Пример #1
0
 public static extern NtStatus NtCreateTransaction(out SafeKernelObjectHandle TransactionHandle,
                                                   TransactionAccessRights DesiredAccess, ObjectAttributes ObjectAttributes,
                                                   OptionalGuid Uow, SafeKernelObjectHandle TmHandle,
                                                   TransactionCreateFlags CreateOptions,
                                                   int IsolationLevel,
                                                   TransactionIsolationFlags IsolationFlags,
                                                   LargeInteger Timeout,
                                                   UnicodeString Description);
 /// <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);
 }
 /// <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)));
 }
Пример #4
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));
     }
 }