ホーム › Storage.FileSystem › FILE_STANDARD_INFO
FILE_STANDARD_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| AllocationSize | LONGLONG | 8 | +0 | +0 | ファイルに割り当てられたサイズ(バイト)。 |
| EndOfFile | LONGLONG | 8 | +8 | +8 | ファイル末尾位置すなわち実サイズ(バイト)。 |
| NumberOfLinks | DWORD | 4 | +16 | +16 | ファイルへのハードリンク数。 |
| DeletePending | BOOLEAN | 1 | +20 | +20 | 削除予定状態ならTRUE。 |
| Directory | BOOLEAN | 1 | +21 | +21 | ディレクトリならTRUE、通常ファイルならFALSE。 |
各言語での定義
#include <windows.h>
// FILE_STANDARD_INFO (x64 24 / x86 24 バイト)
typedef struct FILE_STANDARD_INFO {
LONGLONG AllocationSize;
LONGLONG EndOfFile;
DWORD NumberOfLinks;
BOOLEAN DeletePending;
BOOLEAN Directory;
} FILE_STANDARD_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILE_STANDARD_INFO
{
public long AllocationSize;
public long EndOfFile;
public uint NumberOfLinks;
[MarshalAs(UnmanagedType.U1)] public bool DeletePending;
[MarshalAs(UnmanagedType.U1)] public bool Directory;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILE_STANDARD_INFO
Public AllocationSize As Long
Public EndOfFile As Long
Public NumberOfLinks As UInteger
<MarshalAs(UnmanagedType.U1)> Public DeletePending As Boolean
<MarshalAs(UnmanagedType.U1)> Public Directory As Boolean
End Structureimport ctypes
from ctypes import wintypes
class FILE_STANDARD_INFO(ctypes.Structure):
_fields_ = [
("AllocationSize", ctypes.c_longlong),
("EndOfFile", ctypes.c_longlong),
("NumberOfLinks", wintypes.DWORD),
("DeletePending", ctypes.c_byte),
("Directory", ctypes.c_byte),
]#[repr(C)]
pub struct FILE_STANDARD_INFO {
pub AllocationSize: i64,
pub EndOfFile: i64,
pub NumberOfLinks: u32,
pub DeletePending: u8,
pub Directory: u8,
}import "golang.org/x/sys/windows"
type FILE_STANDARD_INFO struct {
AllocationSize int64
EndOfFile int64
NumberOfLinks uint32
DeletePending byte
Directory byte
}type
FILE_STANDARD_INFO = record
AllocationSize: Int64;
EndOfFile: Int64;
NumberOfLinks: DWORD;
DeletePending: ByteBool;
Directory: ByteBool;
end;const FILE_STANDARD_INFO = extern struct {
AllocationSize: i64,
EndOfFile: i64,
NumberOfLinks: u32,
DeletePending: u8,
Directory: u8,
};type
FILE_STANDARD_INFO {.bycopy.} = object
AllocationSize: int64
EndOfFile: int64
NumberOfLinks: uint32
DeletePending: uint8
Directory: uint8struct FILE_STANDARD_INFO
{
long AllocationSize;
long EndOfFile;
uint NumberOfLinks;
ubyte DeletePending;
ubyte Directory;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FILE_STANDARD_INFO サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; AllocationSize : LONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; EndOfFile : LONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; NumberOfLinks : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; DeletePending : BOOLEAN (+20, 1byte) poke st,20,値 / 値 = peek(st,20)
; Directory : BOOLEAN (+21, 1byte) poke st,21,値 / 値 = peek(st,21)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global FILE_STANDARD_INFO
#field int64 AllocationSize
#field int64 EndOfFile
#field int NumberOfLinks
#field bool1 DeletePending
#field bool1 Directory
#endstruct
stdim st, FILE_STANDARD_INFO ; NSTRUCT 変数を確保
st->AllocationSize = 100
mes "AllocationSize=" + st->AllocationSize