如何根据指针地址获取指针内容
How to get the pointer content based on the pointer address
我使用 ctypes 调用 dll 来读取存储区域的内容。但它返回一个无符号的字符指针,我想获取指针的内容。我该怎么做?
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)
)
我尝试了另一种方法,它成功了。我获取原始缓冲区的内容。
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)
相关文章:
- 我可以使用 decltype() 或其他东西通过指针获取真实类型吗?
- 通过基类指针获取派生类对象的引用
- C++从双指针获取数据
- 如何从原始指针获取shared_ptr?
- 如何从C++中的字符指针获取子字符串
- 使用 std::launder 从指向非活动工会成员的指针获取指向活动工会成员的指针?
- 使用我的共享指针获取内存泄漏
- 通过指向非多态类型的基类的指针获取已分配内存的地址
- 指向引用的指针获取器
- 使用 std::launder 从指向非活动对象的指针获取指向活动对象成员的指针?
- CPP:无法使用 -> 通过指针获取成员的值
- 字符串十六进制到指针获取值
- 从基类指针获取模板派生类的值
- 从 C++ 数组元素的指针获取索引的最快方法是什么
- 通过指针获取最大数量的元素
- 如何使用指针获取字符串数据
- 返回指向指针数组的指针获取下一个元素失败
- 从"子项"项指针获取"父""std::tuple"
- 从成员函数指针获取方法的返回类型
- 如何从指向数组的指针获取对该数组的引用