Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/UndockedRegFreeWinRT/TestComponent/Class.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "pch.h"
#include "Class.h"
#include "Class.g.cpp"

namespace winrt::TestComponent::implementation
{
int32_t Class::Apartment()
{
APTTYPE aptType;
APTTYPEQUALIFIER aptQualifier;
check_hresult(CoGetApartmentType(&aptType, &aptQualifier));
return aptType;
}

void Class::Apartment(int32_t /* value */)
{
throw hresult_not_implemented();
}
}
21 changes: 21 additions & 0 deletions src/UndockedRegFreeWinRT/TestComponent/Class.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

#include "Class.g.h"

namespace winrt::TestComponent::implementation
{
struct Class : ClassT<Class>
{
Class() = default;

int32_t Apartment();
void Apartment(int32_t value);
};
}

namespace winrt::TestComponent::factory_implementation
{
struct Class : ClassT<Class, implementation::Class>
{
};
}
9 changes: 9 additions & 0 deletions src/UndockedRegFreeWinRT/TestComponent/Class.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace TestComponent
{
[default_interface]
runtimeclass Class
{
Class();
Int32 Apartment;
}
}
16 changes: 16 additions & 0 deletions src/UndockedRegFreeWinRT/TestComponent/PropertySheet.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<!--
To customize common C++/WinRT project properties:
* right-click the project node
* expand the Common Properties item
* select the C++/WinRT property page
For more advanced scenarios, and complete documentation, please see:
https://github.com/Microsoft/cppwinrt/tree/master/nuget
-->
<PropertyGroup />
<ItemDefinitionGroup />
</Project>
3 changes: 3 additions & 0 deletions src/UndockedRegFreeWinRT/TestComponent/TestComponent.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
EXPORTS
DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE
DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE
175 changes: 175 additions & 0 deletions src/UndockedRegFreeWinRT/TestComponent/TestComponent.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.200117.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200117.5\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
<MinimalCoreWin>true</MinimalCoreWin>
<ProjectGuid>{e63dc9f0-834c-42c8-9392-13b0531a9959}</ProjectGuid>
<ProjectName>TestComponent</ProjectName>
<RootNamespace>TestComponent</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
<WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.17134.0</WindowsTargetPlatformMinVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<GenerateManifest>false</GenerateManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="PropertySheet.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<OutDir>$(BuildOutDir)</OutDir>
<IntDir>$(OutDir)$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<OutDir>$(BuildOutDir)</OutDir>
<IntDir>$(OutDir)$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(BuildOutDir)</OutDir>
<IntDir>$(OutDir)$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(BuildOutDir)</OutDir>
<IntDir>$(OutDir)$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(BuildOutDir)</OutDir>
<IntDir>$(OutDir)$(ProjectName)</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(BuildOutDir)</OutDir>
<IntDir>$(OutDir)$(ProjectName)</IntDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<WarningLevel>Level4</WarningLevel>
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
<!--Temporarily disable cppwinrt heap enforcement to work around xaml compiler generated std::shared_ptr use -->
<AdditionalOptions Condition="'$(CppWinRTHeapEnforcement)'==''">/DWINRT_NO_MAKE_DETECTION %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>
</DisableSpecificWarnings>
<PreprocessorDefinitions>_WINRT_DLL;WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
<ModuleDefinitionFile>TestComponent.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="Class.h">
<DependentUpon>Class.idl</DependentUpon>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Class.cpp">
<DependentUpon>Class.idl</DependentUpon>
</ClCompile>
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
</ItemGroup>
<ItemGroup>
<Midl Include="Class.idl" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="TestComponent.def" />
</ItemGroup>
<ItemGroup>
<None Include="PropertySheet.props" />
<Text Include="readme.txt">
<DeploymentContent>false</DeploymentContent>
</Text>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.200117.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200117.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\packages\Microsoft.VCRTForwarders.140.1.0.5\build\native\Microsoft.VCRTForwarders.140.targets" Condition="Exists('..\packages\Microsoft.VCRTForwarders.140.1.0.5\build\native\Microsoft.VCRTForwarders.140.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200117.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.200117.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200117.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.200117.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.VCRTForwarders.140.1.0.5\build\native\Microsoft.VCRTForwarders.140.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VCRTForwarders.140.1.0.5\build\native\Microsoft.VCRTForwarders.140.targets'))" />
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Resources">
<UniqueIdentifier>accd3aa8-1ba0-4223-9bbe-0c431709210b</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{926ab91d-31b4-48c3-b9a4-e681349f27f0}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp" />
<ClCompile Include="Class.cpp" />
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<Midl Include="Class.idl" />
</ItemGroup>
<ItemGroup>
<None Include="TestComponent.def" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<None Include="PropertySheet.props" />
</ItemGroup>
<ItemGroup>
<Text Include="readme.txt" />
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions src/UndockedRegFreeWinRT/TestComponent/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.VCRTForwarders.140" version="1.0.5" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.200117.5" targetFramework="native" />
</packages>
1 change: 1 addition & 0 deletions src/UndockedRegFreeWinRT/TestComponent/pch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "pch.h"
4 changes: 4 additions & 0 deletions src/UndockedRegFreeWinRT/TestComponent/pch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#pragma once
#include <unknwn.h>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>
23 changes: 23 additions & 0 deletions src/UndockedRegFreeWinRT/TestComponent/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
========================================================================
C++/WinRT TestComponent Project Overview
========================================================================

