[python-win32] DeviceIOControl calls respond with parameter incorrect

Eryk Sun eryksun at gmail.com
Tue Feb 9 16:51:03 EST 2021


On 2/9/21, Doug Campbell <wdouglascampbell at hotmail.com> wrote:
>
> That was exactly what I needed.  I will have to read up on the _pack_
> directive to understand it but for now things are running the way they
> should be.

I'm glad I could help. Normally padding is added between fields of a
struct in order to support aligned access for the data type of each
field. Setting the `_pack_ = 1` attribute forces single-byte
alignment, and thus no padding bytes are added.

> I did have one typo in what I originally pasted that made its way into what
> you provided.
>
> ('volumeID', ctypes.c_wchar * VOLUME_ID_SIZE),
>
> should actually be
>
> ('volumeID', ctypes.c_char * VOLUME_ID_SIZE),

Sorry, I did actually scan over the fields to check the types against
the C definition, but I somehow missed that extra "w".


More information about the python-win32 mailing list