Esempio n. 1
0
 /// <summary>
 /// Create a new volatile resource manager object.
 /// </summary>
 /// <param name="path">The path to the resource manager.</param>
 /// <param name="root">The root if path is relative.</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="transaction_manager">Optional transaction manager to assign the resource manager to.</param>
 /// <returns>The object result.</returns>
 /// <exception cref="NtException">Thrown on error.</exception>
 public static NtResourceManager CreateVolatile(string path,
                                                NtObject root,
                                                ResourceManagerAccessRights desired_access,
                                                NtTransactionManager transaction_manager)
 {
     return(CreateVolatile(path, null, ResourceManagerAccessRights.MaximumAllowed,
                           transaction_manager, Guid.NewGuid()));
 }
Esempio n. 2
0
 /// <summary>
 /// Opens an existing resource manager object.
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="transaction_manager">Transaction manager which contains the resource manager.</param>
 /// <param name="resource_manager_guid">Resource manager GUID.</param>
 /// <returns>The object result.</returns>
 /// <exception cref="NtException">Thrown on error.</exception>
 public static NtResourceManager Open(ObjectAttributes object_attributes,
                                      ResourceManagerAccessRights desired_access,
                                      NtTransactionManager transaction_manager,
                                      Guid resource_manager_guid)
 {
     return(Open(object_attributes, desired_access, transaction_manager,
                 resource_manager_guid, true).Result);
 }
Esempio n. 3
0
 /// <summary>
 /// Create a new volatile resource manager object.
 /// </summary>
 /// <param name="path">The path to the resource manager.</param>
 /// <param name="root">The root if path is relative.</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="transaction_manager">Optional transaction manager to assign the resource manager to.</param>
 /// <param name="resource_manager_guid">Resource manager GUID.</param>
 /// <returns>The object result.</returns>
 /// <exception cref="NtException">Thrown on error.</exception>
 public static NtResourceManager CreateVolatile(string path,
                                                NtObject root,
                                                ResourceManagerAccessRights desired_access,
                                                NtTransactionManager transaction_manager,
                                                Guid resource_manager_guid)
 {
     return(Create(path, root, desired_access, transaction_manager,
                   resource_manager_guid, ResourceManagerCreateOptions.Volatile, null, true).Result);
 }
Esempio n. 4
0
 /// <summary>
 /// Opens an existing resource manager object.
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="transaction_manager">Transaction manager which contains the resource manager.</param>
 /// <param name="resource_manager_guid">Resource manager GUID.</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <returns>The NT status code and object result.</returns>
 public static NtResult <NtResourceManager> Open(ObjectAttributes object_attributes,
                                                 ResourceManagerAccessRights desired_access,
                                                 NtTransactionManager transaction_manager,
                                                 Guid resource_manager_guid,
                                                 bool throw_on_error)
 {
     return(NtSystemCalls.NtOpenResourceManager(out SafeKernelObjectHandle handle,
                                                desired_access, transaction_manager.GetHandle(), ref resource_manager_guid,
                                                object_attributes).CreateResult(throw_on_error, () => new NtResourceManager(handle)));
 }
Esempio n. 5
0
 /// <summary>
 /// Create a new resource manager object.
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="create_options">Creation options flags.</param>
 /// <param name="transaction_manager">Optional transaction manager to assign the resource manager to.</param>
 /// <param name="resource_manager_guid">Resource manager GUID.</param>
 /// <param name="description">Optional description.</param>
 /// <returns>The object result.</returns>
 /// <exception cref="NtException">Thrown on error.</exception>
 public static NtResourceManager Create(ObjectAttributes object_attributes,
                                        ResourceManagerAccessRights desired_access,
                                        NtTransactionManager transaction_manager,
                                        Guid resource_manager_guid,
                                        ResourceManagerCreateOptions create_options,
                                        string description)
 {
     return(Create(object_attributes, desired_access, transaction_manager,
                   resource_manager_guid, create_options, description, true).Result);
 }
