diff --git a/tests/test_process.py b/tests/test_process.py index 13b4e89..aea71d4 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -474,7 +474,7 @@ class TestProcessWithCheckGarbage(object): with proc32_64.allocated_memory(0x1000) as addr: assert proc32_64.get_mapped_filename(addr) is None - def test_current_thread_teb(): + def test_current_thread_teb(self): teb = windows.current_thread.teb assert ctypes.addressof(teb) == ctypes.addressof(windows.current_thread.teb.NtTib.Self[0]) assert ctypes.addressof(windows.current_process.peb) == ctypes.addressof(teb.ProcessEnvironmentBlock[0]) diff --git a/windows/winobject/process.py b/windows/winobject/process.py index 6bb6ab9..0af4cdd 100644 --- a/windows/winobject/process.py +++ b/windows/winobject/process.py @@ -916,8 +916,10 @@ class WinThread(Thread): @property def teb_syswow(self): - return RemoteTEB64(self.teb_syswow_base, self.owner) - + if windows.current_process.bitness == 64: + return RemoteTEB64(self.teb_syswow_base, self) + else: #current is 32bits + return RemoteTEB64(self.teb_syswow_base, windows.syswow64.ReadSyswow64Process(self.owner)) def exit(self, code=0): """Exit the thread"""