ホーム › Storage.FileSystem › FILE_ID_BOTH_DIR_INFO
FILE_ID_BOTH_DIR_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| NextEntryOffset | DWORD | 4 | +0 | +0 | 次のエントリへのバイトオフセット。0なら最終エントリ。 |
| FileIndex | DWORD | 4 | +4 | +4 | ディレクトリ内のファイルインデックス。 |
| CreationTime | LONGLONG | 8 | +8 | +8 | ファイルの作成時刻(1601年起点の100ns単位)。 |
| LastAccessTime | LONGLONG | 8 | +16 | +16 | ファイルの最終アクセス時刻。 |
| LastWriteTime | LONGLONG | 8 | +24 | +24 | ファイルの最終書き込み時刻。 |
| ChangeTime | LONGLONG | 8 | +32 | +32 | ファイルメタデータの最終変更時刻。 |
| EndOfFile | LONGLONG | 8 | +40 | +40 | ファイル末尾位置すなわち実サイズ(バイト)。 |
| AllocationSize | LONGLONG | 8 | +48 | +48 | ファイルに割り当てられたサイズ(バイト)。 |
| FileAttributes | DWORD | 4 | +56 | +56 | ファイル属性ビットマスク(FILE_ATTRIBUTE_*)。 |
| FileNameLength | DWORD | 4 | +60 | +60 | FileNameのバイト長。 |
| EaSize | DWORD | 4 | +64 | +64 | 拡張属性(EA)のバイトサイズ。 |
| ShortNameLength | CHAR | 1 | +68 | +68 | 8.3形式短い名前の文字数(バイト)。 |
| ShortName | WCHAR | 24 | +70 | +70 | 8.3形式の短いファイル名(最大12 WCHAR)。 |
| FileId | LONGLONG | 8 | +96 | +96 | ファイルを識別する64ビットのファイルID。 |
| FileName | WCHAR | 2 | +104 | +104 | 長いファイル名(可変長WCHAR配列)。 |
各言語での定義
#include <windows.h>
// FILE_ID_BOTH_DIR_INFO (x64 112 / x86 112 バイト)
typedef struct FILE_ID_BOTH_DIR_INFO {
DWORD NextEntryOffset;
DWORD FileIndex;
LONGLONG CreationTime;
LONGLONG LastAccessTime;
LONGLONG LastWriteTime;
LONGLONG ChangeTime;
LONGLONG EndOfFile;
LONGLONG AllocationSize;
DWORD FileAttributes;
DWORD FileNameLength;
DWORD EaSize;
CHAR ShortNameLength;
WCHAR ShortName[12];
LONGLONG FileId;
WCHAR FileName[1];
} FILE_ID_BOTH_DIR_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILE_ID_BOTH_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 sbyte ShortNameLength;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)] public string ShortName;
public long FileId;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string FileName;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILE_ID_BOTH_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 ShortNameLength As SByte
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=12)> Public ShortName As String
Public FileId As Long
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public FileName As String
End Structureimport ctypes
from ctypes import wintypes
class FILE_ID_BOTH_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),
("ShortNameLength", ctypes.c_byte),
("ShortName", ctypes.c_wchar * 12),
("FileId", ctypes.c_longlong),
("FileName", ctypes.c_wchar * 1),
]#[repr(C)]
pub struct FILE_ID_BOTH_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 ShortNameLength: i8,
pub ShortName: [u16; 12],
pub FileId: i64,
pub FileName: [u16; 1],
}import "golang.org/x/sys/windows"
type FILE_ID_BOTH_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
ShortNameLength int8
ShortName [12]uint16
FileId int64
FileName [1]uint16
}type
FILE_ID_BOTH_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;
ShortNameLength: Shortint;
ShortName: array[0..11] of WideChar;
FileId: Int64;
FileName: array[0..0] of WideChar;
end;const FILE_ID_BOTH_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,
ShortNameLength: i8,
ShortName: [12]u16,
FileId: i64,
FileName: [1]u16,
};type
FILE_ID_BOTH_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
ShortNameLength: int8
ShortName: array[12, uint16]
FileId: int64
FileName: array[1, uint16]struct FILE_ID_BOTH_DIR_INFO
{
uint NextEntryOffset;
uint FileIndex;
long CreationTime;
long LastAccessTime;
long LastWriteTime;
long ChangeTime;
long EndOfFile;
long AllocationSize;
uint FileAttributes;
uint FileNameLength;
uint EaSize;
byte ShortNameLength;
wchar[12] ShortName;
long 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_BOTH_DIR_INFO サイズ: 112 バイト(x64)
dim st, 28 ; 4byte整数×28(構造体サイズ 112 / 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 も可)
; ShortNameLength : CHAR (+68, 1byte) poke st,68,値 / 値 = peek(st,68)
; ShortName : WCHAR (+70, 24byte) varptr(st)+70 を基点に操作(24byte:入れ子/配列)
; FileId : LONGLONG (+96, 8byte) qpoke st,96,値 / qpeek(st,96) ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; FileName : WCHAR (+104, 2byte) varptr(st)+104 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global FILE_ID_BOTH_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 byte ShortNameLength
#field wchar ShortName 12
#field int64 FileId
#field wchar FileName 1
#endstruct
stdim st, FILE_ID_BOTH_DIR_INFO ; NSTRUCT 変数を確保
st->NextEntryOffset = 100
mes "NextEntryOffset=" + st->NextEntryOffset