summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/ntapi/nt_object.h29
-rw-r--r--include/ntapi/ntapi.h2
-rw-r--r--src/internal/ntapi.c2
-rw-r--r--src/internal/ntapi_fnapi.h2
-rw-r--r--src/object/ntapi_tt_keyed_object_directory.c95
5 files changed, 129 insertions, 1 deletions
diff --git a/include/ntapi/nt_object.h b/include/ntapi/nt_object.h
index 68aa6a5..1dad1d8 100644
--- a/include/ntapi/nt_object.h
+++ b/include/ntapi/nt_object.h
@@ -378,12 +378,27 @@ typedef struct _nt_directory_basic_information {
} nt_directory_basic_information;
+typedef struct _nt_ipc_object_directory_guid {
+ wchar16_t uscore_guid;
+ wchar16_t pgrp_guid[36];
+} nt_ipc_object_directory_guid, nt_ipc_objdir_guid;
+
+
+typedef struct _nt_ipc_object_directory_name {
+ wchar16_t base_named_objects[17];
+ wchar16_t backslash;
+ wchar16_t prefix[6];
+ nt_ipc_objdir_guid objdir_guid;
+} nt_ipc_object_directory_name, nt_ipc_objdir_name;
+
+
typedef struct _nt_keyed_object_directory_guid {
wchar16_t uscore_guid;
wchar16_t pgrp_guid[36];
wchar16_t uscore_key;
} nt_keyed_object_directory_guid, nt_keyed_objdir_guid;
+
typedef struct _nt_keyed_object_directory_name {
wchar16_t base_named_objects[17];
wchar16_t backslash;
@@ -489,6 +504,20 @@ typedef int32_t __stdcall ntapi_zw_query_symbolic_link_object(
__out size_t * returned_length);
/* extension functions */
+typedef int32_t __stdcall ntapi_tt_open_ipc_object_directory(
+ __out void ** hdir,
+ __in uint32_t desired_access,
+ __in const wchar16_t prefix[6],
+ __in nt_guid * guid);
+
+typedef int32_t __stdcall ntapi_tt_create_ipc_object_directory_entry(
+ __out void ** hentry,
+ __in uint32_t desired_access,
+ __in void * hdir,
+ __in void * htarget,
+ __in nt_unicode_string * target_name,
+ __in uint32_t key);
+
typedef int32_t __stdcall ntapi_tt_create_keyed_object_directory(
__out void ** hdir,
__in uint32_t desired_access,
diff --git a/include/ntapi/ntapi.h b/include/ntapi/ntapi.h
index 5aa97bd..bf066bd 100644
--- a/include/ntapi/ntapi.h
+++ b/include/ntapi/ntapi.h
@@ -366,6 +366,8 @@ typedef struct _ntapi_vtbl {
/* extension functions */
/* nt_object.h */
+ ntapi_tt_open_ipc_object_directory * tt_open_ipc_object_directory;
+ ntapi_tt_create_ipc_object_directory_entry * tt_create_ipc_object_directory_entry;
ntapi_tt_create_keyed_object_directory * tt_create_keyed_object_directory;
ntapi_tt_open_keyed_object_directory * tt_open_keyed_object_directory;
ntapi_tt_create_keyed_object_directory_entry * tt_create_keyed_object_directory_entry;
diff --git a/src/internal/ntapi.c b/src/internal/ntapi.c
index 16c12c1..65b5c72 100644
--- a/src/internal/ntapi.c
+++ b/src/internal/ntapi.c
@@ -144,6 +144,8 @@ static int32_t __fastcall __ntapi_init_once(ntapi_vtbl ** pvtbl)
/* extension functions */
/* nt_object.h */
+ __ntapi->tt_open_ipc_object_directory = __ntapi_tt_open_ipc_object_directory;
+ __ntapi->tt_create_ipc_object_directory_entry = __ntapi_tt_create_ipc_object_directory_entry;
__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;
diff --git a/src/internal/ntapi_fnapi.h b/src/internal/ntapi_fnapi.h
index d11ef5c..09d87b6 100644
--- a/src/internal/ntapi_fnapi.h
+++ b/src/internal/ntapi_fnapi.h
@@ -23,6 +23,8 @@ typedef int32_t __stdcall ntapi_tt_create_remote_runtime_data(
typedef void ** __cdecl ntapi_tt_get_csr_port_handle_addr_by_logic(void);
/* nt_object.h */
+ntapi_tt_open_ipc_object_directory __ntapi_tt_open_ipc_object_directory;
+ntapi_tt_create_ipc_object_directory_entry __ntapi_tt_create_ipc_object_directory_entry;
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;
diff --git a/src/object/ntapi_tt_keyed_object_directory.c b/src/object/ntapi_tt_keyed_object_directory.c
index 2efb624..b2919f0 100644
--- a/src/object/ntapi_tt_keyed_object_directory.c
+++ b/src/object/ntapi_tt_keyed_object_directory.c
@@ -18,6 +18,62 @@ static nt_keyed_objdir_name __template_name = {__NT_BASED_NAMED_OBJECTS,
{0,{0},0},
{0}};
+
+static int32_t __stdcall __tt_create_ipc_object_directory(
+ __out void ** hdir,
+ __in uint32_t desired_access,
+ __in const wchar16_t prefix[6],
+ __in nt_guid * guid)
+{
+ int32_t status;
+ nt_ipc_objdir_name objdir_name;
+ nt_unicode_string name;
+ nt_oa oa;
+ nt_sqos sqos = {
+ sizeof(sqos),
+ NT_SECURITY_IMPERSONATION,
+ NT_SECURITY_TRACKING_DYNAMIC,
+ 1};
+
+ __ntapi->tt_generic_memcpy(
+ &objdir_name,
+ &__template_name,
+ sizeof(objdir_name));
+
+ __ntapi->tt_memcpy_utf16(
+ objdir_name.prefix,
+ prefix,
+ sizeof(objdir_name.prefix));
+
+ __ntapi->tt_guid_to_string_utf16(
+ guid,
+ (nt_guid_str_utf16 *)&objdir_name.objdir_guid);
+
+ objdir_name.backslash = '\\';
+ objdir_name.objdir_guid.uscore_guid = '_';
+
+ name.strlen = sizeof(objdir_name);
+ name.maxlen = 0;
+ name.buffer = (uint16_t *)&objdir_name;
+
+ oa.len = sizeof(oa);
+ oa.root_dir = 0;
+ oa.obj_name = &name;
+ oa.obj_attr = NT_OBJ_INHERIT
+ | NT_OBJ_OPENIF
+ | NT_OBJ_CASE_INSENSITIVE;
+ oa.sec_desc = 0;
+ oa.sec_qos = &sqos;
+
+ status = __ntapi->zw_create_directory_object(
+ hdir,desired_access,&oa);
+
+ return (status == NT_STATUS_OBJECT_NAME_EXISTS)
+ ? NT_STATUS_SUCCESS
+ : status;
+}
+
+
static int32_t __stdcall __tt_create_keyed_object_directory(
__out void ** hdir,
__in uint32_t desired_access,
@@ -71,7 +127,7 @@ static int32_t __stdcall __tt_create_keyed_object_directory(
}
-int32_t __stdcall __ntapi_tt_create_keyed_object_directory_entry(
+static int32_t __stdcall __tt_create_object_directory_entry(
__out void ** hentry,
__in uint32_t desired_access,
__in void * hdir,
@@ -118,6 +174,30 @@ int32_t __stdcall __ntapi_tt_create_keyed_object_directory_entry(
&oa,target_name);
}
+int32_t __stdcall __ntapi_tt_open_ipc_object_directory(
+ __out void ** hdir,
+ __in uint32_t desired_access,
+ __in const wchar16_t prefix[6],
+ __in nt_guid * guid)
+{
+ return __tt_create_ipc_object_directory(
+ hdir,desired_access,
+ prefix,guid);
+}
+
+int32_t __stdcall __ntapi_tt_create_ipc_object_directory_entry(
+ __out void ** hentry,
+ __in uint32_t desired_access,
+ __in void * hdir,
+ __in void * htarget,
+ __in nt_unicode_string * target_name,
+ __in uint32_t key)
+{
+ return __tt_create_object_directory_entry(
+ hentry,desired_access,
+ hdir,htarget,target_name,key);
+}
+
int32_t __stdcall __ntapi_tt_create_keyed_object_directory(
__out void ** hdir,
__in uint32_t desired_access,
@@ -143,3 +223,16 @@ int32_t __stdcall __ntapi_tt_open_keyed_object_directory(
prefix,guid,key,
__ntapi->zw_open_directory_object);
}
+
+int32_t __stdcall __ntapi_tt_create_keyed_object_directory_entry(
+ __out void ** hentry,
+ __in uint32_t desired_access,
+ __in void * hdir,
+ __in void * htarget,
+ __in nt_unicode_string * target_name,
+ __in uint32_t key)
+{
+ return __tt_create_object_directory_entry(
+ hentry,desired_access,
+ hdir,htarget,target_name,key);
+}