Subversion Repositories Games.Chess Giants

Rev

Rev 53 | Rev 77 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 53 Rev 54
Line 45... Line 45...
45
   // build the chess engine module path and pathname
45
   // build the chess engine module path and pathname
46
   swprintf_s (chessenginemodule_path, WCHAR_SIZEOF (chessenginemodule_path), L"%s/engines/%s", app_path, options.engine.program);
46
   swprintf_s (chessenginemodule_path, WCHAR_SIZEOF (chessenginemodule_path), L"%s/engines/%s", app_path, options.engine.program);
47
   swprintf_s (chessenginemodule_pathname, WCHAR_SIZEOF (chessenginemodule_pathname), L"%s/engines/%s/%s", app_path, options.engine.program, options.engine.program_options.cmdline);
47
   swprintf_s (chessenginemodule_pathname, WCHAR_SIZEOF (chessenginemodule_pathname), L"%s/engines/%s/%s", app_path, options.engine.program, options.engine.program_options.cmdline);
48
 
48
 
49
   // prepare the pipes' security attributes
49
   // prepare the pipes' security attributes
-
 
50
   memset (&saAttr, 0, sizeof (saAttr));
50
   saAttr.nLength = sizeof (SECURITY_ATTRIBUTES);
51
   saAttr.nLength = sizeof (SECURITY_ATTRIBUTES);
51
   saAttr.bInheritHandle = true; // set the bInheritHandle flag so pipe handles are inherited
52
   saAttr.bInheritHandle = true; // set the bInheritHandle flag so pipe handles are inherited
52
   saAttr.lpSecurityDescriptor = NULL;
-
 
53
 
53
 
54
   // create a pipe for the child process's stdout
54
   // create a pipe for the child process's stdout
55
   CreatePipe (&hChessEngineStdoutRd, &hChessEngineStdoutWr, &saAttr, 0);
55
   CreatePipe (&hChessEngineStdoutRd, &hChessEngineStdoutWr, &saAttr, 0);
56
   SetHandleInformation (hChessEngineStdoutRd, HANDLE_FLAG_INHERIT, 0); // ensure the read handle to the pipe for STDOUT is not inherited
56
   SetHandleInformation (hChessEngineStdoutRd, HANDLE_FLAG_INHERIT, 0); // ensure the read handle to the pipe for STDOUT is not inherited
57
 
57
 
58
   // create a pipe for the child process's stdin
58
   // create a pipe for the child process's stdin
59
   CreatePipe (&hChessEngineStdinRd, &hChessEngineStdinWr, &saAttr, 0);
59
   CreatePipe (&hChessEngineStdinRd, &hChessEngineStdinWr, &saAttr, 0);
60
   SetHandleInformation (hChessEngineStdinWr, HANDLE_FLAG_INHERIT, 0); // ensure the write handle to the pipe for STDIN is not inherited. 
60
   SetHandleInformation (hChessEngineStdinWr, HANDLE_FLAG_INHERIT, 0); // ensure the write handle to the pipe for STDIN is not inherited. 
61
 
61
 
62
   // spawn the chess engine process with redirected input and output
62
   // spawn the chess engine process with redirected input and output
63
   memset (&si, 0, sizeof (si));
63
   memset (&si, 0, sizeof (si));
64
   si.cb = sizeof (STARTUPINFOA);
64
   si.cb = sizeof (STARTUPINFOA);