| View previous topic :: View next topic |
| Author |
Message |
redhead Cheater
Reputation: 0
Joined: 21 Mar 2007 Posts: 47
|
Posted: Sat Aug 09, 2008 12:53 pm Post subject: 2 questions, TEXT search Cheatengine --> C++ |
|
|
Hi,
First Question:
I want to read a word, wich is saved on an address in Unicode.
I've found the address easy with Cheatengine, but:
If I use "readprocessmemory" in c++, I'll get only a "4bytes" Search.
(In unicode, 4byte --> 2signs)
So I get only the 2first letters.
How can I get all letters? (5 in total btw)
second Question:
When I read the first 2letters with readprocessmemory, I'll get a number ofc.
How to translate thise number into letters?
(I'll get 6357107 , wich means "sa" (I know it, becouse I knew those letters, befor I knew this number)
But for example, what does 7667827 mean?
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat Aug 09, 2008 1:11 pm Post subject: |
|
|
| Code: |
char buffer[5] = "";
ReadProcessMemory(hProcess, 0xDEADBEEF /*replace with real address*/, &buffer, 10, NULL);
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
redhead Cheater
Reputation: 0
Joined: 21 Mar 2007 Posts: 47
|
Posted: Sat Aug 09, 2008 1:38 pm Post subject: |
|
|
ty, but this doesnt work very well.(atleast in my case or I'm doing something wrong)
I get the first letter (s) saved in buffer, but only this one.
After I close my program, following error pops up:
| Code: | | Run-Time Check Failure #2 - Stack around the variable "buffer" was corrupted |
my part of code:
| Code: | char buffer[5] = "";
ReadProcessMemory (hopen,(VOID *)0x209E65C, &buffer, 10, NULL);
std::cout<<buffer<<std::endl;
|
|
|
| Back to top |
|
 |
jackyyll Expert Cheater
Reputation: 0
Joined: 28 Jan 2008 Posts: 143 Location: here
|
Posted: Sat Aug 09, 2008 1:53 pm Post subject: |
|
|
| redhead wrote: | ty, but this doesnt work very well.(atleast in my case or I'm doing something wrong)
I get the first letter (s) saved in buffer, but only this one.
After I close my program, following error pops up:
| Code: | | Run-Time Check Failure #2 - Stack around the variable "buffer" was corrupted |
my part of code:
| Code: | char buffer[5] = "";
ReadProcessMemory (hopen,(VOID *)0x209E65C, &buffer, 10, NULL);
std::cout<<buffer<<std::endl;
|
|
Because you're trying to stuff 10 bytes into a 5 byte array..
| Code: |
char buffer[5] = "";
ReadProcessMemory( hopen, ( void * )0x209E65C, &buffer, sizeof( buffer ), NULL );
std::cout << buffer << std::endl;
|
|
|
| Back to top |
|
 |
redhead Cheater
Reputation: 0
Joined: 21 Mar 2007 Posts: 47
|
Posted: Sat Aug 09, 2008 1:55 pm Post subject: |
|
|
y, right jackyyll, also just saw that.
Anyway, the error doesnt pop up anymore, but it still saves only the first letter.
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sat Aug 09, 2008 2:20 pm Post subject: |
|
|
If the address is stored as Unicode, then shouldn't it be..?
| Code: |
wchar buffer[5] = L"";
//...
|
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat Aug 09, 2008 2:27 pm Post subject: |
|
|
And according to the OP, two bytes is a character in Unicode (true/false?). Which is why I happened to read 10 bytes (5 characters, 5*2=10).
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
jackyyll Expert Cheater
Reputation: 0
Joined: 28 Jan 2008 Posts: 143 Location: here
|
Posted: Sat Aug 09, 2008 2:31 pm Post subject: |
|
|
| oib111 wrote: | | And according to the OP, two bytes is a character in Unicode (true/false?). Which is why I happened to read 10 bytes (5 characters, 5*2=10). |
A unicode character is two bytes. 5 Unicode Character * 2 bytes each = 10 bytes so you need char buffer[10], or just wchar buffer[5].
Last edited by jackyyll on Sat Aug 09, 2008 2:33 pm; edited 1 time in total |
|
| Back to top |
|
 |
redhead Cheater
Reputation: 0
Joined: 21 Mar 2007 Posts: 47
|
Posted: Sat Aug 09, 2008 2:32 pm Post subject: |
|
|
Sorry, I never used wchar before.
What do I need to include to use this?
( <wchar.h> ?, but then it still doesnt work:
error C2065: 'wchar': nichtdeklarierter Bezeichner)
if I use wchar_t , it shows the "number" , instead of letters.
But I think U're right, if I uncheck "unicode" in cheatengine, it also shows only the first letter.
|
|
| Back to top |
|
 |
Overload Master Cheater
Reputation: 0
Joined: 08 Feb 2008 Posts: 293
|
Posted: Sat Aug 09, 2008 2:33 pm Post subject: |
|
|
| samuri25404 wrote: | If the address is stored as Unicode, then shouldn't it be..?
| Code: |
wchar buffer[5] = L"";
//...
|
|
he could just use a multi-byte character set instead of unicode.
_________________
Blog
| Quote: | Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that |
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sat Aug 09, 2008 2:34 pm Post subject: |
|
|
| oib111 wrote: | | And according to the OP, two bytes is a character in Unicode (true/false?). Which is why I happened to read 10 bytes (5 characters, 5*2=10). |
Yeah, a Unicode character is 2 bytes, but you were just reading regular characters, which are only one byte.
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sat Aug 09, 2008 2:40 pm Post subject: |
|
|
| readhead wrote: |
I want to read a word, wich is saved on an address in Unicode.
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sat Aug 09, 2008 3:55 pm Post subject: |
|
|
| oib111 wrote: | | Code: |
char buffer[5] = "";
|
|
char is Ansi/Multibyte, not Unicode.
_________________
|
|
| Back to top |
|
 |
slippppppppp Grandmaster Cheater
Reputation: 0
Joined: 08 Aug 2006 Posts: 929
|
Posted: Sat Aug 09, 2008 8:29 pm Post subject: |
|
|
try
char * Buffer;
ReadProcessMemory( hopen, ( LPVOID * ) ( DWORD ) 0x209E65C, &Buffer, sizeof( Buffer ), NULL );
std::cout << buffer << std::endl;
|
|
| Back to top |
|
 |
rapion124 Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Mar 2007 Posts: 1095
|
Posted: Sat Aug 09, 2008 8:42 pm Post subject: |
|
|
| Code: |
wchar_t szBuffer[5];
DWORD dwBytesRead;
ReadProcessMemory(hProcess, LPCVOID(0x1337C0DE), LPVOID(&szBuffer), sizeof(szBuffer), &dwBytesRead);
|
|
|
| Back to top |
|
 |
|