disable KPH by default and add an option to enable it

git-svn-id: svn://svn.code.sf.net/p/processhacker/code@531 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
wj32
2009-01-18 08:22:34 +00:00
parent e69b70caf4
commit de69f8d0ea
6 changed files with 64 additions and 4 deletions
+18 -4
View File
@@ -79,6 +79,7 @@
this.label16 = new System.Windows.Forms.Label();
this.colorCPUKT = new ProcessHacker.Components.ColorModifier();
this.label17 = new System.Windows.Forms.Label();
this.checkEnableKPH = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.textUpdateInterval)).BeginInit();
this.tabControl.SuspendLayout();
this.tabGeneral.SuspendLayout();
@@ -128,7 +129,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, 257);
this.buttonClose.Location = new System.Drawing.Point(362, 276);
this.buttonClose.Name = "buttonClose";
this.buttonClose.Size = new System.Drawing.Size(75, 23);
this.buttonClose.TabIndex = 2;
@@ -187,11 +188,12 @@
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, 239);
this.tabControl.Size = new System.Drawing.Size(425, 258);
this.tabControl.TabIndex = 7;
//
// tabGeneral
//
this.tabGeneral.Controls.Add(this.checkEnableKPH);
this.tabGeneral.Controls.Add(this.comboSizeUnits);
this.tabGeneral.Controls.Add(this.label18);
this.tabGeneral.Controls.Add(this.checkHideWhenMinimized);
@@ -206,7 +208,7 @@
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, 213);
this.tabGeneral.Size = new System.Drawing.Size(417, 232);
this.tabGeneral.TabIndex = 0;
this.tabGeneral.Text = "General";
this.tabGeneral.UseVisualStyleBackColor = true;
@@ -634,12 +636,23 @@
this.label17.TabIndex = 10;
this.label17.Text = "CPU Kernel Time:";
//
// checkEnableKPH
//
this.checkEnableKPH.AutoSize = true;
this.checkEnableKPH.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.checkEnableKPH.Location = new System.Drawing.Point(6, 207);
this.checkEnableKPH.Name = "checkEnableKPH";
this.checkEnableKPH.Size = new System.Drawing.Size(217, 18);
this.checkEnableKPH.TabIndex = 12;
this.checkEnableKPH.Text = "Enable experimental kernel-mode driver";
this.checkEnableKPH.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, 292);
this.ClientSize = new System.Drawing.Size(449, 311);
this.Controls.Add(this.tabControl);
this.Controls.Add(this.buttonClose);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
@@ -716,5 +729,6 @@
private ProcessHacker.Components.ColorModifier colorPackedProcesses;
private ProcessHacker.Components.ColorModifier colorDotNetProcesses;
private System.Windows.Forms.CheckBox checkVerifySignatures;
private System.Windows.Forms.CheckBox checkEnableKPH;
}
}
@@ -47,6 +47,7 @@ namespace ProcessHacker
checkShowTrayIcon.Checked = Properties.Settings.Default.ShowIcon;
checkHideWhenMinimized.Checked = Properties.Settings.Default.HideWhenMinimized;
checkVerifySignatures.Checked = Properties.Settings.Default.VerifySignatures;
checkEnableKPH.Checked = Properties.Settings.Default.EnableKPH;
textHighlightingDuration.Value = Properties.Settings.Default.HighlightingDuration;
colorNewProcesses.Color = Properties.Settings.Default.ColorNewProcesses;
@@ -95,6 +96,21 @@ namespace ProcessHacker
Array.IndexOf(Misc.SizeUnitNames, comboSizeUnits.SelectedItem);
Properties.Settings.Default.VerifySignatures = checkVerifySignatures.Checked;
if (checkEnableKPH.Checked && !Properties.Settings.Default.EnableKPH)
{
checkEnableKPH.Checked = MessageBox.Show("You have chosen to enable ProcessHacker's experimental kernel-mode driver, " +
"KProcessHacker. This is HIGHLY EXPERIMENTAL and MAY CAUSE YOUR COMPUTER TO CRASH.\n\n" +
"KProcessHacker allows Process Hacker to display more types of handles and bypass " +
"certain types of rootkits and security software. If you do not need these features " +
"or do not wish to use KProcessHacker, click No.\n\nIf you do wish to use this feature, " +
"KProcessHacker will be loaded the next time Process Hacker is started. If your computer " +
"crashes, the next time Process Hacker is started KProcessHacker will be disabled.",
"Process Hacker", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button2) == DialogResult.Yes;
}
Properties.Settings.Default.EnableKPH = checkEnableKPH.Checked;
Program.HackerWindow.NotifyIcon.Visible = Properties.Settings.Default.ShowIcon;
Program.HackerWindow.ProcessProvider.Interval = Properties.Settings.Default.RefreshInterval;
Program.HackerWindow.ServiceProvider.Interval = Properties.Settings.Default.RefreshInterval;
+12
View File
@@ -51,6 +51,18 @@ namespace ProcessHacker
public KProcessHacker()
{
if (!Properties.Settings.Default.EnableKPH)
throw new Exception("KProcessHacker is not enabled.");
// in case the computer crashes, KPH will be disabled the next time
// PH is started.
Properties.Settings.Default.EnableKPH = false;
try { Properties.Settings.Default.Save(); }
catch { }
Properties.Settings.Default.EnableKPH = true; // if the computer crashes, this won't actually be saved
Win32.ServiceManagerHandle scm =
new Win32.ServiceManagerHandle(Win32.SC_MANAGER_RIGHTS.SC_MANAGER_CREATE_SERVICE);
+12
View File
@@ -886,5 +886,17 @@ namespace ProcessHacker.Properties {
this["NetworkListViewColumns"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool EnableKPH {
get {
return ((bool)(this["EnableKPH"]));
}
set {
this["EnableKPH"] = value;
}
}
}
}
@@ -218,5 +218,8 @@
<Setting Name="NetworkListViewColumns" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="EnableKPH" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>
+3
View File
@@ -223,6 +223,9 @@
<setting name="NetworkListViewColumns" serializeAs="String">
<value />
</setting>
<setting name="EnableKPH" serializeAs="String">
<value>False</value>
</setting>
</ProcessHacker.Properties.Settings>
</userSettings>
</configuration>