Hi leute ,
ich bin langsam echt ratlos wieso funktioniert dieser Hook nicht?
Die DLL wird erfolgreich injected aber sobald sich die MessageBox aufruft von meiner Test.exe bleibt trozdem der alte Text vorhanden.
(Ich nutze in der exe MessageBoxA).
Hoffe mir kann jemand helfen.
ich bin langsam echt ratlos wieso funktioniert dieser Hook nicht?
Code:
#include <vcl.h>
#include <windows.h>
#include "detours.h"
#include "detoured.h"
#pragma comment(lib,"detours.lib")
int (WINAPI * trueMessageBoxA)(HWND, LPCSTR, LPCSTR, UINT) = MessageBoxA;
int WINAPI hookMessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType) {
int hook = trueMessageBoxA(hWnd, "Hook wurde ausgeführt","MessageBox Hook",uType);
return hook;
}
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
if (reason==DLL_PROCESS_ATTACH) {
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)trueMessageBoxA,hookMessageBoxA);
DetourTransactionCommit();
}
return 1;
}
Die DLL wird erfolgreich injected aber sobald sich die MessageBox aufruft von meiner Test.exe bleibt trozdem der alte Text vorhanden.
(Ich nutze in der exe MessageBoxA).
Hoffe mir kann jemand helfen.