pw1886
June 1st, 2004, 10:10 PM
Hi, all,
I wrote a program to start another application in NT Service. I called CreateProcess to start the application, however, in my client site, the function returns failure and GetLastError returns ERROR_ALREADY_EXISTS.
Here are what I found:
- I found that there is no other instance of my program (service or the app) in task manager.
- even when I reboot the machine, the same error comes out, I cannot get my application started properly.
- It only happens in my customer site. I cannot repeat that problem on my machines.
- I found that there is little material describing ERROR_ALREADY_EXISTS for CreateProcess. I need help.
Does anyone has encountered this error before? Can you tell me a bit of our experience and what's happening? Thanks for your kindly help.
Here is the portion of the code:
// Start the child process.
if( !CreateProcess(NULL, pszAppPath,
NULL, NULL, FALSE, 0, NULL, NULL, &si, &g_pi) )
{
CHAR szBuf[80];
DWORD dw = GetLastError();
sprintf(szBuf, "MyServiceMain() GetLastError returned %u\n", dw);
printf(szBuf);
return;
}
else
{
printf("MyServiceMain() CreateProcess succeed.\n");
}
// Wait until child process exits.
WaitForSingleObject(g_pi.hProcess, INFINITE);
I wrote a program to start another application in NT Service. I called CreateProcess to start the application, however, in my client site, the function returns failure and GetLastError returns ERROR_ALREADY_EXISTS.
Here are what I found:
- I found that there is no other instance of my program (service or the app) in task manager.
- even when I reboot the machine, the same error comes out, I cannot get my application started properly.
- It only happens in my customer site. I cannot repeat that problem on my machines.
- I found that there is little material describing ERROR_ALREADY_EXISTS for CreateProcess. I need help.
Does anyone has encountered this error before? Can you tell me a bit of our experience and what's happening? Thanks for your kindly help.
Here is the portion of the code:
// Start the child process.
if( !CreateProcess(NULL, pszAppPath,
NULL, NULL, FALSE, 0, NULL, NULL, &si, &g_pi) )
{
CHAR szBuf[80];
DWORD dw = GetLastError();
sprintf(szBuf, "MyServiceMain() GetLastError returned %u\n", dw);
printf(szBuf);
return;
}
else
{
printf("MyServiceMain() CreateProcess succeed.\n");
}
// Wait until child process exits.
WaitForSingleObject(g_pi.hProcess, INFINITE);