Moved implementation of GetDiskFreeSpaceEx from ascii to unicode.

This commit is contained in:
Stefan Leichter 2002-12-07 23:47:01 +00:00 committed by Alexandre Julliard
parent 1cfc850b2c
commit 5e2b3131d0
1 changed files with 13 additions and 10 deletions

View File

@ -1529,7 +1529,7 @@ BOOL WINAPI GetDiskFreeSpaceA( LPCSTR root, LPDWORD cluster_sectors,
/*********************************************************************** /***********************************************************************
* GetDiskFreeSpaceExA (KERNEL32.@) * GetDiskFreeSpaceExW (KERNEL32.@)
* *
* This function is used to acquire the size of the available and * This function is used to acquire the size of the available and
* total space on a logical volume. * total space on a logical volume.
@ -1540,7 +1540,7 @@ BOOL WINAPI GetDiskFreeSpaceA( LPCSTR root, LPDWORD cluster_sectors,
* detailed error information. * detailed error information.
* *
*/ */
BOOL WINAPI GetDiskFreeSpaceExA( LPCSTR root, BOOL WINAPI GetDiskFreeSpaceExW( LPCWSTR root,
PULARGE_INTEGER avail, PULARGE_INTEGER avail,
PULARGE_INTEGER total, PULARGE_INTEGER total,
PULARGE_INTEGER totalfree) PULARGE_INTEGER totalfree)
@ -1556,10 +1556,10 @@ BOOL WINAPI GetDiskFreeSpaceExA( LPCSTR root,
FIXME("there are valid root names which are not supported yet\n"); FIXME("there are valid root names which are not supported yet\n");
/* ..like UNC names, for instance. */ /* ..like UNC names, for instance. */
WARN("invalid root '%s'\n", root ); WARN("invalid root '%s'\n", debugstr_w(root));
return FALSE; return FALSE;
} }
drive = toupper(root[0]) - 'A'; drive = toupperW(root[0]) - 'A';
} }
if (!DRIVE_GetFreeSpace(drive, &size, &available)) return FALSE; if (!DRIVE_GetFreeSpace(drive, &size, &available)) return FALSE;
@ -1605,18 +1605,21 @@ BOOL WINAPI GetDiskFreeSpaceExA( LPCSTR root,
} }
/*********************************************************************** /***********************************************************************
* 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 total,
PULARGE_INTEGER totalfree) PULARGE_INTEGER totalfree)
{ {
LPSTR xroot; UNICODE_STRING rootW;
BOOL ret; BOOL ret;
xroot = HEAP_strdupWtoA( GetProcessHeap(), 0, root); if (root) RtlCreateUnicodeStringFromAsciiz(&rootW, root);
ret = GetDiskFreeSpaceExA( xroot, avail, total, totalfree); else rootW.Buffer = NULL;
HeapFree( GetProcessHeap(), 0, xroot );
ret = GetDiskFreeSpaceExW( rootW.Buffer, avail, total, totalfree);
RtlFreeUnicodeString(&rootW);
return ret; return ret;
} }