Simple hooking system.
Steps to build:
- Install Git
- Install CMake
- Install Visual Studio 2019
- Open
build.ps1
and change where your Ebenezer, AIServer and KnightOnline paths accordingly. - Open
Developer Command Prompt for VS 19
and execute the following commands:powershell .\build.ps1
After the first execution of the script, you can use the KOHook.sln
to build from there or debug.
When the project is built, the DLLs are generated in the project's root directory -> build/bin
.
Use CFF Explorer for each executable (AIServer.exe
, Ebenezer.exe
and KnightOnLine.exe
) to add the exported functions of the custom DLLs into the executables' Import Table
by following these steps:
- Open CFF Explorer.
- Drag the target executable into the GUI.
- Click on
Import Addr
on the left pane and then clickAdd
for adding a new module/dll. - Select the corresponding DLL for the loaded executable. e.g.
AIServer.exe
needsAIServer.dll
. - In the
Exported Functions
pane select all of them andImport by Oridinal
. - Final step is to click
Rebuild Import Table
and thenSave
.
If everything is done correctly, the modified executable should automatically load the custom DLL.
HINT: for development instead of copying the DLL, I simply create symbolic link to where the DLLs are compiled. e.g. for Ebenezer in the location where the executable is:
mklink Ebenezer.dll "D:\KOHook\build\bin\Ebenezer.dll"
Then every time recompilation takes place, it will use the latest version. The build.ps1
script already does that for you.