In INT21_GetFreeDiskSpace adjust the sectors-per-cluster value to make

the total number of clusters fit in a 16 bit register.
This commit is contained in:
Rein Klazes 2004-06-03 23:20:35 +00:00 committed by Alexandre Julliard
parent f32a105376
commit a1e8ba9fc2
1 changed files with 6 additions and 0 deletions

View File

@ -3397,6 +3397,12 @@ static int INT21_GetFreeDiskSpace( CONTEXT86 *context )
root[0] += INT21_MapDrive(DL_reg(context)); root[0] += INT21_MapDrive(DL_reg(context));
if (!GetDiskFreeSpaceW( root, &cluster_sectors, &sector_bytes, if (!GetDiskFreeSpaceW( root, &cluster_sectors, &sector_bytes,
&free_clusters, &total_clusters )) return 0; &free_clusters, &total_clusters )) return 0;
/* make sure that the number of clusters fits in a 16 bits value */
while( total_clusters & 0xffff0000) {
cluster_sectors <<= 1;
free_clusters >>= 1;
total_clusters >>= 1;
}
SET_AX( context, cluster_sectors ); SET_AX( context, cluster_sectors );
SET_BX( context, free_clusters ); SET_BX( context, free_clusters );
SET_CX( context, sector_bytes ); SET_CX( context, sector_bytes );