From: 杨堃 Subject: ntdll: Fix the return value of NtQueryKey. Message-Id: Date: Tue, 14 Jun 2022 16:28:19 +0800 Signed-off-by: Kun Yang --- dlls/ntdll/tests/reg.c | 2 +- dlls/ntdll/unix/registry.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c index 2c158be17b4..ab6f7914e4b 100644 --- a/dlls/ntdll/tests/reg.c +++ b/dlls/ntdll/tests/reg.c @@ -1831,7 +1831,7 @@ static void test_NtQueryKey(void) pNtClose(key); return; } - todo_wine ok(status == STATUS_BUFFER_TOO_SMALL, "NtQueryKey Failed: 0x%08lx\n", status); + ok(status == STATUS_BUFFER_TOO_SMALL, "NtQueryKey Failed: 0x%08lx\n", status); info = HeapAlloc(GetProcessHeap(), 0, length); /* non-zero buffer size, but insufficient */ diff --git a/dlls/ntdll/unix/registry.c b/dlls/ntdll/unix/registry.c index 6628454440a..767fa36302d 100644 --- a/dlls/ntdll/unix/registry.c +++ b/dlls/ntdll/unix/registry.c @@ -321,7 +321,12 @@ static NTSTATUS enumerate_key( HANDLE handle, int index, KEY_INFORMATION_CLASS i break; } *result_len = fixed_size + reply->total; - if (length < *result_len) ret = STATUS_BUFFER_OVERFLOW; + if (length < *result_len){ + if(min(length, fixed_size) == 0) + ret = STATUS_BUFFER_TOO_SMALL; + else + ret = STATUS_BUFFER_OVERFLOW; + } } } SERVER_END_REQ; -- 2.20.1