|
|
|
@ -438,36 +438,44 @@ int WINAPI wWinMain( |
|
|
|
CoUninitialize(); |
|
|
|
CoUninitialize(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
HANDLE hExplorerRestartThread = CreateThread(NULL, 0, BeginExplorerRestart, NULL, 0, NULL); |
|
|
|
HWND hShellTrayWnd = FindWindowW(L"Shell_TrayWnd", NULL); |
|
|
|
if (hExplorerRestartThread) |
|
|
|
if (hShellTrayWnd) |
|
|
|
{ |
|
|
|
{ |
|
|
|
WaitForSingleObject(hExplorerRestartThread, 2000); |
|
|
|
INT res = -1; |
|
|
|
CloseHandle(hExplorerRestartThread); |
|
|
|
if (!SendMessageTimeoutW(hShellTrayWnd, 1460, 0, 0, SMTO_ABORTIFHUNG, 2000, &res) && res) |
|
|
|
hExplorerRestartThread = NULL; |
|
|
|
{ |
|
|
|
} |
|
|
|
HANDLE hExplorerRestartThread = CreateThread(NULL, 0, BeginExplorerRestart, NULL, 0, NULL); |
|
|
|
else |
|
|
|
if (hExplorerRestartThread) |
|
|
|
{ |
|
|
|
{ |
|
|
|
BeginExplorerRestart(); |
|
|
|
WaitForSingleObject(hExplorerRestartThread, 2000); |
|
|
|
} |
|
|
|
CloseHandle(hExplorerRestartThread); |
|
|
|
Sleep(100); |
|
|
|
hExplorerRestartThread = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
BeginExplorerRestart(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Sleep(100); |
|
|
|
|
|
|
|
|
|
|
|
GetSystemDirectoryW(wszPath, MAX_PATH); |
|
|
|
GetSystemDirectoryW(wszPath, MAX_PATH); |
|
|
|
wcscat_s(wszPath, MAX_PATH, L"\\taskkill.exe"); |
|
|
|
wcscat_s(wszPath, MAX_PATH, L"\\taskkill.exe"); |
|
|
|
SHELLEXECUTEINFOW sei; |
|
|
|
SHELLEXECUTEINFOW sei; |
|
|
|
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW)); |
|
|
|
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW)); |
|
|
|
sei.cbSize = sizeof(sei); |
|
|
|
sei.cbSize = sizeof(sei); |
|
|
|
sei.fMask = SEE_MASK_NOCLOSEPROCESS; |
|
|
|
sei.fMask = SEE_MASK_NOCLOSEPROCESS; |
|
|
|
sei.hwnd = NULL; |
|
|
|
sei.hwnd = NULL; |
|
|
|
sei.hInstApp = NULL; |
|
|
|
sei.hInstApp = NULL; |
|
|
|
sei.lpVerb = NULL; |
|
|
|
sei.lpVerb = NULL; |
|
|
|
sei.lpFile = wszPath; |
|
|
|
sei.lpFile = wszPath; |
|
|
|
sei.lpParameters = L"/f /im explorer.exe"; |
|
|
|
sei.lpParameters = L"/f /im explorer.exe"; |
|
|
|
sei.hwnd = NULL; |
|
|
|
sei.hwnd = NULL; |
|
|
|
sei.nShow = SW_SHOWMINIMIZED; |
|
|
|
sei.nShow = SW_SHOWMINIMIZED; |
|
|
|
if (ShellExecuteExW(&sei) && sei.hProcess) |
|
|
|
if (ShellExecuteExW(&sei) && sei.hProcess) |
|
|
|
{ |
|
|
|
{ |
|
|
|
WaitForSingleObject(sei.hProcess, INFINITE); |
|
|
|
WaitForSingleObject(sei.hProcess, INFINITE); |
|
|
|
CloseHandle(sei.hProcess); |
|
|
|
CloseHandle(sei.hProcess); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
HWND hWnd = FindWindowW(L"ExplorerPatcher_GUI_" _T(EP_CLSID), NULL); |
|
|
|
HWND hWnd = FindWindowW(L"ExplorerPatcher_GUI_" _T(EP_CLSID), NULL); |
|
|
|
|