Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


2 questions, TEXT search Cheatengine --> C++
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
redhead
Cheater
Reputation: 0

Joined: 21 Mar 2007
Posts: 47

PostPosted: Sat Aug 09, 2008 12:53 pm    Post subject: 2 questions, TEXT search Cheatengine --> C++ Reply with quote

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
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat Aug 09, 2008 1:11 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
redhead
Cheater
Reputation: 0

Joined: 21 Mar 2007
Posts: 47

PostPosted: Sat Aug 09, 2008 1:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
jackyyll
Expert Cheater
Reputation: 0

Joined: 28 Jan 2008
Posts: 143
Location: here

PostPosted: Sat Aug 09, 2008 1:53 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address MSN Messenger
redhead
Cheater
Reputation: 0

Joined: 21 Mar 2007
Posts: 47

PostPosted: Sat Aug 09, 2008 1:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sat Aug 09, 2008 2:20 pm    Post subject: Reply with quote

If the address is stored as Unicode, then shouldn't it be..?

Code:

wchar buffer[5] = L"";

//...

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat Aug 09, 2008 2:27 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
jackyyll
Expert Cheater
Reputation: 0

Joined: 28 Jan 2008
Posts: 143
Location: here

PostPosted: Sat Aug 09, 2008 2:31 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address MSN Messenger
redhead
Cheater
Reputation: 0

Joined: 21 Mar 2007
Posts: 47

PostPosted: Sat Aug 09, 2008 2:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Sat Aug 09, 2008 2:33 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sat Aug 09, 2008 2:34 pm    Post subject: Reply with quote

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.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat Aug 09, 2008 2:40 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sat Aug 09, 2008 3:55 pm    Post subject: Reply with quote

oib111 wrote:
Code:

char buffer[5] = "";


char is Ansi/Multibyte, not Unicode.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
slippppppppp
Grandmaster Cheater
Reputation: 0

Joined: 08 Aug 2006
Posts: 929

PostPosted: Sat Aug 09, 2008 8:29 pm    Post subject: Reply with quote

try

char * Buffer;

ReadProcessMemory( hopen, ( LPVOID * ) ( DWORD ) 0x209E65C, &Buffer, sizeof( Buffer ), NULL );

std::cout << buffer << std::endl;
Back to top
View user's profile Send private message AIM Address MSN Messenger
rapion124
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Mar 2007
Posts: 1095

PostPosted: Sat Aug 09, 2008 8:42 pm    Post subject: Reply with quote

Code:

wchar_t szBuffer[5];
DWORD dwBytesRead;

ReadProcessMemory(hProcess, LPCVOID(0x1337C0DE), LPVOID(&szBuffer), sizeof(szBuffer), &dwBytesRead);
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites