Browse Source

All: Fix crash when attempting to hook function on older OS builds

`RtlQueryFeatureConfiguration` is not available on old Windows 10
builds, like 17763 (LTSC 2019).
Related issue: https://github.com/valinet/ExplorerPatcher/discussions/1142
pull/1648/head
Valentin Radu 3 years ago
parent
commit
6bc2ea5d2b
  1. 20
      ExplorerPatcher/dllmain.c

20
ExplorerPatcher/dllmain.c

@ -10161,15 +10161,17 @@ DWORD Inject(BOOL bIsExplorer)
} }
RtlQueryFeatureConfigurationFunc = GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "RtlQueryFeatureConfiguration"); RtlQueryFeatureConfigurationFunc = GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "RtlQueryFeatureConfiguration");
rv = funchook_prepare( if (RtlQueryFeatureConfigurationFunc) {
funchook, rv = funchook_prepare(
(void**)&RtlQueryFeatureConfigurationFunc, funchook,
RtlQueryFeatureConfigurationHook (void**)&RtlQueryFeatureConfigurationFunc,
); RtlQueryFeatureConfigurationHook
if (rv != 0) );
{ if (rv != 0)
FreeLibraryAndExitThread(hModule, rv); {
return FALSE; FreeLibraryAndExitThread(hModule, rv);
return FALSE;
}
} }
printf("Setup ntdll functions done\n"); printf("Setup ntdll functions done\n");

Loading…
Cancel
Save