From 4c66e672da4b7bb78ebdde42f9e23da59c24d920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 23 Jun 2013 12:55:17 +0000 Subject: [PATCH] [KERNEL32] Never EVER process instructions INSIDE a debug macro (e.g. ASSERT) because when compiling in Release Mode, the code isn't executed at all. Fix that. See revision r59310 for more details. svn path=/branches/ntvdm/; revision=59314 --- dll/win32/kernel32/client/proc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dll/win32/kernel32/client/proc.c b/dll/win32/kernel32/client/proc.c index 8e9af3ffc5b..fee32152f85 100644 --- a/dll/win32/kernel32/client/proc.c +++ b/dll/win32/kernel32/client/proc.c @@ -2541,6 +2541,7 @@ CreateProcessInternalW(HANDLE hToken, WCHAR SaveChar = 0; ULONG RetVal; UINT Error = 0; + UINT Length; BOOLEAN SearchDone = FALSE; BOOLEAN Escape = FALSE; CLIENT_ID ClientId; @@ -2630,7 +2631,13 @@ CreateProcessInternalW(HANDLE hToken, } /* Get the path to the VDM host */ - ASSERT(GetSystemDirectoryW(VdmPath, MAX_PATH - wcslen(NTVDM_STRING)) != 0); + Length = GetSystemDirectoryW(VdmPath, MAX_PATH - wcslen(NTVDM_STRING)); + if ((Length == 0) || (Length >= MAX_PATH - wcslen(NTVDM_STRING))) + { + /* System path not found for some reason, fail */ + SetLastError(ERROR_INVALID_NAME); + return FALSE; + } wcscat(VdmPath, NTVDM_STRING); /*