Esempio n. 6
0
 /// <summary>
 /// Create a new resource manager object.
 /// </summary>
 /// <param name="path">The path to the resource manager.</param>
 /// <param name="root">The root if path is relative.</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="create_options">Creation options flags.</param>
 /// <param name="transaction_manager">Optional transaction manager to assign the resource manager to.</param>
 /// <param name="resource_manager_guid">Resource manager GUID.</param>
 /// <param name="description">Optional description.</param>
 /// <returns>The object result.</returns>
 /// <exception cref="NtException">Thrown on error.</exception>
 public static NtResourceManager Create(string path,
                                        NtObject root,
                                        ResourceManagerAccessRights desired_access,
                                        NtTransactionManager transaction_manager,
                                        Guid resource_manager_guid,
                                        ResourceManagerCreateOptions create_options = ResourceManagerCreateOptions.None,
                                        string description = null)
 {
     return(Create(path, root, desired_access, transaction_manager,
                   resource_manager_guid, create_options, description, true).Result);
 }
Esempio n. 7
0
 /// <summary>
 /// Create a new resource manager object.
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="create_options">Creation options flags.</param>
 /// <param name="transaction_manager">Optional transaction manager to assign the resource manager to.</param>
 /// <param name="resource_manager_guid">Resource manager GUID.</param>
 /// <param name="description">Optional description.</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <returns>The NT status code and object result.</returns>
 public static NtResult <NtResourceManager> Create(ObjectAttributes object_attributes,
                                                   ResourceManagerAccessRights desired_access,
                                                   NtTransactionManager transaction_manager,
                                                   Guid resource_manager_guid,
                                                   ResourceManagerCreateOptions create_options,
                                                   string description,
                                                   bool throw_on_error)
 {
     return(NtSystemCalls.NtCreateResourceManager(out SafeKernelObjectHandle handle,
                                                  desired_access, transaction_manager.GetHandle(), ref resource_manager_guid,
                                                  object_attributes, create_options, description.ToUnicodeString())
            .CreateResult(throw_on_error, () => new NtResourceManager(handle)));
 }
 /// <summary>
 /// Create a transaction
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="create_options">Transaction creation options.</param>
 /// <param name="description">Optional description of the transaction.</param>
 /// <param name="isolation_flags">Isolation flags.</param>
 /// <param name="isolation_level">Isolation level.</param>
 /// <param name="timeout">Optional transaction timeout.</param>
 /// <param name="transaction_manager">Optional transaction manager.</param>
 /// <param name="uow">Optional UOW.</param>
 /// <returns>The NT status code and object result.</returns>
 public static NtTransaction Create(ObjectAttributes object_attributes,
                                    TransactionAccessRights desired_access,
                                    Guid?uow, NtTransactionManager transaction_manager,
                                    TransactionCreateFlags create_options,
                                    int isolation_level,
                                    TransactionIsolationFlags isolation_flags,
                                    NtWaitTimeout timeout,
                                    string description)
 {
     return(Create(object_attributes, desired_access, uow,
                   transaction_manager, create_options,
                   isolation_level, isolation_flags, timeout, description, true).Result);
 }
