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 archive_postsperpage - assumed 'archive_postsperpage' (this will throw an Error in a future version of PHP) in ..../archive/index.php on line 456
Reading battle list [Archive] - Forums

PDA

View Full Version : Reading battle list



Xleniz
06-30-2013, 04:02 AM
Hi, I got a real simple question
First:



monsterID = baseAddress + 0x007B0B4;
DWORD buffer;
byte monsterID3[15];
ReadProcessMemory(phandle,(void*)monsterID,&buffer, sizeof(&buffer),0);
ReadProcessMemory(phandle,(void*)buffer+0x124,&buffer, sizeof(&buffer),0);

(Now I have first, or second monster in battlelist)

Then


ReadProcessMemory(phandle,(void*)monsterID, &monsterID3, 15,0);


Gives only 4 characters (Cipf) and not Cipfried.
Even though I tell readprocessmemory to take 15 characters. Why is this?

Thanks.

<edit> Now I managed to make it more than 4 char, but its in ASCII. I have no idea how to make it
normal.

its like:


ReadProcessMemory(phandle,(void*)monsterID, &monsterID3[0],sizeof(monsterID3),0);
cout << monsterID3 << endl;

XtrmJash
06-30-2013, 08:26 AM
Hi, I got a real simple question
First:



monsterID = baseAddress + 0x007B0B4;
DWORD buffer;
byte monsterID3[15];
ReadProcessMemory(phandle,(void*)monsterID,&buffer, sizeof(&buffer),0);
ReadProcessMemory(phandle,(void*)buffer+0x124,&buffer, sizeof(&buffer),0);

(Now I have first, or second monster in battlelist)

Then


ReadProcessMemory(phandle,(void*)monsterID, &monsterID3, 15,0);


Gives only 4 characters (Cipf) and not Cipfried.
Even though I tell readprocessmemory to take 15 characters. Why is this?

Thanks.

<edit> Now I managed to make it more than 4 char, but its in ASCII. I have no idea how to make it
normal.

its like:


ReadProcessMemory(phandle,(void*)monsterID, &monsterID3[0],sizeof(monsterID3),0);
cout << monsterID3 << endl;


Did you override the ReadProcessMemory function?

Xleniz
06-30-2013, 08:59 AM
Override? No.

ottizy
06-30-2013, 09:07 AM
What data type is monsterID3?

XtrmJash
06-30-2013, 09:09 AM
What data type is monsterID3?

As he's reading the battle list, presumably 32 bit integer.

Xleniz
06-30-2013, 09:09 AM
byte monsterID3[15];

XtrmJash
06-30-2013, 09:10 AM
byte monsterID3[15];

You're reading a 32 bit integer, right? The creature ID from battle list? If so, it's stored at offset 0 from the battle list entry (before the name), and is only 4 bytes. Why are you declaring a 15 byte array?

Xleniz
06-30-2013, 09:11 AM
no, im trying to get name.
I dont know what variable type I need, I tried char[15] and char* with no good results.

ottizy
06-30-2013, 09:26 AM
std::string ReadString(DWORD address) {
char buffer;
std::string res;
while(1) {
ReadProcessMemory(handle, (void*)address, &buffer, sizeof(buffer), 0);
if (buffer == 0) break;
res += buffer;
address++;
}
return res;
}


This will work for reading names in battlelist.

Xleniz
06-30-2013, 09:35 AM
Dont want to complain, but still only showing ascii.
(With: cout << ReadString(monsterID) << endl )

XtrmJash
06-30-2013, 09:39 AM
Dont want to complain, but still only showing ascii.
(With: cout << ReadString(monsterID) << endl )

When you say it's showing ASCII, what exactly do you mean? What is the output? Hex? Random string? Numbers? Does the data represent the name?

Xleniz
06-30-2013, 09:41 AM
A picture explains so much:
http://pbrd.co/13iaHlb

Btw, I recommend pasteboard.co, its a site where you just print screen, ctrl+v and its there:S

ottizy
06-30-2013, 09:51 AM
Would you mind showing us some more of your code? How you are getting the handle, which address you're using etc.

Xleniz
06-30-2013, 09:56 AM
Yes Sir!

Heres my 700 lines code



The text that you have entered is too long (23744 characters). Please shorten it to 10000 characters long.


Sorry.

Heres the part of it: (base address works)


GetWindowThreadProcessId(tibiaWindow,&pid);
phandle = OpenProcess(PROCESS_ALL_ACCESS,0,pid);
if(phandle) {
baseAddress = GetModuleBase(phandle, processName);
size_t bytesRead;
size_t bytestoRead = 50;
xPos = baseAddress + 0x553038;
yPos = baseAddress + 0x55303C;
testHex = baseAddress + 0x54F50C;
DMessage = baseAddress + 0x3BF0AC;
DWORD monsterID;
monsterID = baseAddress + 0x007B0B4;
DWORD buffer;
char* monsterID3 = new char[15];
ReadProcessMemory(phandle,(void*)monsterID,&buffer, sizeof(&buffer),0);
ReadProcessMemory(phandle,(void*)(buffer+0x128),&buffer, sizeof(&buffer),0);

char battleName[15] = "Hello";
int monsterID2;

while(1+1 == 2) {
if(GetAsyncKeyState(VK_LBUTTON && GetAsyncKeyState(VK_RBUTTON))) {
cout << ReadString(monsterID) << endl;
}
}


XDD

ottizy
06-30-2013, 10:08 AM
Not really sure what you're trying to accomplish, but I guess it is to read all names in the battlelist.

Right now you're just reading baseAddress + 0x007B0B4 over and over again, which is pointing to nothing. The readstring function will read 1 byte from the memory until it finds a null character. Since the address you are reading isn't really pointing to a string it will keep on reading until it finds one, thus returning a value that makes no sense whatsoever.

If you want to read the battlelist I suggest you read some tutorials on how to do it on this forum.

XtrmJash
06-30-2013, 10:15 AM
The battle list start address is currently 0x5A9530, so add that to Tibias base, add the offset for the name, and you should be hunky dory. (Offset for name = 4).

Stiju
06-30-2013, 10:15 AM
char buffer[32];
ReadProcessMemory(hProcess, (void*)0x00F59534, (void*)buffer, 32, 0);
std::cout << "String: " << buffer << '\n';

And make sure to use the correct address.

Xleniz
06-30-2013, 11:20 AM
I did Tibia.exe + 0x007B0B4, and did all of the stuff, to get it show correct address with full string in cheatengine,
I dont see why its wrong address.

Oh, I forgot
monsterID = buffer;

Well, now output is BLANK.
XDD