[python-win32] deviceiocontrol string format
B.P.S.Thurin at city.ac.uk
B.P.S.Thurin at city.ac.uk
Thu May 25 20:43:40 CEST 2006
Dear All,
I am new to python win32, and i cannot figure out how to format the data
string for deviceiocontrol code with win32file.
I have the following c struct in my driver file:
typedef struct _WRITE_DEVICE_DATA_INPARAMS
{
UCHAR ucMemorySpace; // 0: I/O Space, 1: Mem Space.
ULONG ulPhysicalAddress; // Dword-aligned offset to write to.
ULONG ulItemSize; // 1: Byte, 2: Word, 4: Dword.
ULONG ulItemCount; // Number of bytes, words or dwords.
union{
UCHAR vucDataBuf[1];
USHORT vusDataBuf[1];
ULONG vulDataBuf[1];
}data;
}WRITE_DEVICE_DATA_INPARAMS, *PWRITE_DEVICE_DATA_INPARAMS;
I tried to format my data string like this:
data=struct.pack('BLLLH',2,1020,2,1,0)
but got the following error:
OverflowError: long int too large to convert to int
Apparentely the error is coming from 1020. However it is define as ulong
for both case the c struct and the python struct.pack.
Thanks in advance for your help
Regards
Brice
More information about the Python-win32
mailing list