mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
FreeDiskSpace: Added DiskQuota option to change the returned size values to obey user disk quotas when set to DiskQuota=1. (default 0)
This commit is contained in:
parent
ef2942a6c1
commit
6a1a880801
@ -43,6 +43,7 @@ CMeasureDiskSpace::CMeasureDiskSpace(CMeterWindow* meterWindow, const WCHAR* nam
|
|||||||
m_Total(false),
|
m_Total(false),
|
||||||
m_Label(false),
|
m_Label(false),
|
||||||
m_IgnoreRemovable(true),
|
m_IgnoreRemovable(true),
|
||||||
|
m_DiskQuota(false),
|
||||||
m_OldTotalBytes()
|
m_OldTotalBytes()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -112,7 +113,14 @@ void CMeasureDiskSpace::UpdateValue()
|
|||||||
{
|
{
|
||||||
UINT oldMode = SetErrorMode(0);
|
UINT oldMode = SetErrorMode(0);
|
||||||
SetErrorMode(oldMode | SEM_FAILCRITICALERRORS); // Prevent the system from displaying message box
|
SetErrorMode(oldMode | SEM_FAILCRITICALERRORS); // Prevent the system from displaying message box
|
||||||
sizeResult = GetDiskFreeSpaceEx(drive, NULL, (PULARGE_INTEGER)&i64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes);
|
if (!m_DiskQuota)
|
||||||
|
{
|
||||||
|
sizeResult = GetDiskFreeSpaceEx(drive, NULL, (PULARGE_INTEGER)&i64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sizeResult = GetDiskFreeSpaceEx(drive, (PULARGE_INTEGER)&i64FreeBytes, (PULARGE_INTEGER)&i64TotalBytes, NULL);
|
||||||
|
}
|
||||||
SetErrorMode(oldMode); // Reset
|
SetErrorMode(oldMode); // Reset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,6 +211,7 @@ void CMeasureDiskSpace::ReadOptions(CConfigParser& parser, const WCHAR* section)
|
|||||||
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", 1));
|
m_IgnoreRemovable = (1 == parser.ReadInt(section, L"IgnoreRemovable", 1));
|
||||||
|
m_DiskQuota = (1 == parser.ReadInt(section, L"DiskQuota", 0));
|
||||||
|
|
||||||
// Set the m_MaxValue
|
// Set the m_MaxValue
|
||||||
if (!m_Initialized)
|
if (!m_Initialized)
|
||||||
|
@ -42,6 +42,7 @@ private:
|
|||||||
bool m_Total;
|
bool m_Total;
|
||||||
bool m_Label;
|
bool m_Label;
|
||||||
bool m_IgnoreRemovable;
|
bool m_IgnoreRemovable;
|
||||||
|
bool m_DiskQuota;
|
||||||
|
|
||||||
ULONGLONG m_OldTotalBytes;
|
ULONGLONG m_OldTotalBytes;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user