[ros-diffs] [spetreolle] 41404: Fix 2 kernel32:environ tests. The GetComputerNameEx ComputerNameDnsDomain tests can't succeed if we have no domain, as the function succeeds querying a zero length domain into a zero length buffer.

spetreolle at svn.reactos.org spetreolle at svn.reactos.org
Sat Jun 13 17:33:34 CEST 2009


Author: spetreolle
Date: Sat Jun 13 19:33:33 2009
New Revision: 41404

URL: http://svn.reactos.org/svn/reactos?rev=41404&view=rev
Log:
Fix 2 kernel32:environ tests.
The GetComputerNameEx ComputerNameDnsDomain tests can't succeed if we have no domain,
as the function succeeds querying a zero length domain into a zero length buffer.

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=41404&r1=41403&r2=41404&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 Jun 13 19:33:33 2009
@@ -286,7 +286,11 @@
 WINAPI
 GetComputerNameA(LPSTR lpBuffer, LPDWORD lpnSize)
 {
-    return GetComputerNameExA(ComputerNameNetBIOS, lpBuffer, lpnSize);
+    BOOL ret;
+    ret = GetComputerNameExA(ComputerNameNetBIOS, lpBuffer, lpnSize);    
+    if(!ret && GetLastError() == ERROR_MORE_DATA)
+      SetLastError(ERROR_BUFFER_OVERFLOW);
+      return ret;
 }
 
 
@@ -297,7 +301,11 @@
 WINAPI
 GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
 {
-    return GetComputerNameExW(ComputerNameNetBIOS, lpBuffer, lpnSize);
+    BOOL ret;
+    ret=GetComputerNameExW(ComputerNameNetBIOS, lpBuffer, lpnSize);
+    if(!ret && GetLastError() == ERROR_MORE_DATA)
+      SetLastError(ERROR_BUFFER_OVERFLOW);
+    return ret;
 }
 
 



More information about the Ros-diffs mailing list