1 /**************************************************************************
3 * Copyright 2012 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 **************************************************************************/
28 *Stubs for internal D3D11 functions.
34 #include "d3d11imports.hpp"
37 static HMODULE g_hD3D11Module = NULL;
41 _getD3D11ProcAddress(LPCSTR lpProcName) {
42 if (!g_hD3D11Module) {
43 char szDll[MAX_PATH] = {0};
44 if (!GetSystemDirectoryA(szDll, MAX_PATH)) {
47 strcat(szDll, "\\\\d3d11.dll");
48 g_hD3D11Module = LoadLibraryA(szDll);
49 if (!g_hD3D11Module) {
53 return GetProcAddress(g_hD3D11Module, lpProcName);
57 typedef HRESULT (WINAPI *PFN_D3D11COREREGISTERLAYERS)(const void *unknown0, DWORD unknown1);
58 static PFN_D3D11COREREGISTERLAYERS _D3D11CoreRegisterLayers_ptr = NULL;
60 EXTERN_C HRESULT WINAPI
61 D3D11CoreRegisterLayers(const void *unknown0, DWORD unknown1) {
62 const char *_name = "D3D11CoreRegisterLayers";
63 if (!_D3D11CoreRegisterLayers_ptr) {
64 _D3D11CoreRegisterLayers_ptr = (PFN_D3D11COREREGISTERLAYERS)_getD3D11ProcAddress(_name);
65 if (!_D3D11CoreRegisterLayers_ptr) {
66 os::log("error: unavailable function %s\n", _name);
70 return _D3D11CoreRegisterLayers_ptr(unknown0, unknown1);
73 typedef SIZE_T (WINAPI *PFN_D3D11COREGETLAYEREDDEVICESIZE)(const void *unknown0, DWORD unknown1);
74 static PFN_D3D11COREGETLAYEREDDEVICESIZE _D3D11CoreGetLayeredDeviceSize_ptr = NULL;
76 EXTERN_C SIZE_T WINAPI
77 D3D11CoreGetLayeredDeviceSize(const void *unknown0, DWORD unknown1) {
78 const char *_name = "D3D11CoreGetLayeredDeviceSize";
79 if (!_D3D11CoreGetLayeredDeviceSize_ptr) {
80 _D3D11CoreGetLayeredDeviceSize_ptr = (PFN_D3D11COREGETLAYEREDDEVICESIZE)_getD3D11ProcAddress(_name);
81 if (!_D3D11CoreGetLayeredDeviceSize_ptr) {
82 os::log("error: unavailable function %s\n", _name);
86 return _D3D11CoreGetLayeredDeviceSize_ptr(unknown0, unknown1);
89 typedef HRESULT (WINAPI *PFN_D3D11CORECREATELAYEREDDEVICE)(const void *unknown0, DWORD unknown1, const void *unknown2, REFIID riid, void **ppvObj);
90 static PFN_D3D11CORECREATELAYEREDDEVICE _D3D11CoreCreateLayeredDevice_ptr = NULL;
92 EXTERN_C HRESULT WINAPI
93 D3D11CoreCreateLayeredDevice(const void *unknown0, DWORD unknown1, const void *unknown2, REFIID riid, void **ppvObj) {
94 const char *_name = "D3D11CoreCreateLayeredDevice";
95 if (!_D3D11CoreCreateLayeredDevice_ptr) {
96 _D3D11CoreCreateLayeredDevice_ptr = (PFN_D3D11CORECREATELAYEREDDEVICE)_getD3D11ProcAddress(_name);
97 if (!_D3D11CoreCreateLayeredDevice_ptr) {
98 os::log("error: unavailable function %s\n", _name);
102 return _D3D11CoreCreateLayeredDevice_ptr(unknown0, unknown1, unknown2, riid, ppvObj);
105 typedef HRESULT (WINAPI *PFN_D3D11CORECREATEDEVICE)(DWORD unknown0, DWORD unknown1, DWORD unknown2, DWORD unknown3, DWORD unknown4, DWORD unknown5, DWORD unknown6, DWORD unknown7, DWORD unknown8);
106 static PFN_D3D11CORECREATEDEVICE _D3D11CoreCreateDevice_ptr = NULL;
108 EXTERN_C HRESULT WINAPI
109 D3D11CoreCreateDevice(DWORD unknown0, DWORD unknown1, DWORD unknown2, DWORD unknown3, DWORD unknown4, DWORD unknown5, DWORD unknown6, DWORD unknown7, DWORD unknown8) {
110 const char *_name = "D3D11CoreCreateDevice";
111 if (!_D3D11CoreCreateDevice_ptr) {
112 _D3D11CoreCreateDevice_ptr = (PFN_D3D11CORECREATEDEVICE)_getD3D11ProcAddress(_name);
113 if (!_D3D11CoreCreateDevice_ptr) {
114 os::log("error: unavailable function %s\n", _name);
118 return _D3D11CoreCreateDevice_ptr(unknown0, unknown1, unknown2, unknown3, unknown4, unknown5, unknown6, unknown7, unknown8);