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;
}