Bug 1456 : patch from w3seek : Fix a bug in CreateDirectoryEx that makes the function...
authorMagnus Olsen <magnus@greatlord.com>
Sun, 7 May 2006 18:17:50 +0000 (18:17 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Sun, 7 May 2006 18:17:50 +0000 (18:17 +0000)
svn path=/trunk/; revision=21835

reactos/dll/win32/kernel32/file/dir.c

index 8e842ee..3c2a6ad 100644 (file)
@@ -191,12 +191,6 @@ CreateDirectoryExW (
                 return FALSE;
         }
 
-        InitializeObjectAttributes(&ObjectAttributes,
-                                   &NtPathU,
-                                   OBJ_CASE_INSENSITIVE,
-                                   NULL,
-                                   (lpSecurityAttributes ? lpSecurityAttributes->lpSecurityDescriptor : NULL));
-
         InitializeObjectAttributes(&ObjectAttributes,
                                    &NtTemplatePathU,
                                    OBJ_CASE_INSENSITIVE,
@@ -256,7 +250,13 @@ OpenTemplateDir:
             Status = STATUS_OBJECT_NAME_INVALID;
             goto Cleanup;
         }
-        
+
+        InitializeObjectAttributes(&ObjectAttributes,
+                                   &NtPathU,
+                                   OBJ_CASE_INSENSITIVE,
+                                   NULL,
+                                   (lpSecurityAttributes ? lpSecurityAttributes->lpSecurityDescriptor : NULL));
+
         /*
          * Query the basic file attributes from the template directory
          */
@@ -358,6 +358,7 @@ OpenTemplateDir:
         /*
          * Create the new directory
          */
+
         Status = NtCreateFile (&DirectoryHandle,
                                DesiredAccess,
                                &ObjectAttributes,
@@ -443,7 +444,7 @@ OpenTemplateDir:
 
             /* FIXME - enumerate and copy the file streams */
         }
-        
+
         /*
          * We successfully created the directory and copied all information
          * from the template directory
@@ -460,7 +461,7 @@ CleanupNoNtPath:
         {
                 NtClose(TemplateHandle);
         }
-        
+
         RtlFreeHeap (RtlGetProcessHeap (),
                      0,
                      NtTemplatePathU.Buffer);