diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index 1b0f0268e..3ec237ad9 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -4089,7 +4089,7 @@ HRESULT stobject_CoCreateInstanceHook( LPVOID* ppv ) { - if (global_rovi.dwBuildNumber >= 25000 && IsEqualGUID(rclsid, &CLSID_NetworkTraySSO)) + if (global_rovi.dwBuildNumber >= 25000 && IsEqualGUID(rclsid, &CLSID_NetworkTraySSO) && bOldTaskbar) { wchar_t szPath[MAX_PATH]; ZeroMemory(szPath, sizeof(szPath)); @@ -10209,9 +10209,12 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall) #ifdef _WIN64 MODULEINFO mi; GetModuleInformation(GetCurrentProcess(), hExplorerFrame, &mi, sizeof(MODULEINFO)); - if (global_rovi.dwBuildNumber >= 19041 && bShrinkExplorerAddressBar) + if (bShrinkExplorerAddressBar) { - PatchAddressBarSizing(&mi); + if ((global_rovi.dwBuildNumber >= 19041 && global_rovi.dwBuildNumber <= 19045 && global_ubr < 3754) || IsWindows11()) + { + PatchAddressBarSizing(&mi); + } } #endif VnPatchIAT(hExplorerFrame, "api-ms-win-core-com-l1-1-0.dll", "CoCreateInstance", ExplorerFrame_CoCreateInstanceHook); @@ -11872,20 +11875,17 @@ void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS) return; } - explorer_TrayUI_CreateInstanceFunc = GetProcAddress(hMyTaskbar, "EP_TrayUI_CreateInstance"); - typedef DWORD (*GetVersion_t)(); GetVersion_t GetVersion = (GetVersion_t)GetProcAddress(hMyTaskbar, "GetVersion"); - if (GetVersion) + DWORD version = GetVersion ? GetVersion() : 0; + if (version != 1) { - DWORD version = GetVersion(); - if (version != 1) - { - wprintf(L"[TB] Version mismatch: %d\n", version); - return; - } + wprintf(L"[TB] '%s' with version %d is not compatible\n", pszTaskbarDll, version); + return; } + explorer_TrayUI_CreateInstanceFunc = GetProcAddress(hMyTaskbar, "EP_TrayUI_CreateInstance"); + typedef void (*CopyExplorerSymbols_t)(symbols_addr* symbols); CopyExplorerSymbols_t CopyExplorerSymbols = (CopyExplorerSymbols_t)GetProcAddress(hMyTaskbar, "CopyExplorerSymbols"); if (CopyExplorerSymbols) @@ -12698,7 +12698,7 @@ DWORD Inject(BOOL bIsExplorer) VnPatchIAT(hStobject, "user32.dll", "TrackPopupMenu", stobject_TrackPopupMenuHook); VnPatchIAT(hStobject, "user32.dll", "TrackPopupMenuEx", stobject_TrackPopupMenuExHook); } - if (global_rovi.dwBuildNumber >= 25000) + if (global_rovi.dwBuildNumber >= 25000 && bOldTaskbar) { PatchStobject(hStobject); } @@ -14511,16 +14511,91 @@ BOOL SEH_GetProductInfo(DWORD dwOSMajorVersion, DWORD dwOSMinorVersion, DWORD dw 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); + if (!IsWindows11Version22H2Build1413OrHigher()) + { + HKEY hKey; + if (RegOpenKeyW(HKEY_CURRENT_USER, _T(SEH_REGPATH), &hKey) == ERROR_SUCCESS) + { + 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 } +HRESULT SHRegGetBOOLWithREGSAM(HKEY key, LPCWSTR subKey, LPCWSTR value, REGSAM regSam, BOOL* data) +{ + DWORD dwType = REG_NONE; + DWORD dwData; + DWORD cbData = 4; + LSTATUS lRes = RegGetValueW( + key, + subKey, + value, + ((regSam & 0x100) << 8) | RRF_RT_REG_DWORD | RRF_RT_REG_SZ | RRF_NOEXPAND, + &dwType, + &dwData, + &cbData + ); + if (lRes != ERROR_SUCCESS) + { + if (lRes == ERROR_MORE_DATA) + return HRESULT_FROM_WIN32(ERROR_INVALID_DATA); + if (lRes > 0) + return HRESULT_FROM_WIN32(lRes); + return lRes; + } + + if (dwType == REG_DWORD) + { + if (dwData > 1) + return HRESULT_FROM_WIN32(ERROR_INVALID_DATA); + *data = dwData == 1; + } + else + { + if (cbData != 4 || (WCHAR)dwData != L'0' && (WCHAR)dwData != L'1') + return HRESULT_FROM_WIN32(ERROR_INVALID_DATA); + *data = (WCHAR)dwData == L'1'; + } + + return S_OK; +} + +bool IsUserOOBE() +{ + BOOL b = FALSE; + SHRegGetBOOLWithREGSAM( + HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\OOBE", + L"LaunchUserOOBE", + 0, + &b + ); + return b; +} + +bool IsCredentialReset() +{ + BOOL b = FALSE; + SHRegGetBOOLWithREGSAM( + HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Authentication\\CFL\\ExperienceManagerData", + L"LaunchCflScenario", + 0, + &b + ); + return b; +} + +bool IsUserOOBEOrCredentialReset() +{ + return IsUserOOBE() || IsCredentialReset(); +} + #define DLL_INJECTION_METHOD_DXGI 0 #define DLL_INJECTION_METHOD_COM 1 #define DLL_INJECTION_METHOD_START_INJECTION 2 @@ -14608,6 +14683,12 @@ HRESULT EntryPoint(DWORD dwMethod) bIsExplorerProcess = bIsThisExplorer; if (bIsThisExplorer) { + if (IsUserOOBEOrCredentialReset()) + { + IncrementDLLReferenceCount(hModule); + bInstanced = TRUE; + return E_NOINTERFACE; + } BOOL desktopExists = IsDesktopWindowAlreadyPresent(); #ifdef _WIN64 if (!desktopExists && CrashCounterHandleEntryPoint()) diff --git a/README.md b/README.md index c13851c8c..be8d737f1 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ That's it. It's that simple. ## Uninstalling +* Right click the taskbar then click "Properties" or search for "ExplorerPatcher", and go to "Uninstall" section or * Use "Programs and Features" in Control Panel, or "Apps and features" in the Settings app or * Run `ep_setup.exe /uninstall` or * Rename `ep_setup.exe` to `ep_uninstall.exe` and run that. @@ -25,6 +26,6 @@ That's it. It's that simple. ## Donate -If you find this project essential to your daily life, please consider donating to support the development through the [Sponsor](#sponsor-button) button at the top of this page, so that we can continue to keep supporting newer Windows builds. +If you find this project essential to your daily life, please consider donating to support the development through the [Sponsor](?sponsor) button at the top of this page, so that we can continue to keep supporting newer Windows builds. [Read more](https://github.com/valinet/ExplorerPatcher/wiki) diff --git a/ep_gui/GUI.c b/ep_gui/GUI.c index 93991cf56..da3b075ee 100644 --- a/ep_gui/GUI.c +++ b/ep_gui/GUI.c @@ -974,7 +974,7 @@ static void GUI_UpdateLanguages() DWORD GUI_GetTaskbarStyle() { - DWORD dwRes = IsWindows11() ? 0 : 1; + DWORD dwRes = 1; DWORD dwSize = sizeof(DWORD); RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L"OldTaskbar", RRF_RT_DWORD, NULL, &dwRes, &dwSize); if (dwRes >= 2 && !DoesTaskbarDllExist())