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;
|
||||
}
|
||||
|
||||
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
|
||||
inline BOOL MaskCompare(PVOID pBuffer, LPCSTR lpPattern, LPCSTR lpMask)
|
||||
{
|
||||
|
@ -670,8 +670,6 @@ typedef struct _MonitorOverrideData
|
||||
} MonitorOverrideData;
|
||||
|
||||
BOOL ExtractMonitorByIndex(HMONITOR hMonitor, HDC hDC, LPRECT lpRect, MonitorOverrideData* mod);
|
||||
DWORD GetProcessIdByExeName(LPCWSTR wszProcessName);
|
||||
void KillProcess(LPCWSTR wszProcessName);
|
||||
|
||||
#ifdef _WIN64
|
||||
PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask);
|
||||
|
@ -651,11 +651,24 @@ int WINAPI wWinMain(
|
||||
}
|
||||
}
|
||||
Sleep(100);
|
||||
KillProcess(L"explorer.exe");
|
||||
KillProcess(L"StartMenuExperienceHost.exe");
|
||||
KillProcess(L"SearchHost.exe");
|
||||
KillProcess(L"SearchApp.exe");
|
||||
KillProcess(L"ShellExperienceHost.exe");
|
||||
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(500);
|
||||
|
||||
@ -759,6 +772,8 @@ int WINAPI wWinMain(
|
||||
}
|
||||
}
|
||||
|
||||
Sleep(1000);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
// C:\Program Files\ExplorerPatcher
|
||||
|
Loading…
Reference in New Issue
Block a user