diff options
author | James Ross-Gowan <rossymiles@gmail.com> | 2016-01-06 23:08:13 +1100 |
---|---|---|
committer | James Ross-Gowan <rossymiles@gmail.com> | 2016-01-07 23:37:06 +1100 |
commit | c19f634e6cbdeaffed1d56ecd3a31c0652820cdf (patch) | |
tree | ade0dbf8d433ce9b7b60e6fe6051cb562572a39f /osdep/win32-console-wrapper.c | |
parent | 82e81421d737dae9a54098d8dc9d174c764340be (diff) | |
download | mpv-c19f634e6cbdeaffed1d56ecd3a31c0652820cdf.tar.bz2 mpv-c19f634e6cbdeaffed1d56ecd3a31c0652820cdf.tar.xz |
win32: fix fd://
Windows definitely supports Unix-style fd inheritance. This mostly
worked when launched from mpv.exe, though mpv should change the file
mode to O_BINARY. When launched from mpv.com, the wrapper must pass the
list of handles (stored in the undocumented lpReserved2 and cbReserved2
fields) to the mpv process.
Diffstat (limited to 'osdep/win32-console-wrapper.c')
-rw-r--r-- | osdep/win32-console-wrapper.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/osdep/win32-console-wrapper.c b/osdep/win32-console-wrapper.c index 8cebcf8c83..778d699161 100644 --- a/osdep/win32-console-wrapper.c +++ b/osdep/win32-console-wrapper.c @@ -37,6 +37,7 @@ void cr_perror(const wchar_t *prefix) int cr_runproc(wchar_t *name, wchar_t *cmdline) { STARTUPINFO si; + STARTUPINFO our_si; PROCESS_INFORMATION pi; DWORD retval = 1; @@ -47,6 +48,12 @@ int cr_runproc(wchar_t *name, wchar_t *cmdline) si.hStdError = GetStdHandle(STD_ERROR_HANDLE); si.dwFlags |= STARTF_USESTDHANDLES; + // Copy the list of inherited CRT file descriptors to the new process + our_si.cb = sizeof(our_si); + GetStartupInfo(&our_si); + si.lpReserved2 = our_si.lpReserved2; + si.cbReserved2 = our_si.cbReserved2; + ZeroMemory(&pi, sizeof(pi)); if (!CreateProcessW(name, cmdline, NULL, NULL, TRUE, 0, |