RecycleManager.dll: Fixed disk error message in some cases

This commit is contained in:
Birunthan Mohanathas 2012-07-01 13:24:18 +03:00
parent ff5fde4479
commit fdcf133d86

View File

@ -300,6 +300,8 @@ PLUGIN_EXPORT void ExecuteBang(void* data, LPCWSTR args)
DWORD WINAPI QueryRecycleBinThreadProc(void* pParam) DWORD WINAPI QueryRecycleBinThreadProc(void* pParam)
{ {
// NOTE: Do not use CRT function (since thread was created by CreateThread())!
SHQUERYRBINFO rbi = {0}; SHQUERYRBINFO rbi = {0};
rbi.cbSize = sizeof(SHQUERYRBINFO); rbi.cbSize = sizeof(SHQUERYRBINFO);
SHQueryRecycleBin(NULL, &rbi); SHQueryRecycleBin(NULL, &rbi);
@ -383,8 +385,16 @@ CRawString GetRecycleBinDirectory(WCHAR drive, bool& isFAT)
WCHAR search[] = L"\0:\\"; WCHAR search[] = L"\0:\\";
search[0] = drive; search[0] = drive;
// Prevent the system from displaying message box.
UINT oldMode = SetErrorMode(0);
SetErrorMode(oldMode | SEM_FAILCRITICALERRORS);
WCHAR filesystem[16]; WCHAR filesystem[16];
if (!GetVolumeInformation(search, NULL, 0, NULL, NULL, NULL, filesystem, _countof(filesystem))) BOOL volumeResult = GetVolumeInformation(search, NULL, 0, NULL, NULL, NULL, filesystem, _countof(filesystem)));
SetErrorMode(oldMode);
if (!volumeResult)
{ {
return NULL; return NULL;
} }