Skip to content

0xPh0enix/APIHook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

APIHook

X86 API Hook

This is a very simple C++ class for X86 API Hooking.

Code Example:


#include "cHook.h"

BYTE bPatch[6];

int WINAPI MessageBoxAHook(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType) {

    cHook::UnHookFunction("user32.dll", "MessageBoxA", bPatch);

    int iResult =  MessageBoxA(NULL, "Hooked", "Hooked", MB_OK | MB_ICONERROR);

	cHook::HookFunction("user32.dll", "MessageBoxA", MessageBoxAHook, bPatch);
	
	return iResult;

}

int main()
{
   

    cHook::HookFunction("user32.dll", "MessageBoxA", MessageBoxAHook, bPatch);

    Sleep(500);

    MessageBoxA(NULL, "Hook Me", "Hook", MB_OK);

    cHook::UnHookFunction("user32.dll", "MessageBoxA", bPatch);

    return EXIT_SUCCESS;
}


Releases

No releases published

Packages

No packages published

Languages