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

USB_PORT_EXT_STATUS

共用体
サイズx64: 4 バイト / x86: 4 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
AsUlong32DWORD4+0+0ポート拡張ステータスを32ビット生値として参照するメンバ。
Anonymous_Anonymous_e__Struct4+0+0受信/送信レーン数等の各ビットを表す無名構造体。

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

フィールドサイズx64x86
_bitfieldDWORD4+0+0

各言語での定義

#include <windows.h>

// USB_PORT_EXT_STATUS  (x64 4 / x86 4 バイト)
#pragma pack(push, 1)
typedef struct USB_PORT_EXT_STATUS {
    DWORD AsUlong32;
    _Anonymous_e__Struct Anonymous;
} USB_PORT_EXT_STATUS;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct USB_PORT_EXT_STATUS
{
    public uint AsUlong32;
    public _Anonymous_e__Struct Anonymous;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure USB_PORT_EXT_STATUS
    Public AsUlong32 As UInteger
    Public Anonymous As _Anonymous_e__Struct
End Structure
import ctypes
from ctypes import wintypes

class USB_PORT_EXT_STATUS(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("AsUlong32", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Struct),
    ]
#[repr(C, packed(1))]
pub struct USB_PORT_EXT_STATUS {
    pub AsUlong32: u32,
    pub Anonymous: _Anonymous_e__Struct,
}
import "golang.org/x/sys/windows"

type USB_PORT_EXT_STATUS struct {
	AsUlong32 uint32
	Anonymous _Anonymous_e__Struct
}
type
  USB_PORT_EXT_STATUS = packed record
    AsUlong32: DWORD;
    Anonymous: _Anonymous_e__Struct;
  end;
const USB_PORT_EXT_STATUS = extern struct {
    AsUlong32: u32,
    Anonymous: _Anonymous_e__Struct,
};
type
  USB_PORT_EXT_STATUS {.packed.} = object
    AsUlong32: uint32
    Anonymous: _Anonymous_e__Struct
align(1)
struct USB_PORT_EXT_STATUS
{
    uint AsUlong32;
    _Anonymous_e__Struct Anonymous;
}

HSP用 定義

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

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

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