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

USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT

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

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

フィールド

フィールドサイズx64x86説明
RouteUSB4_HRD_DEBUG_ROUTE_STRING8+0+0対象デバイスへのUSB4ルート文字列。
AdapterNumberBYTE1+8+8対象アダプタの番号。
ConfigurationSpaceTypeUSB4_CONFIG_SPACE_TYPE4+9+9読み出すコンフィギュレーション空間の種別。
DwOffsetDWORD4+13+13読み出し開始オフセット(DWORD単位)。
DwLengthDWORD4+17+17読み出す長さ(DWORD単位)。

各言語での定義

#include <windows.h>

// USB4_HRD_DEBUG_ROUTE_STRING  (x64 8 / x86 8 バイト)
typedef struct USB4_HRD_DEBUG_ROUTE_STRING {
    BYTE Depth;
    BYTE Route[7];
} USB4_HRD_DEBUG_ROUTE_STRING;

// USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT  (x64 21 / x86 21 バイト)
#pragma pack(push, 1)
typedef struct USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT {
    USB4_HRD_DEBUG_ROUTE_STRING Route;
    BYTE AdapterNumber;
    USB4_CONFIG_SPACE_TYPE ConfigurationSpaceType;
    DWORD DwOffset;
    DWORD DwLength;
} USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USB4_HRD_DEBUG_ROUTE_STRING
{
    public byte Depth;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public byte[] Route;
}

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT
{
    public USB4_HRD_DEBUG_ROUTE_STRING Route;
    public byte AdapterNumber;
    public int ConfigurationSpaceType;
    public uint DwOffset;
    public uint DwLength;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USB4_HRD_DEBUG_ROUTE_STRING
    Public Depth As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=7)> Public Route() As Byte
End Structure

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT
    Public Route As USB4_HRD_DEBUG_ROUTE_STRING
    Public AdapterNumber As Byte
    Public ConfigurationSpaceType As Integer
    Public DwOffset As UInteger
    Public DwLength As UInteger
End Structure
import ctypes
from ctypes import wintypes

class USB4_HRD_DEBUG_ROUTE_STRING(ctypes.Structure):
    _fields_ = [
        ("Depth", ctypes.c_ubyte),
        ("Route", ctypes.c_ubyte * 7),
    ]

class USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("Route", USB4_HRD_DEBUG_ROUTE_STRING),
        ("AdapterNumber", ctypes.c_ubyte),
        ("ConfigurationSpaceType", ctypes.c_int),
        ("DwOffset", wintypes.DWORD),
        ("DwLength", wintypes.DWORD),
    ]
#[repr(C)]
pub struct USB4_HRD_DEBUG_ROUTE_STRING {
    pub Depth: u8,
    pub Route: [u8; 7],
}

#[repr(C, packed(1))]
pub struct USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT {
    pub Route: USB4_HRD_DEBUG_ROUTE_STRING,
    pub AdapterNumber: u8,
    pub ConfigurationSpaceType: i32,
    pub DwOffset: u32,
    pub DwLength: u32,
}
import "golang.org/x/sys/windows"

type USB4_HRD_DEBUG_ROUTE_STRING struct {
	Depth byte
	Route [7]byte
}

type USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT struct {
	Route USB4_HRD_DEBUG_ROUTE_STRING
	AdapterNumber byte
	ConfigurationSpaceType int32
	DwOffset uint32
	DwLength uint32
}
type
  USB4_HRD_DEBUG_ROUTE_STRING = record
    Depth: Byte;
    Route: array[0..6] of Byte;
  end;

  USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT = packed record
    Route: USB4_HRD_DEBUG_ROUTE_STRING;
    AdapterNumber: Byte;
    ConfigurationSpaceType: Integer;
    DwOffset: DWORD;
    DwLength: DWORD;
  end;
const USB4_HRD_DEBUG_ROUTE_STRING = extern struct {
    Depth: u8,
    Route: [7]u8,
};

const USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT = extern struct {
    Route: USB4_HRD_DEBUG_ROUTE_STRING,
    AdapterNumber: u8,
    ConfigurationSpaceType: i32,
    DwOffset: u32,
    DwLength: u32,
};
type
  USB4_HRD_DEBUG_ROUTE_STRING {.bycopy.} = object
    Depth: uint8
    Route: array[7, uint8]

  USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT {.packed.} = object
    Route: USB4_HRD_DEBUG_ROUTE_STRING
    AdapterNumber: uint8
    ConfigurationSpaceType: int32
    DwOffset: uint32
    DwLength: uint32
struct USB4_HRD_DEBUG_ROUTE_STRING
{
    ubyte Depth;
    ubyte[7] Route;
}

align(1)
struct USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT
{
    USB4_HRD_DEBUG_ROUTE_STRING Route;
    ubyte AdapterNumber;
    int ConfigurationSpaceType;
    uint DwOffset;
    uint DwLength;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT サイズ: 21 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 21 / 4 切り上げ)
; Route : USB4_HRD_DEBUG_ROUTE_STRING (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; AdapterNumber : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; ConfigurationSpaceType : USB4_CONFIG_SPACE_TYPE (+9, 4byte)  lpoke st,9,値  /  値 = lpeek(st,9)
; DwOffset : DWORD (+13, 4byte)  lpoke st,13,値  /  値 = lpeek(st,13)
; DwLength : DWORD (+17, 4byte)  lpoke st,17,値  /  値 = lpeek(st,17)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global USB4_HRD_DEBUG_ROUTE_STRING
    #field byte Depth
    #field byte Route 7
#endstruct

#defstruct global USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT, pack=1
    #field USB4_HRD_DEBUG_ROUTE_STRING Route
    #field byte AdapterNumber
    #field int ConfigurationSpaceType
    #field int DwOffset
    #field int DwLength
#endstruct

stdim st, USB4_HRD_DEBUG_READ_CONFIGURATION_SPACE_INPUT        ; NSTRUCT 変数を確保
st->AdapterNumber = 100
mes "AdapterNumber=" + st->AdapterNumber