diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2021-10-18 20:53:32 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2021-10-18 20:53:32 +0200 |
commit | d1cce5caed1b9c3809ed5e2f80c9c413afd0c09a (patch) | |
tree | d3efc2a9ae475ea9e85122df11c6198d85614dfd | |
parent | adbfeae3525769c7c001000ab8dd816e88b18736 (diff) | |
download | psutil-d1cce5caed1b9c3809ed5e2f80c9c413afd0c09a.tar.gz |
update HISTORY to include #1981, CREDIT @PetrPospisil, fix C linter warnings
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
-rw-r--r-- | CREDITS | 4 | ||||
-rw-r--r-- | HISTORY.rst | 3 | ||||
-rw-r--r-- | psutil/_psutil_windows.c | 12 |
3 files changed, 13 insertions, 6 deletions
@@ -770,3 +770,7 @@ I: 1948 N: Saeed Rasooli W: https://github.com/ilius I: 1996 + +N: PetrPospisil +W: https://github.com/PetrPospisil +I: 1980 diff --git a/HISTORY.rst b/HISTORY.rst index fb43a196..9319ba1c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -45,6 +45,9 @@ XXXX-XX-XX (patch by MaWe2019) - 1965_: [Windows] fix "Fatal Python error: deallocating None" when calling psutil.users() multiple times. +- 1980_: [Windows] 32bit / WOW64 processes fails to read process name longer + than 128 characters resulting in AccessDenied. This is now fixed. (patch + by PetrPospisil) - 1991_: process_iter() can raise TypeError if invoked from multiple threads (not thread-safe). diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index 0a6ac726..6a128ae2 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -366,15 +366,14 @@ psutil_proc_exe(PyObject *self, PyObject *args) { sizeof(SYSTEM_PROCESS_ID_INFORMATION), NULL); - if (status == STATUS_INFO_LENGTH_MISMATCH && processIdInfo.ImageName.MaximumLength <= bufferSize) { + if ((status == STATUS_INFO_LENGTH_MISMATCH) && + (processIdInfo.ImageName.MaximumLength <= bufferSize)) + { // Required length was NOT stored in MaximumLength (WOW64 issue). - - ULONG maxBufferSize = 0x7FFF * 2; // NTFS_MAX_PATH * sizeof(wchar_t) - + ULONG maxBufferSize = 0x7FFF * 2; // NTFS_MAX_PATH * sizeof(wchar_t) do { // Iteratively double the size of the buffer up to maxBufferSize bufferSize *= 2; - FREE(buffer); buffer = MALLOC_ZERO(bufferSize); if (! buffer) { @@ -390,7 +389,8 @@ psutil_proc_exe(PyObject *self, PyObject *args) { &processIdInfo, sizeof(SYSTEM_PROCESS_ID_INFORMATION), NULL); - } while (status == STATUS_INFO_LENGTH_MISMATCH && bufferSize <= maxBufferSize); + } while ((status == STATUS_INFO_LENGTH_MISMATCH) && + (bufferSize <= maxBufferSize)); } else if (status == STATUS_INFO_LENGTH_MISMATCH) { // Required length is stored in MaximumLength. |