https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0ebeced143aa5fc6810c3…
commit 0ebeced143aa5fc6810c3b747c22e46d929d8eb8
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Mon Mar 11 22:46:18 2019 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Thu Mar 14 20:02:00 2019 +0100
[SHIMENG] Find shims case-insensitive
CORE-15845
---
dll/appcompat/shims/layer/forcedxsetupsuccess.c | 2 +-
dll/appcompat/shims/shimlib/shimlib.c | 6 +++---
dll/appcompat/shims/shimlib/shimlib.h | 2 +-
modules/rostests/apitests/appshim/layer_hooks.c | 9 +++++++++
4 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/dll/appcompat/shims/layer/forcedxsetupsuccess.c
b/dll/appcompat/shims/layer/forcedxsetupsuccess.c
index 7ffcedbe60..7b22182da8 100644
--- a/dll/appcompat/shims/layer/forcedxsetupsuccess.c
+++ b/dll/appcompat/shims/layer/forcedxsetupsuccess.c
@@ -19,7 +19,7 @@ typedef FARPROC(WINAPI* GETPROCADDRESSPROC)(HMODULE hModule, LPCSTR
lpProcName);
typedef BOOL (WINAPI* FREELIBRARYPROC)(HINSTANCE hLibModule);
-#define SHIM_NS ForceDxSetupSuccess
+#define SHIM_NS ForceDXSetupSuccess
#include <setup_shim.inl>
diff --git a/dll/appcompat/shims/shimlib/shimlib.c
b/dll/appcompat/shims/shimlib/shimlib.c
index fa3b22675e..7ab8aa86e3 100644
--- a/dll/appcompat/shims/shimlib/shimlib.c
+++ b/dll/appcompat/shims/shimlib/shimlib.c
@@ -69,9 +69,9 @@ PCSTR ShimLib_StringDuplicateA(PCSTR szString)
return ShimLib_StringNDuplicateA(szString, lstrlenA(szString) + 1);
}
-BOOL ShimLib_StrAEqualsW(PCSTR szString, PCWSTR wszString)
+BOOL ShimLib_StrAEqualsWNC(PCSTR szString, PCWSTR wszString)
{
- while (*szString == *wszString)
+ while (toupper(*szString) == towupper(*wszString))
{
if (!*szString)
return TRUE;
@@ -116,7 +116,7 @@ PHOOKAPI WINAPI ShimLib_GetHookAPIs(IN LPCSTR szCommandLine, IN
LPCWSTR wszShimN
{
if (ps->GetHookAPIs != NULL && ps->ShimName != NULL)
{
- if (ShimLib_StrAEqualsW(ps->ShimName, wszShimName))
+ if (ShimLib_StrAEqualsWNC(ps->ShimName, wszShimName))
{
pUsedShim shim = (pUsedShim)ShimLib_ShimMalloc(sizeof(UsedShim));
shim->pShim = ps;
diff --git a/dll/appcompat/shims/shimlib/shimlib.h
b/dll/appcompat/shims/shimlib/shimlib.h
index 0f016ac205..0bda8bd8d2 100644
--- a/dll/appcompat/shims/shimlib/shimlib.h
+++ b/dll/appcompat/shims/shimlib/shimlib.h
@@ -27,7 +27,7 @@ PVOID ShimLib_ShimMalloc(SIZE_T dwSize);
VOID ShimLib_ShimFree(PVOID pData);
PCSTR ShimLib_StringDuplicateA(PCSTR szString);
PCSTR ShimLib_StringNDuplicateA(PCSTR szString, SIZE_T stringLength);
-BOOL ShimLib_StrAEqualsW(PCSTR szString, PCWSTR wszString);
+BOOL ShimLib_StrAEqualsWNC(PCSTR szString, PCWSTR wszString);
HINSTANCE ShimLib_Instance(VOID);
/* Forward events to generic handlers */
diff --git a/modules/rostests/apitests/appshim/layer_hooks.c
b/modules/rostests/apitests/appshim/layer_hooks.c
index 715de78df2..1a0126b311 100644
--- a/modules/rostests/apitests/appshim/layer_hooks.c
+++ b/modules/rostests/apitests/appshim/layer_hooks.c
@@ -53,6 +53,15 @@ static expect_shim_data data[] =
{ "KERNEL32.DLL", "VerifyVersionInfoW" },
}
},
+ /* Show that it is not case sensitive */
+ {
+ L"VeRiFyVeRsIoNInFoLiTe",
+ 0,
+ {
+ { "KERNEL32.DLL", "VerifyVersionInfoA" },
+ { "KERNEL32.DLL", "VerifyVersionInfoW" },
+ }
+ },
};
static DWORD count_shims(expect_shim_data* data)