mirror of
https://github.com/reactos/reactos.git
synced 2024-10-05 17:06:29 +00:00
Fix GetUserNameA/GetComputerNameExA
Patch by Carlo Bramini, carlo dot bramix at libero dot it See issue #1859 for more details. svn path=/trunk/; revision=34159
This commit is contained in:
parent
0b91e99584
commit
ec92a60952
|
@ -723,7 +723,6 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
|
|||
|
||||
/* 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 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
|
|||
lpSize);
|
||||
if(Ret)
|
||||
{
|
||||
NameW.Length = (*lpSize) * sizeof(WCHAR);
|
||||
RtlUnicodeStringToAnsiString(&NameA, &NameW, FALSE);
|
||||
NameA.Buffer[NameA.Length] = '\0';
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ GetComputerNameExA (
|
|||
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 @@ GetComputerNameExA (
|
|||
FALSE);
|
||||
}
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, TempBuffer );
|
||||
RtlFreeHeap( RtlGetProcessHeap(), 0, TempBuffer );
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue