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

BUSNUMBER_DES

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

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

フィールド

フィールドサイズx64x86説明
BUSD_CountDWORD4+0+0後続のBUSNUMBER_RANGE配列の要素数。
BUSD_TypeDWORD4+4+4バス番号記述子の種別を示す値。
BUSD_FlagsDWORD4+8+8バス番号記述子のフラグ群。
BUSD_Alloc_BaseDWORD4+12+12割り当てられたバス番号範囲の開始値。
BUSD_Alloc_EndDWORD4+16+16割り当てられたバス番号範囲の終了値。

各言語での定義

#include <windows.h>

// BUSNUMBER_DES  (x64 20 / x86 20 バイト)
#pragma pack(push, 1)
typedef struct BUSNUMBER_DES {
    DWORD BUSD_Count;
    DWORD BUSD_Type;
    DWORD BUSD_Flags;
    DWORD BUSD_Alloc_Base;
    DWORD BUSD_Alloc_End;
} BUSNUMBER_DES;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct BUSNUMBER_DES
{
    public uint BUSD_Count;
    public uint BUSD_Type;
    public uint BUSD_Flags;
    public uint BUSD_Alloc_Base;
    public uint BUSD_Alloc_End;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure BUSNUMBER_DES
    Public BUSD_Count As UInteger
    Public BUSD_Type As UInteger
    Public BUSD_Flags As UInteger
    Public BUSD_Alloc_Base As UInteger
    Public BUSD_Alloc_End As UInteger
End Structure
import ctypes
from ctypes import wintypes

class BUSNUMBER_DES(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("BUSD_Count", wintypes.DWORD),
        ("BUSD_Type", wintypes.DWORD),
        ("BUSD_Flags", wintypes.DWORD),
        ("BUSD_Alloc_Base", wintypes.DWORD),
        ("BUSD_Alloc_End", wintypes.DWORD),
    ]
#[repr(C, packed(1))]
pub struct BUSNUMBER_DES {
    pub BUSD_Count: u32,
    pub BUSD_Type: u32,
    pub BUSD_Flags: u32,
    pub BUSD_Alloc_Base: u32,
    pub BUSD_Alloc_End: u32,
}
import "golang.org/x/sys/windows"

type BUSNUMBER_DES struct {
	BUSD_Count uint32
	BUSD_Type uint32
	BUSD_Flags uint32
	BUSD_Alloc_Base uint32
	BUSD_Alloc_End uint32
}
type
  BUSNUMBER_DES = packed record
    BUSD_Count: DWORD;
    BUSD_Type: DWORD;
    BUSD_Flags: DWORD;
    BUSD_Alloc_Base: DWORD;
    BUSD_Alloc_End: DWORD;
  end;
const BUSNUMBER_DES = extern struct {
    BUSD_Count: u32,
    BUSD_Type: u32,
    BUSD_Flags: u32,
    BUSD_Alloc_Base: u32,
    BUSD_Alloc_End: u32,
};
type
  BUSNUMBER_DES {.packed.} = object
    BUSD_Count: uint32
    BUSD_Type: uint32
    BUSD_Flags: uint32
    BUSD_Alloc_Base: uint32
    BUSD_Alloc_End: uint32
align(1)
struct BUSNUMBER_DES
{
    uint BUSD_Count;
    uint BUSD_Type;
    uint BUSD_Flags;
    uint BUSD_Alloc_Base;
    uint BUSD_Alloc_End;
}

HSP用 定義

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

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

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