https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cdc8b721dad8ded6a30f4…
commit cdc8b721dad8ded6a30f48ccef6cbb9c5e93f316
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Mon Mar 11 00:04:13 2019 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Thu Mar 14 20:02:00 2019 +0100
[ACLAYERS] Add stubplemented IgnoreLoadLibrary shim
CORE-15845
---
dll/appcompat/shims/layer/CMakeLists.txt | 1 +
dll/appcompat/shims/layer/ignoreloadlibrary.c | 80 +++++++++++++++++++++++++++
media/sdb/sysmain.xml | 5 ++
3 files changed, 86 insertions(+)
diff --git a/dll/appcompat/shims/layer/CMakeLists.txt
b/dll/appcompat/shims/layer/CMakeLists.txt
index 92b168f85d..d2b70b2b99 100644
--- a/dll/appcompat/shims/layer/CMakeLists.txt
+++ b/dll/appcompat/shims/layer/CMakeLists.txt
@@ -6,6 +6,7 @@ spec2def(aclayers.dll layer.spec)
list(APPEND SOURCE
dispmode.c
forcedxsetupsuccess.c
+ ignoreloadlibrary.c
versionlie.c
vmhorizon.c
main.c
diff --git a/dll/appcompat/shims/layer/ignoreloadlibrary.c
b/dll/appcompat/shims/layer/ignoreloadlibrary.c
new file mode 100644
index 0000000000..43f236f6c5
--- /dev/null
+++ b/dll/appcompat/shims/layer/ignoreloadlibrary.c
@@ -0,0 +1,80 @@
+/*
+ * PROJECT: ReactOS 'Layers' Shim library
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: IgnoreLoadLibrary shim
+ * COPYRIGHT: Copyright 2019 Mark Jansen (mark.jansen(a)reactos.org)
+ */
+
+#define WIN32_NO_STATUS
+#include <windef.h>
+#include <winbase.h>
+#include <shimlib.h>
+#include "ntndk.h"
+
+typedef HMODULE(WINAPI* LOADLIBRARYAPROC)(LPCSTR lpLibFileName);
+typedef HMODULE(WINAPI* LOADLIBRARYEXAPROC)(LPCSTR lpLibFileName, HANDLE hFile, DWORD
dwFlags);
+typedef HMODULE(WINAPI* LOADLIBRARYWPROC)(LPCWSTR lpLibFileName);
+typedef HMODULE(WINAPI* LOADLIBRARYEXWPROC)(LPCWSTR lpLibFileName, HANDLE hFile, DWORD
dwFlags);
+
+
+#define SHIM_NS IgnoreLoadLibrary
+#include <setup_shim.inl>
+
+
+HMODULE WINAPI SHIM_OBJ_NAME(APIHook_LoadLibraryA)(LPCSTR lpLibFileName)
+{
+ HMODULE Module;
+ DWORD dwOldErrorMode;
+
+ dwOldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
SEM_NOOPENFILEERRORBOX);
+ Module = CALL_SHIM(0, LOADLIBRARYAPROC)(lpLibFileName);
+ SetErrorMode(dwOldErrorMode);
+
+ return Module;
+}
+
+HMODULE WINAPI SHIM_OBJ_NAME(APIHook_LoadLibraryExA)(LPCSTR lpLibFileName, HANDLE hFile,
DWORD dwFlags)
+{
+ HMODULE Module;
+ DWORD dwOldErrorMode;
+
+ dwOldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
SEM_NOOPENFILEERRORBOX);
+ Module = CALL_SHIM(1, LOADLIBRARYEXAPROC)(lpLibFileName, hFile, dwFlags);
+ SetErrorMode(dwOldErrorMode);
+
+ return Module;
+}
+
+HMODULE WINAPI SHIM_OBJ_NAME(APIHook_LoadLibraryW)(LPCWSTR lpLibFileName)
+{
+ HMODULE Module;
+ DWORD dwOldErrorMode;
+
+ dwOldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
SEM_NOOPENFILEERRORBOX);
+ Module = CALL_SHIM(2, LOADLIBRARYWPROC)(lpLibFileName);
+ SetErrorMode(dwOldErrorMode);
+
+ return Module;
+}
+
+HMODULE WINAPI SHIM_OBJ_NAME(APIHook_LoadLibraryExW)(LPCWSTR lpLibFileName, HANDLE hFile,
DWORD dwFlags)
+{
+ HMODULE Module;
+ DWORD dwOldErrorMode;
+
+ dwOldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
SEM_NOOPENFILEERRORBOX);
+ Module = CALL_SHIM(3, LOADLIBRARYEXWPROC)(lpLibFileName, hFile, dwFlags);
+ SetErrorMode(dwOldErrorMode);
+
+ return Module;
+}
+
+
+#define SHIM_NUM_HOOKS 4
+#define SHIM_SETUP_HOOKS \
+ SHIM_HOOK(0, "KERNEL32.DLL", "LoadLibraryA",
SHIM_OBJ_NAME(APIHook_LoadLibraryA)) \
+ SHIM_HOOK(1, "KERNEL32.DLL", "LoadLibraryExA",
SHIM_OBJ_NAME(APIHook_LoadLibraryExA)) \
+ SHIM_HOOK(2, "KERNEL32.DLL", "LoadLibraryW",
SHIM_OBJ_NAME(APIHook_LoadLibraryW)) \
+ SHIM_HOOK(3, "KERNEL32.DLL", "LoadLibraryExW",
SHIM_OBJ_NAME(APIHook_LoadLibraryExW))
+
+#include <implement_shim.inl>
diff --git a/media/sdb/sysmain.xml b/media/sdb/sysmain.xml
index c5123e9d9a..de87df7c0d 100644
--- a/media/sdb/sysmain.xml
+++ b/media/sdb/sysmain.xml
@@ -222,6 +222,9 @@
<SHIM NAME="IgnoreFreeLibrary">
<DLLFILE>acgenral.dll</DLLFILE>
</SHIM>
+ <SHIM NAME="IgnoreLoadLibrary">
+ <DLLFILE>aclayers.dll</DLLFILE>
+ </SHIM>
<SHIM NAME="VMHorizonSetup">
<DLLFILE>aclayers.dll</DLLFILE>
</SHIM>
@@ -244,11 +247,13 @@
<LAYER NAME="WIN95">
<SHIM_REF NAME="Win95VersionLie" />
<SHIM_REF NAME="ForceDXSetupSuccess" />
+ <SHIM_REF NAME="IgnoreLoadLibrary" />
<!-- TODO: Add more fixes! -->
</LAYER>
<LAYER NAME="WIN98">
<SHIM_REF NAME="Win98VersionLie" />
<SHIM_REF NAME="ForceDXSetupSuccess" />
+ <SHIM_REF NAME="IgnoreLoadLibrary" />
<!-- TODO: Add more fixes! -->
</LAYER>
<LAYER NAME="NT4SP5">