From fc25c25df966b19b4fa9c21947d389449f801ea1 Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Sat, 2 Nov 2024 08:10:21 +0700 Subject: [PATCH] Start10: Un-hardcode Program Files path --- ep_startmenu/ep_sm_main_cpp.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ep_startmenu/ep_sm_main_cpp.cpp b/ep_startmenu/ep_sm_main_cpp.cpp index 0e1447d48..bd5075f1c 100644 --- a/ep_startmenu/ep_sm_main_cpp.cpp +++ b/ep_startmenu/ep_sm_main_cpp.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -55,8 +56,13 @@ extern "C" HRESULT LoadOurShellCommonPri() ComPtr pSystemResourceManagerExtensions2; pResourceManager.As(&pSystemResourceManagerExtensions2); + WCHAR wszPath[MAX_PATH] = {}; - wcscat_s(wszPath, MAX_PATH, L"C:\\Program Files\\ExplorerPatcher\\Windows.UI.ShellCommon.pri"); + hr = SHGetFolderPathW(nullptr, CSIDL_PROGRAM_FILES, nullptr, SHGFP_TYPE_CURRENT, wszPath); + if (FAILED(hr)) + return hr; + + wcscat_s(wszPath, MAX_PATH, L"\\ExplorerPatcher\\Windows.UI.ShellCommon.pri"); hr = pSystemResourceManagerExtensions2->LoadPriFileForSystemUse(wszPath); return hr;