Hi everyone, i'm triying call DrawText from IW5 engine without R_EndFrame hook or another game func, my code is the following:
Code:
void DrawCommonText(float x, float y, float fsize, char* txt)
{
// IW5 drawengine...
EngineDrawText(txt, strlen(txt), FontA, x, y, fsize, fsize, 0, WHITE, 3);
}
void InitDraw()
{
while (1)
{
static int z = 0;
DrawCommonText(200, 50, 1, "^6 Working!");
Sleep(1);
}
}
// called from a new thread created from DllMain();
void Main()
{
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessId());
DWORD thidr;
HANDLE thr = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)InitDraw, (PVOID)NULL, 0, &thidr);
if (thr != NULL)
MessageBox(NULL, L"Remote thread created!", L"Success!", MB_OK | MB_ICONASTERISK);
}
well, this works but for a few seconds, then the game crashes telling me something like:
Name of the problem event: APPCRASH
** Name of the application: iw5mp.exe
** Application Version: 0.0.0.0
** Application timestamp: 4f186c8f
** Name of the module with errors: StackHash_0a9e
** Module version with errors: 0.0.0.0
** Module timestamp with errors: 00000000
** Exception code: c0000005
** Displacement exception: 3cd82408
** Operating system version: 6.1.7601.2.1.0.256.1
** Regional Settings Id: 11274
** Additional Information 1: 0a9e
** Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
** Additional Information 3: 0a9e
** Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Any idea how i can solve it? thanks to all.. Greetings.-