Win32 API 日本語リファレンス
ホームSystem.Ioctl › STORAGE_BREAK_RESERVATION_REQUEST

STORAGE_BREAK_RESERVATION_REQUEST

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

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

フィールド

フィールドサイズx64x86説明
LengthDWORD4+0+0この構造体の長さをバイト単位で示す。
_unusedBYTE1+4+4未使用の予約バイト。整列のために存在する。
PathIdBYTE1+5+5対象デバイスが属するSCSIバスのパスID。
TargetIdBYTE1+6+6対象デバイスのSCSIターゲットID。
LunBYTE1+7+7対象デバイスの論理ユニット番号(LUN)。

各言語での定義

#include <windows.h>

// STORAGE_BREAK_RESERVATION_REQUEST  (x64 8 / x86 8 バイト)
typedef struct STORAGE_BREAK_RESERVATION_REQUEST {
    DWORD Length;
    BYTE _unused;
    BYTE PathId;
    BYTE TargetId;
    BYTE Lun;
} STORAGE_BREAK_RESERVATION_REQUEST;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_BREAK_RESERVATION_REQUEST
{
    public uint Length;
    public byte _unused;
    public byte PathId;
    public byte TargetId;
    public byte Lun;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_BREAK_RESERVATION_REQUEST
    Public Length As UInteger
    Public _unused As Byte
    Public PathId As Byte
    Public TargetId As Byte
    Public Lun As Byte
End Structure
import ctypes
from ctypes import wintypes

class STORAGE_BREAK_RESERVATION_REQUEST(ctypes.Structure):
    _fields_ = [
        ("Length", wintypes.DWORD),
        ("_unused", ctypes.c_ubyte),
        ("PathId", ctypes.c_ubyte),
        ("TargetId", ctypes.c_ubyte),
        ("Lun", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct STORAGE_BREAK_RESERVATION_REQUEST {
    pub Length: u32,
    pub _unused: u8,
    pub PathId: u8,
    pub TargetId: u8,
    pub Lun: u8,
}
import "golang.org/x/sys/windows"

type STORAGE_BREAK_RESERVATION_REQUEST struct {
	Length uint32
	_unused byte
	PathId byte
	TargetId byte
	Lun byte
}
type
  STORAGE_BREAK_RESERVATION_REQUEST = record
    Length: DWORD;
    _unused: Byte;
    PathId: Byte;
    TargetId: Byte;
    Lun: Byte;
  end;
const STORAGE_BREAK_RESERVATION_REQUEST = extern struct {
    Length: u32,
    _unused: u8,
    PathId: u8,
    TargetId: u8,
    Lun: u8,
};
type
  STORAGE_BREAK_RESERVATION_REQUEST {.bycopy.} = object
    Length: uint32
    _unused: uint8
    PathId: uint8
    TargetId: uint8
    Lun: uint8
struct STORAGE_BREAK_RESERVATION_REQUEST
{
    uint Length;
    ubyte _unused;
    ubyte PathId;
    ubyte TargetId;
    ubyte Lun;
}

HSP用 定義

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

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

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