summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-06-28 15:27:34 -0400
committermidipix <writeonce@midipix.org>2016-06-28 19:41:46 -0400
commitc30ed71d8c5375cd63d413c47f7368e2ead104c4 (patch)
tree2d2e190dfbbc42747da0c21cfc89b8f2ae2f9ea6
parent7f9f58a65c9d12370508b24799a35d78201762b5 (diff)
downloadntapi-c30ed71d8c5375cd63d413c47f7368e2ead104c4.tar.bz2
ntapi-c30ed71d8c5375cd63d413c47f7368e2ead104c4.tar.xz
string functions: added __ntapi_tt_strcmp_multibyte().
-rw-r--r--include/ntapi/nt_string.h4
-rw-r--r--include/ntapi/ntapi.h1
-rw-r--r--project/common.mk1
-rw-r--r--src/internal/ntapi.c1
-rw-r--r--src/internal/ntapi_fnapi.h1
-rw-r--r--src/string/ntapi_tt_strcmp_multibyte.c18
6 files changed, 26 insertions, 0 deletions
diff --git a/include/ntapi/nt_string.h b/include/ntapi/nt_string.h
index 93cd1f6..a44e287 100644
--- a/include/ntapi/nt_string.h
+++ b/include/ntapi/nt_string.h
@@ -43,6 +43,10 @@ typedef size_t __cdecl ntapi_tt_string_null_offset_qword(
typedef size_t __cdecl ntapi_tt_string_null_offset_ptrsize(
__in const intptr_t *str);
+typedef int __cdecl ntapi_tt_strcmp_multibyte(
+ __in const char * a,
+ __in const char * b);
+
typedef void __cdecl ntapi_tt_init_unicode_string_from_utf16(
__out nt_unicode_string * str_dest,
__in wchar16_t * str_src);
diff --git a/include/ntapi/ntapi.h b/include/ntapi/ntapi.h
index 714abf0..1b618d5 100644
--- a/include/ntapi/ntapi.h
+++ b/include/ntapi/ntapi.h
@@ -400,6 +400,7 @@ typedef struct _ntapi_vtbl {
ntapi_tt_string_null_offset_dword * tt_string_null_offset_dword;
ntapi_tt_string_null_offset_qword * tt_string_null_offset_qword;
ntapi_tt_string_null_offset_ptrsize * tt_string_null_offset_ptrsize;
+ ntapi_tt_strcmp_multibyte * tt_strcmp_multibyte;
ntapi_tt_aligned_block_memset * tt_aligned_block_memset;
ntapi_tt_aligned_block_memcpy * tt_aligned_block_memcpy;
ntapi_tt_aligned_memcpy_utf16 * tt_aligned_memcpy_utf16;
diff --git a/project/common.mk b/project/common.mk
index 45951fa..52b1a18 100644
--- a/project/common.mk
+++ b/project/common.mk
@@ -73,6 +73,7 @@ COMMON_SRCS = \
src/string/ntapi_tt_hex_utf16_to_uintptr.c \
src/string/ntapi_tt_init_unicode_string_from_utf16.c \
src/string/ntapi_tt_memcpy_utf16.c \
+ src/string/ntapi_tt_strcmp_multibyte.c \
src/string/ntapi_tt_string_null_offset.c \
src/string/ntapi_tt_uintptr_to_hex_utf16.c \
src/string/ntapi_tt_uintptr_to_hex_utf8.c \
diff --git a/src/internal/ntapi.c b/src/internal/ntapi.c
index e67bcf1..b01a52c 100644
--- a/src/internal/ntapi.c
+++ b/src/internal/ntapi.c
@@ -167,6 +167,7 @@ static int32_t __fastcall __ntapi_init_once(ntapi_vtbl ** pvtbl)
__ntapi->tt_string_null_offset_dword = __ntapi_tt_string_null_offset_dword;
__ntapi->tt_string_null_offset_qword = __ntapi_tt_string_null_offset_qword;
__ntapi->tt_string_null_offset_ptrsize = __ntapi_tt_string_null_offset_ptrsize;
+ __ntapi->tt_strcmp_multibyte = __ntapi_tt_strcmp_multibyte;
__ntapi->strlen = __ntapi_tt_string_null_offset_multibyte;
__ntapi->wcslen = __ntapi_wcslen;
__ntapi->tt_aligned_block_memset = __ntapi_tt_aligned_block_memset;
diff --git a/src/internal/ntapi_fnapi.h b/src/internal/ntapi_fnapi.h
index a7436c5..ab74d85 100644
--- a/src/internal/ntapi_fnapi.h
+++ b/src/internal/ntapi_fnapi.h
@@ -53,6 +53,7 @@ ntapi_tt_string_null_offset_short __ntapi_tt_string_null_offset_short;
ntapi_tt_string_null_offset_dword __ntapi_tt_string_null_offset_dword;
ntapi_tt_string_null_offset_qword __ntapi_tt_string_null_offset_qword;
ntapi_tt_string_null_offset_ptrsize __ntapi_tt_string_null_offset_ptrsize;
+ntapi_tt_strcmp_multibyte __ntapi_tt_strcmp_multibyte;
ntapi_wcslen __ntapi_wcslen;
ntapi_tt_aligned_block_memset __ntapi_tt_aligned_block_memset;
ntapi_tt_aligned_block_memcpy __ntapi_tt_aligned_block_memcpy;
diff --git a/src/string/ntapi_tt_strcmp_multibyte.c b/src/string/ntapi_tt_strcmp_multibyte.c
new file mode 100644
index 0000000..b6d04b2
--- /dev/null
+++ b/src/string/ntapi_tt_strcmp_multibyte.c
@@ -0,0 +1,18 @@
+/********************************************************/
+/* ntapi: Native API core library */
+/* Copyright (C) 2013--2016 Z. Gilboa */
+/* Released under GPLv2 and GPLv3; see COPYING.NTAPI. */
+/********************************************************/
+
+#include <psxtypes/psxtypes.h>
+#include <ntapi/nt_string.h>
+
+int __cdecl __ntapi_tt_strcmp_multibyte(
+ __in const char * a,
+ __in const char * b)
+{
+ for (; (*a == *b) && *a; a++, b++)
+ (void)0;
+
+ return (int)*a - (int)*b;
+}