internal TrustManagerMoreInformation(TrustManagerPromptOptions options, String publisherName) { InitializeComponent(); this.Font = SystemFonts.MessageBoxFont; lblMachineAccess.Font = lblPublisher.Font = lblInstallation.Font = lblLocation.Font = new Font(lblMachineAccess.Font, FontStyle.Bold); FillContent(options, publisherName); }
internal TrustManagerPromptUI(string appName, string defaultBrowserExePath, string supportUrl, string deploymentUrl, string publisherName, X509Certificate2 certificate, TrustManagerPromptOptions options) { this.m_appName = appName; this.m_defaultBrowserExePath = defaultBrowserExePath; this.m_supportUrl = supportUrl; this.m_deploymentUrl = deploymentUrl; this.m_publisherName = publisherName; this.m_certificate = certificate; this.m_options = options; InitializeComponent(); LoadResources(); if (AccessibilityImprovements.Level2) { // The outer pane this.tableLayoutPanelOuter.AccessibleName = string.Empty; // The "Do you want to install this application?" question pane and inner controls this.tableLayoutPanelQuestion.AccessibleName = string.Empty; this.lblQuestion.AccessibleName = this.lblQuestion.Text; this.pictureBoxQuestion.AccessibleName = SR.GetString(SR.TrustManagerPromptUI_GlobeIcon); this.pictureBoxQuestion.AccessibleRole = AccessibleRole.Graphic; // The application information pane and inner controls this.tableLayoutPanelInfo.AccessibleName = string.Empty; this.lblName.AccessibleName = SR.GetString(SR.TrustManagerPromptUI_Name); this.linkLblName.AccessibleName = this.linkLblName.Text; this.lblFrom.AccessibleName = SR.GetString(SR.TrustManagerPromptUI_From); this.linkLblFromUrl.AccessibleName = this.linkLblFromUrl.Text; this.lblPublisher.AccessibleName = SR.GetString(SR.TrustManagerPromptUI_Publisher); this.linkLblPublisher.AccessibleName = this.linkLblPublisher.Text; // The buttons pane and inner controls this.tableLayoutPanelButtons.AccessibleName = string.Empty; this.btnInstall.AccessibleName = StripOutAccelerator(this.btnInstall.Text); this.btnCancel.AccessibleName = StripOutAccelerator(this.btnCancel.Text); // The security summary pane and inner controls this.warningTextTableLayoutPanel.AccessibleName = string.Empty; this.pictureBoxWarning.AccessibleName = this.pictureBoxWarning.AccessibleDescription; this.pictureBoxWarning.AccessibleRole = AccessibleRole.Graphic; this.linkLblMoreInformation.AccessibleName = this.linkLblMoreInformation.Text; // The line separator this.lineLabel.AccessibleName = string.Empty; // Re-order panes to fix Narrator's Scan Mode navigation this.tableLayoutPanelOuter.Controls.SetChildIndex(this.tableLayoutPanelQuestion, 0); this.tableLayoutPanelOuter.Controls.SetChildIndex(this.tableLayoutPanelInfo, 1); this.tableLayoutPanelOuter.Controls.SetChildIndex(this.tableLayoutPanelButtons, 2); this.tableLayoutPanelOuter.Controls.SetChildIndex(this.warningTextTableLayoutPanel, 3); } }
internal TrustManagerMoreInformation(TrustManagerPromptOptions options, String publisherName) { InitializeComponent(); this.Font = SystemFonts.MessageBoxFont; lblMachineAccess.Font = lblPublisher.Font = lblInstallation.Font = lblLocation.Font = new Font(lblMachineAccess.Font, FontStyle.Bold); FillContent(options, publisherName); if (AccessibilityImprovements.Level2) { // The form this.AccessibleName = this.Text; // The outer panel this.tableLayoutPanel.AccessibleName = string.Empty; // Publisher this.pictureBoxPublisher.AccessibleName = this.pictureBoxPublisher.AccessibleDescription; this.pictureBoxPublisher.AccessibleRole = AccessibleRole.Graphic; this.lblPublisher.AccessibleName = this.lblPublisher.Text; this.lblPublisherContent.AccessibleName = this.lblPublisherContent.Text; // Machine Access this.pictureBoxMachineAccess.AccessibleName = this.pictureBoxMachineAccess.AccessibleDescription; this.pictureBoxMachineAccess.AccessibleRole = AccessibleRole.Graphic; this.lblMachineAccess.AccessibleName = this.lblMachineAccess.Text; this.lblMachineAccessContent.AccessibleName = this.lblMachineAccessContent.Text; // Installation this.pictureBoxInstallation.AccessibleName = this.pictureBoxInstallation.AccessibleDescription; this.pictureBoxInstallation.AccessibleRole = AccessibleRole.Graphic; this.lblInstallation.AccessibleName = this.lblInstallation.Text; this.lblInstallationContent.AccessibleName = this.lblInstallationContent.Text; // Location this.pictureBoxLocation.AccessibleName = this.pictureBoxLocation.AccessibleDescription; this.pictureBoxLocation.AccessibleRole = AccessibleRole.Graphic; this.lblLocation.AccessibleName = this.lblLocation.Text; this.lblLocationContent.AccessibleName = this.lblLocationContent.Text; // Close button this.btnClose.AccessibleName = this.btnClose.Text; // Re-order controls to fix Narrator's Scan Mode navigation this.tableLayoutPanel.Controls.SetChildIndex(this.pictureBoxPublisher, 0); this.tableLayoutPanel.Controls.SetChildIndex(this.lblPublisher, 1); this.tableLayoutPanel.Controls.SetChildIndex(this.lblPublisherContent, 2); this.tableLayoutPanel.Controls.SetChildIndex(this.pictureBoxMachineAccess, 3); this.tableLayoutPanel.Controls.SetChildIndex(this.lblMachineAccess, 4); this.tableLayoutPanel.Controls.SetChildIndex(this.lblMachineAccessContent, 5); this.tableLayoutPanel.Controls.SetChildIndex(this.pictureBoxInstallation, 6); this.tableLayoutPanel.Controls.SetChildIndex(this.lblInstallation, 7); this.tableLayoutPanel.Controls.SetChildIndex(this.lblInstallationContent, 8); this.tableLayoutPanel.Controls.SetChildIndex(this.pictureBoxLocation, 9); this.tableLayoutPanel.Controls.SetChildIndex(this.lblLocation, 10); this.tableLayoutPanel.Controls.SetChildIndex(this.lblLocationContent, 11); this.tableLayoutPanel.Controls.SetChildIndex(this.btnClose, 12); } }
public TrustManagerPromptUIThread(string appName, string defaultBrowserExePath, string supportUrl, string deploymentUrl, string publisherName, X509Certificate2 certificate, TrustManagerPromptOptions options) { this.m_appName = appName; this.m_defaultBrowserExePath = defaultBrowserExePath; this.m_supportUrl = supportUrl; this.m_deploymentUrl = deploymentUrl; this.m_publisherName = publisherName; this.m_certificate = certificate; this.m_options = options; }
internal TrustManagerPromptUI(string appName, string defaultBrowserExePath, string supportUrl, string deploymentUrl, string publisherName, X509Certificate2 certificate, TrustManagerPromptOptions options) { this.m_appName = appName; this.m_defaultBrowserExePath = defaultBrowserExePath; this.m_supportUrl = supportUrl; this.m_deploymentUrl = deploymentUrl; this.m_publisherName = publisherName; this.m_certificate = certificate; this.m_options = options; this.InitializeComponent(); this.LoadResources(); }
private static ApplicationTrust BlockingPrompt(ActivationContext activationContext, ParsedData parsedData, string deploymentUrl, ApplicationSecurityInfo info, ApplicationTrustExtraInfo appTrustExtraInfo, string zoneName, bool permissionElevationRequired) { TrustManagerPromptOptions options = CompletePromptOptions(permissionElevationRequired ? (TrustManagerPromptOptions.RequiresPermissions | TrustManagerPromptOptions.StopApp) : TrustManagerPromptOptions.StopApp, appTrustExtraInfo, zoneName, info); try { new TrustManagerPromptUIThread(string.IsNullOrEmpty(parsedData.AppName) ? info.ApplicationId.Name : parsedData.AppName, DefaultBrowserExePath, parsedData.SupportUrl, GetHostFromDeploymentUrl(deploymentUrl), parsedData.AuthenticodedPublisher, parsedData.Certificate, options).ShowDialog(); } catch (Exception) { } return(CreateApplicationTrust(activationContext, info, appTrustExtraInfo, false, false)); }
private static ApplicationTrust HighRiskPrompt(ActivationContext activationContext, ParsedData parsedData, string deploymentUrl, HostContextInternal hostContextInternal, ApplicationSecurityInfo info, ApplicationTrustExtraInfo appTrustExtraInfo, string zoneName) { DialogResult no; TrustManagerPromptOptions options = CompletePromptOptions(TrustManagerPromptOptions.RequiresPermissions, appTrustExtraInfo, zoneName, info); try { no = new TrustManagerPromptUIThread(string.IsNullOrEmpty(parsedData.AppName) ? info.ApplicationId.Name : parsedData.AppName, DefaultBrowserExePath, parsedData.SupportUrl, GetHostFromDeploymentUrl(deploymentUrl), parsedData.AuthenticodedPublisher, parsedData.Certificate, options).ShowDialog(); } catch (Exception) { no = DialogResult.No; } return(CreateApplicationTrust(activationContext, info, appTrustExtraInfo, no == DialogResult.OK, hostContextInternal.Persist && (no == DialogResult.OK))); }
private static TrustManagerPromptOptions CompletePromptOptions(TrustManagerPromptOptions options, ApplicationTrustExtraInfo appTrustExtraInfo, string zoneName, ApplicationSecurityInfo info) { if (appTrustExtraInfo.RequestsShellIntegration) { options |= TrustManagerPromptOptions.AddsShortcut; } if (zoneName != null) { if (string.Compare(zoneName, "Internet", true, CultureInfo.InvariantCulture) == 0) { options |= TrustManagerPromptOptions.InternetSource; } else if (string.Compare(zoneName, "TrustedSites", true, CultureInfo.InvariantCulture) == 0) { options |= TrustManagerPromptOptions.TrustedSitesSource; } else if (string.Compare(zoneName, "UntrustedSites", true, CultureInfo.InvariantCulture) == 0) { options |= TrustManagerPromptOptions.UntrustedSitesSource; } else if (string.Compare(zoneName, "LocalIntranet", true, CultureInfo.InvariantCulture) == 0) { options |= TrustManagerPromptOptions.LocalNetworkSource; } else if (string.Compare(zoneName, "MyComputer", true, CultureInfo.InvariantCulture) == 0) { options |= TrustManagerPromptOptions.LocalComputerSource; } } if (info != null) { PermissionSet defaultRequestSet = info.DefaultRequestSet; if ((defaultRequestSet != null) && defaultRequestSet.IsUnrestricted()) { options |= TrustManagerPromptOptions.WillHaveFullTrust; } } return(options); }
private static TrustManagerPromptOptions CompletePromptOptions(TrustManagerPromptOptions options, ApplicationTrustExtraInfo appTrustExtraInfo, string zoneName, ApplicationSecurityInfo info) { if (appTrustExtraInfo.RequestsShellIntegration) { options |= TrustManagerPromptOptions.AddsShortcut; } if (zoneName != null) { if (string.Compare(zoneName, "Internet", true, CultureInfo.InvariantCulture) == 0) { options |= TrustManagerPromptOptions.InternetSource; } else if (string.Compare(zoneName, "TrustedSites", true, CultureInfo.InvariantCulture) == 0) { options |= TrustManagerPromptOptions.TrustedSitesSource; } else if (string.Compare(zoneName, "UntrustedSites", true, CultureInfo.InvariantCulture) == 0) { options |= TrustManagerPromptOptions.UntrustedSitesSource; } else if (string.Compare(zoneName, "LocalIntranet", true, CultureInfo.InvariantCulture) == 0) { options |= TrustManagerPromptOptions.LocalNetworkSource; } else if (string.Compare(zoneName, "MyComputer", true, CultureInfo.InvariantCulture) == 0) { options |= TrustManagerPromptOptions.LocalComputerSource; } } if (info != null) { PermissionSet pset = info.DefaultRequestSet; if (pset != null && pset.IsUnrestricted()) { options |= TrustManagerPromptOptions.WillHaveFullTrust; } } return options; }
private void FillContent(TrustManagerPromptOptions options, String publisherName) { LoadWarningBitmap((publisherName == null) ? TrustManagerWarningLevel.Red : TrustManagerWarningLevel.Green, this.pictureBoxPublisher); LoadWarningBitmap(((options & (TrustManagerPromptOptions.RequiresPermissions | TrustManagerPromptOptions.WillHaveFullTrust)) != 0) ? TrustManagerWarningLevel.Red : TrustManagerWarningLevel.Green, this.pictureBoxMachineAccess); LoadWarningBitmap(((options & TrustManagerPromptOptions.AddsShortcut) != 0) ? TrustManagerWarningLevel.Yellow : TrustManagerWarningLevel.Green, this.pictureBoxInstallation); TrustManagerWarningLevel locationWarningLevel; if ((options & (TrustManagerPromptOptions.LocalNetworkSource | TrustManagerPromptOptions.LocalComputerSource | TrustManagerPromptOptions.TrustedSitesSource)) != 0) { locationWarningLevel = TrustManagerWarningLevel.Green; } else if ((options & TrustManagerPromptOptions.UntrustedSitesSource) != 0) { locationWarningLevel = TrustManagerWarningLevel.Red; } else { Debug.Assert((options & TrustManagerPromptOptions.InternetSource) != 0); locationWarningLevel = TrustManagerWarningLevel.Yellow; } LoadWarningBitmap(locationWarningLevel, this.pictureBoxLocation); if (publisherName == null) { this.lblPublisherContent.Text = SR.GetString(SR.TrustManagerMoreInfo_UnknownPublisher); } else { this.lblPublisherContent.Text = SR.GetString(SR.TrustManagerMoreInfo_KnownPublisher, publisherName); } if ((options & (TrustManagerPromptOptions.RequiresPermissions | TrustManagerPromptOptions.WillHaveFullTrust)) != 0) { this.lblMachineAccessContent.Text = SR.GetString(SR.TrustManagerMoreInfo_UnsafeAccess); } else { this.lblMachineAccessContent.Text = SR.GetString(SR.TrustManagerMoreInfo_SafeAccess); } if ((options & TrustManagerPromptOptions.AddsShortcut) != 0) { this.Text = SR.GetString(SR.TrustManagerMoreInfo_InstallTitle); this.lblInstallationContent.Text = SR.GetString(SR.TrustManagerMoreInfo_WithShortcut); } else { this.Text = SR.GetString(SR.TrustManagerMoreInfo_RunTitle); this.lblInstallationContent.Text = SR.GetString(SR.TrustManagerMoreInfo_WithoutShortcut); } string source; if ((options & TrustManagerPromptOptions.LocalNetworkSource) != 0) { source = SR.GetString(SR.TrustManagerMoreInfo_LocalNetworkSource); } else if ((options & TrustManagerPromptOptions.LocalComputerSource) != 0) { source = SR.GetString(SR.TrustManagerMoreInfo_LocalComputerSource); } else if ((options & TrustManagerPromptOptions.InternetSource) != 0) { source = SR.GetString(SR.TrustManagerMoreInfo_InternetSource); } else if ((options & TrustManagerPromptOptions.TrustedSitesSource) != 0) { source = SR.GetString(SR.TrustManagerMoreInfo_TrustedSitesSource); } else { Debug.Assert((options & TrustManagerPromptOptions.UntrustedSitesSource) != 0); source = SR.GetString(SR.TrustManagerMoreInfo_UntrustedSitesSource); } this.lblLocationContent.Text = SR.GetString(SR.TrustManagerMoreInfo_Location, source); }
private void FillContent(TrustManagerPromptOptions options, string publisherName) { TrustManagerWarningLevel green; string str; LoadWarningBitmap((publisherName == null) ? TrustManagerWarningLevel.Red : TrustManagerWarningLevel.Green, this.pictureBoxPublisher); LoadWarningBitmap(((options & (TrustManagerPromptOptions.WillHaveFullTrust | TrustManagerPromptOptions.RequiresPermissions)) != TrustManagerPromptOptions.None) ? TrustManagerWarningLevel.Red : TrustManagerWarningLevel.Green, this.pictureBoxMachineAccess); LoadWarningBitmap(((options & TrustManagerPromptOptions.AddsShortcut) != TrustManagerPromptOptions.None) ? TrustManagerWarningLevel.Yellow : TrustManagerWarningLevel.Green, this.pictureBoxInstallation); if ((options & (TrustManagerPromptOptions.TrustedSitesSource | TrustManagerPromptOptions.LocalComputerSource | TrustManagerPromptOptions.LocalNetworkSource)) != TrustManagerPromptOptions.None) { green = TrustManagerWarningLevel.Green; } else if ((options & TrustManagerPromptOptions.UntrustedSitesSource) != TrustManagerPromptOptions.None) { green = TrustManagerWarningLevel.Red; } else { green = TrustManagerWarningLevel.Yellow; } LoadWarningBitmap(green, this.pictureBoxLocation); if (publisherName == null) { this.lblPublisherContent.Text = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_UnknownPublisher"); } else { this.lblPublisherContent.Text = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_KnownPublisher", new object[] { publisherName }); } if ((options & (TrustManagerPromptOptions.WillHaveFullTrust | TrustManagerPromptOptions.RequiresPermissions)) != TrustManagerPromptOptions.None) { this.lblMachineAccessContent.Text = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_UnsafeAccess"); } else { this.lblMachineAccessContent.Text = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_SafeAccess"); } if ((options & TrustManagerPromptOptions.AddsShortcut) != TrustManagerPromptOptions.None) { this.Text = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_InstallTitle"); this.lblInstallationContent.Text = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_WithShortcut"); } else { this.Text = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_RunTitle"); this.lblInstallationContent.Text = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_WithoutShortcut"); } if ((options & TrustManagerPromptOptions.LocalNetworkSource) != TrustManagerPromptOptions.None) { str = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_LocalNetworkSource"); } else if ((options & TrustManagerPromptOptions.LocalComputerSource) != TrustManagerPromptOptions.None) { str = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_LocalComputerSource"); } else if ((options & TrustManagerPromptOptions.InternetSource) != TrustManagerPromptOptions.None) { str = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_InternetSource"); } else if ((options & TrustManagerPromptOptions.TrustedSitesSource) != TrustManagerPromptOptions.None) { str = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_TrustedSitesSource"); } else { str = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_UntrustedSitesSource"); } this.lblLocationContent.Text = System.Windows.Forms.SR.GetString("TrustManagerMoreInfo_Location", new object[] { str }); }