ntdll: Fix RtlCheckRegistryKey when called with empty path.

Signed-off-by: Stefan Leichter <sle85276@gmx.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Stefan Leichter 2018-03-12 00:14:55 +01:00 committed by Alexandre Julliard
parent 4d4fc7ae34
commit f07e8ca8f0
2 changed files with 16 additions and 1 deletions

View File

@ -1401,10 +1401,12 @@ NTSTATUS WINAPI RtlCheckRegistryKey(IN ULONG RelativeTo, IN PWSTR Path)
TRACE("(%d, %s)\n", RelativeTo, debugstr_w(Path));
if((!RelativeTo) && Path == NULL)
if(!RelativeTo && (Path == NULL || Path[0] == 0))
return STATUS_OBJECT_PATH_SYNTAX_BAD;
if(RelativeTo & RTL_REGISTRY_HANDLE)
return STATUS_SUCCESS;
if((RelativeTo <= RTL_REGISTRY_USER) && (Path == NULL || Path[0] == 0))
return STATUS_SUCCESS;
status = RTL_GetKeyHandle(RelativeTo, Path, &handle);
if (handle) NtClose(handle);

View File

@ -671,6 +671,7 @@ static void test_RtlOpenCurrentUser(void)
static void test_RtlCheckRegistryKey(void)
{
static WCHAR empty[] = {0};
NTSTATUS status;
status = pRtlCheckRegistryKey(RTL_REGISTRY_ABSOLUTE, winetestpath.Buffer);
@ -678,6 +679,18 @@ static void test_RtlCheckRegistryKey(void)
status = pRtlCheckRegistryKey((RTL_REGISTRY_ABSOLUTE | RTL_REGISTRY_OPTIONAL), winetestpath.Buffer);
ok(status == STATUS_SUCCESS, "RtlCheckRegistryKey with RTL_REGISTRY_ABSOLUTE and RTL_REGISTRY_OPTIONAL: 0x%08x\n", status);
status = pRtlCheckRegistryKey(RTL_REGISTRY_ABSOLUTE, NULL);
ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD, "RtlCheckRegistryKey with RTL_REGISTRY_ABSOLUTE and Path being NULL: 0x%08x\n", status);
status = pRtlCheckRegistryKey(RTL_REGISTRY_ABSOLUTE, empty);
ok(status == STATUS_OBJECT_PATH_SYNTAX_BAD, "RtlCheckRegistryKey with RTL_REGISTRY_ABSOLUTE and Path being empty: 0x%08x\n", status);
status = pRtlCheckRegistryKey(RTL_REGISTRY_USER, NULL);
ok(status == STATUS_SUCCESS, "RtlCheckRegistryKey with RTL_REGISTRY_USER and Path being NULL: 0x%08x\n", status);
status = pRtlCheckRegistryKey(RTL_REGISTRY_USER, empty);
ok(status == STATUS_SUCCESS, "RtlCheckRegistryKey with RTL_REGISTRY_USER and Path being empty: 0x%08x\n", status);
}
static void test_NtFlushKey(void)