scrcpy/app/src
Romain Vimont 9cb14b5166 Inherit only specific handles on Windows
To be able to communicate with a child process via stdin, stdout and
stderr, the CreateProcess() parameter bInheritHandles must be set to
TRUE. But this causes *all* handles to be inherited, including sockets.

As a result, the server socket was inherited by the process running adb
to execute the server on the device, so it could not be closed properly,
causing other scrcpy instances to fail.

To fix the issue, use an extended API to explicitly set the HANDLEs to
inherit:
 - <https://stackoverflow.com/a/28185363/1987178>
 - <https://devblogs.microsoft.com/oldnewthing/20111216-00/?p=8873>

Fixes #2779 <https://github.com/Genymobile/scrcpy/issues/2779>
PR #2783 <https://github.com/Genymobile/scrcpy/pull/2783>
2021-11-15 10:13:30 +01:00
..
android Fix typos 2021-04-18 14:36:31 +02:00
sys Inherit only specific handles on Windows 2021-11-15 10:13:30 +01:00
trait Extract mouse processor trait 2021-10-26 21:30:04 +02:00
util Move str_util to str 2021-11-14 01:22:22 +01:00
adb.c Move str_util to str 2021-11-14 01:22:22 +01:00
adb.h Improve process API 2021-11-12 22:44:37 +01:00
adb_tunnel.c Rename SC_INVALID_SOCKET to SC_SOCKET_NONE 2021-11-14 01:22:22 +01:00
adb_tunnel.h Extract adb tunnel to a separate component 2021-11-14 01:22:22 +01:00
aoa_hid.c Delay HID events on Ctrl+v 2021-10-26 21:30:04 +02:00
aoa_hid.h Move scrcpy option structs to options.h 2021-10-27 18:43:47 +02:00
cli.c Move str_util to str 2021-11-14 01:22:22 +01:00
cli.h Move scrcpy option structs to options.h 2021-10-27 18:43:47 +02:00
clock.c Improve slope estimation on start 2021-07-14 14:54:22 +02:00
clock.h Fix typo in clock comments 2021-10-29 12:21:34 +02:00
common.h Add container_of() macro 2021-04-25 14:38:42 +02:00
compat.c Provide strdup() compat 2021-02-17 09:53:25 +01:00
compat.h Disable synthetic mouse events from touch events 2021-10-31 12:45:59 +01:00
control_msg.c Move str_util to str 2021-11-14 01:22:22 +01:00
control_msg.h Use sc_ prefix for size, position and point 2021-10-30 15:20:39 +02:00
controller.c Use sc_ prefix for sockets 2021-10-26 22:49:45 +02:00
controller.h Use sc_ prefix for sockets 2021-10-26 22:49:45 +02:00
coords.h Use sc_ prefix for size, position and point 2021-10-30 15:20:39 +02:00
decoder.c Add missing includes 2021-09-20 18:27:37 +02:00
decoder.h Add support for v4l2loopback 2021-04-25 14:59:10 +02:00
device_msg.c Replace SDL_strdup() by strdup() 2021-02-17 09:54:03 +01:00
device_msg.h Replace SDL_strdup() by strdup() 2021-02-17 09:54:03 +01:00
events.h Run the server from a dedicated thread 2021-11-13 10:19:52 +01:00
file_handler.c Improve process API 2021-11-12 22:44:37 +01:00
file_handler.h Improve process API 2021-11-12 22:44:37 +01:00
fps_counter.c Replace delay by deadline in timedwait() 2021-07-14 14:22:32 +02:00
fps_counter.h Wrap tick API 2021-07-14 14:22:32 +02:00
frame_buffer.c Extract current video_buffer to frame_buffer 2021-07-14 14:22:32 +02:00
frame_buffer.h Extract current video_buffer to frame_buffer 2021-07-14 14:22:32 +02:00
hid_keyboard.c Increase delay to inject HID on Ctrl+v 2021-11-14 01:23:06 +01:00
hid_keyboard.h Synchronize HID keyboard state on first event 2021-10-26 21:30:04 +02:00
icon.c Fix compilation errors with old SDL versions 2021-11-14 15:37:30 +01:00
icon.h Add icon loader 2021-10-25 18:08:37 +02:00
input_manager.c Use sc_ prefix for size, position and point 2021-10-30 15:20:39 +02:00
input_manager.h Move scrcpy option structs to options.h 2021-10-27 18:43:47 +02:00
keyboard_inject.c Extract keyboard processor trait 2021-10-26 21:30:04 +02:00
keyboard_inject.h Move scrcpy option structs to options.h 2021-10-27 18:43:47 +02:00
main.c Define default options as const struct 2021-10-27 18:43:47 +02:00
mouse_inject.c Use sc_ prefix for size, position and point 2021-10-30 15:20:39 +02:00
mouse_inject.h Move scrcpy option structs to options.h 2021-10-27 18:43:47 +02:00
opengl.c Enable trilinear filtering for OpenGL 2020-04-15 17:39:51 +02:00
opengl.h Define feature test macros in common.h 2021-01-17 14:08:48 +01:00
options.c Define v4l2 option field only if HAVE_V4L2 2021-10-27 18:43:47 +02:00
options.h Define v4l2 option field only if HAVE_V4L2 2021-10-27 18:43:47 +02:00
receiver.c Use sc_ prefix for sockets 2021-10-26 22:49:45 +02:00
receiver.h Use sc_ prefix for sockets 2021-10-26 22:49:45 +02:00
recorder.c Move str_util to str 2021-11-14 01:22:22 +01:00
recorder.h Use sc_ prefix for size, position and point 2021-10-30 15:20:39 +02:00
scrcpy.c Use sc_ prefix for server 2021-11-14 01:23:05 +01:00
scrcpy.h Move scrcpy option structs to options.h 2021-10-27 18:43:47 +02:00
screen.c Make screen_render() static 2021-11-12 22:44:22 +01:00
screen.h Make screen_render() static 2021-11-12 22:44:22 +01:00
server.c Stop connection attempts if interrupted 2021-11-14 15:40:59 +01:00
server.h Use sc_ prefix for server 2021-11-14 01:23:05 +01:00
stream.c Use sc_ prefix for sockets 2021-10-26 22:49:45 +02:00
stream.h Use sc_ prefix for sockets 2021-10-26 22:49:45 +02:00
v4l2_sink.c Move str_util to str 2021-11-14 01:22:22 +01:00
v4l2_sink.h Use sc_ prefix for size, position and point 2021-10-30 15:20:39 +02:00
video_buffer.c Add buffering debugging tools 2021-07-14 14:54:22 +02:00
video_buffer.h Add buffering debugging tools 2021-07-14 14:54:22 +02:00