CreateProcessAsUser fails in Windows 7 after 7 invocations - winapi

My service spawns a process for each core on the target machine using CreateProcessAsUser. The process is a MFC program which has been modified to run using commandline parameters rather than GUI controls. It has run successfully in this scenario since XP. I have two new machines running WIN7 x64 one with 8 cores and one with 12 cores but on both machines 7 processes get created and execute successfully but the 8th process starts and then dies. The process dies on MFC LoadFrame call with no exit code.
I have written my service so it can be run from the command line and when I execute it from the command line as the same user I use in CreateProcessAsUser I can successfully get the 8th 9th 10th etc process to start and execute normally. As you can imagine getting 7 to start makes me think I'm calling CreateProcessAsUser "fairly" correctly. Failing on LoadFrame suggests windows station or desktop problems. Any ideas?

Related

Windows 2000 Shutdown on Program Close

Is there a way to signal windows 2000 to shutdown when a specific program closes? I tried doing it by scheduling a task but couldn't find the shutdown executable, apparently it's only include starting in windows 2003. My next thoughts were with a batch file but I couldn't find any documentation on the command to use.
To summarize the comments & further information therein, this question is closer to the following:
How can I monitor a process on a Windows 2000 VM, running in VirtualBox, so that I can kill off the VM when the process I care about falls over?
Working from there, something like http://www.virtualbox.org/manual/ch08.html#vboxmanage-guestcontrol would be the way to go. Create a process which tells VirtualBox to start your process & then perform the shutdown when that process terminates. You'd essentially be constructing a supervisory process outside of the Win2K environment, however you want to accomplish that, rather than trying to work within the environment itself.

How can I run an alert program when a Windows Service fails to start?

I have a Windows service whose start-up is set to 'Automatic', so it starts whenever the system boots up.
But this jobs sometimes did not start due to unknown reasons. I want to setup an alert program (.bat) to run whenever the service fails to start.
I tried using Recovery Mode options in service property, but it is not working. I think it is for jobs crashing with errors.
You can create a script that lists the service of yours and see whether it is running (using the sc command). Then you might to put that script to Startup menu. Should the script run before the service is started, you would need to schedule the script to be running periodically (to give the service some time to be started) using either of schtasks, at, or back in the nt4 days there was (still functional I presume) nice gui version of at in nt 4 resource kit called winat, if you have access to it.

Execute two commands as a single action in windows command prompt

We have a system where an application A starts the second application B to run in background (no gui or console window should be shown). However, the first application should be able to execute a command and continue working without waiting for the second one to finish. After B has finished, an empty file is created to indicate this to application A. This is the requirement because this system is built so that it can run on both Windows and Linux machines as well as clusters and therefore the file cannot be directly created by application B.
Here is the equivalent Linux command issued by application A:
{ B; touch done.txt; } &
The question is how to produce the same effect in Windows?

Install newer .NET and run a child process that uses it from one parent process?

I'm trying to automate some test runs in my company and constraint I operate under is that I have one process (that I can change to run whatever I want), but once it finishes automation cleans up machine.
I cannot change state of machine before this process starts.
Requirement for test is to install .NET 4.5 and then start another process that uses it.
Problem I'm facing is that second process cannot find some of .NET 4.5 dll's that get installed in one of the previous steps (I basically start installer process, it finishes and then I kick off tests).
If I remote desktop into that machine and start test process manually again it loads and works correctly.
So my quiestion is - is there any way to start test process as a child of "system" or can I make it reload environment somehow?

Simple "Hello World!" console application crashes when run by windows TaskScheduler (1.0)

I have a batch file which starts multiple instances of simple console application (Hello World!). I work on Windows server 2008 64-bit. I configure it to run in TaskScheduler, at startup, and whether user is logged-in or not. The later configuration means that the instances will run without GUI (i.e. - no window).
When I run this task, some of the instances just fail, after consuming 100& CPU. Application event-log shows the following error:
"Faulting module KERNEL32.dll, version 6.0.6002.18005, time stamp 0x49e0421d, exception code 0xc0000142, fault offset 0x00000000000b8fb8, process id 0x29bc, application start time 0x01cae17d94a61895."
Running the batch file directly works just fine. It seems to me that the OS has a problem loading too many instances of the application when no window is displayed. However - I can’t figure out why...
Any idea??
This issue has a fix, thanks to Microsoft expert:
http://social.msdn.microsoft.com/Forums/en/windowsgeneraldevelopmentissues/thread/9102531c-cf60-4682-b014-c11a190b00f1?prof=required

Resources