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

Updated to v31

This commit is contained in:
Valentin Radu 2021-10-21 09:01:59 +03:00
parent 87f5ea4772
commit bf07fad687
17 changed files with 2912 additions and 835 deletions

View File

@ -2,7 +2,41 @@
This document includes the same release notes as in the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section on GitHub.
## 22000.258.30.3
## 22000.258.31.0
Tested on build: 22000.258.
#### New features
* Cortana button now opens the Widgets panel
* Ability to choose what happens when clicking the Network icon in the system tray
* Possibility to use the legacy clock flyout
* Possibility to use the legacy volume flyout
* Fixes to fully support the classic theme, with a functional taskbar, system tray, Explorer windows, working context menus; read more about this feature [here](https://github.com/valinet/ExplorerPatcher/discussions/101)
#### Feature enhancements
* Reorganized settings in the GUI
* Added option not to have an accelerator for the `Properties` menu entry in `Win`+`X` (#162)
#### Fixes
* Fixed an issue where the Windows 10 window switcher failed to display some windows (#161)
* Fixed an issue that prevented Start from opening again until Explorer was restarted after opening File Explorer via the Start menu Explorer icon (#145)
* Fixed patching in libvalinet
* Fixed GUI launch path; GUI now launches in an external process, survives Explorer restarts
#### Experimental
The application can now be registered as a shell extension. This will enable the Explorer related functionality to work in Open/Save file dialogs as well. This is especially useful for users wanting proper support of the classic theme in Windows 11.
Please note that this is experimental. For the moment, the preferred installation method remains dropping the DLL in `C:\Windows`. For interested users, I invite you to test this functionality and report your findings in the discussions board.
To enable this, put the 2 DLLs (`ExplorerPatcher.amd64.dll` and `ExplorerPatcher.IA-32.dll`) in a secure folder (for example, `C:\Program Files\ExplorerPatcher`). Then, in that folder, run this command: `regsvr32 ExplorerPatcher.amd64.dll`. After elevation, a message will display informing you of the operation outcome, and if it went well, Explorer will restart displaying the old taskbar.
To uninstall, run `regsvr32 /u ExplorerPatcher.amd64.dll` in the same folder and preferably reboot the computer to unload the DLLs from all applications. Then, the files can be deleted just fine.
## 22000.258.30.6
Tested on build: 22000.258.

View File

@ -51,8 +51,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 22000,258,30,6
PRODUCTVERSION 22000,258,30,6
FILEVERSION 22000,258,31,0
PRODUCTVERSION 22000,258,31,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -69,12 +69,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "VALINET Solutions SRL"
VALUE "FileDescription", "ExplorerPatcher"
VALUE "FileVersion", "22000.258.30.6"
VALUE "FileVersion", "22000.258.31.0"
VALUE "InternalName", "ExplorerPatcher.dll"
VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved."
VALUE "OriginalFilename", "ExplorerPatcher.dll"
VALUE "ProductName", "ExplorerPatcher"
VALUE "ProductVersion", "22000.258.30.6"
VALUE "ProductVersion", "22000.258.31.0"
END
END
BLOCK "VarFileInfo"
@ -106,6 +106,15 @@ BEGIN
IDS_VISITGITHUB "Visit project Github"
IDS_VISITWEBSITE "Visit web site"
IDS_LICENSEINFO "E-mail author"
IDS_INSTALL_SUCCESS_TEXT "Installation succeeded."
IDS_INSTALL_ERROR_TEXT "Installation failed."
IDS_UNINSTALL_SUCCESS_TEXT "Uninstallation succeeded."
END
STRINGTABLE
BEGIN
IDS_UNINSTALL_ERROR_TEXT "Uninstallation failed."
IDS_OPERATION_NONE "No action has been taken."
END
#endif // English (United States) resources

View File

@ -4,8 +4,6 @@ void* GUI_FileMapping = NULL;
DWORD GUI_FileSize = 0;
BOOL g_darkModeEnabled = FALSE;
static void(*RefreshImmersiveColorPolicyState)() = NULL;
static int(*SetPreferredAppMode)(int bAllowDark) = NULL;
static BOOL(*AllowDarkModeForWindow)(HWND hWnd, BOOL bAllowDark) = NULL;
static BOOL(*ShouldAppsUseDarkMode)() = NULL;
BOOL IsHighContrast()
{
@ -21,7 +19,6 @@ BOOL IsColorSchemeChangeMessage(LPARAM lParam)
BOOL is = FALSE;
if (lParam && CompareStringOrdinal(lParam, -1, L"ImmersiveColorSet", -1, TRUE) == CSTR_EQUAL)
{
RefreshImmersiveColorPolicyState();
is = TRUE;
}
return is;
@ -143,7 +140,8 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
logFont.lfHeight = GUI_CAPTION_FONT_SIZE * dy;
logFont.lfWeight = FW_BOLD;
HFONT hFontCaption = CreateFontIndirect(&logFont);
logFont.lfHeight = GUI_TITLE_FONT_SIZE * dy;
logFont = ncm.lfMenuFont;
if (IsThemeActive()) logFont.lfHeight = GUI_TITLE_FONT_SIZE * dy;
HFONT hFontTitle = CreateFontIndirect(&logFont);
logFont.lfWeight = FW_REGULAR;
logFont.lfUnderline = 1;
@ -152,7 +150,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
logFont.lfUnderline = 0;
HFONT hFontRegular = CreateFontIndirect(&logFont);
logFont.lfWeight = FW_DEMIBOLD;
logFont.lfHeight = GUI_SECTION_FONT_SIZE * dy;
if (IsThemeActive()) logFont.lfHeight = GUI_SECTION_FONT_SIZE * dy;
HFONT hFontSection = CreateFontIndirect(&logFont);
logFont.lfUnderline = 1;
HFONT hFontSectionSel = CreateFontIndirect(&logFont);
@ -184,10 +182,11 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
if (!IsThemeActive() && hDC)
{
COLORREF oldcr = SetBkColor(hdcPaint, GetSysColor(COLOR_WINDOW));
COLORREF oldcr = SetBkColor(hdcPaint, GetSysColor(COLOR_MENU));
ExtTextOutW(hdcPaint, 0, 0, ETO_OPAQUE, &rc, L"", 0, 0);
SetBkColor(hdcPaint, oldcr);
SetTextColor(hdcPaint, GetSysColor(COLOR_WINDOWTEXT));
SetBkMode(hdcPaint, TRANSPARENT);
}
FILE* f = fmemopen(pRscr, cbRscr, "r");
@ -433,7 +432,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
bTabOrderHit = TRUE;
if (!IsThemeActive())
{
cr = SetTextColor(hdcPaint, GetSysColor(COLOR_HIGHLIGHT));
cr = SetTextColor(hdcPaint, GetSysColor(COLOR_HIGHLIGHTTEXT));
}
else
{
@ -1255,6 +1254,7 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
{
if (IsThemeActive() && ShouldAppsUseDarkMode)
{
RefreshImmersiveColorPolicyState();
BOOL bIsCompositionEnabled = TRUE;
DwmIsCompositionEnabled(&bIsCompositionEnabled);
BOOL bDarkModeEnabled = IsThemeActive() && bIsCompositionEnabled && ShouldAppsUseDarkMode() && !IsHighContrast();
@ -1486,14 +1486,14 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
wszPath,
(MAX_PATH) * sizeof(wchar_t)
);
GetWindowsDirectoryW(
GetSystemDirectoryW(
wszPath,
MAX_PATH
);
wcscat_s(
wszPath,
MAX_PATH,
L"\\explorer.exe"
L"\\shell32.dll"
);
WNDCLASS wc = { 0 };
@ -1504,18 +1504,32 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
wc.hInstance = hModule;
wc.lpszClassName = L"ExplorerPatcherGUI";
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
HMODULE hExplorer = LoadLibraryExW(wszPath, NULL, LOAD_LIBRARY_AS_DATAFILE);
if (hExplorer)
HMODULE hShell32 = LoadLibraryExW(wszPath, NULL, LOAD_LIBRARY_AS_DATAFILE);
if (hShell32)
{
_this.hIcon = LoadIconW(hExplorer, L"ICO_MYCOMPUTER");
_this.hIcon = LoadIconW(hShell32, MAKEINTRESOURCEW(40));
wc.hIcon = _this.hIcon;
}
RegisterClassW(&wc);
TCHAR title[260];
HMODULE hExplorerFrame = LoadLibraryExW(L"ExplorerFrame.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
LoadStringW(hExplorerFrame, 726, title, 260);
LoadStringW(hExplorerFrame, 50222, title, 260); // 726 = File Explorer
FreeLibrary(hExplorerFrame);
wchar_t* p = wcschr(title, L'(');
if (p)
{
p--;
if (p == L' ')
{
*p = 0;
}
else
{
p++;
*p = 0;
}
}
if (title[0] == 0)
{
LoadStringW(hModule, IDS_PRODUCTNAME, title, 260);
@ -1587,10 +1601,10 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
DispatchMessage(&msg);
}
if (hExplorer)
if (hShell32)
{
CloseHandle(_this.hIcon);
FreeLibrary(hExplorer);
FreeLibrary(hShell32);
}
if (bHasLoadedUxtheme && hUxtheme)

View File

@ -94,7 +94,7 @@ VOID HideExplorerSearchBar(HWND hWnd)
);
}
LRESULT HideExplorerSearchBarSubClass(
LRESULT CALLBACK HideExplorerSearchBarSubClass(
HWND hWnd,
UINT uMsg,
WPARAM wParam,

View File

@ -13,7 +13,7 @@ HWND FindChildWindow(
// https://github.com/Open-Shell/Open-Shell-Menu/blob/master/Src/ClassicExplorer/ExplorerBHO.cpp
VOID HideExplorerSearchBar(HWND hWnd);
LRESULT HideExplorerSearchBarSubClass(
LRESULT CALLBACK HideExplorerSearchBarSubClass(
HWND hWnd,
UINT uMsg,
WPARAM wParam,

View File

@ -1,10 +1,12 @@
#include "SettingsMonitor.h"
DWORD MonitorSettings(SettingsChangeParameters* params)
DWORD WINAPI MonitorSettings(SettingsChangeParameters* params)
{
BOOL bShouldExit = FALSE;
while (TRUE)
{
HANDLE* handles = malloc(sizeof(HANDLE) * params->size);
HANDLE* handles = malloc(sizeof(HANDLE) * (params->size + 1));
if (!handles)
{
return 0;
@ -42,8 +44,9 @@ DWORD MonitorSettings(SettingsChangeParameters* params)
return 0;
}
}
handles[params->size] = params->hExitEvent;
DWORD dwRes = WaitForMultipleObjects(
params->size,
params->size + (params->hExitEvent ? 1 : 0),
handles,
FALSE,
INFINITE
@ -51,7 +54,14 @@ DWORD MonitorSettings(SettingsChangeParameters* params)
if (dwRes != WAIT_FAILED)
{
unsigned int i = dwRes - WAIT_OBJECT_0;
params->settings[i].callback(params->settings[i].data);
if (i >= 0 && i < params->size)
{
params->settings[i].callback(params->settings[i].data);
}
else if (i == params->size)
{
bShouldExit = TRUE;
}
}
free(handles);
for (unsigned int i = 0; i < params->size; ++i)
@ -59,6 +69,10 @@ DWORD MonitorSettings(SettingsChangeParameters* params)
CloseHandle(params->settings[i].hEvent);
RegCloseKey(params->settings[i].hKey);
}
if (bShouldExit)
{
break;
}
}
}

View File

@ -10,13 +10,14 @@ typedef struct _Setting
wchar_t name[MAX_PATH];
HKEY hKey;
HANDLE hEvent;
void(*callback)(void*);
void(__stdcall *callback)(void*);
void* data;
} Setting;
typedef struct _SettingsChangeParameters
{
Setting* settings;
DWORD size;
HANDLE hExitEvent;
} SettingsChangeParameters;
DWORD MonitorSettings(SettingsChangeParameters*);
DWORD WINAPI MonitorSettings(SettingsChangeParameters*);
#endif

View File

@ -117,7 +117,7 @@ finish:
DWORD OpenStartOnCurentMonitorThread(OpenStartOnCurentMonitorThreadParams* unused)
{
HANDLE hEvent = CreateEvent(0, 0, 0, L"ShellDesktopSwitchEvent");
HANDLE hEvent = CreateEventW(0, 0, 0, L"ShellDesktopSwitchEvent");
if (!hEvent)
{
printf("Failed to start \"Open Start on current monitor\" thread.\n");
@ -128,12 +128,21 @@ DWORD OpenStartOnCurentMonitorThread(OpenStartOnCurentMonitorThreadParams* unuse
INFINITE
);
printf("Started \"Open Start on current monitor\" thread.\n");
HWND g_ProgWin = FindWindowEx(
NULL,
NULL,
L"Progman",
NULL
);
HWND g_ProgWin = NULL;
while (!g_ProgWin)
{
g_ProgWin = FindWindowEx(
NULL,
NULL,
L"Progman",
NULL
);
if (!g_ProgWin)
{
Sleep(100);
}
}
printf("Progman: %d\n", g_ProgWin);
DWORD progThread = GetWindowThreadProcessId(
g_ProgWin,
NULL
@ -144,6 +153,7 @@ DWORD OpenStartOnCurentMonitorThread(OpenStartOnCurentMonitorThreadParams* unuse
NULL,
progThread
);
printf("Progman hook: %d\n", g_ProgHook);
MSG msg = { 0 };
while (GetMessage(&msg, NULL, 0, 0))
{
@ -318,6 +328,78 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params)
Sleep(params->dwTimeout);
continue;
}
if (WaitForSingleObject(hThread, INFINITE) != WAIT_OBJECT_0)
{
printf("Unable to determine LoadLibrary outcome.\n");
Sleep(params->dwTimeout);
continue;
}
CloseHandle(hThread);
DWORD cbNeeded = 0;
EnumProcessModules(
hProcess,
NULL,
0,
&cbNeeded
);
if (!cbNeeded)
{
printf("Unable to determine number of modules in process.\n");
Sleep(params->dwTimeout);
continue;
}
HMODULE* hMods = malloc(cbNeeded);
if (!hMods)
{
printf("Out of memory.\n");
Sleep(params->dwTimeout);
continue;
}
if (!EnumProcessModulesEx(
hProcess,
hMods,
cbNeeded,
&cbNeeded,
LIST_MODULES_ALL
))
{
printf("Unable to enumerate modules of process.\n");
Sleep(params->dwTimeout);
continue;
}
for (unsigned int i = 0; i < (cbNeeded / sizeof(HMODULE)); ++i)
{
TCHAR szModName[MAX_PATH];
if (GetModuleFileNameExW(hProcess, hMods[i], szModName,
sizeof(szModName) / sizeof(TCHAR)))
{
if (!wcscmp(szModName, params->wszModulePath))
{
printf("Found module in process memory space.\n");
HANDLE hTh = CreateRemoteThread(
hProcess,
NULL,
0,
(uintptr_t)(hMods[i]) + ((uintptr_t)params->proc - (uintptr_t)params->hModule),
0,
0,
NULL
);
if (hTh)
{
printf("Waiting for remote initialization.\n");
WaitForSingleObject(hTh, INFINITE);
DWORD dwExitCode = 0;
GetExitCodeThread(hTh, &dwExitCode);
printf("Initialization exited with code 0x%x.\n", dwExitCode);
CloseHandle(hTh);
printf("HOOKED START MENU\n");
}
break;
}
}
}
free(hMods);
WaitForSingleObject(
hProcess,
INFINITE

View File

@ -6,6 +6,8 @@
#include <Shlwapi.h>
#pragma comment(lib, "Shlwapi.lib")
#include <TlHelp32.h>
#include <Psapi.h>
#pragma comment(lib, "Psapi.lib")
extern DWORD bMonitorOverride;
extern DWORD bOpenAtLogon;
@ -228,6 +230,7 @@ typedef struct _HookStartMenuParams
HMODULE hModule;
DWORD dwTimeout;
wchar_t wszModulePath[MAX_PATH];
FARPROC proc;
} HookStartMenuParams;
DWORD WINAPI HookStartMenu(HookStartMenuParams* params);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,5 @@
#ifndef _H_HOOKING_H_
#define _H_HOOKING_H_
#ifndef _M_AMD64
#ifndef _M_ARM64
#error This application only supports the amd64 or ARM64 architectures. Compilation aborted.
#endif
#endif
#define STRAT_REPLACE_ANY_TYPE_OF_JUMP_WITH_NOP 0
#define STRAT_REPLACE_ANY_TYPE_OF_JUMP_WITH_ALWAYS_JUMP 1
#define HOOK_WITH_FUNCHOOK 0

View File

@ -10,12 +10,17 @@
#define IDS_VISITGITHUB 106
#define IDS_VISITWEBSITE 107
#define IDS_LICENSEINFO 108
#define IDS_INSTALL_SUCCESS_TEXT 109
#define IDS_INSTALL_ERROR_TEXT 110
#define IDS_UNINSTALL_SUCCESS_TEXT 111
#define IDS_UNINSTALL_ERROR_TEXT 112
#define IDS_OPERATION_NONE 113
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_RESOURCE_VALUE 111
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101

View File

@ -6,7 +6,7 @@
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;b Enable Windows 10 taskbar *
"OldTaskbar"=dword:00000001
;t The following settings only apply to the Windows 10 taskbar:
;t The following settings only apply to the Windows 10 taskbar:
;l Enable missing system tray icons
;shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}\SystemIcons
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
@ -24,20 +24,28 @@
;x 1 Small
;x 0 Large (default)
"TaskbarSmallIcons"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;a Choosing 'Open Network && Internet settings' when right clicking the system tray
;c 3 network icon should open:
;x 0 Network section in the Settings app (default)
;x 1 Network and Sharing Center in Control Panel
;x 2 Network Connections in Control Panel
"ReplaceNetwork"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search]
;b Show Search button
"SearchboxTaskbarMode"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
;b Show Widgets button
"TaskbarDa"=dword:00000000
;b Show Task view button
"ShowTaskViewButton"=dword:00000000
;b Show seconds in the system tray clock
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People]
;b Show People on the taskbar *
"TaskbarMn"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
;b Show Desktop button
"TaskbarSD"=dword:00000001
;t
;t
;T System tray
;l Enable missing system tray icons
;shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}\SystemIcons
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
;b Show seconds in the clock
"ShowSecondsInSystemClock"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;b Skin taskbar and tray pop-up menus
@ -51,12 +59,30 @@
;p 2
;b Apply Windows 11 style to system tray icons *
"SkinIcons"=dword:00000001
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People]
;b Show People on the taskbar *
"PeopleBand"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\TabletTip\1.7]
;b Show touch keyboard button *
"TipbandDesiredVisibility"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\MTCUVC]
;i Use legacy volume flyout
"EnableMtcUvc"=dword:00000001
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell]
;b Use legacy clock flyout
"UseWin32TrayClockExperience"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;a Choosing 'Open Network && Internet settings' when right clicking the
;c 3 network icon should open:
;x 0 Network section in the Settings app (default)
;x 1 Network and Sharing Center in Control Panel
;x 2 Network Connections in Control Panel
"ReplaceNetwork"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Control Panel\Settings\Network]
;c 5 Network icon should open
;x 0 WiFi list (default)
;x 1 Network section in the Settings app
;x 2 Windows 8 network flyout
;x 3 Network and Sharing Center in Control Panel
;x 4 Network Connections in Control Panel
"ReplaceVan"=dword:00000000
;T File Explorer
[-HKEY_CURRENT_USER\Software\Classes\CLSID\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\InprocServer32]
@ -66,8 +92,11 @@
;d Disable the Windows 11 context menu *
@=""
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;b Disable the Windows 10 (immersive) context menu
;i Use immersive menus when displaying Windows 10 context menus
"DisableImmersiveContextMenu"=dword:00000000
[-HKEY_CURRENT_USER\Software\Classes\CLSID\{056440FD-8568-48e7-A632-72157243B55B}\InprocServer32]
;d Disable navigation bar
@=""
[-HKEY_CURRENT_USER\Software\Classes\CLSID\{1d64637d-31e9-4b06-9124-e83fb178ac6e}\TreatAs]
;d Disable modern search bar
@="{64bc32b5-4eec-4de7-972d-bd8bd0324537}"
@ -79,6 +108,10 @@
"MicaEffectOnTitlebar"=dword:00000000
;T Start menu
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;b Enable Start menu support
"HookStartMenu"=dword:00000001
;t The following settings only work when the above is enabled:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StartPage]
;i Open Start on monitor containing the cursor
"MonitorOverride"=dword:00000001
@ -118,10 +151,14 @@
"Start_MaximumFrequentApps"=dword:00000006
;T Window switcher
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher\sws]
;b Enable Windows 10 window switcher (Alt+Tab) *
"Enabled"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
;c 3 Window switcher (Alt+Tab) style *
;x 0 Windows 11
;x 2 Windows 10
;x 1 Windows NT
"AltTabSettings"=dword:00000000
;t The following settings only apply to the Windows 10 window switcher:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher\sws]
;b Include desktop
"IncludeWallpaper"=dword:00000001
;c 3 Color scheme
@ -206,13 +243,16 @@
"Start_PowerButtonAction"=dword:00000002
;b Show Command Prompt instead of PowerShell in Win+X menu *
"DontUsePowerShellOnWinX"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;b Remove shortcut key from menu item
"NoMenuAccelerator"=dword:00000000
;T Advanced
;t Only change these settings if you know what you are doing. You've been warned!
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ExplorerPatcher]
;b Enable console *
"AllocConsole"=dword:00000000
;c 7 Supplimentary delay at logon *
;c 12 Supplimentary delay at logon *
;x 0 None (default)
;x 300 300 ms
;x 600 600 ms
@ -220,6 +260,11 @@
;x 1500 1.5 seconds
;x 2000 2 seconds
;x 3000 3 seconds
;x 4000 4 seconds
;x 5000 5 seconds
;x 6000 6 seconds
;x 8000 8 seconds
;x 10000 10 seconds
"ExplorerReadyDelay"=dword:00000000
[HKEY_CURRENT_USER\Control Panel\Desktop]
;b Show Windows build info on the desktop *

View File

@ -421,4 +421,31 @@ void QueryVersionInfo(HMODULE hModule, WORD Resource, DWORD* dwLeftMost, DWORD*
*dwRightMost = LOWORD(dwFileVersionLS);
LocalFree(pResCopy);
}
void* ReadFromFile(wchar_t* wszFileName, DWORD* dwSize)
{
void* ok = NULL;
HANDLE hImage = CreateFileW(wszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hImage)
{
DWORD dwFileSize;
GetFileSizeEx(hImage, &dwFileSize);
if (dwFileSize)
{
void* pImage = malloc(dwFileSize);
if (pImage)
{
DWORD dwNumberOfBytesRead = 0;
ReadFile(hImage, pImage, dwFileSize, &dwNumberOfBytesRead, NULL);
if (dwFileSize == dwNumberOfBytesRead)
{
ok = pImage;
*dwSize = dwNumberOfBytesRead;
}
}
}
CloseHandle(hImage);
}
return ok;
}

View File

@ -93,4 +93,169 @@ __declspec(dllexport) CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hIns
POINT GetDefaultWinXPosition(BOOL bUseRcWork, BOOL* lpBottom, BOOL* lpRight, BOOL bAdjust);
void QueryVersionInfo(HMODULE hModule, WORD Resource, DWORD*, DWORD*, DWORD*, DWORD*);
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
FARPROC SHRegGetValueFromHKCUHKLMFunc;
inline LSTATUS SHRegGetValueFromHKCUHKLMWithOpt(
PCWSTR pwszKey,
PCWSTR pwszValue,
REGSAM samDesired,
void* pvData,
DWORD* pcbData
)
{
LSTATUS lRes = ERROR_FILE_NOT_FOUND;
HKEY hKey = NULL;
RegOpenKeyExW(
HKEY_CURRENT_USER,
pwszKey,
0,
samDesired,
&hKey
);
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
{
hKey = NULL;
}
if (hKey)
{
lRes = RegQueryValueExW(
hKey,
pwszValue,
0,
NULL,
pvData,
pcbData
);
RegCloseKey(hKey);
if (lRes == ERROR_SUCCESS || lRes == ERROR_MORE_DATA)
{
return lRes;
}
}
RegOpenKeyExW(
HKEY_LOCAL_MACHINE,
pwszKey,
0,
samDesired,
&hKey
);
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
{
hKey = NULL;
}
if (hKey)
{
lRes = RegQueryValueExW(
hKey,
pwszValue,
0,
NULL,
pvData,
pcbData
);
RegCloseKey(hKey);
if (lRes == ERROR_SUCCESS || lRes == ERROR_MORE_DATA)
{
return lRes;
}
}
return lRes;
}
static HWND(WINAPI* CreateWindowInBand)(
_In_ DWORD dwExStyle,
_In_opt_ ATOM atom,
_In_opt_ LPCWSTR lpWindowName,
_In_ DWORD dwStyle,
_In_ int X,
_In_ int Y,
_In_ int nWidth,
_In_ int nHeight,
_In_opt_ HWND hWndParent,
_In_opt_ HMENU hMenu,
_In_opt_ HINSTANCE hInstance,
_In_opt_ LPVOID lpParam,
DWORD band
);
BOOL(WINAPI* GetWindowBand)(HWND hWnd, PDWORD pdwBand);
BOOL(WINAPI* SetWindowBand)(HWND hWnd, HWND hwndInsertAfter, DWORD dwBand);
INT64(*SetWindowCompositionAttribute)(HWND, void*);
static void(*SetPreferredAppMode)(INT64 bAllowDark);
static void(*AllowDarkModeForWindow)(HWND hWnd, INT64 bAllowDark);
static BOOL(*ShouldAppsUseDarkMode)();
static void(*GetThemeName)(void*, void*, void*);
static BOOL AppsShouldUseDarkMode() { return TRUE; }
void* ReadFromFile(wchar_t* wszFileName, DWORD* dwSize);
inline long long milliseconds_now() {
LARGE_INTEGER s_frequency;
BOOL s_use_qpc = QueryPerformanceFrequency(&s_frequency);
if (s_use_qpc) {
LARGE_INTEGER now;
QueryPerformanceCounter(&now);
return (1000LL * now.QuadPart) / s_frequency.QuadPart;
}
else {
return GetTickCount();
}
}
inline BOOL IsAppRunningAsAdminMode()
{
BOOL fIsRunAsAdmin = FALSE;
DWORD dwError = ERROR_SUCCESS;
PSID pAdministratorsGroup = NULL;
// Allocate and initialize a SID of the administrators group.
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
if (!AllocateAndInitializeSid(
&NtAuthority,
2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&pAdministratorsGroup))
{
dwError = GetLastError();
goto Cleanup;
}
// Determine whether the SID of administrators group is enabled in
// the primary access token of the process.
if (!CheckTokenMembership(NULL, pAdministratorsGroup, &fIsRunAsAdmin))
{
dwError = GetLastError();
goto Cleanup;
}
Cleanup:
// Centralized cleanup for all allocated resources.
if (pAdministratorsGroup)
{
FreeSid(pAdministratorsGroup);
pAdministratorsGroup = NULL;
}
// Throw the error if something failed in the function.
if (ERROR_SUCCESS != dwError)
{
return FALSE;
}
return fIsRunAsAdmin;
}
#endif

@ -1 +1 @@
Subproject commit 93377dcb57a5da48f4c062a613c38c2effc5ba2d
Subproject commit ecbd725891f24bbdb06912f2caa98c82f0e94456

@ -1 +1 @@
Subproject commit bbabb853337a90213353a720e56645df043a11ca
Subproject commit a5ffe4d4d88fd1c6e4325d63b7556ad02a3c3e95