- BOOL bSuccess = CreateProcess ( module, (LPTSTR)command_line.c_str(),
- 0, // PROCESS_SECURITY_ATTRIBUTES
- 0, // THREAD_SECURITY_ATTRIBUTES
- TRUE, // We went to inherit handles.
- CREATE_SUSPENDED | // Suspend the primary thread of the new process
- CREATE_PRESERVE_CODE_AUTHZ_LEVEL, // Allow us full access to the process
- 0, // ENVIRONMENT
- 0, // CURRENT_DIRECTORY
- &startupinfo, // startup info
- &procinfo); // process info
+ BOOL bSuccess = CreateProcess ( module, // Module (exe) filename
+ strdup(GetCommandLine()), // Command line (exe plus parameters from the OS)
+ // NOTE: We cannot return the direct value of the
+ // GetCommandLine function here, as the pointer is
+ // passed straight to the child process, and will be
+ // invalid once we exit as it goes out of context.
+ // strdup() seems ok, though.
+ 0, // PROCESS_SECURITY_ATTRIBUTES
+ 0, // THREAD_SECURITY_ATTRIBUTES
+ TRUE, // We went to inherit handles.
+ startupflags, // Allow us full access to the process and suspend it.
+ 0, // ENVIRONMENT
+ 0, // CURRENT_DIRECTORY
+ &startupinfo, // startup info
+ &procinfo); // process info