summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-06-15 08:46:42 +0000
committermidipix <writeonce@midipix.org>2018-06-15 10:38:10 -0400
commit8ca63f397a2b4c08806de38202e443f868e6b08d (patch)
tree5cdb9660c98c744e7aab84c21a092468017fb97d /src
parentaac1ecb7acc5196664ef65a2467cbe45c097841c (diff)
downloadntapi-8ca63f397a2b4c08806de38202e443f868e6b08d.tar.bz2
ntapi-8ca63f397a2b4c08806de38202e443f868e6b08d.tar.xz
keyed object directory interfaces: added ntapi_tt_keyed_object_to_key().
Diffstat (limited to 'src')
-rw-r--r--src/internal/ntapi.c1
-rw-r--r--src/internal/ntapi_fnapi.h1
-rw-r--r--src/object/ntapi_tt_keyed_object_directory.c33
3 files changed, 35 insertions, 0 deletions
diff --git a/src/internal/ntapi.c b/src/internal/ntapi.c
index 6f6b9ce..78075b6 100644
--- a/src/internal/ntapi.c
+++ b/src/internal/ntapi.c
@@ -171,6 +171,7 @@ static int32_t __fastcall __ntapi_init_once(ntapi_vtbl ** pvtbl)
__ntapi->tt_create_keyed_object_directory = __ntapi_tt_create_keyed_object_directory;
__ntapi->tt_open_keyed_object_directory = __ntapi_tt_open_keyed_object_directory;
__ntapi->tt_create_keyed_object_directory_entry = __ntapi_tt_create_keyed_object_directory_entry;
+ __ntapi->tt_keyed_object_to_key = __ntapi_tt_keyed_object_to_key;
__ntapi->tt_sid_copy = __ntapi_tt_sid_copy;
__ntapi->tt_sid_compare = __ntapi_tt_sid_compare;
diff --git a/src/internal/ntapi_fnapi.h b/src/internal/ntapi_fnapi.h
index 9157dc1..5cea58f 100644
--- a/src/internal/ntapi_fnapi.h
+++ b/src/internal/ntapi_fnapi.h
@@ -30,6 +30,7 @@ ntapi_tt_create_dev_object_directory_entry __ntapi_tt_create_dev_object_director
ntapi_tt_create_keyed_object_directory __ntapi_tt_create_keyed_object_directory;
ntapi_tt_open_keyed_object_directory __ntapi_tt_open_keyed_object_directory;
ntapi_tt_create_keyed_object_directory_entry __ntapi_tt_create_keyed_object_directory_entry;
+ntapi_tt_keyed_object_to_key __ntapi_tt_keyed_object_to_key;
ntapi_tt_sid_copy __ntapi_tt_sid_copy;
ntapi_tt_sid_compare __ntapi_tt_sid_compare;
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);
+}