ホーム › Devices.DeviceAndDriverInstallation › IO_RANGE
IO_RANGE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| IOR_Align | ULONGLONG | 8 | +0 | +0 | I/Oポート範囲のアライメント要件を示すビットマスク。 |
| IOR_nPorts | DWORD | 4 | +8 | +8 | 要求するI/Oポート数。 |
| IOR_Min | ULONGLONG | 8 | +12 | +12 | 許容されるI/Oアドレスの下限値。 |
| IOR_Max | ULONGLONG | 8 | +20 | +20 | 許容されるI/Oアドレスの上限値。 |
| IOR_RangeFlags | IOD_DESFLAGS | 4 | +28 | +28 | I/O記述子のフラグ群(IOD_DESFLAGS)。 |
| IOR_Alias | ULONGLONG | 8 | +32 | +32 | I/Oポートのエイリアス指定値。 |
各言語での定義
#include <windows.h>
// IO_RANGE (x64 40 / x86 40 バイト)
#pragma pack(push, 1)
typedef struct IO_RANGE {
ULONGLONG IOR_Align;
DWORD IOR_nPorts;
ULONGLONG IOR_Min;
ULONGLONG IOR_Max;
IOD_DESFLAGS IOR_RangeFlags;
ULONGLONG IOR_Alias;
} IO_RANGE;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct IO_RANGE
{
public ulong IOR_Align;
public uint IOR_nPorts;
public ulong IOR_Min;
public ulong IOR_Max;
public uint IOR_RangeFlags;
public ulong IOR_Alias;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure IO_RANGE
Public IOR_Align As ULong
Public IOR_nPorts As UInteger
Public IOR_Min As ULong
Public IOR_Max As ULong
Public IOR_RangeFlags As UInteger
Public IOR_Alias As ULong
End Structureimport ctypes
from ctypes import wintypes
class IO_RANGE(ctypes.Structure):
_pack_ = 1
_fields_ = [
("IOR_Align", ctypes.c_ulonglong),
("IOR_nPorts", wintypes.DWORD),
("IOR_Min", ctypes.c_ulonglong),
("IOR_Max", ctypes.c_ulonglong),
("IOR_RangeFlags", wintypes.DWORD),
("IOR_Alias", ctypes.c_ulonglong),
]#[repr(C, packed(1))]
pub struct IO_RANGE {
pub IOR_Align: u64,
pub IOR_nPorts: u32,
pub IOR_Min: u64,
pub IOR_Max: u64,
pub IOR_RangeFlags: u32,
pub IOR_Alias: u64,
}import "golang.org/x/sys/windows"
type IO_RANGE struct {
IOR_Align uint64
IOR_nPorts uint32
IOR_Min uint64
IOR_Max uint64
IOR_RangeFlags uint32
IOR_Alias uint64
}type
IO_RANGE = packed record
IOR_Align: UInt64;
IOR_nPorts: DWORD;
IOR_Min: UInt64;
IOR_Max: UInt64;
IOR_RangeFlags: DWORD;
IOR_Alias: UInt64;
end;const IO_RANGE = extern struct {
IOR_Align: u64,
IOR_nPorts: u32,
IOR_Min: u64,
IOR_Max: u64,
IOR_RangeFlags: u32,
IOR_Alias: u64,
};type
IO_RANGE {.packed.} = object
IOR_Align: uint64
IOR_nPorts: uint32
IOR_Min: uint64
IOR_Max: uint64
IOR_RangeFlags: uint32
IOR_Alias: uint64align(1)
struct IO_RANGE
{
ulong IOR_Align;
uint IOR_nPorts;
ulong IOR_Min;
ulong IOR_Max;
uint IOR_RangeFlags;
ulong IOR_Alias;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IO_RANGE サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; IOR_Align : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; IOR_nPorts : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; IOR_Min : ULONGLONG (+12, 8byte) qpoke st,12,値 / qpeek(st,12) ※IronHSPのみ。3.7/3.8は lpoke st,12,下位 : lpoke st,16,上位
; IOR_Max : ULONGLONG (+20, 8byte) qpoke st,20,値 / qpeek(st,20) ※IronHSPのみ。3.7/3.8は lpoke st,20,下位 : lpoke st,24,上位
; IOR_RangeFlags : IOD_DESFLAGS (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; IOR_Alias : ULONGLONG (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global IO_RANGE, pack=1
#field int64 IOR_Align
#field int IOR_nPorts
#field int64 IOR_Min
#field int64 IOR_Max
#field int IOR_RangeFlags
#field int64 IOR_Alias
#endstruct
stdim st, IO_RANGE ; NSTRUCT 変数を確保
st->IOR_Align = 100
mes "IOR_Align=" + st->IOR_Align