summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-01-08 20:02:06 -0800
committerGiampaolo Rodola <g.rodola@gmail.com>2020-01-08 20:02:06 -0800
commitd40720b9e15a27a6e75840fa98cb922a5df9cb3e (patch)
tree381f46e54024c630b1d5acec97260825b95ce90f
parent298ef985181d6324338b51f23e226ec9a057cf7f (diff)
downloadpsutil-d40720b9e15a27a6e75840fa98cb922a5df9cb3e.tar.gz
skip handle types which are not REG files
-rw-r--r--psutil/arch/windows/process_handles.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/psutil/arch/windows/process_handles.c b/psutil/arch/windows/process_handles.c
index b4a95244..45a13a67 100644
--- a/psutil/arch/windows/process_handles.c
+++ b/psutil/arch/windows/process_handles.c
@@ -30,6 +30,8 @@
#define THREAD_TIMEOUT 100 // ms
// Global object shared between the 2 threads.
+// XXX: this is evil but not sure how to avoid it. Python GIL is supposed
+// to save us though.
PUNICODE_STRING globalFileName = NULL;
@@ -45,6 +47,12 @@ psutil_get_filename(LPVOID lpvParam) {
bufferSize = 0x200;
globalFileName = MALLOC_ZERO(bufferSize);
+ // Note: also this is supposed to hang, hence why we do it in here.
+ if (GetFileType(hFile) != FILE_TYPE_DISK) {
+ globalFileName->Length = 0;
+ return 0;
+ }
+
// A loop is needed because the I/O subsystem likes to give us the
// wrong return lengths...
do {