diff options
-rw-r--r-- | include/ntapi/nt_guid.h | 4 | ||||
-rw-r--r-- | include/ntapi/ntapi.h | 1 | ||||
-rw-r--r-- | src/guid/ntapi_tt_guid.c | 22 | ||||
-rw-r--r-- | src/internal/ntapi.c | 1 | ||||
-rw-r--r-- | src/internal/ntapi_fnapi.h | 1 |
5 files changed, 29 insertions, 0 deletions
diff --git a/include/ntapi/nt_guid.h b/include/ntapi/nt_guid.h index 2c27f23..d688985 100644 --- a/include/ntapi/nt_guid.h +++ b/include/ntapi/nt_guid.h @@ -34,4 +34,8 @@ typedef int32_t __fastcall ntapi_tt_string_to_guid_utf16( __in const nt_guid_str_utf16 * guid_str, __out nt_guid * guid); +typedef int32_t __fastcall ntapi_tt_string_to_guid_utf8( + __in const char * guid_str, + __out nt_guid * guid); + #endif diff --git a/include/ntapi/ntapi.h b/include/ntapi/ntapi.h index a5e91e3..63ff63f 100644 --- a/include/ntapi/ntapi.h +++ b/include/ntapi/ntapi.h @@ -502,6 +502,7 @@ typedef struct _ntapi_vtbl { ntapi_tt_guid_compare * tt_guid_compare; ntapi_tt_guid_to_string_utf16 * tt_guid_to_string_utf16; ntapi_tt_string_to_guid_utf16 * tt_string_to_guid_utf16; + ntapi_tt_string_to_guid_utf8 * tt_string_to_guid_utf8; /* nt_sysinfo.h */ ntapi_tt_get_system_directory_native_path * tt_get_system_directory_native_path; diff --git a/src/guid/ntapi_tt_guid.c b/src/guid/ntapi_tt_guid.c index 6f520fe..00628c3 100644 --- a/src/guid/ntapi_tt_guid.c +++ b/src/guid/ntapi_tt_guid.c @@ -192,3 +192,25 @@ int32_t __fastcall __ntapi_tt_string_to_guid_utf16( return NT_STATUS_SUCCESS; } + +int32_t __fastcall __ntapi_tt_string_to_guid_utf8( + __in const char * guid_str, + __out nt_guid * guid) +{ + const char * ch; + const char * cap; + wchar16_t * wch; + nt_guid_str_utf16 guid_str_utf16; + + ch = guid_str; + cap = &ch[sizeof(guid_str_utf16) / sizeof(wchar16_t)]; + wch = &guid_str_utf16.lbrace; + + for (; *ch && (ch<cap); ) + *wch++ = *ch++; + + return (ch < cap) + ? NT_STATUS_INVALID_PARAMETER + : __ntapi_tt_string_to_guid_utf16( + &guid_str_utf16,guid); +} diff --git a/src/internal/ntapi.c b/src/internal/ntapi.c index 3af78c9..1cb7dfa 100644 --- a/src/internal/ntapi.c +++ b/src/internal/ntapi.c @@ -326,6 +326,7 @@ static int32_t __fastcall __ntapi_init_once(ntapi_vtbl ** pvtbl) __ntapi->tt_guid_compare = __ntapi_tt_guid_compare; __ntapi->tt_guid_to_string_utf16 = __ntapi_tt_guid_to_string_utf16; __ntapi->tt_string_to_guid_utf16 = __ntapi_tt_string_to_guid_utf16; + __ntapi->tt_string_to_guid_utf8 = __ntapi_tt_string_to_guid_utf8; /* nt_sysinfo.h */ __ntapi->tt_get_system_directory_native_path = __ntapi_tt_get_system_directory_native_path; diff --git a/src/internal/ntapi_fnapi.h b/src/internal/ntapi_fnapi.h index 6bade8c..4121883 100644 --- a/src/internal/ntapi_fnapi.h +++ b/src/internal/ntapi_fnapi.h @@ -151,6 +151,7 @@ NTAPI_SFN(wcslen); /* nt_guid.h */ NTAPI_UFN(tt_guid_to_string_utf16); NTAPI_UFN(tt_string_to_guid_utf16); +NTAPI_UFN(tt_string_to_guid_utf8); /* nt_sysinfo.h */ NTAPI_UFN(tt_get_system_directory_native_path); |