mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
fix some kernel32 environ winetests
svn path=/trunk/; revision=36020
This commit is contained in:
parent
714e5fdc39
commit
26fef2b1c8
1 changed files with 91 additions and 78 deletions
|
@ -88,6 +88,7 @@ static BOOL GetComputerNameFromRegistry( LPWSTR RegistryKey,
|
|||
0,
|
||||
KeyInfo);
|
||||
ZwClose (KeyHandle);
|
||||
*nSize = ReturnSize;
|
||||
SetLastErrorByStatus (Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -95,6 +96,7 @@ static BOOL GetComputerNameFromRegistry( LPWSTR RegistryKey,
|
|||
if( *nSize > (KeyInfo->DataLength / sizeof(WCHAR)) ) {
|
||||
*nSize = KeyInfo->DataLength / sizeof(WCHAR);
|
||||
lpBuffer[*nSize] = 0;
|
||||
(*nSize)--;
|
||||
}
|
||||
|
||||
RtlCopyMemory (lpBuffer,
|
||||
|
@ -103,8 +105,7 @@ static BOOL GetComputerNameFromRegistry( LPWSTR RegistryKey,
|
|||
|
||||
RtlFreeHeap (RtlGetProcessHeap (),
|
||||
0,
|
||||
KeyInfo)
|
||||
;
|
||||
KeyInfo);
|
||||
ZwClose (KeyHandle);
|
||||
|
||||
return TRUE;
|
||||
|
@ -124,6 +125,8 @@ GetComputerNameExW (
|
|||
UNICODE_STRING DomainPart;
|
||||
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
|
||||
NTSTATUS Status;
|
||||
BOOL ret = TRUE;
|
||||
DWORD HostSize;
|
||||
|
||||
switch( NameType ) {
|
||||
case ComputerNameNetBIOS:
|
||||
|
@ -160,7 +163,11 @@ GetComputerNameExW (
|
|||
QueryTable, NULL, NULL);
|
||||
|
||||
if( NT_SUCCESS(Status) ) {
|
||||
RtlAppendUnicodeStringToString(&ResultString, &DomainPart);
|
||||
Status = RtlAppendUnicodeStringToString(&ResultString, &DomainPart);
|
||||
HostSize = DomainPart.Length;
|
||||
if (!NT_SUCCESS(Status)) {
|
||||
ret = FALSE;
|
||||
}
|
||||
RtlAppendUnicodeToString(&ResultString, L".");
|
||||
RtlFreeUnicodeString(&DomainPart);
|
||||
|
||||
|
@ -176,9 +183,15 @@ GetComputerNameExW (
|
|||
QueryTable, NULL, NULL);
|
||||
|
||||
if( NT_SUCCESS(Status) ) {
|
||||
RtlAppendUnicodeStringToString(&ResultString, &DomainPart);
|
||||
Status = RtlAppendUnicodeStringToString(&ResultString, &DomainPart);
|
||||
if ( (!NT_SUCCESS(Status)) || (!ret)) {
|
||||
*nSize = HostSize + DomainPart.Length;
|
||||
SetLastError(ERROR_MORE_DATA);
|
||||
RtlFreeUnicodeString(&DomainPart);
|
||||
*nSize = ResultString.Length / sizeof(WCHAR);
|
||||
return FALSE;
|
||||
}
|
||||
RtlFreeUnicodeString(&DomainPart);
|
||||
*nSize = ResultString.Length / sizeof(WCHAR) - 1;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -245,8 +258,8 @@ GetComputerNameExA (
|
|||
Result = GetComputerNameExW( NameType, TempBuffer, nSize );
|
||||
|
||||
if( Result ) {
|
||||
UnicodeString.MaximumLength = (USHORT)*nSize * sizeof(WCHAR);
|
||||
UnicodeString.Length = (USHORT)*nSize * sizeof(WCHAR);
|
||||
UnicodeString.MaximumLength = (USHORT)*nSize * sizeof(WCHAR) + sizeof(WCHAR);
|
||||
UnicodeString.Length = (USHORT)*nSize * sizeof(WCHAR) + sizeof(WCHAR);
|
||||
UnicodeString.Buffer = TempBuffer;
|
||||
|
||||
RtlUnicodeStringToAnsiString (&AnsiString,
|
||||
|
|
Loading…
Reference in a new issue