Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

Commit

Permalink
Merge branch 'valinet:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
creeper-0910 authored Oct 3, 2022
2 parents f4305d5 + e4e3c61 commit 9399c7f
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 17 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

本書には、GitHub の [Releases](https://github.com/creeper-0910/ExplorerPatcher-jp/releases) に掲載されているものと同じリリースノートが含まれています。

## 22621.608.51

Tested on OS builds 22621.608 and 22000.1042.

Please make sure you are connected to the Internet while installing, the application might need to perform one-time downloads for several resources in order to enable full functionality.

#### Details

##### 1

* Fixed a bug that could prevent the Windows 10 network or battery flyouts from showing on OS build 22000.
* Fixed the Windows 10 network and battery flyouts on OS build 22621.
* Weather: Fixed a bug that displayed the widget contents with incorrect left padding.

## 22622.450.50

OSビルド22622.450でテストしています。
Expand Down
54 changes: 47 additions & 7 deletions ExplorerPatcher/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -3908,15 +3908,16 @@ HRESULT stobject_CoCreateInstanceHook(
DWORD dwVal = 0, dwSize = sizeof(DWORD);
if (IsEqualGUID(rclsid, &CLSID_ImmersiveShell) &&
IsEqualGUID(riid, &IID_IServiceProvider) &&
SHRegGetValueFromHKCUHKLMFunc && SHRegGetValueFromHKCUHKLMFunc(
SHRegGetValueFromHKCUHKLMFunc)
{
SHRegGetValueFromHKCUHKLMFunc(
TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ImmersiveShell"),
TEXT("UseWin32BatteryFlyout"),
SRRF_RT_REG_DWORD,
NULL,
&dwVal,
(LPDWORD)(&dwSize)
) == ERROR_SUCCESS)
{
);
if (!dwVal)
{
if (hCheckForegroundThread)
Expand Down Expand Up @@ -3982,15 +3983,16 @@ HRESULT pnidui_CoCreateInstanceHook(
DWORD dwVal = 0, dwSize = sizeof(DWORD);
if (IsEqualGUID(rclsid, &CLSID_ImmersiveShell) &&
IsEqualGUID(riid, &IID_IServiceProvider) &&
SHRegGetValueFromHKCUHKLMFunc && SHRegGetValueFromHKCUHKLMFunc(
SHRegGetValueFromHKCUHKLMFunc)
{
SHRegGetValueFromHKCUHKLMFunc(
TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Settings\\Network"),
TEXT("ReplaceVan"),
SRRF_RT_REG_DWORD,
NULL,
&dwVal,
(LPDWORD)(&dwSize)
) == ERROR_SUCCESS)
{
);
if (dwVal)
{
if (dwVal == 5 || dwVal == 6)
Expand Down Expand Up @@ -12051,6 +12053,40 @@ void InjectShellExperienceHost()
#endif
}

// On 22H2 builds, the Windows 10 flyouts for network and battery can be enabled
// by patching either of the following functions in ShellExperienceHost. I didn't
// see any differences when patching with any of the 3 methods, although
// `SharedUtilities::IsWindowsLite` seems to be invoked in more places, whereas `GetProductInfo`
// and `RtlGetDeviceFamilyInfoEnum` are only called in `FlightHelper::CalculateRepaintEnabled`
// and either seems to get the job done. YMMV

LSTATUS SEH_RegGetValueW(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData) {
if (!lstrcmpW(lpValue, L"UseLiteLayout")) { *(DWORD*)pvData = 1; return ERROR_SUCCESS; }
return RegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);
}

BOOL SEH_RtlGetDeviceFamilyInfoEnum(INT64 u0, PDWORD u1, INT64 u2) {
*u1 = 10;
return TRUE;
}

BOOL SEH_GetProductInfo(DWORD dwOSMajorVersion, DWORD dwOSMinorVersion, DWORD dwSpMajorVersion, DWORD dwSpMinorVersion, PDWORD pdwReturnedProductType) {
*pdwReturnedProductType = 119;
return TRUE;
}

void InjectShellExperienceHostFor22H2OrHigher() {
#ifdef _WIN64
HKEY hKey;
if (RegOpenKeyW(HKEY_CURRENT_USER, _T(SEH_REGPATH), &hKey) != ERROR_SUCCESS) return;
RegCloseKey(hKey);
HMODULE hQA = LoadLibraryW(L"Windows.UI.QuickActions.dll");
if (hQA) VnPatchIAT(hQA, "api-ms-win-core-sysinfo-l1-2-0.dll", "GetProductInfo", SEH_GetProductInfo);
//if (hQA) VnPatchIAT(hQA, "ntdll.dll", "RtlGetDeviceFamilyInfoEnum", SEH_RtlGetDeviceFamilyInfoEnum);
//if (hQA) VnPatchIAT(hQA, "api-ms-win-core-registry-l1-1-0.dll", "RegGetValueW", SEH_RegGetValueW);
#endif
}

#define DLL_INJECTION_METHOD_DXGI 0
#define DLL_INJECTION_METHOD_COM 1
#define DLL_INJECTION_METHOD_START_INJECTION 2
Expand Down Expand Up @@ -12150,7 +12186,11 @@ HRESULT EntryPoint(DWORD dwMethod)
}
else if (bIsThisShellEH)
{
if (IsWindows11())
if (IsWindows11Version22H2OrHigher())
{
InjectShellExperienceHostFor22H2OrHigher();
}
else if (IsWindows11())
{
InjectShellExperienceHost();
}
Expand Down
44 changes: 42 additions & 2 deletions ExplorerPatcher/updates.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ BOOL IsUpdateAvailableHelper(
*szRealHash = 0;
szRealHash++;
DWORD dwRemoteLeftMost = atoi(szLeftMost);
if (pLeftMost) *pLeftMost = dwRemoteLeftMost;
if (pLeftMost) *pLeftMost = dwRemoteLeftMost - ((dwRemoteLeftMost == 22622 && szRealHash[0] != '!') ? 1 : 0);
DWORD dwRemoteSecondLeft = atoi(szSecondLeft);
if (pSecondLeft) *pSecondLeft = dwRemoteSecondLeft;
DWORD dwRemoteSecondRight = atoi(szSecondRight);
Expand All @@ -240,7 +240,47 @@ BOOL IsUpdateAvailableHelper(
DWORD dwLocalSecondLeft = 0;
DWORD dwLocalSecondRight = 0;
DWORD dwLocalRightMost = 0;
QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLocalLeftMost, &dwLocalSecondLeft, &dwLocalSecondRight, &dwLocalRightMost);
BOOL bExtractedFromHash = FALSE;
CHAR hashCopy[100];
strcpy_s(hashCopy, 100, szCheckAgainst);
char* szLocalLeftMost = NULL, *szLocalSecondLeft = NULL, *szLocalSecondRight = NULL, *szLocalRightMost = NULL, *szLocalRealHash = NULL;
if (strchr(hashCopy, '.'))
{
szLocalLeftMost = hashCopy;
if (szLocalSecondLeft = strchr(szLocalLeftMost, '.'))
{
*szLocalSecondLeft = 0;
szLocalSecondLeft++;
if (szLocalSecondRight = strchr(szLocalSecondLeft, '.'))
{
*szLocalSecondRight = 0;
szLocalSecondRight++;
if (szLocalRightMost = strchr(szLocalSecondRight, '.'))
{
*szLocalRightMost = 0;
szLocalRightMost++;
if (szLocalRealHash = strchr(szLocalRightMost, '.'))
{
*szLocalRealHash = 0;
szLocalRealHash++;

bExtractedFromHash = TRUE;
dwLocalLeftMost = atoi(szLocalLeftMost);
dwLocalSecondLeft = atoi(szLocalSecondLeft);
dwLocalSecondRight = atoi(szLocalSecondRight);
dwLocalRightMost = atoi(szLocalRightMost);
#ifdef UPDATES_VERBOSE_OUTPUT
printf("[Updates] Local version obtained from hash is %d.%d.%d.%d.\n", dwLocalLeftMost, dwLocalSecondLeft, dwLocalSecondRight, dwLocalRightMost);
#endif
}
}
}
}
}
if (!bExtractedFromHash)
{
QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLocalLeftMost, &dwLocalSecondLeft, &dwLocalSecondRight, &dwLocalRightMost);
}

int res = 0;
if (!res)
Expand Down
3 changes: 2 additions & 1 deletion ExplorerPatcher/utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,12 @@ int ComputeFileHash2(HMODULE hModule, LPCWSTR filename, LPSTR hash, DWORD dwHash
DWORD dwRightMost = 0;
QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost);

sprintf_s(hash, 33, "%d.%d.%d.%d.", dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost);
sprintf_s(hash, 33, "%d.%d.%d.%d.", dwLeftMost == 22621 ? 22622 : dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost);

char real_hash[33];
ComputeFileHash(filename, real_hash, 33);
strncpy_s(hash + strlen(hash), dwHash - strlen(hash), real_hash, 32 - strlen(hash));
if (dwLeftMost == 22622) *(strchr(strchr(strchr(strchr(hash, '.') + 1, '.') + 1, '.') + 1, '.') + 1) = '!';
hash[33] = 0;

return ERROR_SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion ep_weather_host/ep_weather_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ HRESULT STDMETHODCALLTYPE _ep_Weather_ReboundBrowser(EPWeather* _this, LONG64 dw
{
DWORD dwTextScaleFactor = epw_Weather_GetTextScaleFactor(_this);
DWORD dwZoomFactor = epw_Weather_GetZoomFactor(_this);
bounds.left = 0 - MulDiv(MulDiv(MulDiv(167, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);
bounds.left = 0 - MulDiv(MulDiv(MulDiv(181, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);
bounds.top = 0 - MulDiv(MulDiv(MulDiv(178, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);
bounds.right = MulDiv(MulDiv(MulDiv((!InterlockedAdd64(&_this->dwTextDir, 0) ? 1333 : 705), dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);// 5560;
bounds.bottom = MulDiv(MulDiv(MulDiv(600, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);// 15600;
Expand Down
12 changes: 6 additions & 6 deletions version.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define VER_MAJOR 22622
#define VER_MINOR 450
#define VER_BUILD_HI 50
#define VER_BUILD_LO 3
#define VER_MAJOR 22621
#define VER_MINOR 608
#define VER_BUILD_HI 51
#define VER_BUILD_LO 1
#define VER_FLAGS VS_FF_PRERELEASE


Expand All @@ -12,5 +12,5 @@
#define VER_STR(arg) #arg

// The String form of the version numbers
#define VER_FILE_STRING VALUE "FileVersion", "22622.450.50.3"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22622.450.50.3"
#define VER_FILE_STRING VALUE "FileVersion", "22621.608.51.1"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22621.608.51.1"

0 comments on commit 9399c7f

Please sign in to comment.