Browse Source

All: Infrastructure for reporting which OS features are enabled

pull/1648/head
Valentin Radu 3 years ago
parent
commit
23a4190018
  1. 37
      ExplorerPatcher/dllmain.c
  2. 8
      ExplorerPatcher/osutility.h

37
ExplorerPatcher/dllmain.c

@ -50,6 +50,7 @@ HANDLE hServiceWindowThread = NULL;
RTL_OSVERSIONINFOW global_rovi; RTL_OSVERSIONINFOW global_rovi;
DWORD32 global_ubr; DWORD32 global_ubr;
#endif #endif
#include <featurestagingapi.h>
#define WINX_ADJUST_X 5 #define WINX_ADJUST_X 5
#define WINX_ADJUST_Y 5 #define WINX_ADJUST_Y 5
@ -9583,6 +9584,29 @@ HWND user32_NtUserFindWindowExHook(HWND hWndParent, HWND hWndChildAfter, LPCWSTR
#pragma endregion #pragma endregion
#pragma region "Infrastructure for reporting which OS features are enabled"
#pragma pack(push, 1)
struct RTL_FEATURE_CONFIGURATION {
unsigned int featureId;
unsigned __int32 group : 4;
unsigned __int32 enabledState : 2;
unsigned __int32 enabledStateOptions : 1;
unsigned __int32 unused1 : 1;
unsigned __int32 variant : 6;
unsigned __int32 variantPayloadKind : 2;
unsigned __int32 unused2 : 16;
unsigned int payload;
};
#pragma pack(pop)
int (*RtlQueryFeatureConfigurationFunc)(UINT32 featureId, int sectionType, INT64* changeStamp, struct RTL_FEATURE_CONFIGURATION* buffer);
int RtlQueryFeatureConfigurationHook(UINT32 featureId, int sectionType, INT64* changeStamp, struct RTL_FEATURE_CONFIGURATION* buffer) {
int rv = RtlQueryFeatureConfigurationFunc(featureId, sectionType, changeStamp, buffer);
return rv;
}
#pragma endregion
DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall) DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall)
{ {
//Sleep(150); //Sleep(150);
@ -10127,6 +10151,19 @@ DWORD Inject(BOOL bIsExplorer)
printf("Loaded symbols\n"); printf("Loaded symbols\n");
} }
RtlQueryFeatureConfigurationFunc = GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "RtlQueryFeatureConfiguration");
rv = funchook_prepare(
funchook,
(void**)&RtlQueryFeatureConfigurationFunc,
RtlQueryFeatureConfigurationHook
);
if (rv != 0)
{
FreeLibraryAndExitThread(hModule, rv);
return FALSE;
}
printf("Setup ntdll functions done\n");
HANDLE hUser32 = LoadLibraryW(L"user32.dll"); HANDLE hUser32 = LoadLibraryW(L"user32.dll");
CreateWindowInBand = GetProcAddress(hUser32, "CreateWindowInBand"); CreateWindowInBand = GetProcAddress(hUser32, "CreateWindowInBand");

8
ExplorerPatcher/osutility.h

@ -69,4 +69,12 @@ inline BOOL IsWindows11BuildHigherThan25158()
if (global_rovi.dwBuildNumber > 25158) return TRUE; if (global_rovi.dwBuildNumber > 25158) return TRUE;
return FALSE; return FALSE;
} }
inline BOOL IsWindows11Version22H2Build1413OrHigher()
{
if (IsWindows11BuildHigherThan25158()) return TRUE;
if (!global_rovi.dwMajorVersion) global_ubr = VnGetOSVersionAndUBR(&global_rovi);
if (global_ubr >= 1413) return TRUE;
return FALSE;
}
#endif #endif
Loading…
Cancel
Save