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

FILE_STREAM_INFO

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

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

フィールド

フィールドサイズx64x86説明
NextEntryOffsetDWORD4+0+0次のエントリへのバイトオフセット。0なら最終エントリ。
StreamNameLengthDWORD4+4+4StreamNameのバイト長。
StreamSizeLONGLONG8+8+8ストリームデータの実サイズ(バイト)。
StreamAllocationSizeLONGLONG8+16+16ストリームに割り当てられたサイズ(バイト)。
StreamNameWCHAR2+24+24代替データストリーム名(可変長WCHAR配列)。

各言語での定義

#include <windows.h>

// FILE_STREAM_INFO  (x64 32 / x86 32 バイト)
typedef struct FILE_STREAM_INFO {
    DWORD NextEntryOffset;
    DWORD StreamNameLength;
    LONGLONG StreamSize;
    LONGLONG StreamAllocationSize;
    WCHAR StreamName[1];
} FILE_STREAM_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILE_STREAM_INFO
{
    public uint NextEntryOffset;
    public uint StreamNameLength;
    public long StreamSize;
    public long StreamAllocationSize;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string StreamName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILE_STREAM_INFO
    Public NextEntryOffset As UInteger
    Public StreamNameLength As UInteger
    Public StreamSize As Long
    Public StreamAllocationSize As Long
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public StreamName As String
End Structure
import ctypes
from ctypes import wintypes

class FILE_STREAM_INFO(ctypes.Structure):
    _fields_ = [
        ("NextEntryOffset", wintypes.DWORD),
        ("StreamNameLength", wintypes.DWORD),
        ("StreamSize", ctypes.c_longlong),
        ("StreamAllocationSize", ctypes.c_longlong),
        ("StreamName", ctypes.c_wchar * 1),
    ]
#[repr(C)]
pub struct FILE_STREAM_INFO {
    pub NextEntryOffset: u32,
    pub StreamNameLength: u32,
    pub StreamSize: i64,
    pub StreamAllocationSize: i64,
    pub StreamName: [u16; 1],
}
import "golang.org/x/sys/windows"

type FILE_STREAM_INFO struct {
	NextEntryOffset uint32
	StreamNameLength uint32
	StreamSize int64
	StreamAllocationSize int64
	StreamName [1]uint16
}
type
  FILE_STREAM_INFO = record
    NextEntryOffset: DWORD;
    StreamNameLength: DWORD;
    StreamSize: Int64;
    StreamAllocationSize: Int64;
    StreamName: array[0..0] of WideChar;
  end;
const FILE_STREAM_INFO = extern struct {
    NextEntryOffset: u32,
    StreamNameLength: u32,
    StreamSize: i64,
    StreamAllocationSize: i64,
    StreamName: [1]u16,
};
type
  FILE_STREAM_INFO {.bycopy.} = object
    NextEntryOffset: uint32
    StreamNameLength: uint32
    StreamSize: int64
    StreamAllocationSize: int64
    StreamName: array[1, uint16]
struct FILE_STREAM_INFO
{
    uint NextEntryOffset;
    uint StreamNameLength;
    long StreamSize;
    long StreamAllocationSize;
    wchar[1] StreamName;
}

HSP用 定義

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

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

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