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
This commit is contained in:
wj32
2009-01-15 00:11:27 +00:00
parent 07ab959d06
commit 3bc331b047
7 changed files with 106 additions and 66 deletions
@@ -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;
+54 -40
View File
@@ -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;
}
}
+3 -1
View File
@@ -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;
+21 -18
View File
@@ -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)
{
+12
View File
@@ -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;
}
}
}
}
@@ -212,5 +212,8 @@
<Setting Name="ColorPackedProcesses" Type="System.Drawing.Color" Scope="User">
<Value Profile="(Default)">DeepPink</Value>
</Setting>
<Setting Name="VerifySignatures" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>
+3
View File
@@ -217,6 +217,9 @@
<setting name="ColorPackedProcesses" serializeAs="String">
<value>DeepPink</value>
</setting>
<setting name="VerifySignatures" serializeAs="String">
<value>True</value>
</setting>
</ProcessHacker.Properties.Settings>
</userSettings>
</configuration>