[ros-diffs] [dchapyshev] 41887: - Fix 3 "kernel32_winetest environ" tests. All environ tests passed now

dchapyshev at svn.reactos.org dchapyshev at svn.reactos.org
Sat Jul 11 16:18:07 CEST 2009


Author: dchapyshev
Date: Sat Jul 11 18:18:06 2009
New Revision: 41887

URL: http://svn.reactos.org/svn/reactos?rev=41887&view=rev
Log:
- Fix 3 "kernel32_winetest environ" tests. All environ tests passed now

Modified:
    trunk/reactos/dll/win32/kernel32/misc/computername.c

Modified: trunk/reactos/dll/win32/kernel32/misc/computername.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/computername.c?rev=41887&r1=41886&r2=41887&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/computername.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/computername.c [iso-8859-1] Sat Jul 11 18:18:06 2009
@@ -92,10 +92,18 @@
         return FALSE;
     }
 
-    if (*nSize > (KeyInfo->DataLength / sizeof(WCHAR)))
+    if (lpBuffer && *nSize > (KeyInfo->DataLength / sizeof(WCHAR)))
     {
         *nSize = KeyInfo->DataLength / sizeof(WCHAR) - 1;
         lpBuffer[*nSize] = 0;
+    }
+    else
+    {
+        RtlFreeHeap(RtlGetProcessHeap(), 0, KeyInfo);
+        ZwClose(KeyHandle);
+        *nSize = ReturnSize;
+        SetLastErrorByStatus(STATUS_BUFFER_OVERFLOW);
+        return FALSE;
     }
 
     RtlCopyMemory(lpBuffer, KeyInfo->Data, *nSize * sizeof(WCHAR));
@@ -254,7 +262,8 @@
 
     if (!TempBuffer)
     {
-        return ERROR_OUTOFMEMORY;
+        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+        return FALSE;
     }
 
     AnsiString.MaximumLength = (USHORT)*nSize;



More information about the Ros-diffs mailing list