Skip to content

Commit

Permalink
supports Unhook() & minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanite Factory committed Oct 7, 2018
1 parent 5aae6c7 commit 32ef8eb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
hookwin10calc.h
*.dll
*.exe
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OUT := my
OUT := hookwin10calc
FUNC := Test
VERSION := $(shell git describe --always --long)

Expand Down
18 changes: 11 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,22 @@ import (
// ----------------------------------------------------------------------------

/*
#include <string.h>
#include <Windows.h>
// 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);
*/
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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 32ef8eb

Please sign in to comment.