Alexandre Julliard : ntdll: Fix returned error for NtCreateKey with empty name.

Alexandre Julliard julliard at winehq.org
Tue Jul 5 15:56:14 CDT 2022


Module: wine
Branch: master
Commit: 95ddb7576d13d3b4bb1aa213a045771cb70a3d17
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=95ddb7576d13d3b4bb1aa213a045771cb70a3d17

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jul  5 14:03:34 2022 +0200

ntdll: Fix returned error for NtCreateKey with empty name.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/tests/reg.c     | 1 -
 dlls/ntdll/unix/registry.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c
index a0d07c9fc21..e791271ed17 100644
--- a/dlls/ntdll/tests/reg.c
+++ b/dlls/ntdll/tests/reg.c
@@ -603,7 +603,6 @@ static void test_NtCreateKey(void)
 
     pRtlCreateUnicodeStringFromAsciiz( &str, "" );
     status = pNtCreateKey( &subkey, am, &attr, 0, 0, 0, 0 );
-    todo_wine
     ok( status == STATUS_OBJECT_PATH_SYNTAX_BAD, "NtCreateKey failed: 0x%08lx\n", status );
     pRtlFreeUnicodeString( &str );
 
diff --git a/dlls/ntdll/unix/registry.c b/dlls/ntdll/unix/registry.c
index 8901c350868..47547d42f09 100644
--- a/dlls/ntdll/unix/registry.c
+++ b/dlls/ntdll/unix/registry.c
@@ -81,6 +81,7 @@ NTSTATUS WINAPI NtCreateKey( HANDLE *key, ACCESS_MASK access, const OBJECT_ATTRI
 
     *key = 0;
     if (attr->Length != sizeof(OBJECT_ATTRIBUTES)) return STATUS_INVALID_PARAMETER;
+    if (!attr->ObjectName->Length && !attr->RootDirectory) return STATUS_OBJECT_PATH_SYNTAX_BAD;
     if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret;
 
     TRACE( "(%p,%s,%s,%x,%x,%p)\n", attr->RootDirectory, debugstr_us(attr->ObjectName),




More information about the wine-cvs mailing list