Skip to content

Commit

Permalink
All: Fix crash when attempting to hook function on older OS builds
Browse files Browse the repository at this point in the history
`RtlQueryFeatureConfiguration` is not available on old Windows 10
builds, like 17763 (LTSC 2019).
Related issue: valinet/ExplorerPatcher#1142
  • Loading branch information
valinet committed Mar 20, 2023
1 parent 8e9403c commit 6bc2ea5
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions ExplorerPatcher/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down

0 comments on commit 6bc2ea5

Please sign in to comment.