Update generation for ntstatus and add a parallele define module to ApiProxy

This commit is contained in:
Clement Rouault
2016-06-24 16:55:25 +02:00
parent 75c48103c4
commit 86fe9c9f82
4 changed files with 9 additions and 8 deletions
+1 -3
View File
@@ -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
+1 -2
View File
@@ -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):
+3
View File
@@ -1,4 +1,7 @@
import ctypes
from windef import *
class NtStatusException(WindowsError):
ALL_STATUS = {}
def __init__(self , code):
+4 -3
View File
@@ -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