百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

AppInitHook

> 编程语言
开源

基于 AppInit_DLLs 的全局用户模式钩子框架。目的是让您快速开发钩子,以便在任意进程中进行注入。

189 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

基于 AppInit_DLLs 的全局用户模式钩子框架。目的是让您快速开发钩子,以便在任意进程中进行注入。

AppInitHook

Global user-mode hooking framework, based on AppInit_DLLs. The goal is to allow you to rapidly develop hooks to inject in an arbitrary process.

Building & Usage

bash
cmake -B build
cmake --build build --config Release

Alternatively you can open this folder in a CMake-supported IDE (Visual Studio, CLion, Qt Creator, etc).

The first time you use this framework you need to build and register AppInitDispatcher.dll in the AppInitDLLs registry key. You can do so by building the register_AppInitDLLs target. This will also create AppInitHook.ini in your build folder where you can customize which module gets loaded in which process:

ini
[TestLoader.exe]
Module=ExitProcess.dll

Now if you run the TestLoader target you should see it exits immediately instead of showing a Hello world! message box.

Debugging

You can use DebugView with the filter [AppInitHook]* to see the dlog and dlogp messages, or you can break on DLL load of AppInitDispatcher.dll in x64dbg.

Developing modules

The AppInitExampleModule hooks SetCurrentDirectoryW:

cpp
#include "HookDll.hpp"

/* MSDN Signature:
BOOL SetCurrentDirectory(
	LPCTSTR lpPathName
);
*/
HOOK(kernelbase.dll, BOOL WINAPI, SetCurrentDirectoryW)(
	LPCWSTR lpPathName
)
{
	dlogp("'%S'", lpPathName);
	return original_SetCurrentDirectoryW(lpPathName);
}

BOOL WINAPI DllMain(
	_In_ HINSTANCE hinstDLL,
	_In_ DWORD     fdwReason,
	_In_ LPVOID    lpvReserved
)
{
	return HookDllMain(hinstDLL, fdwReason, lpvReserved);
}

For more examples you can check the Modules folder.

Private Modules

If you enable -DAPPINITHOOK_PRIVATE_MODULES=ON it will look for Private/cmake.toml where you can add your own modules:

toml
[target.MyPrivateModule]
type = "shared"
sources = ["MyPrivateModule/*.cpp", "MyPrivateModule/*.hpp"]
link-libraries = ["HookDll"]

You can set up your own private git repository in this folder if you desire, since the folder is fully ignored by the .gitignore of this project.

Credits

  • MinHook by Tsuda Kageyu
  • ntdll.h by Matthijs Lavrijsen
  • Can Bölük for helping with the HOOK macro

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ccmakecmkrcpphook-framework

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言