Additional change to fdcf133

This commit is contained in:
Birunthan Mohanathas 2012-07-01 22:05:06 +03:00
parent 7eebaa19ce
commit 49d9b84514

View File

@ -187,6 +187,10 @@ PLUGIN_EXPORT double Update(void* data)
} }
else if (!data.directory.empty()) else if (!data.directory.empty())
{ {
// Prevent the system from displaying message box.
UINT oldMode = SetErrorMode(0);
SetErrorMode(oldMode | SEM_FAILCRITICALERRORS);
HANDLE bin = CreateFile( HANDLE bin = CreateFile(
data.directory.c_str(), data.directory.c_str(),
GENERIC_READ, GENERIC_READ,
@ -208,6 +212,8 @@ PLUGIN_EXPORT double Update(void* data)
CloseHandle(bin); CloseHandle(bin);
} }
SetErrorMode(oldMode);
} }
*pos = DRIVE_HANDLED; *pos = DRIVE_HANDLED;
@ -367,9 +373,7 @@ LPWSTR GetCurrentUserSid()
if (GetTokenInformation(hToken, TokenUser, buf, dwBufSize, &dwBufSize)) if (GetTokenInformation(hToken, TokenUser, buf, dwBufSize, &dwBufSize))
{ {
TOKEN_USER* tu = (TOKEN_USER*)buf; TOKEN_USER* tu = (TOKEN_USER*)buf;
if (ConvertSidToStringSid(tu->User.Sid, &sidStr)) ConvertSidToStringSid(tu->User.Sid, &sidStr);
{
}
} }
delete [] buf; delete [] buf;
@ -385,15 +389,9 @@ 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];
BOOL volumeResult = 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) if (!volumeResult)
{ {
return NULL; return NULL;