[2/2] ntdll: Fix NtQueryValueKey return value

Nikolay Sivov bunglehead at gmail.com
Thu Jan 8 17:42:04 CST 2009


Changelog:
    - fix NtQueryValueKey return value (removes last todo from ntdll:reg)

>From d0673bc8e0b3cccf230fceb82f53a51cc9e01a36 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Fri, 9 Jan 2009 02:37:57 +0300
Subject:  Fix NtQueryValueKey return value

---
 dlls/ntdll/reg.c       |    3 ++-
 dlls/ntdll/tests/reg.c |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index d00cdce..73dcdb1 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -533,7 +533,8 @@ NTSTATUS WINAPI NtQueryValueKey( HANDLE handle, const UNICODE_STRING *name,
             copy_key_value_info( info_class, info, length, reply->type,
                                  name->Length, reply->total );
             *result_len = fixed_size + (info_class == KeyValueBasicInformation ? 0 : reply->total);
-            if (length < *result_len) ret = STATUS_BUFFER_OVERFLOW;
+            if (length < *result_len)
+                ret = (info ? STATUS_BUFFER_OVERFLOW: STATUS_BUFFER_TOO_SMALL);
         }
     }
     SERVER_END_REQ;
diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c
index 6fc8d82..ccec68c 100644
--- a/dlls/ntdll/tests/reg.c
+++ b/dlls/ntdll/tests/reg.c
@@ -563,7 +563,7 @@ static void test_NtQueryValueKey(void)
     pRtlCreateUnicodeStringFromAsciiz(&ValName, "stringtest");
 
     status = pNtQueryValueKey(key, &ValName, KeyValuePartialInformation, NULL, 0, &len);
-    todo_wine ok(status == STATUS_BUFFER_TOO_SMALL, "NtQueryValueKey should have returned STATUS_BUFFER_TOO_SMALL instead of 0x%08x\n", status);
+    ok(status == STATUS_BUFFER_TOO_SMALL, "NtQueryValueKey should have returned STATUS_BUFFER_TOO_SMALL instead of 0x%08x\n", status);
     partial_info = HeapAlloc(GetProcessHeap(), 0, len+1);
     memset((BYTE*)partial_info, 0xbd, len+1);
     status = pNtQueryValueKey(key, &ValName, KeyValuePartialInformation, partial_info, len, &len);
-- 
1.5.6.5






More information about the wine-patches mailing list