From 99efbd098f403a9f46a5861b6f38d8dfe9336b60 Mon Sep 17 00:00:00 2001 From: toneillcodes <148013535+toneillcodes@users.noreply.github.com> Date: Fri, 1 May 2026 08:56:46 -0400 Subject: [PATCH] Add GetExplorerPID to utils.cpp --- includes/utils.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/includes/utils.cpp b/includes/utils.cpp index edf9a15..1d3598d 100644 --- a/includes/utils.cpp +++ b/includes/utils.cpp @@ -75,4 +75,20 @@ int my_wcsicmp(const wchar_t* s1, const wchar_t* s2) { } while (c1 == c2); return c1 - c2; -} \ No newline at end of file +} + +// Helper to find Explorer PID +DWORD GetExplorerPID() { + HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + PROCESSENTRY32 pe = { sizeof(pe) }; + if (Process32First(hSnapshot, &pe)) { + do { + if (lstrcmpiW(pe.szExeFile, L"explorer.exe") == 0) { + CloseHandle(hSnapshot); + return pe.th32ProcessID; + } + } while (Process32Next(hSnapshot, &pe)); + } + if (hSnapshot) CloseHandle(hSnapshot); + return 0; +}