Skip to content

Commit

Permalink
fix #1501: handle the case where NtQueryInformationProcess fails when…
Browse files Browse the repository at this point in the history
… dealing with 'Registry' win 10 pseudo process
  • Loading branch information
giampaolo committed May 14, 2019
1 parent f98d627 commit 6d4ad49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ XXXX-XX-XX
**Bug fixes**

- 1276_: [AIX] can't get whole cmdline(). (patch by Arnon Yaari)
- 1501_: [Windows] Process cmdline() and exe() raise unhandled "WinError 1168
element not found" exceptions for "Registry" and "Memory Compression" psuedo
processes on Windows 10.

5.6.2
=====
Expand Down
8 changes: 8 additions & 0 deletions psutil/arch/windows/process_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,14 @@ psutil_cmdline_query_proc(long pid, WCHAR **pdata, SIZE_T *psize) {
0,
&bufLen);

// 0xC0000225 == STATUS_NOT_FOUND, see:
// https://github.com/giampaolo/psutil/issues/1501
if (status == 0xC0000225) {
AccessDenied("NtQueryInformationProcess(ProcessBasicInformation) -> "
"STATUS_NOT_FOUND translated into PermissionError");
goto error;
}

if (status != STATUS_BUFFER_OVERFLOW && \
status != STATUS_BUFFER_TOO_SMALL && \
status != STATUS_INFO_LENGTH_MISMATCH) {
Expand Down

0 comments on commit 6d4ad49

Please sign in to comment.