diff options
author | midipix <writeonce@midipix.org> | 2020-06-24 18:18:29 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2020-06-24 20:32:04 +0000 |
commit | fea48d76f9cf1296a19e7b0b863f163265fad9ac (patch) | |
tree | 4a97aad3b70317151f40b8dbb321a48ac72c7747 | |
parent | 0fda85780bd51c982622f3baf70701d4d032bbc6 (diff) | |
download | ntapi-fea48d76f9cf1296a19e7b0b863f163265fad9ac.tar.bz2 ntapi-fea48d76f9cf1296a19e7b0b863f163265fad9ac.tar.xz |
__ntapi_tt_guid_to_string_utf8(): initial implementation and integration.
-rw-r--r-- | include/ntapi/nt_guid.h | 19 | ||||
-rw-r--r-- | include/ntapi/ntapi.h | 1 | ||||
-rw-r--r-- | src/guid/ntapi_tt_guid.c | 54 | ||||
-rw-r--r-- | src/internal/ntapi.c | 1 | ||||
-rw-r--r-- | src/internal/ntapi_fnapi.h | 2 |
5 files changed, 77 insertions, 0 deletions
diff --git a/include/ntapi/nt_guid.h b/include/ntapi/nt_guid.h index d688985..bae1468 100644 --- a/include/ntapi/nt_guid.h +++ b/include/ntapi/nt_guid.h @@ -18,6 +18,21 @@ typedef struct _nt_guid_str_utf16 { wchar16_t rbrace; } nt_guid_str_utf16, nt_uuid_str_utf16; +typedef struct _nt_guid_str_utf8 { + uint8_t lbrace; + uint8_t group1[8]; + uint8_t dash1; + uint8_t group2[4]; + uint8_t dash2; + uint8_t group3[4]; + uint8_t dash3; + uint8_t group4[4]; + uint8_t dash4; + uint8_t group5[12]; + uint8_t rbrace; + uint8_t null; +} nt_guid_str_utf8, nt_uuid_str_utf8; + typedef void __fastcall ntapi_tt_guid_copy( __out nt_guid * pguid_dst, __in const nt_guid * pguid_src); @@ -34,6 +49,10 @@ typedef int32_t __fastcall ntapi_tt_string_to_guid_utf16( __in const nt_guid_str_utf16 * guid_str, __out nt_guid * guid); +typedef void __fastcall ntapi_tt_guid_to_string_utf8( + __in const nt_guid * guid, + __out nt_guid_str_utf8 * guid_str); + typedef int32_t __fastcall ntapi_tt_string_to_guid_utf8( __in const char * guid_str, __out nt_guid * guid); diff --git a/include/ntapi/ntapi.h b/include/ntapi/ntapi.h index 71d8ffb..9fcb896 100644 --- a/include/ntapi/ntapi.h +++ b/include/ntapi/ntapi.h @@ -509,6 +509,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_guid_to_string_utf8 * tt_guid_to_string_utf8; ntapi_tt_string_to_guid_utf8 * tt_string_to_guid_utf8; /* nt_sysinfo.h */ diff --git a/src/guid/ntapi_tt_guid.c b/src/guid/ntapi_tt_guid.c index 00628c3..6e8c7c4 100644 --- a/src/guid/ntapi_tt_guid.c +++ b/src/guid/ntapi_tt_guid.c @@ -214,3 +214,57 @@ int32_t __fastcall __ntapi_tt_string_to_guid_utf8( : __ntapi_tt_string_to_guid_utf16( &guid_str_utf16,guid); } + +void __fastcall __ntapi_tt_guid_to_string_utf8( + __in const nt_guid * guid, + __out nt_guid_str_utf8 * guid_str) +{ + uint16_t key; + uint8_t * ch; + + ch = &(guid_str->group5[0]); + + __ntapi_tt_uint32_to_hex_utf8( + guid->data1, + &guid_str->group1[0]); + + __ntapi_tt_uint16_to_hex_utf8( + guid->data2, + &guid_str->group2[0]); + + __ntapi_tt_uint16_to_hex_utf8( + guid->data3, + &guid_str->group3[0]); + + key = guid->data4[0] * 0x100 + guid->data4[1]; + + __ntapi_tt_uint16_to_hex_utf8( + key, + &guid_str->group4[0]); + + key = guid->data4[2] * 0x100 + guid->data4[3]; + + __ntapi_tt_uint16_to_hex_utf8( + key, + &guid_str->group5[0]); + + key = guid->data4[4] * 0x100 + guid->data4[5]; + + __ntapi_tt_uint16_to_hex_utf8( + key, + &(ch[4])); + + key = guid->data4[6] * 0x100 + guid->data4[7]; + + __ntapi_tt_uint16_to_hex_utf8( + key, + &(ch[8])); + + guid_str->lbrace = '{'; + guid_str->rbrace = '}'; + guid_str->dash1 = '-'; + guid_str->dash2 = '-'; + guid_str->dash3 = '-'; + guid_str->dash4 = '-'; + guid_str->null = 0; +} diff --git a/src/internal/ntapi.c b/src/internal/ntapi.c index 7562b35..db1c92a 100644 --- a/src/internal/ntapi.c +++ b/src/internal/ntapi.c @@ -333,6 +333,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_guid_to_string_utf8 = __ntapi_tt_guid_to_string_utf8; __ntapi->tt_string_to_guid_utf8 = __ntapi_tt_string_to_guid_utf8; /* nt_sysinfo.h */ diff --git a/src/internal/ntapi_fnapi.h b/src/internal/ntapi_fnapi.h index ca888c4..6128488 100644 --- a/src/internal/ntapi_fnapi.h +++ b/src/internal/ntapi_fnapi.h @@ -329,6 +329,8 @@ NTAPI_UFN(tt_guid_copy); NTAPI_UFN(tt_guid_compare); NTAPI_UFN(tt_guid_to_string_utf16); NTAPI_UFN(tt_string_to_guid_utf16); +NTAPI_UFN(tt_guid_to_string_utf8); +NTAPI_UFN(tt_string_to_guid_utf8); /* log */ NTAPI_UFN(log_write); |