diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..df37ff2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +hookwin10calc.h +*.dll +*.exe \ No newline at end of file diff --git a/Makefile b/Makefile index 068d06f..1b12972 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -OUT := my +OUT := hookwin10calc FUNC := Test VERSION := $(shell git describe --always --long) diff --git a/main.go b/main.go index 2b8689d..bd23838 100644 --- a/main.go +++ b/main.go @@ -16,16 +16,13 @@ import ( // ---------------------------------------------------------------------------- /* -#include #include // Due to lack of my knowledge in reversing I literally have no idea what the return type of these functions would be though. // Arguments could be guessed; 64-bit integers because they always pass in R8, RDX, RCX in order. -typedef DWORD64 (*ProtoOnDisplayUpdate)(DWORD64, DWORD64, DWORD64); +// Gateway functions in C. DWORD64 OnDisplayUpdate(DWORD64, DWORD64, DWORD64); - -typedef DWORD64 (*ProtoOnNumberUpdate)(DWORD64, DWORD64, DWORD64); DWORD64 OnNumberUpdate(DWORD64, DWORD64, DWORD64); */ @@ -33,8 +30,8 @@ import "C" var isInMiddleOfOnDisplayUpdate bool -var fpDisplayUpdate C.ProtoOnDisplayUpdate -var fpNumberUpdate C.ProtoOnNumberUpdate +var fpDisplayUpdate *func(arg1, arg2, arg3 uintptr) (ret uintptr) +var fpNumberUpdate *func(arg1, arg2, arg3 uintptr) (ret uintptr) //export OnDisplayUpdate func OnDisplayUpdate(arg1, arg2, arg3 uintptr) (ret uintptr) { @@ -194,11 +191,18 @@ func OnProcessAttach( // ---------------------------------------------------------------------------- // Block this routine. - ch := make(chan int) <-ch outputdebug.String("OnProcessAttach(): Exit") } +var ch = make(chan int) + +// Unhook everything. This will restore the target process to its original state. +//export Unhook +func Unhook() { + ch <- 1 +} + // ---------------------------------------------------------------------------- //export MessageBoxTest