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

WIN32_STREAM_ID

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

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

フィールド

フィールドサイズx64x86説明
dwStreamIdWIN_STREAM_ID4+0+0バックアップストリームの種類(データ/EA/ACL等のWIN_STREAM_ID)。
dwStreamAttributesDWORD4+4+4ストリームの属性を示すビットマスク。
SizeLONGLONG8+8+8ストリームデータのバイトサイズ。
dwStreamNameSizeDWORD4+16+16cStreamNameのバイト長。
cStreamNameWCHAR2+20+20ストリーム名(可変長WCHAR配列)。

各言語での定義

#include <windows.h>

// WIN32_STREAM_ID  (x64 24 / x86 24 バイト)
typedef struct WIN32_STREAM_ID {
    WIN_STREAM_ID dwStreamId;
    DWORD dwStreamAttributes;
    LONGLONG Size;
    DWORD dwStreamNameSize;
    WCHAR cStreamName[1];
} WIN32_STREAM_ID;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WIN32_STREAM_ID
{
    public uint dwStreamId;
    public uint dwStreamAttributes;
    public long Size;
    public uint dwStreamNameSize;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string cStreamName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WIN32_STREAM_ID
    Public dwStreamId As UInteger
    Public dwStreamAttributes As UInteger
    Public Size As Long
    Public dwStreamNameSize As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public cStreamName As String
End Structure
import ctypes
from ctypes import wintypes

class WIN32_STREAM_ID(ctypes.Structure):
    _fields_ = [
        ("dwStreamId", wintypes.DWORD),
        ("dwStreamAttributes", wintypes.DWORD),
        ("Size", ctypes.c_longlong),
        ("dwStreamNameSize", wintypes.DWORD),
        ("cStreamName", ctypes.c_wchar * 1),
    ]
#[repr(C)]
pub struct WIN32_STREAM_ID {
    pub dwStreamId: u32,
    pub dwStreamAttributes: u32,
    pub Size: i64,
    pub dwStreamNameSize: u32,
    pub cStreamName: [u16; 1],
}
import "golang.org/x/sys/windows"

type WIN32_STREAM_ID struct {
	dwStreamId uint32
	dwStreamAttributes uint32
	Size int64
	dwStreamNameSize uint32
	cStreamName [1]uint16
}
type
  WIN32_STREAM_ID = record
    dwStreamId: DWORD;
    dwStreamAttributes: DWORD;
    Size: Int64;
    dwStreamNameSize: DWORD;
    cStreamName: array[0..0] of WideChar;
  end;
const WIN32_STREAM_ID = extern struct {
    dwStreamId: u32,
    dwStreamAttributes: u32,
    Size: i64,
    dwStreamNameSize: u32,
    cStreamName: [1]u16,
};
type
  WIN32_STREAM_ID {.bycopy.} = object
    dwStreamId: uint32
    dwStreamAttributes: uint32
    Size: int64
    dwStreamNameSize: uint32
    cStreamName: array[1, uint16]
struct WIN32_STREAM_ID
{
    uint dwStreamId;
    uint dwStreamAttributes;
    long Size;
    uint dwStreamNameSize;
    wchar[1] cStreamName;
}

HSP用 定義

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

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

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