diff --git a/TODO b/TODO index 3164434..975ab85 100644 --- a/TODO +++ b/TODO @@ -3,9 +3,6 @@ TODO: - Better WMI interface - - ProcessMemory object ? (metasm like) - - - remove pe_parse.transform_ctypes_fields (use utils.transform_ctypes_fields) - DBG - Verif multiple bp at same place.. - Verif multiple pending at same place @@ -35,6 +32,7 @@ TODO: Documentation * verif samples + * COMImplementation (example in LKD) FIXME: - setup.py build seems to raise an error diff --git a/ctypes_generation/generate.py b/ctypes_generation/generate.py index 665953b..1f40651 100644 --- a/ctypes_generation/generate.py +++ b/ctypes_generation/generate.py @@ -298,10 +298,9 @@ class FuncGenerator(CtypesGenerator): return ctypes_code class NtStatusGenerator(CtypesGenerator): - HEADER_IMPORT = dedent(""" + IMPORT_HEADER = dedent(""" import ctypes {deps} - """) HEADER = dedent(""" class NtStatusException(WindowsError): diff --git a/windows/generated_def/ntstatus.py b/windows/generated_def/ntstatus.py index fd7346d..f501a65 100644 --- a/windows/generated_def/ntstatus.py +++ b/windows/generated_def/ntstatus.py @@ -1,4 +1,7 @@ + +import ctypes from windef import * + class NtStatusException(WindowsError): ALL_STATUS = {} def __init__(self , code): diff --git a/windows/winproxy.py b/windows/winproxy.py index 931c8e9..3f60689 100644 --- a/windows/winproxy.py +++ b/windows/winproxy.py @@ -100,7 +100,8 @@ class ExportNotFound(RuntimeError): class ApiProxy(object): APIDLL = None """Create a python wrapper around a kernel32 function""" - def __init__(self, func_name, error_check=None): + def __init__(self, func_name, error_check=None, deffunc_module=None): + self.deffunc_module = deffunc_module if deffunc_module is not None else winfuncs self.func_name = func_name if error_check is None: error_check = self.default_error_check @@ -108,8 +109,8 @@ class ApiProxy(object): self._cprototyped = None def __call__(self, python_proxy, ): - prototype = getattr(winfuncs, self.func_name + "Prototype") - params = getattr(winfuncs, self.func_name + "Params") + prototype = getattr(self.deffunc_module, self.func_name + "Prototype") + params = getattr(self.deffunc_module, self.func_name + "Params") python_proxy.prototype = prototype python_proxy.params = params python_proxy.errcheck = self.error_check