Skip to content

Commit

Permalink
Fix crash when trying to DIR a mounted physical CD drive
Browse files Browse the repository at this point in the history
  • Loading branch information
maron2000 committed Jan 5, 2025
1 parent aa1aaa5 commit eee44ef
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/dos/drive_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2286,6 +2286,7 @@ bool localDrive::AllocationInfo64(uint32_t* _bytes_sector, uint32_t* _sectors_cl
diskToQuery = drive ? root : NULL;

res = GetDiskFreeSpace(diskToQuery, &dwSectPerClust, &dwBytesPerSect, &dwFreeClusters, &dwTotalClusters);
if(dwSectPerClust * dwBytesPerSect == 0) return false;
ULARGE_INTEGER FreeBytesAvailableToCaller, TotalNumberOfBytes;
GetDiskFreeSpaceEx(diskToQuery, &FreeBytesAvailableToCaller, &TotalNumberOfBytes, NULL);
qwTotalClusters = TotalNumberOfBytes.QuadPart / (dwSectPerClust * dwBytesPerSect);
Expand Down

0 comments on commit eee44ef

Please sign in to comment.