ntdll: Fixed conditional expression (Coverity).

This commit is contained in:
Paul Vriens 2006-09-18 13:55:25 +02:00 committed by Alexandre Julliard
parent e41c0acc0c
commit e94df274ce
2 changed files with 12 additions and 1 deletions

View File

@ -517,7 +517,7 @@ NTSTATUS WINAPI RtlpNtQueryValueKey( HANDLE handle, ULONG *result_type, PBYTE de
UNICODE_STRING name;
NTSTATUS ret;
DWORD dwResultLen;
DWORD dwLen = sizeof (KEY_VALUE_PARTIAL_INFORMATION) + result_len ? *result_len : 0;
DWORD dwLen = sizeof (KEY_VALUE_PARTIAL_INFORMATION) + (result_len ? *result_len : 0);
info = (KEY_VALUE_PARTIAL_INFORMATION*)RtlAllocateHeap( GetProcessHeap(), 0, dwLen );
if (!info)

View File

@ -103,6 +103,7 @@ static NTSTATUS (WINAPI * pRtlUnicodeStringToAnsiString)(PSTRING, PUNICODE_STRIN
static NTSTATUS (WINAPI * pRtlFreeHeap)(PVOID, ULONG, PVOID);
static NTSTATUS (WINAPI * pRtlAllocateHeap)(PVOID,ULONG,ULONG);
static NTSTATUS (WINAPI * pRtlZeroMemory)(PVOID, ULONG);
static NTSTATUS (WINAPI * pRtlpNtQueryValueKey)(HANDLE,ULONG*,PBYTE,DWORD*);
static HMODULE hntdll = 0;
static int CurrentTest = 0;
@ -146,6 +147,7 @@ static BOOL InitFunctionPtrs(void)
NTDLL_GET_PROC(RtlFreeHeap)
NTDLL_GET_PROC(RtlAllocateHeap)
NTDLL_GET_PROC(RtlZeroMemory)
NTDLL_GET_PROC(RtlpNtQueryValueKey)
}
return TRUE;
}
@ -445,6 +447,14 @@ static void test_NtDeleteKey(void)
ok(status == STATUS_SUCCESS, "NtDeleteKey Failed: 0x%08lx\n", status);
}
static void test_RtlpNtQueryValueKey(void)
{
NTSTATUS status;
status = pRtlpNtQueryValueKey(NULL, NULL, NULL, NULL);
ok(status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got: 0x%08lx\n", status);
}
START_TEST(reg)
{
static const WCHAR winetest[] = {'\\','W','i','n','e','T','e','s','t','\\',0};
@ -463,6 +473,7 @@ START_TEST(reg)
test_RtlCheckRegistryKey();
test_RtlOpenCurrentUser();
test_RtlQueryRegistryValues();
test_RtlpNtQueryValueKey();
test_NtFlushKey();
test_NtDeleteKey();