Ah ah !! Good point !

 

Cheers,
Hermès

 

De : ros-dev-bounces@reactos.org [mailto:ros-dev-bounces@reactos.org] De la part de Alex Ionescu
Envoyé : dimanche 23 juin 2013 17:46
À : ReactOS Development List
Cc : Linda Wang
Objet : Re: [ros-dev] [ros-diffs] [hbelusca] 59314: [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...

 

You should should learnt about NT_VERIFY :)


Best regards,
Alex Ionescu

 

On Sun, Jun 23, 2013 at 8:55 AM, <hbelusca@svn.reactos.org> wrote:

Author: hbelusca
Date: Sun Jun 23 12:55:17 2013
New Revision: 59314

URL: http://svn.reactos.org/svn/reactos?rev=59314&view=rev
Log:
[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.

Modified:
    branches/ntvdm/dll/win32/kernel32/client/proc.c

Modified: branches/ntvdm/dll/win32/kernel32/client/proc.c
URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/dll/win32/kernel32/client/proc.c?rev=59314&r1=59313&r2=59314&view=diff
==============================================================================
--- branches/ntvdm/dll/win32/kernel32/client/proc.c     [iso-8859-1] (original)
+++ branches/ntvdm/dll/win32/kernel32/client/proc.c     [iso-8859-1] Sun Jun 23 12:55:17 2013
@@ -2541,6 +2541,7 @@
     WCHAR SaveChar = 0;
     ULONG RetVal;
     UINT Error = 0;
+    UINT Length;
     BOOLEAN SearchDone = FALSE;
     BOOLEAN Escape = FALSE;
     CLIENT_ID ClientId;
@@ -2630,7 +2631,13 @@
     }

     /* 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);

     /*