コード例 #1
0
        public TransactionHandle(
            string name,
            ObjectFlags objectFlags,
            DirectoryHandle rootDirectory,
            Guid unitOfWorkGuid,
            TmHandle tmHandle,
            TransactionAccess access
            )
        {
            ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
            IntPtr           handle;

            try
            {
                Win32.NtOpenTransaction(
                    out handle,
                    access,
                    ref oa,
                    ref unitOfWorkGuid,
                    tmHandle ?? IntPtr.Zero
                    ).ThrowIf();
            }
            finally
            {
                oa.Dispose();
            }

            this.Handle = handle;
        }
コード例 #2
0
        public TransactionHandle(
            string name,
            ObjectFlags objectFlags,
            DirectoryHandle rootDirectory,
            Guid unitOfWorkGuid,
            TmHandle tmHandle,
            TransactionAccess access
            )
        {
            NtStatus         status;
            ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
            IntPtr           handle;

            try
            {
                if ((status = Win32.NtOpenTransaction(
                         out handle,
                         access,
                         ref oa,
                         ref unitOfWorkGuid,
                         tmHandle ?? IntPtr.Zero
                         )) >= NtStatus.Error)
                {
                    Win32.ThrowLastError(status);
                }
            }
            finally
            {
                oa.Dispose();
            }

            this.Handle = handle;
        }
コード例 #3
0
        public ResourceManagerHandle(
            string name,
            ObjectFlags objectFlags,
            DirectoryHandle rootDirectory,
            TmHandle tmHandle,
            Guid guid,
            ResourceManagerAccess access
            )
        {
            NtStatus         status;
            ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
            IntPtr           handle;

            try
            {
                if ((status = Win32.NtOpenResourceManager(
                         out handle,
                         access,
                         tmHandle,
                         ref guid,
                         ref oa
                         )) >= NtStatus.Error)
                {
                    Win32.ThrowLastError(status);
                }
            }
            finally
            {
                oa.Dispose();
            }

            this.Handle = handle;
        }
コード例 #4
0
        public ResourceManagerHandle(
            string name,
            ObjectFlags objectFlags,
            DirectoryHandle rootDirectory,
            TmHandle tmHandle,
            Guid guid,
            ResourceManagerAccess access
            )
        {
            ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
            IntPtr           handle;

            try
            {
                Win32.NtOpenResourceManager(
                    out handle,
                    access,
                    tmHandle,
                    ref guid,
                    ref oa
                    ).ThrowIf();
            }
            finally
            {
                oa.Dispose();
            }

            this.Handle = handle;
        }
コード例 #5
0
        public static TransactionHandle Create(
            TransactionAccess access,
            string name,
            ObjectFlags objectFlags,
            DirectoryHandle rootDirectory,
            Guid unitOfWorkGuid,
            TmHandle tmHandle,
            TransactionOptions createOptions,
            long timeout,
            string description
            )
        {
            NtStatus         status;
            ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
            IntPtr           handle;

            if (unitOfWorkGuid == Guid.Empty)
            {
                unitOfWorkGuid = Guid.NewGuid();
            }

            try
            {
                UnicodeString descriptionStr = new UnicodeString(description);

                try
                {
                    if ((status = Win32.NtCreateTransaction(
                             out handle,
                             access,
                             ref oa,
                             ref unitOfWorkGuid,
                             tmHandle ?? IntPtr.Zero,
                             createOptions,
                             0,
                             0,
                             ref timeout,
                             ref descriptionStr
                             )) >= NtStatus.Error)
                    {
                        Win32.Throw(status);
                    }
                }
                finally
                {
                    descriptionStr.Dispose();
                }
            }
            finally
            {
                oa.Dispose();
            }

            return(new TransactionHandle(handle, true));
        }
コード例 #6
0
        public static ResourceManagerHandle Create(
            ResourceManagerAccess access,
            string name,
            ObjectFlags objectFlags,
            DirectoryHandle rootDirectory,
            TmHandle tmHandle,
            Guid guid,
            ResourceManagerOptions createOptions,
            string description
            )
        {
            NtStatus         status;
            ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
            IntPtr           handle;

            try
            {
                UnicodeString descriptionStr = new UnicodeString(description);

                try
                {
                    if ((status = Win32.NtCreateResourceManager(
                             out handle,
                             access,
                             tmHandle,
                             ref guid,
                             ref oa,
                             createOptions,
                             ref descriptionStr
                             )) >= NtStatus.Error)
                    {
                        Win32.ThrowLastError(status);
                    }
                }
                finally
                {
                    descriptionStr.Dispose();
                }
            }
            finally
            {
                oa.Dispose();
            }

            return(new ResourceManagerHandle(handle, true));
        }
コード例 #7
0
 public static TransactionHandle Create(
     TransactionAccess access,
     TmHandle tmHandle,
     TransactionOptions createOptions,
     long timeout,
     string description
     )
 {
     return(Create(
                access,
                null,
                0,
                null,
                Guid.Empty,
                tmHandle,
                createOptions,
                timeout,
                description
                ));
 }