mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-27 17:00:59 +01:00
Setup: Reverted the method for ending explorer.exe and its subprocesses
This commit is contained in:
parent
cb3f9670d9
commit
fdc357b23f
@ -1536,42 +1536,6 @@ BOOL ExtractMonitorByIndex(HMONITOR hMonitor, HDC hDC, LPRECT lpRect, MonitorOve
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD GetProcessIdByExeName(LPCWSTR wszProcessName)
|
|
||||||
{
|
|
||||||
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
|
||||||
if (hSnap != INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
PROCESSENTRY32W pe;
|
|
||||||
pe.dwSize = sizeof(pe);
|
|
||||||
BOOL bRet = Process32FirstW(hSnap, &pe);
|
|
||||||
while (bRet)
|
|
||||||
{
|
|
||||||
if (!_wcsicmp(pe.szExeFile, wszProcessName))
|
|
||||||
{
|
|
||||||
CloseHandle(hSnap);
|
|
||||||
return pe.th32ProcessID;
|
|
||||||
}
|
|
||||||
bRet = Process32NextW(hSnap, &pe);
|
|
||||||
}
|
|
||||||
CloseHandle(hSnap);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KillProcess(LPCWSTR wszProcessName)
|
|
||||||
{
|
|
||||||
DWORD dwProcessId = GetProcessIdByExeName(wszProcessName);
|
|
||||||
if (!dwProcessId)
|
|
||||||
return;
|
|
||||||
|
|
||||||
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, dwProcessId);
|
|
||||||
if (hProcess)
|
|
||||||
{
|
|
||||||
TerminateProcess(hProcess, 1);
|
|
||||||
CloseHandle(hProcess);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
inline BOOL MaskCompare(PVOID pBuffer, LPCSTR lpPattern, LPCSTR lpMask)
|
inline BOOL MaskCompare(PVOID pBuffer, LPCSTR lpPattern, LPCSTR lpMask)
|
||||||
{
|
{
|
||||||
|
@ -670,8 +670,6 @@ typedef struct _MonitorOverrideData
|
|||||||
} MonitorOverrideData;
|
} MonitorOverrideData;
|
||||||
|
|
||||||
BOOL ExtractMonitorByIndex(HMONITOR hMonitor, HDC hDC, LPRECT lpRect, MonitorOverrideData* mod);
|
BOOL ExtractMonitorByIndex(HMONITOR hMonitor, HDC hDC, LPRECT lpRect, MonitorOverrideData* mod);
|
||||||
DWORD GetProcessIdByExeName(LPCWSTR wszProcessName);
|
|
||||||
void KillProcess(LPCWSTR wszProcessName);
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask);
|
PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask);
|
||||||
|
@ -651,11 +651,24 @@ int WINAPI wWinMain(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Sleep(100);
|
Sleep(100);
|
||||||
KillProcess(L"explorer.exe");
|
GetSystemDirectoryW(wszPath, MAX_PATH);
|
||||||
KillProcess(L"StartMenuExperienceHost.exe");
|
wcscat_s(wszPath, MAX_PATH, L"\\taskkill.exe");
|
||||||
KillProcess(L"SearchHost.exe");
|
SHELLEXECUTEINFOW sei;
|
||||||
KillProcess(L"SearchApp.exe");
|
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));
|
||||||
KillProcess(L"ShellExperienceHost.exe");
|
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(500);
|
Sleep(500);
|
||||||
|
|
||||||
@ -759,6 +772,8 @@ int WINAPI wWinMain(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sleep(1000);
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------
|
||||||
|
|
||||||
// C:\Program Files\ExplorerPatcher
|
// C:\Program Files\ExplorerPatcher
|
||||||
|
Loading…
Reference in New Issue
Block a user