ホーム › Storage.FileSystem › FILE_STORAGE_INFO
FILE_STORAGE_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| LogicalBytesPerSector | DWORD | 4 | +0 | +0 | 論理セクターあたりのバイト数。 |
| PhysicalBytesPerSectorForAtomicity | DWORD | 4 | +4 | +4 | 原子性を保証する物理セクターあたりのバイト数。 |
| PhysicalBytesPerSectorForPerformance | DWORD | 4 | +8 | +8 | 性能上最適な物理セクターあたりのバイト数。 |
| FileSystemEffectivePhysicalBytesPerSectorForAtomicity | DWORD | 4 | +12 | +12 | ファイルシステムが原子性に用いる実効物理セクターサイズ。 |
| Flags | DWORD | 4 | +16 | +16 | ストレージの整列情報フラグ(STORAGE_INFO_FLAGS_*)。 |
| ByteOffsetForSectorAlignment | DWORD | 4 | +20 | +20 | セクター整列のためのバイトオフセット。整列不明時は0xFFFFFFFF。 |
| ByteOffsetForPartitionAlignment | DWORD | 4 | +24 | +24 | パーティション整列のためのバイトオフセット。不明時は0xFFFFFFFF。 |
各言語での定義
#include <windows.h>
// FILE_STORAGE_INFO (x64 28 / x86 28 バイト)
typedef struct FILE_STORAGE_INFO {
DWORD LogicalBytesPerSector;
DWORD PhysicalBytesPerSectorForAtomicity;
DWORD PhysicalBytesPerSectorForPerformance;
DWORD FileSystemEffectivePhysicalBytesPerSectorForAtomicity;
DWORD Flags;
DWORD ByteOffsetForSectorAlignment;
DWORD ByteOffsetForPartitionAlignment;
} FILE_STORAGE_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILE_STORAGE_INFO
{
public uint LogicalBytesPerSector;
public uint PhysicalBytesPerSectorForAtomicity;
public uint PhysicalBytesPerSectorForPerformance;
public uint FileSystemEffectivePhysicalBytesPerSectorForAtomicity;
public uint Flags;
public uint ByteOffsetForSectorAlignment;
public uint ByteOffsetForPartitionAlignment;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILE_STORAGE_INFO
Public LogicalBytesPerSector As UInteger
Public PhysicalBytesPerSectorForAtomicity As UInteger
Public PhysicalBytesPerSectorForPerformance As UInteger
Public FileSystemEffectivePhysicalBytesPerSectorForAtomicity As UInteger
Public Flags As UInteger
Public ByteOffsetForSectorAlignment As UInteger
Public ByteOffsetForPartitionAlignment As UInteger
End Structureimport ctypes
from ctypes import wintypes
class FILE_STORAGE_INFO(ctypes.Structure):
_fields_ = [
("LogicalBytesPerSector", wintypes.DWORD),
("PhysicalBytesPerSectorForAtomicity", wintypes.DWORD),
("PhysicalBytesPerSectorForPerformance", wintypes.DWORD),
("FileSystemEffectivePhysicalBytesPerSectorForAtomicity", wintypes.DWORD),
("Flags", wintypes.DWORD),
("ByteOffsetForSectorAlignment", wintypes.DWORD),
("ByteOffsetForPartitionAlignment", wintypes.DWORD),
]#[repr(C)]
pub struct FILE_STORAGE_INFO {
pub LogicalBytesPerSector: u32,
pub PhysicalBytesPerSectorForAtomicity: u32,
pub PhysicalBytesPerSectorForPerformance: u32,
pub FileSystemEffectivePhysicalBytesPerSectorForAtomicity: u32,
pub Flags: u32,
pub ByteOffsetForSectorAlignment: u32,
pub ByteOffsetForPartitionAlignment: u32,
}import "golang.org/x/sys/windows"
type FILE_STORAGE_INFO struct {
LogicalBytesPerSector uint32
PhysicalBytesPerSectorForAtomicity uint32
PhysicalBytesPerSectorForPerformance uint32
FileSystemEffectivePhysicalBytesPerSectorForAtomicity uint32
Flags uint32
ByteOffsetForSectorAlignment uint32
ByteOffsetForPartitionAlignment uint32
}type
FILE_STORAGE_INFO = record
LogicalBytesPerSector: DWORD;
PhysicalBytesPerSectorForAtomicity: DWORD;
PhysicalBytesPerSectorForPerformance: DWORD;
FileSystemEffectivePhysicalBytesPerSectorForAtomicity: DWORD;
Flags: DWORD;
ByteOffsetForSectorAlignment: DWORD;
ByteOffsetForPartitionAlignment: DWORD;
end;const FILE_STORAGE_INFO = extern struct {
LogicalBytesPerSector: u32,
PhysicalBytesPerSectorForAtomicity: u32,
PhysicalBytesPerSectorForPerformance: u32,
FileSystemEffectivePhysicalBytesPerSectorForAtomicity: u32,
Flags: u32,
ByteOffsetForSectorAlignment: u32,
ByteOffsetForPartitionAlignment: u32,
};type
FILE_STORAGE_INFO {.bycopy.} = object
LogicalBytesPerSector: uint32
PhysicalBytesPerSectorForAtomicity: uint32
PhysicalBytesPerSectorForPerformance: uint32
FileSystemEffectivePhysicalBytesPerSectorForAtomicity: uint32
Flags: uint32
ByteOffsetForSectorAlignment: uint32
ByteOffsetForPartitionAlignment: uint32struct FILE_STORAGE_INFO
{
uint LogicalBytesPerSector;
uint PhysicalBytesPerSectorForAtomicity;
uint PhysicalBytesPerSectorForPerformance;
uint FileSystemEffectivePhysicalBytesPerSectorForAtomicity;
uint Flags;
uint ByteOffsetForSectorAlignment;
uint ByteOffsetForPartitionAlignment;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FILE_STORAGE_INFO サイズ: 28 バイト(x64)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; LogicalBytesPerSector : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; PhysicalBytesPerSectorForAtomicity : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; PhysicalBytesPerSectorForPerformance : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; FileSystemEffectivePhysicalBytesPerSectorForAtomicity : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Flags : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ByteOffsetForSectorAlignment : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ByteOffsetForPartitionAlignment : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global FILE_STORAGE_INFO
#field int LogicalBytesPerSector
#field int PhysicalBytesPerSectorForAtomicity
#field int PhysicalBytesPerSectorForPerformance
#field int FileSystemEffectivePhysicalBytesPerSectorForAtomicity
#field int Flags
#field int ByteOffsetForSectorAlignment
#field int ByteOffsetForPartitionAlignment
#endstruct
stdim st, FILE_STORAGE_INFO ; NSTRUCT 変数を確保
st->LogicalBytesPerSector = 100
mes "LogicalBytesPerSector=" + st->LogicalBytesPerSector