public static EnlistmentHandle Create(
            EnlistmentAccess access,
            string name,
            ObjectFlags objectFlags,
            DirectoryHandle rootDirectory,
            ResourceManagerHandle resourceManagerHandle,
            TransactionHandle transactionHandle,
            EnlistmentOptions createOptions,
            NotificationMask notificationMask,
            IntPtr enlistmentKey
            )
        {
            ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
            IntPtr           handle;

            try
            {
                Win32.NtCreateEnlistment(
                    out handle,
                    access,
                    resourceManagerHandle,
                    transactionHandle,
                    ref oa,
                    createOptions,
                    notificationMask,
                    enlistmentKey
                    ).ThrowIf();
            }
            finally
            {
                oa.Dispose();
            }

            return(new EnlistmentHandle(handle, true));
        }
        public EnlistmentHandle(
            string name,
            ObjectFlags objectFlags,
            DirectoryHandle rootDirectory,
            ResourceManagerHandle resourceManagerHandle,
            Guid guid,
            EnlistmentAccess access
            )
        {
            ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
            IntPtr           handle;

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

            this.Handle = handle;
        }
Exemplo n.º 3
0
        public EnlistmentHandle(
            string name,
            ObjectFlags objectFlags,
            DirectoryHandle rootDirectory,
            ResourceManagerHandle resourceManagerHandle,
            Guid guid,
            EnlistmentAccess access
            )
        {
            NtStatus         status;
            ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
            IntPtr           handle;

            try
            {
                if ((status = Win32.NtOpenEnlistment(
                         out handle,
                         access,
                         resourceManagerHandle,
                         ref guid,
                         ref oa
                         )) >= NtStatus.Error)
                {
                    Win32.Throw(status);
                }
            }
            finally
            {
                oa.Dispose();
            }

            this.Handle = handle;
        }