ホーム › Storage.FileSystem › FILE_NOTIFY_EXTENDED_INFORMATION
FILE_NOTIFY_EXTENDED_INFORMATION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| NextEntryOffset | DWORD | 4 | +0 | +0 | 次のエントリへのバイトオフセット。0なら最終エントリ。 |
| Action | FILE_ACTION | 4 | +4 | +4 | 発生した変更の種類(FILE_ACTION値)。 |
| CreationTime | LONGLONG | 8 | +8 | +8 | ファイルの作成時刻(1601年起点の100ns単位)。 |
| LastModificationTime | LONGLONG | 8 | +16 | +16 | ファイルの最終データ変更時刻。 |
| LastChangeTime | LONGLONG | 8 | +24 | +24 | ファイルメタデータの最終変更時刻。 |
| LastAccessTime | LONGLONG | 8 | +32 | +32 | ファイルの最終アクセス時刻。 |
| AllocatedLength | LONGLONG | 8 | +40 | +40 | ファイルに割り当てられたサイズ(バイト)。 |
| FileSize | LONGLONG | 8 | +48 | +48 | ファイルの実サイズ(バイト)。 |
| FileAttributes | DWORD | 4 | +56 | +56 | ファイル属性ビットマスク(FILE_ATTRIBUTE_*)。 |
| Anonymous | _Anonymous_e__Union | 4 | +60 | +60 | 予約タグ/ハードリンク数等を保持する無名共用体。 |
| FileId | LONGLONG | 8 | +64 | +64 | ファイルを一意に識別するファイルID。 |
| ParentFileId | LONGLONG | 8 | +72 | +72 | 親ディレクトリのファイルID。 |
| FileNameLength | DWORD | 4 | +80 | +80 | FileNameのバイト長(NULL終端を含まない)。 |
| FileName | WCHAR | 2 | +84 | +84 | 変更されたファイルの相対パス名(可変長WCHAR配列)。 |
共用体: _Anonymous_e__Union x64 4B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| ReparsePointTag | DWORD | 4 | +0 | +0 |
| EaSize | DWORD | 4 | +0 | +0 |
各言語での定義
#include <windows.h>
// FILE_NOTIFY_EXTENDED_INFORMATION (x64 88 / x86 88 バイト)
typedef struct FILE_NOTIFY_EXTENDED_INFORMATION {
DWORD NextEntryOffset;
FILE_ACTION Action;
LONGLONG CreationTime;
LONGLONG LastModificationTime;
LONGLONG LastChangeTime;
LONGLONG LastAccessTime;
LONGLONG AllocatedLength;
LONGLONG FileSize;
DWORD FileAttributes;
_Anonymous_e__Union Anonymous;
LONGLONG FileId;
LONGLONG ParentFileId;
DWORD FileNameLength;
WCHAR FileName[1];
} FILE_NOTIFY_EXTENDED_INFORMATION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILE_NOTIFY_EXTENDED_INFORMATION
{
public uint NextEntryOffset;
public uint Action;
public long CreationTime;
public long LastModificationTime;
public long LastChangeTime;
public long LastAccessTime;
public long AllocatedLength;
public long FileSize;
public uint FileAttributes;
public _Anonymous_e__Union Anonymous;
public long FileId;
public long ParentFileId;
public uint FileNameLength;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string FileName;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILE_NOTIFY_EXTENDED_INFORMATION
Public NextEntryOffset As UInteger
Public Action As UInteger
Public CreationTime As Long
Public LastModificationTime As Long
Public LastChangeTime As Long
Public LastAccessTime As Long
Public AllocatedLength As Long
Public FileSize As Long
Public FileAttributes As UInteger
Public Anonymous As _Anonymous_e__Union
Public FileId As Long
Public ParentFileId As Long
Public FileNameLength As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public FileName As String
End Structureimport ctypes
from ctypes import wintypes
class FILE_NOTIFY_EXTENDED_INFORMATION(ctypes.Structure):
_fields_ = [
("NextEntryOffset", wintypes.DWORD),
("Action", wintypes.DWORD),
("CreationTime", ctypes.c_longlong),
("LastModificationTime", ctypes.c_longlong),
("LastChangeTime", ctypes.c_longlong),
("LastAccessTime", ctypes.c_longlong),
("AllocatedLength", ctypes.c_longlong),
("FileSize", ctypes.c_longlong),
("FileAttributes", wintypes.DWORD),
("Anonymous", _Anonymous_e__Union),
("FileId", ctypes.c_longlong),
("ParentFileId", ctypes.c_longlong),
("FileNameLength", wintypes.DWORD),
("FileName", ctypes.c_wchar * 1),
]#[repr(C)]
pub struct FILE_NOTIFY_EXTENDED_INFORMATION {
pub NextEntryOffset: u32,
pub Action: u32,
pub CreationTime: i64,
pub LastModificationTime: i64,
pub LastChangeTime: i64,
pub LastAccessTime: i64,
pub AllocatedLength: i64,
pub FileSize: i64,
pub FileAttributes: u32,
pub Anonymous: _Anonymous_e__Union,
pub FileId: i64,
pub ParentFileId: i64,
pub FileNameLength: u32,
pub FileName: [u16; 1],
}import "golang.org/x/sys/windows"
type FILE_NOTIFY_EXTENDED_INFORMATION struct {
NextEntryOffset uint32
Action uint32
CreationTime int64
LastModificationTime int64
LastChangeTime int64
LastAccessTime int64
AllocatedLength int64
FileSize int64
FileAttributes uint32
Anonymous _Anonymous_e__Union
FileId int64
ParentFileId int64
FileNameLength uint32
FileName [1]uint16
}type
FILE_NOTIFY_EXTENDED_INFORMATION = record
NextEntryOffset: DWORD;
Action: DWORD;
CreationTime: Int64;
LastModificationTime: Int64;
LastChangeTime: Int64;
LastAccessTime: Int64;
AllocatedLength: Int64;
FileSize: Int64;
FileAttributes: DWORD;
Anonymous: _Anonymous_e__Union;
FileId: Int64;
ParentFileId: Int64;
FileNameLength: DWORD;
FileName: array[0..0] of WideChar;
end;const FILE_NOTIFY_EXTENDED_INFORMATION = extern struct {
NextEntryOffset: u32,
Action: u32,
CreationTime: i64,
LastModificationTime: i64,
LastChangeTime: i64,
LastAccessTime: i64,
AllocatedLength: i64,
FileSize: i64,
FileAttributes: u32,
Anonymous: _Anonymous_e__Union,
FileId: i64,
ParentFileId: i64,
FileNameLength: u32,
FileName: [1]u16,
};type
FILE_NOTIFY_EXTENDED_INFORMATION {.bycopy.} = object
NextEntryOffset: uint32
Action: uint32
CreationTime: int64
LastModificationTime: int64
LastChangeTime: int64
LastAccessTime: int64
AllocatedLength: int64
FileSize: int64
FileAttributes: uint32
Anonymous: _Anonymous_e__Union
FileId: int64
ParentFileId: int64
FileNameLength: uint32
FileName: array[1, uint16]struct FILE_NOTIFY_EXTENDED_INFORMATION
{
uint NextEntryOffset;
uint Action;
long CreationTime;
long LastModificationTime;
long LastChangeTime;
long LastAccessTime;
long AllocatedLength;
long FileSize;
uint FileAttributes;
_Anonymous_e__Union Anonymous;
long FileId;
long ParentFileId;
uint FileNameLength;
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_NOTIFY_EXTENDED_INFORMATION サイズ: 88 バイト(x64)
dim st, 22 ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; NextEntryOffset : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Action : FILE_ACTION (+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,上位
; LastModificationTime : LONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; LastChangeTime : LONGLONG (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; LastAccessTime : LONGLONG (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; AllocatedLength : LONGLONG (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; FileSize : 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 も可)
; Anonymous : _Anonymous_e__Union (+60, 4byte) varptr(st)+60 を基点に操作(4byte:入れ子/配列)
; FileId : LONGLONG (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; ParentFileId : LONGLONG (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; FileNameLength : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; FileName : WCHAR (+84, 2byte) varptr(st)+84 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global FILE_NOTIFY_EXTENDED_INFORMATION
#field int NextEntryOffset
#field int Action
#field int64 CreationTime
#field int64 LastModificationTime
#field int64 LastChangeTime
#field int64 LastAccessTime
#field int64 AllocatedLength
#field int64 FileSize
#field int FileAttributes
#field byte Anonymous 4
#field int64 FileId
#field int64 ParentFileId
#field int FileNameLength
#field wchar FileName 1
#endstruct
stdim st, FILE_NOTIFY_EXTENDED_INFORMATION ; NSTRUCT 変数を確保
st->NextEntryOffset = 100
mes "NextEntryOffset=" + st->NextEntryOffset
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。