 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
voidaccess How do I cheat?
Reputation: 0
Joined: 01 Nov 2013 Posts: 9
|
Posted: Fri Nov 01, 2013 6:05 pm Post subject: Need help getting string value from a hexadecimal addressC++ |
|
|
I am having difficulties getting the string value from an address. I did a text search in cheat engine for an address that contains string values of information I need to read in and modify for a program. However every time I read out the address I get the 4 Byte form of the value instead of text.
Is there way to convert the 4 Byte form to Text like cheat engine does.
|
|
| Back to top |
|
 |
DELETED_USER Newbie cheater
Reputation: 1
Joined: 02 Oct 2013 Posts: 24 Location: Venezuela
|
Posted: Fri Nov 01, 2013 6:16 pm Post subject: |
|
|
| AFAIK; You need to read the number of characters that contains the string as bytes, then you must convert the result (byte by byte) in ASCII or Unicode.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25823 Location: The netherlands
|
Posted: Fri Nov 01, 2013 6:35 pm Post subject: |
|
|
Just read the bytes into a compatible string with equal or bigger size
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
voidaccess How do I cheat?
Reputation: 0
Joined: 01 Nov 2013 Posts: 9
|
Posted: Sat Nov 02, 2013 1:49 am Post subject: |
|
|
Ty I figured it out now , brain just wasn't working today.
Answer for anyone else curious,
| Code: | std::string* buffer[15];
ReadProcessMemory(fProcess.__HandleProcess, (LPCVOID)(address), &buffer, sizeof(buffer), NULL);
std::cout << (char*)&buffer << std::endl; |
|
|
| Back to top |
|
 |
justa_dude Grandmaster Cheater
Reputation: 23
Joined: 29 Jun 2010 Posts: 893
|
Posted: Sat Nov 02, 2013 3:25 pm Post subject: |
|
|
| voidaccess wrote: | Ty I figured it out now , brain just wasn't working today.
Answer for anyone else curious,
| Code: | std::string* buffer[15];
ReadProcessMemory(fProcess.__HandleProcess, (LPCVOID)(address), &buffer, sizeof(buffer), NULL);
std::cout << (char*)&buffer << std::endl; |
|
No offense, but this is all kinds of wrong. Try replacing std::string with unsigned char.
|
|
| Back to top |
|
 |
cinderstorm How do I cheat?
Reputation: 0
Joined: 15 Jan 2014 Posts: 1
|
Posted: Wed Jan 15, 2014 1:57 am Post subject: help |
|
|
I'm encountering the same issue but I can't tell where I'm not scooping up the value. I'm looking at an address that has appended multiple dwords and displays it in Unicode.
AHK Code
| Code: | tmp = 0x11E3F4
string .= memory.readString(tmp, length := 14, encoding := "utf-8") |
| Code: |
readString(address, length := 0, encoding := "utf-8", aOffsets*)
{
size := (encoding ="utf-16" || encoding = "cp1200") ? 2 : 1
VarSetCapacity(buffer, length ? length * size : size, 0)
if aOffsets.maxIndex()
address := this.getAddressFromOffsets(address, aOffsets*)
If !length ; read until null terminator is found or something goes wrong
{
Loop
{
success := DllCall("ReadProcessMemory", "UInt", this.hProcessCurrent, "UInt", address + (A_index - 1) * size, "str", buffer, "Uint", size, "Ptr", 0)
if (ErrorLevel || !success || "" = char := StrGet(&buffer, 1, encoding)) ; null terminator = ""
break
string .= char
}
}
Else ; will read X length
{
DllCall("ReadProcessMemory", "UInt", this.hProcessCurrent, "UInt", address, "str", buffer, "Uint", length * size, "Ptr", 0)
string := StrGet(&buffer, length, encoding)
}
return string
}
|
I understand that this is not the AHK forums, but I'm trying to figure out how to extract this list of values (as strings) that I see at a given address. Because I'm fairly new to memory reading and writing, I have no clue where to even start.
Mostly what I can see from the memory address is a consistent appending of the text. For example:
Type
String
Value
Rabbit 123sDuck 80sFeet 12s
Value is currently set as a String[256] so it can read the what I'm guessing is an array of values created in assembly... but I can only guess at that because it seems logical and looking at the stack that there's the beginning of a dword, some letters 2 letters at a time (I'm guessing 4 bytes each) and a pointer at the end. The memory address that shows the values grows dynamically based on the number of objects that are "active".
Please help - I see that it might have something to do with the function I'm using but I'm kind of lost. I would prefer being able to reference the exact item rather than parse out the string but I haven't been able to figure out to do that. I appreciate any help and all help/guidance on this matter.
Thank you,
cinderstorm
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|