A global injection and hooking example. Injects into all processes and hooks the
MessageBoxW
function. Also hooks the CreateProcessInternalW
function to be
able to inject into newly created processes. Refer to the blog post for details:
Implementing Global Injection and Hooking in
Windows.
- Open the solution in Visual Studio.
- Go to Build -> Batch Build...
- Select the following three configurations, Configuration can be
Debug
orRelease
:- Project
global-inject-demo
, PlatformWin32
. - Project
global-inject-lib
, PlatformWin32
. - Project
global-inject-lib
, Platformx64
.
- Project
- Click on Build.
- Make sure you have the following files in your execution folder:
global-inject-demo.exe
32\global-inject-lib.dll
64\global-inject-lib.dll
- Run
global-inject-demo.exe
to load the library in all processes. - Close the window to unload the library from all processes.
Use any program that displays a message box using the MessageBoxW
WinAPI
function. An easy option is running slmgr.vbs
via the Run dialog (Win+R).