https://git.reactos.org/?p=reactos.git;a=commitdiff;h=15d491fb29257de873390…
commit 15d491fb29257de8733909182ebe9c802e77e984
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Sat Feb 25 13:33:15 2017 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Wed Oct 26 20:12:21 2022 +0200
[NTDLL] Implement LdrInitShimEngineDynamic.
This is the final step required to properly support SE_DynamicShim
CORE-13283
---
dll/ntdll/def/ntdll.spec | 2 +-
dll/ntdll/ldr/ldrapi.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/dll/ntdll/def/ntdll.spec b/dll/ntdll/def/ntdll.spec
index 30f9a4c7a1e..617933ca710 100644
--- a/dll/ntdll/def/ntdll.spec
+++ b/dll/ntdll/def/ntdll.spec
@@ -156,7 +156,7 @@
@ stdcall LdrGetProcedureAddress(ptr ptr long ptr)
@ stdcall -stub -version=0x600+ LdrGetProcedureAddressEx(ptr ptr long ptr long)
@ stdcall -stub LdrHotPatchRoutine(ptr)
-@ stdcall -stub LdrInitShimEngineDynamic(ptr)
+@ stdcall LdrInitShimEngineDynamic(ptr)
@ stdcall LdrInitializeThunk(long long long long)
@ stdcall LdrLoadAlternateResourceModule(ptr ptr)
@ stub -version=0x600+ LdrLoadAlternateResourceModuleEx
diff --git a/dll/ntdll/ldr/ldrapi.c b/dll/ntdll/ldr/ldrapi.c
index 8c968160f30..de7c68d8053 100644
--- a/dll/ntdll/ldr/ldrapi.c
+++ b/dll/ntdll/ldr/ldrapi.c
@@ -1672,4 +1672,23 @@ LdrSetAppCompatDllRedirectionCallback(
return STATUS_NOT_IMPLEMENTED;
}
+BOOLEAN
+NTAPI
+LdrInitShimEngineDynamic(IN PVOID BaseAddress)
+{
+ ULONG_PTR Cookie;
+ NTSTATUS Status = LdrLockLoaderLock(0, NULL, &Cookie);
+ if (NT_SUCCESS(Status))
+ {
+ if (!g_pShimEngineModule)
+ {
+ g_pShimEngineModule = BaseAddress;
+ LdrpGetShimEngineInterface();
+ }
+ LdrUnlockLoaderLock(0, Cookie);
+ return TRUE;
+ }
+ return FALSE;
+}
+
/* EOF */