BCD_ELEMENT_DEVICE - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTBCD_H
// Serialized device payloads can contain nested devices at unaligned offsets.
#include <pshpack1.h>

/**
 * Serialized device-format element data passed to BcdSetElementData and returned
 * by BcdGetElementData. DeviceType selects the serialized payload layout.
 * DeviceType selects the payload at byte offset 20. AdditionalOptions identifies
 * a device-options object, or is GUID_NULL when there is no such object.
 *
 * ParentOffset is a byte offset from the start of the containing device, not
 * from the File/Locate member. It locates another BCD_ELEMENT_DEVICE inside the
 * same buffer. Validate offsets and variable-length paths against DataSize before
 * dereferencing them. ANYSIZE_ARRAY is a placeholder, not the payload capacity.
 * A fixed boot/qualified-partition device occupies 60 bytes; partition/file/locate
 * records use their actual variable payload length, not sizeof this structure.
 */
typedef struct _BCD_ELEMENT_DEVICE
{
    ULONG DeviceType; // BCD_ELEMENT_DEVICE_TYPE
    GUID AdditionalOptions;
    union
    {
        struct
        {
            ULONG ParentOffset;
            WCHAR Path[ANYSIZE_ARRAY]; // NUL-terminated; starts at device offset 24.
        } File;
        struct
        {
            WCHAR Path[ANYSIZE_ARRAY]; // NUL-terminated; starts at device offset 20.
        } Partition;
        struct
        {
            ULONG Type; // BCD_ELEMENT_DEVICE_LOCATE_TYPE
            ULONG ParentOffset;
            ULONG ElementType; // Packed BCD_ELEMENT_DATATYPE for Type 0.
            WCHAR Path[ANYSIZE_ARRAY]; // Type 1; starts at device offset 32.
        } Locate;
        struct
        {
            GUID InterfaceInstance;
        } Vmbus;
        struct
        {
            UCHAR Data[ANYSIZE_ARRAY]; // Opaque bytes after the 20-byte prefix.
        } Unknown;
        BCD_ELEMENT_DEVICE_QUALIFIED_PARTITION QualifiedPartition;
    };
} BCD_ELEMENT_DEVICE, *PBCD_ELEMENT_DEVICE;

#include <poppack.h>
#endif

View code on GitHub

NtDoc

No description available.