[C++]Game Hook Problem

Posts 1–6 of 6 · Page 1 of 1
[C++]Game Hook Problem
Hi guys, I m trying to hack with the hook method to BLR. But somethings wrong, i can't found my problem.Can anybody help me?

I'm using the thefeckness SDK REV51.

Code:
FILE* file = fopen("logst.txt", "a");

//00F94699 > $ E8 70020000    CALL BLR.00F9490E

DWORD dwOvwrBytes = 0;

#define UObject_ProcessEvent 0x0044C770

UCanvas* pCanvas;
DWORD dwCallingObject = 0;

FColor MakeColor(int R, int G, int B, int A)
{
	FColor ReturnedColor;
	ReturnedColor.R = R;
	ReturnedColor.G = G;
	ReturnedColor.B = B;
	ReturnedColor.A = A;
	return ReturnedColor;
}

FColor Green = MakeColor(0,255,255,255);


UFunction* pFunction;
 void* pParms;
 void* pResult = NULL;

VOID WINAPI DispatchFunction()
{
	fprintf(file,"log : %s\n", "3");

    if(pFunction == NULL || pParms == NULL)
        return;

	fprintf(file,"log : %s\n", "4");

    if(!strcmp(pFunction->GetFullName(), "Function Engine.GameViewportClient.PostRender"))
    {
        pCanvas = ((UGameViewportClient_eventPostRender_Parms *)pParms)->Canvas;

        if(pCanvas != NULL)
        {
            pCanvas->CurX = 50;
            pCanvas->CurY = 50;
            pCanvas->DrawColor = Green;
            pCanvas->DrawText(L"y0o we draw here!!", NULL, 1.0f, 1.0f, NULL);
        }
    }
}

VOID __declspec(naked) ProxyFunction()
{
	fprintf(file,"log : %s\n", "5");
    __asm
    {
        mov dwCallingObject, ecx

        push edx
        mov edx, dword ptr [esp + 0x8]
        mov pFunction, edx
        mov edx, dword ptr [esp + 0xC]
        mov pParms, edx
        pop edx

        pushad
    }
	fprintf(file,"log : %s\n", "6");
    DispatchFunction();

    __asm
    {
        popad
        jmp [dwOvwrBytes]
    }
}

int __stdcall DllMain( HMODULE hModule, unsigned long dwReason, void* lpReserved )
{
		
	fprintf(file,"log : %s\n", "0");
    if ( dwReason == DLL_PROCESS_ATTACH )
    {		     
			fprintf(file,"log : %s\n", "1");
       dwOvwrBytes = (DWORD)DetourFunction((BYTE*)UObject_ProcessEvent, (BYTE*)ProxyFunction);
	   fprintf(file,"log : %s : %s\n", "1",dwOvwrBytes);
    }
		fprintf(file,"log : %s\n", "2");
    return TRUE;
}
I don't see what can be wrong since you copypasted the whole hook from lolHertz
 
code

Code:
DWORD dwOvwrBytes = 0;
...
VOID WINAPI DispatchFunction()
{

    if(pFunction == NULL || pParams == NULL)
        return;

    if(!strcmp(pFunction->GetFullName(), "Function FoxGame.FoxGameViewportClient.PostRender"))
    {
        pCanvas = ((UFoxGameViewportClient_eventPostRender_Parms *)pParams)->Canvas;

        if(pCanvas != NULL)
        {
            pCanvas->CurX = 10;
            pCanvas->CurY = 10;
            pCanvas->DrawColor = Color;
            pCanvas->DrawText(L"y0o we draw here!!", NULL, 1.0f, 1.0f, NULL);
        }
    }
}

VOID __declspec(naked) ProxyFunction()
{
    __asm
    {
        mov dwCallingObject, ecx

        push edx
        mov edx, dword ptr [esp + 0x8]
        mov pFunction, edx
        mov edx, dword ptr [esp + 0xC]
        mov pParams, edx
        pop edx

        pushad
    }

    DispatchFunction();

    __asm
    {
        popad
        jmp [dwOvwrBytes]
    }
}
...
dwOvwrBytes = (DWORD)DetourFunction((BYTE *)dwProcessEvent, (BYTE *)ProxyFunction, 5); 
...


/Nuff said
Eh... Sigh,
It Could Be, Acutally why do i even Bother, you C&Pasted the Whole fucking Thing.
Whats the Point in Acutally helping when it Seems you dont Have the Slightest Clue
GO AND READ A FUCKING BOOK to learn the C++ Synatx
Quote Originally Posted by kJNR View Post
GO AND READ A FUCKING BOOK to learn the C++ Synatx
Thank you.
You right, acctually i m a programmer but i'm learning new lang (c++). I just tried my chance. Thank u all.
what do you expect from newbies? i mean seriously......
Quote Originally Posted by unspeakable View Post
what do you expect from newbies? i mean seriously......
To actually learn a language before trying to leech a hack. It's not that much to ask, really.
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us