Using the sample code from "Creating a Simple Window NT Service in C++" by Nigel Thompson from Microsoft's technical article in the MSDN CDs, I created my own NT service that spawns another Win32 application called "ServerApp". After the NT service starts, the ServerApp is created using CreateProcess().
si.cb = sizeof(si);
CreateProcess(NULL, "C:\\ServerApp", NULL, NULL, FALSE,
0, NULL, NULL, &si, &pi);
However, for some reason, the ServeApp stays in a wait state and never completes the execution. Even after the NT service is stopped, the ServeApp remains in the wait state. I can't even kill the process. How can I get the process to start?