diff --git a/trunk/CHANGELOG.txt b/trunk/CHANGELOG.txt
index a6c8fbabf..1548012a6 100644
--- a/trunk/CHANGELOG.txt
+++ b/trunk/CHANGELOG.txt
@@ -16,6 +16,7 @@ Process Hacker
* Thread wait analysis now detects NtQueryObject hangs
* Better file object names without KProcessHacker
* Better IP address resolving
+ * Child windows float by default
* Automatic tree text coloring, allowing for dark highlighting
colors
* Small performance improvements
diff --git a/trunk/ProcessHacker.Native/Api/Enums.cs b/trunk/ProcessHacker.Native/Api/Enums.cs
index 432683f1f..f355c8288 100644
--- a/trunk/ProcessHacker.Native/Api/Enums.cs
+++ b/trunk/ProcessHacker.Native/Api/Enums.cs
@@ -184,6 +184,17 @@ namespace ProcessHacker.Native.Api
DcPen
}
+ public enum GetWindowLongOffset : int
+ {
+ WndProc = -4,
+ HInstance = -6,
+ HwndParent = -8,
+ Id = -12,
+ Style = -16,
+ ExStyle = -20,
+ UserData = -21
+ }
+
[Flags]
public enum HeapEntry32Flags : int
{
diff --git a/trunk/ProcessHacker.Native/Api/Functions.cs b/trunk/ProcessHacker.Native/Api/Functions.cs
index f88d6db18..7dd7686db 100644
--- a/trunk/ProcessHacker.Native/Api/Functions.cs
+++ b/trunk/ProcessHacker.Native/Api/Functions.cs
@@ -2252,32 +2252,36 @@ namespace ProcessHacker.Native.Api
[In] int exitCode
);
- [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
-#if(_WIN64)
- private static extern IntPtr SetWindowLongPtr(
- [In] IntPtr hWnd,
- [In] int index,
- [In] [MarshalAs(UnmanagedType.FunctionPtr)] WndProcDelegate windowCallback
- );
+#if _WIN64
+ [DllImport("user32.dll", SetLastError = true, EntryPoint = "SetWindowLongPtr", CharSet = CharSet.Auto)]
#else
- private static extern IntPtr SetWindowLong(
- [In] IntPtr hWnd,
- [In] int index,
- [In] [MarshalAs(UnmanagedType.FunctionPtr)] WndProcDelegate windowCallback
- );
-#endif
-
[DllImport("user32.dll", SetLastError = true, EntryPoint = "SetWindowLong", CharSet = CharSet.Auto)]
- public static extern IntPtr SetWindowLongStyle(
+#endif
+ private static extern IntPtr SetWindowLongPtr(
[In] IntPtr hWnd,
- [In] int index,
- [In] WindowStyles style
+ [In] GetWindowLongOffset Index,
+ [In] [MarshalAs(UnmanagedType.FunctionPtr)] WndProcDelegate WndProc
);
- [DllImport("user32.dll", SetLastError = true, EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)]
- public static extern WindowStyles GetWindowLongStyle(
+#if _WIN64
+ [DllImport("user32.dll", SetLastError = true, EntryPoint = "SetWindowLongPtr", CharSet = CharSet.Auto)]
+#else
+ [DllImport("user32.dll", SetLastError = true, EntryPoint = "SetWindowLong", CharSet = CharSet.Auto)]
+#endif
+ public static extern IntPtr SetWindowLongPtr(
[In] IntPtr hWnd,
- [In] int index
+ [In] GetWindowLongOffset Index,
+ [In] IntPtr NewLong
+ );
+
+#if _WIN64
+ [DllImport("user32.dll", SetLastError = true, EntryPoint = "GetWindowLongPtr", CharSet = CharSet.Auto)]
+#else
+ [DllImport("user32.dll", SetLastError = true, EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)]
+#endif
+ public static extern IntPtr GetWindowLongPtr(
+ [In] IntPtr hWnd,
+ [In] GetWindowLongOffset Index
);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
diff --git a/trunk/ProcessHacker.Native/Api/NativeDefinitions.cs b/trunk/ProcessHacker.Native/Api/NativeDefinitions.cs
index 1703f9271..3ff4797c1 100644
--- a/trunk/ProcessHacker.Native/Api/NativeDefinitions.cs
+++ b/trunk/ProcessHacker.Native/Api/NativeDefinitions.cs
@@ -33,7 +33,7 @@ namespace ProcessHacker.Native.Api
{
public const int ExceptionMaximumParameters = 15;
public const int FlsMaximumAvailable = 128;
-#if _X64
+#if _WIN64
public const int GdiHandleBufferSize = 60;
#else
public const int GdiHandleBufferSize = 34;
diff --git a/trunk/ProcessHacker/Forms/HackerWindow.cs b/trunk/ProcessHacker/Forms/HackerWindow.cs
index ffa006e1f..cedf1fe2d 100644
--- a/trunk/ProcessHacker/Forms/HackerWindow.cs
+++ b/trunk/ProcessHacker/Forms/HackerWindow.cs
@@ -2844,6 +2844,7 @@ namespace ProcessHacker
// Force the handle to be created
{ var handle = this.Handle; }
+ Program.HackerWindowHandle = this.Handle;
Logging.Logged += this.QueueMessage;
Settings.Refresh();
diff --git a/trunk/ProcessHacker/Forms/HandleFilterWindow.Designer.cs b/trunk/ProcessHacker/Forms/HandleFilterWindow.Designer.cs
index 0578d8a84..2d8bc73c6 100644
--- a/trunk/ProcessHacker/Forms/HandleFilterWindow.Designer.cs
+++ b/trunk/ProcessHacker/Forms/HandleFilterWindow.Designer.cs
@@ -187,6 +187,7 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Find Handles or DLLs";
this.Load += new System.EventHandler(this.HandleFilterWindow_Load);
+ this.VisibleChanged += new System.EventHandler(this.HandleFilterWindow_VisibleChanged);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HandleFilterWindow_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.vistaMenu)).EndInit();
this.ResumeLayout(false);
diff --git a/trunk/ProcessHacker/Forms/HandleFilterWindow.cs b/trunk/ProcessHacker/Forms/HandleFilterWindow.cs
index 43b741b1e..092d87ecf 100644
--- a/trunk/ProcessHacker/Forms/HandleFilterWindow.cs
+++ b/trunk/ProcessHacker/Forms/HandleFilterWindow.cs
@@ -80,6 +80,14 @@ namespace ProcessHacker
this.Visible = false;
}
+ private void HandleFilterWindow_VisibleChanged(object sender, EventArgs e)
+ {
+ if (this.Visible)
+ {
+ this.SetPhParent();
+ }
+ }
+
private void menuHandle_Popup(object sender, EventArgs e)
{
if (listHandles.SelectedItems.Count == 0)
diff --git a/trunk/ProcessHacker/Forms/HiddenProcessesWindow.cs b/trunk/ProcessHacker/Forms/HiddenProcessesWindow.cs
index a370616a6..17fbebf5f 100644
--- a/trunk/ProcessHacker/Forms/HiddenProcessesWindow.cs
+++ b/trunk/ProcessHacker/Forms/HiddenProcessesWindow.cs
@@ -38,6 +38,7 @@ namespace ProcessHacker
{
public HiddenProcessesWindow()
{
+ this.SetPhParent();
InitializeComponent();
this.AddEscapeToClose();
diff --git a/trunk/ProcessHacker/Forms/MemoryEditor.cs b/trunk/ProcessHacker/Forms/MemoryEditor.cs
index c11232010..ecbed5aef 100644
--- a/trunk/ProcessHacker/Forms/MemoryEditor.cs
+++ b/trunk/ProcessHacker/Forms/MemoryEditor.cs
@@ -110,6 +110,7 @@ namespace ProcessHacker
Program.UpdateWindow(this);
this.Size = Properties.Settings.Default.MemoryWindowSize;
+ this.SetPhParent(false);
}
private void MemoryEditor_FormClosing(object sender, FormClosingEventArgs e)
diff --git a/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs b/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs
index 17b9736af..afa605887 100644
--- a/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs
+++ b/trunk/ProcessHacker/Forms/OptionsWindow.Designer.cs
@@ -99,6 +99,7 @@
this.toolTipProvider = new System.Windows.Forms.ToolTip(this.components);
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonApply = new System.Windows.Forms.Button();
+ this.checkFloatChildWindows = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.textUpdateInterval)).BeginInit();
this.tabControl.SuspendLayout();
this.tabGeneral.SuspendLayout();
@@ -155,7 +156,7 @@
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonOK.Location = new System.Drawing.Point(200, 363);
+ this.buttonOK.Location = new System.Drawing.Point(227, 319);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 2;
@@ -167,7 +168,7 @@
//
this.checkShowProcessDomains.AutoSize = true;
this.checkShowProcessDomains.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.checkShowProcessDomains.Location = new System.Drawing.Point(6, 285);
+ this.checkShowProcessDomains.Location = new System.Drawing.Point(211, 213);
this.checkShowProcessDomains.Name = "checkShowProcessDomains";
this.checkShowProcessDomains.Size = new System.Drawing.Size(156, 18);
this.checkShowProcessDomains.TabIndex = 3;
@@ -206,7 +207,7 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.textSearchEngine.Location = new System.Drawing.Point(134, 58);
this.textSearchEngine.Name = "textSearchEngine";
- this.textSearchEngine.Size = new System.Drawing.Size(277, 20);
+ this.textSearchEngine.Size = new System.Drawing.Size(304, 20);
this.textSearchEngine.TabIndex = 6;
//
// tabControl
@@ -222,11 +223,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, 345);
+ this.tabControl.Size = new System.Drawing.Size(452, 301);
this.tabControl.TabIndex = 7;
//
// tabGeneral
//
+ this.tabGeneral.Controls.Add(this.checkFloatChildWindows);
this.tabGeneral.Controls.Add(this.checkScrollDownProcessTree);
this.tabGeneral.Controls.Add(this.checkAllowOnlyOneInstance);
this.tabGeneral.Controls.Add(this.buttonFont);
@@ -247,7 +249,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, 319);
+ this.tabGeneral.Size = new System.Drawing.Size(444, 275);
this.tabGeneral.TabIndex = 0;
this.tabGeneral.Text = "General";
this.tabGeneral.UseVisualStyleBackColor = true;
@@ -256,7 +258,7 @@
//
this.checkScrollDownProcessTree.AutoSize = true;
this.checkScrollDownProcessTree.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.checkScrollDownProcessTree.Location = new System.Drawing.Point(6, 261);
+ this.checkScrollDownProcessTree.Location = new System.Drawing.Point(211, 189);
this.checkScrollDownProcessTree.Name = "checkScrollDownProcessTree";
this.checkScrollDownProcessTree.Size = new System.Drawing.Size(213, 18);
this.checkScrollDownProcessTree.TabIndex = 17;
@@ -412,7 +414,7 @@
this.tabAdvanced.Location = new System.Drawing.Point(4, 22);
this.tabAdvanced.Name = "tabAdvanced";
this.tabAdvanced.Padding = new System.Windows.Forms.Padding(3);
- this.tabAdvanced.Size = new System.Drawing.Size(417, 319);
+ this.tabAdvanced.Size = new System.Drawing.Size(444, 319);
this.tabAdvanced.TabIndex = 3;
this.tabAdvanced.Text = "Advanced";
this.tabAdvanced.UseVisualStyleBackColor = true;
@@ -962,7 +964,7 @@
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonCancel.Location = new System.Drawing.Point(281, 363);
+ this.buttonCancel.Location = new System.Drawing.Point(308, 319);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 11;
@@ -975,7 +977,7 @@
this.buttonApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonApply.Enabled = false;
this.buttonApply.FlatStyle = System.Windows.Forms.FlatStyle.System;
- this.buttonApply.Location = new System.Drawing.Point(362, 363);
+ this.buttonApply.Location = new System.Drawing.Point(389, 319);
this.buttonApply.Name = "buttonApply";
this.buttonApply.Size = new System.Drawing.Size(75, 23);
this.buttonApply.TabIndex = 11;
@@ -983,12 +985,23 @@
this.buttonApply.UseVisualStyleBackColor = true;
this.buttonApply.Click += new System.EventHandler(this.buttonApply_Click);
//
+ // checkFloatChildWindows
+ //
+ this.checkFloatChildWindows.AutoSize = true;
+ this.checkFloatChildWindows.FlatStyle = System.Windows.Forms.FlatStyle.System;
+ this.checkFloatChildWindows.Location = new System.Drawing.Point(211, 166);
+ this.checkFloatChildWindows.Name = "checkFloatChildWindows";
+ this.checkFloatChildWindows.Size = new System.Drawing.Size(124, 18);
+ this.checkFloatChildWindows.TabIndex = 18;
+ this.checkFloatChildWindows.Text = "Float child windows";
+ this.checkFloatChildWindows.UseVisualStyleBackColor = true;
+ //
// OptionsWindow
//
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(449, 398);
+ this.ClientSize = new System.Drawing.Size(476, 354);
this.Controls.Add(this.buttonApply);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.tabControl);
@@ -1095,5 +1108,6 @@
private System.Windows.Forms.CheckBox checkEnableExperimentalFeatures;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.CheckBox checkScrollDownProcessTree;
+ private System.Windows.Forms.CheckBox checkFloatChildWindows;
}
}
\ No newline at end of file
diff --git a/trunk/ProcessHacker/Forms/OptionsWindow.cs b/trunk/ProcessHacker/Forms/OptionsWindow.cs
index cbfbbc414..fd0a68f7f 100644
--- a/trunk/ProcessHacker/Forms/OptionsWindow.cs
+++ b/trunk/ProcessHacker/Forms/OptionsWindow.cs
@@ -242,6 +242,7 @@ namespace ProcessHacker
checkEnableExperimentalFeatures.Checked = Properties.Settings.Default.EnableExperimentalFeatures;
checkStartHidden.Checked = Properties.Settings.Default.StartHidden;
checkScrollDownProcessTree.Checked = Properties.Settings.Default.ScrollDownProcessTree;
+ checkFloatChildWindows.Checked = Properties.Settings.Default.FloatChildWindows;
checkHidePhConnections.Checked = Properties.Settings.Default.HideProcessHackerNetworkConnections;
textImposterNames.Text = Properties.Settings.Default.ImposterNames;
@@ -346,6 +347,7 @@ namespace ProcessHacker
Properties.Settings.Default.VerifySignatures = checkVerifySignatures.Checked;
Properties.Settings.Default.HideHandlesWithNoName = checkHideHandlesWithNoName.Checked;
Properties.Settings.Default.ScrollDownProcessTree = checkScrollDownProcessTree.Checked;
+ Properties.Settings.Default.FloatChildWindows = checkFloatChildWindows.Checked;
Properties.Settings.Default.StartHidden = checkStartHidden.Checked;
Properties.Settings.Default.EnableKPH = checkEnableKPH.Checked;
Properties.Settings.Default.EnableExperimentalFeatures = checkEnableExperimentalFeatures.Checked;
diff --git a/trunk/ProcessHacker/Forms/PEWindow.cs b/trunk/ProcessHacker/Forms/PEWindow.cs
index 1ab3168c0..d0714d524 100644
--- a/trunk/ProcessHacker/Forms/PEWindow.cs
+++ b/trunk/ProcessHacker/Forms/PEWindow.cs
@@ -64,6 +64,7 @@ namespace ProcessHacker
this.Size = Properties.Settings.Default.PEWindowSize;
Program.UpdateWindow(this);
+ this.SetPhParent();
}
private void PEWindow_FormClosing(object sender, FormClosingEventArgs e)
diff --git a/trunk/ProcessHacker/Forms/ProcessWindow.cs b/trunk/ProcessHacker/Forms/ProcessWindow.cs
index 1eaaf3854..9658e18c0 100644
--- a/trunk/ProcessHacker/Forms/ProcessWindow.cs
+++ b/trunk/ProcessHacker/Forms/ProcessWindow.cs
@@ -62,6 +62,7 @@ namespace ProcessHacker
public ProcessWindow(ProcessItem process)
{
+ this.SetPhParent();
InitializeComponent();
this.AddEscapeToClose();
@@ -82,6 +83,35 @@ namespace ProcessHacker
this.FixTabs();
}
+ private void ProcessWindow_Load(object sender, EventArgs e)
+ {
+ // Load settings.
+ this.Size = Properties.Settings.Default.ProcessWindowSize;
+ buttonSearch.Text = Properties.Settings.Default.SearchType;
+ checkHideHandlesNoName.Checked = Properties.Settings.Default.HideHandlesWithNoName;
+
+ if (tabControl.TabPages[Properties.Settings.Default.ProcessWindowSelectedTab] != null)
+ tabControl.SelectedTab = tabControl.TabPages[Properties.Settings.Default.ProcessWindowSelectedTab];
+
+ // Load location, cascade if possible.
+ Rectangle bounds = Screen.GetWorkingArea(this);
+ Point location = Properties.Settings.Default.ProcessWindowLocation;
+
+ if (Program.PWindows.Count > 1)
+ {
+ location.X += 20;
+ location.Y += 20;
+ }
+
+ Properties.Settings.Default.ProcessWindowLocation = this.Location =
+ Utils.FitRectangle(new Rectangle(location, this.Size), this).Location;
+
+ // Update the Window menu.
+ Program.UpdateWindow(this);
+
+ SymbolProviderExtensions.ShowWarning(this, false);
+ }
+
public MenuItem WindowMenuItem
{
get { return windowMenuItem; }
@@ -117,35 +147,6 @@ namespace ProcessHacker
get { return _serviceProps.List; }
}
- private void ProcessWindow_Load(object sender, EventArgs e)
- {
- // load settings
- this.Size = Properties.Settings.Default.ProcessWindowSize;
- buttonSearch.Text = Properties.Settings.Default.SearchType;
- checkHideHandlesNoName.Checked = Properties.Settings.Default.HideHandlesWithNoName;
-
- if (tabControl.TabPages[Properties.Settings.Default.ProcessWindowSelectedTab] != null)
- tabControl.SelectedTab = tabControl.TabPages[Properties.Settings.Default.ProcessWindowSelectedTab];
-
- // load location, cascade if possible
- Rectangle bounds = Screen.GetWorkingArea(this);
- Point location = Properties.Settings.Default.ProcessWindowLocation;
-
- if (Program.PWindows.Count > 1)
- {
- location.X += 20;
- location.Y += 20;
- }
-
- Properties.Settings.Default.ProcessWindowLocation = this.Location =
- Utils.FitRectangle(new Rectangle(location, this.Size), this).Location;
-
- // update the Window menu
- Program.UpdateWindow(this);
-
- SymbolProviderExtensions.ShowWarning(this, false);
- }
-
protected override void WndProc(ref Message m)
{
switch (m.Msg)
diff --git a/trunk/ProcessHacker/Forms/ResultsWindow.cs b/trunk/ProcessHacker/Forms/ResultsWindow.cs
index 3c5123e55..be97f6a34 100644
--- a/trunk/ProcessHacker/Forms/ResultsWindow.cs
+++ b/trunk/ProcessHacker/Forms/ResultsWindow.cs
@@ -82,6 +82,7 @@ namespace ProcessHacker
this.Size = Properties.Settings.Default.ResultsWindowSize;
ColumnSettings.LoadSettings(Properties.Settings.Default.ResultsListViewColumns, listResults);
+ this.SetPhParent(false);
}
private void ResultsWindow_FormClosing(object sender, FormClosingEventArgs e)
diff --git a/trunk/ProcessHacker/Program/Program.cs b/trunk/ProcessHacker/Program/Program.cs
index 09d6bc61d..6baaa113f 100644
--- a/trunk/ProcessHacker/Program/Program.cs
+++ b/trunk/ProcessHacker/Program/Program.cs
@@ -44,6 +44,7 @@ namespace ProcessHacker
/// The main Process Hacker window instance
///
public static HackerWindow HackerWindow;
+ public static IntPtr HackerWindowHandle;
public static ProcessAccess MinProcessQueryRights = ProcessAccess.QueryInformation;
public static ProcessAccess MinProcessReadMemoryRights = ProcessAccess.VmRead;
@@ -1211,6 +1212,32 @@ namespace ProcessHacker
};
}
+ ///