This project demonstrates how to get started authoring Windows Runtime
classes directly with standard C++, using the C++/WinRT SDK component
to generate implementation headers from interface (IDL) files. The
generated Windows Runtime component binary and WinMD files should then
be bundled with the Universal Windows Platform (UWP) app consuming them.

Steps:
1. Create an interface (IDL) file to define your Windows Runtime class,
its default interface, and any other interfaces it implements.
2. Build the project once to generate module.g.cpp, module.h.cpp, and
implementation templates under the "Generated Files" folder, as
well as skeleton class definitions under "Generated Files\sources".
3. Use the skeleton class definitions for reference to implement your
Windows Runtime classes.

========================================================================
Learn more about C++/WinRT here:
http://aka.ms/cppwinrt/
========================================================================
31 changes: 15 additions & 16 deletions src/UndockedRegFreeWinRT/UndockedRegFreeWinRT.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UndockedRegFreeWinRT", "Und
{787EC629-C0FB-4BA9-9746-4A82CD06B73E} = {787EC629-C0FB-4BA9-9746-4A82CD06B73E}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "detours", "detours\detours.vcxproj", "{787EC629-C0FB-4BA9-9746-4A82CD06B73E}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Detours", "detours\detours.vcxproj", "{787EC629-C0FB-4BA9-9746-4A82CD06B73E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UndockedRegFreeWinRTTest", "UndockedRegFreeWinRTTest\UndockedRegFreeWinRTTest.vcxproj", "{DD92B07F-ED53-4318-A775-017AEEF2324F}"
ProjectSection(ProjectDependencies) = postProject
{883D007C-C5E5-4BD6-8693-D683CA7F182A} = {883D007C-C5E5-4BD6-8693-D683CA7F182A}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestComp", "TestComp\TestComp.vcxproj", "{883D007C-C5E5-4BD6-8693-D683CA7F182A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1E15BC1E-A4E7-4EC2-9E9B-855324963431}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestComponent", "TestComponent\TestComponent.vcxproj", "{E63DC9F0-834C-42C8-9392-13B0531A9959}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Expand Down Expand Up @@ -62,16 +59,18 @@ Global
{DD92B07F-ED53-4318-A775-017AEEF2324F}.Release|x64.Build.0 = Release|x64
{DD92B07F-ED53-4318-A775-017AEEF2324F}.Release|x86.ActiveCfg = Release|Win32
{DD92B07F-ED53-4318-A775-017AEEF2324F}.Release|x86.Build.0 = Release|Win32
{883D007C-C5E5-4BD6-8693-D683CA7F182A}.Debug|ARM.ActiveCfg = Debug|Win32
{883D007C-C5E5-4BD6-8693-D683CA7F182A}.Debug|x64.ActiveCfg = Debug|x64
{883D007C-C5E5-4BD6-8693-D683CA7F182A}.Debug|x64.Build.0 = Debug|x64
{883D007C-C5E5-4BD6-8693-D683CA7F182A}.Debug|x86.ActiveCfg = Debug|Win32
{883D007C-C5E5-4BD6-8693-D683CA7F182A}.Debug|x86.Build.0 = Debug|Win32
{883D007C-C5E5-4BD6-8693-D683CA7F182A}.Release|ARM.ActiveCfg = Release|Win32
{883D007C-C5E5-4BD6-8693-D683CA7F182A}.Release|x64.ActiveCfg = Release|x64
{883D007C-C5E5-4BD6-8693-D683CA7F182A}.Release|x64.Build.0 = Release|x64
{883D007C-C5E5-4BD6-8693-D683CA7F182A}.Release|x86.ActiveCfg = Release|Win32
{883D007C-C5E5-4BD6-8693-D683CA7F182A}.Release|x86.Build.0 = Release|Win32
{E63DC9F0-834C-42C8-9392-13B0531A9959}.Debug|ARM.ActiveCfg = Debug|ARM
{E63DC9F0-834C-42C8-9392-13B0531A9959}.Debug|ARM.Build.0 = Debug|ARM
{E63DC9F0-834C-42C8-9392-13B0531A9959}.Debug|x64.ActiveCfg = Debug|x64
{E63DC9F0-834C-42C8-9392-13B0531A9959}.Debug|x64.Build.0 = Debug|x64
{E63DC9F0-834C-42C8-9392-13B0531A9959}.Debug|x86.ActiveCfg = Debug|Win32
{E63DC9F0-834C-42C8-9392-13B0531A9959}.Debug|x86.Build.0 = Debug|Win32
{E63DC9F0-834C-42C8-9392-13B0531A9959}.Release|ARM.ActiveCfg = Release|ARM
{E63DC9F0-834C-42C8-9392-13B0531A9959}.Release|ARM.Build.0 = Release|ARM
{E63DC9F0-834C-42C8-9392-13B0531A9959}.Release|x64.ActiveCfg = Release|x64
{E63DC9F0-834C-42C8-9392-13B0531A9959}.Release|x64.Build.0 = Release|x64
{E63DC9F0-834C-42C8-9392-13B0531A9959}.Release|x86.ActiveCfg = Release|Win32
{E63DC9F0-834C-42C8-9392-13B0531A9959}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading