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

FILE_FULL_DIR_INFO

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

サイズ=各フィールドのバイト数(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)のバイトサイズ。
FileNameWCHAR2+68+68ファイル名(可変長WCHAR配列)。

各言語での定義

#include <windows.h>

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILE_FULL_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;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string FileName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILE_FULL_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
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public FileName As String
End Structure
import ctypes
from ctypes import wintypes

class FILE_FULL_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),
        ("FileName", ctypes.c_wchar * 1),
    ]
#[repr(C)]
pub struct FILE_FULL_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 FileName: [u16; 1],
}
import "golang.org/x/sys/windows"

type FILE_FULL_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
	FileName [1]uint16
}
type
  FILE_FULL_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;
    FileName: array[0..0] of WideChar;
  end;
const FILE_FULL_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,
    FileName: [1]u16,
};
type
  FILE_FULL_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
    FileName: array[1, uint16]
struct FILE_FULL_DIR_INFO
{
    uint NextEntryOffset;
    uint FileIndex;
    long CreationTime;
    long LastAccessTime;
    long LastWriteTime;
    long ChangeTime;
    long EndOfFile;
    long AllocationSize;
    uint FileAttributes;
    uint FileNameLength;
    uint EaSize;
    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_FULL_DIR_INFO サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 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 も可)
; FileName : WCHAR (+68, 2byte)  varptr(st)+68 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global FILE_FULL_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 wchar FileName 1
#endstruct

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