[SHIMENG] Find shims case-insensitive

CORE-15845
This commit is contained in:
Mark Jansen 2019-03-11 22:46:18 +01:00
parent cdc8b721da
commit 0ebeced143
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
4 changed files with 14 additions and 5 deletions

View 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>

View 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;

View 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 */

View 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)