Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hook ntdll #79

Closed
SpenserCai opened this issue Aug 9, 2020 · 1 comment
Closed

hook ntdll #79

SpenserCai opened this issue Aug 9, 2020 · 1 comment

Comments

@SpenserCai
Copy link

if use this way get address can I hook it?

typedef DWORD(__stdcall *pNtTerminateProcess)(HANDLE, UINT);
pNtTerminateProcess fnNtTerminateProcess = (pNtTerminateProcess)GetProcAddress(GetModuleHandle(TEXT("ntdll.dll")), "NtTerminateProcess");

my code:

typedef NTSTATUS(WINAPI tNtTerminateProcess)
(
HANDLE ProcessHandle,
NTSTATUS ExitStatus
);
tNtTerminateProcess oNtTerminateProcessFunc;
NTSTATUS WINAPI hkNtTerminateProcess(HANDLE ProcessHandle,NTSTATUS ExitStatus)
{
printf("11111");
MessageBox(NULL, L"I'm alive!", L"Hello", 0);
return 0;
}
PLH::IatHook hook("ntdll.dll", "NtTerminateProcess", (uint64_t)&hkNtTerminateProcess, (uint64_t
)&oNtTerminateProcessFunc, L"NtTerminateProcess");

@stevemk14ebr
Copy link
Owner

Please report bugs on the issue tracker and questions in the Gitter community chat linked in the projects readme. For an example of IatHook (and all other hook types) please refer to the UnitTests until i complete the documentation.

PLH::IatHook hook("kernel32.dll", "GetCurrentThreadId", (char*)&hkGetCurrentThreadId, (uint64_t*)&oGetCurrentThreadID, L"polyhook_2.exe");

Afaik this should work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants