From 8ca63f397a2b4c08806de38202e443f868e6b08d Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 15 Jun 2018 08:46:42 +0000 Subject: keyed object directory interfaces: added ntapi_tt_keyed_object_to_key(). --- src/object/ntapi_tt_keyed_object_directory.c | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/object') diff --git a/src/object/ntapi_tt_keyed_object_directory.c b/src/object/ntapi_tt_keyed_object_directory.c index 705eec9..988ed00 100644 --- a/src/object/ntapi_tt_keyed_object_directory.c +++ b/src/object/ntapi_tt_keyed_object_directory.c @@ -388,3 +388,36 @@ int32_t __stdcall __ntapi_tt_create_keyed_object_directory_entry( hentry,desired_access, hdir,htarget,target_name,key); } + +int32_t __stdcall __ntapi_tt_keyed_object_to_key( + __in void * hentry, + __out uint32_t * key, + __out void * buffer, + __in size_t buflen) +{ + int32_t status; + wchar16_t * pidname; + nt_unicode_string * dirname; + + if ((status = __ntapi->zw_query_object( + hentry, + NT_OBJECT_NAME_INFORMATION, + buffer,buflen, + &(uint32_t){0}))) + return status; + + dirname = (nt_unicode_string *)buffer; + pidname = dirname->buffer; + + if (dirname->strlen <= 8 * sizeof(wchar16_t)) + return NT_STATUS_INTERNAL_ERROR; + + pidname += dirname->strlen / sizeof(wchar16_t); + pidname -= 8; + + if (pidname[-1] != '\\') + return NT_STATUS_INVALID_PARAMETER; + + return __ntapi->tt_hex_utf16_to_uint32( + pidname,key); +} -- cgit v1.2.3