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

Windows >= 8.1 : get commandline through NtQueryInformationProcess + ProcessCommandLineInformation #1384

Closed
EccoTheFlintstone opened this issue Dec 19, 2018 · 2 comments

Comments

@EccoTheFlintstone
Copy link
Contributor

Starting from windows 8.1 and protected processes, it' impossible to get PROCESS_QUERY_INFORMATION | PROCESS_VM_READ on certain processes (protected processes for instance)
psutil retrieves the command line of processes by reading the PEB of those processes (thus needing PROCESS_VM_READ)

Starting from windows 8.1, it's possible to get the commandline of a process using NtQueryInformationProcess with ProcessCommandLineInformation class

To use this, only PROCESS_QUERY_LIMITED_INFORMATION rights are needed on the process

discussion about this here :
https://wj32.org/processhacker/forums/viewtopic.php?t=2760

implementation by process hacker here:
https://github.com/processhacker/processhacker/blob/master/phlib/native.c#L721

@giampaolo
Copy link
Owner

giampaolo commented Dec 19, 2018

Interesting. I suppose that means less AccessDenied exceptions. Thanks for digging into this. I'm not sure when I'll have time to look into this (definitively not this year) so if you're interested in working on a PR be my guest. =)

giampaolo pushed a commit that referenced this issue Feb 3, 2019
…mationProcess (see #1384) (#1398)

#1384, #1398: on windows 8.1, get cmdline() using NtQueryInformationProcess in case the original method fails with ACCESS_DENIED
@giampaolo
Copy link
Owner

Closing out as fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants