ホーム › Storage.IscsiDisc › IDE_IO_CONTROL
IDE_IO_CONTROL
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| HeaderLength | DWORD | 4 | +0 | +0 | ヘッダー部分のバイト長。 |
| Signature | BYTE | 8 | +4 | +4 | 要求を識別するシグネチャ(バイト配列)。 |
| Timeout | DWORD | 4 | +12 | +12 | 操作のタイムアウト秒数。 |
| ControlCode | DWORD | 4 | +16 | +16 | 実行するIDE制御コード。 |
| ReturnStatus | DWORD | 4 | +20 | +20 | 操作完了後に返されるステータス値。 |
| DataLength | DWORD | 4 | +24 | +24 | 後続データバッファのバイト長。 |
各言語での定義
#include <windows.h>
// IDE_IO_CONTROL (x64 28 / x86 28 バイト)
typedef struct IDE_IO_CONTROL {
DWORD HeaderLength;
BYTE Signature[8];
DWORD Timeout;
DWORD ControlCode;
DWORD ReturnStatus;
DWORD DataLength;
} IDE_IO_CONTROL;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IDE_IO_CONTROL
{
public uint HeaderLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] Signature;
public uint Timeout;
public uint ControlCode;
public uint ReturnStatus;
public uint DataLength;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IDE_IO_CONTROL
Public HeaderLength As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public Signature() As Byte
Public Timeout As UInteger
Public ControlCode As UInteger
Public ReturnStatus As UInteger
Public DataLength As UInteger
End Structureimport ctypes
from ctypes import wintypes
class IDE_IO_CONTROL(ctypes.Structure):
_fields_ = [
("HeaderLength", wintypes.DWORD),
("Signature", ctypes.c_ubyte * 8),
("Timeout", wintypes.DWORD),
("ControlCode", wintypes.DWORD),
("ReturnStatus", wintypes.DWORD),
("DataLength", wintypes.DWORD),
]#[repr(C)]
pub struct IDE_IO_CONTROL {
pub HeaderLength: u32,
pub Signature: [u8; 8],
pub Timeout: u32,
pub ControlCode: u32,
pub ReturnStatus: u32,
pub DataLength: u32,
}import "golang.org/x/sys/windows"
type IDE_IO_CONTROL struct {
HeaderLength uint32
Signature [8]byte
Timeout uint32
ControlCode uint32
ReturnStatus uint32
DataLength uint32
}type
IDE_IO_CONTROL = record
HeaderLength: DWORD;
Signature: array[0..7] of Byte;
Timeout: DWORD;
ControlCode: DWORD;
ReturnStatus: DWORD;
DataLength: DWORD;
end;const IDE_IO_CONTROL = extern struct {
HeaderLength: u32,
Signature: [8]u8,
Timeout: u32,
ControlCode: u32,
ReturnStatus: u32,
DataLength: u32,
};type
IDE_IO_CONTROL {.bycopy.} = object
HeaderLength: uint32
Signature: array[8, uint8]
Timeout: uint32
ControlCode: uint32
ReturnStatus: uint32
DataLength: uint32struct IDE_IO_CONTROL
{
uint HeaderLength;
ubyte[8] Signature;
uint Timeout;
uint ControlCode;
uint ReturnStatus;
uint DataLength;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IDE_IO_CONTROL サイズ: 28 バイト(x64)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; HeaderLength : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Signature : BYTE (+4, 8byte) varptr(st)+4 を基点に操作(8byte:入れ子/配列)
; Timeout : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ControlCode : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ReturnStatus : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; DataLength : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global IDE_IO_CONTROL
#field int HeaderLength
#field byte Signature 8
#field int Timeout
#field int ControlCode
#field int ReturnStatus
#field int DataLength
#endstruct
stdim st, IDE_IO_CONTROL ; NSTRUCT 変数を確保
st->HeaderLength = 100
mes "HeaderLength=" + st->HeaderLength