/// <summary>
 /// Get a list of all accessible resource manager objects owned by this transaction manager.
 /// </summary>
 /// <param name="desired_access">The access for the resource manager objects.</param>
 /// <returns>The list of all accessible resource manager objects.</returns>
 public IEnumerable <NtResourceManager> GetAccessibleResourceManager(ResourceManagerAccessRights desired_access)
 {
     return(NtTransactionManagerUtils.GetAccessibleTransactionObjects(
                Handle,
                KtmObjectType.ResourceManager,
                id => NtResourceManager.Open(null, desired_access, this, id, false)));
 }
 /// <summary>
 /// Open a existing new enlistment object.
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="resource_manager">Resource manager handling the enlistment.</param>
 /// <param name="enlistment_guid">ID of the enlistment to open.</param>
 /// <returns>The opened enlistment.</returns>
 public static NtEnlistment Open(
     ObjectAttributes object_attributes,
     EnlistmentAccessRights desired_access,
     NtResourceManager resource_manager,
     Guid enlistment_guid
     )
 {
     return(Open(object_attributes, desired_access, resource_manager, enlistment_guid, true).Result);
 }
 /// <summary>
 /// Open a existing new enlistment object.
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="resource_manager">Resource manager handling the enlistment.</param>
 /// <param name="enlistment_guid">ID of the enlistment to open.</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <returns>The opened enlistment and NT status code.</returns>
 public static NtResult <NtEnlistment> Open(
     ObjectAttributes object_attributes,
     EnlistmentAccessRights desired_access,
     NtResourceManager resource_manager,
     Guid enlistment_guid,
     bool throw_on_error
     )
 {
     return(NtSystemCalls.NtOpenEnlistment(out SafeKernelObjectHandle handle,
                                           desired_access, resource_manager.GetHandle(),
                                           ref enlistment_guid, object_attributes).CreateResult(throw_on_error, () => new NtEnlistment(handle)));
 }
 /// <summary>
 /// Create a new enlistment object.
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="resource_manager">Resource manager to handle the enlistment.</param>
 /// <param name="transaction">The transaction to enlist.</param>
 /// <param name="create_options">Optional create options.</param>
 /// <param name="notification_mask">Notification mask.</param>
 /// <param name="enlistment_key">Enlistment key returned during notification.</param>
 /// <returns>The created enlistment.</returns>
 public static NtEnlistment Create(
     ObjectAttributes object_attributes,
     EnlistmentAccessRights desired_access,
     NtResourceManager resource_manager,
     NtTransaction transaction,
     EnlistmentCreateOptions create_options,
     TransactionNotificationMask notification_mask,
     IntPtr enlistment_key
     )
 {
     return(Create(object_attributes, desired_access,
                   resource_manager, transaction,
                   create_options, notification_mask,
                   enlistment_key, true).Result);
 }
 /// <summary>
 /// Create a new enlistment object.
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="resource_manager">Resource manager to handle the enlistment.</param>
 /// <param name="transaction">The transaction to enlist.</param>
 /// <param name="create_options">Optional create options.</param>
 /// <param name="notification_mask">Notification mask.</param>
 /// <param name="enlistment_key">Enlistment key returned during notification.</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <returns>The created enlistment and NT status code.</returns>
 public static NtResult <NtEnlistment> Create(
     ObjectAttributes object_attributes,
     EnlistmentAccessRights desired_access,
     NtResourceManager resource_manager,
     NtTransaction transaction,
     EnlistmentCreateOptions create_options,
     TransactionNotificationMask notification_mask,
     IntPtr enlistment_key,
     bool throw_on_error
     )
 {
     return(NtSystemCalls.NtCreateEnlistment(out SafeKernelObjectHandle handle,
                                             desired_access,
                                             resource_manager.GetHandle(),
                                             transaction.GetHandle(),
                                             object_attributes,
                                             create_options,
                                             notification_mask,
                                             enlistment_key).CreateResult(throw_on_error, () => new NtEnlistment(handle)));
 }
 /// <summary>
 /// Create a resource manager for this transaction manager.
 /// </summary>
 /// <param name="resource_manager_guid">The resource manager GUID to assign.</param>
 /// <param name="create_options">Creation options.</param>
 /// <param name="throw_on_error">True to throw on error.</param>
 /// <returns>The resource manager and NT status.</returns>
 public NtResult <NtResourceManager> CreateResourceManager(Guid resource_manager_guid, ResourceManagerCreateOptions create_options, bool throw_on_error)
 {
     return(NtResourceManager.Create(null, ResourceManagerAccessRights.MaximumAllowed, this, resource_manager_guid, create_options, null, throw_on_error));
 }