For low-level purposes, I need to construct a ctypes pointer from an arbitrary address, given as an integer. For instance:
INTP = ctypes.POINTER(ctypes.c_int)
p = INTP(0x12345678) # i *know* this is the address
But all such attempts result in
TypeError: expected c_long instead of int
Is there anything I can do to overcome this? In case someone wonders why I need this, it's done so as to extract the OVERLAPPED
struct from a win32file.PyOVERLAPPED
, for integrating ctypes-exposed functions with win32file wrapped APIs.
Thanks,
-Tomer
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…