@@ -75,6 +75,7 @@ HANDLE hIsWinXShown = NULL;
75
75
HANDLE hWinXThread = NULL ;
76
76
HANDLE hSwsSettingsChanged = NULL ;
77
77
HANDLE hSwsOpacityMaybeChanged = NULL ;
78
+ HANDLE hWin11AltTabInitialized = NULL ;
78
79
BYTE * lpShouldDisplayCCButton = NULL ;
79
80
HMONITOR hMonitorList [30 ];
80
81
DWORD dwMonitorCount = 0 ;
@@ -863,6 +864,11 @@ void UpdateStartMenuPositioning(LPARAM loIsShouldInitializeArray_hiIsShouldRoIni
863
864
BOOL bShouldInitialize = LOWORD (loIsShouldInitializeArray_hiIsShouldRoInitialize );
864
865
BOOL bShouldRoInitialize = HIWORD (loIsShouldInitializeArray_hiIsShouldRoInitialize );
865
866
867
+ if (!bOldTaskbar )
868
+ {
869
+ return ;
870
+ }
871
+
866
872
DWORD dwPosCurrent = GetStartMenuPosition (SHRegGetValueFromHKCUHKLMFunc );
867
873
if (bShouldInitialize || InterlockedAdd (& dwTaskbarAl , 0 ) != dwPosCurrent )
868
874
{
@@ -2475,6 +2481,9 @@ void sws_ReadSettings(sws_WindowSwitcher* sws)
2475
2481
2476
2482
DWORD WindowSwitcher (DWORD unused )
2477
2483
{
2484
+ WaitForSingleObject (hWin11AltTabInitialized , INFINITE );
2485
+ Sleep (500 );
2486
+
2478
2487
while (TRUE)
2479
2488
{
2480
2489
sws_ReadSettings (NULL );
@@ -3122,7 +3131,7 @@ HWND CreateWindowExWHook(
3122
3131
{
3123
3132
SetWindowSubclass (hWnd , ShowDesktopSubclassProc , ShowDesktopSubclassProc , 0 );
3124
3133
}
3125
- else if (bIsExplorerProcess && (* ((WORD * )& (lpClassName )+ 1 )) && !wcscmp (lpClassName , L"Shell_TrayWnd" ))
3134
+ else if (bOldTaskbar && bIsExplorerProcess && (* ((WORD * )& (lpClassName )+ 1 )) && !wcscmp (lpClassName , L"Shell_TrayWnd" ))
3126
3135
{
3127
3136
SetWindowSubclass (hWnd , Shell_TrayWndSubclassProc , Shell_TrayWndSubclassProc , 0 );
3128
3137
}
@@ -3769,6 +3778,38 @@ LSTATUS explorer_RegGetValueW(
3769
3778
return lRes ;
3770
3779
}
3771
3780
3781
+ LSTATUS twinuipcshell_RegGetValueW (
3782
+ HKEY hkey ,
3783
+ LPCWSTR lpSubKey ,
3784
+ LPCWSTR lpValue ,
3785
+ DWORD dwFlags ,
3786
+ LPDWORD pdwType ,
3787
+ PVOID pvData ,
3788
+ LPDWORD pcbData
3789
+ )
3790
+ {
3791
+ LSTATUS lRes = RegGetValueW (hkey , lpSubKey , lpValue , dwFlags , pdwType , pvData , pcbData );
3792
+
3793
+ if (!lstrcmpW (lpValue , L"AltTabSettings" ))
3794
+ {
3795
+ if (* (DWORD * )pvData )
3796
+ {
3797
+ * (DWORD * )pvData = 1 ;
3798
+ }
3799
+
3800
+ if (hWin11AltTabInitialized )
3801
+ {
3802
+ SetEvent (hWin11AltTabInitialized );
3803
+ CloseHandle (hWin11AltTabInitialized );
3804
+ hWin11AltTabInitialized = NULL ;
3805
+ }
3806
+
3807
+ lRes = ERROR_SUCCESS ;
3808
+ }
3809
+
3810
+ return lRes ;
3811
+ }
3812
+
3772
3813
BOOL CALLBACK GetMonitorByIndex (HMONITOR hMonitor , HDC hdcMonitor , LPRECT lprcMonitor , RECT * rc )
3773
3814
{
3774
3815
//printf(">> %d %d %d %d\n", lprcMonitor->left, lprcMonitor->top, lprcMonitor->right, lprcMonitor->bottom);
@@ -4115,6 +4156,7 @@ __declspec(dllexport) DWORD WINAPI main(
4115
4156
#ifdef _WIN64
4116
4157
if (bIsExplorer )
4117
4158
{
4159
+ hWin11AltTabInitialized = CreateEventW (NULL , FALSE, FALSE, NULL );
4118
4160
CreateThread (
4119
4161
0 ,
4120
4162
0 ,
@@ -4165,10 +4207,10 @@ __declspec(dllexport) DWORD WINAPI main(
4165
4207
4166
4208
HANDLE hExplorer = GetModuleHandleW (NULL );
4167
4209
SetChildWindowNoActivateFunc = GetProcAddress (GetModuleHandleW (L"user32.dll" ), (LPCSTR )2005 );
4168
- VnPatchIAT (hExplorer , "user32.dll" , (LPCSTR )2005 , explorer_SetChildWindowNoActivateHook );
4169
- VnPatchDelayIAT (hExplorer , "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll" , "SendMessageW" , explorer_SendMessageW );
4170
4210
if (bOldTaskbar )
4171
4211
{
4212
+ VnPatchIAT (hExplorer , "user32.dll" , (LPCSTR )2005 , explorer_SetChildWindowNoActivateHook );
4213
+ VnPatchDelayIAT (hExplorer , "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll" , "SendMessageW" , explorer_SendMessageW );
4172
4214
VnPatchIAT (hExplorer , "api-ms-win-core-libraryloader-l1-2-0.dll" , "GetProcAddress" , explorer_GetProcAddressHook );
4173
4215
VnPatchIAT (hExplorer , "shell32.dll" , "ShellExecuteW" , explorer_ShellExecuteW );
4174
4216
VnPatchIAT (hExplorer , "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL" , "RegGetValueW" , explorer_RegGetValueW );
@@ -4197,7 +4239,7 @@ __declspec(dllexport) DWORD WINAPI main(
4197
4239
VnPatchIAT (hExplorer , "user32.dll" , "SetWindowCompositionAttribute" , explorer_SetWindowCompositionAttribute );
4198
4240
}
4199
4241
//VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "CreateWindowExW", explorer_CreateWindowExW);
4200
- if (dwIMEStyle )
4242
+ if (bOldTaskbar && dwIMEStyle )
4201
4243
{
4202
4244
VnPatchIAT (hExplorer , "api-ms-win-core-com-l1-1-0.dll" , "CoCreateInstance" , explorer_CoCreateInstanceHook );
4203
4245
}
@@ -4309,6 +4351,7 @@ __declspec(dllexport) DWORD WINAPI main(
4309
4351
}
4310
4352
}
4311
4353
}
4354
+ VnPatchIAT (hTwinuiPcshell , "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL" , "RegGetValueW" , twinuipcshell_RegGetValueW );
4312
4355
printf ("Setup twinui.pcshell functions done\n" );
4313
4356
4314
4357
@@ -4386,27 +4429,32 @@ __declspec(dllexport) DWORD WINAPI main(
4386
4429
ResetEvent(hEvent);
4387
4430
}*/
4388
4431
4389
-
4390
- CreateThread (
4391
- 0 ,
4392
- 0 ,
4393
- PlayStartupSound ,
4394
- 0 ,
4395
- 0 ,
4396
- 0
4397
- );
4398
- printf ("Play startup sound thread...\n" );
4432
+ if (bOldTaskbar )
4433
+ {
4434
+ CreateThread (
4435
+ 0 ,
4436
+ 0 ,
4437
+ PlayStartupSound ,
4438
+ 0 ,
4439
+ 0 ,
4440
+ 0
4441
+ );
4442
+ printf ("Play startup sound thread...\n" );
4443
+ }
4399
4444
4400
4445
4401
- CreateThread (
4402
- 0 ,
4403
- 0 ,
4404
- SignalShellReady ,
4405
- dwExplorerReadyDelay ,
4406
- 0 ,
4407
- 0
4408
- );
4409
- printf ("Signal shell ready...\n" );
4446
+ if (bOldTaskbar )
4447
+ {
4448
+ CreateThread (
4449
+ 0 ,
4450
+ 0 ,
4451
+ SignalShellReady ,
4452
+ dwExplorerReadyDelay ,
4453
+ 0 ,
4454
+ 0
4455
+ );
4456
+ printf ("Signal shell ready...\n" );
4457
+ }
4410
4458
4411
4459
4412
4460
CreateThread (
0 commit comments