Win32 API 日本語リファレンス
ホームDevices.Usb › USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR

USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR

構造体
サイズx64: 50 バイト / x86: 50 バイトパッキング1

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
bLengthBYTE1+0+0このディスクリプタのサイズをバイト単位で示す。
bDescriptorTypeBYTE1+1+1ディスクリプタ種別。デバイス能力ディスクリプタ。
bDevCapabilityTypeBYTE1+2+2能力種別。Billboard能力を示す。
iAddtionalInfoURLBYTE1+3+3追加情報URL文字列ディスクリプタのインデックス。
bNumberOfAlternateModesBYTE1+4+4サポートする代替モードの数を示す。
bPreferredAlternateModeBYTE1+5+5優先する代替モードのインデックスを示す。
VconnPower_VconnPower_e__Union4+6+6VCONN電力に関する情報を保持する無名共用体。
bmConfiguredBYTE32+10+10各代替モードの構成状態をビットマスクで示す。
bReservedDWORD4+42+42予約フィールド。0でなければならない。
AlternateMode_Anonymous_e__Struct4+46+46各代替モードの情報を格納する無名構造体配列。

共用体: _VconnPower_e__Union x64 4B / x86 4B

フィールドサイズx64x86
AsUshortWORD2+0+0
Anonymous_Anonymous_e__Struct4+0+0

構造体: _Anonymous_e__Struct x64 4B / x86 4B

フィールドサイズx64x86
wSVIDWORD2+0+0
bAlternateModeBYTE1+2+2
iAlternateModeSettingBYTE1+3+3

各言語での定義

#include <windows.h>

// USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR  (x64 50 / x86 50 バイト)
#pragma pack(push, 1)
typedef struct USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR {
    BYTE bLength;
    BYTE bDescriptorType;
    BYTE bDevCapabilityType;
    BYTE iAddtionalInfoURL;
    BYTE bNumberOfAlternateModes;
    BYTE bPreferredAlternateMode;
    _VconnPower_e__Union VconnPower;
    BYTE bmConfigured[32];
    DWORD bReserved;
    _Anonymous_e__Struct AlternateMode[1];
} USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR
{
    public byte bLength;
    public byte bDescriptorType;
    public byte bDevCapabilityType;
    public byte iAddtionalInfoURL;
    public byte bNumberOfAlternateModes;
    public byte bPreferredAlternateMode;
    public _VconnPower_e__Union VconnPower;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] bmConfigured;
    public uint bReserved;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public _Anonymous_e__Struct[] AlternateMode;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR
    Public bLength As Byte
    Public bDescriptorType As Byte
    Public bDevCapabilityType As Byte
    Public iAddtionalInfoURL As Byte
    Public bNumberOfAlternateModes As Byte
    Public bPreferredAlternateMode As Byte
    Public VconnPower As _VconnPower_e__Union
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public bmConfigured() As Byte
    Public bReserved As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public AlternateMode() As _Anonymous_e__Struct
End Structure
import ctypes
from ctypes import wintypes

class USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("bLength", ctypes.c_ubyte),
        ("bDescriptorType", ctypes.c_ubyte),
        ("bDevCapabilityType", ctypes.c_ubyte),
        ("iAddtionalInfoURL", ctypes.c_ubyte),
        ("bNumberOfAlternateModes", ctypes.c_ubyte),
        ("bPreferredAlternateMode", ctypes.c_ubyte),
        ("VconnPower", _VconnPower_e__Union),
        ("bmConfigured", ctypes.c_ubyte * 32),
        ("bReserved", wintypes.DWORD),
        ("AlternateMode", _Anonymous_e__Struct * 1),
    ]
#[repr(C, packed(1))]
pub struct USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR {
    pub bLength: u8,
    pub bDescriptorType: u8,
    pub bDevCapabilityType: u8,
    pub iAddtionalInfoURL: u8,
    pub bNumberOfAlternateModes: u8,
    pub bPreferredAlternateMode: u8,
    pub VconnPower: _VconnPower_e__Union,
    pub bmConfigured: [u8; 32],
    pub bReserved: u32,
    pub AlternateMode: [_Anonymous_e__Struct; 1],
}
import "golang.org/x/sys/windows"

type USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR struct {
	bLength byte
	bDescriptorType byte
	bDevCapabilityType byte
	iAddtionalInfoURL byte
	bNumberOfAlternateModes byte
	bPreferredAlternateMode byte
	VconnPower _VconnPower_e__Union
	bmConfigured [32]byte
	bReserved uint32
	AlternateMode [1]_Anonymous_e__Struct
}
type
  USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR = packed record
    bLength: Byte;
    bDescriptorType: Byte;
    bDevCapabilityType: Byte;
    iAddtionalInfoURL: Byte;
    bNumberOfAlternateModes: Byte;
    bPreferredAlternateMode: Byte;
    VconnPower: _VconnPower_e__Union;
    bmConfigured: array[0..31] of Byte;
    bReserved: DWORD;
    AlternateMode: array[0..0] of _Anonymous_e__Struct;
  end;
const USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR = extern struct {
    bLength: u8,
    bDescriptorType: u8,
    bDevCapabilityType: u8,
    iAddtionalInfoURL: u8,
    bNumberOfAlternateModes: u8,
    bPreferredAlternateMode: u8,
    VconnPower: _VconnPower_e__Union,
    bmConfigured: [32]u8,
    bReserved: u32,
    AlternateMode: [1]_Anonymous_e__Struct,
};
type
  USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR {.packed.} = object
    bLength: uint8
    bDescriptorType: uint8
    bDevCapabilityType: uint8
    iAddtionalInfoURL: uint8
    bNumberOfAlternateModes: uint8
    bPreferredAlternateMode: uint8
    VconnPower: _VconnPower_e__Union
    bmConfigured: array[32, uint8]
    bReserved: uint32
    AlternateMode: array[1, _Anonymous_e__Struct]
align(1)
struct USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR
{
    ubyte bLength;
    ubyte bDescriptorType;
    ubyte bDevCapabilityType;
    ubyte iAddtionalInfoURL;
    ubyte bNumberOfAlternateModes;
    ubyte bPreferredAlternateMode;
    _VconnPower_e__Union VconnPower;
    ubyte[32] bmConfigured;
    uint bReserved;
    _Anonymous_e__Struct[1] AlternateMode;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR サイズ: 50 バイト(x64)
dim st, 13    ; 4byte整数×13(構造体サイズ 50 / 4 切り上げ)
; bLength : BYTE (+0, 1byte)  poke st,0,値  /  値 = peek(st,0)
; bDescriptorType : BYTE (+1, 1byte)  poke st,1,値  /  値 = peek(st,1)
; bDevCapabilityType : BYTE (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; iAddtionalInfoURL : BYTE (+3, 1byte)  poke st,3,値  /  値 = peek(st,3)
; bNumberOfAlternateModes : BYTE (+4, 1byte)  poke st,4,値  /  値 = peek(st,4)
; bPreferredAlternateMode : BYTE (+5, 1byte)  poke st,5,値  /  値 = peek(st,5)
; VconnPower : _VconnPower_e__Union (+6, 4byte)  varptr(st)+6 を基点に操作(4byte:入れ子/配列)
; bmConfigured : BYTE (+10, 32byte)  varptr(st)+10 を基点に操作(32byte:入れ子/配列)
; bReserved : DWORD (+42, 4byte)  lpoke st,42,値  /  値 = lpeek(st,42)
; AlternateMode : _Anonymous_e__Struct (+46, 4byte)  varptr(st)+46 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR, pack=1
    #field byte bLength
    #field byte bDescriptorType
    #field byte bDevCapabilityType
    #field byte iAddtionalInfoURL
    #field byte bNumberOfAlternateModes
    #field byte bPreferredAlternateMode
    #field byte VconnPower 4
    #field byte bmConfigured 32
    #field int bReserved
    #field _Anonymous_e__Struct AlternateMode 1
#endstruct

stdim st, USB_DEVICE_CAPABILITY_BILLBOARD_DESCRIPTOR        ; NSTRUCT 変数を確保
st->bLength = 100
mes "bLength=" + st->bLength
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。