Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions withlockfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<char *>( commandLine.c_str() ),
Expand All @@ -140,7 +141,7 @@ int main( int argc, char **argv )
CREATE_SUSPENDED,
NULL,
NULL,
&si,
&sia,
&pi ) == FALSE ) {
throw Win32Error( "CreateProcessA", ::GetLastError() );
}
Expand Down Expand Up @@ -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.
Expand Down