제가 갖고있는 프로그램에서 MessageBox
디스플레이를 변경하려고합니다. DLL을 삽입하고 내 MessageBox
대신 일반 DLL을 표시하는 MessageBox
함수에서 내 DLL로 점프를 수행하여이 작업을 수행하려고합니다.DLL에서 메모리에 쓸 때 오류가 발생했습니다.
나는뿐만 아니라 MessageBox
'메모리의 주소와 내 MessageBox
의 주소를 가져옵니다 다음 코드를 작성했습니다, 나는 점프를 미리 형성하기 위해 옵 코드를 계산하기 위해 노력하고있어하지만 불행히도 나는 "액세스 위반이 나타날 하나 MessageBoxA
또는 012로 확인되는 매크로는 사실에 MessageBox
MessageBox
로 User32.dll 같이
DWORD oldProtect;
PVOID MessageBoxaddr = GetProcAddress(
GetModuleHandle("User32.dll"), "MessageBoxA");
PVOID MessageBoxHookAddr = &HookedMessageBox;
DWORD relJmp = (DWORD)MessageBoxaddr- ((DWORD)MessageBoxHookAddr + 5);
VirtualProtect(MessageBoxaddr,
sizeof(BYTE)* 5, PAGE_EXECUTE_READWRITE, &oldProtect);
// These line preform the little Debian method and are the cause for the error
((PBYTE)MessageBoxaddr)[0] = 0xe9;
((PBYTE)MessageBoxaddr)[1] = relJmp^0x000000ff;
((PBYTE)MessageBoxaddr)[2] = (relJmp^0x0000ff00) >> 8;
((PBYTE)MessageBoxaddr)[3] = (relJmp^0x00ff0000) >> 16;
((PBYTE)MessageBoxaddr)[4] = (relJmp^0xff000000)>>24;
VirtualProtect(MessageBoxaddr,
sizeof(BYTE)* 5, PAGE_EXECUTE_READ, &oldProtect);
return 0;
나는'^'대신에'&'를 의미하는 것으로 생각합니다. 그럼 다시 작은 데비안 방법 –