ホーム › Devices.Usb › USB_COMPOSITE_FUNCTION_INFO
USB_COMPOSITE_FUNCTION_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| FunctionNumber | BYTE | 1 | +0 | +0 | 複合デバイス内のファンクション番号。 |
| BaseInterfaceNumber | BYTE | 1 | +1 | +1 | ファンクションが使用する先頭インターフェイス番号。 |
| NumberOfInterfaces | BYTE | 1 | +2 | +2 | ファンクションが含むインターフェイス数。 |
| FunctionIsIdle | BOOLEAN | 1 | +3 | +3 | ファンクションがアイドル状態か否か。 |
各言語での定義
#include <windows.h>
// USB_COMPOSITE_FUNCTION_INFO (x64 4 / x86 4 バイト)
typedef struct USB_COMPOSITE_FUNCTION_INFO {
BYTE FunctionNumber;
BYTE BaseInterfaceNumber;
BYTE NumberOfInterfaces;
BOOLEAN FunctionIsIdle;
} USB_COMPOSITE_FUNCTION_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USB_COMPOSITE_FUNCTION_INFO
{
public byte FunctionNumber;
public byte BaseInterfaceNumber;
public byte NumberOfInterfaces;
[MarshalAs(UnmanagedType.U1)] public bool FunctionIsIdle;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USB_COMPOSITE_FUNCTION_INFO
Public FunctionNumber As Byte
Public BaseInterfaceNumber As Byte
Public NumberOfInterfaces As Byte
<MarshalAs(UnmanagedType.U1)> Public FunctionIsIdle As Boolean
End Structureimport ctypes
from ctypes import wintypes
class USB_COMPOSITE_FUNCTION_INFO(ctypes.Structure):
_fields_ = [
("FunctionNumber", ctypes.c_ubyte),
("BaseInterfaceNumber", ctypes.c_ubyte),
("NumberOfInterfaces", ctypes.c_ubyte),
("FunctionIsIdle", ctypes.c_byte),
]#[repr(C)]
pub struct USB_COMPOSITE_FUNCTION_INFO {
pub FunctionNumber: u8,
pub BaseInterfaceNumber: u8,
pub NumberOfInterfaces: u8,
pub FunctionIsIdle: u8,
}import "golang.org/x/sys/windows"
type USB_COMPOSITE_FUNCTION_INFO struct {
FunctionNumber byte
BaseInterfaceNumber byte
NumberOfInterfaces byte
FunctionIsIdle byte
}type
USB_COMPOSITE_FUNCTION_INFO = record
FunctionNumber: Byte;
BaseInterfaceNumber: Byte;
NumberOfInterfaces: Byte;
FunctionIsIdle: ByteBool;
end;const USB_COMPOSITE_FUNCTION_INFO = extern struct {
FunctionNumber: u8,
BaseInterfaceNumber: u8,
NumberOfInterfaces: u8,
FunctionIsIdle: u8,
};type
USB_COMPOSITE_FUNCTION_INFO {.bycopy.} = object
FunctionNumber: uint8
BaseInterfaceNumber: uint8
NumberOfInterfaces: uint8
FunctionIsIdle: uint8struct USB_COMPOSITE_FUNCTION_INFO
{
ubyte FunctionNumber;
ubyte BaseInterfaceNumber;
ubyte NumberOfInterfaces;
ubyte FunctionIsIdle;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USB_COMPOSITE_FUNCTION_INFO サイズ: 4 バイト(x64)
dim st, 1 ; 4byte整数×1(構造体サイズ 4 / 4 切り上げ)
; FunctionNumber : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; BaseInterfaceNumber : BYTE (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; NumberOfInterfaces : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; FunctionIsIdle : BOOLEAN (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USB_COMPOSITE_FUNCTION_INFO
#field byte FunctionNumber
#field byte BaseInterfaceNumber
#field byte NumberOfInterfaces
#field bool1 FunctionIsIdle
#endstruct
stdim st, USB_COMPOSITE_FUNCTION_INFO ; NSTRUCT 変数を確保
st->FunctionNumber = 100
mes "FunctionNumber=" + st->FunctionNumber