Add filesytem type NTFS to config (2nd version)

Tony Lambregts tony_lambregts at telusplanet.net
Tue Jan 14 21:36:09 CST 2003


Cleaned up a little based on suggestions ....

Some program (VirtualDub) checks the fsname returned by
GetVolumeInformation, to find the name of the file system, when it needs
to write files that are larger than 2GB. It refuses to create the file
when we return FAT but will successfully write the file when NTSF is
returned.

Change Log: add configuration option to report NTFS as the file system
type for a drive.

Files changed: documentation/samples/config
                documentation/configuring.sgml
                files/drive.c

-- 

Tony Lambregts


-------------- next part --------------
Index: files/drive.c
===================================================================
RCS file: /home/wine/wine/files/drive.c,v
retrieving revision 1.83
diff -u -r1.83 drive.c
--- files/drive.c	13 Jan 2003 20:44:13 -0000	1.83
+++ files/drive.c	15 Jan 2003 02:50:57 -0000
@@ -90,6 +90,7 @@
     UINT      codepage;  /* drive code page */
     dev_t     dev;       /* unix device number */
     ino_t     ino;       /* unix inode number */
+    WCHAR     fs_type[12];     /* file system type */
 } DOSDRIVE;
 
 
@@ -121,9 +122,13 @@
     { {'f','a','t',0}, DRIVE_SHORT_NAMES },
     { {'v','f','a','t',0}, DRIVE_CASE_PRESERVING },
     { {'w','i','n','9','5',0}, DRIVE_CASE_PRESERVING },
+    { {'n','t','f','s',0}, DRIVE_CASE_PRESERVING },
     { { 0 }, 0 }
 };
 
+static const WCHAR win95W[] = {'w','i','n','9','5',0};
+static const WCHAR ntfsW[] = {'N','T','F','S',0};
+
 
 static DOSDRIVE DOSDrives[MAX_DOS_DRIVES];
 static int DRIVE_CurDrive = -1;
@@ -180,6 +185,27 @@
 
 
 /***********************************************************************
+ *           DRIVE_GetFSType
+ */
+UINT DRIVE_GetFSType( LPCWSTR name, LPCWSTR value, WCHAR *fstype )
+{
+    const FS_DESCR *descr;
+    UINT i;
+  
+    for (i = 0, descr = DRIVE_Filesystems; *descr->name; descr++, i++){
+        if (!strcmpiW( value, descr->name )){
+	    strcpyW( fstype, descr->name );
+	    return i;
+	}
+    }
+    MESSAGE("%s: unknown filesystem type %s, defaulting to 'win95'.\n",
+            debugstr_w(name), debugstr_w(value) );
+    strcpyW( fstype, win95W );
+    return -1 ;
+
+
+}
+/***********************************************************************
  *           DRIVE_Init
  */
 int DRIVE_Init(void)
@@ -200,7 +226,6 @@
     static const WCHAR zeroW[] = {'0',0};
     static const WCHAR def_serialW[] = {'1','2','3','4','5','6','7','8',0};
     static const WCHAR FilesystemW[] = {'F','i','l','e','s','y','s','t','e','m',0};
-    static const WCHAR win95W[] = {'w','i','n','9','5',0};
     static const WCHAR DeviceW[] = {'D','e','v','i','c','e',0};
     static const WCHAR ReadVolInfoW[] = {'R','e','a','d','V','o','l','I','n','f','o',0};
     static const WCHAR FailReadOnlyW[] = {'F','a','i','l','R','e','a','d','O','n','l','y',0};
@@ -277,6 +302,8 @@
             /* Get the filesystem type */
             PROFILE_GetWineIniString( name, FilesystemW, win95W, buffer, 80 );
             drive->flags = DRIVE_GetFSFlags( name, buffer );
+            
+	    DRIVE_GetFSType(name, buffer, drive->fs_type);
 
             /* Get the device */
             PROFILE_GetWineIniString( name, DeviceW, empty_strW, buffer, 80 );
@@ -468,8 +495,6 @@
         }
     }
 }
-
-
 /***********************************************************************
  *           DRIVE_FindDriveRootW
  *
@@ -1964,6 +1989,7 @@
        if (DOSDrives[drive].flags & DRIVE_CASE_PRESERVING)
          *flags|=FS_CASE_IS_PRESERVED;
       }
+
     if (fsname && fsname_len)
     {
     	/* Diablo checks that return code ... */
@@ -1974,8 +2000,15 @@
         }
 	else
         {
-            static const WCHAR fatW[] = {'F','A','T',0};
-            strncpyW( fsname, fatW, fsname_len );
+            FIXME("fs_type = %s\n",
+               debugstr_w(DOSDrives[drive].fs_type));
+            if (!strcmpiW(DOSDrives[drive].fs_type,ntfsW))		    
+	   	strncpyW( fsname, ntfsW, fsname_len );
+	    else
+	    {	    
+                static const WCHAR fatW[] = {'F','A','T',0};
+                strncpyW( fsname, fatW, fsname_len );
+	    }
         }
         fsname[fsname_len - 1] = 0; /* ensure 0 termination */
     }
