diff options
Diffstat (limited to 'tools/windows/process.c')
-rw-r--r-- | tools/windows/process.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/windows/process.c b/tools/windows/process.c index 3bf7e58..0cd09fc 100644 --- a/tools/windows/process.c +++ b/tools/windows/process.c @@ -54,7 +54,7 @@ void die_windows_error(const char *fmt, ...) if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, GetLastError(), + NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&msg, 0, NULL)) msg = "(failed to retrieve Windows error message)"; @@ -146,10 +146,10 @@ void pipeline(const char *const *argv, struct pipeline *pl) { HANDLE in_read_handle, in_write_handle; SECURITY_ATTRIBUTES sec_attr; - PROCESS_INFORMATION proc_info; + PROCESS_INFORMATION proc_info; STARTUPINFO start_info; char *cmdline = make_command_line(argv); - + sec_attr.nLength = sizeof sec_attr; sec_attr.bInheritHandle = TRUE; sec_attr.lpSecurityDescriptor = NULL; @@ -159,11 +159,11 @@ void pipeline(const char *const *argv, struct pipeline *pl) if (!SetHandleInformation(in_write_handle, HANDLE_FLAG_INHERIT, 0)) die_windows_error("SetHandleInformation"); - + /* when in Rome... */ ZeroMemory(&proc_info, sizeof proc_info); ZeroMemory(&start_info, sizeof start_info); - + start_info.cb = sizeof start_info; start_info.dwFlags |= STARTF_USESTDHANDLES; @@ -172,7 +172,7 @@ void pipeline(const char *const *argv, struct pipeline *pl) || (start_info.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE)) == INVALID_HANDLE_VALUE) die_windows_error("GetStdHandle"); - + start_info.hStdInput = in_read_handle; if (!CreateProcess(NULL, cmdline, NULL, NULL, TRUE, 0, @@ -196,7 +196,7 @@ int finish_pipeline(struct pipeline *pl) if (close(pl->infd)) die_errno(errno, "close"); - + for (;;) { if (!GetExitCodeProcess(pl->proc_handle, &code)) die_windows_error("GetExitCodeProcess"); @@ -210,6 +210,6 @@ int finish_pipeline(struct pipeline *pl) if (!CloseHandle(pl->proc_handle)) die_windows_error("CloseHandle for process"); - + return code; } |