コード例 #1
0
        /// <summary>
        /// Sets the designated mode flag for the current install session.
        /// </summary>
        /// <param name="mode">The type of mode to be set.</param>
        /// <param name="value">The desired value of the mode.</param>
        /// <exception cref="InvalidHandleException">the Session handle is invalid</exception>
        /// <exception cref="ArgumentOutOfRangeException">an invalid mode flag was specified</exception>
        /// <exception cref="InvalidOperationException">the mode cannot not be set</exception>
        /// <remarks><p>
        /// Win32 MSI API:
        /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisetmode.asp">MsiSetMode</a>
        /// </p></remarks>
        public void SetMode(InstallRunMode mode, bool value)
        {
            this.ValidateSessionAccess();

            uint ret = RemotableNativeMethods.MsiSetMode((int)this.Handle, (uint)mode, value);

            if (ret != 0)
            {
                if (ret == (uint)NativeMethods.Error.ACCESS_DENIED)
                {
                    throw new InvalidOperationException();
                }
                else
                {
                    throw InstallerException.ExceptionFromReturnCode(ret);
                }
            }
        }
コード例 #2
0
ファイル: Session.cs プロジェクト: jonnybest/coapp
        /// <summary>
        /// Sets the designated mode flag for the current install session.
        /// </summary>
        /// <param name="mode">The type of mode to be set.</param>
        /// <param name="value">The desired value of the mode.</param>
        /// <exception cref="InvalidHandleException">the Session handle is invalid</exception>
        /// <exception cref="ArgumentOutOfRangeException">an invalid mode flag was specified</exception>
        /// <exception cref="InvalidOperationException">the mode cannot not be set</exception>
        /// <remarks><p>
        /// Win32 MSI API:
        /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisetmode.asp">MsiSetMode</a>
        /// </p></remarks>
        internal void SetMode(InstallRunMode mode, bool value)
        {
            this.ValidateSessionAccess();

            uint ret = RemotableNativeMethods.MsiSetMode((int) this.Handle, (uint) mode, value);
            if (ret != 0)
            {
                if (ret == (uint) NativeMethods.Error.ACCESS_DENIED)
                {
                    throw new InvalidOperationException();
                }
                else
                {
                    throw InstallerException.ExceptionFromReturnCode(ret);
                }
            }
        }
コード例 #3
0
 /// <summary>
 /// Gets the designated mode flag for the current install session.
 /// </summary>
 /// <param name="mode">The type of mode to be checked.</param>
 /// <returns>The value of the designated mode flag.</returns>
 /// <exception cref="InvalidHandleException">the Session handle is invalid</exception>
 /// <exception cref="ArgumentOutOfRangeException">an invalid mode flag was specified</exception>
 /// <remarks><p>
 /// Note that only the following run modes are available to read from
 /// a deferred custom action:<list type="bullet">
 /// <item><description><see cref="InstallRunMode.Scheduled"/></description></item>
 /// <item><description><see cref="InstallRunMode.Rollback"/></description></item>
 /// <item><description><see cref="InstallRunMode.Commit"/></description></item>
 /// </list>
 /// </p><p>
 /// Win32 MSI API:
 /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msigetmode.asp">MsiGetMode</a>
 /// </p></remarks>
 public bool GetMode(InstallRunMode mode)
 {
     return(RemotableNativeMethods.MsiGetMode((int)this.Handle, (uint)mode));
 }
コード例 #4
0
ファイル: Session.cs プロジェクト: jonnybest/coapp
 /// <summary>
 /// Gets the designated mode flag for the current install session.
 /// </summary>
 /// <param name="mode">The type of mode to be checked.</param>
 /// <returns>The value of the designated mode flag.</returns>
 /// <exception cref="InvalidHandleException">the Session handle is invalid</exception>
 /// <exception cref="ArgumentOutOfRangeException">an invalid mode flag was specified</exception>
 /// <remarks><p>
 /// Note that only the following run modes are available to read from
 /// a deferred custom action:<list type="bullet">
 /// <item><description><see cref="InstallRunMode.Scheduled"/></description></item>
 /// <item><description><see cref="InstallRunMode.Rollback"/></description></item>
 /// <item><description><see cref="InstallRunMode.Commit"/></description></item>
 /// </list>
 /// </p><p>
 /// Win32 MSI API:
 /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msigetmode.asp">MsiGetMode</a>
 /// </p></remarks>
 internal bool GetMode(InstallRunMode mode)
 {
     return RemotableNativeMethods.MsiGetMode((int) this.Handle, (uint) mode);
 }