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 


getting handle to my trainer

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 215

PostPosted: Sat Jun 08, 2019 8:50 am    Post subject: getting handle to my trainer Reply with quote

I want my trainer to close if some memory scanner open a handle to my CE trainer process .
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 368

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

PostPosted: Sat Jun 08, 2019 10:10 am    Post subject: Reply with quote

getHandleList(3) will return a list of all the handles to your trainer (make sure the driver file is attached to your trainer package)

Keep in mind that some processes have your process open by default e.g system and some services

but what you can do is get a list of handles, close as many as you can, and then scan for changes in the list

e.g:
Code:

enableDRM() --just one extra layer
x=getHandleList(3)
for i=1,#x do
  if x[i].ProcessID~=getCheatEngineProcessID() then
    closeRemoteHandle(x[i].HandleValue, x[i].ProcessID)
  end
end

minimumlist=getHandleList(3) --the list with the least amount of handles
minlist={}
for i=1,#minimumlist do
  minlist[minimumlist[i].HandleValue]=true
end

thr=createThread(function(t)
  while t.Terminated==false do
    local currentlist=getHandleList(3)
    local i
    local found
    for i=1,#currentlist do
      --check if this entry is in the o\ld list
      if currentlist[i].ProcessID~=getCheatEngineProcessID() then --allow CE opening itself               
        if minlist[currentlist[i].HandleValue]==nil then --not found, it's a new handle   
          if (currentlist[i].GrantedAccess & 0x30)~=0 then --a new handle with read or write access
            closeCE()
          end
        end
      end
    end
    sleep(1000)
  end
end)

(It will freeze for a few seconds)

You can also apply this to the target process, and watch for debuggers that look at what memory it changes

_________________
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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions 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