Fix the path translation in FormatEx (depends on unimplemented GetVolumeNameForVolume...
authorFilip Navara <filip.navara@gmail.com>
Tue, 13 Dec 2005 23:10:34 +0000 (23:10 +0000)
committerFilip Navara <filip.navara@gmail.com>
Tue, 13 Dec 2005 23:10:34 +0000 (23:10 +0000)
svn path=/trunk/; revision=20156

reactos/lib/fmifs/fmifs.xml
reactos/lib/fmifs/format.c

index f9e58f8..76a1aa7 100644 (file)
@@ -3,6 +3,7 @@
        <include base="fmifs">.</include>
        <define name="_DISABLE_TIDENTS" />
        <define name="__USE_W32API" />
+       <define name="_WIN32_WINNT">0x0600</define>
        <library>vfatlib</library>
        <library>ntdll</library>
        <library>kernel32</library>
index 1a31c84..a693466 100644 (file)
@@ -35,8 +35,28 @@ FormatEx (PWCHAR DriveRoot,
   UNICODE_STRING usDriveRoot;
   UNICODE_STRING usLabel;
   BOOLEAN Argument = FALSE;
+  WCHAR VolumeName[MAX_PATH];
+  CURDIR CurDir;
+
+  if (_wcsnicmp(Format, L"FAT", 3) != 0)
+    {
+      /* Unknown file system */
+      Callback (DONE,        /* Command */
+               0,           /* DWORD Modifier */
+               &Argument);  /* Argument */
+    }
+
+  if (!GetVolumeNameForVolumeMountPointW(DriveRoot, VolumeName, MAX_PATH) ||
+      !RtlDosPathNameToNtPathName_U(VolumeName, &usDriveRoot, NULL, &CurDir))
+    {
+      /* Report an error. */
+      Callback (DONE,        /* Command */
+               0,           /* DWORD Modifier */
+               &Argument);  /* Argument */
+
+      return;
+    }
 
-  RtlInitUnicodeString(&usDriveRoot, DriveRoot);
   RtlInitUnicodeString(&usLabel, Label);
 
   if (_wcsnicmp(Format, L"FAT", 3) == 0)
@@ -51,13 +71,7 @@ FormatEx (PWCHAR DriveRoot,
                  ClusterSize,
                  Callback);
       VfatCleanup ();
-    }
-  else
-    {
-      /* Unknown file system */
-      Callback (DONE,        /* Command */
-               0,           /* DWORD Modifier */
-               &Argument);  /* Argument */
+      RtlFreeUnicodeString(&usDriveRoot);
     }
 }