diff --git a/trunk/CHANGELOG.txt b/trunk/CHANGELOG.txt index 8d95db663..b4c3d83e4 100644 --- a/trunk/CHANGELOG.txt +++ b/trunk/CHANGELOG.txt @@ -18,6 +18,8 @@ Process Hacker * Windows 7 RC BSOD (Windows 7 Beta is no longer supported) at startup; support is STILL EXPERIMENTAL * Memory search addresses being in decimal + * Disabling "Warn about dangerous actions" now disables all + process-related prompts 1.3.8.0 * NEW/IMPROVED: diff --git a/trunk/ProcessHacker.Native/Api/Functions.cs b/trunk/ProcessHacker.Native/Api/Functions.cs index 4f7931c29..24195bf81 100644 --- a/trunk/ProcessHacker.Native/Api/Functions.cs +++ b/trunk/ProcessHacker.Native/Api/Functions.cs @@ -1466,29 +1466,10 @@ namespace ProcessHacker.Native.Api [DllImport("wtsapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool WTSQuerySessionInformation( - [In] IntPtr ServerHandle, - [In] int SessionID, - [In] WtsInformationClass InfoClass, - [Out] out IntPtr Buffer, - [Out] out int BytesReturned - ); - - [DllImport("wtsapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool WTSQuerySessionInformation( - [In] IntPtr ServerHandle, - [In] int SessionID, - [In] WtsInformationClass InfoClass, - [Out] out string Buffer, - [Out] out int BytesReturned - ); - - [DllImport("wtsapi32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool WTSLogoffSession( - [In] IntPtr ServerHandle, - [In] int SessionID, + public static extern bool WTSConnectSession( + [In] int LogonId, + [In] int TargetLogonId, + [In] string Password, [In] bool Wait ); @@ -1496,16 +1477,18 @@ namespace ProcessHacker.Native.Api [return: MarshalAs(UnmanagedType.Bool)] public static extern bool WTSDisconnectSession( [In] IntPtr ServerHandle, - [In] int SessionID, + [In] int SessionId, [In] bool Wait ); - [DllImport("wtsapi32.dll", SetLastError = true)] + [DllImport("wtsapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool WTSTerminateProcess( + public static extern bool WTSEnumerateProcesses( [In] IntPtr ServerHandle, - [In] int ProcessID, - [In] int ExitCode + [In] int Reserved, + [In] int Version, + [Out] out IntPtr ProcessInfo, + [Out] out int Count ); [DllImport("wtsapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] @@ -1518,25 +1501,50 @@ namespace ProcessHacker.Native.Api [Out] out int Count ); - [DllImport("wtsapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool WTSEnumerateProcesses( - [In] IntPtr ServerHandle, - [In] int Reserved, - [In] int Version, - [Out] out IntPtr ProcessInfo, - [Out] out int Count - ); - [DllImport("wtsapi32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool WTSFreeMemory( [In] IntPtr Memory ); + [DllImport("wtsapi32.dll", SetLastError = true)] + public static extern int WTSGetActiveConsoleSessionId(); + [DllImport("wtsapi32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool WTSFreeMemory([In] string Memory); + public static extern bool WTSLogoffSession( + [In] IntPtr ServerHandle, + [In] int SessionId, + [In] bool Wait + ); + + [DllImport("wtsapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool WTSQuerySessionInformation( + [In] IntPtr ServerHandle, + [In] int SessionId, + [In] WtsInformationClass InfoClass, + [Out] out IntPtr Buffer, + [Out] out int BytesReturned + ); + + [DllImport("wtsapi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool WTSQuerySessionInformation( + [In] IntPtr ServerHandle, + [In] int SessionId, + [In] WtsInformationClass InfoClass, + [Out] out string Buffer, + [Out] out int BytesReturned + ); + + [DllImport("wtsapi32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool WTSTerminateProcess( + [In] IntPtr ServerHandle, + [In] int ProcessId, + [In] int ExitCode + ); #endregion diff --git a/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs b/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs index e43974971..491023d6b 100644 --- a/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs +++ b/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs @@ -60,6 +60,7 @@ this.checkHideHandlesWithNoName = new System.Windows.Forms.CheckBox(); this.checkVerifySignatures = new System.Windows.Forms.CheckBox(); this.tabHighlighting = new System.Windows.Forms.TabPage(); + this.label11 = new System.Windows.Forms.Label(); this.buttonDisableAll = new System.Windows.Forms.Button(); this.buttonEnableAll = new System.Windows.Forms.Button(); this.label5 = new System.Windows.Forms.Label(); @@ -97,7 +98,6 @@ this.toolTipProvider = new System.Windows.Forms.ToolTip(this.components); this.buttonCancel = new System.Windows.Forms.Button(); this.buttonApply = new System.Windows.Forms.Button(); - this.label11 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.textUpdateInterval)).BeginInit(); this.tabControl.SuspendLayout(); this.tabGeneral.SuspendLayout(); @@ -184,8 +184,8 @@ this.checkWarnDangerous.Size = new System.Drawing.Size(228, 18); this.checkWarnDangerous.TabIndex = 4; this.checkWarnDangerous.Text = "Warn about potentially dangerous actions"; - this.toolTipProvider.SetToolTip(this.checkWarnDangerous, "Warns about any attempts to suspend a system process or inspect a system process\'" + - " thread."); + this.toolTipProvider.SetToolTip(this.checkWarnDangerous, "Warns about any attempts to terminate a process, suspend a system process, and si" + + "milar actions."); this.checkWarnDangerous.UseVisualStyleBackColor = true; // // label2 @@ -546,6 +546,15 @@ this.tabHighlighting.Text = "Highlighting"; this.tabHighlighting.UseVisualStyleBackColor = true; // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(6, 295); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(165, 13); + this.label11.TabIndex = 13; + this.label11.Text = "Double-click an item to change it."; + // // buttonDisableAll // this.buttonDisableAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -960,15 +969,6 @@ this.buttonApply.UseVisualStyleBackColor = true; this.buttonApply.Click += new System.EventHandler(this.buttonApply_Click); // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(6, 295); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(165, 13); - this.label11.TabIndex = 13; - this.label11.Text = "Double-click an item to change it."; - // // OptionsWindow // this.AcceptButton = this.buttonOK; diff --git a/trunk/ProcessHacker/UI/Actions/ProcessActions.cs b/trunk/ProcessHacker/UI/Actions/ProcessActions.cs index 9528f462e..d7a9bba3a 100644 --- a/trunk/ProcessHacker/UI/Actions/ProcessActions.cs +++ b/trunk/ProcessHacker/UI/Actions/ProcessActions.cs @@ -36,6 +36,9 @@ namespace ProcessHacker.UI.Actions private static bool Prompt(IWin32Window window, int[] pids, string[] names, string action, string content, bool promptOnlyIfDangerous) { + if (!Properties.Settings.Default.WarnDangerous) + return true; + string name = "the selected process(es)"; if (pids.Length == 1)