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
What's wrong with reading mana?
Results 1 to 5 of 5

Thread: What's wrong with reading mana?

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    11

    What's wrong with reading mana?

    Code:
        tibiaWindow = FindWindow( L"TibiaClient", NULL);
        DWORD PID;
        GetWindowThreadProcessId( tibiaWindow, &PID );
        HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, PID); //Open Process for Read/Write
        short mana = 0;
    
        if( !ReadProcessMemory(hProcess, (void*)0x3C2D00, &mana, 2, 0) )
            statusBar()->showMessage( "Error occured ", 3000 ); //shows me if failed
        else
            statusBar()->showMessage( QString::number(mana), 3000 ); //Shows me mana
    I've checked the address of mana and it should be tibia.exe+0x3C2D00. However, this code above does not work. It always fails to read the process memory. Anyone knows whats wrong?

  2. #2
    Administrator
    Join Date
    Mar 2007
    Posts
    1,723
    I believe Mana is one of the addresses that are XOR'd. This thread should help: http://tpforums.org/forum/threads/49...ll=1#post44519

  3. #3
    Junior Member
    Join Date
    Nov 2013
    Posts
    11
    Here's an update.

    This code works but I got the wrong address. CheatEngine says I have to get the baseaddress of tibia.exe and add 0x3C2D00 to it.
    Now I just need to find out how to get the base address of tibia.exe...
    Gonna look it up somewhere but so far I got nothing! -.-

  4. #4
    Junior Member
    Join Date
    Nov 2013
    Posts
    11
    Code:
    DWORD MainWindow::getBaseAddress(DWORD dwProcessIdentifier, TCHAR *lpszModuleName)
    {
        HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessIdentifier);
        DWORD dwModuleBaseAddress = 0;
        if(hSnapshot != INVALID_HANDLE_VALUE)
        {
            MODULEENTRY32 ModuleEntry32;
            ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
            if(Module32First(hSnapshot, &ModuleEntry32))
            {
                do
                {
                    if( wcscmp(ModuleEntry32.szModule, lpszModuleName) == 0)
                    {
                        dwModuleBaseAddress = (DWORD)ModuleEntry32.modBaseAddr;
                        break;
                    }
                }
                while(Module32Next(hSnapshot, &ModuleEntry32));
            }
            CloseHandle(hSnapshot);
        }
        return dwModuleBaseAddress;
    }
    This is supposed to return the base address... doesn't work! Any ideas whats wrong?

  5. #5
    Junior Member
    Join Date
    Nov 2013
    Posts
    11
    Got it now :

    Code:
    DWORD MainWindow::getBaseAddress(DWORD dwProcessId)
    {
        WCHAR* lpModuleName = L"tibia.exe";
        MODULEENTRY32 lpModuleEntry;
        HANDLE hSnapShot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwProcessId );
    
        if(!hSnapShot)
            return 0;
    
        lpModuleEntry.dwSize = sizeof(lpModuleEntry);
        BOOL bModule = Module32First( hSnapShot, &lpModuleEntry );
        while(bModule)
        {
            if(!wcsicmp(lpModuleEntry.szModule, lpModuleName ) )
            {
                CloseHandle( hSnapShot );
                return (DWORD)lpModuleEntry.modBaseAddr;
            }
            bModule = Module32Next( hSnapShot, &lpModuleEntry );
        }
        CloseHandle( hSnapShot );
        return 0;
    }
    this seems to work.

Tags for this Thread

Posting Permissions

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