Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 19 additions & 20 deletions src/pyshellext/shellext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ class PyManagerOperationInProgress
class DECLSPEC_UUID(CLSID_IDLE_COMMAND) IdleCommand
: public RuntimeClass<RuntimeClassFlags<ClassicCom>, IExplorerCommand, IObjectWithSite>
{
PyManagerOperationInProgress busy;
std::vector<IdleData> idles;
std::wstring iconPath;
std::wstring title;
Expand All @@ -392,21 +391,19 @@ class DECLSPEC_UUID(CLSID_IDLE_COMMAND) IdleCommand
iconPath += L",-4";
}

if (!busy) {
hr = ReadAllIdleInstalls(idles, HKEY_LOCAL_MACHINE, L"Software\\Python", KEY_WOW64_32KEY);
if (SUCCEEDED(hr)) {
hr = ReadAllIdleInstalls(idles, HKEY_LOCAL_MACHINE, L"Software\\Python", KEY_WOW64_64KEY);
}
if (SUCCEEDED(hr)) {
hr = ReadAllIdleInstalls(idles, HKEY_CURRENT_USER, L"Software\\Python", 0);
}
hr = ReadAllIdleInstalls(idles, HKEY_LOCAL_MACHINE, L"Software\\Python", KEY_WOW64_32KEY);
if (SUCCEEDED(hr)) {
hr = ReadAllIdleInstalls(idles, HKEY_LOCAL_MACHINE, L"Software\\Python", KEY_WOW64_64KEY);
}
if (SUCCEEDED(hr)) {
hr = ReadAllIdleInstalls(idles, HKEY_CURRENT_USER, L"Software\\Python", 0);
}

if (FAILED(hr)) {
wchar_t buffer[512];
swprintf_s(buffer, L"IdleCommand error 0x%08X", (DWORD)hr);
OutputDebugStringW(buffer);
idles.clear();
}
if (FAILED(hr)) {
wchar_t buffer[512];
swprintf_s(buffer, L"IdleCommand error 0x%08X", (DWORD)hr);
OutputDebugStringW(buffer);
idles.clear();
}
}

Expand All @@ -425,12 +422,10 @@ class DECLSPEC_UUID(CLSID_IDLE_COMMAND) IdleCommand
iconPath += L",-4";
}

if (!busy) {
hr = ReadAllIdleInstalls(idles, hive, root, 0);
hr = ReadAllIdleInstalls(idles, hive, root, 0);

if (FAILED(hr)) {
idles.clear();
}
if (FAILED(hr)) {
idles.clear();
}
}
#endif
Expand Down Expand Up @@ -469,6 +464,10 @@ class DECLSPEC_UUID(CLSID_IDLE_COMMAND) IdleCommand

IFACEMETHODIMP GetState(IShellItemArray *psiItemArray, BOOL fOkToBeSlow, EXPCMDSTATE *pCmdState)
{
if (title.empty()) {
*pCmdState = ECS_HIDDEN;
return S_OK;
}
*pCmdState = idles.size() ? ECS_ENABLED : ECS_DISABLED;
return S_OK;
}
Expand Down