Habe gerade das Tutorial von MrSmith durchgemacht. Hat super geklappt.
Jetzt habe ich mir ein kleines Testprogramm geschrieben, in dem ich ebenfalls die MessageBoxW Funktion detouren möchte. In Olly habe ich flgendes gefunden:
Code:
idata:00482684 ; int __stdcall MessageBoxW(HWND hWnd,LPCWSTR lpText,LPCWSTR lpCaption,UINT uType)
Code:
#include <detours.h>
#pragma comment(lib,"detours")
typedef int (__stdcall *MyType)(HWND,LPCWSTR,LPCWSTR,UINT);
MyType Original = NULL;
int __stdcall MessageBoxWDetour(HWND Window, LPCWSTR Text, LPCWSTR Caption, UINT Type)
{
Text = L"lol'd";
return Original(Window, Text, Caption, Type);
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
MessageBoxA(0,"Attached","Info",0);
Original=(MyType)DetourFunction((PBYTE)0x00482684,(PBYTE)MessageBoxWDetour);
break;
case DLL_PROCESS_DETACH:
MessageBoxA(0,"Dettached","Info",0);
break;
}
return TRUE;
}
PS: Bin C++ "Anfänger", beherrsche jedoch C# recht gut.
Mfg AutoitScript






