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 


problem with getProcessIDFromProcessName

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
nvz
Newbie cheater
Reputation: 0

Joined: 02 Jul 2016
Posts: 21

PostPosted: Thu Nov 24, 2016 8:28 am    Post subject: problem with getProcessIDFromProcessName Reply with quote

EDIT: ok, it just happened again. The autoAssemble fails and the cheat doesnt load correctly. I opened the program with "cheat engine" and i can confirm that there is no injection, even if i used "if autoAssemble([[]])==true".

As far as i know it should try to use the autoAssemble every 10ms until
it returns true, but it doenst.

ORIGINAL POST:
hi, i need some help with initizializing the hack program i'm writing. Sorry
if the post is long but it's easy to understand.

I need to inject code as soon as the program starts (i think i can wait one second max before injecting). However sometimes the autoAssemble scripts fails (probably is used too soon). This is the code i use:

function CETimer1Timer(sender)

if (HackWaitingLaunch==true) then
if getProcessIDFromProcessName("game.exe") ~= nil then
openProcess("game.exe")
HackWaitingLaunch=false
HackLoadInit=true


end

end


if (HackLoadInit==true) then

if (autoAssemble([[

alloc(HackInitMem,2048)
alloc(ScriptsPointerArray,1024000)
alloc(InitVariables,2048)
registersymbol(InitVariables)
registersymbol(ScriptsPointerArray)

//blah blah blah

mov [InitVariables+10], 1

]])==true) then

HackLoadInit=false
HackGameFound=true

end

end


if (HackGameFound==true) then

a=ReadBytes(GetAddress("InitVariables")+0x10,1,false)

if (a==1) then
WriteBytes(GetAddress("InitVariables")+0x10,0)
HackMainInjection()
HackGameFound=false
end

end

end

The timer is created in the Form Designer and set to 10ms. After the first
injection, the code will set the variables [InitVariables+10] to allow
the code to execute the "next" part of the loading.

The problem that i was having was that the autoAssemble would fail and so the InitVariables symbol was not registered, so the final part of the code couldnt work. So i added the check (if autoAssemble=true) etc.
Do you think the code is correct? I ask because i cannot replicate the bug,
on my computer it seem to work but on other people computer it may
have problems.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Nov 24, 2016 9:56 am    Post subject: Reply with quote

Nowhere in the code do I see you set
Code:
HackWaitingLaunch=true

But, anyway, maybe this setup will be easier to play with:
Code:
local timer = createTimer(nil, false)
timer.Interval = 100
timer.OnTimer = function(timer)
  if readInteger("Calculator.exe") == nil then
    openProcess("Calculator.exe")
  else
    local init = readInteger("InitVariables+10")
    if init == nil then
      autoAssemble([[
        alloc(InitVariables,2048)
        registersymbol(InitVariables)
      ]])
    elseif init == 1 then
      print("done")
      timer.Destroy()
    else -- just to test it (DELETE ME)
      autoAssemble([[
        InitVariables+10:
        dd 1
      ]])
    end
  end
end
timer.Enabled = true
Back to top
View user's profile Send private message
nvz
Newbie cheater
Reputation: 0

Joined: 02 Jul 2016
Posts: 21

PostPosted: Thu Nov 24, 2016 11:16 am    Post subject: Reply with quote

EDIT:
hi, i'm testing your code right now, and it's interesting that if i launch
the script in CE with "execute script" button it works, but when i make
an executable it doenst work. Any idea why? maybe my settings arent
right, but i never had any problem with them before.
I tested it with an empty executable, i just created a form.



hi, thanks. The hackwaitinglaunch variable is initialized in another place.

I tested your code with calc.exe, and works well, i noticed that it uses more
CPU than mine (if i drag the CE window it lags, with my code it doenst lag).
Maybe because your code is safer than mine?

however, just to explain what the code is doing: after attaching the process,
it does a first injection, so it can retrieve all the pointers that i need, when
it has all the pointers it sets [InitVariables+10] to 1, so it can do the rest
of the injection (which requires the pointers that were found).

I will use your code in my program and see if it solves. Thanks.
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 Gamehacking 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