ホーム › Devices.Usb › USB_CONTROLLER_INFO_0
USB_CONTROLLER_INFO_0
構造体サイズ=各フィールドのバイト数(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 | コントローラのルートポート数を示す。 |
| ControllerFlavor | USB_CONTROLLER_FLAVOR | 4 | +16 | +16 | コントローラの種別を示すUSB_CONTROLLER_FLAVOR列挙値。 |
| HcFeatureFlags | DWORD | 4 | +20 | +20 | ホストコントローラの機能を示すビットフラグ。 |
各言語での定義
#include <windows.h>
// USB_CONTROLLER_INFO_0 (x64 24 / x86 24 バイト)
#pragma pack(push, 1)
typedef struct USB_CONTROLLER_INFO_0 {
DWORD PciVendorId;
DWORD PciDeviceId;
DWORD PciRevision;
DWORD NumberOfRootPorts;
USB_CONTROLLER_FLAVOR ControllerFlavor;
DWORD HcFeatureFlags;
} USB_CONTROLLER_INFO_0;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct USB_CONTROLLER_INFO_0
{
public uint PciVendorId;
public uint PciDeviceId;
public uint PciRevision;
public uint NumberOfRootPorts;
public int ControllerFlavor;
public uint HcFeatureFlags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure USB_CONTROLLER_INFO_0
Public PciVendorId As UInteger
Public PciDeviceId As UInteger
Public PciRevision As UInteger
Public NumberOfRootPorts As UInteger
Public ControllerFlavor As Integer
Public HcFeatureFlags As UInteger
End Structureimport ctypes
from ctypes import wintypes
class USB_CONTROLLER_INFO_0(ctypes.Structure):
_pack_ = 1
_fields_ = [
("PciVendorId", wintypes.DWORD),
("PciDeviceId", wintypes.DWORD),
("PciRevision", wintypes.DWORD),
("NumberOfRootPorts", wintypes.DWORD),
("ControllerFlavor", ctypes.c_int),
("HcFeatureFlags", wintypes.DWORD),
]#[repr(C, packed(1))]
pub struct USB_CONTROLLER_INFO_0 {
pub PciVendorId: u32,
pub PciDeviceId: u32,
pub PciRevision: u32,
pub NumberOfRootPorts: u32,
pub ControllerFlavor: i32,
pub HcFeatureFlags: u32,
}import "golang.org/x/sys/windows"
type USB_CONTROLLER_INFO_0 struct {
PciVendorId uint32
PciDeviceId uint32
PciRevision uint32
NumberOfRootPorts uint32
ControllerFlavor int32
HcFeatureFlags uint32
}type
USB_CONTROLLER_INFO_0 = packed record
PciVendorId: DWORD;
PciDeviceId: DWORD;
PciRevision: DWORD;
NumberOfRootPorts: DWORD;
ControllerFlavor: Integer;
HcFeatureFlags: DWORD;
end;const USB_CONTROLLER_INFO_0 = extern struct {
PciVendorId: u32,
PciDeviceId: u32,
PciRevision: u32,
NumberOfRootPorts: u32,
ControllerFlavor: i32,
HcFeatureFlags: u32,
};type
USB_CONTROLLER_INFO_0 {.packed.} = object
PciVendorId: uint32
PciDeviceId: uint32
PciRevision: uint32
NumberOfRootPorts: uint32
ControllerFlavor: int32
HcFeatureFlags: uint32align(1)
struct USB_CONTROLLER_INFO_0
{
uint PciVendorId;
uint PciDeviceId;
uint PciRevision;
uint NumberOfRootPorts;
int ControllerFlavor;
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_INFO_0 サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 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 も可)
; ControllerFlavor : USB_CONTROLLER_FLAVOR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; HcFeatureFlags : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USB_CONTROLLER_INFO_0, pack=1
#field int PciVendorId
#field int PciDeviceId
#field int PciRevision
#field int NumberOfRootPorts
#field int ControllerFlavor
#field int HcFeatureFlags
#endstruct
stdim st, USB_CONTROLLER_INFO_0 ; NSTRUCT 変数を確保
st->PciVendorId = 100
mes "PciVendorId=" + st->PciVendorId