Generator function that iterates through a memory map, filtering memory region blocks by any given condition. @type memory_map: list( L{win32.MemoryBasicInformation} ) @param memory_map: List of memory region information objects. Returned by L{Process.get_memory_map}.
(memory_map, condition)
| 470 | |
| 471 | |
| 472 | def CustomAddressIterator(memory_map, condition): |
| 473 | """ |
| 474 | Generator function that iterates through a memory map, filtering memory |
| 475 | region blocks by any given condition. |
| 476 | |
| 477 | @type memory_map: list( L{win32.MemoryBasicInformation} ) |
| 478 | @param memory_map: List of memory region information objects. |
| 479 | Returned by L{Process.get_memory_map}. |
| 480 | |
| 481 | @type condition: function |
| 482 | @param condition: Callback function that returns C{True} if the memory |
| 483 | block should be returned, or C{False} if it should be filtered. |
| 484 | |
| 485 | @rtype: generator of L{win32.MemoryBasicInformation} |
| 486 | @return: Generator object to iterate memory blocks. |
| 487 | """ |
| 488 | for mbi in memory_map: |
| 489 | if condition(mbi): |
| 490 | address = mbi.BaseAddress |
| 491 | max_addr = address + mbi.RegionSize |
| 492 | while address < max_addr: |
| 493 | yield address |
| 494 | address = address + 1 |
| 495 | |
| 496 | |
| 497 | def DataAddressIterator(memory_map): |
no outgoing calls
no test coverage detected