(self)
| 231 | addr += x.RegionSize |
| 232 | |
| 233 | def query_working_set(self): |
| 234 | if self.bitness == 64 or windows.current_process.bitness == 64: |
| 235 | WSET_BLOCK = EPSAPI_WORKING_SET_BLOCK64 |
| 236 | dummy = PSAPI_WORKING_SET_INFORMATION64() |
| 237 | else: |
| 238 | WSET_BLOCK = EPSAPI_WORKING_SET_BLOCK32 |
| 239 | dummy = PSAPI_WORKING_SET_INFORMATION32() |
| 240 | try: |
| 241 | windows.winproxy.QueryWorkingSet(self.handle, ctypes.byref(dummy), ctypes.sizeof(dummy)) |
| 242 | except WindowsError as e: |
| 243 | if e.winerror != 24: |
| 244 | raise |
| 245 | |
| 246 | NumberOfEntriesType = [f for f in WSET_BLOCK._fields_ if f[0] == "Flags"][0][1] |
| 247 | for i in range(10): |
| 248 | # use the same type as WSET_BLOCK.Flags |
| 249 | class GENERATED_PSAPI_WORKING_SET_INFORMATION(ctypes.Structure): |
| 250 | _fields_ = [ |
| 251 | ("NumberOfEntries", NumberOfEntriesType), |
| 252 | ("WorkingSetInfo", WSET_BLOCK * dummy.NumberOfEntries), |
| 253 | ] |
| 254 | res = GENERATED_PSAPI_WORKING_SET_INFORMATION() |
| 255 | try: |
| 256 | if windows.current_process.bitness == 32 and self.bitness == 64: |
| 257 | windows.syswow64.NtQueryVirtualMemory_32_to_64(self.handle, 0, MemoryWorkingSetList, res) |
| 258 | else: |
| 259 | windows.winproxy.QueryWorkingSet(self.handle, ctypes.byref(res), ctypes.sizeof(res)) |
| 260 | except WindowsError as e: |
| 261 | if e.winerror != 24: |
| 262 | raise |
| 263 | dummy.NumberOfEntries = res.NumberOfEntries |
| 264 | continue |
| 265 | except windows.generated_def.ntstatus.NtStatusException as e: |
| 266 | if e.code != STATUS_INFO_LENGTH_MISMATCH: |
| 267 | raise |
| 268 | dummy.NumberOfEntries = res.NumberOfEntries |
| 269 | continue |
| 270 | return res.WorkingSetInfo |
| 271 | # Raise ? |
| 272 | return None |
| 273 | |
| 274 | def query_working_setex(self, addresses): |
| 275 | if self.bitness == 64 or windows.current_process.bitness == 64: |
nothing calls this directly
no test coverage detected