diff --git a/withlockfile.cpp b/withlockfile.cpp index 72005f6..46573f1 100644 --- a/withlockfile.cpp +++ b/withlockfile.cpp @@ -127,10 +127,11 @@ int main( int argc, char **argv ) PROCESS_INFORMATION pi = { 0 }; - STARTUPINFO si = { sizeof( si ) }; - si.hStdError = ::GetStdHandle( STD_ERROR_HANDLE ); - si.hStdOutput = ::GetStdHandle( STD_OUTPUT_HANDLE ); - si.hStdInput = ::GetStdHandle( STD_INPUT_HANDLE ); + STARTUPINFOA sia = { sizeof(sia)}; + sia.hStdError = ::GetStdHandle(STD_ERROR_HANDLE); + sia.hStdOutput = ::GetStdHandle(STD_OUTPUT_HANDLE); + sia.hStdInput = ::GetStdHandle(STD_INPUT_HANDLE); + if ( ::CreateProcessA( executable.c_str(), const_cast( commandLine.c_str() ), @@ -140,7 +141,7 @@ int main( int argc, char **argv ) CREATE_SUSPENDED, NULL, NULL, - &si, + &sia, &pi ) == FALSE ) { throw Win32Error( "CreateProcessA", ::GetLastError() ); } @@ -192,7 +193,7 @@ int main( int argc, char **argv ) throw Win32Error( "CloseHandle", ::GetLastError() ); } - return 0; + return exitCode; } catch ( const Win32Error &e ) { /* The MSDN documentation for FormatMessage says that the buf cannot * be larger than 64K bytes.