summaryrefslogtreecommitdiffhomepage
path: root/src/object
diff options
context:
space:
mode:
Diffstat (limited to 'src/object')
-rw-r--r--src/object/ntapi_tt_keyed_object_directory.c33
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);
+}