A context manager that disable the SysWow64 Filesystem Redirection :: if is_process_32_bits: def pop_calc_64(): with windows.utils.DisableWow64FsRedirection(): return windows.utils.create_process(r"C:\Windows\system32\calc.exe", True)
| 605 | |
| 606 | |
| 607 | class DisableWow64FsRedirection(object): |
| 608 | """ |
| 609 | A context manager that disable the SysWow64 Filesystem Redirection :: |
| 610 | |
| 611 | if is_process_32_bits: |
| 612 | def pop_calc_64(): |
| 613 | with windows.utils.DisableWow64FsRedirection(): |
| 614 | return windows.utils.create_process(r"C:\Windows\system32\calc.exe", True) |
| 615 | """ |
| 616 | def __enter__(self): |
| 617 | if windows.current_process.bitness == 64 or windows.system.bitness == 32: |
| 618 | return self |
| 619 | self.OldValue = PVOID() |
| 620 | winproxy.Wow64DisableWow64FsRedirection(ctypes.byref(self.OldValue)) |
| 621 | return self |
| 622 | |
| 623 | def __exit__(self, exc_type, exc_value, traceback): |
| 624 | if windows.current_process.bitness == 64 or windows.system.bitness == 32: |
| 625 | return False |
| 626 | winproxy.Wow64RevertWow64FsRedirection(self.OldValue) |
| 627 | return False |