ホーム › System.Ioctl › NTFS_VOLUME_DATA_BUFFER
NTFS_VOLUME_DATA_BUFFER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| VolumeSerialNumber | LONGLONG | 8 | +0 | +0 | ボリュームのシリアル番号。 |
| NumberSectors | LONGLONG | 8 | +8 | +8 | ボリュームの総セクタ数。 |
| TotalClusters | LONGLONG | 8 | +16 | +16 | ボリュームの総クラスタ数。 |
| FreeClusters | LONGLONG | 8 | +24 | +24 | 空きクラスタ数。 |
| TotalReserved | LONGLONG | 8 | +32 | +32 | 予約済みクラスタ数。 |
| BytesPerSector | DWORD | 4 | +40 | +40 | 1セクタあたりのバイト数。 |
| BytesPerCluster | DWORD | 4 | +44 | +44 | 1クラスタあたりのバイト数。 |
| BytesPerFileRecordSegment | DWORD | 4 | +48 | +48 | 1ファイルレコードセグメントあたりのバイト数。 |
| ClustersPerFileRecordSegment | DWORD | 4 | +52 | +52 | 1ファイルレコードセグメントあたりのクラスタ数。 |
| MftValidDataLength | LONGLONG | 8 | +56 | +56 | MFTの有効データ長。バイト単位。 |
| MftStartLcn | LONGLONG | 8 | +64 | +64 | MFTの開始論理クラスタ番号(LCN)。 |
| Mft2StartLcn | LONGLONG | 8 | +72 | +72 | MFTミラーの開始論理クラスタ番号(LCN)。 |
| MftZoneStart | LONGLONG | 8 | +80 | +80 | MFTゾーンの開始LCN。 |
| MftZoneEnd | LONGLONG | 8 | +88 | +88 | MFTゾーンの終了LCN。 |
各言語での定義
#include <windows.h>
// NTFS_VOLUME_DATA_BUFFER (x64 96 / x86 96 バイト)
typedef struct NTFS_VOLUME_DATA_BUFFER {
LONGLONG VolumeSerialNumber;
LONGLONG NumberSectors;
LONGLONG TotalClusters;
LONGLONG FreeClusters;
LONGLONG TotalReserved;
DWORD BytesPerSector;
DWORD BytesPerCluster;
DWORD BytesPerFileRecordSegment;
DWORD ClustersPerFileRecordSegment;
LONGLONG MftValidDataLength;
LONGLONG MftStartLcn;
LONGLONG Mft2StartLcn;
LONGLONG MftZoneStart;
LONGLONG MftZoneEnd;
} NTFS_VOLUME_DATA_BUFFER;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NTFS_VOLUME_DATA_BUFFER
{
public long VolumeSerialNumber;
public long NumberSectors;
public long TotalClusters;
public long FreeClusters;
public long TotalReserved;
public uint BytesPerSector;
public uint BytesPerCluster;
public uint BytesPerFileRecordSegment;
public uint ClustersPerFileRecordSegment;
public long MftValidDataLength;
public long MftStartLcn;
public long Mft2StartLcn;
public long MftZoneStart;
public long MftZoneEnd;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NTFS_VOLUME_DATA_BUFFER
Public VolumeSerialNumber As Long
Public NumberSectors As Long
Public TotalClusters As Long
Public FreeClusters As Long
Public TotalReserved As Long
Public BytesPerSector As UInteger
Public BytesPerCluster As UInteger
Public BytesPerFileRecordSegment As UInteger
Public ClustersPerFileRecordSegment As UInteger
Public MftValidDataLength As Long
Public MftStartLcn As Long
Public Mft2StartLcn As Long
Public MftZoneStart As Long
Public MftZoneEnd As Long
End Structureimport ctypes
from ctypes import wintypes
class NTFS_VOLUME_DATA_BUFFER(ctypes.Structure):
_fields_ = [
("VolumeSerialNumber", ctypes.c_longlong),
("NumberSectors", ctypes.c_longlong),
("TotalClusters", ctypes.c_longlong),
("FreeClusters", ctypes.c_longlong),
("TotalReserved", ctypes.c_longlong),
("BytesPerSector", wintypes.DWORD),
("BytesPerCluster", wintypes.DWORD),
("BytesPerFileRecordSegment", wintypes.DWORD),
("ClustersPerFileRecordSegment", wintypes.DWORD),
("MftValidDataLength", ctypes.c_longlong),
("MftStartLcn", ctypes.c_longlong),
("Mft2StartLcn", ctypes.c_longlong),
("MftZoneStart", ctypes.c_longlong),
("MftZoneEnd", ctypes.c_longlong),
]#[repr(C)]
pub struct NTFS_VOLUME_DATA_BUFFER {
pub VolumeSerialNumber: i64,
pub NumberSectors: i64,
pub TotalClusters: i64,
pub FreeClusters: i64,
pub TotalReserved: i64,
pub BytesPerSector: u32,
pub BytesPerCluster: u32,
pub BytesPerFileRecordSegment: u32,
pub ClustersPerFileRecordSegment: u32,
pub MftValidDataLength: i64,
pub MftStartLcn: i64,
pub Mft2StartLcn: i64,
pub MftZoneStart: i64,
pub MftZoneEnd: i64,
}import "golang.org/x/sys/windows"
type NTFS_VOLUME_DATA_BUFFER struct {
VolumeSerialNumber int64
NumberSectors int64
TotalClusters int64
FreeClusters int64
TotalReserved int64
BytesPerSector uint32
BytesPerCluster uint32
BytesPerFileRecordSegment uint32
ClustersPerFileRecordSegment uint32
MftValidDataLength int64
MftStartLcn int64
Mft2StartLcn int64
MftZoneStart int64
MftZoneEnd int64
}type
NTFS_VOLUME_DATA_BUFFER = record
VolumeSerialNumber: Int64;
NumberSectors: Int64;
TotalClusters: Int64;
FreeClusters: Int64;
TotalReserved: Int64;
BytesPerSector: DWORD;
BytesPerCluster: DWORD;
BytesPerFileRecordSegment: DWORD;
ClustersPerFileRecordSegment: DWORD;
MftValidDataLength: Int64;
MftStartLcn: Int64;
Mft2StartLcn: Int64;
MftZoneStart: Int64;
MftZoneEnd: Int64;
end;const NTFS_VOLUME_DATA_BUFFER = extern struct {
VolumeSerialNumber: i64,
NumberSectors: i64,
TotalClusters: i64,
FreeClusters: i64,
TotalReserved: i64,
BytesPerSector: u32,
BytesPerCluster: u32,
BytesPerFileRecordSegment: u32,
ClustersPerFileRecordSegment: u32,
MftValidDataLength: i64,
MftStartLcn: i64,
Mft2StartLcn: i64,
MftZoneStart: i64,
MftZoneEnd: i64,
};type
NTFS_VOLUME_DATA_BUFFER {.bycopy.} = object
VolumeSerialNumber: int64
NumberSectors: int64
TotalClusters: int64
FreeClusters: int64
TotalReserved: int64
BytesPerSector: uint32
BytesPerCluster: uint32
BytesPerFileRecordSegment: uint32
ClustersPerFileRecordSegment: uint32
MftValidDataLength: int64
MftStartLcn: int64
Mft2StartLcn: int64
MftZoneStart: int64
MftZoneEnd: int64struct NTFS_VOLUME_DATA_BUFFER
{
long VolumeSerialNumber;
long NumberSectors;
long TotalClusters;
long FreeClusters;
long TotalReserved;
uint BytesPerSector;
uint BytesPerCluster;
uint BytesPerFileRecordSegment;
uint ClustersPerFileRecordSegment;
long MftValidDataLength;
long MftStartLcn;
long Mft2StartLcn;
long MftZoneStart;
long MftZoneEnd;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NTFS_VOLUME_DATA_BUFFER サイズ: 96 バイト(x64)
dim st, 24 ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; VolumeSerialNumber : LONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; NumberSectors : LONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; TotalClusters : LONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; FreeClusters : LONGLONG (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; TotalReserved : LONGLONG (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; BytesPerSector : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; BytesPerCluster : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; BytesPerFileRecordSegment : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; ClustersPerFileRecordSegment : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; MftValidDataLength : LONGLONG (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; MftStartLcn : LONGLONG (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; Mft2StartLcn : LONGLONG (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; MftZoneStart : LONGLONG (+80, 8byte) qpoke st,80,値 / qpeek(st,80) ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; MftZoneEnd : LONGLONG (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NTFS_VOLUME_DATA_BUFFER
#field int64 VolumeSerialNumber
#field int64 NumberSectors
#field int64 TotalClusters
#field int64 FreeClusters
#field int64 TotalReserved
#field int BytesPerSector
#field int BytesPerCluster
#field int BytesPerFileRecordSegment
#field int ClustersPerFileRecordSegment
#field int64 MftValidDataLength
#field int64 MftStartLcn
#field int64 Mft2StartLcn
#field int64 MftZoneStart
#field int64 MftZoneEnd
#endstruct
stdim st, NTFS_VOLUME_DATA_BUFFER ; NSTRUCT 変数を確保
st->VolumeSerialNumber = 100
mes "VolumeSerialNumber=" + st->VolumeSerialNumber