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 


C++ pointer

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Snootae
Grandmaster Cheater
Reputation: 0

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

PostPosted: Wed Dec 23, 2009 2:17 am    Post subject: C++ pointer Reply with quote

so ive got this function

Code:
__inline ULONG_PTR readpointer(ULONG_PTR* ulBase, INT nOffset){
   if ( !IsBadReadPtr((VOID*)ulBase, sizeof(ULONG_PTR)) )
      if ( !IsBadReadPtr((VOID*)((*(ULONG_PTR*)ulBase)+nOffset), sizeof(ULONG_PTR)) )
         return *(ULONG_PTR*)((*(ULONG_PTR*)ulBase)+nOffset);
   return 0;
}


and it works for a simple pointer, but i am trying to read a pointer with 2 seperate offsets

i tried this, hoping i could pull some random shit and make it work

Code:
__inline ULONG_PTR readpointer(ULONG_PTR* ulBase, INT nOffset, INT nOffset2){
   if ( !IsBadReadPtr((VOID*)ulBase, sizeof(ULONG_PTR)) )
      if ( !IsBadReadPtr((VOID*)(((*(ULONG_PTR*)ulBase)+nOffset)+nOffset2), sizeof(ULONG_PTR)) )
         return *(ULONG_PTR*)(((*(ULONG_PTR*)ulBase)+nOffset)+nOffset2);
   return 0;
}


anyone know how i could do this properly?

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Dec 23, 2009 3:41 am    Post subject: Reply with quote

ew

why don't you just use an array for the offsets?

also IsBadxx() calls are pretty iffy.
Back to top
View user's profile Send private message
NoMercy
Master Cheater
Reputation: 1

Joined: 09 Feb 2009
Posts: 289

PostPosted: Wed Dec 23, 2009 11:19 am    Post subject: Reply with quote

its fm kitterz source right ?

well, if u did it like thisi

DWORD base = 0x01
DWORD offset1 = 0x02
DWORD offset2 = 0x03

simple do base + offset 1 = DWORD baseoffset1

baseoffset1+offset2 = ur pointer

it will work like that, u can take a look at it, if kitterz source, at the mouse x position , in the set pointers value to the window
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
Page 1 of 1

 
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