Win32 API 日本語リファレンス
ホームStorage.IscsiDisc › SRB_IO_CONTROL

SRB_IO_CONTROL

構造体
サイズx64: 28 バイト / x86: 28 バイト

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

フィールド

フィールドサイズx64x86説明
HeaderLengthDWORD4+0+0このヘッダー構造体のバイト長。
SignatureBYTE8+4+4要求を識別するシグネチャ(8バイト)。
TimeoutDWORD4+12+12操作のタイムアウト秒数。
ControlCodeDWORD4+16+16実行するSRB制御コード。
ReturnCodeDWORD4+20+20操作完了後に返されるステータスコード。
LengthDWORD4+24+24ヘッダーに続くデータバッファのバイト長。

各言語での定義

#include <windows.h>

// SRB_IO_CONTROL  (x64 28 / x86 28 バイト)
typedef struct SRB_IO_CONTROL {
    DWORD HeaderLength;
    BYTE Signature[8];
    DWORD Timeout;
    DWORD ControlCode;
    DWORD ReturnCode;
    DWORD Length;
} SRB_IO_CONTROL;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SRB_IO_CONTROL
{
    public uint HeaderLength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] Signature;
    public uint Timeout;
    public uint ControlCode;
    public uint ReturnCode;
    public uint Length;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SRB_IO_CONTROL
    Public HeaderLength As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public Signature() As Byte
    Public Timeout As UInteger
    Public ControlCode As UInteger
    Public ReturnCode As UInteger
    Public Length As UInteger
End Structure
import ctypes
from ctypes import wintypes

class SRB_IO_CONTROL(ctypes.Structure):
    _fields_ = [
        ("HeaderLength", wintypes.DWORD),
        ("Signature", ctypes.c_ubyte * 8),
        ("Timeout", wintypes.DWORD),
        ("ControlCode", wintypes.DWORD),
        ("ReturnCode", wintypes.DWORD),
        ("Length", wintypes.DWORD),
    ]
#[repr(C)]
pub struct SRB_IO_CONTROL {
    pub HeaderLength: u32,
    pub Signature: [u8; 8],
    pub Timeout: u32,
    pub ControlCode: u32,
    pub ReturnCode: u32,
    pub Length: u32,
}
import "golang.org/x/sys/windows"

type SRB_IO_CONTROL struct {
	HeaderLength uint32
	Signature [8]byte
	Timeout uint32
	ControlCode uint32
	ReturnCode uint32
	Length uint32
}
type
  SRB_IO_CONTROL = record
    HeaderLength: DWORD;
    Signature: array[0..7] of Byte;
    Timeout: DWORD;
    ControlCode: DWORD;
    ReturnCode: DWORD;
    Length: DWORD;
  end;
const SRB_IO_CONTROL = extern struct {
    HeaderLength: u32,
    Signature: [8]u8,
    Timeout: u32,
    ControlCode: u32,
    ReturnCode: u32,
    Length: u32,
};
type
  SRB_IO_CONTROL {.bycopy.} = object
    HeaderLength: uint32
    Signature: array[8, uint8]
    Timeout: uint32
    ControlCode: uint32
    ReturnCode: uint32
    Length: uint32
struct SRB_IO_CONTROL
{
    uint HeaderLength;
    ubyte[8] Signature;
    uint Timeout;
    uint ControlCode;
    uint ReturnCode;
    uint Length;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SRB_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 も可)
; ReturnCode : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; Length : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SRB_IO_CONTROL
    #field int HeaderLength
    #field byte Signature 8
    #field int Timeout
    #field int ControlCode
    #field int ReturnCode
    #field int Length
#endstruct

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