Moved implementation of GetDiskFreeSpaceEx from ascii to unicode.
diff --git a/files/drive.c b/files/drive.c
index f13bc53..4752352 100644
--- a/files/drive.c
+++ b/files/drive.c
@@ -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;
}