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

STREAM_LAYOUT_ENTRY

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

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

フィールド

フィールドサイズx64x86説明
VersionDWORD4+0+0このエントリ構造体のバージョン番号。
NextStreamOffsetDWORD4+4+4次のストリームエントリへのオフセット(バイト)。0で最終。
FlagsDWORD4+8+8このストリームに関するフラグ。
ExtentInformationOffsetDWORD4+12+12エクステント情報へのオフセット(バイト)。
AllocationSizeLONGLONG8+16+16ストリームの割り当てサイズ(バイト)。
EndOfFileLONGLONG8+24+24ストリームの論理ファイル末尾位置(バイト)。
StreamInformationOffsetDWORD4+32+32ストリーム情報へのオフセット(バイト)。
AttributeTypeCodeDWORD4+36+36ストリームのNTFS属性タイプコード。
AttributeFlagsDWORD4+40+40ストリーム属性のフラグ(圧縮/暗号化等)。
StreamIdentifierLengthDWORD4+44+44ストリーム識別子の長さ(バイト)。
StreamIdentifierWCHAR2+48+48ストリームを識別する名前を表すWCHAR配列。

各言語での定義

#include <windows.h>

// STREAM_LAYOUT_ENTRY  (x64 56 / x86 56 バイト)
typedef struct STREAM_LAYOUT_ENTRY {
    DWORD Version;
    DWORD NextStreamOffset;
    DWORD Flags;
    DWORD ExtentInformationOffset;
    LONGLONG AllocationSize;
    LONGLONG EndOfFile;
    DWORD StreamInformationOffset;
    DWORD AttributeTypeCode;
    DWORD AttributeFlags;
    DWORD StreamIdentifierLength;
    WCHAR StreamIdentifier[1];
} STREAM_LAYOUT_ENTRY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STREAM_LAYOUT_ENTRY
{
    public uint Version;
    public uint NextStreamOffset;
    public uint Flags;
    public uint ExtentInformationOffset;
    public long AllocationSize;
    public long EndOfFile;
    public uint StreamInformationOffset;
    public uint AttributeTypeCode;
    public uint AttributeFlags;
    public uint StreamIdentifierLength;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string StreamIdentifier;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STREAM_LAYOUT_ENTRY
    Public Version As UInteger
    Public NextStreamOffset As UInteger
    Public Flags As UInteger
    Public ExtentInformationOffset As UInteger
    Public AllocationSize As Long
    Public EndOfFile As Long
    Public StreamInformationOffset As UInteger
    Public AttributeTypeCode As UInteger
    Public AttributeFlags As UInteger
    Public StreamIdentifierLength As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public StreamIdentifier As String
End Structure
import ctypes
from ctypes import wintypes

class STREAM_LAYOUT_ENTRY(ctypes.Structure):
    _fields_ = [
        ("Version", wintypes.DWORD),
        ("NextStreamOffset", wintypes.DWORD),
        ("Flags", wintypes.DWORD),
        ("ExtentInformationOffset", wintypes.DWORD),
        ("AllocationSize", ctypes.c_longlong),
        ("EndOfFile", ctypes.c_longlong),
        ("StreamInformationOffset", wintypes.DWORD),
        ("AttributeTypeCode", wintypes.DWORD),
        ("AttributeFlags", wintypes.DWORD),
        ("StreamIdentifierLength", wintypes.DWORD),
        ("StreamIdentifier", ctypes.c_wchar * 1),
    ]
#[repr(C)]
pub struct STREAM_LAYOUT_ENTRY {
    pub Version: u32,
    pub NextStreamOffset: u32,
    pub Flags: u32,
    pub ExtentInformationOffset: u32,
    pub AllocationSize: i64,
    pub EndOfFile: i64,
    pub StreamInformationOffset: u32,
    pub AttributeTypeCode: u32,
    pub AttributeFlags: u32,
    pub StreamIdentifierLength: u32,
    pub StreamIdentifier: [u16; 1],
}
import "golang.org/x/sys/windows"

type STREAM_LAYOUT_ENTRY struct {
	Version uint32
	NextStreamOffset uint32
	Flags uint32
	ExtentInformationOffset uint32
	AllocationSize int64
	EndOfFile int64
	StreamInformationOffset uint32
	AttributeTypeCode uint32
	AttributeFlags uint32
	StreamIdentifierLength uint32
	StreamIdentifier [1]uint16
}
type
  STREAM_LAYOUT_ENTRY = record
    Version: DWORD;
    NextStreamOffset: DWORD;
    Flags: DWORD;
    ExtentInformationOffset: DWORD;
    AllocationSize: Int64;
    EndOfFile: Int64;
    StreamInformationOffset: DWORD;
    AttributeTypeCode: DWORD;
    AttributeFlags: DWORD;
    StreamIdentifierLength: DWORD;
    StreamIdentifier: array[0..0] of WideChar;
  end;
const STREAM_LAYOUT_ENTRY = extern struct {
    Version: u32,
    NextStreamOffset: u32,
    Flags: u32,
    ExtentInformationOffset: u32,
    AllocationSize: i64,
    EndOfFile: i64,
    StreamInformationOffset: u32,
    AttributeTypeCode: u32,
    AttributeFlags: u32,
    StreamIdentifierLength: u32,
    StreamIdentifier: [1]u16,
};
type
  STREAM_LAYOUT_ENTRY {.bycopy.} = object
    Version: uint32
    NextStreamOffset: uint32
    Flags: uint32
    ExtentInformationOffset: uint32
    AllocationSize: int64
    EndOfFile: int64
    StreamInformationOffset: uint32
    AttributeTypeCode: uint32
    AttributeFlags: uint32
    StreamIdentifierLength: uint32
    StreamIdentifier: array[1, uint16]
struct STREAM_LAYOUT_ENTRY
{
    uint Version;
    uint NextStreamOffset;
    uint Flags;
    uint ExtentInformationOffset;
    long AllocationSize;
    long EndOfFile;
    uint StreamInformationOffset;
    uint AttributeTypeCode;
    uint AttributeFlags;
    uint StreamIdentifierLength;
    wchar[1] StreamIdentifier;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STREAM_LAYOUT_ENTRY サイズ: 56 バイト(x64)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; Version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; NextStreamOffset : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Flags : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ExtentInformationOffset : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; AllocationSize : LONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; EndOfFile : LONGLONG (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; StreamInformationOffset : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; AttributeTypeCode : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; AttributeFlags : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; StreamIdentifierLength : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; StreamIdentifier : WCHAR (+48, 2byte)  varptr(st)+48 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STREAM_LAYOUT_ENTRY
    #field int Version
    #field int NextStreamOffset
    #field int Flags
    #field int ExtentInformationOffset
    #field int64 AllocationSize
    #field int64 EndOfFile
    #field int StreamInformationOffset
    #field int AttributeTypeCode
    #field int AttributeFlags
    #field int StreamIdentifierLength
    #field wchar StreamIdentifier 1
#endstruct

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