blob: 21838262040c3847b083262de5232c7166a34169 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// 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.
#include "precomp.h"
/********************************************************************
WixQueryDirectXCaps - entry point for WixQueryDirectXCaps CA
Called as Type 1 custom action (DLL from the Binary table) from
Windows Installer to set properties that identify the DirectX
capabilities ("caps") of the system.
********************************************************************/
extern "C" UINT __stdcall WixQueryDirectXCaps(
__in MSIHANDLE hInstall
)
{
#if 0
::MessageBoxA(0, "break into debugger now please", "---->> ATTACH TO ME!", MB_ICONEXCLAMATION);
#endif
HRESULT hr = S_OK;
DWORD er = ERROR_SUCCESS;
LPDIRECT3D9 pD3D = NULL;
hr = WcaInitialize(hInstall, "WixQueryDirectXCaps");
ExitOnFailure(hr, "failed to initialize");
pD3D = Direct3DCreate9(D3D_SDK_VERSION);
ExitOnNull(pD3D, hr, E_FAIL, "Direct3DCreate9 failed");
D3DCAPS9 d3dCaps;
hr = pD3D->GetDeviceCaps(
0, // first adapter
D3DDEVTYPE_HAL, // fail on non-HAL devices
&d3dCaps
);
ExitOnFailure(hr, "GetDeviceCaps call failed");
int iVertexShaderVersion = D3DSHADER_VERSION_MAJOR(d3dCaps.VertexShaderVersion) * 100 + D3DSHADER_VERSION_MINOR(d3dCaps.VertexShaderVersion);
WcaSetIntProperty(L"WIX_DIRECTX_VERTEXSHADERVERSION", iVertexShaderVersion);
int iPixelShaderVersion = D3DSHADER_VERSION_MAJOR(d3dCaps.PixelShaderVersion) * 100 + D3DSHADER_VERSION_MINOR(d3dCaps.PixelShaderVersion);
WcaSetIntProperty(L"WIX_DIRECTX_PIXELSHADERVERSION", iPixelShaderVersion);
LExit:
ReleaseObject(pD3D);
return WcaFinalize(er = FAILED(hr) ? ERROR_INSTALL_FAILURE : er);
}
|