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: Do not fail ProcState.Get when run by non-admin #121

Merged
merged 2 commits into from
May 27, 2019

Conversation

adriansr
Copy link

@adriansr adriansr commented May 24, 2019

When running under Windows as a non-administrator user, ProcState.Get() will fail with the error "OpenProcessToken failed for pid=XXX: Permission denied".

This is a known issue under Windows: A non-admin won't be able to access the token of most processes, regardless of privileges (i.e. SeDebugPrivilege).

This PR allows ProcState.Get to return with a missing username instead of failing completely.

I also took the opportunity to fix a case where it would be leaking a handle under an error condition.

When running under Windows as a non-administrator  user, ProcState.Get()
will fail with the error "OpenProcessToken failed for pid=XXX:
Permission denied".

This is a known issue under Windows: A non-admin won't be able to
access the token of most processes, regardless of privileges
(i.e. SeDebugPrivilege).

We should still allow ProcState.Get to return with a missing username
instead of failing completely.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants