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) @@ -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
);
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");

6
ExplorerPatcher/utility.c

@ -588,15 +588,15 @@ HRESULT ShellExecuteFromExplorer( @@ -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"");

17
ep_setup/ep_setup.c

@ -455,8 +455,9 @@ int WINAPI wWinMain( @@ -455,8 +455,9 @@ int WINAPI wWinMain(
{
BeginExplorerRestart();
}
}
}
Sleep(100);
GetSystemDirectoryW(wszPath, MAX_PATH);
wcscat_s(wszPath, MAX_PATH, L"\\taskkill.exe");
SHELLEXECUTEINFOW sei;
@ -475,8 +476,6 @@ int WINAPI wWinMain( @@ -475,8 +476,6 @@ int WINAPI wWinMain(
WaitForSingleObject(sei.hProcess, INFINITE);
CloseHandle(sei.hProcess);
}
}
}
HWND hWnd = FindWindowW(L"ExplorerPatcher_GUI_" _T(EP_CLSID), NULL);
if (hWnd)
@ -719,9 +718,21 @@ int WINAPI wWinMain( @@ -719,9 +718,21 @@ int WINAPI wWinMain(
}
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);
}
}
else
{
SetEvent(hEvent0);

Loading…
Cancel
Save