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

USB_HUB_DEVICE_UXD_SETTINGS

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0本構造体のバージョン番号。互換性判定に用いる。
PnpGuidGUID16+4+4UXD(ユーザーモード外部デバイス)割り当てのPnP GUID。
OwnerGuidGUID16+20+20デバイスの所有者を識別するGUID。
DeleteOnShutdownDWORD4+36+36シャットダウン時に割り当てを削除するか否かのフラグ。
DeleteOnReloadDWORD4+40+40ドライバ再読み込み時に割り当てを削除するか否かのフラグ。
DeleteOnDisconnectDWORD4+44+44デバイス切断時に割り当てを削除するか否かのフラグ。
ReservedDWORD20+48+48将来拡張用の予約領域。0を設定する。

各言語での定義

#include <windows.h>

// USB_HUB_DEVICE_UXD_SETTINGS  (x64 68 / x86 68 バイト)
#pragma pack(push, 1)
typedef struct USB_HUB_DEVICE_UXD_SETTINGS {
    DWORD Version;
    GUID PnpGuid;
    GUID OwnerGuid;
    DWORD DeleteOnShutdown;
    DWORD DeleteOnReload;
    DWORD DeleteOnDisconnect;
    DWORD Reserved[5];
} USB_HUB_DEVICE_UXD_SETTINGS;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct USB_HUB_DEVICE_UXD_SETTINGS
{
    public uint Version;
    public Guid PnpGuid;
    public Guid OwnerGuid;
    public uint DeleteOnShutdown;
    public uint DeleteOnReload;
    public uint DeleteOnDisconnect;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public uint[] Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure USB_HUB_DEVICE_UXD_SETTINGS
    Public Version As UInteger
    Public PnpGuid As Guid
    Public OwnerGuid As Guid
    Public DeleteOnShutdown As UInteger
    Public DeleteOnReload As UInteger
    Public DeleteOnDisconnect As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=5)> Public Reserved() As UInteger
End Structure
import ctypes
from ctypes import wintypes

class USB_HUB_DEVICE_UXD_SETTINGS(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("PnpGuid", GUID),
        ("OwnerGuid", GUID),
        ("DeleteOnShutdown", wintypes.DWORD),
        ("DeleteOnReload", wintypes.DWORD),
        ("DeleteOnDisconnect", wintypes.DWORD),
        ("Reserved", wintypes.DWORD * 5),
    ]
#[repr(C, packed(1))]
pub struct USB_HUB_DEVICE_UXD_SETTINGS {
    pub Version: u32,
    pub PnpGuid: GUID,
    pub OwnerGuid: GUID,
    pub DeleteOnShutdown: u32,
    pub DeleteOnReload: u32,
    pub DeleteOnDisconnect: u32,
    pub Reserved: [u32; 5],
}
import "golang.org/x/sys/windows"

type USB_HUB_DEVICE_UXD_SETTINGS struct {
	Version uint32
	PnpGuid windows.GUID
	OwnerGuid windows.GUID
	DeleteOnShutdown uint32
	DeleteOnReload uint32
	DeleteOnDisconnect uint32
	Reserved [5]uint32
}
type
  USB_HUB_DEVICE_UXD_SETTINGS = packed record
    Version: DWORD;
    PnpGuid: TGUID;
    OwnerGuid: TGUID;
    DeleteOnShutdown: DWORD;
    DeleteOnReload: DWORD;
    DeleteOnDisconnect: DWORD;
    Reserved: array[0..4] of DWORD;
  end;
const USB_HUB_DEVICE_UXD_SETTINGS = extern struct {
    Version: u32,
    PnpGuid: GUID,
    OwnerGuid: GUID,
    DeleteOnShutdown: u32,
    DeleteOnReload: u32,
    DeleteOnDisconnect: u32,
    Reserved: [5]u32,
};
type
  USB_HUB_DEVICE_UXD_SETTINGS {.packed.} = object
    Version: uint32
    PnpGuid: GUID
    OwnerGuid: GUID
    DeleteOnShutdown: uint32
    DeleteOnReload: uint32
    DeleteOnDisconnect: uint32
    Reserved: array[5, uint32]
align(1)
struct USB_HUB_DEVICE_UXD_SETTINGS
{
    uint Version;
    GUID PnpGuid;
    GUID OwnerGuid;
    uint DeleteOnShutdown;
    uint DeleteOnReload;
    uint DeleteOnDisconnect;
    uint[5] Reserved;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USB_HUB_DEVICE_UXD_SETTINGS サイズ: 68 バイト(x64)
dim st, 17    ; 4byte整数×17(構造体サイズ 68 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; PnpGuid : GUID (+4, 16byte)  varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; OwnerGuid : GUID (+20, 16byte)  varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; DeleteOnShutdown : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; DeleteOnReload : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; DeleteOnDisconnect : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; Reserved : DWORD (+48, 20byte)  varptr(st)+48 を基点に操作(20byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global USB_HUB_DEVICE_UXD_SETTINGS, pack=1
    #field int Version
    #field GUID PnpGuid
    #field GUID OwnerGuid
    #field int DeleteOnShutdown
    #field int DeleteOnReload
    #field int DeleteOnDisconnect
    #field int Reserved 5
#endstruct

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