diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/ntapi.c | 2 | ||||
-rw-r--r-- | src/internal/ntapi_fnapi.h | 2 | ||||
-rw-r--r-- | src/object/ntapi_tt_keyed_object_directory.c | 95 |
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); +} |