[ntdll][3/3] Fix returncode for NtDeleteKey (with test)

Paul Vriens Paul.Vriens at xs4all.nl
Mon Jul 3 07:19:33 CDT 2006


Hi,

New tests pass on NT4/W2K/XP/W2K3 and Wine.

Some original tests still fail for NT4, haven't looked into that (yet).

Changelog
  Fix returncode for NtDeleteKey (with test) 

Cheers,

Paul.
---
 dlls/ntdll/reg.c       |    2 ++
 dlls/ntdll/tests/reg.c |    4 ++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index fb67207..16d16ff 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -163,6 +163,8 @@ NTSTATUS WINAPI NtDeleteKey( HANDLE hkey
 
     TRACE( "(%p)\n", hkey );
 
+    if (!hkey) return STATUS_INVALID_HANDLE;
+
     SERVER_START_REQ( delete_key )
     {
         req->hkey = hkey;
diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c
index 6f04b23..275d4dd 100644
--- a/dlls/ntdll/tests/reg.c
+++ b/dlls/ntdll/tests/reg.c
@@ -410,6 +410,10 @@ static void test_NtDeleteKey(void)
     OBJECT_ATTRIBUTES attr;
     ACCESS_MASK am = KEY_ALL_ACCESS;
 
+    /* NULL check */
+    status = pNtDeleteKey(NULL);
+    ok(status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got: 0x%08lx\n", status);
+
     InitializeObjectAttributes(&attr, &winetestpath, 0, 0, 0);
     status = pNtOpenKey(&hkey, am, &attr);
 
-- 
1.4.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-patches/attachments/20060703/39a5d67b/attachment.htm


More information about the wine-patches mailing list