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

IO_DES

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

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

フィールド

フィールドサイズx64x86説明
IOD_CountDWORD4+0+0後続のIO_RANGE配列の要素数。
IOD_TypeDWORD4+4+4I/O記述子の種別を示す値。
IOD_Alloc_BaseULONGLONG8+8+8割り当てられたI/O範囲の開始アドレス。
IOD_Alloc_EndULONGLONG8+16+16割り当てられたI/O範囲の終了アドレス。
IOD_DesFlagsIOD_DESFLAGS4+24+24I/O記述子のフラグ群(IOD_DESFLAGS)。

各言語での定義

#include <windows.h>

// IO_DES  (x64 28 / x86 28 バイト)
#pragma pack(push, 1)
typedef struct IO_DES {
    DWORD IOD_Count;
    DWORD IOD_Type;
    ULONGLONG IOD_Alloc_Base;
    ULONGLONG IOD_Alloc_End;
    IOD_DESFLAGS IOD_DesFlags;
} IO_DES;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct IO_DES
{
    public uint IOD_Count;
    public uint IOD_Type;
    public ulong IOD_Alloc_Base;
    public ulong IOD_Alloc_End;
    public uint IOD_DesFlags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure IO_DES
    Public IOD_Count As UInteger
    Public IOD_Type As UInteger
    Public IOD_Alloc_Base As ULong
    Public IOD_Alloc_End As ULong
    Public IOD_DesFlags As UInteger
End Structure
import ctypes
from ctypes import wintypes

class IO_DES(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("IOD_Count", wintypes.DWORD),
        ("IOD_Type", wintypes.DWORD),
        ("IOD_Alloc_Base", ctypes.c_ulonglong),
        ("IOD_Alloc_End", ctypes.c_ulonglong),
        ("IOD_DesFlags", wintypes.DWORD),
    ]
#[repr(C, packed(1))]
pub struct IO_DES {
    pub IOD_Count: u32,
    pub IOD_Type: u32,
    pub IOD_Alloc_Base: u64,
    pub IOD_Alloc_End: u64,
    pub IOD_DesFlags: u32,
}
import "golang.org/x/sys/windows"

type IO_DES struct {
	IOD_Count uint32
	IOD_Type uint32
	IOD_Alloc_Base uint64
	IOD_Alloc_End uint64
	IOD_DesFlags uint32
}
type
  IO_DES = packed record
    IOD_Count: DWORD;
    IOD_Type: DWORD;
    IOD_Alloc_Base: UInt64;
    IOD_Alloc_End: UInt64;
    IOD_DesFlags: DWORD;
  end;
const IO_DES = extern struct {
    IOD_Count: u32,
    IOD_Type: u32,
    IOD_Alloc_Base: u64,
    IOD_Alloc_End: u64,
    IOD_DesFlags: u32,
};
type
  IO_DES {.packed.} = object
    IOD_Count: uint32
    IOD_Type: uint32
    IOD_Alloc_Base: uint64
    IOD_Alloc_End: uint64
    IOD_DesFlags: uint32
align(1)
struct IO_DES
{
    uint IOD_Count;
    uint IOD_Type;
    ulong IOD_Alloc_Base;
    ulong IOD_Alloc_End;
    uint IOD_DesFlags;
}

HSP用 定義

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

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

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