[PATCH] ntdll: Fix the return value of NtQueryKey

杨堃 yangkun at uniontech.com
Tue Jun 14 02:44:53 CDT 2022


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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: registry_patch
Type: application/octet-stream
Size: 1249 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20220614/0464048b/attachment.obj>


More information about the wine-devel mailing list