tags:

views:

49

answers:

1

I have written a small function that will load multiple instances of an executable using CreateProcessWithLogonW

the pseudo-code:

for ( i=0;i<100;i++)
 {
 sprintf(user,"user%i",i);
 sprintf(pass,"pass%i",i);
 if(NetUserGetInfo(user,pass)==NOT_FOUND) { NetUserAdd(user,pass); }
 aaProcessCreateWithLogin("prog.exe",user,pass);
 }

it works fine, except , it is limited to 32 instances - additional instances fail -

Is there a limit to the number of users that can launch processes at the same time ?

Thanks

Ash

+1  A: 

From the documentation for CreateProcessWithLogonW:

There is a limit to the number of child processes that can be created by this function and run simultaneously. For example, on Windows XP, this limit is MAXIMUM_WAIT_OBJECTS*4. On Windows 2000, this limit is MAXIMUM_WAIT_OBJECTS. However, you may not be able to create this many processes due to system-wide quota limits.

I've tested MAXIMUM_WAIT_OBJECTS on Windows XP and it is 64, so maybe you are hitting the 'system-wide quota limits'.

This post suggests using a combination of LogonUser and CreateProcessAsUser instead to avoid hitting these limits.

Matthew Murdoch