diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-05-14 14:35:43 +0800 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-05-14 14:35:43 +0800 |
commit | 6d4ad494e671dd00c8f95067a6ec734c92437d25 (patch) | |
tree | 8554b2f62eacad19377d4b3ca61b9ee228f09dcb | |
parent | f98d627277445282954413cb0e20116e26ff8183 (diff) | |
download | psutil-6d4ad494e671dd00c8f95067a6ec734c92437d25.tar.gz |
fix #1501: handle the case where NtQueryInformationProcess fails when dealing with 'Registry' win 10 pseudo process
-rw-r--r-- | HISTORY.rst | 3 | ||||
-rw-r--r-- | psutil/arch/windows/process_info.c | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/HISTORY.rst b/HISTORY.rst index 36977cbc..6b517766 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -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 ===== diff --git a/psutil/arch/windows/process_info.c b/psutil/arch/windows/process_info.c index 3b3c677e..ba9966bb 100644 --- a/psutil/arch/windows/process_info.c +++ b/psutil/arch/windows/process_info.c @@ -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) { |