No new process, after succeede launch of CreateProcess

Viewed 38

I am trying to create program that will monitor the execution of another process. If the process crashes, my program would restart it. (Kinda process monitor). I have main class called ProcessController. There's ProcessController::Start() method that should start the new process. There's code:

ProcessController::Start()
{

        if (!CreateProcess(
            m_progPath.c_str(),           //Program name
            NULL,        // Command line
            NULL,           // Process handle not inheritable
            NULL,           // Thread handle not inheritable
            FALSE,          // Set handle inheritance to FALSE
            0,              // No creation flags
            NULL,           // Use parent's environment block
            NULL,           // Use parent's starting directory 
            &m_si,            // Pointer to STARTUPINFO structure
            &m_pi)           // Pointer to PROCESS_INFORMATION structure
            )
        {
            printf("CreateProcess failed (%d).\n", GetLastError());
            return false;
        }

        ... other code

}

I never see error code, so CreateProcess executes well, however, no new procees appear (can't see new process in task manager and no windows appears. The app I'm trying to launch also writes logs, but no new logs after I ran my ProcessController.) Permissions of the process I'm trying to launch are set to enable execute it. If I am trying to create notepad++ process using my code, it works fine. The notepad++ window appears. I always use full path to the program I am trying to start with my controller.

Am I doing something wrong??

0 Answers
Related