Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
Hook PrintFps
Results 1 to 4 of 4

Thread: Hook PrintFps

  1. #1

    Hook PrintFps

    Well I have problem with hooking PrintFps function. I don't know how to catch all arguments like position X, also I can modify orginal fps but when I call more than one PrintText() is not working.

    Code:
    void MyPrintFps(int nY, int nFont, int nRed, int nGreen, int nBlue, char* lpText, int nSurface, int unk/* test next arg */) //10.76
    {
    	typedef void _PrintText(int nY, int nFont, int nRed, int nGreen, int nBlue, char* lpText, int nSurface);
    	static _PrintText *PrintText = (_PrintText*)(PrintName + Addresses::GetProcessImageBase());
    
    	nY = 50;
    	//nFont = 3;
    	lpText = "Tpforums";
    	nRed = 60, nGreen = 226, nBlue = 34;
    	
    	
    	PrintText(nY, nFont, nRed, nGreen, nBlue, lpText, nSurface);
    	PrintText(0, 2, nRed, nGreen, nBlue, "Test", nSurface); //not working
    	
    	
    	Console::cout() << nY << Console::endl();
    	Console::cout() << nFont << Console::endl();
    	Console::cout() << nRed << Console::endl();
    	Console::cout() << nGreen << Console::endl();
    	Console::cout() << nBlue << Console::endl();
    	Console::cout() << lpText << Console::endl();
    	Console::cout() << nSurface << Console::endl();	
    	Console::cout() << unk << Console::endl(); //checking next arg	
    	Console::cout() << "------------------------" << Console::endl();
    }
    HookCall((DWORD)(PrintFps + Addresses::GetProcessImageBase()), (DWORD)&MyPrintFps);
    Screen:


    there is unk = -923413 so I think so there is no more arguments.

  2. #2
    Just need to add __fastcall and working (catch int nSurface, int nX from register)

    Code:
    void __fastcall MyPrintFps(int nSurface, int nX, int nY, int nFont, int nRed, int nGreen, int nBlue, char* lpText, int nAlign) //10.76
    ---------------------------------------------------------------------------------------------------------------------
    still another problem, print is working but I get error with calling convention
    Code:
    Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.  This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
    PrintText function...
    Code:
    typedef void __fastcall _PrintText(int nSurface, int nX, int nY, int nFont, int nRed, int nGreen, int nBlue, char* lpText, int nAlign);
    static _PrintText *PrintText = (_PrintText*)original;
    PrintText(nSurface, nX, nY, nFont, nRed, nGreen, nBlue, lpText, nAlign);
    Last edited by wgrzelak; 03-03-2015 at 11:00 PM.

  3. #3
    Senior Member
    Join Date
    Dec 2011
    Posts
    249
    Code:
    int x = 0;
    int surface = 0;
    
    __asm{
    MOV x, EDX
    MOV surface, ECX
    }
    Edit, too late

  4. #4
    Quote Originally Posted by ottizy View Post
    Code:
    int x = 0;
    int surface = 0;
    
    __asm{
    MOV x, EDX
    MOV surface, ECX
    }
    Edit, too late
    ottizy, I saw your solution and I have no idea why but ECX = 0 when it's = 1.

    like
    Code:
    void MyPrintFps(/*int nSurface, int nX,*/ int nY, int nFont, int nRed, int nGreen, int nBlue, char* lpText, int nAlign) //10.76
    {
    	int nSurface;
    	int nX;
    	__asm
    	{
    		mov nX, edx
    		mov nSurface, ecx
    	}
            //ecx = 0 and client will crash
    	PrintText(nSurface, nX, nY, nFont, nRed, nGreen, nBlue, lpText, nAlign);
    }
    but that is not important because with _fastcall is working great. Still have error when call PrintText() try calling any convention (stdcall, cdecl, fastcall, thiscall) and still problem, only _fastcall without crash but with error as above.

    Edit, fastcall conversion in asm, working but still problem with esp
    Code:
    _asm
    {	
    	push nAlign
    	push lpText
    	push nBlue
    	push nGreen
    	push nRed
    	push nFont
    	push nY
    	mov edx, nX
    	mov ecx, 1
    	//add esp, 0x1c //7*4
    	call original
    }
    Edit, I got it working just I was making mistake because I was add esp before call function...so noob :P
    Last edited by wgrzelak; 03-08-2015 at 02:42 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •