Browse Source

Fixes #313 (unable to start when sws is enabled and Windows 10 taskbar is disabled)

pull/400/head 22000.318.36.1_e02e4ae
Valentin Radu 4 years ago
parent
commit
e02e4ae58f
  1. 3
      CHANGELOG.md
  2. 8
      ExplorerPatcher/ExplorerPatcher.rc
  3. 94
      ExplorerPatcher/dllmain.c

3
CHANGELOG.md

@ -8,7 +8,8 @@ Tested on build 22000.318.
#### Fixes #### Fixes
* Lots of bug and issue fixes for shell extension failing to work under certain circumstances; fixed #259 * Fixes an issue that prevented Explorer from starting up when Windows 10 taskbar was disabled and Windows 10 window switcher was enabled (#313) (.1)
* Lots of bug and issue fixes for shell extension failing to work under certain circumstances (#259)
## 22000.318.35 ## 22000.318.35

8
ExplorerPatcher/ExplorerPatcher.rc

@ -51,8 +51,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 22000,318,36,0 FILEVERSION 22000,318,36,1
PRODUCTVERSION 22000,318,36,0 PRODUCTVERSION 22000,318,36,1
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -69,12 +69,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "VALINET Solutions SRL" VALUE "CompanyName", "VALINET Solutions SRL"
VALUE "FileDescription", "ExplorerPatcher" VALUE "FileDescription", "ExplorerPatcher"
VALUE "FileVersion", "22000.318.36.0" VALUE "FileVersion", "22000.318.36.1"
VALUE "InternalName", "ExplorerPatcher.dll" VALUE "InternalName", "ExplorerPatcher.dll"
VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved." VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved."
VALUE "OriginalFilename", "ExplorerPatcher.dll" VALUE "OriginalFilename", "ExplorerPatcher.dll"
VALUE "ProductName", "ExplorerPatcher" VALUE "ProductName", "ExplorerPatcher"
VALUE "ProductVersion", "22000.318.36.0" VALUE "ProductVersion", "22000.318.36.1"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

94
ExplorerPatcher/dllmain.c

@ -75,6 +75,7 @@ HANDLE hIsWinXShown = NULL;
HANDLE hWinXThread = NULL; HANDLE hWinXThread = NULL;
HANDLE hSwsSettingsChanged = NULL; HANDLE hSwsSettingsChanged = NULL;
HANDLE hSwsOpacityMaybeChanged = NULL; HANDLE hSwsOpacityMaybeChanged = NULL;
HANDLE hWin11AltTabInitialized = NULL;
BYTE* lpShouldDisplayCCButton = NULL; BYTE* lpShouldDisplayCCButton = NULL;
HMONITOR hMonitorList[30]; HMONITOR hMonitorList[30];
DWORD dwMonitorCount = 0; DWORD dwMonitorCount = 0;
@ -863,6 +864,11 @@ void UpdateStartMenuPositioning(LPARAM loIsShouldInitializeArray_hiIsShouldRoIni
BOOL bShouldInitialize = LOWORD(loIsShouldInitializeArray_hiIsShouldRoInitialize); BOOL bShouldInitialize = LOWORD(loIsShouldInitializeArray_hiIsShouldRoInitialize);
BOOL bShouldRoInitialize = HIWORD(loIsShouldInitializeArray_hiIsShouldRoInitialize); BOOL bShouldRoInitialize = HIWORD(loIsShouldInitializeArray_hiIsShouldRoInitialize);
if (!bOldTaskbar)
{
return;
}
DWORD dwPosCurrent = GetStartMenuPosition(SHRegGetValueFromHKCUHKLMFunc); DWORD dwPosCurrent = GetStartMenuPosition(SHRegGetValueFromHKCUHKLMFunc);
if (bShouldInitialize || InterlockedAdd(&dwTaskbarAl, 0) != dwPosCurrent) if (bShouldInitialize || InterlockedAdd(&dwTaskbarAl, 0) != dwPosCurrent)
{ {
@ -2475,6 +2481,9 @@ void sws_ReadSettings(sws_WindowSwitcher* sws)
DWORD WindowSwitcher(DWORD unused) DWORD WindowSwitcher(DWORD unused)
{ {
WaitForSingleObject(hWin11AltTabInitialized, INFINITE);
Sleep(500);
while (TRUE) while (TRUE)
{ {
sws_ReadSettings(NULL); sws_ReadSettings(NULL);
@ -3122,7 +3131,7 @@ HWND CreateWindowExWHook(
{ {
SetWindowSubclass(hWnd, ShowDesktopSubclassProc, ShowDesktopSubclassProc, 0); SetWindowSubclass(hWnd, ShowDesktopSubclassProc, ShowDesktopSubclassProc, 0);
} }
else if (bIsExplorerProcess && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L"Shell_TrayWnd")) else if (bOldTaskbar && bIsExplorerProcess && (*((WORD*)&(lpClassName)+1)) && !wcscmp(lpClassName, L"Shell_TrayWnd"))
{ {
SetWindowSubclass(hWnd, Shell_TrayWndSubclassProc, Shell_TrayWndSubclassProc, 0); SetWindowSubclass(hWnd, Shell_TrayWndSubclassProc, Shell_TrayWndSubclassProc, 0);
} }
@ -3769,6 +3778,38 @@ LSTATUS explorer_RegGetValueW(
return lRes; return lRes;
} }
LSTATUS twinuipcshell_RegGetValueW(
HKEY hkey,
LPCWSTR lpSubKey,
LPCWSTR lpValue,
DWORD dwFlags,
LPDWORD pdwType,
PVOID pvData,
LPDWORD pcbData
)
{
LSTATUS lRes = RegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);
if (!lstrcmpW(lpValue, L"AltTabSettings"))
{
if (*(DWORD*)pvData)
{
*(DWORD*)pvData = 1;
}
if (hWin11AltTabInitialized)
{
SetEvent(hWin11AltTabInitialized);
CloseHandle(hWin11AltTabInitialized);
hWin11AltTabInitialized = NULL;
}
lRes = ERROR_SUCCESS;
}
return lRes;
}
BOOL CALLBACK GetMonitorByIndex(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, RECT* rc) BOOL CALLBACK GetMonitorByIndex(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, RECT* rc)
{ {
//printf(">> %d %d %d %d\n", lprcMonitor->left, lprcMonitor->top, lprcMonitor->right, lprcMonitor->bottom); //printf(">> %d %d %d %d\n", lprcMonitor->left, lprcMonitor->top, lprcMonitor->right, lprcMonitor->bottom);
@ -4115,6 +4156,7 @@ __declspec(dllexport) DWORD WINAPI main(
#ifdef _WIN64 #ifdef _WIN64
if (bIsExplorer) if (bIsExplorer)
{ {
hWin11AltTabInitialized = CreateEventW(NULL, FALSE, FALSE, NULL);
CreateThread( CreateThread(
0, 0,
0, 0,
@ -4165,10 +4207,10 @@ __declspec(dllexport) DWORD WINAPI main(
HANDLE hExplorer = GetModuleHandleW(NULL); HANDLE hExplorer = GetModuleHandleW(NULL);
SetChildWindowNoActivateFunc = GetProcAddress(GetModuleHandleW(L"user32.dll"), (LPCSTR)2005); SetChildWindowNoActivateFunc = GetProcAddress(GetModuleHandleW(L"user32.dll"), (LPCSTR)2005);
VnPatchIAT(hExplorer, "user32.dll", (LPCSTR)2005, explorer_SetChildWindowNoActivateHook);
VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "SendMessageW", explorer_SendMessageW);
if (bOldTaskbar) if (bOldTaskbar)
{ {
VnPatchIAT(hExplorer, "user32.dll", (LPCSTR)2005, explorer_SetChildWindowNoActivateHook);
VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "SendMessageW", explorer_SendMessageW);
VnPatchIAT(hExplorer, "api-ms-win-core-libraryloader-l1-2-0.dll", "GetProcAddress", explorer_GetProcAddressHook); VnPatchIAT(hExplorer, "api-ms-win-core-libraryloader-l1-2-0.dll", "GetProcAddress", explorer_GetProcAddressHook);
VnPatchIAT(hExplorer, "shell32.dll", "ShellExecuteW", explorer_ShellExecuteW); VnPatchIAT(hExplorer, "shell32.dll", "ShellExecuteW", explorer_ShellExecuteW);
VnPatchIAT(hExplorer, "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL", "RegGetValueW", explorer_RegGetValueW); VnPatchIAT(hExplorer, "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL", "RegGetValueW", explorer_RegGetValueW);
@ -4197,7 +4239,7 @@ __declspec(dllexport) DWORD WINAPI main(
VnPatchIAT(hExplorer, "user32.dll", "SetWindowCompositionAttribute", explorer_SetWindowCompositionAttribute); VnPatchIAT(hExplorer, "user32.dll", "SetWindowCompositionAttribute", explorer_SetWindowCompositionAttribute);
} }
//VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "CreateWindowExW", explorer_CreateWindowExW); //VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "CreateWindowExW", explorer_CreateWindowExW);
if (dwIMEStyle) if (bOldTaskbar && dwIMEStyle)
{ {
VnPatchIAT(hExplorer, "api-ms-win-core-com-l1-1-0.dll", "CoCreateInstance", explorer_CoCreateInstanceHook); VnPatchIAT(hExplorer, "api-ms-win-core-com-l1-1-0.dll", "CoCreateInstance", explorer_CoCreateInstanceHook);
} }
@ -4309,6 +4351,7 @@ __declspec(dllexport) DWORD WINAPI main(
} }
} }
} }
VnPatchIAT(hTwinuiPcshell, "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL", "RegGetValueW", twinuipcshell_RegGetValueW);
printf("Setup twinui.pcshell functions done\n"); printf("Setup twinui.pcshell functions done\n");
@ -4386,27 +4429,32 @@ __declspec(dllexport) DWORD WINAPI main(
ResetEvent(hEvent); ResetEvent(hEvent);
}*/ }*/
if (bOldTaskbar)
CreateThread( {
0, CreateThread(
0, 0,
PlayStartupSound, 0,
0, PlayStartupSound,
0, 0,
0 0,
); 0
printf("Play startup sound thread...\n"); );
printf("Play startup sound thread...\n");
}
CreateThread( if (bOldTaskbar)
0, {
0, CreateThread(
SignalShellReady, 0,
dwExplorerReadyDelay, 0,
0, SignalShellReady,
0 dwExplorerReadyDelay,
); 0,
printf("Signal shell ready...\n"); 0
);
printf("Signal shell ready...\n");
}
CreateThread( CreateThread(

Loading…
Cancel
Save