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

boost::process::limit_handles limited to PIDs below 65535 #428

Open
Breakwell opened this issue Nov 8, 2024 · 1 comment
Open

boost::process::limit_handles limited to PIDs below 65535 #428

Breakwell opened this issue Nov 8, 2024 · 1 comment

Comments

@Breakwell
Copy link

The call to get_handles is limited to PID sizes of up to 65535 (USHRT_MAX). This is because of this call to NtQuerySystemInformation.

As it's undocumented it's hard to hunt down but it looks like the NtQuerySystemInformation call is limited to PIDs in the range of an unsigned short. To fix this instead of SYSTEM_HANDLE_INFORMATION we would need to consider using SYSTEM_HANDLE_INFORMATION_EX to query the system handles.

I think it would be safer to possibly use UpdateProcThreadAttribute() (at least for vista +) as suggested originally. It seems a bit unnecessary to iterate over all the system handles in order to limit the handles inherited by a process when UpdateProcThreadAttribute() is supported.

@klemens-morgenstern
Copy link
Collaborator

There's a PR for adding this to v2: #423

I'll deprecate v1 in the upcoming release, so I don't know if I'll add this.

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

No branches or pull requests

2 participants