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 


readInteger/readPointer problem

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
MexKexFlex
How do I cheat?
Reputation: 0

Joined: 02 Mar 2015
Posts: 8

PostPosted: Mon Mar 02, 2015 8:44 am    Post subject: readInteger/readPointer problem Reply with quote

Here is my problem.

I have 32 bit process and an address 02023244.

I do:
Code:
local ptr = readPointer("02023244")


I get:
Code:
ffffffffdf9e0000


It should be df9e0000, because memory view looks like this:

02023240: 00000000
02023244: df9e0000
02023248: 00101001


Then I want to read from this pointer another one:
Code:
local ptr2 = readPointer(ptr + 4)


After I do this ptr2 equals nil. I think the problem is that
it reads signed integer and it converts it to 64bit address and when
I'm trying to pass this value to another readPointer it reads 64 bit address
instead of 32 bit, so it tries to read ffffffffdf9e0000 instead of df9e0000 (???)

How to read it properly?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25288
Location: The netherlands

PostPosted: Mon Mar 02, 2015 8:52 am    Post subject: Reply with quote

weird. Looks like a bug
use bAnd(value,0xffffffff) to convert it to a 32-bit value

_________________
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
View user's profile Send private message MSN Messenger
MexKexFlex
How do I cheat?
Reputation: 0

Joined: 02 Mar 2015
Posts: 8

PostPosted: Mon Mar 02, 2015 9:08 am    Post subject: Reply with quote

Dark Byte wrote:
weird. Looks like a bug
use bAnd(value,0xffffffff) to convert it to a 32-bit value


Thanks. That solved the problem for me. I've tried before some C bitwise operators like "&", but I forgot it's lua, also I forgot to mention that it only
happens when cheat engine is 64 bit and target process is 32.
When I run 32 bit version of cheat engine everything
seems to be working just fine.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon Mar 02, 2015 10:38 am    Post subject: Reply with quote

Hmm, it works as expected:

_________________
Back to top
View user's profile Send private message MSN Messenger
MexKexFlex
How do I cheat?
Reputation: 0

Joined: 02 Mar 2015
Posts: 8

PostPosted: Mon Mar 02, 2015 10:47 am    Post subject: Reply with quote

mgr.inz.Player wrote:
Hmm, it works as expected:


You read 64 bit pointer from 64 bit process - in this case everything is working. When you run 64-bit cheat engine and you will try to read integer from 32-bit process that is greater than 0x7FFFFFFF you will end up with FFFFFFFF90909090 if the value that you're trying to read is f.ex 90909090.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon Mar 02, 2015 11:09 am    Post subject: Reply with quote

Hmm, the same is with readInteger.


Anyway, readPointer is designed to read pointers. Where did you find 32bit process which can use address above 7FFFFFFF ?


ASLR mechanism ?

_________________
Back to top
View user's profile Send private message MSN Messenger
MexKexFlex
How do I cheat?
Reputation: 0

Joined: 02 Mar 2015
Posts: 8

PostPosted: Mon Mar 02, 2015 11:28 am    Post subject: Reply with quote

According to microsoft the Virtual Address Space for process can be adjusted: BCDEdit /set increaseuserva Megabytes

but, it can't be higher than 3GB.

This 32-bit process is TERA.exe - MMORPG game. I'm just reading some local player information.

Pointers like FDC85000 are for this game normal thing, which is way more than 3GB.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon Mar 02, 2015 12:54 pm    Post subject: Reply with quote

In that case, use my _readPointer function.
Code:
function _readPointer(a)
  local v=readPointer(a)

  if targetIs64Bit() then return v
  elseif v~=nil      then return v % 0x100000000
  else return nil
  end
end




and _readInteger function.
Code:
function _readInteger(a)
  local v=readInteger(a)

  if v~=nil then return v % 0x100000000
  else           return nil
  end
end

_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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