summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-07-30 21:21:21 +0000
committermidipix <writeonce@midipix.org>2017-07-31 08:43:34 -0400
commit661c276ff61cf93a40829a9c120e1c6690c2ca2e (patch)
tree5133a3cb33f7b25ce555e70c8373f518d0cfc7e6 /src
parent4a2e495c3aae5ba119844ba689c1eb282c1f49a8 (diff)
downloadntapi-661c276ff61cf93a40829a9c120e1c6690c2ca2e.tar.bz2
ntapi-661c276ff61cf93a40829a9c120e1c6690c2ca2e.tar.xz
subsystem interfaces: integrated ipc object directory handlers.
Diffstat (limited to 'src')
-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
3 files changed, 98 insertions, 1 deletions
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);
+}