diff options
author | midipix <writeonce@midipix.org> | 2018-06-15 08:46:42 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2018-06-15 10:38:10 -0400 |
commit | 8ca63f397a2b4c08806de38202e443f868e6b08d (patch) | |
tree | 5cdb9660c98c744e7aab84c21a092468017fb97d /src/object | |
parent | aac1ecb7acc5196664ef65a2467cbe45c097841c (diff) | |
download | ntapi-8ca63f397a2b4c08806de38202e443f868e6b08d.tar.bz2 ntapi-8ca63f397a2b4c08806de38202e443f868e6b08d.tar.xz |
keyed object directory interfaces: added ntapi_tt_keyed_object_to_key().
Diffstat (limited to 'src/object')
-rw-r--r-- | src/object/ntapi_tt_keyed_object_directory.c | 33 |
1 files changed, 33 insertions, 0 deletions
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); +} |