ホーム › Devices.Usb › USB_CONTROLLER_DEVICE_INFO
USB_CONTROLLER_DEVICE_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| PciVendorId | DWORD | 4 | +0 | +0 | ホストコントローラのPCIベンダID。 |
| PciDeviceId | DWORD | 4 | +4 | +4 | ホストコントローラのPCIデバイスID。 |
| PciRevision | DWORD | 4 | +8 | +8 | ホストコントローラのPCIリビジョン番号。 |
| NumberOfRootPorts | DWORD | 4 | +12 | +12 | ルートハブのポート数。 |
| HcFeatureFlags | DWORD | 4 | +16 | +16 | ホストコントローラの機能を示すフラグ集合。 |
各言語での定義
#include <windows.h>
// USB_CONTROLLER_DEVICE_INFO (x64 20 / x86 20 バイト)
#pragma pack(push, 1)
typedef struct USB_CONTROLLER_DEVICE_INFO {
DWORD PciVendorId;
DWORD PciDeviceId;
DWORD PciRevision;
DWORD NumberOfRootPorts;
DWORD HcFeatureFlags;
} USB_CONTROLLER_DEVICE_INFO;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct USB_CONTROLLER_DEVICE_INFO
{
public uint PciVendorId;
public uint PciDeviceId;
public uint PciRevision;
public uint NumberOfRootPorts;
public uint HcFeatureFlags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure USB_CONTROLLER_DEVICE_INFO
Public PciVendorId As UInteger
Public PciDeviceId As UInteger
Public PciRevision As UInteger
Public NumberOfRootPorts As UInteger
Public HcFeatureFlags As UInteger
End Structureimport ctypes
from ctypes import wintypes
class USB_CONTROLLER_DEVICE_INFO(ctypes.Structure):
_pack_ = 1
_fields_ = [
("PciVendorId", wintypes.DWORD),
("PciDeviceId", wintypes.DWORD),
("PciRevision", wintypes.DWORD),
("NumberOfRootPorts", wintypes.DWORD),
("HcFeatureFlags", wintypes.DWORD),
]#[repr(C, packed(1))]
pub struct USB_CONTROLLER_DEVICE_INFO {
pub PciVendorId: u32,
pub PciDeviceId: u32,
pub PciRevision: u32,
pub NumberOfRootPorts: u32,
pub HcFeatureFlags: u32,
}import "golang.org/x/sys/windows"
type USB_CONTROLLER_DEVICE_INFO struct {
PciVendorId uint32
PciDeviceId uint32
PciRevision uint32
NumberOfRootPorts uint32
HcFeatureFlags uint32
}type
USB_CONTROLLER_DEVICE_INFO = packed record
PciVendorId: DWORD;
PciDeviceId: DWORD;
PciRevision: DWORD;
NumberOfRootPorts: DWORD;
HcFeatureFlags: DWORD;
end;const USB_CONTROLLER_DEVICE_INFO = extern struct {
PciVendorId: u32,
PciDeviceId: u32,
PciRevision: u32,
NumberOfRootPorts: u32,
HcFeatureFlags: u32,
};type
USB_CONTROLLER_DEVICE_INFO {.packed.} = object
PciVendorId: uint32
PciDeviceId: uint32
PciRevision: uint32
NumberOfRootPorts: uint32
HcFeatureFlags: uint32align(1)
struct USB_CONTROLLER_DEVICE_INFO
{
uint PciVendorId;
uint PciDeviceId;
uint PciRevision;
uint NumberOfRootPorts;
uint HcFeatureFlags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USB_CONTROLLER_DEVICE_INFO サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; PciVendorId : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; PciDeviceId : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; PciRevision : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; NumberOfRootPorts : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; HcFeatureFlags : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USB_CONTROLLER_DEVICE_INFO, pack=1
#field int PciVendorId
#field int PciDeviceId
#field int PciRevision
#field int NumberOfRootPorts
#field int HcFeatureFlags
#endstruct
stdim st, USB_CONTROLLER_DEVICE_INFO ; NSTRUCT 変数を確保
st->PciVendorId = 100
mes "PciVendorId=" + st->PciVendorId