From 3bc331b047bfa42eef6a3ae67601369ef205418d Mon Sep 17 00:00:00 2001 From: wj32 Date: Thu, 15 Jan 2009 00:11:27 +0000 Subject: [PATCH] add option for whether to verify or not git-svn-id: svn://svn.code.sf.net/p/processhacker/code@498 21ef857c-d57f-4fe0-8362-d861dc6d29cd --- .../ProcessTree/ProcessToolTipProvider.cs | 17 ++-- .../Forms/OptionsWindow.Designer.cs | 94 +++++++++++-------- trunk/ProcessHacker/Forms/OptionsWindow.cs | 4 +- trunk/ProcessHacker/Forms/ProcessWindow.cs | 39 ++++---- .../Properties/Settings.Designer.cs | 12 +++ .../Properties/Settings.settings | 3 + trunk/ProcessHacker/app.config | 3 + 7 files changed, 106 insertions(+), 66 deletions(-) diff --git a/trunk/ProcessHacker/Components/ProcessTree/ProcessToolTipProvider.cs b/trunk/ProcessHacker/Components/ProcessTree/ProcessToolTipProvider.cs index 5d7e40e65..d44affe25 100644 --- a/trunk/ProcessHacker/Components/ProcessTree/ProcessToolTipProvider.cs +++ b/trunk/ProcessHacker/Components/ProcessTree/ProcessToolTipProvider.cs @@ -123,14 +123,17 @@ namespace ProcessHacker else if (pNode.ProcessItem.IsPacked) otherNotes += "\n Image is probably packed - error reading PE file."; - var verifyResult = Win32.VerifyFile(pNode.ProcessItem.FileName); + if (Properties.Settings.Default.VerifySignatures) + { + var verifyResult = Win32.VerifyFile(pNode.ProcessItem.FileName); - if (verifyResult == Win32.VerifyResult.Trusted) - otherNotes += "\n Signature present and verified."; - else if (verifyResult == Win32.VerifyResult.TrustedInstaller) - otherNotes += "\n File is a Windows component."; - else if (verifyResult != Win32.VerifyResult.NoSignature) - otherNotes += "\n Signature present but invalid."; + if (verifyResult == Win32.VerifyResult.Trusted) + otherNotes += "\n Signature present and verified."; + else if (verifyResult == Win32.VerifyResult.TrustedInstaller) + otherNotes += "\n File is a Windows component."; + else if (verifyResult != Win32.VerifyResult.NoSignature) + otherNotes += "\n Signature present but invalid."; + } if (otherNotes != "") otherNotes = "\nNotes:" + otherNotes; diff --git a/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs b/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs index 51410eec3..3bc6f1590 100644 --- a/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs +++ b/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs @@ -42,7 +42,11 @@ this.checkHideWhenMinimized = new System.Windows.Forms.CheckBox(); this.checkShowTrayIcon = new System.Windows.Forms.CheckBox(); this.tabHighlighting = new System.Windows.Forms.TabPage(); + this.label20 = new System.Windows.Forms.Label(); + this.label19 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); + this.colorPackedProcesses = new ProcessHacker.Components.ColorModifier(); + this.colorDotNetProcesses = new ProcessHacker.Components.ColorModifier(); this.colorJobProcesses = new ProcessHacker.Components.ColorModifier(); this.label10 = new System.Windows.Forms.Label(); this.colorElevatedProcesses = new ProcessHacker.Components.ColorModifier(); @@ -74,10 +78,7 @@ this.label16 = new System.Windows.Forms.Label(); this.colorCPUKT = new ProcessHacker.Components.ColorModifier(); this.label17 = new System.Windows.Forms.Label(); - this.colorDotNetProcesses = new ProcessHacker.Components.ColorModifier(); - this.label19 = new System.Windows.Forms.Label(); - this.colorPackedProcesses = new ProcessHacker.Components.ColorModifier(); - this.label20 = new System.Windows.Forms.Label(); + this.checkVerifySignatures = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.textUpdateInterval)).BeginInit(); this.tabControl.SuspendLayout(); this.tabGeneral.SuspendLayout(); @@ -127,7 +128,7 @@ // this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonClose.FlatStyle = System.Windows.Forms.FlatStyle.System; - this.buttonClose.Location = new System.Drawing.Point(362, 243); + this.buttonClose.Location = new System.Drawing.Point(362, 257); this.buttonClose.Name = "buttonClose"; this.buttonClose.Size = new System.Drawing.Size(75, 23); this.buttonClose.TabIndex = 2; @@ -186,7 +187,7 @@ this.tabControl.Location = new System.Drawing.Point(12, 12); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size(425, 225); + this.tabControl.Size = new System.Drawing.Size(425, 239); this.tabControl.TabIndex = 7; // // tabGeneral @@ -199,12 +200,13 @@ this.tabGeneral.Controls.Add(this.textSearchEngine); this.tabGeneral.Controls.Add(this.textUpdateInterval); this.tabGeneral.Controls.Add(this.label2); + this.tabGeneral.Controls.Add(this.checkVerifySignatures); this.tabGeneral.Controls.Add(this.checkShowProcessDomains); this.tabGeneral.Controls.Add(this.checkWarnDangerous); this.tabGeneral.Location = new System.Drawing.Point(4, 22); this.tabGeneral.Name = "tabGeneral"; this.tabGeneral.Padding = new System.Windows.Forms.Padding(3); - this.tabGeneral.Size = new System.Drawing.Size(417, 199); + this.tabGeneral.Size = new System.Drawing.Size(417, 213); this.tabGeneral.TabIndex = 0; this.tabGeneral.Text = "General"; this.tabGeneral.UseVisualStyleBackColor = true; @@ -290,6 +292,24 @@ this.tabHighlighting.Text = "Highlighting"; this.tabHighlighting.UseVisualStyleBackColor = true; // + // label20 + // + this.label20.AutoSize = true; + this.label20.Location = new System.Drawing.Point(214, 139); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(99, 13); + this.label20.TabIndex = 9; + this.label20.Text = "Packed Processes:"; + // + // label19 + // + this.label19.AutoSize = true; + this.label19.Location = new System.Drawing.Point(214, 113); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(87, 13); + this.label19.TabIndex = 9; + this.label19.Text = ".NET Processes:"; + // // label11 // this.label11.AutoSize = true; @@ -299,6 +319,22 @@ this.label11.TabIndex = 9; this.label11.Text = "Job Processes:"; // + // colorPackedProcesses + // + this.colorPackedProcesses.Color = System.Drawing.Color.Transparent; + this.colorPackedProcesses.Location = new System.Drawing.Point(335, 137); + this.colorPackedProcesses.Name = "colorPackedProcesses"; + this.colorPackedProcesses.Size = new System.Drawing.Size(40, 20); + this.colorPackedProcesses.TabIndex = 8; + // + // colorDotNetProcesses + // + this.colorDotNetProcesses.Color = System.Drawing.Color.Transparent; + this.colorDotNetProcesses.Location = new System.Drawing.Point(335, 111); + this.colorDotNetProcesses.Name = "colorDotNetProcesses"; + this.colorDotNetProcesses.Size = new System.Drawing.Size(40, 20); + this.colorDotNetProcesses.TabIndex = 8; + // // colorJobProcesses // this.colorJobProcesses.Color = System.Drawing.Color.Transparent; @@ -588,46 +624,23 @@ this.label17.TabIndex = 10; this.label17.Text = "CPU Kernel Time:"; // - // colorDotNetProcesses + // checkVerifySignatures // - this.colorDotNetProcesses.Color = System.Drawing.Color.Transparent; - this.colorDotNetProcesses.Location = new System.Drawing.Point(335, 111); - this.colorDotNetProcesses.Name = "colorDotNetProcesses"; - this.colorDotNetProcesses.Size = new System.Drawing.Size(40, 20); - this.colorDotNetProcesses.TabIndex = 8; - // - // label19 - // - this.label19.AutoSize = true; - this.label19.Location = new System.Drawing.Point(214, 113); - this.label19.Name = "label19"; - this.label19.Size = new System.Drawing.Size(87, 13); - this.label19.TabIndex = 9; - this.label19.Text = ".NET Processes:"; - // - // colorPackedProcesses - // - this.colorPackedProcesses.Color = System.Drawing.Color.Transparent; - this.colorPackedProcesses.Location = new System.Drawing.Point(335, 137); - this.colorPackedProcesses.Name = "colorPackedProcesses"; - this.colorPackedProcesses.Size = new System.Drawing.Size(40, 20); - this.colorPackedProcesses.TabIndex = 8; - // - // label20 - // - this.label20.AutoSize = true; - this.label20.Location = new System.Drawing.Point(214, 139); - this.label20.Name = "label20"; - this.label20.Size = new System.Drawing.Size(99, 13); - this.label20.TabIndex = 9; - this.label20.Text = "Packed Processes:"; + this.checkVerifySignatures.AutoSize = true; + this.checkVerifySignatures.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.checkVerifySignatures.Location = new System.Drawing.Point(6, 183); + this.checkVerifySignatures.Name = "checkVerifySignatures"; + this.checkVerifySignatures.Size = new System.Drawing.Size(109, 18); + this.checkVerifySignatures.TabIndex = 3; + this.checkVerifySignatures.Text = "Verify signatures"; + this.checkVerifySignatures.UseVisualStyleBackColor = true; // // OptionsWindow // this.AcceptButton = this.buttonClose; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(449, 278); + this.ClientSize = new System.Drawing.Size(449, 292); this.Controls.Add(this.tabControl); this.Controls.Add(this.buttonClose); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; @@ -703,5 +716,6 @@ private System.Windows.Forms.Label label19; private ProcessHacker.Components.ColorModifier colorPackedProcesses; private ProcessHacker.Components.ColorModifier colorDotNetProcesses; + private System.Windows.Forms.CheckBox checkVerifySignatures; } } \ No newline at end of file diff --git a/trunk/ProcessHacker/Forms/OptionsWindow.cs b/trunk/ProcessHacker/Forms/OptionsWindow.cs index f611c15a7..043e32f15 100644 --- a/trunk/ProcessHacker/Forms/OptionsWindow.cs +++ b/trunk/ProcessHacker/Forms/OptionsWindow.cs @@ -46,6 +46,7 @@ namespace ProcessHacker checkShowProcessDomains.Checked = Properties.Settings.Default.ShowAccountDomains; checkShowTrayIcon.Checked = Properties.Settings.Default.ShowIcon; checkHideWhenMinimized.Checked = Properties.Settings.Default.HideWhenMinimized; + checkVerifySignatures.Checked = Properties.Settings.Default.VerifySignatures; textHighlightingDuration.Value = Properties.Settings.Default.HighlightingDuration; colorNewProcesses.Color = Properties.Settings.Default.ColorNewProcesses; @@ -90,8 +91,9 @@ namespace ProcessHacker Properties.Settings.Default.ShowAccountDomains = checkShowProcessDomains.Checked; Properties.Settings.Default.ShowIcon = checkShowTrayIcon.Checked; Properties.Settings.Default.HideWhenMinimized = checkHideWhenMinimized.Checked; - Properties.Settings.Default.UnitSpecifier = + Properties.Settings.Default.UnitSpecifier = Array.IndexOf(Misc.SizeUnitNames, comboSizeUnits.SelectedItem); + Properties.Settings.Default.VerifySignatures = checkVerifySignatures.Checked; Program.HackerWindow.NotifyIcon.Visible = Properties.Settings.Default.ShowIcon; Program.HackerWindow.ProcessProvider.Interval = Properties.Settings.Default.RefreshInterval; diff --git a/trunk/ProcessHacker/Forms/ProcessWindow.cs b/trunk/ProcessHacker/Forms/ProcessWindow.cs index 145b80de2..e98b0be79 100644 --- a/trunk/ProcessHacker/Forms/ProcessWindow.cs +++ b/trunk/ProcessHacker/Forms/ProcessWindow.cs @@ -192,25 +192,28 @@ namespace ProcessHacker try { pictureIcon.Image = Win32.GetFileIcon(fileName, true).ToBitmap(); } catch { pictureIcon.Image = global::ProcessHacker.Properties.Resources.Process.ToBitmap(); } - // verify signature - var verifyResult = Win32.VerifyFile(fileName); + if (Properties.Settings.Default.VerifySignatures) + { + // verify signature + var verifyResult = Win32.VerifyFile(fileName); - if (verifyResult == Win32.VerifyResult.Trusted) - textFileCompany.Text += " (verified)"; - else if (verifyResult == Win32.VerifyResult.TrustedInstaller) - textFileCompany.Text += " (verified, Windows component)"; - else if (verifyResult == Win32.VerifyResult.NoSignature) - textFileCompany.Text += " (not verified, no signature)"; - else if (verifyResult == Win32.VerifyResult.Distrust) - textFileCompany.Text += " (not verified, distrusted)"; - else if (verifyResult == Win32.VerifyResult.Expired) - textFileCompany.Text += " (not verified, expired)"; - else if (verifyResult == Win32.VerifyResult.Revoked) - textFileCompany.Text += " (not verified, revoked)"; - else if (verifyResult == Win32.VerifyResult.SecuritySettings) - textFileCompany.Text += " (not verified, security settings)"; - else - textFileCompany.Text += " (not verified)"; + if (verifyResult == Win32.VerifyResult.Trusted) + textFileCompany.Text += " (verified)"; + else if (verifyResult == Win32.VerifyResult.TrustedInstaller) + textFileCompany.Text += " (verified, Windows component)"; + else if (verifyResult == Win32.VerifyResult.NoSignature) + textFileCompany.Text += " (not verified, no signature)"; + else if (verifyResult == Win32.VerifyResult.Distrust) + textFileCompany.Text += " (not verified, distrusted)"; + else if (verifyResult == Win32.VerifyResult.Expired) + textFileCompany.Text += " (not verified, expired)"; + else if (verifyResult == Win32.VerifyResult.Revoked) + textFileCompany.Text += " (not verified, revoked)"; + else if (verifyResult == Win32.VerifyResult.SecuritySettings) + textFileCompany.Text += " (not verified, security settings)"; + else + textFileCompany.Text += " (not verified)"; + } } catch (Exception ex) { diff --git a/trunk/ProcessHacker/Properties/Settings.Designer.cs b/trunk/ProcessHacker/Properties/Settings.Designer.cs index 6ffb7a259..a82b26f12 100644 --- a/trunk/ProcessHacker/Properties/Settings.Designer.cs +++ b/trunk/ProcessHacker/Properties/Settings.Designer.cs @@ -862,5 +862,17 @@ namespace ProcessHacker.Properties { this["ColorPackedProcesses"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool VerifySignatures { + get { + return ((bool)(this["VerifySignatures"])); + } + set { + this["VerifySignatures"] = value; + } + } } } diff --git a/trunk/ProcessHacker/Properties/Settings.settings b/trunk/ProcessHacker/Properties/Settings.settings index df5a91fa5..cf71509b5 100644 --- a/trunk/ProcessHacker/Properties/Settings.settings +++ b/trunk/ProcessHacker/Properties/Settings.settings @@ -212,5 +212,8 @@ DeepPink + + True + \ No newline at end of file diff --git a/trunk/ProcessHacker/app.config b/trunk/ProcessHacker/app.config index 110b76eb0..27e1d85f1 100644 --- a/trunk/ProcessHacker/app.config +++ b/trunk/ProcessHacker/app.config @@ -217,6 +217,9 @@ DeepPink + + True + \ No newline at end of file