Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark sockets as non-inheritable on Windows #2782

Closed
wants to merge 2 commits into from
Closed

Conversation

rom1v
Copy link
Collaborator

@rom1v rom1v commented Nov 14, 2021

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.

One possibility could be to use an extended API to set extra attributes
on process creation:

But it seems that this API is not available on MinGW (it does not
compile).

As an alternative, explicitly mark all sockets as non-inheritable.

Fixes #2779


Replace these binaries in your v1.20 release:

  • scrcpy.exe sha256:6ab57110d07088e0793c1e1a8d2caabdc5811ade54bfeb5646778f6563cd7169
  • scrcpy-server sha256:b20aee4951f99b060c4a44000ba94de973f9604758ef62beb253b371aad3df34

@rom1v rom1v changed the base branch from master to dev November 14, 2021 18:57
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.

One possibility could be to use an extended API to set extra attributes
on process creation:
 - <https://stackoverflow.com/a/28185363/1987178>
 - <https://devblogs.microsoft.com/oldnewthing/20111216-00/?p=8873>

But it seems that this API is not available on MinGW (it does not
compile).

As an alternative, explicitly mark all sockets as non-inheritable.

Fixes #2779 <#2779>
@rom1v
Copy link
Collaborator Author

rom1v commented Nov 14, 2021

Will do differently.

@rom1v rom1v closed this Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

V1.20 version can only open one device window when multiple devices are connected.
1 participant