Click here to Skip to main content
15,886,795 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
I've recently created a "hello world" c++ program:

C++
#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
    MessageBoxA(NULL, "Hello World!", "", MB_OK);
    return 0;
}


What I need to do now is create a dll that hooks MessageBoxA API and changes the message (I want to load the dll from my main program using LoadLibrary).

I've downloaded and properly installed MS Detours 3.0 and have searched the web for help, but I'm completely stuck! Any help would be appreciated in creating that dll.

Thanks in advance.

What I have tried:

Searching the web and trying everything I found.
Posted
Updated 21-May-16 6:32am

1 solution

Please see this CodeProject article: API hooking revealed[^].

See also this open-source project at GitHub: EasyHook[^].

—SA
 
Share this answer
 
Comments
Member 12537558 21-May-16 13:36pm    
Thank you very much.
I've come across both this article and this project and could still not make a dll file that hooks MessageBoxA.
Any further help would be appreciated!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900