Skip to content

Commit

Permalink
Taskbar10: Partially fixed Windows 11 Start menu and Search positioni…
Browse files Browse the repository at this point in the history
…ng on builds 23545+ (Dev)
  • Loading branch information
Amrsatrio committed Oct 26, 2023
1 parent a7c87ce commit ac268b1
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Note: After updating to this version, the symbols will be re-downloaded even if
* Start10: Properly fixed start menu showing/hiding along with its original animations on builds 22000.65+. (7e2f768)
* GUI: Fixed a bug where "Remember last used section" doesn't remember the current page after being enabled. (11160c8)
* Symbols: Reworked how symbols are managed so that symbols don't need to be successfully downloaded in succession. (8412bd6)
* Setup: Fixed uninstallation of EP installations that have went through upgrades before the proper Pin to Start fix. (845d2b5, a7c87ce)

## 22621.2361.58

Expand Down
38 changes: 31 additions & 7 deletions ExplorerPatcher/StartMenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ BOOL NeedsRo_PositionStartMenuForMonitor(
//hr = (*(HRESULT(**)(INT64, INT64*))(*(INT64*)pTaskbarLayoutFactory + 48))(pTaskbarLayoutFactory, &v12);
hr = pTaskbarLayoutFactory->lpVtbl->get_Current(pTaskbarLayoutFactory, &pTaskbarLayout);
}
int interfaceVersion = 1;
if (SUCCEEDED(hr))
{
/*hr = (**(HRESULT(***)(INT64, GUID*, INT64*))v12)(
Expand All @@ -689,6 +690,15 @@ BOOL NeedsRo_PositionStartMenuForMonitor(
&IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager,
&pTaskbarLayoutManager
);
if (hr == E_NOINTERFACE)
{
interfaceVersion = 2;
hr = pTaskbarLayout->lpVtbl->QueryInterface(
pTaskbarLayout,
&IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager2,
&pTaskbarLayoutManager
);
}
}
if (SUCCEEDED(hr))
{
Expand All @@ -714,12 +724,26 @@ BOOL NeedsRo_PositionStartMenuForMonitor(

if (data->operation == STARTMENU_POSITIONING_OPERATION_ADD)
{
hr = pTaskbarLayoutManager->lpVtbl->ReportMonitorAdded(
pTaskbarLayoutManager,
hMonitor,
&instanceof_WindowsUdk_UI_Shell_ITaskbarSettings,
NULL
);
if (interfaceVersion == 1)
{
hr = pTaskbarLayoutManager->lpVtbl->ReportMonitorAdded(
pTaskbarLayoutManager,
hMonitor,
&instanceof_WindowsUdk_UI_Shell_ITaskbarSettings,
NULL
);
}
else
{
unsigned __int64 result = 0;
hr = pTaskbarLayoutManager->lpVtbl->ReportMonitorAdded2(
pTaskbarLayoutManager,
hMonitor,
&instanceof_WindowsUdk_UI_Shell_ITaskbarSettings,
NULL,
&result
);
}
data->pMonitorList[InterlockedIncrement(data->pMonitorCount) - 1] = hMonitor;
printf("[Positioning] Added settings for monitor %p : %d\n", hMonitor, data->location);
}
Expand All @@ -729,7 +753,7 @@ BOOL NeedsRo_PositionStartMenuForMonitor(
pTaskbarLayoutManager,
hMonitor,
&instanceof_WindowsUdk_UI_Shell_ITaskbarSettings
);
); // TODO Doesn't work when the 2nd interface is used. Needs further investigation
printf("[Positioning] Changed settings for monitor: %p : %d\n", hMonitor, data->location);
}
else if (data->operation == STARTMENU_POSITIONING_OPERATION_REMOVE)
Expand Down
31 changes: 24 additions & 7 deletions ExplorerPatcher/StartMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,16 @@ interface WindowsUdk_UI_Shell_TaskbarLayoutStatics // : IInspectable
};

DEFINE_GUID(IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager,
0x4FB10D7C4,
0xFB10D7C4,
0x4F7F, 0x5DE5, 0xA5, 0x28,
0x7e, 0xfe, 0xf4, 0x18, 0xaa, 0x48
0x7E, 0xFE, 0xF4, 0x18, 0xAA, 0x48
);

// Used in 23545+ (or maybe couple lower builds too). Still named ITaskbarLayoutManager but has different ReportMonitorAdded signature.
DEFINE_GUID(IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager2,
0x98F82ED2,
0x4791, 0x58A0, 0x8D, 0x2F,
0xDA, 0xBD, 0x7A, 0x2F, 0x18, 0x9F
);

typedef struct WindowsUdk_UI_Shell_TaskbarLayoutManagerVtbl // : IInspectableVtbl
Expand Down Expand Up @@ -325,11 +332,21 @@ typedef struct WindowsUdk_UI_Shell_TaskbarLayoutManagerVtbl // : IInspectableVtb
__RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,
/* [out] */ __RPC__out TrustLevel* trustLevel);

HRESULT(STDMETHODCALLTYPE* ReportMonitorAdded)(
__RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,
__RPC__in HMONITOR hMonitor,
__RPC__in void* _instance_of_winrt_WindowsUdk_UI_Shell_ITaskbarSettings,
__RPC__in LPRECT _unknown_lpGeometry);
union
{
HRESULT(STDMETHODCALLTYPE* ReportMonitorAdded)(
__RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,
__RPC__in HMONITOR hMonitor,
__RPC__in void* _instance_of_winrt_WindowsUdk_UI_Shell_ITaskbarSettings,
__RPC__in void* _unknown_shellViewToRectMap);

HRESULT(STDMETHODCALLTYPE* ReportMonitorAdded2)(
__RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,
__RPC__in HMONITOR hMonitor,
__RPC__in void* _instance_of_winrt_WindowsUdk_UI_Shell_ITaskbarSettings,
__RPC__in void* _unknown_shellViewToRectMap,
/* [out] */ __RPC__out unsigned __int64* result);
};

HRESULT(STDMETHODCALLTYPE* ReportMonitorRemoved)(
__RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,
Expand Down

0 comments on commit ac268b1

Please sign in to comment.