我使用ctypes来调用dll来读取存储区域的内容。但是它返回一个unsigned char指针,我想得到指针的内容。我该怎么做?
from ctypes import *
c = WinDLL("FT_ET99_API.dll")
hwnd = c_void_p()
c.et_OpenToken(byref(hwnd), c_char_p('53E00FD8'), c_int(1))
c.et_Verify(hwnd, c_int(0), c_char_p('35316D69696C616E'))
f = c.et_Read
f.argtypes = c_void_p, c_int, c_int, POINTER(c_char_p)
f.restype = None
txt = c_char_p()
f(hwnd, 1, 34, byref(txt))
(What should I do next?)
et_Read(
ET_HANDLE hHandle(in),
WORD offset(in),
int Len(in),
unsigned char* pucReadBuf(out)
)
答案 0 :(得分:0)
我尝试了另一种方式,它成功了。我得到了原始缓冲区的内容。
from ctypes import *
c = WinDLL("FT_ET99_API.dll")
hwnd = c_void_p()
c.et_OpenToken(byref(hwnd), c_char_p('53E00FD8'), c_int(1))
c.et_Verify(hwnd, c_int(0), c_char_p('35316D69696C616E'))
outData = create_string_buffer(34)
c.et_Read(hwnd, 1, 34, outData)
print outData.value(my aim)