开发者

CreateProcess returns non 0 but GetExitCodeProcess() returns 128

I am creating an application that will start another process using CreateProcess(). And in the parent process I will use GetExitCodeProcess() to check whether the process active or not.

Here CreateProcess() is successful (returned a non negative value) but GetExitCodeProcess() returns 128 (There are no child processes to wait for). I am not seeing any trace of the child process started(usually some debugs). It happens intermittently.

Any idea what really happened to the child process?. Where we get more information (in system/ap开发者_JAVA技巧plication event logs?).

Please guide me.

Thanks, Naga


Thanks for your comments.

I have found the following MSDN articles that gives the same symptoms and resolution for the problem.


Cmd.exe, Perl.exe, or other console-mode applications may fail to initialize properly and terminate prematurely when launched by a service using the CreateProcess() or CreateProcessAsUser() APIs. The calling process has no way of knowing that the launched console-mode application has terminated prematurely.

In some instances, calling GetExitCode() against the failed process indicates the following exit code: 128L ERROR_WAIT_NO_CHILDREN - There are no child processes to wait for.


http://support.microsoft.com/kb/156484 http://support.microsoft.com/kb/142676/EN-US

http://support.microsoft.com/kb/175687/EN-US

Thanks, Naga

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