GetDiskFreeSpace needs to set the last error on failure.

This commit is contained in:
Aric Stewart 2002-01-29 02:45:23 +00:00 committed by Alexandre Julliard
parent a51ff76b86
commit c43985b275
1 changed files with 9 additions and 3 deletions

View File

@ -1289,11 +1289,17 @@ BOOL WINAPI GetDiskFreeSpaceA( LPCSTR root, LPDWORD cluster_sectors,
else else
if (path[0] == '\\') if (path[0] == '\\')
path++; path++;
if (strlen(path)) /* oops, we are in a subdir */ if (path[0]) /* oops, we are in a subdir */
{
SetLastError(ERROR_INVALID_NAME);
return FALSE; return FALSE;
} }
}
else else
{
SetLastError(ERROR_INVALID_NAME);
return FALSE; return FALSE;
}
if (!DRIVE_GetFreeSpace(drive, &size, &available)) return FALSE; if (!DRIVE_GetFreeSpace(drive, &size, &available)) return FALSE;
@ -1311,7 +1317,7 @@ BOOL WINAPI GetDiskFreeSpaceA( LPCSTR root, LPDWORD cluster_sectors,
sec_size = (DRIVE_GetType(drive)==DRIVE_CDROM) ? 2048 : 512; sec_size = (DRIVE_GetType(drive)==DRIVE_CDROM) ? 2048 : 512;
size.s.LowPart /= sec_size; size.s.LowPart /= sec_size;
available.s.LowPart /= sec_size; available.s.LowPart /= sec_size;
/* fixme: probably have to adjust those variables too for CDFS */ /* FIXME: probably have to adjust those variables too for CDFS */
cluster_sec = 1; cluster_sec = 1;
while (cluster_sec * 65536 < size.s.LowPart) cluster_sec *= 2; while (cluster_sec * 65536 < size.s.LowPart) cluster_sec *= 2;