T
Tobias Johansson
Hello,
I'm having what I believe a security problem
to execute an executable file from a windows service
in windows server 2003.
It works fine in WIN XP SP2
The program(the service) itself just continues as if nothing where wrong
after process.Start is executed and I get an Exit code from the process
and HasExited is true, however in the process list in taskmanager i don't
see the process when it starts.
no exception is caught
When I run the same code on a console program (on Win 2003) everything works
just fine.
The Process I'm trying to start is unmanaged code made in Cobol.
Code is on latest Framework 2.0 Beta (2.0.41115)
Any help is greatly appreciated
Best Regards
Tobias
Code:
try
{
System.Diagnostics.ProcessStartInfo psi = new
System.Diagnostics.ProcessStartInfo(@"D:\Program\MyProgram\ExtExp.exe");
psi.RedirectStandardOutput = true;
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
psi.UseShellExecute = false;
psi.Arguments = "#DEF
\"C:\\Program\\MyService\\Exp\\Def\\ExtExpWRFA.def\"";
System.Diagnostics.Process pProcess;
pProcess = System.Diagnostics.Process.Start(psi);
Log.Write("started");
System.IO.StreamReader myOutput = pProcess.StandardOutput;
pProcess.WaitForExit(5000);
if (pProcess.HasExited)
{
Log.Write("exited");
string output = myOutput.ReadToEnd();
Log.Write("out:--"+output);
Log.Write("exit code: " + pProcess.ExitCode.ToString());
return true;
}
else
{
Log.Write("NO exit");
return false;
}
}
catch (Exception ex)
{
Log.Write("Exp:" + ex.Message);
return false;
}
I'm having what I believe a security problem
to execute an executable file from a windows service
in windows server 2003.
It works fine in WIN XP SP2
The program(the service) itself just continues as if nothing where wrong
after process.Start is executed and I get an Exit code from the process
and HasExited is true, however in the process list in taskmanager i don't
see the process when it starts.
no exception is caught
When I run the same code on a console program (on Win 2003) everything works
just fine.
The Process I'm trying to start is unmanaged code made in Cobol.
Code is on latest Framework 2.0 Beta (2.0.41115)
Any help is greatly appreciated
Best Regards
Tobias
Code:
try
{
System.Diagnostics.ProcessStartInfo psi = new
System.Diagnostics.ProcessStartInfo(@"D:\Program\MyProgram\ExtExp.exe");
psi.RedirectStandardOutput = true;
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
psi.UseShellExecute = false;
psi.Arguments = "#DEF
\"C:\\Program\\MyService\\Exp\\Def\\ExtExpWRFA.def\"";
System.Diagnostics.Process pProcess;
pProcess = System.Diagnostics.Process.Start(psi);
Log.Write("started");
System.IO.StreamReader myOutput = pProcess.StandardOutput;
pProcess.WaitForExit(5000);
if (pProcess.HasExited)
{
Log.Write("exited");
string output = myOutput.ReadToEnd();
Log.Write("out:--"+output);
Log.Write("exit code: " + pProcess.ExitCode.ToString());
return true;
}
else
{
Log.Write("NO exit");
return false;
}
}
catch (Exception ex)
{
Log.Write("Exp:" + ex.Message);
return false;
}