| 5856 | } |
| 5857 | |
| 5858 | bool WindowsSystem::QueryRecycleBin() |
| 5859 | { |
| 5860 | OleInitialize(NULL); |
| 5861 | CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); |
| 5862 | |
| 5863 | if (winOS->GetSystemPath(DesktopDirectory) == native(scnManager->getWorkingDirectory())) |
| 5864 | { |
| 5865 | HKEY recycleBinKey; |
| 5866 | TCHAR defaultIconPath[MAX_PATH]; |
| 5867 | TCHAR fullIconPath[MAX_PATH]; |
| 5868 | DWORD dwType = REG_SZ; |
| 5869 | DWORD dwSize = MAX_PATH; |
| 5870 | |
| 5871 | LONG returnStatus = RegOpenKeyEx(HKEY_CURRENT_USER, QT_NT(L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\{645FF040-5081-101B-9F08-00AA002F954E}\\DefaultIcon"), 0, KEY_QUERY_VALUE, &recycleBinKey); |
| 5872 | |
| 5873 | if (returnStatus != ERROR_SUCCESS) |
| 5874 | return false; |
| 5875 | |
| 5876 | while (_recyclerThread) |
| 5877 | { |
| 5878 | _recyclerThread->markAsSafeToJoin(false); |
| 5879 | |
| 5880 | returnStatus = RegQueryValueEx(recycleBinKey, NULL, NULL, &dwType, (LPBYTE) &defaultIconPath, &dwSize) == ERROR_SUCCESS && |
| 5881 | RegQueryValueEx(recycleBinKey, QT_NT(L"full"), NULL, &dwType, (LPBYTE) &fullIconPath, &dwSize) == ERROR_SUCCESS; |
| 5882 | |
| 5883 | if (_memberMutex.tryLock() && returnStatus) |
| 5884 | { |
| 5885 | bool isRecycleBinFull = _isRecycleBinFull; |
| 5886 | if (_tcscmp(defaultIconPath, fullIconPath) == 0) |
| 5887 | _isRecycleBinFull = true; |
| 5888 | else |
| 5889 | _isRecycleBinFull = false; |
| 5890 | |
| 5891 | _recycleBinStateChanged = (_isRecycleBinFull != isRecycleBinFull) ? true : false; |
| 5892 | _memberMutex.unlock(); |
| 5893 | } |
| 5894 | |
| 5895 | _recyclerThread->markAsSafeToJoin(true); |
| 5896 | Sleep(5000); |
| 5897 | } |
| 5898 | RegCloseKey(recycleBinKey); |
| 5899 | } |
| 5900 | |
| 5901 | CoUninitialize(); |
| 5902 | OleUninitialize(); |
| 5903 | |
| 5904 | return true; |
| 5905 | } |
| 5906 | |
| 5907 | void WindowsSystem::onPowerResume() |
| 5908 | { |
nothing calls this directly
no test coverage detected