From: Mark on
Not sure which the right fora are for this but the one obvious choice hasn't
been very helpful...

I have an ASP.Net page that is used to launch certain jobs using
System.Diagnostics.Process, based on a config. The config also allows the
web master to set which creds to use running the app - effected through
psexec.exe.

This had been working fine for many months, but recently the jobs spawned by
psexec.exe have been hanging - specifically anything that would run through
cmd.exe (bat files and the like). Any cmd.exe psexec spawn hangs and leaves
a System eventlog message "The application failed to initialize properly
(0xc0000142). Click on OK to terminate the application." Since the thing
isn't interacting with the desktop, it just hangs.

Non-cmd.exe commands launched by psexec.exe work just fine. To redirect
i/o, my web page launches cmd.exe, adds some debug output then launches
psexec. The parent cmd.exe runs fine. Psexec runs fine, only the cmd.exe
launched *by* psexec fail.

I posted to the Sysinternals forum but really haven't gotten any responses.

I googled around and found this cmd.exe launch failure was often associated
with a registry setting governing heap allocation to background jobs. I
upped the heap from 512k to 4mb and rebooted but it didn't help at all.

This worked for months and I haven't been able to figure out what suddenly
changed or what the root cause of the error is.

If anyone knows of a better forum to put this in, I'd also appreciate
re-direction.

Thanks
Mark

From: Mark on
Not got any nibbles yet, but here's what I've learned so far:

When psexec.exe is launching cmd.exe to run a bat file, the program
csrss.exe jumps in immediately after loading kernel32.dll and before
msvcrt.dll.

In the cases where cmd successfully launches, csrss.exe looks up a bunch of
presentation stuff (code page, color table, etc). In my case, when psexec is
launching a process without desktop interaction, csrss.exe looks up some
ErrorMode. Because of the error mode, it pops a non-existent "Click OK to
terminate" dialog box, leaving the cmd hung forever.

Still wondering why this csrss.exe check impacts only cmd.exe launched in
the background by psexec.exe and not others. What's the environmental
difference it's keying on?

"Mark" wrote:

> Not sure which the right fora are for this but the one obvious choice hasn't
> been very helpful...
>
> I have an ASP.Net page that is used to launch certain jobs using
> System.Diagnostics.Process, based on a config. The config also allows the
> web master to set which creds to use running the app - effected through
> psexec.exe.
>
> This had been working fine for many months, but recently the jobs spawned by
> psexec.exe have been hanging - specifically anything that would run through
> cmd.exe (bat files and the like). Any cmd.exe psexec spawn hangs and leaves
> a System eventlog message "The application failed to initialize properly
> (0xc0000142). Click on OK to terminate the application." Since the thing
> isn't interacting with the desktop, it just hangs.
>
> Non-cmd.exe commands launched by psexec.exe work just fine. To redirect
> i/o, my web page launches cmd.exe, adds some debug output then launches
> psexec. The parent cmd.exe runs fine. Psexec runs fine, only the cmd.exe
> launched *by* psexec fail.
>
> I posted to the Sysinternals forum but really haven't gotten any responses.
>
> I googled around and found this cmd.exe launch failure was often associated
> with a registry setting governing heap allocation to background jobs. I
> upped the heap from 512k to 4mb and rebooted but it didn't help at all.
>
> This worked for months and I haven't been able to figure out what suddenly
> changed or what the root cause of the error is.
>
> If anyone knows of a better forum to put this in, I'd also appreciate
> re-direction.
>
> Thanks
> Mark
>