Skip to content

Commit 029f7cb

Browse files
committed
More TEB syswow fix
1 parent 36c1eb6 commit 029f7cb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tests/test_process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def test_mapped_filename(self, proc32_64):
474474
with proc32_64.allocated_memory(0x1000) as addr:
475475
assert proc32_64.get_mapped_filename(addr) is None
476476

477-
def test_current_thread_teb():
477+
def test_current_thread_teb(self):
478478
teb = windows.current_thread.teb
479479
assert ctypes.addressof(teb) == ctypes.addressof(windows.current_thread.teb.NtTib.Self[0])
480480
assert ctypes.addressof(windows.current_process.peb) == ctypes.addressof(teb.ProcessEnvironmentBlock[0])

windows/winobject/process.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,10 @@ def teb_syswow_base(self):
916916

917917
@property
918918
def teb_syswow(self):
919-
return RemoteTEB64(self.teb_syswow_base, self.owner)
920-
919+
if windows.current_process.bitness == 64:
920+
return RemoteTEB64(self.teb_syswow_base, self)
921+
else: #current is 32bits
922+
return RemoteTEB64(self.teb_syswow_base, windows.syswow64.ReadSyswow64Process(self.owner))
921923

922924
def exit(self, code=0):
923925
"""Exit the thread"""

0 commit comments

Comments
 (0)