Browse Source

Fixes for Explorer restart and app servicing

pull/886/head
Valentin Radu 4 years ago
parent
commit
cb5975d3a7
  1. 25
      ExplorerPatcher/GUI.c
  2. 6
      ExplorerPatcher/utility.c
  3. 17
      ep_setup/ep_setup.c

25
ExplorerPatcher/GUI.c

@ -790,18 +790,25 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
{ {
BeginExplorerRestart(); BeginExplorerRestart();
} }
}
Sleep(100); Sleep(100);
//ZZRestartExplorer(0, 0, 0, 0);
GetSystemDirectoryW(wszPath, MAX_PATH); GetSystemDirectoryW(wszPath, MAX_PATH);
wcscat_s(wszPath, MAX_PATH, L"\\taskkill.exe"); wcscat_s(wszPath, MAX_PATH, L"\\taskkill.exe");
ShellExecuteW( SHELLEXECUTEINFOW sei;
NULL, ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));
L"open", sei.cbSize = sizeof(sei);
wszPath, sei.fMask = SEE_MASK_NOCLOSEPROCESS;
L"/f /im explorer.exe", sei.hwnd = NULL;
NULL, sei.hInstApp = NULL;
SW_SHOWMINIMIZED 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); GetWindowsDirectoryW(wszPath, MAX_PATH);
wcscat_s(wszPath, MAX_PATH, L"\\explorer.exe"); wcscat_s(wszPath, MAX_PATH, L"\\explorer.exe");

6
ExplorerPatcher/utility.c

@ -588,15 +588,15 @@ HRESULT ShellExecuteFromExplorer(
{ {
HRESULT hr = E_FAIL; HRESULT hr = E_FAIL;
IShellFolderViewDual* spFolderView = NULL; IShellFolderViewDual* spFolderView = NULL;
hr = GetDesktopAutomationObject(&IID_IShellFolderViewDual, &spFolderView); GetDesktopAutomationObject(&IID_IShellFolderViewDual, &spFolderView);
if (spFolderView) if (spFolderView)
{ {
IDispatch* spdispShell = NULL; IDispatch* spdispShell = NULL;
hr = spFolderView->lpVtbl->get_Application(spFolderView, &spdispShell); spFolderView->lpVtbl->get_Application(spFolderView, &spdispShell);
if (spdispShell) if (spdispShell)
{ {
IShellDispatch2* spdispShell2 = NULL; IShellDispatch2* spdispShell2 = NULL;
hr = spdispShell->lpVtbl->QueryInterface(spdispShell, &IID_IShellDispatch2, &spdispShell2); spdispShell->lpVtbl->QueryInterface(spdispShell, &IID_IShellDispatch2, &spdispShell2);
if (spdispShell2) if (spdispShell2)
{ {
BSTR a_pszFile = pszFile ? SysAllocString(pszFile): SysAllocString(L""); BSTR a_pszFile = pszFile ? SysAllocString(pszFile): SysAllocString(L"");

17
ep_setup/ep_setup.c

@ -455,8 +455,9 @@ int WINAPI wWinMain(
{ {
BeginExplorerRestart(); BeginExplorerRestart();
} }
}
}
Sleep(100); 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;
@ -475,8 +476,6 @@ int WINAPI wWinMain(
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);
if (hWnd) if (hWnd)
@ -719,9 +718,21 @@ int WINAPI wWinMain(
} }
if (!hEvent0 || !hEvent1 || FAILED(hr)) if (!hEvent0 || !hEvent1 || FAILED(hr))
{
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); StartExplorerWithDelay(1000);
} }
}
else else
{ {
SetEvent(hEvent0); SetEvent(hEvent0);

Loading…
Cancel
Save