public static void PushExternalUI(MsiUIHandler handler, InstallLogMode logMode) { TaskLogger.LogEnter(); IntPtr zero = IntPtr.Zero; InstallUILevel installUILevel = MsiNativeMethods.SetInternalUI(InstallUILevel.None | InstallUILevel.SourceResOnly, ref zero); if (installUILevel == InstallUILevel.NoChange) { throw new ArgumentOutOfRangeException("uiLevel", installUILevel, Strings.ExceptionInvalidUILevel); } MsiUIHandlerDelegate handlerDelegate = MsiNativeMethods.SetExternalUI(handler.UIHandlerDelegate, logMode, null); MsiUtility.uiSettings.Push(new MsiUtility.InternalUISettings(InstallUILevel.None | InstallUILevel.SourceResOnly, zero, handlerDelegate)); }
internal static extern uint EnableLog(InstallLogMode logMode, string logFile, InstallLogAttributes logAttributes);
internal static extern MsiUIHandlerDelegate SetExternalUI([MarshalAs(UnmanagedType.FunctionPtr)] MsiUIHandlerDelegate handler, InstallLogMode filter, object context);
/// <summary> /// Sets the log mode for all subsequent installations that are initiated in the calling process. /// </summary> /// <param name="logMode">Specifies the log mode.</param> /// <param name="logFile">Specifies the full path to the log file. When set to <see langword="null"/>, logging is disabled and <paramref name="logMode"/> is ignored". /// If a path is specified, <paramref name="logMode"/> must be set. /// </param> /// <param name="logAttributes">Specifies how frequently the log buffer is to be flushed.</param> /// <returns><see cref="Error.SUCCESS"/> if successful or <see cref="Error.INVALID_PARAMETER"/> if an invalid log mode was specified.</returns> public static uint EnableLog(InstallLogMode logMode, string logFile, InstallLogAttributes logAttributes) { return(NativeMethods.MsiEnableLog((uint)logMode, logFile, (uint)logAttributes)); }
/// <summary> /// Creates a new <see cref="UserInterfaceHandler"/> instance to register an external event handler to process /// install messages and triggering separate events for each type of <see cref="InstallMessage"/>. /// </summary> /// <param name="messageFilter">Specifies which messages to handle.</param> public UserInterfaceHandler(InstallLogMode messageFilter) { _previousHandler = NativeMethods.MsiSetExternalUI(Handler, (uint)messageFilter, IntPtr.Zero); }