GuillaumeGomez / sysinfo

Cross-platform library to fetch system information
MIT License
2.19k stars 320 forks source link

Process parent is `None` if the target process of `refresh_process_specifics()` is a WoW64 process #1313

Closed Chaoses-Ib closed 4 months ago

Chaoses-Ib commented 4 months ago

https://github.com/GuillaumeGomez/sysinfo/blob/1f17db7428fb568a2c3af803fc3d550dd924b5b3/src/windows/process.rs#L805-L829

If the target process is a WoW64 process, NtQueryInformationProcess(ProcessBasicInformation) is skipped and process.parent is not set. However, NtQueryInformationProcess(ProcessBasicInformation) actually works fine for WoW64 processes, at least for the InheritedFromUniqueProcessId part.

Simply moving this NtQueryInformationProcess out of the if guard seems to solve the problem. If needed, I can make a PR for this change.

OS: Windows 24H2 26100.1000

sysinfo: 0.30.13

GuillaumeGomez commented 4 months ago

It would be very appreciated! :)