Win32 API 日本語リファレンス
ホームSystem.SystemServices › FILE_STAT_INFORMATION

FILE_STAT_INFORMATION

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

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

フィールド

フィールドサイズx64x86説明
FileIdLONGLONG8+0+0ファイルを一意に識別するファイルID。
CreationTimeLONGLONG8+8+8ファイル作成日時。
LastAccessTimeLONGLONG8+16+16最終アクセス日時。
LastWriteTimeLONGLONG8+24+24最終書き込み日時。
ChangeTimeLONGLONG8+32+32最終属性変更日時。
AllocationSizeLONGLONG8+40+40ファイルに割り当てられたサイズをバイト単位で示す。
EndOfFileLONGLONG8+48+48ファイル末尾位置(実サイズ)をバイト単位で示す。
FileAttributesDWORD4+56+56ファイル属性フラグ。
ReparseTagDWORD4+60+60再解析ポイントのタグ値。再解析ポイントでない場合は0。
NumberOfLinksDWORD4+64+64ファイルへのハードリンク数。
EffectiveAccessDWORD4+68+68呼び出し元に許可された実効アクセス権。

各言語での定義

#include <windows.h>

// FILE_STAT_INFORMATION  (x64 72 / x86 72 バイト)
typedef struct FILE_STAT_INFORMATION {
    LONGLONG FileId;
    LONGLONG CreationTime;
    LONGLONG LastAccessTime;
    LONGLONG LastWriteTime;
    LONGLONG ChangeTime;
    LONGLONG AllocationSize;
    LONGLONG EndOfFile;
    DWORD FileAttributes;
    DWORD ReparseTag;
    DWORD NumberOfLinks;
    DWORD EffectiveAccess;
} FILE_STAT_INFORMATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILE_STAT_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 EffectiveAccess;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILE_STAT_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 EffectiveAccess As UInteger
End Structure
import ctypes
from ctypes import wintypes

class FILE_STAT_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),
        ("EffectiveAccess", wintypes.DWORD),
    ]
#[repr(C)]
pub struct FILE_STAT_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 EffectiveAccess: u32,
}
import "golang.org/x/sys/windows"

type FILE_STAT_INFORMATION struct {
	FileId int64
	CreationTime int64
	LastAccessTime int64
	LastWriteTime int64
	ChangeTime int64
	AllocationSize int64
	EndOfFile int64
	FileAttributes uint32
	ReparseTag uint32
	NumberOfLinks uint32
	EffectiveAccess uint32
}
type
  FILE_STAT_INFORMATION = record
    FileId: Int64;
    CreationTime: Int64;
    LastAccessTime: Int64;
    LastWriteTime: Int64;
    ChangeTime: Int64;
    AllocationSize: Int64;
    EndOfFile: Int64;
    FileAttributes: DWORD;
    ReparseTag: DWORD;
    NumberOfLinks: DWORD;
    EffectiveAccess: DWORD;
  end;
const FILE_STAT_INFORMATION = extern struct {
    FileId: i64,
    CreationTime: i64,
    LastAccessTime: i64,
    LastWriteTime: i64,
    ChangeTime: i64,
    AllocationSize: i64,
    EndOfFile: i64,
    FileAttributes: u32,
    ReparseTag: u32,
    NumberOfLinks: u32,
    EffectiveAccess: u32,
};
type
  FILE_STAT_INFORMATION {.bycopy.} = object
    FileId: int64
    CreationTime: int64
    LastAccessTime: int64
    LastWriteTime: int64
    ChangeTime: int64
    AllocationSize: int64
    EndOfFile: int64
    FileAttributes: uint32
    ReparseTag: uint32
    NumberOfLinks: uint32
    EffectiveAccess: uint32
struct FILE_STAT_INFORMATION
{
    long FileId;
    long CreationTime;
    long LastAccessTime;
    long LastWriteTime;
    long ChangeTime;
    long AllocationSize;
    long EndOfFile;
    uint FileAttributes;
    uint ReparseTag;
    uint NumberOfLinks;
    uint EffectiveAccess;
}

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_INFORMATION サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 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 も可)
; EffectiveAccess : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global FILE_STAT_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 EffectiveAccess
#endstruct

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