Well Im practicing simple detours and stuff. Ive had success with Notepad and Minesweeper and I will post a tutorial soon but I have a issue with Pinball.
I successfully inject it, and I know this because I made a MessageBox appear.
I detoured show_high_score_dialog, and it works, because I also made another MessageBox appear. After I close the high score dialog it crashes.
Im using Microsoft Detour 1.2 so yeah...
I also checked the address and its correct.
I also checked function parameters and its all good.
Im using Windows XP SP2
Here is the code:
Code:
#include "windows.h"
#include "detours.h"
#pragma comment(lib,"detours.lib")
void (__stdcall* show_high_score_dialog)(int x);
int myhighscore(int x)
{
MessageBox(NULL,"Displaying...","Display",MB_OK);
return show_high_score_dialog(x);
}
BOOL APIENTRY DllMain(HANDLE hModule, DWORD Reason, LPVOID lpReserved)
{
switch (Reason)
{
case DLL_PROCESS_ATTACH:
MessageBox(NULL,"Injected","Done",MB_OK);
//CreateThread(NULL,NULL,&highscorechange,NULL,NULL,&ThreadID);
show_high_score_dialog = (int (__stdcall*)(int))DetourFunction((PBYTE)0x01005412,(PBYTE)myhighscore);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
MessageBox(0,"Removed","Done",MB_OK);
break;
}
return TRUE;
}