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

Loading…
Cancel
Save