Search code examples
cwinapiioctluint16

Why is CDROM_TOC.Length an UCHAR[2] instead of WORD?


In the documentation the length is made of two unsigned bytes:

Length

Indicates the length, in bytes, of the table of contents data. This length value does not include the length of the Length member itself.

When you form a WORD in Little Endian, indeed it is the correct value, but why did they choose to not use a WORD directly ?


Solution

  • After digging deep through the docs:

    For information about the permissible values for this member, see specification T10/1363-D, by National Committee for Information Technology Standards (NCITS).

    This leads us to here:

    https://ia802909.us.archive.org/35/items/mmc3r10g/mmc3r10g.pdf

    When you look through these 471 pages for the word endian, there are zero results, for the word integer there are only five results.

    But in 5.23.2 TOC/PMA/ATIP Response Data Format 0000b, we can infer that since in that table next to Bit 0 there is (LSB), it is indeed a 16-bit integer in Little Endian Big Endian (thanks Hans).

    In conclusion, they just made the struct look as it's laid out in these specs.