ホーム › Storage.FileSystem › FILE_STAT_BASIC_INFORMATION
FILE_STAT_BASIC_INFORMATION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| FileId | LONGLONG | 8 | +0 | +0 | ファイルを識別する64ビットのファイルID。 |
| CreationTime | LONGLONG | 8 | +8 | +8 | ファイルの作成時刻(1601年起点の100ns単位)。 |
| LastAccessTime | LONGLONG | 8 | +16 | +16 | ファイルの最終アクセス時刻。 |
| LastWriteTime | LONGLONG | 8 | +24 | +24 | ファイルの最終書き込み時刻。 |
| ChangeTime | LONGLONG | 8 | +32 | +32 | ファイルメタデータの最終変更時刻。 |
| AllocationSize | LONGLONG | 8 | +40 | +40 | ファイルに割り当てられたサイズ(バイト)。 |
| EndOfFile | LONGLONG | 8 | +48 | +48 | ファイル末尾位置すなわち実サイズ(バイト)。 |
| FileAttributes | DWORD | 4 | +56 | +56 | ファイル属性ビットマスク(FILE_ATTRIBUTE_*)。 |
| ReparseTag | DWORD | 4 | +60 | +60 | リパースポイントのタグ値。非該当時は0。 |
| NumberOfLinks | DWORD | 4 | +64 | +64 | ファイルへのハードリンク数。 |
| DeviceType | DWORD | 4 | +68 | +68 | ファイルが存在するデバイスの種類。 |
| DeviceCharacteristics | DWORD | 4 | +72 | +72 | デバイスの特性を示すビットマスク。 |
| Reserved | DWORD | 4 | +76 | +76 | 予約フィールド。0が設定される。 |
| VolumeSerialNumber | LONGLONG | 8 | +80 | +80 | ファイルが存在するボリュームのシリアル番号。 |
| FileId128 | FILE_ID_128 | 16 | +88 | +88 | 128ビットのファイル識別子。 |
各言語での定義
#include <windows.h>
// FILE_ID_128 (x64 16 / x86 16 バイト)
typedef struct FILE_ID_128 {
BYTE Identifier[16];
} FILE_ID_128;
// FILE_STAT_BASIC_INFORMATION (x64 104 / x86 104 バイト)
typedef struct FILE_STAT_BASIC_INFORMATION {
LONGLONG FileId;
LONGLONG CreationTime;
LONGLONG LastAccessTime;
LONGLONG LastWriteTime;
LONGLONG ChangeTime;
LONGLONG AllocationSize;
LONGLONG EndOfFile;
DWORD FileAttributes;
DWORD ReparseTag;
DWORD NumberOfLinks;
DWORD DeviceType;
DWORD DeviceCharacteristics;
DWORD Reserved;
LONGLONG VolumeSerialNumber;
FILE_ID_128 FileId128;
} FILE_STAT_BASIC_INFORMATION;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_STAT_BASIC_INFORMATION
{
public long FileId;
public long CreationTime;
public long LastAccessTime;
public long LastWriteTime;
public long ChangeTime;
public long AllocationSize;
public long EndOfFile;
public uint FileAttributes;
public uint ReparseTag;
public uint NumberOfLinks;
public uint DeviceType;
public uint DeviceCharacteristics;
public uint Reserved;
public long VolumeSerialNumber;
public FILE_ID_128 FileId128;
}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_STAT_BASIC_INFORMATION
Public FileId As Long
Public CreationTime As Long
Public LastAccessTime As Long
Public LastWriteTime As Long
Public ChangeTime As Long
Public AllocationSize As Long
Public EndOfFile As Long
Public FileAttributes As UInteger
Public ReparseTag As UInteger
Public NumberOfLinks As UInteger
Public DeviceType As UInteger
Public DeviceCharacteristics As UInteger
Public Reserved As UInteger
Public VolumeSerialNumber As Long
Public FileId128 As FILE_ID_128
End Structureimport ctypes
from ctypes import wintypes
class FILE_ID_128(ctypes.Structure):
_fields_ = [
("Identifier", ctypes.c_ubyte * 16),
]
class FILE_STAT_BASIC_INFORMATION(ctypes.Structure):
_fields_ = [
("FileId", ctypes.c_longlong),
("CreationTime", ctypes.c_longlong),
("LastAccessTime", ctypes.c_longlong),
("LastWriteTime", ctypes.c_longlong),
("ChangeTime", ctypes.c_longlong),
("AllocationSize", ctypes.c_longlong),
("EndOfFile", ctypes.c_longlong),
("FileAttributes", wintypes.DWORD),
("ReparseTag", wintypes.DWORD),
("NumberOfLinks", wintypes.DWORD),
("DeviceType", wintypes.DWORD),
("DeviceCharacteristics", wintypes.DWORD),
("Reserved", wintypes.DWORD),
("VolumeSerialNumber", ctypes.c_longlong),
("FileId128", FILE_ID_128),
]#[repr(C)]
pub struct FILE_ID_128 {
pub Identifier: [u8; 16],
}
#[repr(C)]
pub struct FILE_STAT_BASIC_INFORMATION {
pub FileId: i64,
pub CreationTime: i64,
pub LastAccessTime: i64,
pub LastWriteTime: i64,
pub ChangeTime: i64,
pub AllocationSize: i64,
pub EndOfFile: i64,
pub FileAttributes: u32,
pub ReparseTag: u32,
pub NumberOfLinks: u32,
pub DeviceType: u32,
pub DeviceCharacteristics: u32,
pub Reserved: u32,
pub VolumeSerialNumber: i64,
pub FileId128: FILE_ID_128,
}import "golang.org/x/sys/windows"
type FILE_ID_128 struct {
Identifier [16]byte
}
type FILE_STAT_BASIC_INFORMATION struct {
FileId int64
CreationTime int64
LastAccessTime int64
LastWriteTime int64
ChangeTime int64
AllocationSize int64
EndOfFile int64
FileAttributes uint32
ReparseTag uint32
NumberOfLinks uint32
DeviceType uint32
DeviceCharacteristics uint32
Reserved uint32
VolumeSerialNumber int64
FileId128 FILE_ID_128
}type
FILE_ID_128 = record
Identifier: array[0..15] of Byte;
end;
FILE_STAT_BASIC_INFORMATION = record
FileId: Int64;
CreationTime: Int64;
LastAccessTime: Int64;
LastWriteTime: Int64;
ChangeTime: Int64;
AllocationSize: Int64;
EndOfFile: Int64;
FileAttributes: DWORD;
ReparseTag: DWORD;
NumberOfLinks: DWORD;
DeviceType: DWORD;
DeviceCharacteristics: DWORD;
Reserved: DWORD;
VolumeSerialNumber: Int64;
FileId128: FILE_ID_128;
end;const FILE_ID_128 = extern struct {
Identifier: [16]u8,
};
const FILE_STAT_BASIC_INFORMATION = extern struct {
FileId: i64,
CreationTime: i64,
LastAccessTime: i64,
LastWriteTime: i64,
ChangeTime: i64,
AllocationSize: i64,
EndOfFile: i64,
FileAttributes: u32,
ReparseTag: u32,
NumberOfLinks: u32,
DeviceType: u32,
DeviceCharacteristics: u32,
Reserved: u32,
VolumeSerialNumber: i64,
FileId128: FILE_ID_128,
};type
FILE_ID_128 {.bycopy.} = object
Identifier: array[16, uint8]
FILE_STAT_BASIC_INFORMATION {.bycopy.} = object
FileId: int64
CreationTime: int64
LastAccessTime: int64
LastWriteTime: int64
ChangeTime: int64
AllocationSize: int64
EndOfFile: int64
FileAttributes: uint32
ReparseTag: uint32
NumberOfLinks: uint32
DeviceType: uint32
DeviceCharacteristics: uint32
Reserved: uint32
VolumeSerialNumber: int64
FileId128: FILE_ID_128struct FILE_ID_128
{
ubyte[16] Identifier;
}
struct FILE_STAT_BASIC_INFORMATION
{
long FileId;
long CreationTime;
long LastAccessTime;
long LastWriteTime;
long ChangeTime;
long AllocationSize;
long EndOfFile;
uint FileAttributes;
uint ReparseTag;
uint NumberOfLinks;
uint DeviceType;
uint DeviceCharacteristics;
uint Reserved;
long VolumeSerialNumber;
FILE_ID_128 FileId128;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FILE_STAT_BASIC_INFORMATION サイズ: 104 バイト(x64)
dim st, 26 ; 4byte整数×26(構造体サイズ 104 / 4 切り上げ)
; FileId : LONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; 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,上位
; AllocationSize : LONGLONG (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; EndOfFile : 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 も可)
; ReparseTag : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; NumberOfLinks : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; DeviceType : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; DeviceCharacteristics : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; Reserved : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; VolumeSerialNumber : LONGLONG (+80, 8byte) qpoke st,80,値 / qpeek(st,80) ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; FileId128 : FILE_ID_128 (+88, 16byte) varptr(st)+88 を基点に操作(16byte:入れ子/配列)
; ※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_STAT_BASIC_INFORMATION
#field int64 FileId
#field int64 CreationTime
#field int64 LastAccessTime
#field int64 LastWriteTime
#field int64 ChangeTime
#field int64 AllocationSize
#field int64 EndOfFile
#field int FileAttributes
#field int ReparseTag
#field int NumberOfLinks
#field int DeviceType
#field int DeviceCharacteristics
#field int Reserved
#field int64 VolumeSerialNumber
#field FILE_ID_128 FileId128
#endstruct
stdim st, FILE_STAT_BASIC_INFORMATION ; NSTRUCT 変数を確保
st->FileId = 100
mes "FileId=" + st->FileId