@ -165,7 +165,6 @@ HWND archivehWnd;
@@ -165,7 +165,6 @@ HWND archivehWnd;
funchook_t * funchook = NULL ;
HMODULE hModule = NULL ;
HANDLE hIsWinXShown = NULL ;
INT64 lockEnsureWinXHotkeyOnlyOnce ;
typedef LONG NTSTATUS , * PNTSTATUS ;
# define STATUS_SUCCESS (0x00000000)
@ -411,6 +410,31 @@ typedef struct IImmersiveMonitorServiceVtbl
@@ -411,6 +410,31 @@ typedef struct IImmersiveMonitorServiceVtbl
/* [in] */ HMONITOR hMonitor ,
_COM_Outptr_ IUnknown * * ppvObject ) ;
HRESULT ( STDMETHODCALLTYPE * method6 ) (
IImmersiveMonitorService * This ) ;
HRESULT ( STDMETHODCALLTYPE * method7 ) (
IImmersiveMonitorService * This ) ;
HRESULT ( STDMETHODCALLTYPE * QueryService ) (
IImmersiveMonitorService * This ,
HMONITOR hMonitor ,
GUID * ,
GUID * ,
void * * ppvObject
) ;
HRESULT ( STDMETHODCALLTYPE * method9 ) (
IImmersiveMonitorService * This ) ;
HRESULT ( STDMETHODCALLTYPE * QueryServiceFromWindow ) (
IImmersiveMonitorService * This ,
HWND hWnd ,
GUID * a3 ,
GUID * a4 ,
void * * ppvObject
) ;
END_INTERFACE
} IImmersiveMonitorServiceVtbl ;
@ -783,6 +807,8 @@ typedef struct
@@ -783,6 +807,8 @@ typedef struct
IUnknown * iunk ;
} ShowLauncherTipContextMenuParameters ;
HWND hWinXWnd ;
DWORD ShowLauncherTipContextMenu (
ShowLauncherTipContextMenuParameters * params
)
@ -796,7 +822,7 @@ DWORD ShowLauncherTipContextMenu(
@@ -796,7 +822,7 @@ DWORD ShowLauncherTipContextMenu(
wc . hCursor = LoadCursorW ( NULL , IDC_ARROW ) ;
RegisterClass ( & wc ) ;
HWND h Wnd = CreateWindowInBand (
hWinX Wnd = CreateWindowInBand (
0 ,
CLASS_NAME ,
0 ,
@ -811,8 +837,8 @@ DWORD ShowLauncherTipContextMenu(
@@ -811,8 +837,8 @@ DWORD ShowLauncherTipContextMenu(
( char * ) params - > _this - 0x58 ,
7
) ;
ShowWindow ( hWnd , SW_SHOW ) ;
SetForegroundWindow ( hWnd ) ;
ShowWindow ( hWinXW nd , SW_SHOW ) ;
SetForegroundWindow ( hWinXW nd ) ;
while ( ! ( * ( ( HMENU * ) ( ( char * ) params - > _this + 0xe8 ) ) ) )
{
@ -826,7 +852,7 @@ DWORD ShowLauncherTipContextMenu(
@@ -826,7 +852,7 @@ DWORD ShowLauncherTipContextMenu(
INT64 * unknown_array = calloc ( 4 , sizeof ( INT64 ) ) ;
ImmersiveContextMenuHelper_ApplyOwnerDrawToMenuFunc (
* ( ( HMENU * ) ( ( char * ) params - > _this + 0xe8 ) ) ,
hWnd ,
hWinXW nd ,
& ( params - > point ) ,
0xc ,
unknown_array
@ -838,13 +864,13 @@ DWORD ShowLauncherTipContextMenu(
@@ -838,13 +864,13 @@ DWORD ShowLauncherTipContextMenu(
params - > point . x ,
params - > point . y ,
0 ,
hWnd ,
hWinXW nd ,
0
) ;
ImmersiveContextMenuHelper_RemoveOwnerDrawFromMenuFunc (
* ( ( HMENU * ) ( ( char * ) params - > _this + 0xe8 ) ) ,
hWnd ,
hWinXW nd ,
& ( params - > point )
) ;
free ( unknown_array ) ;
@ -872,7 +898,7 @@ DWORD ShowLauncherTipContextMenu(
@@ -872,7 +898,7 @@ DWORD ShowLauncherTipContextMenu(
finalize :
params - > iunk - > lpVtbl - > Release ( params - > iunk ) ;
SendMessage (
hWnd ,
hWinXW nd ,
WM_CLOSE ,
0 ,
0
@ -882,24 +908,9 @@ DWORD ShowLauncherTipContextMenu(
@@ -882,24 +908,9 @@ DWORD ShowLauncherTipContextMenu(
return 0 ;
}
INT64 CLauncherTipContextMenu_ShowLauncherTipContextMenuHook (
void * _this ,
POINT * pt
)
{
if ( hIsWinXShown )
{
goto finalize ;
}
POINT point ;
if ( pt )
{
point = * pt ;
}
else
POINT GetDefaultWinXPosition ( )
{
POINT ptCursor ;
POINT point , ptCursor ;
GetCursorPos ( & ptCursor ) ;
MONITORINFO mi ;
mi . cbSize = sizeof ( MONITORINFO ) ;
@ -938,6 +949,27 @@ INT64 CLauncherTipContextMenu_ShowLauncherTipContextMenuHook(
@@ -938,6 +949,27 @@ INT64 CLauncherTipContextMenu_ShowLauncherTipContextMenuHook(
point . x = mi . rcMonitor . right ;
point . y = mi . rcMonitor . top ;
}
return point ;
}
INT64 CLauncherTipContextMenu_ShowLauncherTipContextMenuHook (
void * _this ,
POINT * pt
)
{
if ( hIsWinXShown )
{
goto finalize ;
}
POINT point ;
if ( pt )
{
point = * pt ;
}
else
{
point = GetDefaultWinXPosition ( ) ;
}
IUnknown * iunk ;
@ -980,62 +1012,36 @@ INT64 CTray_HandleGlobalHotkeyHook(
@@ -980,62 +1012,36 @@ INT64 CTray_HandleGlobalHotkeyHook(
// see https://github.com/valinet/ExplorerPatcher/issues/3
if ( hIsWinXShown )
{
INPUT ip [ 2 ] ;
ip [ 0 ] . type = INPUT_KEYBOARD ;
ip [ 0 ] . ki . wScan = 0 ;
ip [ 0 ] . ki . time = 0 ;
ip [ 0 ] . ki . dwExtraInfo = 0 ;
ip [ 0 ] . ki . wVk = VK_ESCAPE ;
ip [ 0 ] . ki . dwFlags = 0 ;
ip [ 1 ] . type = INPUT_KEYBOARD ;
ip [ 1 ] . ki . wScan = 0 ;
ip [ 1 ] . ki . time = 0 ;
ip [ 1 ] . ki . dwExtraInfo = 0 ;
ip [ 1 ] . ki . wVk = VK_ESCAPE ;
ip [ 1 ] . ki . dwFlags = KEYEVENTF_KEYUP ;
SendInput ( 2 , ip , sizeof ( INPUT ) ) ;
return 0 ;
SendMessage ( hWinXWnd , WM_CLOSE , 0 , 0 ) ;
}
HWND hWnd = GetForegroundWindow ( ) ;
HWND g_ProgWin = FindWindowEx (
else
{
HWND hWnd = FindWindowEx (
NULL ,
NULL ,
L " Progman " ,
L " Shell_TrayWnd " ,
NULL
) ;
SetForegroundWindow ( g_ProgWin ) ;
INPUT ip [ 4 ] ;
ip [ 0 ] . type = INPUT_KEYBOARD ;
ip [ 0 ] . ki . wScan = 0 ;
ip [ 0 ] . ki . time = 0 ;
ip [ 0 ] . ki . dwExtraInfo = 0 ;
ip [ 0 ] . ki . wVk = VK_LWIN ;
ip [ 0 ] . ki . dwFlags = 0 ;
ip [ 1 ] . type = INPUT_KEYBOARD ;
ip [ 1 ] . ki . wScan = 0 ;
ip [ 1 ] . ki . time = 0 ;
ip [ 1 ] . ki . dwExtraInfo = 0 ;
ip [ 1 ] . ki . wVk = 0x51 ; // 0x46;
ip [ 1 ] . ki . dwFlags = 0 ;
ip [ 2 ] . type = INPUT_KEYBOARD ;
ip [ 2 ] . ki . wScan = 0 ;
ip [ 2 ] . ki . time = 0 ;
ip [ 2 ] . ki . dwExtraInfo = 0 ;
ip [ 2 ] . ki . wVk = 0x51 ; // 0x46;
ip [ 2 ] . ki . dwFlags = KEYEVENTF_KEYUP ;
ip [ 3 ] . type = INPUT_KEYBOARD ;
ip [ 3 ] . ki . wScan = 0 ;
ip [ 3 ] . ki . time = 0 ;
ip [ 3 ] . ki . dwExtraInfo = 0 ;
ip [ 3 ] . ki . wVk = VK_LWIN ;
ip [ 3 ] . ki . dwFlags = KEYEVENTF_KEYUP ;
InterlockedExchange64 ( & lockEnsureWinXHotkeyOnlyOnce , 1 ) ;
SendInput ( 4 , ip , sizeof ( INPUT ) ) ;
SetForegroundWindow ( hWnd ) ;
if ( hWnd )
{
hWnd = FindWindowEx (
hWnd ,
NULL ,
L " Start " ,
NULL
) ;
if ( hWnd )
{
POINT pt = GetDefaultWinXPosition ( ) ;
PostMessage (
hWnd ,
WM_CONTEXTMENU ,
hWnd ,
MAKELPARAM ( pt . x , pt . y )
) ;
}
}
}
return 0 ;
}
return CTray_HandleGlobalHotkeyFunc (
@ -1075,38 +1081,6 @@ HRESULT CImmersiveHotkeyNotification_OnMessageHook(
@@ -1075,38 +1081,6 @@ HRESULT CImmersiveHotkeyNotification_OnMessageHook(
INT64 lParam
)
{
if ( InterlockedExchange64 ( & lockEnsureWinXHotkeyOnlyOnce , 0 ) & &
wParam = = 30 & & // 28, 15
IsDesktopInputContextFunc ( _this , msg )
)
{
IUnknown * pMonitor = NULL ;
HRESULT hr = CImmersiveHotkeyNotification_GetMonitorForHotkeyNotificationFunc (
( char * ) _this - 0x68 ,
& pMonitor ,
0
) ;
if ( SUCCEEDED ( hr ) )
{
IUnknown * pMenu = NULL ;
IUnknown_QueryService (
pMonitor ,
& IID_ILauncherTipContextMenu ,
& IID_ILauncherTipContextMenu ,
& pMenu
) ;
if ( pMenu )
{
CLauncherTipContextMenu_ShowLauncherTipContextMenuHook (
pMenu ,
0
) ;
pMenu - > lpVtbl - > Release ( pMenu ) ;
}
}
return 0 ;
}
return CImmersiveHotkeyNotification_OnMessageFunc (
_this ,
msg ,