1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-14 11:07:36 +01:00

Start10: Un-hardcode Program Files path

This commit is contained in:
Amrsatrio 2024-11-02 08:10:21 +07:00
parent cc9b6b3fd0
commit fc25c25df9

View File

@ -1,4 +1,5 @@
#include <Windows.h>
#include <ShlObj_core.h>
#include <windows.foundation.h>
#include <windows.applicationmodel.resources.core.h>
@ -55,8 +56,13 @@ extern "C" HRESULT LoadOurShellCommonPri()
ComPtr<ABI::Windows::ApplicationModel::Resources::Core::Internal::ISystemResourceManagerExtensions2> 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;