- Home /
Getting Win32Exception: error and not sure what to do
Hi everyone, So I'm trying to use System.Diagnostics.Process to access command propmt so I can tell a program(phantomjs) to run a javascript file. But I'm getting a Win32Exception error and I'm not sure what that means or what to do. Here is my code.
import System.Diagnostics;
var i:int;
var command:String;
var arguments:String;
function Start()
{
var process = new Process();
process.StartInfo.FileName=command;
process.StartInfo.Arguments = arguments;
process.StartInfo.RedirectStandardError=true;
process.StartInfo.RedirectStandardOutput=true;
process.StartInfo.CreateNoWindow=true;
process.StartInfo.WorkingDirectory = "C:\\Users\\m7a\\Documents\\StuffFromDevin\\D3 Demo\\phantomjs-1.8.0-windows";
process.StartInfo.UseShellExecute=false;
process.Start();
}
I'd really love any help, I've sort of hit a wall. Thanks.
Answer by Drakmyth · Jan 02, 2013 at 08:27 PM
The MSDN documentation for System.Diagnostics.Process mentions the following tidbit:
Note: A 32-bit processes cannot access the modules of a 64-bit process. If you try to get information about a 64-bit process from a 32-bit process, you will get a Win32Exception exception.
As of this past June, Unity did not have 64-bit support (this was before Unity 4, but I don't know if that is something they added or not). Since I don't see separate installers for 32 or 64-bit versions of phantomjs, I'm guessing it auto-detects, so if you're running on a 64-bit machine, it probably installed the 64-bit version of the program.
I'm not saying this is the problem, I don't know, but it definitely could be and it's a good place to start. Another thought I had was that you could be running into permission problems, though I'm not sure how to go about checking or resolving that.