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

FILE_ID_EXTD_DIR_INFO

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

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

フィールド

フィールドサイズx64x86説明
NextEntryOffsetDWORD4+0+0次のエントリへのバイトオフセット。0なら最終エントリ。
FileIndexDWORD4+4+4ディレクトリ内のファイルインデックス。
CreationTimeLONGLONG8+8+8ファイルの作成時刻(1601年起点の100ns単位)。
LastAccessTimeLONGLONG8+16+16ファイルの最終アクセス時刻。
LastWriteTimeLONGLONG8+24+24ファイルの最終書き込み時刻。
ChangeTimeLONGLONG8+32+32ファイルメタデータの最終変更時刻。
EndOfFileLONGLONG8+40+40ファイル末尾位置すなわち実サイズ(バイト)。
AllocationSizeLONGLONG8+48+48ファイルに割り当てられたサイズ(バイト)。
FileAttributesDWORD4+56+56ファイル属性ビットマスク(FILE_ATTRIBUTE_*)。
FileNameLengthDWORD4+60+60FileNameのバイト長。
EaSizeDWORD4+64+64拡張属性(EA)のバイトサイズ。
ReparsePointTagDWORD4+68+68リパースポイントのタグ値。非該当時は0。
FileIdFILE_ID_12816+72+72128ビットのファイル識別子。
FileNameWCHAR2+88+88ファイル名(可変長WCHAR配列)。

各言語での定義

#include <windows.h>

// FILE_ID_128  (x64 16 / x86 16 バイト)
typedef struct FILE_ID_128 {
    BYTE Identifier[16];
} FILE_ID_128;

