mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-22 21:55:52 +00:00
Add feature to globally hook processes to inject indirectly.
* This allows you to hook into processes that are difficult to launch directly with the existing functionality in RenderDoc. * This is rather risky, as it modifies the AppInit_DLLs registry key to inject a small shim dll that checks for the desired process and injects the full renderdoc.dll. If that registry key got left, or if there was some incompatibility with the shim dll, you could have problems. It should only ever be used as a last resort if there's no other way to capture.
This commit is contained in:
@@ -94,6 +94,8 @@ namespace renderdocui.Code
|
||||
public bool CheckUpdate_UpdateAvailable = false;
|
||||
public DateTime CheckUpdate_LastUpdate = new DateTime(2012, 06, 27);
|
||||
|
||||
public bool AllowGlobalHook = false;
|
||||
|
||||
public void SetupFormatter()
|
||||
{
|
||||
Formatter.MinFigures = Formatter_MinFigures;
|
||||
@@ -124,8 +126,12 @@ namespace renderdocui.Code
|
||||
RecentCaptureSettings.Clear();
|
||||
}
|
||||
|
||||
public bool ReadOnly = false;
|
||||
|
||||
public void Serialize(string file)
|
||||
{
|
||||
if (ReadOnly) return;
|
||||
|
||||
try
|
||||
{
|
||||
ReplayHostKeyValues.Clear();
|
||||
|
||||
@@ -91,5 +91,17 @@ namespace renderdocui.Code
|
||||
|
||||
[DllImport("shell32.dll")]
|
||||
public static extern void SHChangeNotify(HChangeNotifyEventID wEventId, HChangeNotifyFlags uFlags, IntPtr dwItem1, IntPtr dwItem2);
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
private static extern uint GetShortPathName(string lpszLongPath, char[] lpszShortPath, int cchBuffer);
|
||||
|
||||
public static string ShortPath(string longpath)
|
||||
{
|
||||
char[] buffer = new char[256];
|
||||
|
||||
GetShortPathName(longpath, buffer, buffer.Length);
|
||||
|
||||
return new string(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,9 @@ namespace renderdoc
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern ReplayCreateStatus RENDERDOC_CreateReplayRenderer(string logfile, ref float progress, ref IntPtr rendPtr);
|
||||
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern void RENDERDOC_StartGlobalHook(string pathmatch, string logfile, CaptureOptions opts);
|
||||
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern UInt32 RENDERDOC_ExecuteAndInject(string app, string workingDir, string cmdLine,
|
||||
string logfile, CaptureOptions opts, bool waitForExit);
|
||||
@@ -94,6 +97,11 @@ namespace renderdoc
|
||||
return new ReplayRenderer(rendPtr);
|
||||
}
|
||||
|
||||
public static void StartGlobalHook(string pathmatch, string logfile, CaptureOptions opts)
|
||||
{
|
||||
RENDERDOC_StartGlobalHook(pathmatch, logfile, opts);
|
||||
}
|
||||
|
||||
public static UInt32 ExecuteAndInject(string app, string workingDir, string cmdLine, string logfile, CaptureOptions opts)
|
||||
{
|
||||
return RENDERDOC_ExecuteAndInject(app, workingDir, cmdLine, logfile, opts, false);
|
||||
|
||||
+137
-60
@@ -34,10 +34,14 @@
|
||||
System.Windows.Forms.ColumnHeader pid;
|
||||
System.Windows.Forms.ColumnHeader name;
|
||||
System.Windows.Forms.Label label5;
|
||||
System.Windows.Forms.GroupBox groupBox1;
|
||||
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.globalLabel = new System.Windows.Forms.Label();
|
||||
this.actionsGroup = new System.Windows.Forms.GroupBox();
|
||||
this.actionsFlow = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.queueFrameCap = new System.Windows.Forms.CheckBox();
|
||||
this.queuedCapFrame = new System.Windows.Forms.NumericUpDown();
|
||||
this.globalGroup = new System.Windows.Forms.GroupBox();
|
||||
this.globalFlow = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.toggleGlobalHook = new System.Windows.Forms.CheckBox();
|
||||
this.capOptsGroup = new System.Windows.Forms.GroupBox();
|
||||
this.capOptsFlow = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.AllowFullscreen = new System.Windows.Forms.CheckBox();
|
||||
@@ -79,10 +83,11 @@
|
||||
pid = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
name = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
label5 = new System.Windows.Forms.Label();
|
||||
groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
groupBox1.SuspendLayout();
|
||||
this.flowLayoutPanel2.SuspendLayout();
|
||||
this.actionsGroup.SuspendLayout();
|
||||
this.actionsFlow.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.queuedCapFrame)).BeginInit();
|
||||
this.globalGroup.SuspendLayout();
|
||||
this.globalFlow.SuspendLayout();
|
||||
this.capOptsGroup.SuspendLayout();
|
||||
this.capOptsFlow.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
@@ -128,32 +133,48 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
label5.Location = new System.Drawing.Point(9, 16);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new System.Drawing.Size(581, 23);
|
||||
label5.Size = new System.Drawing.Size(473, 23);
|
||||
label5.TabIndex = 3;
|
||||
label5.Text = "NOTE: Injecting only works when the process has not used the target API";
|
||||
//
|
||||
// groupBox1
|
||||
// globalLabel
|
||||
//
|
||||
groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.globalLabel.AutoSize = true;
|
||||
this.globalLabel.ForeColor = System.Drawing.Color.Red;
|
||||
this.globalLabel.Location = new System.Drawing.Point(3, 3);
|
||||
this.globalLabel.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.globalLabel.Name = "globalLabel";
|
||||
this.globalLabel.Size = new System.Drawing.Size(188, 39);
|
||||
this.globalLabel.TabIndex = 2;
|
||||
this.globalLabel.Text = "Text is set by code Text is set by code\r\nText is set by codeText is set by code\r\n" +
|
||||
"Text is set by codeText is set by code";
|
||||
//
|
||||
// actionsGroup
|
||||
//
|
||||
this.actionsGroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
groupBox1.Controls.Add(this.flowLayoutPanel2);
|
||||
groupBox1.Location = new System.Drawing.Point(10, 500);
|
||||
groupBox1.Margin = new System.Windows.Forms.Padding(10);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new System.Drawing.Size(603, 49);
|
||||
groupBox1.TabIndex = 11;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Actions";
|
||||
this.actionsGroup.AutoSize = true;
|
||||
this.actionsGroup.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.actionsGroup.Controls.Add(this.actionsFlow);
|
||||
this.actionsGroup.Location = new System.Drawing.Point(10, 500);
|
||||
this.actionsGroup.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.actionsGroup.Name = "actionsGroup";
|
||||
this.actionsGroup.Size = new System.Drawing.Size(195, 65);
|
||||
this.actionsGroup.TabIndex = 11;
|
||||
this.actionsGroup.TabStop = false;
|
||||
this.actionsGroup.Text = "Actions";
|
||||
this.actionsGroup.Layout += new System.Windows.Forms.LayoutEventHandler(this.actionsGroup_Layout);
|
||||
//
|
||||
// flowLayoutPanel2
|
||||
// actionsFlow
|
||||
//
|
||||
this.flowLayoutPanel2.Controls.Add(this.queueFrameCap);
|
||||
this.flowLayoutPanel2.Controls.Add(this.queuedCapFrame);
|
||||
this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 16);
|
||||
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
|
||||
this.flowLayoutPanel2.Size = new System.Drawing.Size(597, 30);
|
||||
this.flowLayoutPanel2.TabIndex = 1;
|
||||
this.actionsFlow.AutoSize = true;
|
||||
this.actionsFlow.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.actionsFlow.Controls.Add(this.queueFrameCap);
|
||||
this.actionsFlow.Controls.Add(this.queuedCapFrame);
|
||||
this.actionsFlow.Location = new System.Drawing.Point(3, 16);
|
||||
this.actionsFlow.Name = "actionsFlow";
|
||||
this.actionsFlow.Size = new System.Drawing.Size(283, 30);
|
||||
this.actionsFlow.TabIndex = 1;
|
||||
//
|
||||
// queueFrameCap
|
||||
//
|
||||
@@ -188,6 +209,45 @@
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// globalGroup
|
||||
//
|
||||
this.globalGroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.globalGroup.AutoSize = true;
|
||||
this.globalGroup.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.globalGroup.Controls.Add(this.globalFlow);
|
||||
this.globalGroup.Location = new System.Drawing.Point(10, 585);
|
||||
this.globalGroup.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.globalGroup.Name = "globalGroup";
|
||||
this.globalGroup.Size = new System.Drawing.Size(195, 80);
|
||||
this.globalGroup.TabIndex = 12;
|
||||
this.globalGroup.TabStop = false;
|
||||
this.globalGroup.Text = "Global Process Hook";
|
||||
this.globalGroup.Layout += new System.Windows.Forms.LayoutEventHandler(this.globalGroup_Layout);
|
||||
//
|
||||
// globalFlow
|
||||
//
|
||||
this.globalFlow.AutoSize = true;
|
||||
this.globalFlow.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.globalFlow.Controls.Add(this.globalLabel);
|
||||
this.globalFlow.Controls.Add(this.toggleGlobalHook);
|
||||
this.globalFlow.Location = new System.Drawing.Point(3, 16);
|
||||
this.globalFlow.Name = "globalFlow";
|
||||
this.globalFlow.Size = new System.Drawing.Size(312, 45);
|
||||
this.globalFlow.TabIndex = 0;
|
||||
//
|
||||
// toggleGlobalHook
|
||||
//
|
||||
this.toggleGlobalHook.Appearance = System.Windows.Forms.Appearance.Button;
|
||||
this.toggleGlobalHook.AutoSize = true;
|
||||
this.toggleGlobalHook.Location = new System.Drawing.Point(197, 3);
|
||||
this.toggleGlobalHook.Name = "toggleGlobalHook";
|
||||
this.toggleGlobalHook.Size = new System.Drawing.Size(112, 23);
|
||||
this.toggleGlobalHook.TabIndex = 3;
|
||||
this.toggleGlobalHook.Text = "Enable Global Hook";
|
||||
this.toggleGlobalHook.UseVisualStyleBackColor = true;
|
||||
this.toggleGlobalHook.CheckedChanged += new System.EventHandler(this.toggleGlobalHook_CheckedChanged);
|
||||
//
|
||||
// capOptsGroup
|
||||
//
|
||||
this.capOptsGroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
@@ -198,7 +258,7 @@
|
||||
this.capOptsGroup.Location = new System.Drawing.Point(10, 367);
|
||||
this.capOptsGroup.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.capOptsGroup.Name = "capOptsGroup";
|
||||
this.capOptsGroup.Size = new System.Drawing.Size(603, 113);
|
||||
this.capOptsGroup.Size = new System.Drawing.Size(195, 113);
|
||||
this.capOptsGroup.TabIndex = 4;
|
||||
this.capOptsGroup.TabStop = false;
|
||||
this.capOptsGroup.Text = "Capture Options";
|
||||
@@ -312,7 +372,7 @@
|
||||
//
|
||||
// HookIntoChildren
|
||||
//
|
||||
this.HookIntoChildren.Location = new System.Drawing.Point(411, 29);
|
||||
this.HookIntoChildren.Location = new System.Drawing.Point(275, 29);
|
||||
this.HookIntoChildren.Name = "HookIntoChildren";
|
||||
this.HookIntoChildren.Size = new System.Drawing.Size(130, 20);
|
||||
this.HookIntoChildren.TabIndex = 14;
|
||||
@@ -323,7 +383,7 @@
|
||||
//
|
||||
// SaveAllInitials
|
||||
//
|
||||
this.SaveAllInitials.Location = new System.Drawing.Point(3, 55);
|
||||
this.SaveAllInitials.Location = new System.Drawing.Point(411, 29);
|
||||
this.SaveAllInitials.Name = "SaveAllInitials";
|
||||
this.SaveAllInitials.Size = new System.Drawing.Size(130, 20);
|
||||
this.SaveAllInitials.TabIndex = 15;
|
||||
@@ -333,7 +393,7 @@
|
||||
//
|
||||
// RefAllResources
|
||||
//
|
||||
this.RefAllResources.Location = new System.Drawing.Point(139, 55);
|
||||
this.RefAllResources.Location = new System.Drawing.Point(3, 55);
|
||||
this.RefAllResources.Name = "RefAllResources";
|
||||
this.RefAllResources.Size = new System.Drawing.Size(130, 20);
|
||||
this.RefAllResources.TabIndex = 16;
|
||||
@@ -343,7 +403,7 @@
|
||||
//
|
||||
// CaptureAllCmdLists
|
||||
//
|
||||
this.CaptureAllCmdLists.Location = new System.Drawing.Point(275, 55);
|
||||
this.CaptureAllCmdLists.Location = new System.Drawing.Point(139, 55);
|
||||
this.CaptureAllCmdLists.Name = "CaptureAllCmdLists";
|
||||
this.CaptureAllCmdLists.Size = new System.Drawing.Size(130, 20);
|
||||
this.CaptureAllCmdLists.TabIndex = 17;
|
||||
@@ -354,7 +414,7 @@
|
||||
//
|
||||
// AutoStart
|
||||
//
|
||||
this.AutoStart.Location = new System.Drawing.Point(411, 55);
|
||||
this.AutoStart.Location = new System.Drawing.Point(275, 55);
|
||||
this.AutoStart.Name = "AutoStart";
|
||||
this.AutoStart.Size = new System.Drawing.Size(130, 20);
|
||||
this.AutoStart.TabIndex = 18;
|
||||
@@ -371,19 +431,19 @@
|
||||
this.panel2.Controls.Add(this.save);
|
||||
this.panel2.Controls.Add(this.close);
|
||||
this.panel2.Controls.Add(this.capture);
|
||||
this.panel2.Location = new System.Drawing.Point(3, 562);
|
||||
this.panel2.Location = new System.Drawing.Point(3, 678);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(617, 26);
|
||||
this.panel2.Size = new System.Drawing.Size(209, 26);
|
||||
this.panel2.TabIndex = 8;
|
||||
//
|
||||
// load
|
||||
//
|
||||
this.load.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.load.Location = new System.Drawing.Point(104, 3);
|
||||
this.load.Location = new System.Drawing.Point(50, 3);
|
||||
this.load.Name = "load";
|
||||
this.load.Size = new System.Drawing.Size(86, 23);
|
||||
this.load.Size = new System.Drawing.Size(39, 23);
|
||||
this.load.TabIndex = 24;
|
||||
this.load.Text = "Load Settings";
|
||||
this.load.Text = "Load";
|
||||
this.toolTip.SetToolTip(this.load, "Load a saved set of capture settings");
|
||||
this.load.UseVisualStyleBackColor = true;
|
||||
this.load.Click += new System.EventHandler(this.load_Click);
|
||||
@@ -393,9 +453,9 @@
|
||||
this.save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.save.Location = new System.Drawing.Point(4, 3);
|
||||
this.save.Name = "save";
|
||||
this.save.Size = new System.Drawing.Size(94, 23);
|
||||
this.save.Size = new System.Drawing.Size(40, 23);
|
||||
this.save.TabIndex = 23;
|
||||
this.save.Text = "Save Settings";
|
||||
this.save.Text = "Save";
|
||||
this.toolTip.SetToolTip(this.save, "Save these capture settings to file to load later");
|
||||
this.save.UseVisualStyleBackColor = true;
|
||||
this.save.Click += new System.EventHandler(this.save_Click);
|
||||
@@ -403,10 +463,10 @@
|
||||
// close
|
||||
//
|
||||
this.close.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.close.Location = new System.Drawing.Point(540, 3);
|
||||
this.close.Location = new System.Drawing.Point(162, 3);
|
||||
this.close.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.close.Name = "close";
|
||||
this.close.Size = new System.Drawing.Size(70, 23);
|
||||
this.close.Size = new System.Drawing.Size(41, 23);
|
||||
this.close.TabIndex = 22;
|
||||
this.close.Text = "Close";
|
||||
this.close.UseVisualStyleBackColor = true;
|
||||
@@ -415,10 +475,10 @@
|
||||
// capture
|
||||
//
|
||||
this.capture.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.capture.Location = new System.Drawing.Point(464, 3);
|
||||
this.capture.Location = new System.Drawing.Point(105, 3);
|
||||
this.capture.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.capture.Name = "capture";
|
||||
this.capture.Size = new System.Drawing.Size(70, 23);
|
||||
this.capture.Size = new System.Drawing.Size(52, 23);
|
||||
this.capture.TabIndex = 21;
|
||||
this.capture.Text = "Capture";
|
||||
this.toolTip.SetToolTip(this.capture, "Trigger a capture of the selected program");
|
||||
@@ -466,14 +526,14 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cmdline.Location = new System.Drawing.Point(137, 71);
|
||||
this.cmdline.Name = "cmdline";
|
||||
this.cmdline.Size = new System.Drawing.Size(460, 20);
|
||||
this.cmdline.Size = new System.Drawing.Size(52, 20);
|
||||
this.cmdline.TabIndex = 4;
|
||||
this.toolTip.SetToolTip(this.cmdline, "The command-line that will be passed to the executable on launch");
|
||||
//
|
||||
// workDirBrowse
|
||||
//
|
||||
this.workDirBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.workDirBrowse.Location = new System.Drawing.Point(573, 45);
|
||||
this.workDirBrowse.Location = new System.Drawing.Point(165, 45);
|
||||
this.workDirBrowse.Name = "workDirBrowse";
|
||||
this.workDirBrowse.Size = new System.Drawing.Size(24, 20);
|
||||
this.workDirBrowse.TabIndex = 3;
|
||||
@@ -488,7 +548,7 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.workDirPath.Location = new System.Drawing.Point(137, 45);
|
||||
this.workDirPath.Name = "workDirPath";
|
||||
this.workDirPath.Size = new System.Drawing.Size(430, 20);
|
||||
this.workDirPath.Size = new System.Drawing.Size(22, 20);
|
||||
this.workDirPath.TabIndex = 2;
|
||||
this.toolTip.SetToolTip(this.workDirPath, "The working directory the executable will be launched in");
|
||||
this.workDirPath.TextChanged += new System.EventHandler(this.workDirPath_TextChanged);
|
||||
@@ -498,7 +558,7 @@
|
||||
// exeBrowse
|
||||
//
|
||||
this.exeBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.exeBrowse.Location = new System.Drawing.Point(573, 19);
|
||||
this.exeBrowse.Location = new System.Drawing.Point(165, 18);
|
||||
this.exeBrowse.Name = "exeBrowse";
|
||||
this.exeBrowse.Size = new System.Drawing.Size(24, 20);
|
||||
this.exeBrowse.TabIndex = 1;
|
||||
@@ -514,7 +574,7 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.exePath.Location = new System.Drawing.Point(137, 19);
|
||||
this.exePath.Name = "exePath";
|
||||
this.exePath.Size = new System.Drawing.Size(430, 20);
|
||||
this.exePath.Size = new System.Drawing.Size(22, 20);
|
||||
this.exePath.TabIndex = 0;
|
||||
this.toolTip.SetToolTip(this.exePath, "The executable file to launch");
|
||||
this.exePath.TextChanged += new System.EventHandler(this.exePath_TextChanged);
|
||||
@@ -524,7 +584,7 @@
|
||||
// pidRefresh
|
||||
//
|
||||
this.pidRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pidRefresh.Location = new System.Drawing.Point(518, 180);
|
||||
this.pidRefresh.Location = new System.Drawing.Point(410, 180);
|
||||
this.pidRefresh.Name = "pidRefresh";
|
||||
this.pidRefresh.Size = new System.Drawing.Size(75, 23);
|
||||
this.pidRefresh.TabIndex = 6;
|
||||
@@ -547,7 +607,7 @@
|
||||
this.pidList.Location = new System.Drawing.Point(6, 42);
|
||||
this.pidList.MultiSelect = false;
|
||||
this.pidList.Name = "pidList";
|
||||
this.pidList.Size = new System.Drawing.Size(584, 129);
|
||||
this.pidList.Size = new System.Drawing.Size(183, 129);
|
||||
this.pidList.TabIndex = 5;
|
||||
this.toolTip.SetToolTip(this.pidList, "Select the process to inject into - must not yet have utilised the target API");
|
||||
this.pidList.UseCompatibleStateImageBehavior = false;
|
||||
@@ -555,23 +615,28 @@
|
||||
//
|
||||
// tableLayoutPanel2
|
||||
//
|
||||
this.tableLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tableLayoutPanel2.AutoSize = true;
|
||||
this.tableLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tableLayoutPanel2.ColumnCount = 1;
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel2.Controls.Add(this.programGroup, 0, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.panel2, 0, 4);
|
||||
this.tableLayoutPanel2.Controls.Add(this.panel2, 0, 5);
|
||||
this.tableLayoutPanel2.Controls.Add(this.capOptsGroup, 0, 2);
|
||||
this.tableLayoutPanel2.Controls.Add(this.processGroup, 0, 1);
|
||||
this.tableLayoutPanel2.Controls.Add(groupBox1, 0, 3);
|
||||
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel2.Controls.Add(this.actionsGroup, 0, 3);
|
||||
this.tableLayoutPanel2.Controls.Add(this.globalGroup, 0, 4);
|
||||
this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||
this.tableLayoutPanel2.RowCount = 5;
|
||||
this.tableLayoutPanel2.RowCount = 6;
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(623, 761);
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(215, 707);
|
||||
this.tableLayoutPanel2.TabIndex = 8;
|
||||
//
|
||||
// programGroup
|
||||
@@ -589,7 +654,7 @@
|
||||
this.programGroup.Location = new System.Drawing.Point(10, 10);
|
||||
this.programGroup.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.programGroup.Name = "programGroup";
|
||||
this.programGroup.Size = new System.Drawing.Size(603, 108);
|
||||
this.programGroup.Size = new System.Drawing.Size(195, 108);
|
||||
this.programGroup.TabIndex = 10;
|
||||
this.programGroup.TabStop = false;
|
||||
this.programGroup.Text = "Program";
|
||||
@@ -604,7 +669,7 @@
|
||||
this.processGroup.Location = new System.Drawing.Point(10, 138);
|
||||
this.processGroup.Margin = new System.Windows.Forms.Padding(10);
|
||||
this.processGroup.Name = "processGroup";
|
||||
this.processGroup.Size = new System.Drawing.Size(603, 209);
|
||||
this.processGroup.Size = new System.Drawing.Size(195, 209);
|
||||
this.processGroup.TabIndex = 9;
|
||||
this.processGroup.TabStop = false;
|
||||
this.processGroup.Text = "Process";
|
||||
@@ -614,16 +679,22 @@
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoScroll = true;
|
||||
this.AutoScrollMinSize = new System.Drawing.Size(360, 0);
|
||||
this.ClientSize = new System.Drawing.Size(623, 761);
|
||||
this.AutoScrollMinSize = new System.Drawing.Size(215, 0);
|
||||
this.ClientSize = new System.Drawing.Size(215, 736);
|
||||
this.Controls.Add(this.tableLayoutPanel2);
|
||||
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Name = "CaptureDialog";
|
||||
this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document;
|
||||
this.Text = "CaptureDialog";
|
||||
groupBox1.ResumeLayout(false);
|
||||
this.flowLayoutPanel2.ResumeLayout(false);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CaptureDialog_FormClosing);
|
||||
this.actionsGroup.ResumeLayout(false);
|
||||
this.actionsGroup.PerformLayout();
|
||||
this.actionsFlow.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.queuedCapFrame)).EndInit();
|
||||
this.globalGroup.ResumeLayout(false);
|
||||
this.globalGroup.PerformLayout();
|
||||
this.globalFlow.ResumeLayout(false);
|
||||
this.globalFlow.PerformLayout();
|
||||
this.capOptsGroup.ResumeLayout(false);
|
||||
this.capOptsGroup.PerformLayout();
|
||||
this.capOptsFlow.ResumeLayout(false);
|
||||
@@ -636,6 +707,7 @@
|
||||
this.programGroup.PerformLayout();
|
||||
this.processGroup.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -676,10 +748,15 @@
|
||||
private System.Windows.Forms.ListView pidList;
|
||||
private System.Windows.Forms.Button pidRefresh;
|
||||
private System.Windows.Forms.CheckBox CaptureAllCmdLists;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
|
||||
private System.Windows.Forms.FlowLayoutPanel actionsFlow;
|
||||
private System.Windows.Forms.NumericUpDown queuedCapFrame;
|
||||
private System.Windows.Forms.CheckBox queueFrameCap;
|
||||
private System.Windows.Forms.GroupBox capOptsGroup;
|
||||
private System.Windows.Forms.FlowLayoutPanel globalFlow;
|
||||
private System.Windows.Forms.CheckBox toggleGlobalHook;
|
||||
private System.Windows.Forms.GroupBox actionsGroup;
|
||||
private System.Windows.Forms.GroupBox globalGroup;
|
||||
private System.Windows.Forms.Label globalLabel;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,14 +28,18 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
using Microsoft.Win32;
|
||||
using renderdocui.Code;
|
||||
using renderdoc;
|
||||
|
||||
using Process = System.Diagnostics.Process;
|
||||
using System.IO.Pipes;
|
||||
|
||||
namespace renderdocui.Windows.Dialogs
|
||||
{
|
||||
public partial class CaptureDialog : DockContent
|
||||
@@ -134,6 +138,8 @@ namespace renderdocui.Windows.Dialogs
|
||||
processGroup.Visible = true;
|
||||
programGroup.Visible = false;
|
||||
|
||||
globalGroup.Visible = false;
|
||||
|
||||
capture.Text = "Inject";
|
||||
|
||||
FillProcessList();
|
||||
@@ -145,6 +151,8 @@ namespace renderdocui.Windows.Dialogs
|
||||
processGroup.Visible = false;
|
||||
programGroup.Visible = true;
|
||||
|
||||
globalGroup.Visible = m_Core.Config.AllowGlobalHook;
|
||||
|
||||
capture.Text = "Capture";
|
||||
|
||||
Text = "Capture Executable";
|
||||
@@ -170,6 +178,8 @@ namespace renderdocui.Windows.Dialogs
|
||||
workDirPath.ForeColor = SystemColors.GrayText;
|
||||
|
||||
SetSettings(defaults);
|
||||
|
||||
UpdateGlobalHook();
|
||||
}
|
||||
|
||||
#region Callbacks
|
||||
@@ -445,6 +455,16 @@ namespace renderdocui.Windows.Dialogs
|
||||
capOptsFlow.MaximumSize = new Size(capOptsGroup.ClientRectangle.Width - 8, 0);
|
||||
}
|
||||
|
||||
private void actionsGroup_Layout(object sender, LayoutEventArgs e)
|
||||
{
|
||||
actionsFlow.MaximumSize = new Size(actionsGroup.ClientRectangle.Width - 8, 0);
|
||||
}
|
||||
|
||||
private void globalGroup_Layout(object sender, LayoutEventArgs e)
|
||||
{
|
||||
globalFlow.MaximumSize = new Size(globalGroup.ClientRectangle.Width - 8, 0);
|
||||
}
|
||||
|
||||
private void workDirPath_Enter(object sender, EventArgs e)
|
||||
{
|
||||
if (workDirHint)
|
||||
@@ -470,13 +490,14 @@ namespace renderdocui.Windows.Dialogs
|
||||
private void exePath_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateWorkDirHint();
|
||||
UpdateGlobalHook();
|
||||
}
|
||||
|
||||
private void UpdateWorkDirHint()
|
||||
{
|
||||
if (workDirHint == false) return;
|
||||
|
||||
if(exePath.Text == "")
|
||||
if (exePath.Text == "")
|
||||
{
|
||||
workDirPath.Text = "";
|
||||
return;
|
||||
@@ -491,5 +512,335 @@ namespace renderdocui.Windows.Dialogs
|
||||
// invalid path or similar
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateGlobalHook()
|
||||
{
|
||||
globalGroup.Visible = !InjectMode && m_Core.Config.AllowGlobalHook;
|
||||
|
||||
if (exePath.Text.Length >= 4)
|
||||
{
|
||||
toggleGlobalHook.Enabled = true;
|
||||
globalLabel.Text = "Global hooking is risky!" + Environment.NewLine + Environment.NewLine +
|
||||
"Be sure you know what you're doing.";
|
||||
|
||||
if (toggleGlobalHook.Checked)
|
||||
globalLabel.Text += Environment.NewLine + "Emergency restore @ %TEMP%\\RenderDoc_RestoreGlobalHook.reg";
|
||||
}
|
||||
else
|
||||
{
|
||||
toggleGlobalHook.Enabled = false;
|
||||
globalLabel.Text = "Global hooking requires an executable path, or filename";
|
||||
}
|
||||
}
|
||||
|
||||
private string prevAppInit = "";
|
||||
private string prevAppInitWoW64 = "";
|
||||
private int prevAppInitEnabled = 0;
|
||||
private int prevAppInitWoW64Enabled = 0;
|
||||
|
||||
private AutoResetEvent wakeupEvent = new AutoResetEvent(false);
|
||||
private bool pipeExit = false;
|
||||
private Thread pipeThread = null;
|
||||
private NamedPipeServerStream pipe32 = null;
|
||||
private NamedPipeServerStream pipe64 = null;
|
||||
|
||||
private void EnableAppInit(RegistryKey parent, string path, string dllname, out int prevEnabled, out string prevStr)
|
||||
{
|
||||
RegistryKey key = parent.OpenSubKey("Microsoft", true);
|
||||
if (key == null) { prevEnabled = 0; prevStr = ""; return; }
|
||||
|
||||
key = key.OpenSubKey("Windows NT", true);
|
||||
if (key == null) { prevEnabled = 0; prevStr = ""; return; }
|
||||
|
||||
key = key.OpenSubKey("CurrentVersion", true);
|
||||
if (key == null) { prevEnabled = 0; prevStr = ""; return; }
|
||||
|
||||
key = key.OpenSubKey("Windows", true);
|
||||
if (key == null) { prevEnabled = 0; prevStr = ""; return; }
|
||||
|
||||
object o = key.GetValue("LoadAppInit_DLLs");
|
||||
if (o == null || !(o is int)) { prevEnabled = 0; prevStr = ""; return; }
|
||||
prevEnabled = (int)o;
|
||||
|
||||
o = key.GetValue("AppInit_DLLs");
|
||||
if (o == null || !(o is string)) { prevEnabled = 0; prevStr = ""; return; }
|
||||
prevStr = (string)o;
|
||||
|
||||
key.SetValue("AppInit_DLLs", Win32PInvoke.ShortPath(Path.Combine(path, dllname)));
|
||||
key.SetValue("LoadAppInit_DLLs", (int)1);
|
||||
}
|
||||
|
||||
private void RestoreAppInit(RegistryKey parent, int prevEnabled, string prevStr)
|
||||
{
|
||||
RegistryKey key = parent.OpenSubKey("Microsoft", true);
|
||||
if (key == null) { prevEnabled = 0; prevStr = ""; return; }
|
||||
|
||||
key = key.OpenSubKey("Windows NT", true);
|
||||
if (key == null) { prevEnabled = 0; prevStr = ""; return; }
|
||||
|
||||
key = key.OpenSubKey("CurrentVersion", true);
|
||||
if (key == null) { prevEnabled = 0; prevStr = ""; return; }
|
||||
|
||||
key = key.OpenSubKey("Windows", true);
|
||||
if (key == null) { prevEnabled = 0; prevStr = ""; return; }
|
||||
|
||||
key.SetValue("AppInit_DLLs", prevStr);
|
||||
key.SetValue("LoadAppInit_DLLs", prevEnabled);
|
||||
}
|
||||
|
||||
private void PipeTick()
|
||||
{
|
||||
while (!pipeExit)
|
||||
{
|
||||
wakeupEvent.WaitOne(250);
|
||||
}
|
||||
|
||||
if (pipe32 != null)
|
||||
{
|
||||
if (pipe32.IsConnected)
|
||||
{
|
||||
using (StreamWriter writer = new StreamWriter(pipe32))
|
||||
{
|
||||
writer.Write("exit");
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
pipe32.Dispose();
|
||||
pipe32 = null;
|
||||
}
|
||||
|
||||
if (pipe64 != null)
|
||||
{
|
||||
if (pipe64.IsConnected)
|
||||
{
|
||||
using (StreamWriter writer = new StreamWriter(pipe64))
|
||||
{
|
||||
writer.Write("exit");
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
pipe64.Dispose();
|
||||
pipe64 = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void ExitPipeThread()
|
||||
{
|
||||
pipeExit = true;
|
||||
wakeupEvent.Set();
|
||||
|
||||
if (pipeThread != null)
|
||||
{
|
||||
if (pipeThread.ThreadState != ThreadState.Aborted &&
|
||||
pipeThread.ThreadState != ThreadState.Stopped)
|
||||
{
|
||||
// try to shut down gracefully
|
||||
pipeThread.Join(1000);
|
||||
|
||||
if (pipeThread.ThreadState != ThreadState.Aborted &&
|
||||
pipeThread.ThreadState != ThreadState.Stopped)
|
||||
{
|
||||
pipeThread.Abort();
|
||||
pipeThread.Join();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pipeThread = null;
|
||||
|
||||
if (pipe32 != null)
|
||||
{
|
||||
pipe32.Dispose();
|
||||
pipe32 = null;
|
||||
}
|
||||
|
||||
if (pipe64 != null)
|
||||
{
|
||||
pipe64.Dispose();
|
||||
pipe64 = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleGlobalHook_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!toggleGlobalHook.Enabled)
|
||||
return;
|
||||
|
||||
toggleGlobalHook.Enabled = false;
|
||||
|
||||
if (toggleGlobalHook.Checked)
|
||||
{
|
||||
if(!Helpers.IsElevated)
|
||||
{
|
||||
DialogResult res = MessageBox.Show("RenderDoc needs to restart with admin privileges. Restart?", "Restart as admin", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||
|
||||
if (res == DialogResult.Yes)
|
||||
{
|
||||
string capfile = Path.GetTempFileName() + ".cap";
|
||||
|
||||
AutoStart.Checked = false;
|
||||
|
||||
SaveSettings(capfile);
|
||||
|
||||
var process = new Process();
|
||||
process.StartInfo = new System.Diagnostics.ProcessStartInfo(Application.ExecutablePath, capfile);
|
||||
process.StartInfo.Verb = "runas";
|
||||
try
|
||||
{
|
||||
process.Start();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// don't restart if it failed for some reason (e.g. user clicked no to UAC)
|
||||
toggleGlobalHook.Checked = false;
|
||||
toggleGlobalHook.Enabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
m_Core.Config.Serialize(Core.ConfigFilename);
|
||||
m_Core.Config.ReadOnly = true;
|
||||
m_Core.AppWindow.Close();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
toggleGlobalHook.Checked = false;
|
||||
toggleGlobalHook.Enabled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
exePath.Enabled = exeBrowse.Enabled =
|
||||
workDirPath.Enabled = workDirBrowse.Enabled =
|
||||
cmdline.Enabled =
|
||||
capture.Enabled = save.Enabled = load.Enabled = false;
|
||||
|
||||
foreach (Control c in capOptsFlow.Controls)
|
||||
c.Enabled = false;
|
||||
|
||||
foreach (Control c in actionsFlow.Controls)
|
||||
c.Enabled = false;
|
||||
|
||||
toggleGlobalHook.Text = "Disable Global Hook";
|
||||
|
||||
var path = Path.GetDirectoryName(Path.GetFullPath(Application.ExecutablePath));
|
||||
|
||||
var regfile = Path.Combine(Path.GetTempPath(), "RenderDoc_RestoreGlobalHook.reg");
|
||||
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
EnableAppInit(Registry.LocalMachine.CreateSubKey("SOFTWARE").CreateSubKey("Wow6432Node"),
|
||||
path, "x86\\renderdocshim32.dll",
|
||||
out prevAppInitWoW64Enabled, out prevAppInitWoW64);
|
||||
|
||||
EnableAppInit(Registry.LocalMachine.CreateSubKey("SOFTWARE"),
|
||||
path, "renderdocshim64.dll",
|
||||
out prevAppInitEnabled, out prevAppInit);
|
||||
|
||||
using (FileStream s = File.OpenWrite(regfile))
|
||||
{
|
||||
using(StreamWriter sw = new StreamWriter(s))
|
||||
{
|
||||
sw.WriteLine("Windows Registry Editor Version 5.00");
|
||||
sw.WriteLine("");
|
||||
sw.WriteLine("[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\Windows]");
|
||||
sw.WriteLine(String.Format("\"LoadAppInit_DLLs\"=dword:{0:X8}", prevAppInitWoW64Enabled));
|
||||
sw.WriteLine(String.Format("\"AppInit_DLLs\"=\"{0}\"", prevAppInitWoW64));
|
||||
sw.WriteLine("");
|
||||
sw.WriteLine("[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Windows]");
|
||||
sw.WriteLine(String.Format("\"LoadAppInit_DLLs\"=dword:{0:X8}", prevAppInitEnabled));
|
||||
sw.WriteLine(String.Format("\"AppInit_DLLs\"=\"{0}\"", prevAppInit));
|
||||
sw.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if this is a 64-bit OS, it will re-direct our request to Wow6432Node anyway, so we
|
||||
// don't need to handle that manually
|
||||
EnableAppInit(Registry.LocalMachine.CreateSubKey("SOFTWARE"), path, "renderdocshim32.dll",
|
||||
out prevAppInitEnabled, out prevAppInit);
|
||||
|
||||
using (FileStream s = File.OpenWrite(regfile))
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(s))
|
||||
{
|
||||
sw.WriteLine("Windows Registry Editor Version 5.00");
|
||||
sw.WriteLine("");
|
||||
sw.WriteLine("[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Windows]");
|
||||
sw.WriteLine(String.Format("\"LoadAppInit_DLLs\"=dword:{0:X8}", prevAppInitEnabled));
|
||||
sw.WriteLine(String.Format("\"AppInit_DLLs\"=\"{0}\"", prevAppInit));
|
||||
sw.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ExitPipeThread();
|
||||
|
||||
pipeExit = false;
|
||||
|
||||
pipe32 = new NamedPipeServerStream("RenderDoc.GlobalHookControl32");
|
||||
pipe64 = new NamedPipeServerStream("RenderDoc.GlobalHookControl64");
|
||||
|
||||
pipeThread = Helpers.NewThread(new ThreadStart(PipeTick));
|
||||
|
||||
pipeThread.Start();
|
||||
|
||||
string exe = exePath.Text;
|
||||
|
||||
string logfile = exe;
|
||||
if (logfile.Contains("/")) logfile = logfile.Substring(logfile.LastIndexOf('/') + 1);
|
||||
if (logfile.Contains("\\")) logfile = logfile.Substring(logfile.LastIndexOf('\\') + 1);
|
||||
if (logfile.Contains(".")) logfile = logfile.Substring(0, logfile.IndexOf('.'));
|
||||
logfile = m_Core.TempLogFilename(logfile);
|
||||
|
||||
StaticExports.StartGlobalHook(exe, logfile, GetSettings().Options);
|
||||
}
|
||||
else
|
||||
{
|
||||
ExitPipeThread();
|
||||
|
||||
exePath.Enabled = exeBrowse.Enabled =
|
||||
workDirPath.Enabled = workDirBrowse.Enabled =
|
||||
cmdline.Enabled =
|
||||
capture.Enabled = save.Enabled = load.Enabled = true;
|
||||
|
||||
foreach (Control c in capOptsFlow.Controls)
|
||||
c.Enabled = true;
|
||||
|
||||
foreach (Control c in actionsFlow.Controls)
|
||||
c.Enabled = true;
|
||||
|
||||
toggleGlobalHook.Text = "Enable Global Hook";
|
||||
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
RestoreAppInit(Registry.LocalMachine.CreateSubKey("SOFTWARE").CreateSubKey("Wow6432Node"), prevAppInitWoW64Enabled, prevAppInitWoW64);
|
||||
RestoreAppInit(Registry.LocalMachine.CreateSubKey("SOFTWARE"), prevAppInitEnabled, prevAppInit);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if this is a 64-bit OS, it will re-direct our request to Wow6432Node anyway, so we
|
||||
// don't need to handle that manually
|
||||
RestoreAppInit(Registry.LocalMachine.CreateSubKey("SOFTWARE"), prevAppInitEnabled, prevAppInit);
|
||||
}
|
||||
|
||||
var regfile = Path.Combine(Path.GetTempPath(), "RenderDoc_RestoreGlobalHook.reg");
|
||||
|
||||
if (File.Exists(regfile)) File.Delete(regfile);
|
||||
}
|
||||
|
||||
toggleGlobalHook.Enabled = true;
|
||||
|
||||
UpdateGlobalHook();
|
||||
}
|
||||
|
||||
private void CaptureDialog_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (toggleGlobalHook.Checked)
|
||||
toggleGlobalHook.Checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,9 +135,6 @@
|
||||
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="groupBox1.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="exeBrowser.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
@@ -150,4 +147,7 @@
|
||||
<metadata name="loadDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>382, 17</value>
|
||||
</metadata>
|
||||
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>485, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
+60
-24
@@ -32,6 +32,7 @@
|
||||
System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
System.Windows.Forms.GroupBox groupBox1;
|
||||
System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||
System.Windows.Forms.Label label13;
|
||||
System.Windows.Forms.Label label6;
|
||||
System.Windows.Forms.Label label4;
|
||||
System.Windows.Forms.Label label1;
|
||||
@@ -47,9 +48,13 @@
|
||||
System.Windows.Forms.GroupBox groupBox4;
|
||||
System.Windows.Forms.Label label8;
|
||||
System.Windows.Forms.Label label9;
|
||||
TreelistView.TreeListColumn treeListColumn1 = new TreelistView.TreeListColumn("Section", "Section");
|
||||
TreelistView.TreeListColumn treeListColumn1 = ((TreelistView.TreeListColumn)(new TreelistView.TreeListColumn("Section", "Section")));
|
||||
this.ok = new System.Windows.Forms.Button();
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.browserCaptureDialog = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.settingsTabs = new renderdocui.Controls.TablessControl();
|
||||
this.generalTab = new System.Windows.Forms.TabPage();
|
||||
this.AllowGlobalHook = new System.Windows.Forms.CheckBox();
|
||||
this.Formatter_PosExp = new System.Windows.Forms.NumericUpDown();
|
||||
this.Formatter_NegExp = new System.Windows.Forms.NumericUpDown();
|
||||
this.rdcAssoc = new System.Windows.Forms.Button();
|
||||
@@ -69,12 +74,10 @@
|
||||
this.EventBrowser_TimeUnit = new System.Windows.Forms.ComboBox();
|
||||
this.EventBrowser_HideEmpty = new System.Windows.Forms.CheckBox();
|
||||
this.pagesTree = new TreelistView.TreeListView();
|
||||
this.ok = new System.Windows.Forms.Button();
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.browserCaptureDialog = new System.Windows.Forms.FolderBrowserDialog();
|
||||
tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
label13 = new System.Windows.Forms.Label();
|
||||
label6 = new System.Windows.Forms.Label();
|
||||
label4 = new System.Windows.Forms.Label();
|
||||
label1 = new System.Windows.Forms.Label();
|
||||
@@ -128,6 +131,21 @@
|
||||
tableLayoutPanel1.Size = new System.Drawing.Size(580, 353);
|
||||
tableLayoutPanel1.TabIndex = 1;
|
||||
//
|
||||
// ok
|
||||
//
|
||||
this.ok.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ok.Location = new System.Drawing.Point(502, 327);
|
||||
this.ok.Name = "ok";
|
||||
this.ok.Size = new System.Drawing.Size(75, 23);
|
||||
this.ok.TabIndex = 100;
|
||||
this.ok.Text = "OK";
|
||||
this.ok.UseVisualStyleBackColor = true;
|
||||
this.ok.Click += new System.EventHandler(this.ok_Click);
|
||||
//
|
||||
// browserCaptureDialog
|
||||
//
|
||||
this.browserCaptureDialog.RootFolder = System.Environment.SpecialFolder.MyComputer;
|
||||
//
|
||||
// settingsTabs
|
||||
//
|
||||
this.settingsTabs.Alignment = System.Windows.Forms.TabAlignment.Left;
|
||||
@@ -170,6 +188,8 @@
|
||||
tableLayoutPanel2.ColumnCount = 2;
|
||||
tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
tableLayoutPanel2.Controls.Add(this.AllowGlobalHook, 1, 7);
|
||||
tableLayoutPanel2.Controls.Add(label13, 0, 7);
|
||||
tableLayoutPanel2.Controls.Add(this.Formatter_PosExp, 1, 5);
|
||||
tableLayoutPanel2.Controls.Add(this.Formatter_NegExp, 1, 4);
|
||||
tableLayoutPanel2.Controls.Add(label6, 0, 3);
|
||||
@@ -182,14 +202,15 @@
|
||||
tableLayoutPanel2.Controls.Add(label7, 0, 5);
|
||||
tableLayoutPanel2.Controls.Add(this.Formatter_MaxFigures, 1, 3);
|
||||
tableLayoutPanel2.Controls.Add(this.Formatter_MinFigures, 1, 2);
|
||||
tableLayoutPanel2.Controls.Add(label3, 0, 7);
|
||||
tableLayoutPanel2.Controls.Add(this.CheckUpdate_AllowChecks, 1, 7);
|
||||
tableLayoutPanel2.Controls.Add(label3, 0, 8);
|
||||
tableLayoutPanel2.Controls.Add(this.CheckUpdate_AllowChecks, 1, 8);
|
||||
tableLayoutPanel2.Controls.Add(label11, 0, 6);
|
||||
tableLayoutPanel2.Controls.Add(this.browseCaptureDirectory, 1, 6);
|
||||
tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
tableLayoutPanel2.Location = new System.Drawing.Point(3, 16);
|
||||
tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||
tableLayoutPanel2.RowCount = 9;
|
||||
tableLayoutPanel2.RowCount = 10;
|
||||
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
@@ -201,6 +222,35 @@
|
||||
tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
tableLayoutPanel2.Size = new System.Drawing.Size(361, 285);
|
||||
tableLayoutPanel2.TabIndex = 0;
|
||||
//
|
||||
// AllowGlobalHook
|
||||
//
|
||||
this.AllowGlobalHook.AutoSize = true;
|
||||
this.AllowGlobalHook.Checked = true;
|
||||
this.AllowGlobalHook.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.AllowGlobalHook.Location = new System.Drawing.Point(268, 194);
|
||||
this.AllowGlobalHook.Name = "AllowGlobalHook";
|
||||
this.AllowGlobalHook.Size = new System.Drawing.Size(15, 14);
|
||||
this.AllowGlobalHook.TabIndex = 16;
|
||||
this.toolTip.SetToolTip(this.AllowGlobalHook, "Allow RenderDoc to insert a global hook into all processes to catch the execution" +
|
||||
" of the desired process, without directly launching it.");
|
||||
this.AllowGlobalHook.UseVisualStyleBackColor = true;
|
||||
this.AllowGlobalHook.CheckedChanged += new System.EventHandler(this.AllowGlobalHook_CheckedChanged);
|
||||
//
|
||||
// label13
|
||||
//
|
||||
label13.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
label13.AutoSize = true;
|
||||
label13.Location = new System.Drawing.Point(3, 191);
|
||||
label13.Name = "label13";
|
||||
label13.Size = new System.Drawing.Size(259, 20);
|
||||
label13.TabIndex = 15;
|
||||
label13.Text = "Allow global process hooking - be careful!";
|
||||
label13.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.toolTip.SetToolTip(label13, "Allows RenderDoc to phone home to http://renderdoc.org to anonymously check for n" +
|
||||
"ew versions.");
|
||||
//
|
||||
// Formatter_PosExp
|
||||
//
|
||||
@@ -408,7 +458,7 @@
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new System.Drawing.Point(3, 191);
|
||||
label3.Location = new System.Drawing.Point(3, 211);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new System.Drawing.Size(259, 20);
|
||||
label3.TabIndex = 12;
|
||||
@@ -422,7 +472,7 @@
|
||||
this.CheckUpdate_AllowChecks.AutoSize = true;
|
||||
this.CheckUpdate_AllowChecks.Checked = true;
|
||||
this.CheckUpdate_AllowChecks.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.CheckUpdate_AllowChecks.Location = new System.Drawing.Point(268, 194);
|
||||
this.CheckUpdate_AllowChecks.Location = new System.Drawing.Point(268, 214);
|
||||
this.CheckUpdate_AllowChecks.Name = "CheckUpdate_AllowChecks";
|
||||
this.CheckUpdate_AllowChecks.Size = new System.Drawing.Size(15, 14);
|
||||
this.CheckUpdate_AllowChecks.TabIndex = 8;
|
||||
@@ -701,21 +751,6 @@
|
||||
this.pagesTree.ViewOptions.ShowPlusMinus = false;
|
||||
this.pagesTree.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.pagesTree_AfterSelect);
|
||||
//
|
||||
// ok
|
||||
//
|
||||
this.ok.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ok.Location = new System.Drawing.Point(502, 327);
|
||||
this.ok.Name = "ok";
|
||||
this.ok.Size = new System.Drawing.Size(75, 23);
|
||||
this.ok.TabIndex = 100;
|
||||
this.ok.Text = "OK";
|
||||
this.ok.UseVisualStyleBackColor = true;
|
||||
this.ok.Click += new System.EventHandler(this.ok_Click);
|
||||
//
|
||||
// browserCaptureDialog
|
||||
//
|
||||
this.browserCaptureDialog.RootFolder = System.Environment.SpecialFolder.MyComputer;
|
||||
//
|
||||
// SettingsDialog
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@@ -779,5 +814,6 @@
|
||||
private System.Windows.Forms.CheckBox EventBrowser_HideEmpty;
|
||||
private System.Windows.Forms.Button browseCaptureDirectory;
|
||||
private System.Windows.Forms.FolderBrowserDialog browserCaptureDialog;
|
||||
private System.Windows.Forms.CheckBox AllowGlobalHook;
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,8 @@ namespace renderdocui.Windows.Dialogs
|
||||
TextureViewer_ResetRange.Checked = m_Core.Config.TextureViewer_ResetRange;
|
||||
ShaderViewer_FriendlyNaming.Checked = m_Core.Config.ShaderViewer_FriendlyNaming;
|
||||
CheckUpdate_AllowChecks.Checked = m_Core.Config.CheckUpdate_AllowChecks;
|
||||
|
||||
AllowGlobalHook.Checked = m_Core.Config.AllowGlobalHook;
|
||||
|
||||
{
|
||||
Type type = m_Core.Config.EventBrowser_TimeUnit.GetType();
|
||||
@@ -142,6 +144,16 @@ namespace renderdocui.Windows.Dialogs
|
||||
m_Core.Config.Serialize(Core.ConfigFilename);
|
||||
}
|
||||
|
||||
private void AllowGlobalHook_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
m_Core.Config.AllowGlobalHook = AllowGlobalHook.Checked;
|
||||
|
||||
m_Core.Config.Serialize(Core.ConfigFilename);
|
||||
|
||||
if (m_Core.CaptureDialog != null)
|
||||
m_Core.CaptureDialog.UpdateGlobalHook();
|
||||
}
|
||||
|
||||
private void EventBrowser_TimeUnit_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
{
|
||||
m_Core.Config.EventBrowser_TimeUnit = (PersistantConfig.TimeUnit)EventBrowser_TimeUnit.SelectedIndex;
|
||||
|
||||
@@ -129,6 +129,9 @@
|
||||
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="label13.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
|
||||
Reference in New Issue
Block a user