Author: hpoussin
Date: Sat Jun 28 11:51:42 2008
New Revision: 34159
URL:
http://svn.reactos.org/svn/reactos?rev=34159&view=rev
Log:
Fix GetUserNameA/GetComputerNameExA
Patch by Carlo Bramini, carlo dot bramix at libero dot it
See issue #1859 for more details.
Modified:
trunk/reactos/dll/win32/advapi32/sec/misc.c
trunk/reactos/dll/win32/kernel32/misc/computername.c
Modified: trunk/reactos/dll/win32/advapi32/sec/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/mis…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/sec/misc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/sec/misc.c [iso-8859-1] Sat Jun 28 11:51:42 2008
@@ -723,7 +723,6 @@
/* apparently Win doesn't check whether lpSize is valid at all! */
- NameW.Length = 0;
NameW.MaximumLength = (*lpSize) * sizeof(WCHAR);
NameW.Buffer = LocalAlloc(LMEM_FIXED, NameW.MaximumLength);
if(NameW.Buffer == NULL)
@@ -740,6 +739,7 @@
lpSize);
if(Ret)
{
+ NameW.Length = (*lpSize) * sizeof(WCHAR);
RtlUnicodeStringToAnsiString(&NameA, &NameW, FALSE);
NameA.Buffer[NameA.Length] = '\0';
Modified: trunk/reactos/dll/win32/kernel32/misc/computername.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/co…
==============================================================================
--- 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 28 11:51:42
2008
@@ -232,7 +232,7 @@
UNICODE_STRING UnicodeString;
ANSI_STRING AnsiString;
BOOL Result;
- PWCHAR TempBuffer = RtlAllocateHeap( GetProcessHeap(), 0, *nSize * sizeof(WCHAR) );
+ PWCHAR TempBuffer = RtlAllocateHeap( RtlGetProcessHeap(), 0, *nSize * sizeof(WCHAR)
);
if( !TempBuffer ) {
return ERROR_OUTOFMEMORY;
@@ -254,7 +254,7 @@
FALSE);
}
- HeapFree( GetProcessHeap(), 0, TempBuffer );
+ RtlFreeHeap( RtlGetProcessHeap(), 0, TempBuffer );
return Result;
}