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 


Pointers In DLL
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
Xoujiro
Advanced Cheater
Reputation: 0

Joined: 20 Mar 2006
Posts: 86

PostPosted: Fri Nov 14, 2008 10:20 pm    Post subject: Pointers In DLL Reply with quote

so, my address in ce is

Quote:
342D8120+0x13


this is what ive done so far

Quote:

LONG hackhex;
LONG *hackbase = (LONG*)0x342D8120;
LONG *hack1;

hackhex = *hackbase;


I think this gives hackhex the value of hackbase in Decimal, but how do i change it to HEX?
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Fri Nov 14, 2008 10:38 pm    Post subject: Reply with quote

Code:
DWORD dwPtrVal = *((DWORD*)0x342D8120+0x13);


If you want to view it in hex, output your string in hex instead...

Code:
LPTSTR lpText = (LPTSTR)HeapAlloc(GetProcessHeap(), 0, sizeof(TCHAR)*64);
wsprintf(lpText, _T("Hex: 0x%X/Dec: %d"), dwPtrVal, dwPtrVal);
MessageBox(hWnd, lpText, _T("dwPtrVal"), MB_OK);
HeapFree(GetProcessHeap(), 0, (LPVOID)lpText);

_________________
Back to top
View user's profile Send private message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Fri Nov 14, 2008 11:02 pm    Post subject: Reply with quote

LPCWSTR lpText;
DWORD dwPtrVal = *((DWORD*)0x342D8120+0x13);
sprintf(lpText, "Hex is %X08 Dec is %d", dwPtrVal, dwPtrVal);
OutputDebugString(lpText);
Back to top
View user's profile Send private message
Xoujiro
Advanced Cheater
Reputation: 0

Joined: 20 Mar 2006
Posts: 86

PostPosted: Fri Nov 14, 2008 11:56 pm    Post subject: Reply with quote

But doesnt

Quote:
DWORD dwPtrVal = *((DWORD*)0x342D8120+0x13);


Give 0x342D8120+0x13 = 342d8133?
I want the value of 0x342D8120 into a hex(address) and that address + 0x13.
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Nov 15, 2008 1:04 am    Post subject: Reply with quote

No, pointers work diffrently.

A pointer points to the base address value + the offset.

And there's no such thing as "hex" values or "decimal" values, everything is binary, it's just the way you output the strings is diffrent, as lurc showed.
Back to top
View user's profile Send private message
Henley
Grandmaster Cheater
Reputation: 0

Joined: 03 Oct 2006
Posts: 671

PostPosted: Sat Nov 15, 2008 1:17 am    Post subject: Reply with quote

Xoujiro wrote:
But doesnt

Quote:
DWORD dwPtrVal = *((DWORD*)0x342D8120+0x13);


Give 0x342D8120+0x13 = 342d8133?
I want the value of 0x342D8120 into a hex(address) and that address + 0x13.

Code:
DWORD dwPtrVal = *(DWORD*)((*(DWORD*)dwAddr)+dwOffset);

try this?
Back to top
View user's profile Send private message
Xoujiro
Advanced Cheater
Reputation: 0

Joined: 20 Mar 2006
Posts: 86

PostPosted: Sat Nov 15, 2008 2:14 am    Post subject: Reply with quote

ok thanks lurc , i didnt know pointers can be used like that in c++ becuz in ce, its diff i think...

Last edited by Xoujiro on Sat Nov 15, 2008 2:42 am; edited 1 time in total
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Nov 15, 2008 2:25 am    Post subject: Reply with quote

A pointer doesn't have to be static, it could be a pointer to a pointer to a pointer..... to a pointer.
Back to top
View user's profile Send private message
Xoujiro
Advanced Cheater
Reputation: 0

Joined: 20 Mar 2006
Posts: 86

PostPosted: Sat Nov 15, 2008 2:49 am    Post subject: Reply with quote

okay...so i got the dwPtrVal to the right address ,

okay now how do i change the value of dwPtrVal?

why cant
Quote:
DWORD *change = (DWORD*)dwPtrVal;
*change = 9460300;

work?
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Nov 15, 2008 3:19 am    Post subject: Reply with quote

What's the value of dwPtrVal?
Back to top
View user's profile Send private message
Xoujiro
Advanced Cheater
Reputation: 0

Joined: 20 Mar 2006
Posts: 86

PostPosted: Sat Nov 15, 2008 3:23 am    Post subject: Reply with quote

dwPtrVal = *(DWORD*)0x0100BECC+0x100;

and then the value is 16777216 which is 0x01000000 the correct one.

so..i meant how do i change the value of value of dwPtrVal...


Last edited by Xoujiro on Sat Nov 15, 2008 3:26 am; edited 1 time in total
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Sat Nov 15, 2008 3:26 am    Post subject: Reply with quote

to set value:

Code:
*(DWORD*)( *(DWORD*)dwAddr + dwOffset) = yourvalue;

_________________
Back to top
View user's profile Send private message
Xoujiro
Advanced Cheater
Reputation: 0

Joined: 20 Mar 2006
Posts: 86

PostPosted: Sat Nov 15, 2008 3:32 am    Post subject: Reply with quote

Snootae wrote:
to set value:

Code:
*(DWORD*)( *(DWORD*)dwAddr + dwOffset) = yourvalue;


ok thanks for your help.. it works perfectly now i can complete my dll ^^ btw i like your maplestory trainer


okay now, how do i get the value of a TEXT address into C++, i need to compare it with another text, ive tried string but it fails with this error

Quote:
if ( *(string*)( *(DWORD*)dwID + dwIDOff) == ID ) {




Quote:
c:\documents and settings\mathew\my documents\visual studio 2008\projects\matt\matt\dllmain.cpp(94) : error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion)
c:\program files\microsoft sdks\windows\v6.0a\include\guiddef.h(192): could be 'int operator ==(const GUID &,const GUID &)'
while trying to match the argument list '(std::string, std::string)'
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Sat Nov 15, 2008 10:01 am    Post subject: Reply with quote

lstrcmp: http://msdn.microsoft.com/en-us/library/ms647488(VS.85).aspx
Back to top
View user's profile Send private message
Xoujiro
Advanced Cheater
Reputation: 0

Joined: 20 Mar 2006
Posts: 86

PostPosted: Sat Nov 15, 2008 11:00 am    Post subject: Reply with quote

HolyBlah wrote:
lstrcmp: http://msdn.microsoft.com/en-us/library/ms647488(VS.85).aspx


Quote:
LPCTSTR ID = "mystring";
LPCTSTR GG;


GG = (LPCTSTR)*(DWORD*) (*(DWORD*)dwID + dwIDOff);
if ( lstrcmp(GG,ID) == 0 ) {
do function
}

crashes me...i think its beause of the
Quote:
(LPCTSTR)*(DWORD*) (*(DWORD*)dwID + dwIDOff)
part...the address are 100% correct.
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