init repo
This commit is contained in:
commit
b8029c8a9d
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
.vscode
|
||||
.xmake/
|
||||
build/
|
||||
vsxmake
|
||||
vs2022
|
||||
vs2019
|
||||
42
hook_winapi/hook_winapi.cpp
Normal file
42
hook_winapi/hook_winapi.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include <iostream>
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef Hook_DLL_Name
|
||||
#define Hook_DLL_Name
|
||||
#endif
|
||||
|
||||
wstring GetDllFullPath(wstring& dllname)
|
||||
{
|
||||
wchar_t buffer[MAX_PATH];
|
||||
|
||||
DWORD length = GetCurrentDirectoryW(MAX_PATH, buffer);
|
||||
|
||||
if (length != 0)
|
||||
{
|
||||
return wstring(buffer) + L"\\" + dllname;
|
||||
}
|
||||
|
||||
return wstring(L"");
|
||||
}
|
||||
|
||||
|
||||
int maint()
|
||||
{
|
||||
auto cmdLine = GetCommandLineW();
|
||||
|
||||
int argc;
|
||||
auto argv = CommandLineToArgvW(cmdLine, &argc);
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
wstring dllName = Hook_DLL_Name;
|
||||
wstring dllPath = GetDllFullPath(dllName);
|
||||
wstring processName = wstring(argv[1]);
|
||||
|
||||
HookWindowsApi(dllPath, processName);
|
||||
|
||||
return 0;
|
||||
}
|
||||
9
hook_winapi/xmake.lua
Normal file
9
hook_winapi/xmake.lua
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
|
||||
target("hook_winapi")
|
||||
set_kind("binary")
|
||||
|
||||
add_defines("Hook_DLL_Name=hookdll.dll")
|
||||
add_includedirs("./")
|
||||
add_files("*.cpp")
|
||||
0
hookdll/dllmain.cpp
Normal file
0
hookdll/dllmain.cpp
Normal file
7
hookdll/xmake.lua
Normal file
7
hookdll/xmake.lua
Normal file
@ -0,0 +1,7 @@
|
||||
target("hookdll")
|
||||
set_kind("shared")
|
||||
|
||||
add_packages("microsoft-detours")
|
||||
|
||||
add_includedirs("./")
|
||||
add_files("*.cpp")
|
||||
Loading…
x
Reference in New Issue
Block a user