| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		Gi@nnis Cheater
  Reputation: 1
  Joined: 26 Oct 2013 Posts: 32 Location: Greece
  | 
		
			
				 Posted: Fri Aug 08, 2014 4:33 pm    Post subject: Check if pointer points | 
				       | 
			 
			
				
  | 
			 
			
				How do I verify that a pointer point somewhere?
 
 
Lets say that I expect at [esi+18] to be a pointer. But for some reason 1/1000 times there isn't one.
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Dark Byte Site Admin
  Reputation: 470
  Joined: 09 May 2003 Posts: 25807 Location: The netherlands
  | 
		
			
				 Posted: Fri Aug 08, 2014 4:48 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				usually check if it's NULL  (0)
 
 	  | Code: | 	 		  
 
cmp [esi+18],0
 
je nopointer
 
 | 	  
 
 
but if it can be random garbage then you're out of luck. You could write a complicated call to virtualquery to get the protection of that address, but it's kinda slow if it's called a lot, and it's not an easy to setup function to call
 _________________
 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 | 
		 | 
	
	
		  | 
	
	
		Gi@nnis Cheater
  Reputation: 1
  Joined: 26 Oct 2013 Posts: 32 Location: Greece
  | 
		
			
				 Posted: Sat Aug 09, 2014 9:52 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | Dark Byte wrote: | 	 		  usually check if it's NULL  (0)
 
 	  | Code: | 	 		  
 
cmp [esi+18],0
 
je nopointer
 
 | 	  
 
 
but if it can be random garbage then you're out of luck. You could write a complicated call to virtualquery to get the protection of that address, but it's kinda slow if it's called a lot, and it's not an easy to setup function to call | 	  
 
 
Yeah that's what I though. I wanted someone with more experience to verify it, because testing result as not as reliable (might work now but not work later).
 
 
As far as I can test it, it works fine.
 
 
Thanks! As always, very helpful.  
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		 |