NTSTATUS Status;
/* don't close null handle or a pseudo handle */
- if ((!hKey) || (((ULONG_PTR)hKey & 0xF0000000) == 0x80000000))
+ if (!hKey)
{
return ERROR_INVALID_HANDLE;
}
+ if (((ULONG_PTR)hKey & 0xF0000000) == 0x80000000)
+ {
+ return ERROR_SUCCESS;
+ }
+
Status = NtClose(hKey);
if (!NT_SUCCESS(Status))
{
{
if (KeyInfo->Basic.NameLength > NameLength)
{
- ErrorCode = ERROR_BUFFER_OVERFLOW;
+ ErrorCode = ERROR_MORE_DATA;
}
else
{
if (KeyInfo->Node.NameLength > NameLength ||
KeyInfo->Node.ClassLength > ClassLength)
{
- ErrorCode = ERROR_BUFFER_OVERFLOW;
+ ErrorCode = ERROR_MORE_DATA;
}
else
{
NTSTATUS Status;
DWORD cClass = 0;
+ if ((lpClass) && (!lpcClass))
+ {
+ return ERROR_INVALID_PARAMETER;
+ }
+
RtlInitUnicodeString(&UnicodeString,
NULL);
if (lpClass != NULL)
FALSE);
ErrorCode = RtlNtStatusToDosError(Status);
cClass = AnsiString.Length;
- lpClass[*lpcClass - 1] = 0;
+ lpClass[cClass] = ANSI_NULL;
}
if (lpcClass != NULL)
NULL,
0,
lpcbSecurityDescriptor);
- if (!NT_SUCCESS(Status) && Status != STATUS_BUFFER_TOO_SMALL)
+ if (Status != STATUS_BUFFER_TOO_SMALL)
{
- ErrorCode = RtlNtStatusToDosError(Status);
- goto Cleanup;
+ *lpcbSecurityDescriptor = 0;
}
}
lpftLastWriteTime->dwHighDateTime = FullInfo->LastWriteTime.u.HighPart;
}
- ErrorCode = ERROR_SUCCESS;
if (lpClass != NULL)
{
if (*lpcClass == 0)
LONG ErrorCode;
if (maxBytes >= (1024*1024))
- return ERROR_TRANSFER_TOO_LONG;
+ return ERROR_MORE_DATA;
*ldwTotsize = 0;
LONG ErrorCode;
if (maxBytes >= (1024*1024))
- return ERROR_TRANSFER_TOO_LONG;
+ return ERROR_MORE_DATA;
*ldwTotsize = 0;