Replace binary used for test as notepad.exe is now the Notepad.exe app + add check on pop_proc about result bitness

This commit is contained in:
clement rouault
2022-04-01 14:29:05 +02:00
parent d23a9813e9
commit 59e2cefee0
2 changed files with 13 additions and 5 deletions
+12 -4
View File
@@ -11,21 +11,29 @@ from .pfwtest import is_windows_32_bits, is_process_32_bits, test_binary_name, D
if is_windows_32_bits:
def pop_proc_32(dwCreationFlags=DEFAULT_CREATION_FLAGS):
return windows.utils.create_process(r"C:\Windows\system32\{0}".format(test_binary_name).encode("ascii"), dwCreationFlags=dwCreationFlags, show_windows=True)
p = windows.utils.create_process(r"C:\Windows\system32\{0}".format(test_binary_name).encode("ascii"), dwCreationFlags=dwCreationFlags, show_windows=True)
assert p.bitness == 32
return p
def pop_proc_64(dwCreationFlags=DEFAULT_CREATION_FLAGS):
raise WindowsError("Cannot create calc64 in 32bits system")
else:
def pop_proc_32(dwCreationFlags=DEFAULT_CREATION_FLAGS):
return windows.utils.create_process(r"C:\Windows\syswow64\{0}".format(test_binary_name).encode("ascii"), dwCreationFlags=dwCreationFlags, show_windows=True)
p = windows.utils.create_process(r"C:\Windows\syswow64\{0}".format(test_binary_name).encode("ascii"), dwCreationFlags=dwCreationFlags, show_windows=True)
assert p.bitness == 32
return p
if is_process_32_bits:
def pop_proc_64(dwCreationFlags=DEFAULT_CREATION_FLAGS):
with windows.utils.DisableWow64FsRedirection():
return windows.utils.create_process(r"C:\Windows\system32\{0}".format(test_binary_name).encode("ascii"), dwCreationFlags=dwCreationFlags, show_windows=True)
p = windows.utils.create_process(r"C:\Windows\system32\{0}".format(test_binary_name).encode("ascii"), dwCreationFlags=dwCreationFlags, show_windows=True)
assert p.bitness == 64
return p
else:
def pop_proc_64(dwCreationFlags=DEFAULT_CREATION_FLAGS):
return windows.utils.create_process(r"C:\Windows\system32\{0}".format(test_binary_name).encode("ascii"), dwCreationFlags=dwCreationFlags, show_windows=True)
p = windows.utils.create_process(r"C:\Windows\system32\{0}".format(test_binary_name).encode("ascii"), dwCreationFlags=dwCreationFlags, show_windows=True)
assert p.bitness == 64
return p
import sys
+1 -1
View File
@@ -28,7 +28,7 @@ require_admin = pytest.mark.skipif(not is_admin, reason="Test must be launched a
check_for_gc_garbage = pytest.mark.usefixtures("check_for_gc_garbage")
check_for_handle_leak = pytest.mark.usefixtures("check_for_handle_leak")
test_binary_name = "notepad.exe"
test_binary_name = "winver.exe"
DEFAULT_CREATION_FLAGS = gdef.CREATE_NEW_CONSOLE