我想调用debug 的 U命令来反汇编一个程序
代码是这样写的
Process p = new Process(); p.StartInfo.FileName = "debug.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p2.StandardInput.WriteLine("u");
p2.StandardInput.WriteLine("quit");
textBox1.Text = p.StandardOutput.ReadToEnd();
我这样写有很多不对的地方
1.如果在CMD里应该传路径 debug f:/1.exe
2.正常不传路径 写U 也应该给出一些反汇编的代码,而我写的这个 返回值什么都没有请高手帮忙 这个应该怎么用?
代码是这样写的
Process p = new Process(); p.StartInfo.FileName = "debug.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p2.StandardInput.WriteLine("u");
p2.StandardInput.WriteLine("quit");
textBox1.Text = p.StandardOutput.ReadToEnd();
我这样写有很多不对的地方
1.如果在CMD里应该传路径 debug f:/1.exe
2.正常不传路径 写U 也应该给出一些反汇编的代码,而我写的这个 返回值什么都没有请高手帮忙 这个应该怎么用?
private void Test(object sender, EventArgs e)
{
Process p = new Process(); p.StartInfo.FileName = "cmd.exe";
p.StartInfo.Arguments = "/c /im Debug.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true; p.Start();
p.StandardInput.WriteLine("exit"); return;
}
主要是参数传不进去 能传进去的时候 就出现了 无限等待 需要手动结束cmd 才能得到结果