From d888298afd1d6875487be215596ce4dbedaa00d4 Mon Sep 17 00:00:00 2001 From: _ <_> Date: Sat, 21 Apr 2018 03:39:25 -0700 Subject: [PATCH] Added struct for PldHeader and related function --- bindings/py3devil1.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 bindings/py3devil1.py diff --git a/bindings/py3devil1.py b/bindings/py3devil1.py new file mode 100644 index 0000000..b520e39 --- /dev/null +++ b/bindings/py3devil1.py @@ -0,0 +1,21 @@ +import ctypes + +class PldHeader(ctypes.Structure): + _fields_ = [ + ("numOffset", ctypes.c_int), + ("offsets", ctypes.POINTER(ctypes.c_int)) + ] + +class Devil1FN_PLD(ctypes.Structure): + _fields_ = [ + ("getheader" , ctypes.CFUNCTYPE(bool, ctypes.POINTER(PldHeader), ctypes.c_char_p)), + ("sizeofsector", ctypes.CFUNCTYPE(int, ctypes.POINTER(PldHeader), ctypes.c_int)), + ("printheader" , ctypes.CFUNCTYPE(None, ctypes.POINTER(PldHeader))) + ] + +def main(): + libc = cdll.LoadLibrary('./libdevil1pld.so') + if (lib): + print("OK") + with open("pl01.pld", "rb") as f: + data = f.read()