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

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
Calling internal tibia function with parameter
Results 1 to 5 of 5

Thread: Calling internal tibia function with parameter

  1. #1
    Junior Member
    Join Date
    Oct 2015
    Posts
    6

    Calling internal tibia function with parameter

    Im trying to call tibia attack function by injecting dll, the problem is that the parameter (creature id) is not passed properly and i dont know why. Here is my code:
    Code:
    #include <windows.h>
    
    DWORD WINAPI MyThread(LPVOID);
    DWORD g_threadID;
    HMODULE g_hModule;
    void __cdecl CallFunction(int);
    
    INT APIENTRY DllMain(HMODULE hDLL, DWORD Reason, LPVOID Reserved)
    {
    	switch(Reason)
    	{
    	case DLL_PROCESS_ATTACH:
    		g_hModule = hDLL;
    		DisableThreadLibraryCalls(hDLL);
    		CreateThread(NULL, NULL, &MyThread, NULL, NULL, &g_threadID);
    	break;
    	case DLL_THREAD_ATTACH:
    	case DLL_PROCESS_DETACH:
    	case DLL_THREAD_DETACH:
    		break;
    	}
    	return TRUE;
    }
    
    DWORD WINAPI MyThread(LPVOID)
    {
    	int creatureID = 0x40030E6B;
    	CallFunction(creatureID);
    	FreeLibraryAndExitThread(g_hModule, 0);
    	return 0;
    }
    
    void __cdecl CallFunction(int param1)
    {
    	typedef void(__cdecl *pFunctionAddress)(int);
    	pFunctionAddress pMySecretFunction = (pFunctionAddress)(0x01310EC0); 
    	pMySecretFunction(param1);
    }

  2. #2
    Senior Member
    Join Date
    Dec 2011
    Posts
    249
    Use __fastcall instead of __cdecl

  3. #3
    Junior Member
    Join Date
    Oct 2015
    Posts
    6
    Quote Originally Posted by ottizy View Post
    Use __fastcall instead of __cdecl
    I tried to change it to fastcall but it didnt help. Function seems to be called properly because when i attack monster and then inject this dll, my character stops attacking but when i inject it when character isn't attacking anything then nothing happens. That's why i think that creatureID isnt passed properly.

  4. #4
    Junior Member
    Join Date
    Oct 2015
    Posts
    6
    Actually u were right, I injected dll to the wrong client . Thank you very much!

    Btw do all tibia functions have to be called with fastcall?
    Last edited by rewisal; 10-25-2015 at 07:40 PM.

  5. #5
    Senior Member
    Join Date
    Dec 2011
    Posts
    249
    I think so. Not 100% sure however.

Posting Permissions

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