Browse Source

Taskbar10: Fix stack corruption in dynamically linked NtDCompositionGetFrameStatistics call on 11 21H2+

pull/4392/head
Amrsatrio 9 months ago
parent
commit
0e55f304c4
  1. 25
      ExplorerPatcher/Taskbar10.cpp

25
ExplorerPatcher/Taskbar10.cpp

@ -163,17 +163,20 @@ struct TaskbarTheme
} }
}; };
struct struct_b enum D3D_FEATURE_LEVEL : int;
struct COMPOSITION_CAPABILITY_INFO
{ {
int a; D3D_FEATURE_LEVEL minSafeFeatureLevel;
int b; D3D_FEATURE_LEVEL maxHardwareFeatureLevel;
int c; int usingSoftwareDevice;
int d; int areEffectsSupported;
int boostCompositorClockSupported; // Valid on 11 21H2+
}; };
typedef HRESULT (*NtDCompositionGetFrameStatistics_t)(DCOMPOSITION_FRAME_STATISTICS*, struct_b*); typedef NTSTATUS (*NtDCompositionGetFrameStatistics_t)(DCOMPOSITION_FRAME_STATISTICS*, COMPOSITION_CAPABILITY_INFO*);
inline HRESULT NtDCompositionGetFrameStatistics(DCOMPOSITION_FRAME_STATISTICS* a, struct_b* b) inline NTSTATUS NtDCompositionGetFrameStatistics(DCOMPOSITION_FRAME_STATISTICS* pStatistics, COMPOSITION_CAPABILITY_INFO* pCapabilities)
{ {
static NtDCompositionGetFrameStatistics_t f = nullptr; static NtDCompositionGetFrameStatistics_t f = nullptr;
if (!f) if (!f)
@ -182,14 +185,14 @@ inline HRESULT NtDCompositionGetFrameStatistics(DCOMPOSITION_FRAME_STATISTICS* a
if (h) if (h)
f = (NtDCompositionGetFrameStatistics_t)GetProcAddress(h, MAKEINTRESOURCEA(1046)); f = (NtDCompositionGetFrameStatistics_t)GetProcAddress(h, MAKEINTRESOURCEA(1046));
} }
return f ? f(a, b) : E_NOTIMPL; return f ? f(pStatistics, pCapabilities) : (NTSTATUS)0xC0000002L; // STATUS_NOT_IMPLEMENTED
} }
bool ShouldApplyBlur() bool ShouldApplyBlur()
{ {
DCOMPOSITION_FRAME_STATISTICS v7; DCOMPOSITION_FRAME_STATISTICS statistics;
struct_b v6; COMPOSITION_CAPABILITY_INFO capabilities;
return SUCCEEDED(NtDCompositionGetFrameStatistics(&v7, &v6)) && v6.d && !v6.c; return NtDCompositionGetFrameStatistics(&statistics, &capabilities) >= 0 && capabilities.areEffectsSupported && !capabilities.usingSoftwareDevice;
} }
TaskbarTheme GetTaskbarTheme() TaskbarTheme GetTaskbarTheme()

Loading…
Cancel
Save