a screen shot?
Thanks sir for your time.
Normally the fake function is supposed to redirect back to the original function. Like this
program MsgBox;
uses
Windows,
afxCodeHook;
var
MessageBoxANextHook: function(hWnd: HWND; lpText, lpCaption: PAnsiChar; uType: UINT): Integer; stdcall;
function MessageBoxAHookProc(hWnd: HWND; lpText, lpCaption: PAnsiChar; uType: UINT): Integer; stdcall;
begin
Result := MessageBoxANextHook(0, '', 'bye', 0);
end;
begin
//test the target API
MessageBox(0, '', 'hi', 0);
//hook the API
HookCode('user32', 'MessageBoxA', @MessageBoxAHookProc, @MessageBoxANextHook);
//the message should be changed
MessageBox(0, '', 'hi', 0);
//unhoook the API
UnhookCode(@MessageBoxANextHook);
//test the target API
MessageBox(0, '', 'hi', 0);
end
Sorry only that he used afxcodehook, tho he used a detour library. It wouldn't redirect to msg here sir, it redirects to the main function as you can see sir.
The detour function still needs to be looked at as apparently it doesn't redirect the hook properly.