NoteZ
NoteZ copied to clipboard
Detours 解析
Prologue
Detours, 微软开源的 Inlinehook Framework.
Somniloquy
Build
使用 nmake 编译, 编译前使用 Microsoft_Visual_Studio_2017\VC\Auxiliary\Build\vcvars32.bat
初始化下
x86 的环境变量, 之后直接切入到 src\
, nmake 即可.
Key Function
DetourCreateProcessWithDllExW
创建进程并注入 detours.dll.
step by step: hook process
- 使用
CreateProcessA
函数, 并以CREATE_SUSPENDED
flag 打开进行文件创建进程 - 使用
DetourUpdateProcessWithDll
进行导入表注入. - 使用
DetourCopyPayloadToProcess
函数保存数据至.detour
section
step by step: hook restore process
-
DetourRestoreAfterWith
:{DetourFindPayloadEx
->DetourRestoreAfterWithEx
}