RecycleManager: Fixed update issue with XP

http://rainmeter.net/forum/viewtopic.php?f=14&t=12884
This commit is contained in:
Birunthan Mohanathas 2012-09-18 20:56:36 +03:00
parent f418c331c7
commit 9cc3e897b9

View File

@ -43,6 +43,8 @@ bool g_Thread = false;
bool g_FreeInstanceInThread = false;
CRITICAL_SECTION g_CriticalSection;
bool g_IsPlatformXP = false;
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
@ -67,6 +69,15 @@ PLUGIN_EXPORT void Initialize(void** data, void* rm)
MeasureData* measure = new MeasureData;
*data = measure;
if (g_InstanceCount == 0)
{
OSVERSIONINFOEX osvi = {sizeof(OSVERSIONINFOEX)};
GetVersionEx((OSVERSIONINFO*)&osvi);
// Not checking for osvi.dwMinorVersion >= 1 because pre-XP is not supported.
g_IsPlatformXP = (osvi.dwMajorVersion == 5);
}
++g_InstanceCount;
}
@ -209,7 +220,9 @@ bool HasRecycleBinChanged()
// Check if items have been added to recycle bin since last check.
HKEY volumeKey;
const WCHAR* subKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\BitBucket\\Volume";
const WCHAR* subKey = g_IsPlatformXP ?
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\BitBucket" :
L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\BitBucket\\Volume";
LSTATUS ls = RegOpenKeyEx(HKEY_CURRENT_USER, subKey, 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &volumeKey);
if (ls == ERROR_SUCCESS)
{