diff --git a/ExplorerPatcher/GUI.c b/ExplorerPatcher/GUI.c index 7254128..76b1f8b 100644 --- a/ExplorerPatcher/GUI.c +++ b/ExplorerPatcher/GUI.c @@ -790,18 +790,25 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) { BeginExplorerRestart(); } - Sleep(100); - //ZZRestartExplorer(0, 0, 0, 0); - GetSystemDirectoryW(wszPath, MAX_PATH); - wcscat_s(wszPath, MAX_PATH, L"\\taskkill.exe"); - ShellExecuteW( - NULL, - L"open", - wszPath, - L"/f /im explorer.exe", - NULL, - SW_SHOWMINIMIZED - ); + } + Sleep(100); + GetSystemDirectoryW(wszPath, MAX_PATH); + wcscat_s(wszPath, MAX_PATH, L"\\taskkill.exe"); + SHELLEXECUTEINFOW sei; + ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW)); + sei.cbSize = sizeof(sei); + sei.fMask = SEE_MASK_NOCLOSEPROCESS; + sei.hwnd = NULL; + sei.hInstApp = NULL; + sei.lpVerb = NULL; + sei.lpFile = wszPath; + sei.lpParameters = L"/f /im explorer.exe"; + sei.hwnd = NULL; + sei.nShow = SW_SHOWMINIMIZED; + if (ShellExecuteExW(&sei) && sei.hProcess) + { + WaitForSingleObject(sei.hProcess, INFINITE); + CloseHandle(sei.hProcess); } GetWindowsDirectoryW(wszPath, MAX_PATH); wcscat_s(wszPath, MAX_PATH, L"\\explorer.exe"); diff --git a/ExplorerPatcher/utility.c b/ExplorerPatcher/utility.c index 0101b66..88e6c22 100644 --- a/ExplorerPatcher/utility.c +++ b/ExplorerPatcher/utility.c @@ -588,15 +588,15 @@ HRESULT ShellExecuteFromExplorer( { HRESULT hr = E_FAIL; IShellFolderViewDual* spFolderView = NULL; - hr = GetDesktopAutomationObject(&IID_IShellFolderViewDual, &spFolderView); + GetDesktopAutomationObject(&IID_IShellFolderViewDual, &spFolderView); if (spFolderView) { IDispatch* spdispShell = NULL; - hr = spFolderView->lpVtbl->get_Application(spFolderView, &spdispShell); + spFolderView->lpVtbl->get_Application(spFolderView, &spdispShell); if (spdispShell) { IShellDispatch2* spdispShell2 = NULL; - hr = spdispShell->lpVtbl->QueryInterface(spdispShell, &IID_IShellDispatch2, &spdispShell2); + spdispShell->lpVtbl->QueryInterface(spdispShell, &IID_IShellDispatch2, &spdispShell2); if (spdispShell2) { BSTR a_pszFile = pszFile ? SysAllocString(pszFile): SysAllocString(L""); diff --git a/ep_setup/ep_setup.c b/ep_setup/ep_setup.c index f7cfb61..09972e0 100644 --- a/ep_setup/ep_setup.c +++ b/ep_setup/ep_setup.c @@ -455,28 +455,27 @@ int WINAPI wWinMain( { BeginExplorerRestart(); } - Sleep(100); - - GetSystemDirectoryW(wszPath, MAX_PATH); - wcscat_s(wszPath, MAX_PATH, L"\\taskkill.exe"); - SHELLEXECUTEINFOW sei; - ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW)); - sei.cbSize = sizeof(sei); - sei.fMask = SEE_MASK_NOCLOSEPROCESS; - sei.hwnd = NULL; - sei.hInstApp = NULL; - sei.lpVerb = NULL; - sei.lpFile = wszPath; - sei.lpParameters = L"/f /im explorer.exe"; - sei.hwnd = NULL; - sei.nShow = SW_SHOWMINIMIZED; - if (ShellExecuteExW(&sei) && sei.hProcess) - { - WaitForSingleObject(sei.hProcess, INFINITE); - CloseHandle(sei.hProcess); - } } } + Sleep(100); + GetSystemDirectoryW(wszPath, MAX_PATH); + wcscat_s(wszPath, MAX_PATH, L"\\taskkill.exe"); + SHELLEXECUTEINFOW sei; + ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW)); + sei.cbSize = sizeof(sei); + sei.fMask = SEE_MASK_NOCLOSEPROCESS; + sei.hwnd = NULL; + sei.hInstApp = NULL; + sei.lpVerb = NULL; + sei.lpFile = wszPath; + sei.lpParameters = L"/f /im explorer.exe"; + sei.hwnd = NULL; + sei.nShow = SW_SHOWMINIMIZED; + if (ShellExecuteExW(&sei) && sei.hProcess) + { + WaitForSingleObject(sei.hProcess, INFINITE); + CloseHandle(sei.hProcess); + } HWND hWnd = FindWindowW(L"ExplorerPatcher_GUI_" _T(EP_CLSID), NULL); if (hWnd) @@ -720,7 +719,19 @@ int WINAPI wWinMain( if (!hEvent0 || !hEvent1 || FAILED(hr)) { - StartExplorerWithDelay(1000); + if (!hShellTrayWnd) + { + MessageBoxW( + NULL, + L"" _T(PRODUCT_NAME) L" has been installed successfully. Start Explorer to have it load up.", + _T(PRODUCT_NAME), + MB_ICONINFORMATION | MB_OK | MB_DEFBUTTON1 + ); + } + else + { + StartExplorerWithDelay(1000); + } } else {