summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-11-07 21:45:50 -0500
committermidipix <writeonce@midipix.org>2016-11-07 22:41:02 -0500
commit0e78645878fb98861eeec67e72c383e12d7ea35c (patch)
tree99caf9bc7cf7164b8cd9b9de3280aa3a62ae0b73
parent56548d7e7fd4703a3782c76dd08e4118a42cf7d5 (diff)
downloadntapi-0e78645878fb98861eeec67e72c383e12d7ea35c.tar.bz2
ntapi-0e78645878fb98861eeec67e72c383e12d7ea35c.tar.xz
unicode interfaces: always set addr_failed, leftover_bytes, and leftover_count.
-rw-r--r--include/ntapi/nt_unicode.h12
-rw-r--r--src/unicode/ntapi_uc_unicode_conversion_from_utf16.c8
-rw-r--r--src/unicode/ntapi_uc_unicode_conversion_from_utf8.c8
-rw-r--r--src/unicode/ntapi_uc_unicode_validation.c4
4 files changed, 24 insertions, 8 deletions
diff --git a/include/ntapi/nt_unicode.h b/include/ntapi/nt_unicode.h
index 346b744..294c2f8 100644
--- a/include/ntapi/nt_unicode.h
+++ b/include/ntapi/nt_unicode.h
@@ -41,7 +41,7 @@ typedef struct _nt_unicode_conversion_params_utf8_to_utf16 {
size_t dst_size_in_bytes;
size_t code_points;
size_t bytes_written;
- void * addr_failed;
+ const unsigned char * addr_failed;
uintptr_t leftover_count;
uintptr_t leftover_bytes;
} nt_unicode_conversion_params_utf8_to_utf16, nt_strconv_mbtonative;
@@ -54,7 +54,7 @@ typedef struct _nt_unicode_conversion_params_utf8_to_utf32 {
size_t dst_size_in_bytes;
size_t code_points;
size_t bytes_written;
- void * addr_failed;
+ const unsigned char * addr_failed;
uintptr_t leftover_count;
uintptr_t leftover_bytes;
} nt_unicode_conversion_params_utf8_to_utf32, nt_strconv_mbtowide;
@@ -67,7 +67,7 @@ typedef struct _nt_unicode_conversion_params_utf16_to_utf8 {
size_t dst_size_in_bytes;
size_t code_points;
size_t bytes_written;
- void * addr_failed;
+ const wchar16_t * addr_failed;
uintptr_t leftover_count;
uintptr_t leftover_bytes;
} nt_unicode_conversion_params_utf16_to_utf8, nt_strconv_nativetomb;
@@ -80,7 +80,7 @@ typedef struct _nt_unicode_conversion_params_utf16_to_utf32 {
size_t dst_size_in_bytes;
size_t code_points;
size_t bytes_written;
- void * addr_failed;
+ const wchar16_t * addr_failed;
uintptr_t leftover_count;
uintptr_t leftover_bytes;
} nt_unicode_conversion_params_utf16_to_utf32, nt_strconv_nativetowide;
@@ -105,7 +105,7 @@ typedef int32_t __stdcall ntapi_uc_validate_unicode_stream_utf8(
__in const unsigned char * ch,
__in size_t size_in_bytes __optional,
__out size_t * code_points __optional,
- __out void ** addr_failed __optional,
+ __out const unsigned char ** addr_failed __optional,
__in ntapi_uc_utf8_callback_fn ** callback_fn __optional,
__in nt_utf8_callback_args * callback_args __optional);
@@ -114,7 +114,7 @@ typedef int32_t __stdcall ntapi_uc_validate_unicode_stream_utf16(
__in const wchar16_t * wch,
__in size_t size_in_bytes __optional,
__out size_t * code_points __optional,
- __out void ** addr_failed __optional,
+ __out const wchar16_t ** addr_failed __optional,
__in ntapi_uc_utf16_callback_fn ** callback_fn __optional,
__in nt_utf16_callback_args * callback_args __optional);
diff --git a/src/unicode/ntapi_uc_unicode_conversion_from_utf16.c b/src/unicode/ntapi_uc_unicode_conversion_from_utf16.c
index eb8196c..f089ec0 100644
--- a/src/unicode/ntapi_uc_unicode_conversion_from_utf16.c
+++ b/src/unicode/ntapi_uc_unicode_conversion_from_utf16.c
@@ -272,7 +272,15 @@ int32_t __stdcall __ntapi_uc_convert_unicode_stream_utf16_to_utf8(
switch (status) {
case NT_STATUS_SUCCESS:
+ params->addr_failed = 0;
+ params->leftover_bytes = 0;
+ params->leftover_count = 0;
+ return status;
+
case NT_STATUS_BUFFER_TOO_SMALL:
+ params->addr_failed = args.src;
+ params->leftover_bytes = 0;
+ params->leftover_count = 0;
return status;
default:
diff --git a/src/unicode/ntapi_uc_unicode_conversion_from_utf8.c b/src/unicode/ntapi_uc_unicode_conversion_from_utf8.c
index 48eacb2..9543b71 100644
--- a/src/unicode/ntapi_uc_unicode_conversion_from_utf8.c
+++ b/src/unicode/ntapi_uc_unicode_conversion_from_utf8.c
@@ -273,7 +273,15 @@ int32_t __stdcall __ntapi_uc_convert_unicode_stream_utf8_to_utf16(
switch (status) {
case NT_STATUS_SUCCESS:
+ params->addr_failed = 0;
+ params->leftover_bytes = 0;
+ params->leftover_count = 0;
+ return status;
+
case NT_STATUS_BUFFER_TOO_SMALL:
+ params->addr_failed = args.src;
+ params->leftover_bytes = 0;
+ params->leftover_count = 0;
return status;
default:
diff --git a/src/unicode/ntapi_uc_unicode_validation.c b/src/unicode/ntapi_uc_unicode_validation.c
index dbdf4e1..35b2d50 100644
--- a/src/unicode/ntapi_uc_unicode_validation.c
+++ b/src/unicode/ntapi_uc_unicode_validation.c
@@ -108,7 +108,7 @@ int32_t __stdcall __ntapi_uc_validate_unicode_stream_utf8(
__in const unsigned char * ch,
__in size_t size_in_bytes __optional,
__out size_t * code_points __optional,
- __out void ** addr_failed __optional,
+ __out const unsigned char ** addr_failed __optional,
__in ntapi_uc_utf8_callback_fn ** callback_fn __optional,
__in nt_utf8_callback_args * callback_args __optional)
{
@@ -247,7 +247,7 @@ int32_t __stdcall __ntapi_uc_validate_unicode_stream_utf16(
__in const wchar16_t * wch,
__in size_t size_in_bytes __optional,
__out size_t * code_points __optional,
- __out void ** addr_failed __optional,
+ __out const wchar16_t ** addr_failed __optional,
__in ntapi_uc_utf16_callback_fn ** callback_fn __optional,
__in nt_utf16_callback_args * callback_args __optional)
{