// FILE_ID_EXTD_DIR_INFO  (x64 96 / x86 96 バイト)
typedef struct FILE_ID_EXTD_DIR_INFO {
    DWORD NextEntryOffset;
    DWORD FileIndex;
    LONGLONG CreationTime;
    LONGLONG LastAccessTime;
    LONGLONG LastWriteTime;
    LONGLONG ChangeTime;
    LONGLONG EndOfFile;
    LONGLONG AllocationSize;
    DWORD FileAttributes;
    DWORD FileNameLength;
    DWORD EaSize;
    DWORD ReparsePointTag;
    FILE_ID_128 FileId;
    WCHAR FileName[1];
} FILE_ID_EXTD_DIR_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILE_ID_128
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] Identifier;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILE_ID_EXTD_DIR_INFO
{
    public uint NextEntryOffset;
    public uint FileIndex;
    public long CreationTime;
    public long LastAccessTime;
    public long LastWriteTime;
    public long ChangeTime;
    public long EndOfFile;
    public long AllocationSize;
    public uint FileAttributes;
    public uint FileNameLength;
    public uint EaSize;
    public uint ReparsePointTag;
    public FILE_ID_128 FileId;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string FileName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILE_ID_128
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public Identifier() As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILE_ID_EXTD_DIR_INFO
    Public NextEntryOffset As UInteger
    Public FileIndex As UInteger
    Public CreationTime As Long
    Public LastAccessTime As Long
    Public LastWriteTime As Long
    Public ChangeTime As Long
    Public EndOfFile As Long
    Public AllocationSize As Long
    Public FileAttributes As UInteger
    Public FileNameLength As UInteger
    Public EaSize As UInteger
    Public ReparsePointTag As UInteger
    Public FileId As FILE_ID_128
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public FileName As String
End Structure
import ctypes
from ctypes import wintypes

class FILE_ID_128(ctypes.Structure):
    _fields_ = [
        ("Identifier", ctypes.c_ubyte * 16),
    ]

class FILE_ID_EXTD_DIR_INFO(ctypes.Structure):
    _fields_ = [
        ("NextEntryOffset", wintypes.DWORD),
        ("FileIndex", wintypes.DWORD),
        ("CreationTime", ctypes.c_longlong),
        ("LastAccessTime", ctypes.c_longlong),
        ("LastWriteTime", ctypes.c_longlong),
        ("ChangeTime", ctypes.c_longlong),
        ("EndOfFile", ctypes.c_longlong),
        ("AllocationSize", ctypes.c_longlong),
        ("FileAttributes", wintypes.DWORD),
        ("FileNameLength", wintypes.DWORD),
        ("EaSize", wintypes.DWORD),
        ("ReparsePointTag", wintypes.DWORD),
        ("FileId", FILE_ID_128),
        ("FileName", ctypes.c_wchar * 1),
    ]
#[repr(C)]
pub struct FILE_ID_128 {
    pub Identifier: [u8; 16],
}

#[repr(C)]
pub struct FILE_ID_EXTD_DIR_INFO {
    pub NextEntryOffset: u32,
    pub FileIndex: u32,
    pub CreationTime: i64,
    pub LastAccessTime: i64,
    pub LastWriteTime: i64,
    pub ChangeTime: i64,
    pub EndOfFile: i64,
    pub AllocationSize: i64,
    pub FileAttributes: u32,
    pub FileNameLength: u32,
    pub EaSize: u32,
    pub ReparsePointTag: u32,
    pub FileId: FILE_ID_128,
    pub FileName: [u16; 1],
}
import "golang.org/x/sys/windows"

type FILE_ID_128 struct {
	Identifier [16]byte
}

type FILE_ID_EXTD_DIR_INFO struct {
	NextEntryOffset uint32
	FileIndex uint32
	CreationTime int64
	LastAccessTime int64
	LastWriteTime int64
	ChangeTime int64
	EndOfFile int64
	AllocationSize int64
	FileAttributes uint32
	FileNameLength uint32
	EaSize uint32
	ReparsePointTag uint32
	FileId FILE_ID_128
	FileName [1]uint16
}
type
  FILE_ID_128 = record
    Identifier: array[0..15] of Byte;
  end;

  FILE_ID_EXTD_DIR_INFO = record
    NextEntryOffset: DWORD;
    FileIndex: DWORD;
    CreationTime: Int64;
    LastAccessTime: Int64;
    LastWriteTime: Int64;
    ChangeTime: Int64;
    EndOfFile: Int64;
    AllocationSize: Int64;
    FileAttributes: DWORD;
    FileNameLength: DWORD;
    EaSize: DWORD;
    ReparsePointTag: DWORD;
    FileId: FILE_ID_128;
    FileName: array[0..0] of WideChar;
  end;
const FILE_ID_128 = extern struct {
    Identifier: [16]u8,
};

const FILE_ID_EXTD_DIR_INFO = extern struct {
    NextEntryOffset: u32,
    FileIndex: u32,
    CreationTime: i64,
    LastAccessTime: i64,
    LastWriteTime: i64,
    ChangeTime: i64,
    EndOfFile: i64,
    AllocationSize: i64,
    FileAttributes: u32,
    FileNameLength: u32,
    EaSize: u32,
    ReparsePointTag: u32,
    FileId: FILE_ID_128,
    FileName: [1]u16,
};
type
  FILE_ID_128 {.bycopy.} = object
    Identifier: array[16, uint8]

  FILE_ID_EXTD_DIR_INFO {.bycopy.} = object
    NextEntryOffset: uint32
    FileIndex: uint32
    CreationTime: int64
    LastAccessTime: int64
    LastWriteTime: int64
    ChangeTime: int64
    EndOfFile: int64
    AllocationSize: int64
    FileAttributes: uint32
    FileNameLength: uint32
    EaSize: uint32
    ReparsePointTag: uint32
    FileId: FILE_ID_128
    FileName: array[1, uint16]
struct FILE_ID_128
{
    ubyte[16] Identifier;
}

struct FILE_ID_EXTD_DIR_INFO
{
    uint NextEntryOffset;
    uint FileIndex;
    long CreationTime;
    long LastAccessTime;
    long LastWriteTime;
    long ChangeTime;
    long EndOfFile;
    long AllocationSize;
    uint FileAttributes;
    uint FileNameLength;
    uint EaSize;
    uint ReparsePointTag;
    FILE_ID_128 FileId;
    wchar[1] FileName;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FILE_ID_EXTD_DIR_INFO サイズ: 96 バイト(x64)
dim st, 24    ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; NextEntryOffset : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; FileIndex : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; CreationTime : LONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; LastAccessTime : LONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; LastWriteTime : LONGLONG (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ChangeTime : LONGLONG (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; EndOfFile : LONGLONG (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; AllocationSize : LONGLONG (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; FileAttributes : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; FileNameLength : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; EaSize : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; ReparsePointTag : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; FileId : FILE_ID_128 (+72, 16byte)  varptr(st)+72 を基点に操作(16byte:入れ子/配列)
; FileName : WCHAR (+88, 2byte)  varptr(st)+88 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global FILE_ID_128
    #field byte Identifier 16
#endstruct

#defstruct global FILE_ID_EXTD_DIR_INFO
    #field int NextEntryOffset
    #field int FileIndex
    #field int64 CreationTime
    #field int64 LastAccessTime
    #field int64 LastWriteTime
    #field int64 ChangeTime
    #field int64 EndOfFile
    #field int64 AllocationSize
    #field int FileAttributes
    #field int FileNameLength
    #field int EaSize
    #field int ReparsePointTag
    #field FILE_ID_128 FileId
    #field wchar FileName 1
#endstruct

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