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 


Attaching using PID...

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Thu Mar 14, 2013 1:59 pm    Post subject: Attaching using PID... Reply with quote

Hey, When I attach using PID, its "successfully"attaching to any random bytes..

Like if I make a trainer form, put inside Editbox, and a button, that will do this:

Code:
function attach()
local pname=tonumber(control_getCaption( UDF1_CEEdit1 ));
if pname ~='' then
openProcess(pname)
local err=getOpenedProcessID()
if err==0 then
 showMessage("Failed attaching to the given PID")
 elseif err~=0 then
  control_setEnabled(UDF1_CEButton2, true)
  control_setCaption(UDF1_CELabel4, "Currently attached to PID: " .. err)
  showMessage("Succeed attaching to the given PID")
if pname=='' then return end
 end
 end
end


But if I write random numbers (e.g 123854031292) it still success attaching..

Although its not really attached to any processor (no processor has been opened in C.E).
How can I prevent this or fix this?

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 468

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

PostPosted: Thu Mar 14, 2013 2:03 pm    Post subject: Reply with quote

Hmm, doesn't look like it.

But what you can do is use this code after openProcess:
Code:

errorOnLookupFailure(false)
reinitializeSymbolhandler()
err=getAddress("kernel32.dll")==0


err will be true if no process is open

_________________
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
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Thu Mar 14, 2013 2:13 pm    Post subject: Reply with quote

Dark Byte wrote:
Hmm, doesn't look like it.

But what you can do is use this code after openProcess:
Code:

errorOnLookupFailure(false)
reinitializeSymbolhandler()
err=getAddress("kernel32.dll")==0


err will be true if no process is open

Code:
function attach()
local pname=tonumber(control_getCaption( UDF1_CEEdit1 ));
if pname ~='' then
openProcess(pname)
errorOnLookupFailure(false)
reinitializeSymbolhandler()
err=getAddress("kernel32.dll")==0
if err==0 then
 showMessage("Failed attaching to the given PID")
 elseif err~=0 then
  showMessage("Succeed attaching to the given PID")
if pname=='' then return end
 end
 end
end

Did this, but It still gives the message "Succeed attaching to the given PID"
And solution for this?

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 468

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

PostPosted: Thu Mar 14, 2013 2:15 pm    Post subject: Reply with quote

err is a boolean, not an integer
true isn't the same as 0 (not even in c)

try "if err then " (or "if err==true then")

or in my script change err=getAddress("kernel32.dll")==0 to err=getAddress("kernel32.dll")

_________________
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
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Thu Mar 14, 2013 2:18 pm    Post subject: Reply with quote

Dark Byte wrote:
err is a boolean, not an integer
true isn't the same as 0 (not even in c)

try "if err then "

Oh didn't noticed the last line Razz my bad.
Yes it works now,
Saw at the end ==0 so though i need to check if its ==0 ..
Anyway thanks!.

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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