Structure annotation RRS feed

  • Question

  • Hi All,

    Any one can explain what is the meaning of the following code used in the array declaration?

     _Field_size_bytes_(DataLength) UCHAR Data[1]; 

        ULONG   TitleIndex;
        ULONG   Type;
        ULONG   DataLength;
        _Field_size_bytes_(DataLength) UCHAR Data[1]; // Variable size


    • Edited by skri Monday, September 23, 2019 4:47 PM
    Monday, September 23, 2019 5:42 AM


  • This line is probably the last element of a structure.  What it means is that the element DataLength which is a scalar defines the number of bytes at a minimum that Data will have.   This is a common approach in Windows for a variable length element in a structure.

    Don Burn Windows Driver Consulting Website:

    • Marked as answer by skri Tuesday, September 24, 2019 5:00 AM
    Monday, September 23, 2019 11:08 AM