aboutsummaryrefslogtreecommitdiff
path: root/src/ext/DirectX/ca
diff options
context:
space:
mode:
Diffstat (limited to 'src/ext/DirectX/ca')
-rw-r--r--src/ext/DirectX/ca/directx.cpp49
-rw-r--r--src/ext/DirectX/ca/directx.def7
-rw-r--r--src/ext/DirectX/ca/directxca.vcxproj70
-rw-r--r--src/ext/DirectX/ca/dllmain.cpp26
-rw-r--r--src/ext/DirectX/ca/packages.config5
-rw-r--r--src/ext/DirectX/ca/precomp.h11
6 files changed, 168 insertions, 0 deletions
diff --git a/src/ext/DirectX/ca/directx.cpp b/src/ext/DirectX/ca/directx.cpp
new file mode 100644
index 00000000..21838262
--- /dev/null
+++ b/src/ext/DirectX/ca/directx.cpp
@@ -0,0 +1,49 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3#include "precomp.h"
4
5/********************************************************************
6WixQueryDirectXCaps - entry point for WixQueryDirectXCaps CA
7
8 Called as Type 1 custom action (DLL from the Binary table) from
9 Windows Installer to set properties that identify the DirectX
10 capabilities ("caps") of the system.
11********************************************************************/
12extern "C" UINT __stdcall WixQueryDirectXCaps(
13 __in MSIHANDLE hInstall
14 )
15{
16#if 0
17 ::MessageBoxA(0, "break into debugger now please", "---->> ATTACH TO ME!", MB_ICONEXCLAMATION);
18#endif
19
20 HRESULT hr = S_OK;
21 DWORD er = ERROR_SUCCESS;
22 LPDIRECT3D9 pD3D = NULL;
23
24 hr = WcaInitialize(hInstall, "WixQueryDirectXCaps");
25 ExitOnFailure(hr, "failed to initialize");
26
27 pD3D = Direct3DCreate9(D3D_SDK_VERSION);
28 ExitOnNull(pD3D, hr, E_FAIL, "Direct3DCreate9 failed");
29
30 D3DCAPS9 d3dCaps;
31 hr = pD3D->GetDeviceCaps(
32 0, // first adapter
33 D3DDEVTYPE_HAL, // fail on non-HAL devices
34 &d3dCaps
35 );
36 ExitOnFailure(hr, "GetDeviceCaps call failed");
37
38 int iVertexShaderVersion = D3DSHADER_VERSION_MAJOR(d3dCaps.VertexShaderVersion) * 100 + D3DSHADER_VERSION_MINOR(d3dCaps.VertexShaderVersion);
39 WcaSetIntProperty(L"WIX_DIRECTX_VERTEXSHADERVERSION", iVertexShaderVersion);
40
41 int iPixelShaderVersion = D3DSHADER_VERSION_MAJOR(d3dCaps.PixelShaderVersion) * 100 + D3DSHADER_VERSION_MINOR(d3dCaps.PixelShaderVersion);
42 WcaSetIntProperty(L"WIX_DIRECTX_PIXELSHADERVERSION", iPixelShaderVersion);
43
44LExit:
45 ReleaseObject(pD3D);
46 return WcaFinalize(er = FAILED(hr) ? ERROR_INSTALL_FAILURE : er);
47}
48
49
diff --git a/src/ext/DirectX/ca/directx.def b/src/ext/DirectX/ca/directx.def
new file mode 100644
index 00000000..8f46f9a8
--- /dev/null
+++ b/src/ext/DirectX/ca/directx.def
@@ -0,0 +1,7 @@
1; Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3
4LIBRARY "directxca"
5
6EXPORTS
7 WixQueryDirectXCaps
diff --git a/src/ext/DirectX/ca/directxca.vcxproj b/src/ext/DirectX/ca/directxca.vcxproj
new file mode 100644
index 00000000..e772009a
--- /dev/null
+++ b/src/ext/DirectX/ca/directxca.vcxproj
@@ -0,0 +1,70 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
4 <Import Project="..\..\packages\WixToolset.DUtil.4.0.30\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.30\build\WixToolset.DUtil.props')" />
5 <Import Project="..\..\packages\WixToolset.WcaUtil.4.0.16\build\WixToolset.WcaUtil.props" Condition="Exists('..\..\packages\WixToolset.WcaUtil.4.0.16\build\WixToolset.WcaUtil.props')" />
6
7 <ItemGroup Label="ProjectConfigurations">
8 <ProjectConfiguration Include="Debug|Win32">
9 <Configuration>Debug</Configuration>
10 <Platform>Win32</Platform>
11 </ProjectConfiguration>
12 <ProjectConfiguration Include="Release|Win32">
13 <Configuration>Release</Configuration>
14 <Platform>Win32</Platform>
15 </ProjectConfiguration>
16 <ProjectConfiguration Include="Debug|x64">
17 <Configuration>Debug</Configuration>
18 <Platform>x64</Platform>
19 </ProjectConfiguration>
20 <ProjectConfiguration Include="Release|x64">
21 <Configuration>Release</Configuration>
22 <Platform>x64</Platform>
23 </ProjectConfiguration>
24 <ProjectConfiguration Include="Debug|ARM64">
25 <Configuration>Debug</Configuration>
26 <Platform>ARM64</Platform>
27 </ProjectConfiguration>
28 <ProjectConfiguration Include="Release|ARM64">
29 <Configuration>Release</Configuration>
30 <Platform>ARM64</Platform>
31 </ProjectConfiguration>
32 </ItemGroup>
33
34 <PropertyGroup Label="Globals">
35 <ProjectGuid>{76542B28-0FFD-47D3-AD6A-D0F20FA875AC}</ProjectGuid>
36 <ConfigurationType>DynamicLibrary</ConfigurationType>
37 <PlatformToolset>v142</PlatformToolset>
38 <CharacterSet>Unicode</CharacterSet>
39 <TargetName>directxca</TargetName>
40 <ProjectModuleDefinitionFile>directx.def</ProjectModuleDefinitionFile>
41 <Description>WiX Toolset DirectX CustomAction</Description>
42 </PropertyGroup>
43
44 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
45 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
46
47 <PropertyGroup>
48 <ProjectAdditionalLinkLibraries>d3d9.lib;msi.lib</ProjectAdditionalLinkLibraries>
49 </PropertyGroup>
50
51 <ItemGroup>
52 <ClCompile Include="directx.cpp" />
53 <ClCompile Include="dllmain.cpp">
54 <PrecompiledHeader>Create</PrecompiledHeader>
55 </ClCompile>
56 <ClInclude Include="precomp.h" />
57 <None Include="directx.def" />
58 <None Include="packages.config" />
59 </ItemGroup>
60
61 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
62
63 <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
64 <PropertyGroup>
65 <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>
66 </PropertyGroup>
67 <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.30\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.30\build\WixToolset.DUtil.props'))" />
68 <Error Condition="!Exists('..\..\packages\WixToolset.WcaUtil.4.0.16\build\WixToolset.WcaUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.WcaUtil.4.0.16\build\WixToolset.WcaUtil.props'))" />
69 </Target>
70</Project> \ No newline at end of file
diff --git a/src/ext/DirectX/ca/dllmain.cpp b/src/ext/DirectX/ca/dllmain.cpp
new file mode 100644
index 00000000..df53f872
--- /dev/null
+++ b/src/ext/DirectX/ca/dllmain.cpp
@@ -0,0 +1,26 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3#include "precomp.h"
4
5/********************************************************************
6DllMain - standard entry point for all WiX CustomActions
7
8********************************************************************/
9extern "C" BOOL WINAPI DllMain(
10 IN HINSTANCE hInst,
11 IN ULONG ulReason,
12 IN LPVOID)
13{
14 switch(ulReason)
15 {
16 case DLL_PROCESS_ATTACH:
17 WcaGlobalInitialize(hInst);
18 break;
19
20 case DLL_PROCESS_DETACH:
21 WcaGlobalFinalize();
22 break;
23 }
24
25 return TRUE;
26}
diff --git a/src/ext/DirectX/ca/packages.config b/src/ext/DirectX/ca/packages.config
new file mode 100644
index 00000000..e3dc0e43
--- /dev/null
+++ b/src/ext/DirectX/ca/packages.config
@@ -0,0 +1,5 @@
1<?xml version="1.0" encoding="utf-8"?>
2<packages>
3 <package id="WixToolset.DUtil" version="4.0.30" targetFramework="native" />
4 <package id="WixToolset.WcaUtil" version="4.0.16" targetFramework="native" />
5</packages> \ No newline at end of file
diff --git a/src/ext/DirectX/ca/precomp.h b/src/ext/DirectX/ca/precomp.h
new file mode 100644
index 00000000..75a15829
--- /dev/null
+++ b/src/ext/DirectX/ca/precomp.h
@@ -0,0 +1,11 @@
1#pragma once
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5#include <windows.h>
6#include <msidefs.h>
7#include <msiquery.h>
8#include <D3D9.h>
9
10#include "wcautil.h"
11#include "strutil.h"