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 


[C] Hook Question

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
BirdsEye
Advanced Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 94

PostPosted: Mon Feb 21, 2011 3:51 pm    Post subject: [C] Hook Question Reply with quote

Hi guys, it's been a long time since I programmed and I'm trying new things for fun... I haven't had much experience with hooking API/functions and related topics, like finding start addresses and such (I'm sure there's a connection). I was wondering if it was possible to "copy" a function. By this, I don't mean copying the function's source code but rather having the original binary that does and call the function from that. Calling a function from another source but not actually have written it. For example, there's a program which hooks the Time/Date function in Notepad. Is it possible that if you keep the binary with the desired function (Notepad) and then each time I command, my program calls that function to do exactly as it does? (print the Time/Date)
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Feb 21, 2011 5:30 pm    Post subject: This post has 1 review(s) Reply with quote

Not really understanding your question.

From what I'm assuming, you want to have two different executables calling each other? Possible, sure, practical not at all since you will need to have some type of pipe/connection between the two. Along with that the connection would have to be synced / blocking to ensure thread safety.

A similar approach to this is called detouring. But you are writing the new code inside the process you are targeting and altering the original code to redirect to yours.

What are you trying to accomplish in the end though?

(As said I'm assuming based on your question since it's not that clear.)

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
BirdsEye
Advanced Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 94

PostPosted: Tue Feb 22, 2011 8:47 pm    Post subject: Reply with quote

Nice to see you back Wiccaan. Smile I understand my question doesn't make much sense. I can't fully explain what I have in mind so this is the response I was looking for... I was only wondering if it was feasible to achieve this. In the end I'm trying to accomplish, as you perfectly stated, having two executables call each other.
However,
Quote:
But you are writing the new code inside the process you are targeting and altering the original code to redirect to yours.

I'm just trying to redirect the original code to mine, nothing else, not modify it. In the end, I want to call a function from another library which isn't mine but belongs to another executable, however that function operates in my executable. [/quote]
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Wed Feb 23, 2011 5:00 pm    Post subject: Reply with quote

BirdsEye wrote:
Nice to see you back Wiccaan. Smile I understand my question doesn't make much sense. I can't fully explain what I have in mind so this is the response I was looking for... I was only wondering if it was feasible to achieve this. In the end I'm trying to accomplish, as you perfectly stated, having two executables call each other.
However,
Quote:
But you are writing the new code inside the process you are targeting and altering the original code to redirect to yours.

I'm just trying to redirect the original code to mine, nothing else, not modify it. In the end, I want to call a function from another library which isn't mine but belongs to another executable, however that function operates in my executable.


Since you are working with two executables, I'm still going to refer to what I said above. You will have to do a lot of work in order to have them communicate together if they weren't created to do so in the first place. Along with ensuring thread safety and so on so they don't crash.

Do you have to be using two exectuables? You can always inject a DLL into the process and hook the functions you need to hook and have them redirect to functions inside your DLL instead. Which will achieve the similar effect just without using a 2nd exe.

_________________
- Retired.
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 -> General programming 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