Author: ekohl
Date: Sun Jun 17 15:35:35 2012
New Revision: 56742

URL: http://svn.reactos.org/svn/reactos?rev=56742&view=rev
Log:
[ADVAPI32]
RegCreateKeyExA/W and RegOpenKeyExA/W: Handle Option REG_OPTION_OPEN_LINK 
properly. This fixes four wine tests.

Modified:
    trunk/reactos/dll/win32/advapi32/reg/reg.c

Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg.c?rev=56742&r1=56741&r2=56742&view=diff
==============================================================================
--- trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] Sun Jun 17 15:35:35 
2012
@@ -1021,8 +1021,9 @@
 {
     UNICODE_STRING SubKeyString;
     UNICODE_STRING ClassString;
-    OBJECT_ATTRIBUTES Attributes;
+    OBJECT_ATTRIBUTES ObjectAttributes;
     HANDLE ParentKey;
+    ULONG Attributes = OBJ_CASE_INSENSITIVE;
     NTSTATUS Status;
 
     TRACE("RegCreateKeyExA() called\n");
@@ -1046,15 +1047,18 @@
                                          lpClass);
     }
 
+    if (dwOptions & REG_OPTION_OPEN_LINK)
+        Attributes |= OBJ_OPENLINK;
+
     RtlCreateUnicodeStringFromAsciiz(&SubKeyString,
                                      (LPSTR)lpSubKey);
-    InitializeObjectAttributes(&Attributes,
+    InitializeObjectAttributes(&ObjectAttributes,
                                &SubKeyString,
-                               OBJ_CASE_INSENSITIVE,
+                               Attributes,
                                (HANDLE)ParentKey,
                                lpSecurityAttributes ? 
(PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL);
     Status = CreateNestedKey(phkResult,
-                             &Attributes,
+                             &ObjectAttributes,
                              (lpClass == NULL)? NULL : &ClassString,
                              dwOptions,
                              samDesired,
@@ -1095,8 +1099,9 @@
 {
     UNICODE_STRING SubKeyString;
     UNICODE_STRING ClassString;
-    OBJECT_ATTRIBUTES Attributes;
+    OBJECT_ATTRIBUTES ObjectAttributes;
     HANDLE ParentKey;
+    ULONG Attributes = OBJ_CASE_INSENSITIVE;
     NTSTATUS Status;
 
     TRACE("RegCreateKeyExW() called\n");
@@ -1113,18 +1118,21 @@
     }
 
     TRACE("ParentKey %p\n", ParentKey);
+
+    if (dwOptions & REG_OPTION_OPEN_LINK)
+        Attributes |= OBJ_OPENLINK;
 
     RtlInitUnicodeString(&ClassString,
                          lpClass);
     RtlInitUnicodeString(&SubKeyString,
                          lpSubKey);
-    InitializeObjectAttributes(&Attributes,
+    InitializeObjectAttributes(&ObjectAttributes,
                                &SubKeyString,
-                               OBJ_CASE_INSENSITIVE,
+                               Attributes,
                                (HANDLE)ParentKey,
                                lpSecurityAttributes ? 
(PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL);
     Status = CreateNestedKey(phkResult,
-                             &Attributes,
+                             &ObjectAttributes,
                              (lpClass == NULL)? NULL : &ClassString,
                              dwOptions,
                              samDesired,
@@ -3347,6 +3355,7 @@
     UNICODE_STRING SubKeyString;
     HANDLE KeyHandle;
     NTSTATUS Status;
+    ULONG Attributes = OBJ_CASE_INSENSITIVE;
     LONG ErrorCode = ERROR_SUCCESS;
 
     TRACE("RegOpenKeyExA hKey 0x%x lpSubKey %s ulOptions 0x%x samDesired 0x%x 
phkResult %p\n",
@@ -3362,12 +3371,15 @@
     {
         return RtlNtStatusToDosError(Status);
     }
+
+    if (ulOptions & REG_OPTION_OPEN_LINK)
+        Attributes |= OBJ_OPENLINK;
 
     RtlCreateUnicodeStringFromAsciiz(&SubKeyString,
                                      (LPSTR)lpSubKey);
     InitializeObjectAttributes(&ObjectAttributes,
                                &SubKeyString,
-                               OBJ_CASE_INSENSITIVE,
+                               Attributes,
                                KeyHandle,
                                NULL);
 
@@ -3402,6 +3414,7 @@
     UNICODE_STRING SubKeyString;
     HANDLE KeyHandle;
     NTSTATUS Status;
+    ULONG Attributes = OBJ_CASE_INSENSITIVE;
     LONG ErrorCode = ERROR_SUCCESS;
 
     TRACE("RegOpenKeyExW hKey 0x%x lpSubKey %S ulOptions 0x%x samDesired 0x%x 
phkResult %p\n",
@@ -3416,6 +3429,9 @@
     {
         return RtlNtStatusToDosError(Status);
     }
+
+    if (ulOptions & REG_OPTION_OPEN_LINK)
+        Attributes |= OBJ_OPENLINK;
 
     if (lpSubKey != NULL)
         RtlInitUnicodeString(&SubKeyString, (LPWSTR)lpSubKey);
@@ -3424,7 +3440,7 @@
 
     InitializeObjectAttributes(&ObjectAttributes,
                                &SubKeyString,
-                               OBJ_CASE_INSENSITIVE,
+                               Attributes,
                                KeyHandle,
                                NULL);
 


Reply via email to