mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 07:33:20 +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
2 changed files with 3 additions and 3 deletions
|
@ -723,7 +723,6 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
|
||||||
|
|
||||||
/* apparently Win doesn't check whether lpSize is valid at all! */
|
/* apparently Win doesn't check whether lpSize is valid at all! */
|
||||||
|
|
||||||
NameW.Length = 0;
|
|
||||||
NameW.MaximumLength = (*lpSize) * sizeof(WCHAR);
|
NameW.MaximumLength = (*lpSize) * sizeof(WCHAR);
|
||||||
NameW.Buffer = LocalAlloc(LMEM_FIXED, NameW.MaximumLength);
|
NameW.Buffer = LocalAlloc(LMEM_FIXED, NameW.MaximumLength);
|
||||||
if(NameW.Buffer == NULL)
|
if(NameW.Buffer == NULL)
|
||||||
|
@ -740,6 +739,7 @@ GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
|
||||||
lpSize);
|
lpSize);
|
||||||
if(Ret)
|
if(Ret)
|
||||||
{
|
{
|
||||||
|
NameW.Length = (*lpSize) * sizeof(WCHAR);
|
||||||
RtlUnicodeStringToAnsiString(&NameA, &NameW, FALSE);
|
RtlUnicodeStringToAnsiString(&NameA, &NameW, FALSE);
|
||||||
NameA.Buffer[NameA.Length] = '\0';
|
NameA.Buffer[NameA.Length] = '\0';
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ GetComputerNameExA (
|
||||||
UNICODE_STRING UnicodeString;
|
UNICODE_STRING UnicodeString;
|
||||||
ANSI_STRING AnsiString;
|
ANSI_STRING AnsiString;
|
||||||
BOOL Result;
|
BOOL Result;
|
||||||
PWCHAR TempBuffer = RtlAllocateHeap( GetProcessHeap(), 0, *nSize * sizeof(WCHAR) );
|
PWCHAR TempBuffer = RtlAllocateHeap( RtlGetProcessHeap(), 0, *nSize * sizeof(WCHAR) );
|
||||||
|
|
||||||
if( !TempBuffer ) {
|
if( !TempBuffer ) {
|
||||||
return ERROR_OUTOFMEMORY;
|
return ERROR_OUTOFMEMORY;
|
||||||
|
@ -254,7 +254,7 @@ GetComputerNameExA (
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapFree( GetProcessHeap(), 0, TempBuffer );
|
RtlFreeHeap( RtlGetProcessHeap(), 0, TempBuffer );
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue