Re: DeviceIOControl calls respond with parameter incorrect

Eryk Sun <[email protected]>
Newsgroups gmane.comp.python.windows
Message-ID <CACL+1avAWPPypZhWHz8ttc4haD2kMTLwnEj4HOfT6p9wkN_UJA@mail.gmail.com>
On 2/9/21, Doug Campbell <[email protected]> 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".
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.