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 


Unhook api

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

Joined: 12 Mar 2006
Posts: 21

PostPosted: Tue Sep 26, 2006 3:11 am    Post subject: Unhook api Reply with quote

Dark Byte, you know how to unhook api function?

i have tried to back up the 1st 6 bytes of the function, but when i try to write back the 6 bytes, i get access violation, because the VirtualProtect also hooked, i don't know what else can i do Sad
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Sep 26, 2006 3:24 am    Post subject: Reply with quote

make a copy of the original bytes (using the disasembler/assembler combination) and then when you want to call the function you call the rewritten code.

or you can write a devicedriver that simulates virtualprotect for you allowing you to make memory writable

_________________
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
hcong
Newbie cheater
Reputation: 0

Joined: 12 Mar 2006
Posts: 21

PostPosted: Tue Sep 26, 2006 7:11 am    Post subject: Reply with quote

Code:
library GameHack;

uses Windows;

type TSendInput = function(cInputs: Cardinal; var pInputs: tagINPUT; cbSize: Integer): Cardinal;

function NewSendInput(cInputs: Cardinal; var pInputs: tagINPUT; cbSize: Integer): Cardinal; stdcall;
var
  Proc: Pointer;
  SendInput: TSendInput;
begin
  Proc := VirtualAlloc(nil, 15, MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE);
  CopyMemory(Proc, GetProcAddress(GetModuleHandle('User32'), 'SendInput'), 15);
  SendInput := Proc;
  Result := SendInput(cInputs, pInputs, cbSize);
end;

exports NewSendInput;

begin
end.


i know this code is useless after the api hooked, but is just an example, when i call the NewSendInput, i get access violation, the function cannot work properly(the original api is not yet hook)

i have try run the dll in debugger, the function is copy correctly to the space i allocate, the call address also correct, so i really don't know what is the problems.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Sep 26, 2006 8:34 am    Post subject: Reply with quote

missing stdcall;
_________________
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
hcong
Newbie cheater
Reputation: 0

Joined: 12 Mar 2006
Posts: 21

PostPosted: Tue Sep 26, 2006 9:59 am    Post subject: Reply with quote

thanks Dark Byte, it work well now, i seldom program in delphi, so i not really know what the stdcall use for Confused
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Sep 26, 2006 10:15 am    Post subject: Reply with quote

to use the standard calling method used by windows.

also, if you plan on using this method on nprotect thats not going to work. That specific api is also hooked in kernelmode

_________________
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
hcong
Newbie cheater
Reputation: 0

Joined: 12 Mar 2006
Posts: 21

PostPosted: Tue Sep 26, 2006 11:08 am    Post subject: Reply with quote

you mean if i want to bypass nProtect, i need to unhook in both usermode and kernelmode?

Sad Sad
i didn't learn how to write devicedriver yet

any suggestion on where to start? i cannot find any ebook or tutorial on internet Sad Sad
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Sep 26, 2006 11:29 am    Post subject: Reply with quote

i'm not sure. I know it is hooked, but some people say they can use it with that method, so theyr hook must be crappy.

anyhow, you could rewrite a unused sdt entry with the address of sendinput, and then change the eax value to that unused entry

I know you don't understand this, but when you do, this is the best solution. (and you can always try to disable their driver)

_________________
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
hcong
Newbie cheater
Reputation: 0

Joined: 12 Mar 2006
Posts: 21

PostPosted: Wed Sep 27, 2006 12:24 am    Post subject: Reply with quote

Quote:
you could rewrite a unused sdt entry with the address of sendinput, and then change the eax value to that unused entry


sounds interested, can you explain in more details?
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 Source 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