![]() |
|
#1
|
||||
|
||||
|
With this library, you can set up function hooking easily and write less code.
It supports both Inline hooking & IAT hooking on both 32-bit & 64-bit. Eg. To hook/un-hook a function with the Inline Hooking technique, you only need to write codes as the following Code:
#include "cpp-hooking/hooking.h"
// Define the hooking function
int WINAPI hkMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType)
{
lpText = L"INL Hooked";
return INLHookingManager::instance().invoke<int>(MessageBoxW, hWnd, lpText, lpCaption, uType);
}
// Perform hooking
INLHookingManager::instance().hook(MessageBoxW, hkMessageBoxW);
// Perform un-hooking
INLHookingManager::instance().unhook(MessageBoxW);
Code:
#include "cpp-hooking/hooking.h"
// Define the hooking entry
#define Entry_MessageBoxW { "cpp-hooking.exe"s, "user32.dll"s, "MessageBoxW"s }
// Define the hooking function
int WINAPI hkMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType)
{
lpText = L"IAT Hooked";
return IATHookingManager::instance().invoke<int>(Entry_MessageBoxW, hWnd, lpText, lpCaption, uType);
}
// Perform hooking
IATHookingManager::instance().hook(Entry_MessageBoxW, hkMessageBoxW);
// Perform un-hooking
IATHookingManager::instance().unhook(Entry_MessageBoxW);
Follow me on GitHub @ https://github.com/vic4key Regards, Vic P. Last edited by vic4key; 11-07-2023 at 15:26. Reason: forum auto remove unexpected chars when submitting the post |
| The Following 4 Users Gave Reputation+1 to vic4key For This Useful Post: | ||
| The Following 13 Users Say Thank You to vic4key For This Useful Post: | ||
ahmadmansoor (11-07-2023), astroid (11-09-2023), besoeso (11-08-2023), blue_devil (11-07-2023), canopus (01-12-2024), chants (11-12-2023), darkBLACK (11-09-2023), Dr.FarFar (04-14-2024), NoneForce (11-07-2023), pnta (11-12-2023), WillyTerra (11-19-2023), wilson bibe (11-07-2023), zhongtiany (11-07-2023) | ||
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Python Hooking - Write Less Do More | vic4key | Source Code | 2 | 12-29-2023 10:06 |
| Write Access on Win9x | nikola | General Discussion | 2 | 04-27-2005 20:23 |
| How to write a dubug like OllDbg? | rivenhuang | General Discussion | 3 | 02-27-2004 15:06 |
| For those who write tutorials. | Nilrem | General Discussion | 4 | 02-03-2004 00:21 |