I am trying to create a child process with the following command:
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
CreateProcess( NULL, // No module name (use command line)
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
&si, // Pointer to STARTUPINFO structure
&pi );
It crashes over here and I am not sure why.
Now my original process takes command line parameters, so do I have to pass them here also? If so then since I am not creating child process from int main() so can I do the following:
LPTSTR szCmdline = TEXT("nmctest -s TS -r DMR -tlLDMR");
Then pass szCmdline inside CreateProcess()?
Can someone please help me why this is crashing?
siandpi. - alkSTARTUPINFO si = {0};is the idiomatic way to zero initialise a struct. No need forZeroMemory. - David Heffernan