Index: documentation/configuring.sgml
===================================================================
RCS file: /home/wine/wine/documentation/configuring.sgml,v
retrieving revision 1.22
diff -u -r1.22 configuring.sgml
--- documentation/configuring.sgml	24 Dec 2002 00:56:33 -0000	1.22
+++ documentation/configuring.sgml	15 Jan 2003 02:51:21 -0000
@@ -245,46 +245,59 @@
 	    is a smarter choice.
           </para>
           <para>
-            <programlisting>"Filesystem" = "win95|unix|msdos"</programlisting>
+            <programlisting>
+              "Filesystem" = "msdos|win95|ntfs|unix"
+            </programlisting>
             Sets up the way Wine looks at files on the drive.
           </para>
 
           <variablelist>
             <varlistentry>
+              <term><literal>msdos</literal></term>
+              <listitem>
+                <para>
+                  Case insensitive filesystem. Alike to DOS and
+                  Windows 3.x. <literal>8.3</literal> is the maximum
+                  length of files (eightdot.123) - longer ones will be
+                  truncated. (NOTE: this is a very bad choice if you
+                  plan on running apps that use long filenames. win95
+                  should work fine with apps that were designed to run
+                  under the msdos system. In other words, you might
+                  not want to use this.)
+                </para>
+              </listitem>
+            </varlistentry>
+            <varlistentry>
               <term><literal>win95</literal></term>
               <listitem>
                 <para>
-                  Case insensitive. Alike to Windows 9x/NT 4. This is
+                  Case preserving. Alike to Windows 9x/NT 4. This is
                   the long filename filesystem you are probably used
                   to working with. The filesystem of choice for most
-                  applications to be run under wine.  PROBABLY THE ONE
+                  applications that are run under Wine.  PROBABLY THE ONE
                   YOU WANT!
                 </para>
               </listitem>
             </varlistentry>
             <varlistentry>
-              <term><literal>unix</literal></term>
+              <term><literal>ntfs</literal></term>
               <listitem>
                 <para>
-                  Case sensitive. This filesystem has almost no use
-                  (Windows apps expect case insensitive filenames).
-                  Try it if you dare, but win95 is a  much better
-                  choice.
-                </para>
+                  Case preserving filesystem. The same as win95 except that 
+                  some programs check for this when saving files larger than
+                  2GB. Make sure that the underlaying file system supports
+                  files > 2GB when using this. eg: ext2/3 (NOT vFAT)
+               </para>
               </listitem>
             </varlistentry>
             <varlistentry>
-              <term><literal>msdos</literal></term>
+              <term><literal>unix</literal></term>
               <listitem>
                 <para>
-                  Case insensitive filesystem. Alike to DOS and
-                  Windows 3.x. <literal>8.3</literal> is the maximum
-                  length of files (eightdot.123) - longer ones will be
-                  truncated. (NOTE: this is a very bad choice if you
-                  plan on running apps that use long filenames. win95
-                  should work fine with apps that were designed to run
-                  under the msdos system. In other words, you might
-                  not want to use this.)
+                  Case sensitive. This filesystem has almost no use
+                  (Windows apps expect case insensitive filenames).
+                  Try it if you dare, but win95/ntfs are much better
+                  choices.
                 </para>
               </listitem>
             </varlistentry>
Index: documentation/samples/config
===================================================================
RCS file: /home/wine/wine/documentation/samples/config,v
retrieving revision 1.37
diff -u -r1.37 config
--- documentation/samples/config	13 Dec 2002 02:26:18 -0000	1.37
+++ documentation/samples/config	15 Jan 2003 02:51:35 -0000
@@ -13,13 +13,17 @@
 ;; "Type"="xxx"       (supported types are 'floppy', 'hd', 'cdrom' and 'network')
 ;; "Label"="xxx"      (drive label, at most 11 characters)
 ;; "Serial"="xxx"     (serial number, 8 characters hexadecimal number)
-;; "Filesystem"="xxx" (supported types are 'msdos'/'dos'/'fat', 'win95'/'vfat', 'unix')
+;; "Filesystem"="xxx" (supported types are 'msdos'/'dos'/'fat', 
+;;                                         'win95'/'vfat',
+;;                                         'ntfs',
+;;                                         'unix')
 ;;   This is the FS Wine is supposed to emulate on a certain
 ;;   directory structure.
 ;;   Recommended:
-;;   - "win95" for ext2fs, VFAT and FAT32
+;;   - "win95" for Native *nix, VFAT and FAT32
 ;;   - "msdos" for FAT16 (ugly, upgrading to VFAT driver strongly recommended)
-;;   DON'T use "unix" unless you intend to port programs using Winelib !
+;;   - "ntfs"  for Native *nix (some program need this to write files > 2GB)
+;;   - "unix"  DO NOT USE unless you intend to port programs using Winelib !
 ;; "Device"="/dev/xx" (only if you want to allow raw device access)
 ;;
 [Drive A]


More information about the wine-patches mailing list