diff --git a/tests/test_handle.py b/tests/test_handle.py index c39c1d0..feda781 100644 --- a/tests/test_handle.py +++ b/tests/test_handle.py @@ -3,13 +3,14 @@ import windows.pipe from .pfwtest import * +@cross_heaven_gates # windows.system.handles def test_handle_process_id(): handle_with_process = [h for h in windows.system.handles if h.dwProcessId] handle = handle_with_process[-1] proc = handle.process assert proc.pid == handle.dwProcessId == handle.pid - +@cross_heaven_gates # windows.current_process.handles def test_local_handle_type(): t = windows.current_process.threads[0] th = t.handle diff --git a/tests/test_parse_pe.py b/tests/test_parse_pe.py index 91b1ed0..fa88f79 100644 --- a/tests/test_parse_pe.py +++ b/tests/test_parse_pe.py @@ -16,6 +16,7 @@ def pe(request): pop_proc = request.param proc = pop_proc() + for i in range(10): try: time.sleep(0.1) @@ -91,7 +92,7 @@ def test_pe_parsing_strange_optional_header_size(tmp_path, proc32): # Also check that section retrieval works (as its position is based on OptionalHeader Size) assert set(s.name for s in mod.pe.sections) == {".text", ".data", ".l1"} -# Make a test from current_process parsing ? +@dll_injection def test_pe_parsing_dotnet32_process_64(proc64, pe_dotnet32): # .NET pe32 loadable in 64bit process -> rewrite of the OptionalHeader mod = proc64.load_library(pe_dotnet32) @@ -108,6 +109,7 @@ def test_pe_parsing_dotnet32_process_64(proc64, pe_dotnet32): assert mod.pe.sections assert ".text" in set(s.name for s in mod.pe.sections) +@dll_injection def test_pe_parsing_dotnet32_current_process_64(proc64, pe_dotnet32): # .NET pe32 loadable in 64bit process -> rewrite of the OptionalHeader # So we injecte python code in a the remote proc64 to test the parsing from itself diff --git a/tests/test_process.py b/tests/test_process.py index 0ffe322..10f80cd 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -487,10 +487,12 @@ class TestProcessWithCheckGarbage(object): # Check type of teb.peb is the correct subclass (with modules & co) assert teb.peb.modules + @cross_heaven_gates def test_thread_teb_base(self, proc32_64): t = proc32_64.threads[0] assert t.teb_base != 0 + @cross_heaven_gates def test_teb(self, proc32_64): teb = proc32_64.threads[0].teb if proc32_64.bitness == 32: @@ -503,6 +505,7 @@ class TestProcessWithCheckGarbage(object): assert teb.peb.modules @windows_64bit_only + @cross_heaven_gates def test_thread_teb_syswow_base(self, proc32): t = proc32.threads[0] assert t.teb_base != 0 @@ -510,6 +513,7 @@ class TestProcessWithCheckGarbage(object): assert t.teb_base == t.teb_syswow_base + 0x2000 @windows_64bit_only + @cross_heaven_gates def test_thread_teb_syswow(self, proc32): teb_syswow = proc32.threads[0].teb_syswow assert type(teb_syswow) == windows.winobject.process.RemoteTEB64 diff --git a/tests/test_system.py b/tests/test_system.py index 09bb502..ecd07a8 100644 --- a/tests/test_system.py +++ b/tests/test_system.py @@ -51,6 +51,7 @@ class TestSystemWithCheckGarbage(object): def test_wmi(self): assert windows.system.wmi is not None + @cross_heaven_gates def test_handles(self): assert windows.system.handles @@ -66,6 +67,7 @@ class TestSystemWithCheckGarbage(object): def test_task_object_manager(self): assert windows.system.object_manager + @cross_heaven_gates def test_system_modules_ntosk(self): # NtQuerySystemInformation(gdef.SystemModuleInformation) returns CHAR so not unicode # Another Nt API that returns unicode ? @@ -83,6 +85,7 @@ class TestSystemWithCheckGarbageAndHandleLeak(object): assert windows.current_process.pid in [p.pid for p in procs] assert is_unicode(windows.system.processes[0].name) + @cross_heaven_gates def test_system_modules(self): assert windows.system.modules diff --git a/tests/test_system_modules.py b/tests/test_system_modules.py index 352bd4d..480a03e 100644 --- a/tests/test_system_modules.py +++ b/tests/test_system_modules.py @@ -1,6 +1,9 @@ import windows import ctypes +from pfwtest import * + +@cross_heaven_gates def test_system_module_gc(): # Test for issue 12 (Py3) # https://github.com/hakril/PythonForWindows/issues/12 diff --git a/tests/test_syswow.py b/tests/test_syswow.py index 56c7014..b1ac1d5 100644 --- a/tests/test_syswow.py +++ b/tests/test_syswow.py @@ -52,6 +52,7 @@ class TestSyswowCurrentProcess(object): @python_injection @windows_64bit_only class TestSyswowRemoteProcess(object): + @cross_heaven_gates def test_remote_pebsyswow(self, proc32): peb64 = proc32.peb_syswow modules_names = [m.name for m in peb64.modules] diff --git a/tests/test_wmi.py b/tests/test_wmi.py index a65a3f5..943edfa 100644 --- a/tests/test_wmi.py +++ b/tests/test_wmi.py @@ -75,6 +75,7 @@ def test_get_object(name, cls): # Todo: test # - put_instance +@cross_heaven_gates # proc.peb.commandline.str == cmdline @pytest.mark.parametrize("cmdline", [r"winver.exe test_string_pfw"]) def test_exec_method_Win32_Process_create(cmdline): namespace = windows.system.wmi["root\\cimv2"]