Recent Posts
Recent Comments
WNDPROC oldProc; HWND hWnd=NULL; LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { default: ; } return CallWindowProc(oldProc, hwnd, message, wParam, lParam); } extern "C" BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason, LPVOID reserved) { switch(reason) { case DLL_PROCESS_ATTACH: { if(hWnd==NULL) { //hWnd = ~ oldProc=(WNDPROC)SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG)WndProc); } break; } case DLL_PROCESS_DETACH: { if(hWnd!=NULL) { SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG)oldProc); hWnd=NULL; break; } } case DLL_THREAD_ATTACH:{break;} case DLL_THREAD_DETACH:{break;} default: ; } return 1; }
SetWindowLongPtr 로 oldProc 도 구하고. 돌려놓을 땐 그걸로 돌려놓으면 됩니다.
위 소스의 DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH 가 그 내용입니다.
엮인 글: DLL을 호출한 프로그램의 최상위 핸들을 구하기
엮인 글: DLL을 호출한 프로그램을 후킹하기
Comments