Fix SERIOUS bug in winecfg

Mike Hearn mike at plan99.net
Mon Oct 24 15:17:44 CDT 2005


The unixfs module apparently can't cope with the Z: drive being anything
other than / or being non-existant. A fresh .wine has this set up OK, but
clicking the drive autodetect button in winecfg will currently set it up
so D: is the root drive. Oops!

Incidentally, shouldn't we have drives be autoconfigured by default so
people can access the CD drive etc in Wine the way they're used to doing
so in Windows? If so just whack a call to winecfg /D in the wineprefixcreate
script.



Mike Hearn <mh at codeweavers.com>
Fix SERIOUS bug in winecfg

Index: programs/winecfg/drivedetect.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/drivedetect.c,v
retrieving revision 1.11
diff -u -p -d -u -r1.11 drivedetect.c
--- programs/winecfg/drivedetect.c	3 Aug 2005 21:25:10 -0000	1.11
+++ programs/winecfg/drivedetect.c	24 Oct 2005 20:11:26 -0000
@@ -192,7 +192,33 @@ static void ensure_root_is_mapped(void)
     BOOL mapped = FALSE;
 
     for (i = 0; i < 26; i++)
-        if (drives[i].in_use && !strcmp(drives[i].unixpath, "/")) mapped = TRUE;
+    {
+        if (drives[i].in_use && !strcmp(drives[i].unixpath, "/"))
+        {
+            mapped = TRUE;
+            
+            if ('A' + i != 'Z')
+            {
+                struct drive swapbuf;
+                
+                /* the root drive must be letter Z for now, the unixfs seems to expect it */
+                WINE_TRACE("attempting to remap / to drive Z:\n");
+
+                /* if Z is already used, we need to swap Z and this drive around */
+                if (drives['Z' - 'A'].in_use)
+                {
+                    swapbuf = drives['Z' - 'A'];
+                    drives['Z' - 'A'] = drives[i];
+                    drives[i] = swapbuf;
+                }
+                else
+                {
+                    drives['Z' - 'A'] = drives[i];
+                    drives[i].in_use = FALSE;
+                }
+            }
+        }
+    }
 
     if (!mapped)
     {



More information about the wine-patches mailing list