Here:
Tested working COD4 v1.7 on Win7 32.
Credits to King - Orgy, sycore [UC] and okidoki [UC] and etc.
Code:bool ( WINAPI *orig_GetWindowThreadProcessId ) ( HWND hWnd, LPDWORD lpdwProcessId ); VOID ( *Com_Frame )( VOID ); BYTE HackEnable = 0x00; void WINAPI HackOff( void ) { Sleep( 4000 ); HackEnable = 0x00; } bool WINAPI GetWindowThreadProcessId_Hook( HWND hWnd, LPDWORD lpdwProcessId) { if( (DWORD)&lpdwProcessId > 0x000cd000 && (DWORD)&lpdwProcessId < 0x000cf000 ) { HackEnable = 0x01; for( int i=0;i<6;i++ ) Com_Frame( ); _beginthread((void (__cdecl *)(void *))HackOff, 0, NULL ); } return orig_GetWindowThreadProcessId ( hWnd, lpdwProcessId ); } HRESULT __stdcall EndScene_Detour(LPDIRECT3DDEVICE9 Device_Interface) { D3DVIEWPORT9 Viewport; Device_Interface->GetViewport( &Viewport ); long SCX = Viewport.Width/2; long SCY = Viewport.Height/2; if( HackEnable == 0x00 ) { D3DCOLOR Color = D3DCOLOR_ARGB( 255, 20, 255, 20 ); D3DRECT Rect; Rect.x1 = SCX - 10; Rect.y1 = SCY; Rect.x2 = SCX + 10; Rect.y2 = SCY + 1; Device_Interface->Clear( 1, &Rect, D3DCLEAR_TARGET, Color, 0, 0 ); Rect.x1 = SCX; Rect.y1 = SCY - 10; Rect.x2 = SCX + 1; Rect.y2 = SCY + 10; Device_Interface->Clear( 1, &Rect, D3DCLEAR_TARGET, Color, 0, 0 ); } return EndScene_Pointer(Device_Interface); } //===================================================================================== BOOL WINAPI DllMain(HINSTANCE hinstModule, DWORD dwReason, LPVOID lpvReserved) { if(dwReason == DLL_PROCESS_ATTACH) { DisableThreadLibraryCalls(hinstModule); Com_Frame = (void (__cdecl *)(void))0x475120; // CoD 1 1.5 Offset = 0x43A3D0 // CoD 2 1.3 Offset = 0x414B20 // CoD 4 1.7 Offset = 0x475120 HMODULE hMod = GetModuleHandleA( "user32.dll" ); orig_GetWindowThreadProcessId = (bool (__stdcall *)(HWND,LPDWORD)) DetourFunction( (PBYTE)GetProcAddress( hMod, "GetWindowThreadProcessId" ), (PBYTE)GetWindowThreadProcessId_Hook ); if(Direct3DCreate9_VMTable() == D3D_OK) return TRUE; } return FALSE; }![]()


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks