• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

C/C++ CreateProcess Problem

lo0ney

New Member
Joined
Jan 14, 2009
Messages
6 (0.00/day)
Hey, I'm trying to figure out a problem with CreateProcess.

CreateProcess seems to no longer launch cmd.exe and GetLastError returns no error (0). Heres the snippet:
Code:
        STARTUPINFO si;
    PROCESS_INFORMATION pi;
    SOCKET sClient = (SOCKET)lpParam;
    
    memset(&si, 0, sizeof(STARTUPINFO));
    si.cb = sizeof(STARTUPINFO);
    si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW | STARTF_USEPOSITION;
    si.wShowWindow = SW_HIDE;
    si.hStdError = si.hStdInput = si.hStdOutput = (HANDLE)sClient;
    si.dwX = GetSystemMetrics(SM_CXSCREEN);
    si.dwY = GetSystemMetrics(SM_CYSCREEN);
    
    //SetCurrentDirectory(szSystemDir);
    CreateProcess(NULL, "cmd.exe", NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi);

I monitor in taskmngr and the process cmd.exe does not execute
 
Top