use real functions

This commit is contained in:
FunkyFr3sh 2023-08-06 09:25:34 +02:00
parent 1d646e0f4f
commit a28578f925
9 changed files with 62 additions and 54 deletions

View file

@ -133,7 +133,7 @@ HRESULT __stdcall IDirectDraw__QueryInterface(IDirectDrawImpl* This, REFIID riid
g_ddraw->real_dll = LoadLibrary("system32\\ddraw.dll"); g_ddraw->real_dll = LoadLibrary("system32\\ddraw.dll");
if (g_ddraw->real_dll && !g_ddraw->DirectDrawCreate) if (g_ddraw->real_dll && !g_ddraw->DirectDrawCreate)
g_ddraw->DirectDrawCreate = (void*)GetProcAddress(g_ddraw->real_dll, "DirectDrawCreate"); g_ddraw->DirectDrawCreate = (void*)real_GetProcAddress(g_ddraw->real_dll, "DirectDrawCreate");
if (g_ddraw->DirectDrawCreate == DirectDrawCreate) if (g_ddraw->DirectDrawCreate == DirectDrawCreate)
g_ddraw->DirectDrawCreate = NULL; g_ddraw->DirectDrawCreate = NULL;

View file

@ -1218,7 +1218,7 @@ HRESULT dd_CreateEx(GUID* lpGuid, LPVOID* lplpDD, REFIID iid, IUnknown* pUnkOute
InitializeCriticalSection(&g_ddraw->cs); InitializeCriticalSection(&g_ddraw->cs);
g_ddraw->render.sem = CreateSemaphore(NULL, 0, 1, NULL); g_ddraw->render.sem = CreateSemaphore(NULL, 0, 1, NULL);
g_ddraw->wine = GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_version") != 0; g_ddraw->wine = real_GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_version") != 0;
g_blt_use_avx = util_is_avx_supported(); g_blt_use_avx = util_is_avx_supported();
cfg_load(); cfg_load();

View file

@ -111,7 +111,7 @@ void dbg_init()
} }
const char* (CDECL * wine_get_version)() = const char* (CDECL * wine_get_version)() =
(void*)GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_version"); (void*)real_GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_version");
if (wine_get_version) if (wine_get_version)
{ {
@ -119,7 +119,7 @@ void dbg_init()
} }
void (CDECL* wine_get_host_version)(const char** sysname, const char** release) = void (CDECL* wine_get_host_version)(const char** sysname, const char** release) =
(void*)GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_host_version"); (void*)real_GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_host_version");
if (wine_get_host_version) if (wine_get_host_version)
{ {

View file

@ -186,12 +186,14 @@ HRESULT WINAPI fake_DirectInputCreateA(
if (!real_DirectInputCreateA) if (!real_DirectInputCreateA)
{ {
real_DirectInputCreateA = real_DirectInputCreateA =
(DIRECTINPUTCREATEAPROC)GetProcAddress(GetModuleHandle("dinput.dll"), "DirectInputCreateA"); (DIRECTINPUTCREATEAPROC)real_GetProcAddress(GetModuleHandle("dinput.dll"), "DirectInputCreateA");
if (real_DirectInputCreateA == fake_DirectInputCreateA) if (real_DirectInputCreateA == fake_DirectInputCreateA)
{ {
real_DirectInputCreateA = real_DirectInputCreateA =
(DIRECTINPUTCREATEAPROC)GetProcAddress(LoadLibraryA("system32\\dinput.dll"), "DirectInputCreateA"); (DIRECTINPUTCREATEAPROC)real_GetProcAddress(
real_LoadLibraryA("system32\\dinput.dll"),
"DirectInputCreateA");
} }
} }
@ -220,12 +222,14 @@ HRESULT WINAPI fake_DirectInputCreateW(
if (!real_DirectInputCreateW) if (!real_DirectInputCreateW)
{ {
real_DirectInputCreateW = real_DirectInputCreateW =
(DIRECTINPUTCREATEWPROC)GetProcAddress(GetModuleHandle("dinput.dll"), "DirectInputCreateW"); (DIRECTINPUTCREATEWPROC)real_GetProcAddress(GetModuleHandle("dinput.dll"), "DirectInputCreateW");
if (real_DirectInputCreateW == fake_DirectInputCreateW) if (real_DirectInputCreateW == fake_DirectInputCreateW)
{ {
real_DirectInputCreateW = real_DirectInputCreateW =
(DIRECTINPUTCREATEWPROC)GetProcAddress(LoadLibraryA("system32\\dinput.dll"), "DirectInputCreateW"); (DIRECTINPUTCREATEWPROC)real_GetProcAddress(
real_LoadLibraryA("system32\\dinput.dll"),
"DirectInputCreateW");
} }
} }
@ -255,12 +259,14 @@ HRESULT WINAPI fake_DirectInputCreateEx(
if (!real_DirectInputCreateEx) if (!real_DirectInputCreateEx)
{ {
real_DirectInputCreateEx = real_DirectInputCreateEx =
(DIRECTINPUTCREATEEXPROC)GetProcAddress(GetModuleHandle("dinput.dll"), "DirectInputCreateEx"); (DIRECTINPUTCREATEEXPROC)real_GetProcAddress(GetModuleHandle("dinput.dll"), "DirectInputCreateEx");
if (real_DirectInputCreateEx == fake_DirectInputCreateEx) if (real_DirectInputCreateEx == fake_DirectInputCreateEx)
{ {
real_DirectInputCreateEx = real_DirectInputCreateEx =
(DIRECTINPUTCREATEEXPROC)GetProcAddress(LoadLibraryA("system32\\dinput.dll"), "DirectInputCreateEx"); (DIRECTINPUTCREATEEXPROC)real_GetProcAddress(
real_LoadLibraryA("system32\\dinput.dll"),
"DirectInputCreateEx");
} }
} }
@ -300,12 +306,14 @@ HRESULT WINAPI fake_DirectInput8Create(
if (!real_DirectInput8Create) if (!real_DirectInput8Create)
{ {
real_DirectInput8Create = real_DirectInput8Create =
(DIRECTINPUT8CREATEPROC)GetProcAddress(GetModuleHandle("dinput8.dll"), "DirectInput8Create"); (DIRECTINPUT8CREATEPROC)real_GetProcAddress(GetModuleHandle("dinput8.dll"), "DirectInput8Create");
if (real_DirectInput8Create == fake_DirectInput8Create) if (real_DirectInput8Create == fake_DirectInput8Create)
{ {
real_DirectInput8Create = real_DirectInput8Create =
(DIRECTINPUT8CREATEPROC)GetProcAddress(LoadLibraryA("system32\\dinput8.dll"), "DirectInput8Create"); (DIRECTINPUT8CREATEPROC)real_GetProcAddress(
real_LoadLibraryA("system32\\dinput8.dll"),
"DirectInput8Create");
} }
} }
@ -330,7 +338,7 @@ void dinput_hook_init()
{ {
g_dinput_hook_active = TRUE; g_dinput_hook_active = TRUE;
real_DirectInputCreateA = (void*)GetProcAddress(LoadLibraryA("dinput.dll"), "DirectInputCreateA"); real_DirectInputCreateA = (void*)real_GetProcAddress(real_LoadLibraryA("dinput.dll"), "DirectInputCreateA");
if (real_DirectInputCreateA && real_DirectInputCreateA != fake_DirectInputCreateA) if (real_DirectInputCreateA && real_DirectInputCreateA != fake_DirectInputCreateA)
{ {
@ -340,7 +348,7 @@ void dinput_hook_init()
DetourTransactionCommit(); DetourTransactionCommit();
} }
/* Being called from winmm for some reason /* Being called from winmm for some reason
real_DirectInputCreateW = (void*)GetProcAddress(LoadLibraryA("dinput.dll"), "DirectInputCreateW"); real_DirectInputCreateW = (void*)real_GetProcAddress(real_LoadLibraryA("dinput.dll"), "DirectInputCreateW");
if (real_DirectInputCreateW && real_DirectInputCreateW != fake_DirectInputCreateW) if (real_DirectInputCreateW && real_DirectInputCreateW != fake_DirectInputCreateW)
{ {
@ -350,7 +358,7 @@ void dinput_hook_init()
DetourTransactionCommit(); DetourTransactionCommit();
} }
*/ */
real_DirectInputCreateEx = (void*)GetProcAddress(LoadLibraryA("dinput.dll"), "DirectInputCreateEx"); real_DirectInputCreateEx = (void*)real_GetProcAddress(real_LoadLibraryA("dinput.dll"), "DirectInputCreateEx");
if (real_DirectInputCreateEx && real_DirectInputCreateEx != fake_DirectInputCreateEx) if (real_DirectInputCreateEx && real_DirectInputCreateEx != fake_DirectInputCreateEx)
{ {
@ -360,7 +368,7 @@ void dinput_hook_init()
DetourTransactionCommit(); DetourTransactionCommit();
} }
real_DirectInput8Create = (void*)GetProcAddress(LoadLibraryA("dinput8.dll"), "DirectInput8Create"); real_DirectInput8Create = (void*)real_GetProcAddress(real_LoadLibraryA("dinput8.dll"), "DirectInput8Create");
if (real_DirectInput8Create && real_DirectInput8Create != fake_DirectInput8Create) if (real_DirectInput8Create && real_DirectInput8Create != fake_DirectInput8Create)
{ {

View file

@ -74,7 +74,7 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
if (user32_dll) if (user32_dll)
{ {
SETPROCESSDPIAWARENESSCONTEXTPROC set_awareness_context = SETPROCESSDPIAWARENESSCONTEXTPROC set_awareness_context =
(SETPROCESSDPIAWARENESSCONTEXTPROC)GetProcAddress(user32_dll, "SetProcessDpiAwarenessContext"); (SETPROCESSDPIAWARENESSCONTEXTPROC)real_GetProcAddress(user32_dll, "SetProcessDpiAwarenessContext");
if (set_awareness_context) if (set_awareness_context)
{ {
@ -85,7 +85,7 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
if (!set_dpi_aware && shcore_dll) if (!set_dpi_aware && shcore_dll)
{ {
SETPROCESSDPIAWERENESSPROC set_awareness = SETPROCESSDPIAWERENESSPROC set_awareness =
(SETPROCESSDPIAWERENESSPROC)GetProcAddress(shcore_dll, "SetProcessDpiAwareness"); (SETPROCESSDPIAWERENESSPROC)real_GetProcAddress(shcore_dll, "SetProcessDpiAwareness");
if (set_awareness) if (set_awareness)
{ {
@ -98,7 +98,7 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
if (!set_dpi_aware && user32_dll) if (!set_dpi_aware && user32_dll)
{ {
SETPROCESSDPIAWAREPROC set_aware = SETPROCESSDPIAWAREPROC set_aware =
(SETPROCESSDPIAWAREPROC)GetProcAddress(user32_dll, "SetProcessDPIAware"); (SETPROCESSDPIAWAREPROC)real_GetProcAddress(user32_dll, "SetProcessDPIAware");
if (set_aware) if (set_aware)
set_aware(); set_aware();

View file

@ -35,42 +35,42 @@ void fpsl_init()
if (!g_fpsl.gdi32_dll) if (!g_fpsl.gdi32_dll)
{ {
g_fpsl.gdi32_dll = LoadLibraryA("gdi32.dll"); g_fpsl.gdi32_dll = real_LoadLibraryA("gdi32.dll");
} }
if (!g_fpsl.dwmapi_dll) if (!g_fpsl.dwmapi_dll)
{ {
g_fpsl.dwmapi_dll = LoadLibraryA("dwmapi.dll"); g_fpsl.dwmapi_dll = real_LoadLibraryA("dwmapi.dll");
} }
if (!g_fpsl.DwmFlush) if (!g_fpsl.DwmFlush)
{ {
g_fpsl.DwmFlush = g_fpsl.DwmFlush =
(DWMFLUSHPROC)GetProcAddress(g_fpsl.dwmapi_dll, "DwmFlush"); (DWMFLUSHPROC)real_GetProcAddress(g_fpsl.dwmapi_dll, "DwmFlush");
} }
if (!g_fpsl.DwmIsCompositionEnabled) if (!g_fpsl.DwmIsCompositionEnabled)
{ {
g_fpsl.DwmIsCompositionEnabled = g_fpsl.DwmIsCompositionEnabled =
(DWMISCOMPOSITIONENABLEDPROC)GetProcAddress(g_fpsl.dwmapi_dll, "DwmIsCompositionEnabled"); (DWMISCOMPOSITIONENABLEDPROC)real_GetProcAddress(g_fpsl.dwmapi_dll, "DwmIsCompositionEnabled");
} }
if (!g_fpsl.D3DKMTWaitForVerticalBlankEvent) if (!g_fpsl.D3DKMTWaitForVerticalBlankEvent)
{ {
g_fpsl.D3DKMTWaitForVerticalBlankEvent = g_fpsl.D3DKMTWaitForVerticalBlankEvent =
(D3DKMTWAITFORVERTICALBLANKEVENTPROC)GetProcAddress(g_fpsl.gdi32_dll, "D3DKMTWaitForVerticalBlankEvent"); (D3DKMTWAITFORVERTICALBLANKEVENTPROC)real_GetProcAddress(g_fpsl.gdi32_dll, "D3DKMTWaitForVerticalBlankEvent");
} }
if (!g_fpsl.D3DKMTOpenAdapterFromHdc) if (!g_fpsl.D3DKMTOpenAdapterFromHdc)
{ {
g_fpsl.D3DKMTOpenAdapterFromHdc = g_fpsl.D3DKMTOpenAdapterFromHdc =
(D3DKMTOPENADAPTERFROMHDCPROC)GetProcAddress(g_fpsl.gdi32_dll, "D3DKMTOpenAdapterFromHdc"); (D3DKMTOPENADAPTERFROMHDCPROC)real_GetProcAddress(g_fpsl.gdi32_dll, "D3DKMTOpenAdapterFromHdc");
} }
if (!g_fpsl.D3DKMTCloseAdapter) if (!g_fpsl.D3DKMTCloseAdapter)
{ {
g_fpsl.D3DKMTCloseAdapter = g_fpsl.D3DKMTCloseAdapter =
(D3DKMTCLOSEADAPTERPROC)GetProcAddress(g_fpsl.gdi32_dll, "D3DKMTCloseAdapter"); (D3DKMTCLOSEADAPTERPROC)real_GetProcAddress(g_fpsl.gdi32_dll, "D3DKMTCloseAdapter");
} }
g_fpsl.initialized = TRUE; g_fpsl.initialized = TRUE;

View file

@ -202,7 +202,7 @@ void hook_patch_obfuscated_iat_list(HMODULE hmod, BOOL unhook, HOOKLIST* hooks)
for (int x = 0; hooks[i].data[x].function_name[0]; x++) for (int x = 0; hooks[i].data[x].function_name[0]; x++)
{ {
DWORD org_function = DWORD org_function =
(DWORD)GetProcAddress( (DWORD)real_GetProcAddress(
cur_mod, cur_mod,
hooks[i].data[x].function_name); hooks[i].data[x].function_name);
@ -327,7 +327,7 @@ void hook_patch_iat_list(HMODULE hmod, BOOL unhook, HOOKLIST* hooks)
if (unhook) if (unhook)
{ {
DWORD org = DWORD org =
(DWORD)GetProcAddress( (DWORD)real_GetProcAddress(
GetModuleHandle(hooks[i].module_name), GetModuleHandle(hooks[i].module_name),
hooks[i].data[x].function_name); hooks[i].data[x].function_name);

View file

@ -98,30 +98,30 @@ BOOL oglu_load_dll()
if (g_oglu_hmodule) if (g_oglu_hmodule)
{ {
xwglCreateContext = (PFNWGLCREATECONTEXTPROC)GetProcAddress(g_oglu_hmodule, "wglCreateContext"); xwglCreateContext = (PFNWGLCREATECONTEXTPROC)real_GetProcAddress(g_oglu_hmodule, "wglCreateContext");
xwglDeleteContext = (PFNWGLDELETECONTEXTPROC)GetProcAddress(g_oglu_hmodule, "wglDeleteContext"); xwglDeleteContext = (PFNWGLDELETECONTEXTPROC)real_GetProcAddress(g_oglu_hmodule, "wglDeleteContext");
xwglGetProcAddress = (PFNWGLGETPROCADDRESSPROC)GetProcAddress(g_oglu_hmodule, "wglGetProcAddress"); xwglGetProcAddress = (PFNWGLGETPROCADDRESSPROC)real_GetProcAddress(g_oglu_hmodule, "wglGetProcAddress");
xwglMakeCurrent = (PFNWGLMAKECURRENTPROC)GetProcAddress(g_oglu_hmodule, "wglMakeCurrent"); xwglMakeCurrent = (PFNWGLMAKECURRENTPROC)real_GetProcAddress(g_oglu_hmodule, "wglMakeCurrent");
glViewport = (PFNGLVIEWPORTPROC)GetProcAddress(g_oglu_hmodule, "glViewport"); glViewport = (PFNGLVIEWPORTPROC)real_GetProcAddress(g_oglu_hmodule, "glViewport");
glBindTexture = (PFNGLBINDTEXTUREPROC)GetProcAddress(g_oglu_hmodule, "glBindTexture"); glBindTexture = (PFNGLBINDTEXTUREPROC)real_GetProcAddress(g_oglu_hmodule, "glBindTexture");
glGenTextures = (PFNGLGENTEXTURESPROC)GetProcAddress(g_oglu_hmodule, "glGenTextures"); glGenTextures = (PFNGLGENTEXTURESPROC)real_GetProcAddress(g_oglu_hmodule, "glGenTextures");
glTexParameteri = (PFNGLTEXPARAMETERIPROC)GetProcAddress(g_oglu_hmodule, "glTexParameteri"); glTexParameteri = (PFNGLTEXPARAMETERIPROC)real_GetProcAddress(g_oglu_hmodule, "glTexParameteri");
glDeleteTextures = (PFNGLDELETETEXTURESPROC)GetProcAddress(g_oglu_hmodule, "glDeleteTextures"); glDeleteTextures = (PFNGLDELETETEXTURESPROC)real_GetProcAddress(g_oglu_hmodule, "glDeleteTextures");
glTexImage2D = (PFNGLTEXIMAGE2DPROC)GetProcAddress(g_oglu_hmodule, "glTexImage2D"); glTexImage2D = (PFNGLTEXIMAGE2DPROC)real_GetProcAddress(g_oglu_hmodule, "glTexImage2D");
glDrawElements = (PFNGLDRAWELEMENTSPROC)GetProcAddress(g_oglu_hmodule, "glDrawElements"); glDrawElements = (PFNGLDRAWELEMENTSPROC)real_GetProcAddress(g_oglu_hmodule, "glDrawElements");
glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)GetProcAddress(g_oglu_hmodule, "glTexSubImage2D"); glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)real_GetProcAddress(g_oglu_hmodule, "glTexSubImage2D");
glGetError = (PFNGLGETERRORPROC)GetProcAddress(g_oglu_hmodule, "glGetError"); glGetError = (PFNGLGETERRORPROC)real_GetProcAddress(g_oglu_hmodule, "glGetError");
glGetString = (PFNGLGETSTRINGPROC)GetProcAddress(g_oglu_hmodule, "glGetString"); glGetString = (PFNGLGETSTRINGPROC)real_GetProcAddress(g_oglu_hmodule, "glGetString");
glGetTexImage = (PFNGLGETTEXIMAGEPROC)GetProcAddress(g_oglu_hmodule, "glGetTexImage"); glGetTexImage = (PFNGLGETTEXIMAGEPROC)real_GetProcAddress(g_oglu_hmodule, "glGetTexImage");
glPixelStorei = (PFNGLPIXELSTOREIPROC)GetProcAddress(g_oglu_hmodule, "glPixelStorei"); glPixelStorei = (PFNGLPIXELSTOREIPROC)real_GetProcAddress(g_oglu_hmodule, "glPixelStorei");
glEnable = (PFNGLENABLEPROC)GetProcAddress(g_oglu_hmodule, "glEnable"); glEnable = (PFNGLENABLEPROC)real_GetProcAddress(g_oglu_hmodule, "glEnable");
glClear = (PFNGLCLEARPROC)GetProcAddress(g_oglu_hmodule, "glClear"); glClear = (PFNGLCLEARPROC)real_GetProcAddress(g_oglu_hmodule, "glClear");
glBegin = (PFNGLBEGINPROC)GetProcAddress(g_oglu_hmodule, "glBegin"); glBegin = (PFNGLBEGINPROC)real_GetProcAddress(g_oglu_hmodule, "glBegin");
glEnd = (PFNGLENDPROC)GetProcAddress(g_oglu_hmodule, "glEnd"); glEnd = (PFNGLENDPROC)real_GetProcAddress(g_oglu_hmodule, "glEnd");
glTexCoord2f = (PFNGLTEXCOORD2FPROC)GetProcAddress(g_oglu_hmodule, "glTexCoord2f"); glTexCoord2f = (PFNGLTEXCOORD2FPROC)real_GetProcAddress(g_oglu_hmodule, "glTexCoord2f");
glVertex2f = (PFNGLVERTEX2FPROC)GetProcAddress(g_oglu_hmodule, "glVertex2f"); glVertex2f = (PFNGLVERTEX2FPROC)real_GetProcAddress(g_oglu_hmodule, "glVertex2f");
} }
return xwglCreateContext && xwglDeleteContext && xwglGetProcAddress && xwglMakeCurrent && glViewport && return xwglCreateContext && xwglDeleteContext && xwglGetProcAddress && xwglMakeCurrent && glViewport &&

View file

@ -26,7 +26,7 @@ BOOL d3d9_is_available()
if ((g_d3d9.hmodule = LoadLibrary("d3d9.dll"))) if ((g_d3d9.hmodule = LoadLibrary("d3d9.dll")))
{ {
IDirect3D9* (WINAPI * d3d_create9)(UINT) = IDirect3D9* (WINAPI * d3d_create9)(UINT) =
(IDirect3D9 * (WINAPI*)(UINT))GetProcAddress(g_d3d9.hmodule, "Direct3DCreate9"); (IDirect3D9 * (WINAPI*)(UINT))real_GetProcAddress(g_d3d9.hmodule, "Direct3DCreate9");
if (d3d_create9 && (d3d9 = d3d_create9(D3D_SDK_VERSION))) if (d3d_create9 && (d3d9 = d3d_create9(D3D_SDK_VERSION)))
IDirect3D9_Release(d3d9); IDirect3D9_Release(d3d9);
@ -52,7 +52,7 @@ BOOL d3d9_create()
if (g_ddraw->nonexclusive) if (g_ddraw->nonexclusive)
{ {
int (WINAPI * d3d9_enable_shim)(BOOL) = int (WINAPI * d3d9_enable_shim)(BOOL) =
(int (WINAPI*)(BOOL))GetProcAddress(g_d3d9.hmodule, "Direct3D9EnableMaximizedWindowedModeShim"); (int (WINAPI*)(BOOL))real_GetProcAddress(g_d3d9.hmodule, "Direct3D9EnableMaximizedWindowedModeShim");
if (d3d9_enable_shim) if (d3d9_enable_shim)
d3d9_enable_shim(TRUE); d3d9_enable_shim(TRUE);
@ -68,11 +68,11 @@ BOOL d3d9_create()
if (g_ddraw->d3d9on12) if (g_ddraw->d3d9on12)
{ {
d3d_create9on12 = (void*)GetProcAddress(g_d3d9.hmodule, "Direct3DCreate9On12"); d3d_create9on12 = (void*)real_GetProcAddress(g_d3d9.hmodule, "Direct3DCreate9On12");
} }
else else
{ {
d3d_create9 = (void*)GetProcAddress(g_d3d9.hmodule, "Direct3DCreate9"); d3d_create9 = (void*)real_GetProcAddress(g_d3d9.hmodule, "Direct3DCreate9");
} }
if ((d3d_create9on12 && (d3d9on12 = g_d3d9.instance = d3d_create9on12(D3D_SDK_VERSION, &args, 1))) || if ((d3d_create9on12 && (d3d9on12 = g_d3d9.instance = d3d_create9on12(D3D_SDK_VERSION, &args, 1))) ||