maxibaby
09-18-2016, 21:45
For external:
Get HWND
hwnd = FindWindow("Qt5QWindowOwnDCIcon", 0);
hwnd = FindWindow(, "Tibia - Charactername");
http://stackoverflow.com/questions/16530871/findwindow-does-not-find-the-a-window#answer-16531276
Get QTCore.dll Base adress.
LPVOID GetModule()
{
HMODULE hMods[1024];
HANDLE pHandle = GetHandle(); //Tibia process Handle
DWORD cbNeeded;
unsigned int i;
if (EnumProcessModules(pHandle, hMods, sizeof(hMods), &cbNeeded))
{
for (i = 0; i < (cbNeeded / sizeof(HMODULE)); i++)
{
TCHAR szModName[MAX_PATH];
if (GetModuleFileNameEx(pHandle, hMods[i], szModName, sizeof(szModName) / sizeof(TCHAR)))
{
string wstrModName = szModName;
string wstrModContain = "Qt5Core.dll";
if (wstrModName.find(wstrModContain) != string::npos)
{
return getBaseAdress(pHandle, hMods[i]);
}
}
}
}
return NULL;
}
Follow offsets chain:
DWORD healthOffset[] = {0x004555C8, 0x8, 0x134, 0x2C, 0x24};
//oLevel = sizeof(healthOffset)/sizeof(DWORD)
DWORD getAdress(int oLevel, HANDLE pHandle, DWORD Offsets[], DWORD BaseAdress){
DWORD CurrentAdress = BaseAdress;
for ( int i = 0; i < oLevel - 1; i++){
cout << "Current: " << CurrentAdress << " adding: " << Offsets[i] << endl;
CurrentAdress = CurrentAdress + Offsets[i];
cout << "Ended in " << CurrentAdress << endl;
if ( ReadProcessMemory(pHandle, (LPVOID)CurrentAdress, &CurrentAdress,sizeof(CurrentAdress),NULL) == 0) {
cout << GetLastError() << endl ;
}
}
return CurrentAdress + Offsets[oLevel - 1] ;
}
hpAdress = getAdress(5, handle, healthOffset, baseAdress) ;
Get HWND
hwnd = FindWindow("Qt5QWindowOwnDCIcon", 0);
hwnd = FindWindow(, "Tibia - Charactername");
http://stackoverflow.com/questions/16530871/findwindow-does-not-find-the-a-window#answer-16531276
Get QTCore.dll Base adress.
LPVOID GetModule()
{
HMODULE hMods[1024];
HANDLE pHandle = GetHandle(); //Tibia process Handle
DWORD cbNeeded;
unsigned int i;
if (EnumProcessModules(pHandle, hMods, sizeof(hMods), &cbNeeded))
{
for (i = 0; i < (cbNeeded / sizeof(HMODULE)); i++)
{
TCHAR szModName[MAX_PATH];
if (GetModuleFileNameEx(pHandle, hMods[i], szModName, sizeof(szModName) / sizeof(TCHAR)))
{
string wstrModName = szModName;
string wstrModContain = "Qt5Core.dll";
if (wstrModName.find(wstrModContain) != string::npos)
{
return getBaseAdress(pHandle, hMods[i]);
}
}
}
}
return NULL;
}
Follow offsets chain:
DWORD healthOffset[] = {0x004555C8, 0x8, 0x134, 0x2C, 0x24};
//oLevel = sizeof(healthOffset)/sizeof(DWORD)
DWORD getAdress(int oLevel, HANDLE pHandle, DWORD Offsets[], DWORD BaseAdress){
DWORD CurrentAdress = BaseAdress;
for ( int i = 0; i < oLevel - 1; i++){
cout << "Current: " << CurrentAdress << " adding: " << Offsets[i] << endl;
CurrentAdress = CurrentAdress + Offsets[i];
cout << "Ended in " << CurrentAdress << endl;
if ( ReadProcessMemory(pHandle, (LPVOID)CurrentAdress, &CurrentAdress,sizeof(CurrentAdress),NULL) == 0) {
cout << GetLastError() << endl ;
}
}
return CurrentAdress + Offsets[oLevel - 1] ;
}
hpAdress = getAdress(5, handle, healthOffset, baseAdress) ;