SHORT VERSION
How do you know which DLL does not load (and possibly why) when the process exits with error code -1073741502?
LONG TERM
I am trying to write a pretxnchangegroup hook for Mercurial, and as part of this hook I need to get the result of the command:
hg log
The code that I use to start and run the hg.exe process is as follows:
string Command = "log"; Process p = new Process(); ProcessStartInfo psi = p.StartInfo; p.StartInfo.FileName = @"C:\Program Files (x86)\Mercurial\hg.exe"; psi.CreateNoWindow = true; psi.LoadUserProfile = true; psi.RedirectStandardError = true; psi.RedirectStandardOutput = true; psi.UseShellExecute = false; psi.WorkingDirectory = Environment.CurrentDirectory; p.StartInfo.Arguments = Command; // Pass-through environment variables psi.UserName = Properties.Settings.Default.HG_User; psi.Domain = Properties.Settings.Default.HG_Domain; psi.Password = new System.Security.SecureString(); foreach (char c in Properties.Settings.Default.HG_Pass) { psi.Password.AppendChar(c); } p.Start(); p.WaitForExit();
The problem is that the process continues to exit with error code -1073741502, without outputting anything to standard output or standard error. After some research on the Internet, I found that this error code has something to do with the fact that the application cannot initialize correctly (cannot find the DLL, maybe?), But I donβt know how to find out how to fix it.
Keep in mind that this hook is called when I click on the repository over the Internet (therefore IIS calls Mercurial CGI through Python, which has this program configured as a hook).
In a completely different web application, I can just run the HG commands, and I can also run this by running runas /user:<same account as in the code> /noprofile cmd.exe , and then manually enter the hg command line.
Also, if I set UseShellExecute = true , then it runs just fine, but then I cannot get the standard output. I really feel like just making a web service call in a web application that can successfully execute this command, but that would be a very ugly solution.
Any ideas why this thing is not being implemented?
c # windows mercurial process winapi
Ryan
source share