STARTUPINFO si;
PROCESS_INFORMATION piProcInfo;
SECURITY_ATTRIBUTES saAttr;
+ char cmd_path[MAX_PATH];
+
+ if (!GetEnvironmentVariableA("COMSPEC", cmd_path, ARRAYSIZE(cmd_path)))
+ {
+ if (GetSystemDirectoryA(cmd_path, ARRAYSIZE(cmd_path)))
+ {
+ StringCchCatA(cmd_path, ARRAYSIZE(cmd_path), "\\cmd.exe");
+ }
+ else
+ {
+ StringCchCopyA(cmd_path, ARRAYSIZE(cmd_path), "C:\\ReactOS\\system32\\cmd.exe");
+ }
+ }
- const char *name = "c:\\reactos\\system32\\cmd.exe";
- const char *cmd = NULL;
- //const char *name = "d:\\cygwin\\bin\\bash.exe";
- //const char *cmd = "d:\\cygwin\\bin\\bash.exe --login -i";
-
saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
saAttr.bInheritHandle = TRUE;
saAttr.lpSecurityDescriptor = NULL;
//si.dwFlags |= STARTF_USESHOWWINDOW;
//si.wShowWindow = SW_SHOW;
- if (!CreateProcess((LPSTR) name, // executable module
- (LPSTR) cmd, // command line
+ if (!CreateProcess(cmd_path, // executable module
+ NULL, // command line
NULL, // process security attributes
NULL, // primary thread security attributes
TRUE, // handles are inherited