boost::process::limit_handles limited to PIDs below 65535
- Dominant language
- C++
- Stars
- 145
- Forks
- 151
- PR merge metrics
- No merged PRs in 30d
Description
The call to [get_handles](https://github.com/boostorg/process/blob/58446b502a5fc2680789bb41b69dba74bb9230e6/include/boost/process/v1/detail/windows/handles.hpp#L136) is limited to PID sizes of up to 65535 (USHRT_MAX). This is because of [this](https://github.com/boostorg/process/blob/58446b502a5fc2680789bb41b69dba74bb9230e6/include/boost/process/v1/detail/windows/handles.hpp#L41) 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](https://github.com/klemens-morgenstern/boost-process/pull/196/files#r280065110). 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.