代码拉取完成,页面将自动刷新
import ctypes
class DLLError(Exception):
pass
class DynamicLinkLibrary:
errors = {
0x00000000: "ok",
}
def __init__(self, path):
self.path = path
self.dll = ctypes.cdll.LoadLibrary(self.path)
def __call__(self, name, *args):
rtn_code = getattr(self.dll, name)(*args)
self._check(rtn_code)
def _check(self, code, ok=0):
"""Overwrite this by super(Heir, self)._check(code, YOUR_OK_VALUE)
Params:
- code: int
return value of a dll funcall
- ok: int
value that indicates the funcall is successful
Return:
- no return value (None)
"""
if code != ok:
raise DLLError("[0x%08x] %s" % (code, self.errors[code]))
def _load(self, path):
"""Load the export functions list from header file"""
pass
def _wrap(self, fndict):
"""Wrap the dll exported function to Python function
Params:
- fndict: dict
{
"name": "function",
"return": "int *",
"args": [
("first", "int"),
("second", "char *"),
...
]
}
Return:
- setattr(self, name, fn)
"""
pass
def _parse(self, functions):
"""Parse the header file and each function info"""
pass
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。