def get_open_files(self): if self.pid in (0, 4): return [] retlist = [] # Filenames come in in native format like: # "\Device\HarddiskVolume1\Windows\systemew\file.txt" # Convert the first part in the corresponding drive letter # (e.g. "C:\") by using Windows's QueryDosDevice() raw_file_names = _psutil_mswindows.get_process_open_files(self.pid) for file in raw_file_names: file = _convert_raw_path(file) if isfile_strict(file) and file not in retlist: ntuple = nt_openfile(file, -1) retlist.append(ntuple) return retlist
def get_open_files(self): if self.pid in (0, 4) or self.pid == 8 and _WIN2000: return [] retlist = [] # Filenames come in in native format like: # "\Device\HarddiskVolume1\Windows\systemew\file.txt" # Convert the first part in the corresponding drive letter # (e.g. "C:\") by using Windows's QueryDosDevice() raw_file_names = _psutil_mswindows.get_process_open_files(self.pid) for file in raw_file_names: if sys.version_info >= (3, ): file = file.decode('utf8') if file.startswith('\\Device\\'): rawdrive = '\\'.join(file.split('\\')[:3]) driveletter = _psutil_mswindows.win32_QueryDosDevice(rawdrive) file = file.replace(rawdrive, driveletter) if os.path.isfile(file) and file not in retlist: ntuple = ntuple_openfile(file, -1) retlist.append(ntuple) return retlist
def get_open_files(self): if self.pid in (0, 4) or self.pid == 8 and _WIN2000: return [] retlist = [] # Filenames come in in native format like: # "\Device\HarddiskVolume1\Windows\systemew\file.txt" # Convert the first part in the corresponding drive letter # (e.g. "C:\") by using Windows's QueryDosDevice() raw_file_names = _psutil_mswindows.get_process_open_files(self.pid) for file in raw_file_names: if sys.version_info >= (3,): file = file.decode('utf8') if file.startswith('\\Device\\'): rawdrive = '\\'.join(file.split('\\')[:3]) driveletter = _psutil_mswindows.win32_QueryDosDevice(rawdrive) file = file.replace(rawdrive, driveletter) if os.path.isfile(file) and file not in retlist: ntuple = ntuple_openfile(file, -1) retlist.append(ntuple) return retlist