N
nsp2092
Guest
Hi
I have a service which invokes a copy_file.exe using CreateProcess(). This copy_file.exe uses CreateProcessAsUser() to run the command "scp -Brv <source> <destination>" as different users.
STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
int flags = CREATE_DEFAULT_ERROR_MODE|CREATE_NEW_CONSOLE|CREATE_NEW_PROCESS_GROUP;
si.lpDesktop = "MYWS\\default";
si.dwFlags = STARTF_USESTDHANDLES;
rc = CreateProcessAsUser(userlogin, NULL, cmd_line, NULL, NULL, TRUE, flags, NULL, wdir, &si, &pi);
WaitForSingleObject(pi.hProcess, INFINITE);
GetExitCodeProcess(pi.hProcess, &rc)
If multiple such processes are invoked, some of the scp process exit with error code -1073741502 i.e. 0xC0000142 STATUS_DLL_INIT_FAILED. What is up with explains that 0xC0000142 may occur due to Desktop heap exhaustion which can happen when -
* Launching lots of applications
* Launching an application as a different user
* Launching an application to a different desktop
which are all true in my case.
To resolve this error, I changed si.lpDesktop=NULL. According to the documentation, if the lpDesktop member is NULL, the new process inherits the desktop and window station of its parent process.
Does setting si.lpDesktop=NULL mean that I am creating a non-interactive desktop?
Is there a limit on the number of child process that can inherit the parent process's desktop and window station? Is it possible to cause Desktop Heap Exhaustion even after setting lpDesktop to NULL?
Thanks!
Continue reading...
I have a service which invokes a copy_file.exe using CreateProcess(). This copy_file.exe uses CreateProcessAsUser() to run the command "scp -Brv <source> <destination>" as different users.
STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
int flags = CREATE_DEFAULT_ERROR_MODE|CREATE_NEW_CONSOLE|CREATE_NEW_PROCESS_GROUP;
si.lpDesktop = "MYWS\\default";
si.dwFlags = STARTF_USESTDHANDLES;
rc = CreateProcessAsUser(userlogin, NULL, cmd_line, NULL, NULL, TRUE, flags, NULL, wdir, &si, &pi);
WaitForSingleObject(pi.hProcess, INFINITE);
GetExitCodeProcess(pi.hProcess, &rc)
If multiple such processes are invoked, some of the scp process exit with error code -1073741502 i.e. 0xC0000142 STATUS_DLL_INIT_FAILED. What is up with explains that 0xC0000142 may occur due to Desktop heap exhaustion which can happen when -
* Launching lots of applications
* Launching an application as a different user
* Launching an application to a different desktop
which are all true in my case.
To resolve this error, I changed si.lpDesktop=NULL. According to the documentation, if the lpDesktop member is NULL, the new process inherits the desktop and window station of its parent process.
Does setting si.lpDesktop=NULL mean that I am creating a non-interactive desktop?
Is there a limit on the number of child process that can inherit the parent process's desktop and window station? Is it possible to cause Desktop Heap Exhaustion even after setting lpDesktop to NULL?
Thanks!
Continue reading...