http://bugs.winehq.org/show_bug.cgi?id=30592
Bug #: 30592 Summary: Give kernel32.GetDiskFreeSpaceExW a trace message to better diagnose free disk space overflow problems with Win9X era apps/games Product: Wine Version: 1.5.3 Platform: x86 OS/Version: Linux Status: NEW Severity: enhancement Priority: P2 Component: kernel32 AssignedTo: wine-bugs@winehq.org ReportedBy: focht@gmx.net Classification: Unclassified
Hello,
another enhancement request for better diagnosis ...
Sometimes I encounter broken Win9X era apps/games that suffer from GetDiskFreeSpaceA/W overflows.
Example code which contains overflows:
--- snip --- 0x00428414: pushl %ecx 0x00428415: pushl %eax 0x00428416: leal 0x1c(%esp),%ecx 0x0042841a: pushl %edx 0x0042841b: leal 0x10(%esp),%eax 0x0042841f: pushl %ecx 0x00428420: pushl %eax 0x00428421: call *0x8a75fc -> 0x7b88273a GetDiskFreeSpaceA 0x00428427: movl 0xc(%esp),%ecx ; ecx = free_clusters 0x0042842b: movl 0x320(%esp),%eax ; needed space (compare value) 0x00428432: imull 0x10(%esp),%ecx ; ecx *= sector_bytes 0x00428437: imull 0x14(%esp),%ecx ; ecx *= cluster_sectors 0x0042843c: cmpl %ecx,%eax 0x0042843e: jnle 0x0042844c 0x00428440: xorl %eax,%eax 0x00428442: popl %ebx 0x00428443: addl $0x318,%esp 0x00428449: ret $0x4 0x0042844c: subl %ecx,%eax 0x0042844e: popl %ebx --- snip ---
If you currently do +volume trace:
--- snip --- 0024:Call KERNEL32.GetDiskFreeSpaceA(0032eccc "C:\",0032ecdc,0032ecd8,0032ecd4,0032ece0) ret=00428427 0024:trace:volume:GetDiskFreeSpaceW L"C:\",0x32ecdc,0x32ecd8,0x32ecd4,0x32ece0 0024:Ret KERNEL32.GetDiskFreeSpaceA() retval=00000001 ret=00428427 ... 0024:trace:msvcrt:pf_printf_a Format is: "You do not have enough disk space to run King's Quest: Mask of Eternity. Please free up %d megs of space and try again." --- snip ---
I'd like to see all the information returned to caller when doing +volume trace.
Source: http://source.winehq.org/git/wine.git/blob/1726427113b141535c2bb9e93879e409b...
--- snip --- 1598 BOOL WINAPI GetDiskFreeSpaceExW( LPCWSTR root, PULARGE_INTEGER avail, 1599 PULARGE_INTEGER total, PULARGE_INTEGER totalfree ) 1600 { 1601 FILE_FS_SIZE_INFORMATION info; 1602 IO_STATUS_BLOCK io; 1603 NTSTATUS status; 1604 HANDLE handle; 1605 UINT units; 1606 1607 TRACE( "%s,%p,%p,%p\n", debugstr_w(root), avail, total, totalfree ); 1608 1609 if (!open_device_root( root, &handle )) return FALSE; 1610 1611 status = NtQueryVolumeInformationFile( handle, &io, &info, sizeof(info), FileFsSizeInformation ); 1612 NtClose( handle ); 1613 if (status != STATUS_SUCCESS) 1614 { 1615 SetLastError( RtlNtStatusToDosError(status) ); 1616 return FALSE; 1617 } 1618 1619 units = info.SectorsPerAllocationUnit * info.BytesPerSector; 1620 if (total) total->QuadPart = info.TotalAllocationUnits.QuadPart * units; 1621 if (totalfree) totalfree->QuadPart = info.AvailableAllocationUnits.QuadPart * units; 1622 /* FIXME: this one should take quotas into account */ 1623 if (avail) avail->QuadPart = info.AvailableAllocationUnits.QuadPart * units; 1624 return TRUE; 1625 } --- snip ---
Before the return on line 1624 a TRACE() would be very helpful, printing the actual values of out parameters: cluster_sector, sector_bytes, free_clusters, total_clusters Additionally a hint if the values were capped due to Win9X compat (capped=0/1).
Actual 32-bits overflow warning would be a bonus but not required ;-)
Thanks.
Regards