Esempio n. 9
0
 /// <summary>
 /// Create a new resource manager object.
 /// </summary>
 /// <param name="path">The path to the resource manager.</param>
 /// <param name="root">The root if path is relative.</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="create_options">Creation options flags.</param>
 /// <param name="transaction_manager">Optional transaction manager to assign the resource manager to.</param>
 /// <param name="resource_manager_guid">Resource manager GUID.</param>
 /// <param name="description">Optional description.</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <returns>The NT status code and object result.</returns>
 public static NtResult <NtResourceManager> Create(string path,
                                                   NtObject root,
                                                   ResourceManagerAccessRights desired_access,
                                                   NtTransactionManager transaction_manager,
                                                   Guid resource_manager_guid,
                                                   ResourceManagerCreateOptions create_options,
                                                   string description,
                                                   bool throw_on_error)
 {
     using (var obj_attr = new ObjectAttributes(path, AttributeFlags.CaseInsensitive, root)) {
         return(Create(obj_attr, desired_access, transaction_manager,
                       resource_manager_guid, create_options, description, throw_on_error));
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Create a transaction
 /// </summary>
 /// <param name="path">The path of the transaction</param>
 /// <param name="root">The root if path is relative</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="create_options">Transaction creation options.</param>
 /// <param name="description">Optional description of the transaction.</param>
 /// <param name="isolation_flags">Isolation flags.</param>
 /// <param name="isolation_level">Isolation level.</param>
 /// <param name="timeout">Optional transaction timeout.</param>
 /// <param name="transaction_manager">Optional transaction manager.</param>
 /// <param name="uow">Optional UOW.</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <returns>The opened transaction</returns>
 public static NtResult <NtTransaction> Create(string path, NtObject root,
                                               TransactionAccessRights desired_access,
                                               Guid?uow, NtTransactionManager transaction_manager,
                                               TransactionCreateFlags create_options,
                                               int isolation_level,
                                               TransactionIsolationFlags isolation_flags,
                                               NtWaitTimeout timeout,
                                               string description,
                                               bool throw_on_error)
 {
     using (ObjectAttributes obja = new ObjectAttributes(path, AttributeFlags.CaseInsensitive, root)) {
         return(Create(obja, desired_access, uow, transaction_manager,
                       create_options, isolation_level, isolation_flags,
                       timeout, description, throw_on_error));
     }
 }
 /// <summary>
 /// Create a transaction
 /// </summary>
 /// <param name="object_attributes">The object attributes</param>
 /// <param name="desired_access">Desired access for the handle</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <param name="create_options">Transaction creation options.</param>
 /// <param name="description">Optional description of the transaction.</param>
 /// <param name="isolation_flags">Isolation flags.</param>
 /// <param name="isolation_level">Isolation level.</param>
 /// <param name="timeout">Optional transaction timeout.</param>
 /// <param name="transaction_manager">Optional transaction manager.</param>
 /// <param name="uow">Optional UOW.</param>
 /// <returns>The NT status code and object result.</returns>
 public static NtResult <NtTransaction> Create(ObjectAttributes object_attributes,
                                               TransactionAccessRights desired_access,
                                               Guid?uow, NtTransactionManager transaction_manager,
                                               TransactionCreateFlags create_options,
                                               int isolation_level,
                                               TransactionIsolationFlags isolation_flags,
                                               NtWaitTimeout timeout,
                                               string description,
                                               bool throw_on_error)
 {
     return(NtSystemCalls.NtCreateTransaction(out SafeKernelObjectHandle handle,
                                              desired_access, object_attributes, uow.ToOptional(),
                                              transaction_manager.GetHandle(), create_options,
                                              isolation_level, isolation_flags, timeout.ToLargeInteger(), description.ToUnicodeString())
            .CreateResult(throw_on_error, () => new NtTransaction(handle)));
 }
Esempio n. 12
0
 /// <summary>
 /// Open a transaction object.
 /// </summary>
 /// <param name="desired_access">The desired access for the object</param>
 /// <param name="transaction_manager">Optional transaction manager.</param>
 /// <param name="uow">UOW Guid.</param>
 /// <returns>The object result.</returns>
 public static NtTransaction Open(TransactionAccessRights desired_access,
                                  Guid uow, NtTransactionManager transaction_manager)
 {
     return(Open(null, desired_access, uow, transaction_manager));
 }
Esempio n. 13
0
 /// <summary>
 /// Open a transaction object.
 /// </summary>
 /// <param name="transaction_manager">Optional transaction manager.</param>
 /// <param name="uow">UOW Guid.</param>
 /// <returns>The object result.</returns>
 public static NtTransaction Open(Guid uow, NtTransactionManager transaction_manager)
 {
     return(Open(TransactionAccessRights.MaximumAllowed, uow, transaction_manager));
 }
Esempio n. 14
0
 /// <summary>
 /// Get a list of all accessible transaction objects.
 /// </summary>
 /// <param name="object_attributes">The object attributes for the object</param>
 /// <param name="transaction_manager">Optional transaction manager.</param>
 /// <param name="desired_access">The access for the transaction objects.</param>
 /// <returns>The list of all accessible transaction objects.</returns>
 public static IEnumerable <NtTransaction> GetAccessibleTransaction(ObjectAttributes object_attributes,
                                                                    TransactionAccessRights desired_access, NtTransactionManager transaction_manager)
 {
     return(NtTransactionManagerUtils.GetAccessibleTransactionObjects(
                transaction_manager.GetHandle(), KtmObjectType.Transaction,
                id => Open(object_attributes, desired_access, id, transaction_manager, false)));
 }
Esempio n. 15
0
 /// <summary>
 /// Create a new volatile resource manager object.
 /// </summary>
 /// <param name="transaction_manager">Optional transaction manager to assign the resource manager to.</param>
 /// <returns>The object result.</returns>
 /// <exception cref="NtException">Thrown on error.</exception>
 public static NtResourceManager CreateVolatile(NtTransactionManager transaction_manager)
 {
     return(CreateVolatile(null, transaction_manager));
 }
Esempio n. 16
0
 /// <summary>
 /// Create a new volatile resource manager object.
 /// </summary>
 /// <param name="path">The path to the resource manager.</param>
 /// <param name="transaction_manager">Optional transaction manager to assign the resource manager to.</param>
 /// <returns>The object result.</returns>
 /// <exception cref="NtException">Thrown on error.</exception>
 public static NtResourceManager CreateVolatile(string path,
                                                NtTransactionManager transaction_manager)
 {
     return(CreateVolatile(path, null, transaction_manager));
 }
 /// <summary>
 /// Open a transaction object.
 /// </summary>
 /// <param name="object_attributes">The object attributes for the object</param>
 /// <param name="desired_access">The desired access for the object</param>
 /// <param name="transaction_manager">Optional transaction manager.</param>
 /// <param name="uow">UOW Guid.</param>
 /// <param name="throw_on_error">True to throw an exception on error.</param>
 /// <returns>The NT status code and object result.</returns>
 public static NtResult <NtTransaction> Open(ObjectAttributes object_attributes, TransactionAccessRights desired_access,
                                             Guid?uow, NtTransactionManager transaction_manager, bool throw_on_error)
 {
     return(NtSystemCalls.NtOpenTransaction(out SafeKernelObjectHandle handle, desired_access, object_attributes,
                                            uow.ToOptional(), transaction_manager.GetHandle()).CreateResult(throw_on_error, () => new NtTransaction(handle)));
 }
 /// <summary>
 /// Open a transaction object.
 /// </summary>
 /// <param name="object_attributes">The object attributes for the object</param>
 /// <param name="desired_access">The desired access for the object</param>
 /// <param name="transaction_manager">Optional transaction manager.</param>
 /// <param name="uow">UOW Guid.</param>
 /// <returns>The NT status code and object result.</returns>
 public static NtTransaction Open(ObjectAttributes object_attributes, TransactionAccessRights desired_access,
                                  Guid?uow, NtTransactionManager transaction_manager)
 {
     return(Open(object_attributes, desired_access, uow, transaction_manager, true).Result);
 }
 protected override sealed NtResult <NtTransactionManager> OpenInternal(ObjectAttributes obj_attributes,
                                                                        TransactionManagerAccessRights desired_access, bool throw_on_error)
 {
     return(NtTransactionManager.Open(obj_attributes, desired_access,
                                      null, null, TransactionManagerOpenOptions.None, throw_on_error));
 }