aboutsummaryrefslogtreecommitdiff
path: root/src/ext/DirectX/ca/directx.cpp
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-05-04 22:45:02 -0700
committerRob Mensching <rob@firegiant.com>2021-05-04 22:45:02 -0700
commitfe2f7e06c595a4e7115d83c4cc8a05b28db5002a (patch)
tree8f46339d2ccbc2ec97c9e77e857bd72f07412a2e /src/ext/DirectX/ca/directx.cpp
parent232ea0120f67d4d445fd5fbb09a8852b2668310a (diff)
downloadwix-fe2f7e06c595a4e7115d83c4cc8a05b28db5002a.tar.gz
wix-fe2f7e06c595a4e7115d83c4cc8a05b28db5002a.tar.bz2
wix-fe2f7e06c595a4e7115d83c4cc8a05b28db5002a.zip
Move DirectX.wixext into ext
Diffstat (limited to 'src/ext/DirectX/ca/directx.cpp')
-rw-r--r--src/ext/DirectX/ca/directx.cpp49
1 files changed, 49 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