From 08bc5cf4228376ab89700a465c9f575eb1758072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Jab=C5=82o=C5=84ski?= Date: Tue, 23 Apr 2024 03:06:18 +0200 Subject: [PATCH] Fix cmd.exe ungraceful exit --- COREDLL/winbase_wcecl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/COREDLL/winbase_wcecl.cpp b/COREDLL/winbase_wcecl.cpp index 6b00fe9..519915d 100644 --- a/COREDLL/winbase_wcecl.cpp +++ b/COREDLL/winbase_wcecl.cpp @@ -12,7 +12,7 @@ BOOL SystemTimeToFileTime_WCECL( BOOL FileTimeToLocalFileTime_WCECL( const FILETIME* lpFileTime, - LPFILETIME lpLocalFileTime) + LPFILETIME lpLocalFileTime) { auto result = ::FileTimeToLocalFileTime(lpFileTime, lpLocalFileTime); return result; @@ -590,6 +590,11 @@ BOOL WINAPI TerminateProcess_WCECL( HANDLE hProcess, DWORD uExitCode) { + /* GetCurrentProcess() seems to be inlined to 0x42 for WinCE */ + if (hProcess == (HANDLE)0x42) + { + hProcess = GetCurrentProcess(); + } auto result = ::TerminateProcess(hProcess, uExitCode); return result; }