Commit f07e8ca8 authored by Stefan Leichter's avatar Stefan Leichter Committed by Alexandre Julliard

ntdll: Fix RtlCheckRegistryKey when called with empty path.

parent 4d4fc7ae
......@@ -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);
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment