Maximum CreateProcessWithLogonW and NetUserAdd
I wrote a small function that will load multiple instances of the executable using CreateProcessWithLogonW
pseudocode:
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 that it is limited to 32 instances - additional instances fail -
Is there a limit to the number of users who can run processes at the same time?
thanks
Ash
source to share
From the documentation for CreateProcessWithLogonW :
There is a limit to the number of child processes that this function can create and run at the same time. For example, in Windows XP this limit
MAXIMUM_WAIT_OBJECTS*4
. In Windows 2000, this limitMAXIMUM_WAIT_OBJECTS
. However, you may not be able to create many processes due to the system-wide quota limits.
I tested MAXIMUM_WAIT_OBJECTS
on Windows XP and it is 64 so maybe you are hitting "system quota limits".
This post suggests using a combination of LogonUser and CreateProcessAsUser to avoid falling within these limits.
source to share