diff options
Diffstat (limited to 'src/object/ntapi_tt_keyed_object_directory.c')
-rw-r--r-- | src/object/ntapi_tt_keyed_object_directory.c | 95 |
1 files changed, 94 insertions, 1 deletions
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); +} |