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

Consider using NtQuerySystemInformation to retrieve process exe() #1445

Closed
giampaolo opened this issue Feb 28, 2019 · 2 comments
Closed

Consider using NtQuerySystemInformation to retrieve process exe() #1445

giampaolo opened this issue Feb 28, 2019 · 2 comments

Comments

@giampaolo
Copy link
Owner

Right now in order to get the process exe() we use QueryFullProcessImageNameW (or GetProcessImageFileNameW on Win XP), see #1394 (comment).

It seems ProcessHacker uses NtQuerySystemInformation instead:
https://github.com/processhacker/processhacker/blob/a39d0f312c863ccb1c4ed927bfcd8eedac1b5fd7/phlib/native.c#L4800

This is somewhat similar to #1398. Using NtQuerySystemInformation instead of QueryFullProcessImageNameW may result in less AccessDenied exceptions for low pid processes.

@giampaolo
Copy link
Owner Author

It turns out NtQuerySystemInformation retrieves the exe for all processes except PIDs 0 and 4. QueryFullProcessImageNameW on the other hand is much more limited (basically you get AccessDenied for any process not owned by your user).
Also, it's around 40 times faster!!

@giampaolo
Copy link
Owner Author

Implemented in PR #1677.

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

1 participant