branch update for HEAD-2003050101
[reactos.git] / lib / fmifs / format.c
index 1f6d817..bf14bfd 100644 (file)
 #define _UNICODE
 #include <windows.h>
 #include <fmifs.h>
+#include <fslib/vfatlib.h>
+
+#define NDEBUG
+#include <debug.h>
+
 
 /* FMIFS.6 */
 VOID
@@ -35,14 +40,30 @@ FormatEx(
        PFMIFSCALLBACK  Callback
        )
 {
-       BOOL    Argument = FALSE;
+       UNICODE_STRING usDriveRoot;
+       UNICODE_STRING usLabel;
+       BOOL Argument = FALSE;
+
+       RtlInitUnicodeString(&usDriveRoot, DriveRoot);
+       RtlInitUnicodeString(&usLabel, Label);
+
+       if (_wcsnicmp(Format, L"FAT", 3) == 0)
+       {
+               DPRINT1("FormatEx - FAT\n");
+               VfatInitialize();
+
+               VfatFormat(&usDriveRoot, MediaFlag, &usLabel, QuickFormat, ClusterSize, Callback);
 
-       /* FAIL immediately */
-       Callback(
-               DONE,           /* Command */
-               0,              /* DWORD Modifier */
-               & Argument      /* Argument */
+               VfatCleanup();
+       }
+       else
+       {
+               /* Unknown file system */
+               Callback(DONE,          /* Command */
+                       0,                              /* DWORD Modifier */
+                       &Argument               /* Argument */
                );
+       }
 }