Free disk space can be read from the removable drives too.

Size and count were reversed in the recycle manager. Fixed.
This commit is contained in:
Kimmo Pekkola 2009-03-10 17:32:35 +00:00
parent d7bfbf386d
commit b4b2d3b9b0
3 changed files with 8 additions and 4 deletions

View File

@ -30,6 +30,8 @@
CMeasureDiskSpace::CMeasureDiskSpace(CMeterWindow* meterWindow) : CMeasure(meterWindow) CMeasureDiskSpace::CMeasureDiskSpace(CMeterWindow* meterWindow) : CMeasure(meterWindow)
{ {
m_Total = false; m_Total = false;
m_Label = false;
m_IgnoreRemovable = false;
} }
/* /*
@ -55,7 +57,7 @@ bool CMeasureDiskSpace::Update()
ULARGE_INTEGER i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes; ULARGE_INTEGER i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes;
UINT type = GetDriveType(m_Drive.c_str()); UINT type = GetDriveType(m_Drive.c_str());
if (type != DRIVE_CDROM && type != DRIVE_REMOVABLE) // Ignore CD-ROMS and removable drives if (type != DRIVE_CDROM && (!m_IgnoreRemovable || type != DRIVE_REMOVABLE)) // Ignore CD-ROMS and removable drives
{ {
if(GetDiskFreeSpaceEx(m_Drive.c_str(), &i64FreeBytesToCaller, &i64TotalBytes, &i64FreeBytes)) if(GetDiskFreeSpaceEx(m_Drive.c_str(), &i64FreeBytesToCaller, &i64TotalBytes, &i64FreeBytes))
{ {
@ -115,12 +117,13 @@ void CMeasureDiskSpace::ReadConfig(CConfigParser& parser, const WCHAR* section)
m_Drive = parser.ReadString(section, L"Drive", L"C:\\"); m_Drive = parser.ReadString(section, L"Drive", L"C:\\");
m_Total = (1 == parser.ReadInt(section, L"Total", 0)); m_Total = (1 == parser.ReadInt(section, L"Total", 0));
m_Label = (1 == parser.ReadInt(section, L"Label", 0)); m_Label = (1 == parser.ReadInt(section, L"Label", 0));
m_IgnoreRemovable = (1 == parser.ReadInt(section, L"IgnoreRemovable", 0));
// Set the m_MaxValue // Set the m_MaxValue
ULARGE_INTEGER i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes; ULARGE_INTEGER i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes;
UINT type = GetDriveType(m_Drive.c_str()); UINT type = GetDriveType(m_Drive.c_str());
if (type != DRIVE_CDROM && type != DRIVE_REMOVABLE) // Ignore CD-ROMS and removable drives if (type != DRIVE_CDROM && (!m_IgnoreRemovable || type != DRIVE_REMOVABLE)) // Ignore CD-ROMS and removable drives
{ {
if(GetDiskFreeSpaceEx(m_Drive.c_str(), &i64FreeBytesToCaller, &i64TotalBytes, &i64FreeBytes)) if(GetDiskFreeSpaceEx(m_Drive.c_str(), &i64FreeBytesToCaller, &i64TotalBytes, &i64FreeBytes))
{ {

View File

@ -36,6 +36,7 @@ private:
std::wstring m_LabelName; std::wstring m_LabelName;
bool m_Total; bool m_Total;
bool m_Label; bool m_Label;
bool m_IgnoreRemovable;
}; };
#endif #endif

View File

@ -97,11 +97,11 @@ double Update2(UINT id)
RecycleBinInfo.cbSize = sizeof( RecycleBinInfo ); // Tell size of structure RecycleBinInfo.cbSize = sizeof( RecycleBinInfo ); // Tell size of structure
SHQueryRecycleBin( L"C:", &RecycleBinInfo ); // Get recycle bin info SHQueryRecycleBin( L"C:", &RecycleBinInfo ); // Get recycle bin info
if (dataType == NUMRECYCLE) if (dataType == SIZERECYCLE)
{ {
return (double)RecycleBinInfo.i64Size; // size in bytes return (double)RecycleBinInfo.i64Size; // size in bytes
} }
else if (dataType == SIZERECYCLE) else if (dataType == NUMRECYCLE)
{ {
return (double)RecycleBinInfo.i64NumItems; // number of items in bin return (double)RecycleBinInfo.i64NumItems; // number of items in bin
} }