From ea4d756cbdefd545da69785ef75b7561653e1cd7 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 2 Apr 2019 16:52:01 +0200 Subject: [PATCH] krnl386.exe16: Don't use strncasecmp. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/krnl386.exe16/atom.c | 6 +++--- dlls/krnl386.exe16/ne_module.c | 2 +- dlls/krnl386.exe16/resource.c | 8 ++++---- dlls/krnl386.exe16/snoop.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/krnl386.exe16/atom.c b/dlls/krnl386.exe16/atom.c index a0595615482..23ef717c7b6 100644 --- a/dlls/krnl386.exe16/atom.c +++ b/dlls/krnl386.exe16/atom.c @@ -108,7 +108,7 @@ static WORD ATOM_Hash( TRACE("%x, %s, %x\n", entries, str, len); - for (i = 0; i < len; i++) hash ^= toupper(str[i]) + i; + for (i = 0; i < len; i++) hash ^= RtlUpperChar(str[i]) + i; return hash % entries; } @@ -223,7 +223,7 @@ ATOM WINAPI AddAtom16( LPCSTR str ) { entryPtr = ATOM_MakePtr( entry ); if ((entryPtr->length == len) && - (!strncasecmp( entryPtr->str, buffer, len ))) + (!_strnicmp( entryPtr->str, buffer, len ))) { entryPtr->refCount++; TRACE("-- existing 0x%x\n", entry); @@ -310,7 +310,7 @@ ATOM WINAPI FindAtom16( LPCSTR str ) { ATOMENTRY * entryPtr = ATOM_MakePtr( entry ); if ((entryPtr->length == len) && - (!strncasecmp( entryPtr->str, str, len ))) + (!_strnicmp( entryPtr->str, str, len ))) { TRACE("-- found %x\n", entry); return HANDLETOATOM( entry ); diff --git a/dlls/krnl386.exe16/ne_module.c b/dlls/krnl386.exe16/ne_module.c index d494585203b..0d343aa8779 100644 --- a/dlls/krnl386.exe16/ne_module.c +++ b/dlls/krnl386.exe16/ne_module.c @@ -1455,7 +1455,7 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name ) if (pModule->ne_flags & NE_FFLAGS_WIN32) continue; name_table = (BYTE *)pModule + pModule->ne_restab; - /* FIXME: the strncasecmp is WRONG. It should not be case insensitive, + /* FIXME: the _strnicmp is WRONG. It should not be case insensitive, * but case sensitive! (Unfortunately Winword 6 and subdlls have * lowercased module names, but try to load uppercase DLLs, so this * 'i' compare is just a quickfix until the loader handles that diff --git a/dlls/krnl386.exe16/resource.c b/dlls/krnl386.exe16/resource.c index 2f606fabe74..42a6d143a34 100644 --- a/dlls/krnl386.exe16/resource.c +++ b/dlls/krnl386.exe16/resource.c @@ -213,7 +213,7 @@ static DWORD NE_FindNameTableId( NE_MODULE *pModule, LPCSTR typeId, LPCSTR resId if (p[1] & 0x8000) { if (!HIWORD(typeId)) continue; - if (strcasecmp( typeId, (char *)(p + 3) )) continue; + if (_strnicmp( typeId, (char *)(p + 3), -1 )) continue; } else if (HIWORD(typeId) || (((DWORD)typeId & ~0x8000)!= p[1])) continue; @@ -223,7 +223,7 @@ static DWORD NE_FindNameTableId( NE_MODULE *pModule, LPCSTR typeId, LPCSTR resId if (p[2] & 0x8000) { if (!HIWORD(resId)) continue; - if (strcasecmp( resId, (char*)(p+3)+strlen((char*)(p+3))+1 )) continue; + if (_strnicmp( resId, (char*)(p+3)+strlen((char*)(p+3))+1, -1 )) continue; } else if (HIWORD(resId) || ((LOWORD(resId) & ~0x8000) != p[2])) @@ -261,7 +261,7 @@ static NE_TYPEINFO *NE_FindTypeSection( LPBYTE pResTab, NE_TYPEINFO *pTypeInfo, if (!(pTypeInfo->type_id & 0x8000)) { BYTE *p = pResTab + pTypeInfo->type_id; - if ((*p == len) && !strncasecmp( (char*)p+1, str, len )) + if ((*p == len) && !_strnicmp( (char*)p+1, str, len )) { TRACE(" Found type '%s'\n", str ); return pTypeInfo; @@ -308,7 +308,7 @@ static NE_NAMEINFO *NE_FindResourceFromType( LPBYTE pResTab, NE_TYPEINFO *pTypeI { if (pNameInfo->id & 0x8000) continue; p = pResTab + pNameInfo->id; - if ((*p == len) && !strncasecmp( (char*)p+1, str, len )) + if ((*p == len) && !_strnicmp( (char*)p+1, str, len )) return pNameInfo; } } diff --git a/dlls/krnl386.exe16/snoop.c b/dlls/krnl386.exe16/snoop.c index 4496080dadb..af06e35701b 100644 --- a/dlls/krnl386.exe16/snoop.c +++ b/dlls/krnl386.exe16/snoop.c @@ -224,7 +224,7 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) { if (strchr(fun->name,'_')) { char *s=strchr(fun->name,'_'); - if (!strncasecmp(s,"_thunkdata",10)) { + if (!_strnicmp(s,"_thunkdata",10)) { HeapFree(GetProcessHeap(),0,fun->name); fun->name = NULL; return origfun;