저는 CDetour와 함께 visual studio 2003을 사용하고 있습니다. 내가 다른 기능을 구부려 한detoured 함수가 호출되지 않습니다
LPDIRECT3D9 d3d;
LPDIRECT3DDEVICE9 d3ddev;
CDetour CreateDevice_Det;
IDirect3D9* Direct3DCreate9_Hook(UINT SDKVersion)
{
MessageBox(GetForegroundWindow(), "Direct9 Create Hooked", "dForce.dll", MB_OK);
d3d = Direct3DCreate9(D3D_SDK_VERSION);
return d3d;
}
BOOL WINAPI DllMain(HINSTANCE hInst,DWORD reason,LPVOID reserved)
{
switch(reason)
{
case DLL_PROCESS_ATTACH:
{
HMODULE hd3d = GetModuleHandle("d3d9.dll");
if(hd3d == 0)
{
MessageBox(GetForegroundWindow(), "d3d9.dll still not loaded", "dForce.dll", MB_ICONSTOP);
return FALSE;
}
DWORD lpAddr = (DWORD)GetProcAddress(hd3d, "Direct3DCreate9");
if(lpAddr == 0)
{
MessageBox(GetForegroundWindow(), "could not find valid d3d9.dll create device address", "dForce.dll", MB_ICONSTOP);
return FALSE;
}
CreateDevice_Det.Detour((LPBYTE)lpAddr, (LPBYTE)Direct3DCreate9_Hook);
CString strDetoured;
strDetoured.Format("CreateDevice Hooked! Address: %x", (LPVOID)lpAddr);
MessageBox(GetForegroundWindow(), strDetoured, "dFoce.dll", MB_ICONINFORMATION);
}break;
}
return TRUE;
}
LoadLibrary
이 같은 방법으로 성공 (KERNEL32.DLL에서),이 DLL은 물론이고 같은 :
나는 SSCE을 줄 수 이번에는 그래서 이것은 내가 무슨 짓을했는지입니다 주 프로그램에서 Direct3DCreate9
전에로드 된, 나는 또한 콘솔 wi32 프로그램에서이 시도했다 그러나 내 후크 기능이 여전히 호출되지 않습니다. 내가 놓친 게 있니?
그가 CDetours를 사용하고 있기 때문에 나는 그것이 MS Detours와 관련이 없다는 것을 발견 한 것으로부터 생각합니다. – Dirk
그 사람은 MSDetours (일명 CDetour)라고 말합니다 – Abhinav
네,하지만 CDetours에서 발견 한 웹에서 일부 코드를 탐색했을 때 Detours처럼 보이지 않았습니다. 후킹은 MS Detour 메서드를 호출하지 않고 0xe9 jmp 등과 같은 다양한 메서드를 사용하여 수동으로 수행되었습니다. 그래서 그것은 래퍼로 보이지 않았습니다. 그리고 MS Detours가 CDetour라고 불리는 것을 들어 보셨습니까? – Dirk