From d38ded61bc144837f6dd6282e20cb1ab177b9406 Mon Sep 17 00:00:00 2001 From: asmodai Date: Sat, 11 Mar 2017 12:36:13 +0300 Subject: [PATCH] Fix #61 --- reapi/src/hook_callback.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index d09eda0..4434c69 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -237,7 +237,17 @@ NOINLINE R DLLEXPORT _callForward(const hook_t* hook, original_t original, volat g_hookCtx = hookCtx; if (unlikely(!hookCtx->retVal.set)) { - hookCtx->retVal._integer = *(int *)&retVal; + switch (sizeof retVal) { + case sizeof(int8): + hookCtx->retVal._integer = *(int8 *)&retVal; + break; + case sizeof(int16): + hookCtx->retVal._integer = *(int16 *)&retVal; + break; + case sizeof(int32): + hookCtx->retVal._integer = *(int32 *)&retVal; + break; + } hookCtx->retVal.set = true; } }