Global API hook.

How do i global hook an API function and replace it with something else? I read somewhere how to hook an API function, but just for you own application, do i need to inject a dll to every process? No MFC.

Thanks.
SwemetalAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkrCommented:
Yes, but there are frameworks that handle that - see e.g. "Detours" at http://research.microsoft.com/sn/detours/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Deepu AbrahamR & D Engineering ManagerCommented:

For your own application I think the best way is to create a dll with those functions and host it with your processes.This is much easier than extending the aplication using detours.

Best Regards,
DeepuAbrahamK
SwemetalAuthor Commented:
Is detours the only way of making an API hook global?
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

jkrCommented:
No, it is not the only way, but the one I would go if had to do that on MS systems.
SwemetalAuthor Commented:
And my other options are? Injecting a dll to every process?
Deepu AbrahamR & D Engineering ManagerCommented:
Yes, I would say injecting dlls to your processes.
Best Regards,
Deepu
SwemetalAuthor Commented:
Are you really really sure that deutors and dll injecting to every process is the only way of making an API hook global?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.