From b5608a206f94c9946c56f45b12691ab85849f557 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 30 Nov 2018 17:37:29 +0700 Subject: [PATCH] update upstream --- src/private/subhook | 2 +- src/subhook.nim | 26 ++++++++++++++++---------- subhook.nimble | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/private/subhook b/src/private/subhook index c1c7be3..12732c1 160000 --- a/src/private/subhook +++ b/src/private/subhook @@ -1 +1 @@ -Subproject commit c1c7be366e7310001b30ffc3d90a6d6d62fca0a3 +Subproject commit 12732c1d1d9b3b9febed99b5b5e4d625549f3098 diff --git a/src/subhook.nim b/src/subhook.nim index 723fa5d..d195a3f 100644 --- a/src/subhook.nim +++ b/src/subhook.nim @@ -1,9 +1,11 @@ +import ospaths + {.compile: "private/subhook/subhook.c".} {.pragma: subhook, cdecl, importc, - header: basename(currentSourcePath()) & "/private/subhook/subhook.h" + header: parentDir(currentSourcePath()) & "/private/subhook/subhook.h" discardable .} @@ -11,7 +13,11 @@ type subhook_t* {.final, pure.} = object -proc subhook_new(src, dst: pointer, options: int): ptr subhook_t {.subhook.} + subhook_flags* {.pure.} = enum + NONE + SUBHOOK_64BIT_OFFSET = 1 + +proc subhook_new(src, dst: pointer, flags: subhook_flags): ptr subhook_t {.subhook.} proc subhook_free(hook: ptr subhook_t) {.subhook.} proc subhook_get_src(hook: ptr subhook_t): pointer {.subhook.} proc subhook_get_dst(hook: ptr subhook_t): pointer {.subhook.} @@ -25,17 +31,17 @@ type Hook* = object impl: ptr subhook_t -proc initHook*(src, dest: pointer, options = 0): Hook {.inline.} = - result.impl = subhook_new(src, dest, options) +proc initHook*(src, dest: pointer, flags: subhook_flags = NONE): Hook {.inline.} = + result.impl = subhook_new(src, dest, flags) -proc initHook*(src, dest: int, options = 0): Hook {.inline.} = - initHook(cast[pointer](src), cast[pointer](dest), options) +proc initHook*(src, dest: int, flags = NONE): Hook {.inline.} = + initHook(cast[pointer](src), cast[pointer](dest), flags) -proc initHook*(src: pointer, dest: int, options = 0): Hook {.inline.} = - initHook(src, cast[pointer](dest), options) +proc initHook*(src: pointer, dest: int, flags = NONE): Hook {.inline.} = + initHook(src, cast[pointer](dest), flags) -proc initHook*(src: int, dest: pointer, options = 0): Hook {.inline.} = - initHook(cast[pointer](src), dest, options) +proc initHook*(src: int, dest: pointer, flags = NONE): Hook {.inline.} = + initHook(cast[pointer](src), dest, flags) proc free*(hook: Hook) {.inline.} = subhook_free(hook.impl) diff --git a/subhook.nimble b/subhook.nimble index a4cd53e..f9b33a0 100644 --- a/subhook.nimble +++ b/subhook.nimble @@ -1,6 +1,6 @@ # Package -version = "0.5.1" +version = "0.5.2" author = "Huy Doan" description = "subhook wrapper" license = "BSD2"