[SHIMENG] Find shims case-insensitive
authorMark Jansen <mark.jansen@reactos.org>
Mon, 11 Mar 2019 21:46:18 +0000 (22:46 +0100)
committerMark Jansen <mark.jansen@reactos.org>
Thu, 14 Mar 2019 19:02:00 +0000 (20:02 +0100)
CORE-15845

dll/appcompat/shims/layer/forcedxsetupsuccess.c
dll/appcompat/shims/shimlib/shimlib.c
dll/appcompat/shims/shimlib/shimlib.h
modules/rostests/apitests/appshim/layer_hooks.c

index 7ffcedb..7b22182 100644 (file)
@@ -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>
 
 
index fa3b226..7ab8aa8 100644 (file)
@@ -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;
index 0f016ac..0bda8bd 100644 (file)
@@ -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 */
index 715de78..1a0126b 100644 (file)
@@ -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)