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 


How to get the allocated address on LOCAL autoassemble?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 959

PostPosted: Sun Sep 27, 2015 2:51 pm    Post subject: How to get the allocated address on LOCAL autoassemble? Reply with quote

I'm experiment with some ffi like api call from ce lua.

Here the base test lua script :
Code:
local aamci = [[
LOADLIBRARY(winmm.dll)
globalalloc(__mci,$4000)
__mci:
dq __mci,winmm.mcisendstringa
]]

print(tostring(autoAssemble(aamci,true))) -- last true is for local (CE) execution of the aa script


The script work, and the dll is injected and address mcisendstringa is correctly written .
The problem is how to get the allocated address __mci?

Since the ce is not the opened process, and will not be opened, the symbol __mci didn't appear in user symbol list.
I'm thinking of also write __mci into "cheatengine-x86_64.exe"+0fc0, but then how to get the 'ce exe' module name properly?

Probably any address in the running ce memory space that can be reliable read and write will be fine.

Thank you~

added:
oops, ce already loaded winmm.dll.

_________________
- Retarded.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Sun Sep 27, 2015 3:10 pm    Post subject: Reply with quote

ce ALWAYS loads at 00400000 (even the 64-bit version), so you can hardcode it at 00400fc0


Also, getAddress("__mci", true)

_________________
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


Last edited by Dark Byte on Sun Sep 27, 2015 3:12 pm; edited 2 times in total
Back to top
View user's profile Send private message MSN Messenger
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 959

PostPosted: Sun Sep 27, 2015 3:11 pm    Post subject: Reply with quote

Dark Byte wrote:
ce ALWAYS loads at 00400000 (even the 64-bit version), so you can hardcode it at 00400fc0

Also, getAddress("__mci", true)


Thankk you!! This is convenient Very Happy

Here an symbol lookup function for lua expression so that the getaddress function can be handy to locate in disassembler window for whom may need.

Code:
function finalsl(luaexpr)
--  print("<"..luaexpr..">")
  if luaexpr:sub(1,1)=='^' then
    luaexpr=string.format("getAddress('%s',true)",luaexpr:sub(2,-1))
  end
  local lf = loadstring("return "..luaexpr)
  if type(lf)=='function' then
    local ok,ret = pcall(lf)
    if ok and type(ret)=='number' then
      return ret
    end
  end
end

if slregistered~=nil then
  unregisterSymbolLookupCallback(slregistered)
  slregistered = nil
end

slregistered = registerSymbolLookupCallback(finalsl,slFailure)


Can be enter "getAddress('__mci',true)" (with double quote) or "^__mci" (also prefix with ^) in address input to locate the local symbol.

_________________
- Retarded.
Back to top
View user's profile Send private message
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