From fe2f7e06c595a4e7115d83c4cc8a05b28db5002a Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 4 May 2021 22:45:02 -0700 Subject: Move DirectX.wixext into ext --- src/ext/DirectX/ca/directx.cpp | 49 +++++++++++++++++++++++++ src/ext/DirectX/ca/directx.def | 7 ++++ src/ext/DirectX/ca/directxca.vcxproj | 70 ++++++++++++++++++++++++++++++++++++ src/ext/DirectX/ca/dllmain.cpp | 26 ++++++++++++++ src/ext/DirectX/ca/packages.config | 5 +++ src/ext/DirectX/ca/precomp.h | 11 ++++++ 6 files changed, 168 insertions(+) create mode 100644 src/ext/DirectX/ca/directx.cpp create mode 100644 src/ext/DirectX/ca/directx.def create mode 100644 src/ext/DirectX/ca/directxca.vcxproj create mode 100644 src/ext/DirectX/ca/dllmain.cpp create mode 100644 src/ext/DirectX/ca/packages.config create mode 100644 src/ext/DirectX/ca/precomp.h (limited to 'src/ext/DirectX/ca') 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 @@ +// 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); +} + + 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 @@ +; 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. + + +LIBRARY "directxca" + +EXPORTS + 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 @@ + + + + + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM64 + + + Release + ARM64 + + + + + {76542B28-0FFD-47D3-AD6A-D0F20FA875AC} + DynamicLibrary + v142 + Unicode + directxca + directx.def + WiX Toolset DirectX CustomAction + + + + + + + d3d9.lib;msi.lib + + + + + + Create + + + + + + + + + + + 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}. + + + + + \ 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 @@ +// 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" + +/******************************************************************** +DllMain - standard entry point for all WiX CustomActions + +********************************************************************/ +extern "C" BOOL WINAPI DllMain( + IN HINSTANCE hInst, + IN ULONG ulReason, + IN LPVOID) +{ + switch(ulReason) + { + case DLL_PROCESS_ATTACH: + WcaGlobalInitialize(hInst); + break; + + case DLL_PROCESS_DETACH: + WcaGlobalFinalize(); + break; + } + + return TRUE; +} 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 @@ + + + + + \ 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 @@ +#pragma once +// 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 +#include +#include +#include + +#include "wcautil.h" +#include "strutil.h" -- cgit v1.2.3-55-g6feb