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

STORAGE_ALLOCATE_BC_STREAM_INPUT

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0構造体のバージョン番号。
RequestsPerPeriodDWORD4+4+41期間あたりのリクエスト数。
PeriodDWORD4+8+8期間長をミリ秒単位で示す。
RetryFailuresBOOLEAN1+12+12失敗時に再試行するかを示す真偽値。
DiscardableBOOLEAN1+13+13破棄可能なストリームかを示す真偽値。
Reserved1BOOLEAN2+14+14将来の拡張のために予約された真偽値領域。
AccessTypeDWORD4+16+16アクセスの種類(読み取り/書き込み)を示す値。
AccessModeDWORD4+20+20アクセスモードを示す値。順次/ランダム等。

各言語での定義

#include <windows.h>

// STORAGE_ALLOCATE_BC_STREAM_INPUT  (x64 24 / x86 24 バイト)
typedef struct STORAGE_ALLOCATE_BC_STREAM_INPUT {
    DWORD Version;
    DWORD RequestsPerPeriod;
    DWORD Period;
    BOOLEAN RetryFailures;
    BOOLEAN Discardable;
    BOOLEAN Reserved1[2];
    DWORD AccessType;
    DWORD AccessMode;
} STORAGE_ALLOCATE_BC_STREAM_INPUT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_ALLOCATE_BC_STREAM_INPUT
{
    public uint Version;
    public uint RequestsPerPeriod;
    public uint Period;
    [MarshalAs(UnmanagedType.U1)] public bool RetryFailures;
    [MarshalAs(UnmanagedType.U1)] public bool Discardable;
    [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.U1, SizeConst = 2)] public bool[] Reserved1;
    public uint AccessType;
    public uint AccessMode;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_ALLOCATE_BC_STREAM_INPUT
    Public Version As UInteger
    Public RequestsPerPeriod As UInteger
    Public Period As UInteger
    <MarshalAs(UnmanagedType.U1)> Public RetryFailures As Boolean
    <MarshalAs(UnmanagedType.U1)> Public Discardable As Boolean
    <MarshalAs(UnmanagedType.ByValArray, ArraySubType:=UnmanagedType.U1, SizeConst:=2)> Public Reserved1() As Boolean
    Public AccessType As UInteger
    Public AccessMode As UInteger
End Structure
import ctypes
from ctypes import wintypes

class STORAGE_ALLOCATE_BC_STREAM_INPUT(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("RequestsPerPeriod", wintypes.DWORD),
        ("Period", wintypes.DWORD),
        ("RetryFailures", ctypes.c_byte),
        ("Discardable", ctypes.c_byte),
        ("Reserved1", ctypes.c_byte * 2),
        ("AccessType", wintypes.DWORD),
        ("AccessMode", wintypes.DWORD),
    ]
#[repr(C)]
pub struct STORAGE_ALLOCATE_BC_STREAM_INPUT {
    pub Version: u32,
    pub RequestsPerPeriod: u32,
    pub Period: u32,
    pub RetryFailures: u8,
    pub Discardable: u8,
    pub Reserved1: [u8; 2],
    pub AccessType: u32,
    pub AccessMode: u32,
}
import "golang.org/x/sys/windows"

type STORAGE_ALLOCATE_BC_STREAM_INPUT struct {
	Version uint32
	RequestsPerPeriod uint32
	Period uint32
	RetryFailures byte
	Discardable byte
	Reserved1 [2]byte
	AccessType uint32
	AccessMode uint32
}
type
  STORAGE_ALLOCATE_BC_STREAM_INPUT = record
    Version: DWORD;
    RequestsPerPeriod: DWORD;
    Period: DWORD;
    RetryFailures: ByteBool;
    Discardable: ByteBool;
    Reserved1: array[0..1] of ByteBool;
    AccessType: DWORD;
    AccessMode: DWORD;
  end;
const STORAGE_ALLOCATE_BC_STREAM_INPUT = extern struct {
    Version: u32,
    RequestsPerPeriod: u32,
    Period: u32,
    RetryFailures: u8,
    Discardable: u8,
    Reserved1: [2]u8,
    AccessType: u32,
    AccessMode: u32,
};
type
  STORAGE_ALLOCATE_BC_STREAM_INPUT {.bycopy.} = object
    Version: uint32
    RequestsPerPeriod: uint32
    Period: uint32
    RetryFailures: uint8
    Discardable: uint8
    Reserved1: array[2, uint8]
    AccessType: uint32
    AccessMode: uint32
struct STORAGE_ALLOCATE_BC_STREAM_INPUT
{
    uint Version;
    uint RequestsPerPeriod;
    uint Period;
    ubyte RetryFailures;
    ubyte Discardable;
    ubyte[2] Reserved1;
    uint AccessType;
    uint AccessMode;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STORAGE_ALLOCATE_BC_STREAM_INPUT サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; RequestsPerPeriod : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Period : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; RetryFailures : BOOLEAN (+12, 1byte)  poke st,12,値  /  値 = peek(st,12)
; Discardable : BOOLEAN (+13, 1byte)  poke st,13,値  /  値 = peek(st,13)
; Reserved1 : BOOLEAN (+14, 2byte)  varptr(st)+14 を基点に操作(2byte:入れ子/配列)
; AccessType : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; AccessMode : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STORAGE_ALLOCATE_BC_STREAM_INPUT
    #field int Version
    #field int RequestsPerPeriod
    #field int Period
    #field bool1 RetryFailures
    #field bool1 Discardable
    #field bool1 Reserved1 2
    #field int AccessType
    #field int AccessMode
#endstruct

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