开发者

Running 64-bit executable in System32 from 32-bit code

I am trying to run an executable from a 32-bit C# app (on a 64-bit OS), but I’m getting “The system cannot find the file specified” probably because wsqmcons.exe does not exist in C:\Windows\SySWOW64. The file does exist in System32. What is the best开发者_高级运维 way to run wsqmcons.exe from code, if possible?

Process p = new Process();
p.StartInfo.Arguments = "-f";
p.StartInfo.FileName = @"C:\Windows\System32\wsqmcons.exe";
p.Start();
p.WaitForExit();
Verify.AreEqual(0, p.ExitCode);


You will need to turn off the file system redirection on your 32 bit process with the Wow64DisableWow64FsRedirection and the re-enable it with Wow64RevertWow64FsRedirection.


A 64-bit executable file located under %windir%\System32 cannot be launched from a 32-bit process, because the file system redirector redirects the path to %windir%\SysWOW64. Do not disable redirection to accomplish this; use %windir%\Sysnative instead. For more information, see File System Redirector.

Quote from http://msdn.microsoft.com/en-us/library/windows/desktop/aa384203%28v=vs.85%29.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