Piotr Caban : kernel32: Don't use strcasecmp.

Alexandre Julliard julliard at winehq.org
Wed Mar 27 17:27:37 CDT 2019


Module: wine
Branch: master
Commit: 2eb1849100e741f3d936bf3f2d52ea09367f9867
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2eb1849100e741f3d936bf3f2d52ea09367f9867

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Mar 27 14:08:12 2019 +0100

kernel32: Don't use strcasecmp.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/locale.c    | 2 +-
 dlls/kernel32/oldconfig.c | 4 ++--
 dlls/ntdll/ntdll.spec     | 2 +-
 include/winternl.h        | 2 ++
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index ed7543e..00006d4 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -339,7 +339,7 @@ static const union cptable *get_codepage_table( unsigned int codepage )
 static int charset_cmp( const void *name, const void *entry )
 {
     const struct charset_entry *charset = entry;
-    return strcasecmp( name, charset->charset_name );
+    return _strnicmp( name, charset->charset_name, -1 );
 }
 
 /***********************************************************************
diff --git a/dlls/kernel32/oldconfig.c b/dlls/kernel32/oldconfig.c
index 219ecc5..dcce1aa 100644
--- a/dlls/kernel32/oldconfig.c
+++ b/dlls/kernel32/oldconfig.c
@@ -301,8 +301,8 @@ static void create_hardware_branch(void)
                     fgets(cStr, sizeof(cStr), procfile);
                     fclose(procfile);
                     nType = DRIVE_UNKNOWN;
-                    if (strncasecmp(cStr, "disk", 4)  == 0) nType = DRIVE_FIXED;
-                    if (strncasecmp(cStr, "cdrom", 5) == 0) nType = DRIVE_CDROM;
+                    if (_strnicmp(cStr, "disk", 4)  == 0) nType = DRIVE_FIXED;
+                    if (_strnicmp(cStr, "cdrom", 5) == 0) nType = DRIVE_CDROM;
 
                     if (nType == DRIVE_UNKNOWN) continue;
                 }
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 6062cfb..0ff695a 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1391,7 +1391,7 @@
 @ cdecl -private _strcmpi(str str) _stricmp
 @ cdecl -private _stricmp(str str)
 @ cdecl -private _strlwr(str)
-@ cdecl -private _strnicmp(str str long)
+@ cdecl _strnicmp(str str long) #add _strnicmp to importlib so it can be used instead of strncasecmp
 @ cdecl -private _strupr(str)
 @ cdecl -private _tolower(long) NTDLL__tolower
 @ cdecl -private _toupper(long) NTDLL__toupper
diff --git a/include/winternl.h b/include/winternl.h
index 147cb1d..2b3fb94 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2886,6 +2886,8 @@ NTSYSAPI NTSTATUS  WINAPI RtlpUnWaitCriticalSection(RTL_CRITICAL_SECTION *);
 NTSYSAPI NTSTATUS  WINAPI vDbgPrintEx(ULONG,ULONG,LPCSTR,__ms_va_list);
 NTSYSAPI NTSTATUS  WINAPI vDbgPrintExWithPrefix(LPCSTR,ULONG,ULONG,LPCSTR,__ms_va_list);
 
+NTSYSAPI int __cdecl _strnicmp(LPCSTR,LPCSTR,size_t);
+
 /* 32-bit only functions */
 
 #ifndef _WIN64




More information about the wine-cvs mailing list