From c7bed5a084324ba94aae5108bac94374ce9dfe39 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 2 Feb 2019 12:54:41 -0600 Subject: Import code from old v4 repo --- src/ca/directx.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ src/ca/directx.def | 7 +++++++ src/ca/directx.vcxproj | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/ca/dllmain.cpp | 26 ++++++++++++++++++++++++++ src/ca/precomp.h | 14 ++++++++++++++ 5 files changed, 143 insertions(+) create mode 100644 src/ca/directx.cpp create mode 100644 src/ca/directx.def create mode 100644 src/ca/directx.vcxproj create mode 100644 src/ca/dllmain.cpp create mode 100644 src/ca/precomp.h (limited to 'src/ca') 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 @@ +// 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/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 @@ +; 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 "directx" + +EXPORTS + 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 @@ + + + + + + + + Debug + Win32 + + + Release + Win32 + + + + + {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981} + DynamicLibrary + Unicode + directx + directx.def + + + + + + $(WixRoot)src\libs\dutil\inc;$(WixRoot)src\libs\wcautil + d3d9.lib;msi.lib;dutil.lib;wcautil.lib + + + + + + + + + + + + + + + + + + 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 @@ +// 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/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 @@ +#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 "wixstrsafe.h" +#include "wcautil.h" +#include "strutil.h" + +#include "CustomMsiErrors.h" -- cgit v1.2.3-55-g6feb