Code: Select all
HookApi('kernel32.dll', 'ExitProcess', @InterceptExitProcess, @TrampolineExitProcess);
procedure InterceptExitProcess(uExitCode: UINT); stdcall;
begin
ShowMessage('InterceptExitProcess');
//TrampolineExitProcess(uExitCode);
end;
Code: Select all
RestoreCode(GetProcAddress(GetModuleHandleA('kernel32.dll'), 'ExitProcess'))
because it doens't work, even if i create an external dll who hook ExitProcess and inject on my app.
But if i create a dll who hooks ExitProcess using C++ (Detours) RestoreCode works perfectly, or if i get the first 6 bytes from ExitProcess api functions and write it on their address before call ExitProcess function.
So, my question is RestoreCode doesn't work if the hook was did by madcodehook hookapi function?