From 13600db1d50efdb8f1091220378b2e6c710b7767 Mon Sep 17 00:00:00 2001 From: icex2 Date: Sun, 20 Dec 2020 16:38:06 +0100 Subject: [PATCH] iidx-ezusb1/2 exit hook: Replace duplicate code with util function --- src/main/iidx-ezusb-exit-hook/main.c | 8 ++------ src/main/iidx-ezusb2-exit-hook/main.c | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/main/iidx-ezusb-exit-hook/main.c b/src/main/iidx-ezusb-exit-hook/main.c index 77dbd37..1c34d66 100644 --- a/src/main/iidx-ezusb-exit-hook/main.c +++ b/src/main/iidx-ezusb-exit-hook/main.c @@ -15,6 +15,7 @@ #include "hook/table.h" #include "util/defs.h" +#include "util/proc.h" static BOOL STDCALL my_DeviceIoControl( HANDLE fd, @@ -163,12 +164,7 @@ static BOOL STDCALL my_DeviceIoControl( /* Don't use ExitProcess. This might result in deadlocks on newer games which rely more on multi threading */ - HANDLE hnd; - hnd = OpenProcess( - SYNCHRONIZE | PROCESS_TERMINATE, - TRUE, - GetCurrentProcessId()); - TerminateProcess(hnd, 0); + proc_terminate_current_process(0); } } } diff --git a/src/main/iidx-ezusb2-exit-hook/main.c b/src/main/iidx-ezusb2-exit-hook/main.c index 47f2bfc..85b61bd 100644 --- a/src/main/iidx-ezusb2-exit-hook/main.c +++ b/src/main/iidx-ezusb2-exit-hook/main.c @@ -14,6 +14,7 @@ #include "hook/table.h" #include "util/defs.h" +#include "util/proc.h" #define IOCTL_VEND_USB_REQ 0x220024 @@ -124,12 +125,7 @@ static BOOL STDCALL my_DeviceIoControl( /* Don't use ExitProcess. This might result in deadlocks on newer games which rely more on multi threading */ - HANDLE hnd; - hnd = OpenProcess( - SYNCHRONIZE | PROCESS_TERMINATE, - TRUE, - GetCurrentProcessId()); - TerminateProcess(hnd, 0); + proc_terminate_current_process(0); } } }