mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Additional change for r1183.
This commit is contained in:
parent
71402a8d48
commit
cc211053be
@ -57,7 +57,7 @@ int RainmeterMain(HINSTANCE hInstance, LPWSTR cmdLine)
|
||||
{
|
||||
COPYDATASTRUCT cds;
|
||||
|
||||
if (cmdLine && cmdLine[0] == L'!')
|
||||
if (cmdLine[0] == L'!')
|
||||
{
|
||||
// Deliver bang to existing Rainmeter instance
|
||||
cds.dwData = 1;
|
||||
@ -84,6 +84,14 @@ int RainmeterMain(HINSTANCE hInstance, LPWSTR cmdLine)
|
||||
}
|
||||
}
|
||||
|
||||
if (cmdLine[0] == L'!' &&
|
||||
_wcsicmp(L"!RainmeterQuit", cmdLine) != 0 &&
|
||||
_wcsicmp(L"!Quit", cmdLine) != 0)
|
||||
{
|
||||
MessageBox(NULL, L"Unable to send bang: Rainmeter is not running.", L"Rainmeter", MB_OK | MB_TOPMOST | MB_ICONERROR);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Avoid loading a dll from current directory
|
||||
SetDllDirectory(L"");
|
||||
|
||||
|
@ -34,8 +34,13 @@ struct MeasureData
|
||||
};
|
||||
|
||||
struct BinData
|
||||
{
|
||||
union
|
||||
{
|
||||
ULONGLONG lastWrite;
|
||||
UINT lastCount;
|
||||
};
|
||||
|
||||
HANDLE directory;
|
||||
WCHAR drive;
|
||||
bool isFAT;
|
||||
@ -128,15 +133,35 @@ PLUGIN_EXPORT double Update(void* data)
|
||||
|
||||
WCHAR* pos = wcschr(buffer, data.drive);
|
||||
if (pos != NULL)
|
||||
{
|
||||
if (data.lastWrite != -1)
|
||||
{
|
||||
if (data.isFAT)
|
||||
{
|
||||
// FAT/FAT32 doesn't update directory last write time.
|
||||
// TODO: Fix me?
|
||||
// Use directory content count instead.
|
||||
WCHAR filter[] = L"\0:\\$RECYCLE.BIN\\*";
|
||||
WCHAR filterXP[] = L"\0:\\RECYCLED\\*";
|
||||
filter[0] = *pos;
|
||||
filterXP[0] = *pos;
|
||||
|
||||
WIN32_FIND_DATA fd;
|
||||
HANDLE hSearch = FindFirstFile(g_IsXP ? filterXP : filter, &fd);
|
||||
if (hSearch != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
UINT count = 0;
|
||||
do
|
||||
{
|
||||
++count;
|
||||
}
|
||||
else
|
||||
while (FindNextFile(hSearch, &fd));
|
||||
|
||||
if (count != data.lastCount)
|
||||
{
|
||||
data.lastCount = count;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (data.directory)
|
||||
{
|
||||
ULONGLONG lastWrite;
|
||||
GetFileTime(data.directory, NULL, NULL, (FILETIME*)&lastWrite);
|
||||
@ -146,7 +171,6 @@ PLUGIN_EXPORT double Update(void* data)
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*pos = DRIVE_HANDLED;
|
||||
++iter;
|
||||
@ -178,8 +202,6 @@ PLUGIN_EXPORT double Update(void* data)
|
||||
data.directory = GetRecycleBinHandle(buffer[i], data.isFAT);
|
||||
}
|
||||
|
||||
data.lastWrite = (data.directory || data.isFAT) ? 0 : -1;
|
||||
|
||||
g_BinData.push_back(data);
|
||||
}
|
||||
}
|
||||
@ -307,12 +329,15 @@ HANDLE GetRecycleBinHandle(WCHAR drive, bool& isFAT)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
isFAT = true;
|
||||
if (wcscmp(filesystem, L"NTFS") == 0)
|
||||
{
|
||||
isFAT = false;
|
||||
}
|
||||
else if (wcscmp(filesystem, L"FAT") != 0 && wcscmp(filesystem, L"FAT32"))
|
||||
else if (wcscmp(filesystem, L"FAT") == 0 || wcscmp(filesystem, L"FAT32") == 0)
|
||||
{
|
||||
isFAT = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RmLog(LOG_ERROR, L"RecycleManager.dll: Unsupported filesystem");
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user