mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-12-18 02:16:00 +01:00
All: Fixes for Windows 10
This commit is contained in:
parent
52cee9ebbb
commit
2cc9b0ed7f
@ -914,6 +914,12 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
|
|||||||
SetTextColor(hdcPaint, GetSysColor(COLOR_WINDOWTEXT));
|
SetTextColor(hdcPaint, GetSysColor(COLOR_WINDOWTEXT));
|
||||||
SetBkMode(hdcPaint, TRANSPARENT);
|
SetBkMode(hdcPaint, TRANSPARENT);
|
||||||
}
|
}
|
||||||
|
else if (!IsWindows11() && hDC)
|
||||||
|
{
|
||||||
|
COLORREF oldcr = SetBkColor(hdcPaint, g_darkModeEnabled ? RGB(0, 0, 0) : RGB(255, 255, 255));
|
||||||
|
ExtTextOutW(hdcPaint, 0, 0, ETO_OPAQUE, &rc, L"", 0, 0);
|
||||||
|
SetBkColor(hdcPaint, oldcr);
|
||||||
|
}
|
||||||
|
|
||||||
BOOL bResetLastHeading = TRUE;
|
BOOL bResetLastHeading = TRUE;
|
||||||
BOOL bWasSpecifiedSectionValid = FALSE;
|
BOOL bWasSpecifiedSectionValid = FALSE;
|
||||||
@ -939,7 +945,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
|
|||||||
if (strcmp(line, "Windows Registry Editor Version 5.00\r\n") &&
|
if (strcmp(line, "Windows Registry Editor Version 5.00\r\n") &&
|
||||||
strcmp(line, "\r\n") &&
|
strcmp(line, "\r\n") &&
|
||||||
(currentSection == -1 || currentSection == _this->section || !strncmp(line, ";T ", 3) || !strncmp(line, ";f", 2) || AuditFile) &&
|
(currentSection == -1 || currentSection == _this->section || !strncmp(line, ";T ", 3) || !strncmp(line, ";f", 2) || AuditFile) &&
|
||||||
!((!IsThemeActive() || IsHighContrast()) && !strncmp(line, ";M ", 3))
|
!((!IsThemeActive() || IsHighContrast() || !IsWindows11()) && !strncmp(line, ";M ", 3))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifndef USE_PRIVATE_INTERFACES
|
#ifndef USE_PRIVATE_INTERFACES
|
||||||
@ -2960,7 +2966,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
|
|||||||
printf("%d %d - %d %d\n", rcWin.right - rcWin.left, rcWin.bottom - rcWin.top, dwMaxWidth, dwMaxHeight);
|
printf("%d %d - %d %d\n", rcWin.right - rcWin.left, rcWin.bottom - rcWin.top, dwMaxWidth, dwMaxHeight);
|
||||||
|
|
||||||
dwMaxWidth += dwInitialLeftPad + _this->padding.left + _this->padding.right;
|
dwMaxWidth += dwInitialLeftPad + _this->padding.left + _this->padding.right;
|
||||||
if (!IsThemeActive() || IsHighContrast())
|
if (!IsThemeActive() || IsHighContrast() || !IsWindows11())
|
||||||
{
|
{
|
||||||
dwMaxHeight += GUI_LINE_HEIGHT * dy + 20 * dy;
|
dwMaxHeight += GUI_LINE_HEIGHT * dy + 20 * dy;
|
||||||
}
|
}
|
||||||
@ -2983,6 +2989,8 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
|
|||||||
SWP_NOZORDER | SWP_NOACTIVATE | (_this->bCalcExtent == 2 ? SWP_NOMOVE : 0)
|
SWP_NOZORDER | SWP_NOACTIVATE | (_this->bCalcExtent == 2 ? SWP_NOMOVE : 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (_this->bCalcExtent != 2)
|
||||||
|
{
|
||||||
DWORD dwReadSection = 0;
|
DWORD dwReadSection = 0;
|
||||||
|
|
||||||
HKEY hKey = NULL;
|
HKEY hKey = NULL;
|
||||||
@ -3043,8 +3051,13 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
|
|||||||
}
|
}
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (_this->bCalcExtent == 2)
|
||||||
|
{
|
||||||
|
_this->section = _this->last_section;
|
||||||
|
}
|
||||||
|
|
||||||
_this->bCalcExtent = FALSE;
|
_this->bCalcExtent = 0;
|
||||||
InvalidateRect(hwnd, NULL, FALSE);
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3085,7 +3098,7 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||||||
_this->dpi.x = dpiX;
|
_this->dpi.x = dpiX;
|
||||||
_this->dpi.y = dpiY;
|
_this->dpi.y = dpiY;
|
||||||
SetRect(&_this->border_thickness, 2, 2, 2, 2);
|
SetRect(&_this->border_thickness, 2, 2, 2, 2);
|
||||||
if (IsThemeActive())
|
if (IsThemeActive() && IsWindows11())
|
||||||
{
|
{
|
||||||
BOOL bIsCompositionEnabled = TRUE;
|
BOOL bIsCompositionEnabled = TRUE;
|
||||||
DwmIsCompositionEnabled(&bIsCompositionEnabled);
|
DwmIsCompositionEnabled(&bIsCompositionEnabled);
|
||||||
@ -3119,7 +3132,7 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED
|
SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED
|
||||||
);
|
);
|
||||||
SetTimer(hWnd, GUI_TIMER_READ_HELP, GUI_TIMER_READ_HELP_TIMEOUT, NULL);
|
SetTimer(hWnd, GUI_TIMER_READ_HELP, GUI_TIMER_READ_HELP_TIMEOUT, NULL);
|
||||||
if (IsThemeActive() && !IsHighContrast())
|
if (IsThemeActive() && !IsHighContrast() && IsWindows11())
|
||||||
{
|
{
|
||||||
RECT rcTitle;
|
RECT rcTitle;
|
||||||
DwmGetWindowAttribute(hWnd, DWMWA_CAPTION_BUTTON_BOUNDS, &rcTitle, sizeof(RECT));
|
DwmGetWindowAttribute(hWnd, DWMWA_CAPTION_BUTTON_BOUNDS, &rcTitle, sizeof(RECT));
|
||||||
@ -3133,9 +3146,16 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||||||
{
|
{
|
||||||
AllowDarkModeForWindow(hWnd, g_darkModeEnabled);
|
AllowDarkModeForWindow(hWnd, g_darkModeEnabled);
|
||||||
BOOL value = g_darkModeEnabled;
|
BOOL value = g_darkModeEnabled;
|
||||||
DwmSetWindowAttribute(hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(BOOL));
|
RTL_OSVERSIONINFOW rovi;
|
||||||
|
DWORD32 ubr = VnGetOSVersionAndUBR(&rovi);
|
||||||
|
int s = 0;
|
||||||
|
if (rovi.dwBuildNumber < 18985)
|
||||||
|
{
|
||||||
|
s = -1;
|
||||||
}
|
}
|
||||||
if (!IsThemeActive() || IsHighContrast())
|
DwmSetWindowAttribute(hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE + s, &value, sizeof(BOOL));
|
||||||
|
}
|
||||||
|
if (!IsThemeActive() || IsHighContrast() || !IsWindows11())
|
||||||
{
|
{
|
||||||
int extendedStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
|
int extendedStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
|
||||||
SetWindowLong(hWnd, GWL_EXSTYLE, extendedStyle | WS_EX_DLGMODALFRAME);
|
SetWindowLong(hWnd, GWL_EXSTYLE, extendedStyle | WS_EX_DLGMODALFRAME);
|
||||||
@ -3159,7 +3179,7 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||||||
{
|
{
|
||||||
if (IsColorSchemeChangeMessage(lParam))
|
if (IsColorSchemeChangeMessage(lParam))
|
||||||
{
|
{
|
||||||
if (IsThemeActive())
|
if (IsThemeActive() && IsWindows11())
|
||||||
{
|
{
|
||||||
BOOL bIsCompositionEnabled = TRUE;
|
BOOL bIsCompositionEnabled = TRUE;
|
||||||
DwmIsCompositionEnabled(&bIsCompositionEnabled);
|
DwmIsCompositionEnabled(&bIsCompositionEnabled);
|
||||||
@ -3183,12 +3203,11 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||||||
DwmExtendFrameIntoClientArea(hWnd, &marGlassInset);
|
DwmExtendFrameIntoClientArea(hWnd, &marGlassInset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_this->bCalcExtent = 2;
|
|
||||||
BOOL bIsCompositionEnabled = TRUE;
|
BOOL bIsCompositionEnabled = TRUE;
|
||||||
DwmIsCompositionEnabled(&bIsCompositionEnabled);
|
DwmIsCompositionEnabled(&bIsCompositionEnabled);
|
||||||
if (bIsCompositionEnabled)
|
if (bIsCompositionEnabled)
|
||||||
{
|
{
|
||||||
BOOL value = (IsThemeActive() && !IsHighContrast()) ? 1 : 0;
|
BOOL value = (IsThemeActive() && !IsHighContrast() && IsWindows11()) ? 1 : 0;
|
||||||
DwmSetWindowAttribute(hWnd, DWMWA_MICA_EFFFECT, &value, sizeof(BOOL));
|
DwmSetWindowAttribute(hWnd, DWMWA_MICA_EFFFECT, &value, sizeof(BOOL));
|
||||||
}
|
}
|
||||||
if (IsThemeActive() && ShouldAppsUseDarkMode && !IsHighContrast())
|
if (IsThemeActive() && ShouldAppsUseDarkMode && !IsHighContrast())
|
||||||
@ -3200,12 +3219,25 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||||||
g_darkModeEnabled = bDarkModeEnabled;
|
g_darkModeEnabled = bDarkModeEnabled;
|
||||||
AllowDarkModeForWindow(hWnd, g_darkModeEnabled);
|
AllowDarkModeForWindow(hWnd, g_darkModeEnabled);
|
||||||
BOOL value = g_darkModeEnabled;
|
BOOL value = g_darkModeEnabled;
|
||||||
DwmSetWindowAttribute(hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(BOOL));
|
RTL_OSVERSIONINFOW rovi;
|
||||||
|
DWORD32 ubr = VnGetOSVersionAndUBR(&rovi);
|
||||||
|
int s = 0;
|
||||||
|
if (rovi.dwBuildNumber < 18985)
|
||||||
|
{
|
||||||
|
s = -1;
|
||||||
|
}
|
||||||
|
DwmSetWindowAttribute(hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE + s, &value, sizeof(BOOL));
|
||||||
|
_this->bCalcExtent = 2;
|
||||||
|
_this->last_section = _this->section;
|
||||||
|
_this->section = 0;
|
||||||
InvalidateRect(hWnd, NULL, FALSE);
|
InvalidateRect(hWnd, NULL, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
_this->bCalcExtent = 2;
|
||||||
|
_this->last_section = _this->section;
|
||||||
|
_this->section = 0;
|
||||||
InvalidateRect(hWnd, NULL, FALSE);
|
InvalidateRect(hWnd, NULL, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3316,7 +3348,7 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (uMsg == WM_NCMOUSELEAVE && IsThemeActive() && !IsHighContrast())
|
else if (uMsg == WM_NCMOUSELEAVE && IsThemeActive() && !IsHighContrast() && IsWindows11())
|
||||||
{
|
{
|
||||||
LRESULT lRes = 0;
|
LRESULT lRes = 0;
|
||||||
if (DwmDefWindowProc(hWnd, uMsg, wParam, lParam, &lRes))
|
if (DwmDefWindowProc(hWnd, uMsg, wParam, lParam, &lRes))
|
||||||
@ -3324,7 +3356,7 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||||||
return lRes;
|
return lRes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (uMsg == WM_NCRBUTTONUP && IsThemeActive() && !IsHighContrast())
|
else if (uMsg == WM_NCRBUTTONUP && IsThemeActive() && !IsHighContrast() && IsWindows11())
|
||||||
{
|
{
|
||||||
HMENU pSysMenu = GetSystemMenu(hWnd, FALSE);
|
HMENU pSysMenu = GetSystemMenu(hWnd, FALSE);
|
||||||
if (pSysMenu != NULL)
|
if (pSysMenu != NULL)
|
||||||
@ -3342,7 +3374,7 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ((uMsg == WM_LBUTTONUP || uMsg == WM_RBUTTONUP) && IsThemeActive() && !IsHighContrast())
|
else if ((uMsg == WM_LBUTTONUP || uMsg == WM_RBUTTONUP) && IsThemeActive() && !IsHighContrast() && IsWindows11())
|
||||||
{
|
{
|
||||||
POINT pt;
|
POINT pt;
|
||||||
pt.x = GET_X_LPARAM(lParam);
|
pt.x = GET_X_LPARAM(lParam);
|
||||||
@ -3398,7 +3430,7 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (uMsg == WM_NCHITTEST && IsThemeActive() && !IsHighContrast())
|
else if (uMsg == WM_NCHITTEST && IsThemeActive() && !IsHighContrast() && IsWindows11())
|
||||||
{
|
{
|
||||||
LRESULT lRes = 0;
|
LRESULT lRes = 0;
|
||||||
if (DwmDefWindowProc(hWnd, uMsg, wParam, lParam, &lRes))
|
if (DwmDefWindowProc(hWnd, uMsg, wParam, lParam, &lRes))
|
||||||
@ -3425,7 +3457,7 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||||||
return HTCAPTION;
|
return HTCAPTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (uMsg == WM_NCCALCSIZE && wParam == TRUE && IsThemeActive() && !IsHighContrast())
|
else if (uMsg == WM_NCCALCSIZE && wParam == TRUE && IsThemeActive() && !IsHighContrast() && IsWindows11())
|
||||||
{
|
{
|
||||||
NCCALCSIZE_PARAMS* sz = (NCCALCSIZE_PARAMS*)(lParam);
|
NCCALCSIZE_PARAMS* sz = (NCCALCSIZE_PARAMS*)(lParam);
|
||||||
sz->rgrc[0].left += _this->border_thickness.left;
|
sz->rgrc[0].left += _this->border_thickness.left;
|
||||||
@ -3769,7 +3801,7 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsThemeActive() && !IsHighContrast())
|
if (IsThemeActive() && !IsHighContrast() && IsWindows11())
|
||||||
{
|
{
|
||||||
if (bIsCompositionEnabled)
|
if (bIsCompositionEnabled)
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,7 @@ typedef struct _GUI
|
|||||||
WCHAR sectionNames[20][20];
|
WCHAR sectionNames[20][20];
|
||||||
BOOL bRebuildIfTabOrderIsEmpty;
|
BOOL bRebuildIfTabOrderIsEmpty;
|
||||||
int dwPageLocation;
|
int dwPageLocation;
|
||||||
|
DWORD last_section;
|
||||||
} GUI;
|
} GUI;
|
||||||
|
|
||||||
static HRESULT GUI_AboutProc(
|
static HRESULT GUI_AboutProc(
|
||||||
|
@ -4234,7 +4234,8 @@ __int64 __fastcall PeopleBand_DrawTextWithGlowHook(
|
|||||||
COLORREF rgbColor = RGB(0, 0, 0);
|
COLORREF rgbColor = RGB(0, 0, 0);
|
||||||
if (bIsThemeActive)
|
if (bIsThemeActive)
|
||||||
{
|
{
|
||||||
if (ShouldSystemUseDarkMode && ShouldSystemUseDarkMode())
|
RTL_OSVERSIONINFOW rovi;
|
||||||
|
if ((VnGetOSVersion(&rovi) && rovi.dwBuildNumber < 18985) || (ShouldSystemUseDarkMode && ShouldSystemUseDarkMode()))
|
||||||
{
|
{
|
||||||
rgbColor = RGB(255, 255, 255);
|
rgbColor = RGB(255, 255, 255);
|
||||||
}
|
}
|
||||||
@ -4660,20 +4661,31 @@ BOOL explorer_SetChildWindowNoActivateHook(HWND hWnd)
|
|||||||
uintptr_t Instance = *(uintptr_t*)GetWindowLongPtrW(hWnd, 0);
|
uintptr_t Instance = *(uintptr_t*)GetWindowLongPtrW(hWnd, 0);
|
||||||
if (Instance)
|
if (Instance)
|
||||||
{
|
{
|
||||||
uintptr_t off_TrayButton_GetComponentName = 0;
|
uintptr_t TrayButton_GetComponentName = *(INT_PTR(WINAPI**)())(Instance + 304); // 280 in versions of Windows 10 where this method exists
|
||||||
if (IsWindows11())
|
wchar_t* wszComponentName = NULL;
|
||||||
|
if (IsWindows11() && !IsBadCodePtr(TrayButton_GetComponentName))
|
||||||
{
|
{
|
||||||
off_TrayButton_GetComponentName = 304;
|
wszComponentName = (const WCHAR*)(*(uintptr_t(**)(void))(Instance + 304))();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
off_TrayButton_GetComponentName = 280;
|
WCHAR title[MAX_PATH];
|
||||||
}
|
GetWindowTextW(hWnd, title, MAX_PATH);
|
||||||
uintptr_t TrayButton_GetComponentName = *(INT_PTR(WINAPI**)())(Instance + off_TrayButton_GetComponentName);
|
WCHAR pbtitle[MAX_PATH];
|
||||||
if (!IsBadCodePtr(TrayButton_GetComponentName))
|
HMODULE hPeopleBand = LoadLibraryExW(L"PeopleBand.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
|
||||||
|
if (hPeopleBand)
|
||||||
{
|
{
|
||||||
wchar_t* wszComponentName = (const WCHAR*)(*(uintptr_t(**)(void))(Instance + off_TrayButton_GetComponentName))();
|
LoadStringW(hPeopleBand, 256, pbtitle, 260);
|
||||||
if (!wcscmp(wszComponentName, L"CortanaButton") && IsWindows11())
|
FreeLibrary(hPeopleBand);
|
||||||
|
}
|
||||||
|
if (!wcscmp(pbtitle, title))
|
||||||
|
{
|
||||||
|
wszComponentName = L"PeopleButton";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (wszComponentName)
|
||||||
|
{
|
||||||
|
if (!wcscmp(wszComponentName, L"CortanaButton"))
|
||||||
{
|
{
|
||||||
DWORD dwOldProtect;
|
DWORD dwOldProtect;
|
||||||
VirtualProtect(Instance + 160, sizeof(uintptr_t), PAGE_READWRITE, &dwOldProtect);
|
VirtualProtect(Instance + 160, sizeof(uintptr_t), PAGE_READWRITE, &dwOldProtect);
|
||||||
@ -4685,7 +4697,7 @@ BOOL explorer_SetChildWindowNoActivateHook(HWND hWnd)
|
|||||||
*(uintptr_t*)(Instance + 216) = Widgets_GetTooltipTextHook; // OnTooltipShow
|
*(uintptr_t*)(Instance + 216) = Widgets_GetTooltipTextHook; // OnTooltipShow
|
||||||
VirtualProtect(Instance + 216, sizeof(uintptr_t), dwOldProtect, &dwOldProtect);
|
VirtualProtect(Instance + 216, sizeof(uintptr_t), dwOldProtect, &dwOldProtect);
|
||||||
}
|
}
|
||||||
else if (!wcscmp(wszComponentName, L"MultitaskingButton") && IsWindows11())
|
else if (!wcscmp(wszComponentName, L"MultitaskingButton"))
|
||||||
{
|
{
|
||||||
DWORD dwOldProtect;
|
DWORD dwOldProtect;
|
||||||
VirtualProtect(Instance + 160, sizeof(uintptr_t), PAGE_READWRITE, &dwOldProtect);
|
VirtualProtect(Instance + 160, sizeof(uintptr_t), PAGE_READWRITE, &dwOldProtect);
|
||||||
@ -7831,6 +7843,8 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall)
|
|||||||
//Sleep(150);
|
//Sleep(150);
|
||||||
|
|
||||||
HMODULE hShlwapi = LoadLibraryW(L"Shlwapi.dll");
|
HMODULE hShlwapi = LoadLibraryW(L"Shlwapi.dll");
|
||||||
|
if (hShlwapi)
|
||||||
|
{
|
||||||
if (bInstall)
|
if (bInstall)
|
||||||
{
|
{
|
||||||
SHRegGetValueFromHKCUHKLMFunc = GetProcAddress(hShlwapi, "SHRegGetValueFromHKCUHKLM");
|
SHRegGetValueFromHKCUHKLMFunc = GetProcAddress(hShlwapi, "SHRegGetValueFromHKCUHKLM");
|
||||||
@ -7840,8 +7854,11 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall)
|
|||||||
FreeLibrary(hShlwapi);
|
FreeLibrary(hShlwapi);
|
||||||
FreeLibrary(hShlwapi);
|
FreeLibrary(hShlwapi);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HANDLE hShell32 = LoadLibraryW(L"shell32.dll");
|
HANDLE hShell32 = LoadLibraryW(L"shell32.dll");
|
||||||
|
if (hShell32)
|
||||||
|
{
|
||||||
if (bInstall)
|
if (bInstall)
|
||||||
{
|
{
|
||||||
VnPatchIAT(hShell32, "user32.dll", "TrackPopupMenu", TrackPopupMenuHook);
|
VnPatchIAT(hShell32, "user32.dll", "TrackPopupMenu", TrackPopupMenuHook);
|
||||||
@ -7866,8 +7883,11 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall)
|
|||||||
FreeLibrary(hShell32);
|
FreeLibrary(hShell32);
|
||||||
FreeLibrary(hShell32);
|
FreeLibrary(hShell32);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HANDLE hShcore = LoadLibraryW(L"shcore.dll");
|
HANDLE hShcore = LoadLibraryW(L"shcore.dll");
|
||||||
|
if (hShcore)
|
||||||
|
{
|
||||||
if (bInstall)
|
if (bInstall)
|
||||||
{
|
{
|
||||||
explorerframe_SHCreateWorkerWindowFunc = GetProcAddress(hShcore, (LPCSTR)188);
|
explorerframe_SHCreateWorkerWindowFunc = GetProcAddress(hShcore, (LPCSTR)188);
|
||||||
@ -7877,8 +7897,11 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall)
|
|||||||
FreeLibrary(hShcore);
|
FreeLibrary(hShcore);
|
||||||
FreeLibrary(hShcore);
|
FreeLibrary(hShcore);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HANDLE hExplorerFrame = LoadLibraryW(L"ExplorerFrame.dll");
|
HANDLE hExplorerFrame = LoadLibraryW(L"ExplorerFrame.dll");
|
||||||
|
if (hExplorerFrame)
|
||||||
|
{
|
||||||
if (bInstall)
|
if (bInstall)
|
||||||
{
|
{
|
||||||
VnPatchIAT(hExplorerFrame, "user32.dll", "TrackPopupMenu", TrackPopupMenuHook);
|
VnPatchIAT(hExplorerFrame, "user32.dll", "TrackPopupMenu", TrackPopupMenuHook);
|
||||||
@ -7907,9 +7930,12 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall)
|
|||||||
FreeLibrary(hExplorerFrame);
|
FreeLibrary(hExplorerFrame);
|
||||||
FreeLibrary(hExplorerFrame);
|
FreeLibrary(hExplorerFrame);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HANDLE hWindowsUIFileExplorer = LoadLibraryW(L"Windows.UI.FileExplorer.dll");
|
HANDLE hWindowsUIFileExplorer = LoadLibraryW(L"Windows.UI.FileExplorer.dll");
|
||||||
if (hWindowsUIFileExplorer)
|
if (hWindowsUIFileExplorer)
|
||||||
|
{
|
||||||
|
if (bInstall)
|
||||||
{
|
{
|
||||||
VnPatchDelayIAT(hWindowsUIFileExplorer, "user32.dll", "TrackPopupMenu", TrackPopupMenuHook);
|
VnPatchDelayIAT(hWindowsUIFileExplorer, "user32.dll", "TrackPopupMenu", TrackPopupMenuHook);
|
||||||
VnPatchDelayIAT(hWindowsUIFileExplorer, "user32.dll", "SystemParametersInfoW", DisableImmersiveMenus_SystemParametersInfoW);
|
VnPatchDelayIAT(hWindowsUIFileExplorer, "user32.dll", "SystemParametersInfoW", DisableImmersiveMenus_SystemParametersInfoW);
|
||||||
@ -7934,6 +7960,7 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall)
|
|||||||
FreeLibrary(hWindowsUIFileExplorer);
|
FreeLibrary(hWindowsUIFileExplorer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
INT64(*twinui_pcshell_IsUndockedAssetAvailableFunc)(INT a1, INT64 a2, INT64 a3, const char* a4);
|
INT64(*twinui_pcshell_IsUndockedAssetAvailableFunc)(INT a1, INT64 a2, INT64 a3, const char* a4);
|
||||||
INT64 twinui_pcshell_IsUndockedAssetAvailableHook(INT a1, INT64 a2, INT64 a3, const char* a4)
|
INT64 twinui_pcshell_IsUndockedAssetAvailableHook(INT a1, INT64 a2, INT64 a3, const char* a4)
|
||||||
|
@ -185,10 +185,9 @@
|
|||||||
"SwitcherIsPerApplication"=dword:00000000
|
"SwitcherIsPerApplication"=dword:00000000
|
||||||
;b %PLACEHOLDER_0001%
|
;b %PLACEHOLDER_0001%
|
||||||
"NoPerApplicationList"=dword:00000000
|
"NoPerApplicationList"=dword:00000000
|
||||||
;c 3 Theme
|
;c 2 Theme
|
||||||
;x 0 Default
|
;x 0 Default
|
||||||
;x 1 Acrylic
|
;x 1 Acrylic
|
||||||
;x 2 Mica (always opaque)
|
|
||||||
"Theme"=dword:00000000
|
"Theme"=dword:00000000
|
||||||
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MultitaskingView\AltTabViewHost]
|
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MultitaskingView\AltTabViewHost]
|
||||||
;c 19 Opacity
|
;c 19 Opacity
|
||||||
|
@ -567,8 +567,7 @@ LRESULT CALLBACK PleaseWait_HookProc(int code, WPARAM wParam, LPARAM lParam);
|
|||||||
inline BOOL IsWindows11()
|
inline BOOL IsWindows11()
|
||||||
{
|
{
|
||||||
RTL_OSVERSIONINFOW rovi;
|
RTL_OSVERSIONINFOW rovi;
|
||||||
DWORD32 ubr = VnGetOSVersionAndUBR(&rovi);
|
if (VnGetOSVersion(&rovi) && rovi.dwBuildNumber >= 21996)
|
||||||
if (rovi.dwBuildNumber >= 21996)
|
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -805,7 +805,7 @@ int WINAPI wWinMain(
|
|||||||
{
|
{
|
||||||
bOk = GetWindowsDirectoryW(wszPath, MAX_PATH);
|
bOk = GetWindowsDirectoryW(wszPath, MAX_PATH);
|
||||||
}
|
}
|
||||||
if (bOk)
|
if (bOk && IsWindows11())
|
||||||
{
|
{
|
||||||
wcscat_s(wszPath, MAX_PATH, L"\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\dxgi.dll");
|
wcscat_s(wszPath, MAX_PATH, L"\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\dxgi.dll");
|
||||||
bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath);
|
bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath);
|
||||||
@ -814,7 +814,7 @@ int WINAPI wWinMain(
|
|||||||
{
|
{
|
||||||
bOk = GetWindowsDirectoryW(wszPath, MAX_PATH);
|
bOk = GetWindowsDirectoryW(wszPath, MAX_PATH);
|
||||||
}
|
}
|
||||||
if (bOk)
|
if (bOk && IsWindows11())
|
||||||
{
|
{
|
||||||
wcscat_s(wszPath, MAX_PATH, L"\\SystemApps\\ShellExperienceHost_cw5n1h2txyewy\\dxgi.dll");
|
wcscat_s(wszPath, MAX_PATH, L"\\SystemApps\\ShellExperienceHost_cw5n1h2txyewy\\dxgi.dll");
|
||||||
bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath);
|
bOk = InstallResource(bInstall, hInstance, IDR_EP_AMD64, wszPath);
|
||||||
|
@ -846,10 +846,24 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
|
|||||||
marGlassInset.cyBottomHeight = 0;
|
marGlassInset.cyBottomHeight = 0;
|
||||||
marGlassInset.cyTopHeight = 0;
|
marGlassInset.cyTopHeight = 0;
|
||||||
}
|
}
|
||||||
|
LONG64 dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);
|
||||||
|
if (IsWindows11())
|
||||||
|
{
|
||||||
DwmExtendFrameIntoClientArea(_this->hWnd, &marGlassInset);
|
DwmExtendFrameIntoClientArea(_this->hWnd, &marGlassInset);
|
||||||
BOOL value = (IsThemeActive() && !IsHighContrast()) ? 1 : 0;
|
BOOL value = (IsThemeActive() && !IsHighContrast()) ? 1 : 0;
|
||||||
DwmSetWindowAttribute(hWnd, 1029, &value, sizeof(BOOL));
|
DwmSetWindowAttribute(_this->hWnd, 1029, &value, sizeof(BOOL));
|
||||||
LONG64 dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RTL_OSVERSIONINFOW rovi;
|
||||||
|
DWORD32 ubr = GetOSVersionAndUBR(&rovi);
|
||||||
|
int s = 0;
|
||||||
|
if (rovi.dwBuildNumber < 18985)
|
||||||
|
{
|
||||||
|
s = -1;
|
||||||
|
}
|
||||||
|
DwmSetWindowAttribute(_this->hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE + s, &dwDarkMode, sizeof(LONG64));
|
||||||
|
}
|
||||||
if (!dwDarkMode)
|
if (!dwDarkMode)
|
||||||
{
|
{
|
||||||
epw_Weather_SetDarkMode(_this, dwDarkMode, TRUE);
|
epw_Weather_SetDarkMode(_this, dwDarkMode, TRUE);
|
||||||
@ -865,7 +879,22 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
|
|||||||
SetWindowPos(_this->hWnd, NULL, rc->left, rc->top, w, rc->bottom - rc->top, 0);
|
SetWindowPos(_this->hWnd, NULL, rc->left, rc->top, w, rc->bottom - rc->top, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else if (uMsg == WM_PAINT && !IsWindows11())
|
||||||
|
{
|
||||||
|
PAINTSTRUCT ps;
|
||||||
|
HDC hdc = BeginPaint(hWnd, &ps);
|
||||||
|
if (ps.fErase)
|
||||||
|
{
|
||||||
|
LONG64 bEnabled, dwDarkMode;
|
||||||
|
dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);
|
||||||
|
epw_Weather_IsDarkMode(_this, dwDarkMode, &bEnabled);
|
||||||
|
COLORREF oldcr = SetBkColor(hdc, bEnabled ? RGB(0, 0, 0) : RGB(255, 255, 255));
|
||||||
|
ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &ps.rcPaint, L"", 0, 0);
|
||||||
|
SetBkColor(hdc, oldcr);
|
||||||
|
}
|
||||||
|
EndPaint(hWnd, &ps);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
/*BOOL bIsRunningWithoutVisualStyle = !IsThemeActive() || IsHighContrast();
|
/*BOOL bIsRunningWithoutVisualStyle = !IsThemeActive() || IsHighContrast();
|
||||||
if (uMsg == WM_CREATE)
|
if (uMsg == WM_CREATE)
|
||||||
{
|
{
|
||||||
@ -939,7 +968,8 @@ HRESULT STDMETHODCALLTYPE epw_Weather_IsDarkMode(EPWeather* _this, LONG64 dwDark
|
|||||||
DwmIsCompositionEnabled(&bIsCompositionEnabled);
|
DwmIsCompositionEnabled(&bIsCompositionEnabled);
|
||||||
if (!dwDarkMode)
|
if (!dwDarkMode)
|
||||||
{
|
{
|
||||||
*bEnabled = bIsCompositionEnabled && (ShouldSystemUseDarkMode ? ShouldSystemUseDarkMode() : FALSE) && !IsHighContrast();
|
RTL_OSVERSIONINFOW rovi;
|
||||||
|
*bEnabled = bIsCompositionEnabled && ((GetOSVersion(&rovi) && rovi.dwBuildNumber < 18985) ? TRUE : (ShouldSystemUseDarkMode ? ShouldSystemUseDarkMode() : FALSE)) && !IsHighContrast();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -959,7 +989,14 @@ HRESULT STDMETHODCALLTYPE epw_Weather_SetDarkMode(EPWeather* _this, LONG64 dwDar
|
|||||||
if (_this->hWnd)
|
if (_this->hWnd)
|
||||||
{
|
{
|
||||||
AllowDarkModeForWindow(_this->hWnd, bEnabled);
|
AllowDarkModeForWindow(_this->hWnd, bEnabled);
|
||||||
DwmSetWindowAttribute(_this->hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &bEnabled, sizeof(BOOL));
|
RTL_OSVERSIONINFOW rovi;
|
||||||
|
DWORD32 ubr = GetOSVersionAndUBR(&rovi);
|
||||||
|
int s = 0;
|
||||||
|
if (rovi.dwBuildNumber < 18985)
|
||||||
|
{
|
||||||
|
s = -1;
|
||||||
|
}
|
||||||
|
DwmSetWindowAttribute(_this->hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE + s, &bEnabled, sizeof(BOOL));
|
||||||
//InvalidateRect(_this->hWnd, NULL, FALSE);
|
//InvalidateRect(_this->hWnd, NULL, FALSE);
|
||||||
PostMessageW(_this->hWnd, EP_WEATHER_WM_SET_BROWSER_THEME, bEnabled, bRefresh);
|
PostMessageW(_this->hWnd, EP_WEATHER_WM_SET_BROWSER_THEME, bEnabled, bRefresh);
|
||||||
}
|
}
|
||||||
@ -1016,7 +1053,7 @@ DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
|
|||||||
wc.style = CS_DBLCLKS;
|
wc.style = CS_DBLCLKS;
|
||||||
wc.lpfnWndProc = epw_Weather_WindowProc;
|
wc.lpfnWndProc = epw_Weather_WindowProc;
|
||||||
wc.hInstance = epw_hModule;
|
wc.hInstance = epw_hModule;
|
||||||
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
wc.hbrBackground = IsWindows11() ? (HBRUSH)GetStockObject(BLACK_BRUSH) : NULL;
|
||||||
wc.lpszClassName = _T(EPW_WEATHER_CLASSNAME);
|
wc.lpszClassName = _T(EPW_WEATHER_CLASSNAME);
|
||||||
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
|
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
|
||||||
if (!RegisterClassW(&wc))
|
if (!RegisterClassW(&wc))
|
||||||
@ -1051,6 +1088,9 @@ DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LONG64 dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);
|
||||||
|
if (IsWindows11())
|
||||||
|
{
|
||||||
if (!IsHighContrast())
|
if (!IsHighContrast())
|
||||||
{
|
{
|
||||||
MARGINS marGlassInset = { -1, -1, -1, -1 }; // -1 means the whole window
|
MARGINS marGlassInset = { -1, -1, -1, -1 }; // -1 means the whole window
|
||||||
@ -1058,7 +1098,18 @@ DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
|
|||||||
BOOL value = 1;
|
BOOL value = 1;
|
||||||
DwmSetWindowAttribute(_this->hWnd, 1029, &value, sizeof(BOOL));
|
DwmSetWindowAttribute(_this->hWnd, 1029, &value, sizeof(BOOL));
|
||||||
}
|
}
|
||||||
LONG64 dwDarkMode = InterlockedAdd64(&_this->g_darkModeEnabled, 0);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RTL_OSVERSIONINFOW rovi;
|
||||||
|
DWORD32 ubr = GetOSVersionAndUBR(&rovi);
|
||||||
|
int s = 0;
|
||||||
|
if (rovi.dwBuildNumber < 18985)
|
||||||
|
{
|
||||||
|
s = -1;
|
||||||
|
}
|
||||||
|
DwmSetWindowAttribute(_this->hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE + s, &dwDarkMode, sizeof(LONG64));
|
||||||
|
}
|
||||||
epw_Weather_SetDarkMode(_this, dwDarkMode, FALSE);
|
epw_Weather_SetDarkMode(_this, dwDarkMode, FALSE);
|
||||||
|
|
||||||
InterlockedExchange64(&_this->bBrowserBusy, TRUE);
|
InterlockedExchange64(&_this->bBrowserBusy, TRUE);
|
||||||
|
@ -60,4 +60,86 @@ inline void QueryVersionInfo(HMODULE hModule, WORD Resource, DWORD* dwLeftMost,
|
|||||||
|
|
||||||
LocalFree(pResCopy);
|
LocalFree(pResCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define OSVERSION_INVALID 0xffffffff
|
||||||
|
|
||||||
|
typedef LONG NTSTATUS, * PNTSTATUS;
|
||||||
|
#define STATUS_SUCCESS (0x00000000)
|
||||||
|
|
||||||
|
typedef NTSTATUS(WINAPI* VnRtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
|
||||||
|
|
||||||
|
// https://stackoverflow.com/questions/36543301/detecting-windows-10-version/36543774#36543774
|
||||||
|
inline BOOL GetOSVersion(PRTL_OSVERSIONINFOW lpRovi)
|
||||||
|
{
|
||||||
|
HMODULE hMod = GetModuleHandleW(L"ntdll.dll");
|
||||||
|
if (hMod != NULL)
|
||||||
|
{
|
||||||
|
VnRtlGetVersionPtr fxPtr = (VnRtlGetVersionPtr)GetProcAddress(
|
||||||
|
hMod,
|
||||||
|
"RtlGetVersion"
|
||||||
|
);
|
||||||
|
if (fxPtr != NULL)
|
||||||
|
{
|
||||||
|
lpRovi->dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOW);
|
||||||
|
if (STATUS_SUCCESS == fxPtr(lpRovi))
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://stackoverflow.com/questions/47926094/detecting-windows-10-os-build-minor-version
|
||||||
|
inline DWORD32 GetUBR()
|
||||||
|
{
|
||||||
|
DWORD32 ubr = 0, ubr_size = sizeof(DWORD32);
|
||||||
|
HKEY hKey;
|
||||||
|
LONG lRes = RegOpenKeyExW(
|
||||||
|
HKEY_LOCAL_MACHINE,
|
||||||
|
wcschr(
|
||||||
|
wcschr(
|
||||||
|
wcschr(
|
||||||
|
UNIFIEDBUILDREVISION_KEY,
|
||||||
|
'\\'
|
||||||
|
) + 1,
|
||||||
|
'\\'
|
||||||
|
) + 1,
|
||||||
|
'\\'
|
||||||
|
) + 1,
|
||||||
|
0,
|
||||||
|
KEY_READ,
|
||||||
|
&hKey
|
||||||
|
);
|
||||||
|
if (lRes == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
RegQueryValueExW(
|
||||||
|
hKey,
|
||||||
|
UNIFIEDBUILDREVISION_VALUE,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
&ubr,
|
||||||
|
&ubr_size
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline DWORD32 GetOSVersionAndUBR(PRTL_OSVERSIONINFOW lpRovi)
|
||||||
|
{
|
||||||
|
if (!GetOSVersion(lpRovi))
|
||||||
|
{
|
||||||
|
return OSVERSION_INVALID;
|
||||||
|
}
|
||||||
|
return GetUBR();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline BOOL IsWindows11()
|
||||||
|
{
|
||||||
|
RTL_OSVERSIONINFOW rovi;
|
||||||
|
if (GetOSVersion(&rovi) && rovi.dwBuildNumber >= 21996)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
2
libs/sws
2
libs/sws
@ -1 +1 @@
|
|||||||
Subproject commit 6fdceae19a8f4339cd59618b3bbd35dac574ac34
|
Subproject commit 1778125faba51fa23b500efd2f0404c87b701e23
|
Loading…
Reference in New Issue
Block a user