Example #1
0
        public void AddModification(EnvironmentModification mod, bool silent)
        {
            TreelistView.Node node = new TreelistView.Node();
            int idx = ExistingIndex();
            if (idx >= 0)
                node = variables.Nodes[idx];

            if (mod.variable.Trim() == "")
            {
                if(!silent)
                    MessageBox.Show("Environment variable cannot be just whitespace", "Invalid variable", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            variables.BeginUpdate();

            if (idx < 0)
                variables.Nodes.Add(node);

            node.SetData(new object[] { mod.variable, mod.GetTypeString(), mod.value });
            node.Tag = mod;

            variables.EndUpdate();

            variables.NodesSelection.Clear();
            variables.NodesSelection.Add(node);

            varName.AutoCompleteCustomSource.Clear();
            for (int i = 0; i < variables.Nodes.Count; i++)
                varName.AutoCompleteCustomSource.Add((string)variables.Nodes[i][0]);
        }
Example #2
0
        private void addUpdate_Click(object sender, EventArgs e)
        {
            EnvironmentModification mod = new EnvironmentModification();
            mod.variable = varName.Text;
            mod.value = varValue.Text;
            mod.separator = (EnvironmentSeparator)pendSeparator.SelectedIndex;

            if (appendType.Checked)
                mod.type = EnvironmentModificationType.Append;
            else if (prependType.Checked)
                mod.type = EnvironmentModificationType.Prepend;
            else
                mod.type = EnvironmentModificationType.Set;

            AddModification(mod, false);

            varName.Text = "";
            varName.Text = mod.variable;
        }
Example #3
0
        private LiveCapture OnInjectTrigger(UInt32 PID, EnvironmentModification[] env, string name, CaptureOptions opts)
        {
            if (!PromptCloseLog())
                return null;

            string logfile = m_Core.TempLogFilename(name);

            UInt32 ret = StaticExports.InjectIntoProcess(PID, env, logfile, opts);

            if (ret == 0)
            {
                MessageBox.Show(string.Format("Error injecting into process {0} for capture.\n\nCheck diagnostic log in Help menu for more details.", PID),
                                   "Error kicking capture", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }

            var live = new LiveCapture(m_Core, "", ret, this);
            ShowLiveCapture(live);
            return live;
        }
Example #4
0
        private LiveCapture OnCaptureTrigger(string exe, string workingDir, string cmdLine, EnvironmentModification[] env, CaptureOptions opts)
        {
            if (!PromptCloseLog())
                return null;

            string logfile = m_Core.TempLogFilename(Path.GetFileNameWithoutExtension(exe));

            UInt32 ret = m_Core.Renderer.ExecuteAndInject(exe, workingDir, cmdLine, env, logfile, opts);

            if (ret == 0)
            {
                MessageBox.Show(string.Format("Error launching {0} for capture.\n\nCheck diagnostic log in Help menu for more details.", exe),
                                   "Error kicking capture", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }

            var live = new LiveCapture(m_Core, m_Core.Renderer.Remote == null ? "" : m_Core.Renderer.Remote.Hostname, ret, this);
            ShowLiveCapture(live);
            return live;
        }
Example #5
0
        public UInt32 ExecuteAndInject(string app, string workingDir, string cmdLine, EnvironmentModification[] env, string logfile, CaptureOptions opts)
        {
            if (m_Remote == null)
            {
                return StaticExports.ExecuteAndInject(app, workingDir, cmdLine, env, logfile, opts);
            }
            else
            {
                UInt32 ret = 0;

                lock (m_Remote)
                {
                    ret = m_Remote.ExecuteAndInject(app, workingDir, cmdLine, env, opts);
                }

                return ret;
            }
        }
Example #6
0
        private void SetEnvironmentModifications(EnvironmentModification[] modifications)
        {
            m_EnvModifications = modifications;

            string envModText = "";

            foreach (var mod in modifications)
            {
                if (envModText != "")
                    envModText += ", ";

                envModText += mod.GetDescription();
            }

            environmentDisplay.Text = envModText;
        }
Example #7
0
        public static UInt32 InjectIntoProcess(UInt32 pid, EnvironmentModification[] env, string logfile, CaptureOptions opts)
        {
            IntPtr logfile_mem = CustomMarshal.MakeUTF8String(logfile);

            IntPtr env_mem = RENDERDOC_MakeEnvironmentModificationList(env.Length);

            for (int i = 0; i < env.Length; i++)
            {
                IntPtr var_mem = CustomMarshal.MakeUTF8String(env[i].variable);
                IntPtr val_mem = CustomMarshal.MakeUTF8String(env[i].value);

                RENDERDOC_SetEnvironmentModification(env_mem, i, var_mem, val_mem, env[i].type, env[i].separator);

                CustomMarshal.Free(var_mem);
                CustomMarshal.Free(val_mem);
            }

            UInt32 ret = RENDERDOC_InjectIntoProcess(pid, env_mem, logfile_mem, opts, false);

            RENDERDOC_FreeEnvironmentModificationList(env_mem);

            CustomMarshal.Free(logfile_mem);

            return ret;
        }
Example #8
0
        public static UInt32 ExecuteAndInject(string app, string workingDir, string cmdLine, EnvironmentModification[] env, string logfile, CaptureOptions opts)
        {
            IntPtr app_mem = CustomMarshal.MakeUTF8String(app);
            IntPtr workingDir_mem = CustomMarshal.MakeUTF8String(workingDir);
            IntPtr cmdLine_mem = CustomMarshal.MakeUTF8String(cmdLine);
            IntPtr logfile_mem = CustomMarshal.MakeUTF8String(logfile);

            IntPtr env_mem = RENDERDOC_MakeEnvironmentModificationList(env.Length);

            for(int i=0; i < env.Length; i++)
            {
                IntPtr var_mem = CustomMarshal.MakeUTF8String(env[i].variable);
                IntPtr val_mem = CustomMarshal.MakeUTF8String(env[i].value);

                RENDERDOC_SetEnvironmentModification(env_mem, i, var_mem, val_mem, env[i].type, env[i].separator);

                CustomMarshal.Free(var_mem);
                CustomMarshal.Free(val_mem);
            }

            UInt32 ret = RENDERDOC_ExecuteAndInject(app_mem, workingDir_mem, cmdLine_mem, env_mem, logfile_mem, opts, false);

            RENDERDOC_FreeEnvironmentModificationList(env_mem);

            CustomMarshal.Free(app_mem);
            CustomMarshal.Free(workingDir_mem);
            CustomMarshal.Free(cmdLine_mem);
            CustomMarshal.Free(logfile_mem);

            return ret;
        }