diff --git a/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs b/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs index fec321575..308ce80b6 100644 --- a/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs +++ b/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/trunk/ProcessHacker/Forms/OptionsWindow.cs b/trunk/ProcessHacker/Forms/OptionsWindow.cs index 685c7f4f5..65e28a316 100644 --- a/trunk/ProcessHacker/Forms/OptionsWindow.cs +++ b/trunk/ProcessHacker/Forms/OptionsWindow.cs @@ -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; diff --git a/trunk/ProcessHacker/KProcessHacker.cs b/trunk/ProcessHacker/KProcessHacker.cs index 1789e33a4..23cde79c5 100644 --- a/trunk/ProcessHacker/KProcessHacker.cs +++ b/trunk/ProcessHacker/KProcessHacker.cs @@ -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); diff --git a/trunk/ProcessHacker/Properties/Settings.Designer.cs b/trunk/ProcessHacker/Properties/Settings.Designer.cs index 969ffadb4..2a7c994e1 100644 --- a/trunk/ProcessHacker/Properties/Settings.Designer.cs +++ b/trunk/ProcessHacker/Properties/Settings.Designer.cs @@ -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; + } + } } } diff --git a/trunk/ProcessHacker/Properties/Settings.settings b/trunk/ProcessHacker/Properties/Settings.settings index 167783eb9..00579db6f 100644 --- a/trunk/ProcessHacker/Properties/Settings.settings +++ b/trunk/ProcessHacker/Properties/Settings.settings @@ -218,5 +218,8 @@ + + False + \ No newline at end of file diff --git a/trunk/ProcessHacker/app.config b/trunk/ProcessHacker/app.config index d69f687b0..0d1162a0d 100644 --- a/trunk/ProcessHacker/app.config +++ b/trunk/ProcessHacker/app.config @@ -223,6 +223,9 @@ + + False + \ No newline at end of file