Get rid of W->A calls: GetDiskFreeSpaceEx

Stefan Leichter Stefan.Leichter at camLine.com
Wed Dec 4 04:16:32 CST 2002


Changelog
------------
        moved implementation of GetDiskFreeSpaceEx from ascii to unicode

Index: wine/files/drive.c
===================================================================
RCS file: /home/wine/wine/files/drive.c,v
retrieving revision 1.79
diff -u -r1.79 drive.c
--- wine/files/drive.c	25 Oct 2002 03:32:11 -0000	1.79
+++ wine/files/drive.c	4 Dec 2002 10:13:00 -0000
@@ -1529,7 +1529,7 @@
 
 
 /***********************************************************************
- *           GetDiskFreeSpaceExA   (KERNEL32.@)
+ *           GetDiskFreeSpaceExW   (KERNEL32.@)
  *
  *  This function is used to acquire the size of the available and
  *  total space on a logical volume.
@@ -1540,7 +1540,7 @@
  *  detailed error information.
  *
  */
-BOOL WINAPI GetDiskFreeSpaceExA( LPCSTR root,
+BOOL WINAPI GetDiskFreeSpaceExW( LPCWSTR root,
 				     PULARGE_INTEGER avail,
 				     PULARGE_INTEGER total,
 				     PULARGE_INTEGER totalfree)
@@ -1556,10 +1556,10 @@
             FIXME("there are valid root names which are not supported yet\n");
 	    /* ..like UNC names, for instance. */
 
-            WARN("invalid root '%s'\n", root );
+            WARN("invalid root '%s'\n", debugstr_w(root));
             return FALSE;
         }
-        drive = toupper(root[0]) - 'A';
+        drive = toupperW(root[0]) - 'A';
     }
 
     if (!DRIVE_GetFreeSpace(drive, &size, &available)) return FALSE;
@@ -1605,18 +1605,21 @@
 }
 
 /***********************************************************************
- *           GetDiskFreeSpaceExW   (KERNEL32.@)
+ *           GetDiskFreeSpaceExA   (KERNEL32.@)
  */
-BOOL WINAPI GetDiskFreeSpaceExW( LPCWSTR root, PULARGE_INTEGER avail,
+BOOL WINAPI GetDiskFreeSpaceExA( LPCSTR root, PULARGE_INTEGER avail,
 				     PULARGE_INTEGER total,
 				     PULARGE_INTEGER  totalfree)
 {
-    LPSTR xroot;
+    UNICODE_STRING rootW;
     BOOL ret;
 
-    xroot = HEAP_strdupWtoA( GetProcessHeap(), 0, root);
-    ret = GetDiskFreeSpaceExA( xroot, avail, total, totalfree);
-    HeapFree( GetProcessHeap(), 0, xroot );
+    if (root) RtlCreateUnicodeStringFromAsciiz(&rootW, root);
+    else rootW.Buffer = NULL;
+
+    ret = GetDiskFreeSpaceExW( rootW.Buffer, avail, total, totalfree);
+
+    RtlFreeUnicodeString(&rootW);
     return ret;
 }
 



More information about the wine-patches mailing list