diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2019-02-02 12:54:41 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2019-02-02 12:54:41 -0600 |
commit | c7bed5a084324ba94aae5108bac94374ce9dfe39 (patch) | |
tree | c9156a8e7a8cae8767dc17b61215a20bb5dcb253 /src/ca | |
parent | 29159bacb7ac1f88557b5f2fa6e7774c67ecddf7 (diff) | |
download | wix-c7bed5a084324ba94aae5108bac94374ce9dfe39.tar.gz wix-c7bed5a084324ba94aae5108bac94374ce9dfe39.tar.bz2 wix-c7bed5a084324ba94aae5108bac94374ce9dfe39.zip |
Import code from old v4 repo
Diffstat (limited to 'src/ca')
-rw-r--r-- | src/ca/directx.cpp | 49 | ||||
-rw-r--r-- | src/ca/directx.def | 7 | ||||
-rw-r--r-- | src/ca/directx.vcxproj | 47 | ||||
-rw-r--r-- | src/ca/dllmain.cpp | 26 | ||||
-rw-r--r-- | src/ca/precomp.h | 14 |
5 files changed, 143 insertions, 0 deletions
diff --git a/src/ca/directx.cpp b/src/ca/directx.cpp new file mode 100644 index 00000000..21838262 --- /dev/null +++ b/src/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 | /******************************************************************** | ||
6 | WixQueryDirectXCaps - 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 | ********************************************************************/ | ||
12 | extern "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 | |||
44 | LExit: | ||
45 | ReleaseObject(pD3D); | ||
46 | return WcaFinalize(er = FAILED(hr) ? ERROR_INSTALL_FAILURE : er); | ||
47 | } | ||
48 | |||
49 | |||
diff --git a/src/ca/directx.def b/src/ca/directx.def new file mode 100644 index 00000000..5841db88 --- /dev/null +++ b/src/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 | |||
4 | LIBRARY "directx" | ||
5 | |||
6 | EXPORTS | ||
7 | WixQueryDirectXCaps | ||
diff --git a/src/ca/directx.vcxproj b/src/ca/directx.vcxproj new file mode 100644 index 00000000..e4020bcc --- /dev/null +++ b/src/ca/directx.vcxproj | |||
@@ -0,0 +1,47 @@ | |||
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 | |||
4 | |||
5 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
6 | <ItemGroup Label="ProjectConfigurations"> | ||
7 | <ProjectConfiguration Include="Debug|Win32"> | ||
8 | <Configuration>Debug</Configuration> | ||
9 | <Platform>Win32</Platform> | ||
10 | </ProjectConfiguration> | ||
11 | <ProjectConfiguration Include="Release|Win32"> | ||
12 | <Configuration>Release</Configuration> | ||
13 | <Platform>Win32</Platform> | ||
14 | </ProjectConfiguration> | ||
15 | </ItemGroup> | ||
16 | |||
17 | <PropertyGroup Label="Globals"> | ||
18 | <ProjectGuid>{F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}</ProjectGuid> | ||
19 | <ConfigurationType>DynamicLibrary</ConfigurationType> | ||
20 | <CharacterSet>Unicode</CharacterSet> | ||
21 | <TargetName>directx</TargetName> | ||
22 | <ProjectModuleDefinitionFile>directx.def</ProjectModuleDefinitionFile> | ||
23 | </PropertyGroup> | ||
24 | |||
25 | <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.props" /> | ||
26 | |||
27 | <PropertyGroup> | ||
28 | <ProjectAdditionalIncludeDirectories>$(WixRoot)src\libs\dutil\inc;$(WixRoot)src\libs\wcautil</ProjectAdditionalIncludeDirectories> | ||
29 | <ProjectAdditionalLinkLibraries>d3d9.lib;msi.lib;dutil.lib;wcautil.lib</ProjectAdditionalLinkLibraries> | ||
30 | </PropertyGroup> | ||
31 | |||
32 | <ItemGroup> | ||
33 | <ClCompile Include="directx.cpp" /> | ||
34 | <ClCompile Include="dllmain.cpp" /> | ||
35 | </ItemGroup> | ||
36 | <ItemGroup> | ||
37 | <ClInclude Include="precomp.h" /> | ||
38 | </ItemGroup> | ||
39 | <ItemGroup> | ||
40 | <None Include="directx.def" /> | ||
41 | </ItemGroup> | ||
42 | <ItemGroup> | ||
43 | <ResourceCompile Include="directx.rc" /> | ||
44 | </ItemGroup> | ||
45 | |||
46 | <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.targets" /> | ||
47 | </Project> | ||
diff --git a/src/ca/dllmain.cpp b/src/ca/dllmain.cpp new file mode 100644 index 00000000..df53f872 --- /dev/null +++ b/src/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 | /******************************************************************** | ||
6 | DllMain - standard entry point for all WiX CustomActions | ||
7 | |||
8 | ********************************************************************/ | ||
9 | extern "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/ca/precomp.h b/src/ca/precomp.h new file mode 100644 index 00000000..8480f2b2 --- /dev/null +++ b/src/ca/precomp.h | |||
@@ -0,0 +1,14 @@ | |||
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 "wixstrsafe.h" | ||
11 | #include "wcautil.h" | ||
12 | #include "strutil.h" | ||
13 | |||
14 | #include "CustomMsiErrors.h" | ||