[Bug 30592] Give kernel32.GetDiskFreeSpaceW a trace message to better diagnose free disk space overflow problems with Win9X era apps/games
wine-bugs at winehq.org
wine-bugs at winehq.org
Fri May 4 10:08:19 CDT 2012
http://bugs.winehq.org/show_bug.cgi?id=30592
Anastasius Focht <focht at gmx.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Give |Give
|kernel32.GetDiskFreeSpaceEx |kernel32.GetDiskFreeSpaceW
|W a trace message to better |a trace message to better
|diagnose free disk space |diagnose free disk space
|overflow problems with |overflow problems with
|Win9X era apps/games |Win9X era apps/games
--- Comment #1 from Anastasius Focht <focht at gmx.net> 2012-05-04 10:08:19 CDT ---
Hello,
*grmbl* sorry .. it is GetDiskFreeSpaceW for diagnosis, not the "Ex" version.
The "Ex" version avoids these problems.
http://source.winehq.org/git/wine.git/blob/1726427113b141535c2bb9e93879e409b7d00c37:/dlls/kernel32/volume.c#l1646
---- snip ---
1646 BOOL WINAPI GetDiskFreeSpaceW( LPCWSTR root, LPDWORD cluster_sectors,
1647 LPDWORD sector_bytes, LPDWORD
free_clusters,
1648 LPDWORD total_clusters )
1649 {
1650 FILE_FS_SIZE_INFORMATION info;
1651 IO_STATUS_BLOCK io;
1652 NTSTATUS status;
1653 HANDLE handle;
1654 UINT units;
1655
1656 TRACE( "%s,%p,%p,%p,%p\n", debugstr_w(root),
1657 cluster_sectors, sector_bytes, free_clusters, total_clusters );
1658
1659 if (!open_device_root( root, &handle )) return FALSE;
1660
1661 status = NtQueryVolumeInformationFile( handle, &io, &info,
sizeof(info), FileFsSizeInformation );
1662 NtClose( handle );
1663 if (status != STATUS_SUCCESS)
1664 {
1665 SetLastError( RtlNtStatusToDosError(status) );
1666 return FALSE;
1667 }
1668
1669 units = info.SectorsPerAllocationUnit * info.BytesPerSector;
1670
1671 if( GetVersion() & 0x80000000) { /* win3.x, 9x, ME */
1672 /* cap the size and available at 2GB as per specs */
1673 if (info.TotalAllocationUnits.QuadPart * units > 0x7fffffff) {
1674 info.TotalAllocationUnits.QuadPart = 0x7fffffff / units;
1675 if (info.AvailableAllocationUnits.QuadPart * units >
0x7fffffff)
1676 info.AvailableAllocationUnits.QuadPart = 0x7fffffff /
units;
1677 }
1678 /* nr. of clusters is always <= 65335 */
1679 while( info.TotalAllocationUnits.QuadPart > 65535 ) {
1680 info.TotalAllocationUnits.QuadPart /= 2;
1681 info.AvailableAllocationUnits.QuadPart /= 2;
1682 info.SectorsPerAllocationUnit *= 2;
1683 }
1684 }
1685
1686 if (cluster_sectors) *cluster_sectors = info.SectorsPerAllocationUnit;
1687 if (sector_bytes) *sector_bytes = info.BytesPerSector;
1688 if (free_clusters) *free_clusters =
info.AvailableAllocationUnits.u.LowPart;
1689 if (total_clusters) *total_clusters =
info.TotalAllocationUnits.u.LowPart;
1690 return TRUE;
1691 }
---- snip ---
Line 1690 ...
Regards
--
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the wine-bugs
mailing list