iidx-ezusb1/2 exit hook: Replace duplicate code with util function

This commit is contained in:
icex2 2020-12-20 16:38:06 +01:00
parent e4126500ef
commit 13600db1d5
2 changed files with 4 additions and 12 deletions

View File

@ -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);
}
}
}

View File

@ -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);
}
}
}