// Exported function (faking d3d9.dll's one-and-only export) IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion) { bool Load = false; if (!gl_hOriginalDll) { LoadOriginalDll(); // looking for the "right d3d9.dll" Load = true; } // Hooking IDirect3D Object from Original Library typedef IDirect3D9 *(WINAPI* D3D9_Type)(UINT SDKVersion); D3D9_Type D3DCreate9_fn = (D3D9_Type) GetProcAddress( gl_hOriginalDll, "Direct3DCreate9"); // Debug if (!D3DCreate9_fn) { OutputDebugString("PROXYDLL: Pointer to original D3DCreate9 function not received ERROR ****\r\n"); ::ExitProcess(0); // exit the hard way } // Request pointer from Original Dll. IDirect3D9 *pIDirect3D9_orig = D3DCreate9_fn(SDKVersion); // Create my IDirect3D8 object and store pointer to original object there. // note: the object will delete itself once Ref count is zero (similar to COM objects) gl_pmyIDirect3D9 = new myIDirect3D9(pIDirect3D9_orig); //if(Load) // SDX::OnLoad(); // Return pointer to hooking Object instead of "real one" return (gl_pmyIDirect3D9); }
// Exported function (faking d3d9.dll's one-and-only export) IDirect3D9* WINAPI Direct3DCreate9( UINT SDKVersion ) { if( !gl_hOriginalDll ) LoadOriginalDll(); // looking for the "right d3d9.dll" // Hooking IDirect3D Object from Original Library typedef IDirect3D9 *(WINAPI* D3D9_Type)(UINT SDKVersion); D3D9_Type D3DCreate9_fn = (D3D9_Type)GetProcAddress( gl_hOriginalDll, "Direct3DCreate9" ); // Debug if( !D3DCreate9_fn ) { log_error( LOG_ERROR, "Direct3DCreate9(): Pointer to original Direct3DCreate9 function not received!\n" ); ErrorLogger_FlushLogFile(); ::ExitProcess(0); // exit the hard way } // Request pointer from Original Dll. IDirect3D9 *pIDirect3D9_orig = D3DCreate9_fn( SDKVersion ); // Create my IDirect3D8 object and store pointer to original object there. // note: the object will delete itself once Ref count is zero (similar to COM objects) gl_pmyIDirect3D9 = new myIDirect3D9( pIDirect3D9_orig ); // Return pointer to hooking Object instead of "real one" return gl_pmyIDirect3D9; }
// Exported function (faking d3d9.dll's one-and-only export) IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion) { if (!hOriginalDll) LoadOriginalDll(); // Hooking IDirect3D Object from Original Library typedef IDirect3D9 *(WINAPI* D3D9_Type)(UINT SDKVersion); D3D9_Type D3DCreate9_fn = (D3D9_Type)GetProcAddress(hOriginalDll, "Direct3DCreate9"); // Debug if (!D3DCreate9_fn) { ExitProcess(0); // exit the hard way } IDirect3D9 *pIDirect3D9_orig = D3DCreate9_fn(SDKVersion); return new Direct3D9Proxy(pIDirect3D9_orig); }
// Exported function (faking d3d9.dll's one-and-only export) IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion) { if (!gl_hGameHook) LoadOriginalDll(); // looking for the "right d3d9.dll" // Hooking IDirect3D Object from Original Library typedef IDirect3D9 *(WINAPI* D3D9_Type)(UINT SDKVersion); D3D9_Type D3DCreate9_fn = (D3D9_Type) GetProcAddress( gl_hGameHook, "Direct3DCreate9"); // Debug if (!D3DCreate9_fn) { OutputDebugString("PROXYDLL: Pointer to original D3DCreate9 function not received ERROR ****\r\n"); ::ExitProcess(0); // exit the hard way } // Request pointer from Original Dll. IDirect3D9 *pIDirect3D9_orig = D3DCreate9_fn(SDKVersion); // Return pointer to hooking Object instead of "real one" return pIDirect3D9_orig; }