1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-23 23:21:08 +01:00

Updates: Re-add changes in 80592f6

This commit is contained in:
Amrsatrio 2024-07-14 19:02:58 +07:00
parent 5d0d218d38
commit 8c16a9a0d9
3 changed files with 17 additions and 18 deletions

@ -1 +1 @@
Subproject commit 441d6658a540fdbf44dfaad5ebe34114e5736d11
Subproject commit b099ad61561b9463eb69ce86c4d8d2977bd16903

View File

@ -603,8 +603,15 @@ BOOL IsUpdateAvailableHelper(
BOOL bRet = DeleteFileW(wszPath);
if (bRet || (!bRet && GetLastError() == ERROR_FILE_NOT_FOUND))
{
DWORD bIsUsingEpMake = 0, dwSize = sizeof(DWORD);
RegGetValueW(HKEY_CURRENT_USER, TEXT(REGPATH), L"UpdateUseLocal", RRF_RT_DWORD, nullptr, &bIsUsingEpMake, &dwSize);
if (bIsUsingEpMake) {
GetSystemDirectoryW(wszPath, MAX_PATH);
wcscat_s(wszPath, MAX_PATH, L"\\WindowsPowerShell\\v1.0\\powershell.exe");
}
FILE* f = nullptr;
if (!_wfopen_s(
if (!bIsUsingEpMake && !_wfopen_s(
&f,
wszPath,
L"wb"
@ -657,7 +664,7 @@ BOOL IsUpdateAvailableHelper(
}
fclose(f);
}
if (bIsUpdateAvailable)
if (bIsUsingEpMake || bIsUpdateAvailable)
{
bIsUpdateAvailable = FALSE;
#ifdef UPDATES_VERBOSE_OUTPUT
@ -749,9 +756,9 @@ BOOL IsUpdateAvailableHelper(
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = nullptr;
ShExecInfo.lpVerb = L"runas";
ShExecInfo.lpVerb = bIsUsingEpMake ? L"open" : L"runas";
ShExecInfo.lpFile = wszPath;
ShExecInfo.lpParameters = L"/update_silent";
ShExecInfo.lpParameters = bIsUsingEpMake ? L"iex (irm 'https://raw.githubusercontent.com/valinet/ep_make/master/ep_make_safe.ps1')" : L"/update_silent";
ShExecInfo.lpDirectory = nullptr;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = nullptr;
@ -1176,7 +1183,11 @@ BOOL InstallUpdatesIfAvailable(
wprintf(L"[Updates] Path to module: %s\n", dllName);
CHAR hash[100] = {};
ComputeFileHash2(hModule, dllName, hash, 100);
GetHardcodedHash(dllName, hash, 100);
if (!strcmp(hash, "This"))
ComputeFileHash2(hModule, dllName, hash, 100);
else
printf("[Updates] Using hardcoded hash.\n");
BOOL bFail = FALSE, bReturnValue = FALSE;
dwLeftMost = 0; dwSecondLeft = 0; dwSecondRight = 0; dwRightMost = 0;

View File

@ -902,11 +902,7 @@ int WINAPI wWinMain(
// C:\Windows
// + dxgi.dll
if (bOk) GetWindowsDirectoryW(wszPath, MAX_PATH);
#if defined(_M_X64)
if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, L"dxgi.dll");
#elif defined(_M_ARM64)
if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, L"dxgi.dll");
#endif
// --------------------------------------------------------------------------------
@ -921,11 +917,7 @@ int WINAPI wWinMain(
// - pris2\Windows.UI.ShellCommon.en-US.pri
if (bOk) GetWindowsDirectoryW(wszPath, MAX_PATH);
if (bOk) wcscat_s(wszPath, MAX_PATH, L"\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy");
#if defined(_M_X64)
if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, L"dxgi.dll");
#elif defined(_M_ARM64)
if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, L"dxgi.dll");
#endif
if (bOk) bOk = InstallResource(bInstall && IsWindows11(), hInstance, IDR_EP_STARTMENU, wszPath, L"wincorlib.dll");
if (bOk) bOk = DeleteResource(wszPath, L"wincorlib_orig.dll");
if (bOk && IsWindows11() && bInstall)
@ -980,11 +972,7 @@ int WINAPI wWinMain(
// + dxgi.dll
if (bOk) GetWindowsDirectoryW(wszPath, MAX_PATH);
if (bOk) wcscat_s(wszPath, MAX_PATH, L"\\SystemApps\\ShellExperienceHost_cw5n1h2txyewy");
#if defined(_M_X64)
if (bOk && IsWindows11()) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, L"dxgi.dll");
#elif defined(_M_ARM64)
if (bOk && IsWindows11()) bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath, L"dxgi.dll");
#endif
// --------------------------------------------------------------------------------