Win32 API 日本語リファレンス
ホームStorage.FileSystem › DISK_SPACE_INFORMATION

DISK_SPACE_INFORMATION

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

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

フィールド

フィールドサイズx64x86説明
ActualTotalAllocationUnitsULONGLONG8+0+0ボリュームの実際の総アロケーションユニット数。
ActualAvailableAllocationUnitsULONGLONG8+8+8実際に使用可能なアロケーションユニット数。
ActualPoolUnavailableAllocationUnitsULONGLONG8+16+16プール都合で使用不可な実アロケーションユニット数。
CallerTotalAllocationUnitsULONGLONG8+24+24呼び出し元視点での総アロケーションユニット数。
CallerAvailableAllocationUnitsULONGLONG8+32+32呼び出し元が使用可能なアロケーションユニット数。
CallerPoolUnavailableAllocationUnitsULONGLONG8+40+40呼び出し元視点でプール都合により使用不可なユニット数。
UsedAllocationUnitsULONGLONG8+48+48使用中のアロケーションユニット数。
TotalReservedAllocationUnitsULONGLONG8+56+56予約済みの総アロケーションユニット数。
VolumeStorageReserveAllocationUnitsULONGLONG8+64+64ストレージ予約に割り当てられたユニット数。
AvailableCommittedAllocationUnitsULONGLONG8+72+72コミット済みで利用可能なアロケーションユニット数。
PoolAvailableAllocationUnitsULONGLONG8+80+80プールで利用可能なアロケーションユニット数。
SectorsPerAllocationUnitDWORD4+88+881アロケーションユニットあたりのセクタ数。
BytesPerSectorDWORD4+92+921セクタあたりのバイト数。

各言語での定義

#include <windows.h>

// DISK_SPACE_INFORMATION  (x64 96 / x86 96 バイト)
typedef struct DISK_SPACE_INFORMATION {
    ULONGLONG ActualTotalAllocationUnits;
    ULONGLONG ActualAvailableAllocationUnits;
    ULONGLONG ActualPoolUnavailableAllocationUnits;
    ULONGLONG CallerTotalAllocationUnits;
    ULONGLONG CallerAvailableAllocationUnits;
    ULONGLONG CallerPoolUnavailableAllocationUnits;
    ULONGLONG UsedAllocationUnits;
    ULONGLONG TotalReservedAllocationUnits;
    ULONGLONG VolumeStorageReserveAllocationUnits;
    ULONGLONG AvailableCommittedAllocationUnits;
    ULONGLONG PoolAvailableAllocationUnits;
    DWORD SectorsPerAllocationUnit;
    DWORD BytesPerSector;
} DISK_SPACE_INFORMATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DISK_SPACE_INFORMATION
{
    public ulong ActualTotalAllocationUnits;
    public ulong ActualAvailableAllocationUnits;
    public ulong ActualPoolUnavailableAllocationUnits;
    public ulong CallerTotalAllocationUnits;
    public ulong CallerAvailableAllocationUnits;
    public ulong CallerPoolUnavailableAllocationUnits;
    public ulong UsedAllocationUnits;
    public ulong TotalReservedAllocationUnits;
    public ulong VolumeStorageReserveAllocationUnits;
    public ulong AvailableCommittedAllocationUnits;
    public ulong PoolAvailableAllocationUnits;
    public uint SectorsPerAllocationUnit;
    public uint BytesPerSector;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DISK_SPACE_INFORMATION
    Public ActualTotalAllocationUnits As ULong
    Public ActualAvailableAllocationUnits As ULong
    Public ActualPoolUnavailableAllocationUnits As ULong
    Public CallerTotalAllocationUnits As ULong
    Public CallerAvailableAllocationUnits As ULong
    Public CallerPoolUnavailableAllocationUnits As ULong
    Public UsedAllocationUnits As ULong
    Public TotalReservedAllocationUnits As ULong
    Public VolumeStorageReserveAllocationUnits As ULong
    Public AvailableCommittedAllocationUnits As ULong
    Public PoolAvailableAllocationUnits As ULong
    Public SectorsPerAllocationUnit As UInteger
    Public BytesPerSector As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DISK_SPACE_INFORMATION(ctypes.Structure):
    _fields_ = [
        ("ActualTotalAllocationUnits", ctypes.c_ulonglong),
        ("ActualAvailableAllocationUnits", ctypes.c_ulonglong),
        ("ActualPoolUnavailableAllocationUnits", ctypes.c_ulonglong),
        ("CallerTotalAllocationUnits", ctypes.c_ulonglong),
        ("CallerAvailableAllocationUnits", ctypes.c_ulonglong),
        ("CallerPoolUnavailableAllocationUnits", ctypes.c_ulonglong),
        ("UsedAllocationUnits", ctypes.c_ulonglong),
        ("TotalReservedAllocationUnits", ctypes.c_ulonglong),
        ("VolumeStorageReserveAllocationUnits", ctypes.c_ulonglong),
        ("AvailableCommittedAllocationUnits", ctypes.c_ulonglong),
        ("PoolAvailableAllocationUnits", ctypes.c_ulonglong),
        ("SectorsPerAllocationUnit", wintypes.DWORD),
        ("BytesPerSector", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DISK_SPACE_INFORMATION {
    pub ActualTotalAllocationUnits: u64,
    pub ActualAvailableAllocationUnits: u64,
    pub ActualPoolUnavailableAllocationUnits: u64,
    pub CallerTotalAllocationUnits: u64,
    pub CallerAvailableAllocationUnits: u64,
    pub CallerPoolUnavailableAllocationUnits: u64,
    pub UsedAllocationUnits: u64,
    pub TotalReservedAllocationUnits: u64,
    pub VolumeStorageReserveAllocationUnits: u64,
    pub AvailableCommittedAllocationUnits: u64,
    pub PoolAvailableAllocationUnits: u64,
    pub SectorsPerAllocationUnit: u32,
    pub BytesPerSector: u32,
}
import "golang.org/x/sys/windows"

type DISK_SPACE_INFORMATION struct {
	ActualTotalAllocationUnits uint64
	ActualAvailableAllocationUnits uint64
	ActualPoolUnavailableAllocationUnits uint64
	CallerTotalAllocationUnits uint64
	CallerAvailableAllocationUnits uint64
	CallerPoolUnavailableAllocationUnits uint64
	UsedAllocationUnits uint64
	TotalReservedAllocationUnits uint64
	VolumeStorageReserveAllocationUnits uint64
	AvailableCommittedAllocationUnits uint64
	PoolAvailableAllocationUnits uint64
	SectorsPerAllocationUnit uint32
	BytesPerSector uint32
}
type
  DISK_SPACE_INFORMATION = record
    ActualTotalAllocationUnits: UInt64;
    ActualAvailableAllocationUnits: UInt64;
    ActualPoolUnavailableAllocationUnits: UInt64;
    CallerTotalAllocationUnits: UInt64;
    CallerAvailableAllocationUnits: UInt64;
    CallerPoolUnavailableAllocationUnits: UInt64;
    UsedAllocationUnits: UInt64;
    TotalReservedAllocationUnits: UInt64;
    VolumeStorageReserveAllocationUnits: UInt64;
    AvailableCommittedAllocationUnits: UInt64;
    PoolAvailableAllocationUnits: UInt64;
    SectorsPerAllocationUnit: DWORD;
    BytesPerSector: DWORD;
  end;
const DISK_SPACE_INFORMATION = extern struct {
    ActualTotalAllocationUnits: u64,
    ActualAvailableAllocationUnits: u64,
    ActualPoolUnavailableAllocationUnits: u64,
    CallerTotalAllocationUnits: u64,
    CallerAvailableAllocationUnits: u64,
    CallerPoolUnavailableAllocationUnits: u64,
    UsedAllocationUnits: u64,
    TotalReservedAllocationUnits: u64,
    VolumeStorageReserveAllocationUnits: u64,
    AvailableCommittedAllocationUnits: u64,
    PoolAvailableAllocationUnits: u64,
    SectorsPerAllocationUnit: u32,
    BytesPerSector: u32,
};
type
  DISK_SPACE_INFORMATION {.bycopy.} = object
    ActualTotalAllocationUnits: uint64
    ActualAvailableAllocationUnits: uint64
    ActualPoolUnavailableAllocationUnits: uint64
    CallerTotalAllocationUnits: uint64
    CallerAvailableAllocationUnits: uint64
    CallerPoolUnavailableAllocationUnits: uint64
    UsedAllocationUnits: uint64
    TotalReservedAllocationUnits: uint64
    VolumeStorageReserveAllocationUnits: uint64
    AvailableCommittedAllocationUnits: uint64
    PoolAvailableAllocationUnits: uint64
    SectorsPerAllocationUnit: uint32
    BytesPerSector: uint32
struct DISK_SPACE_INFORMATION
{
    ulong ActualTotalAllocationUnits;
    ulong ActualAvailableAllocationUnits;
    ulong ActualPoolUnavailableAllocationUnits;
    ulong CallerTotalAllocationUnits;
    ulong CallerAvailableAllocationUnits;
    ulong CallerPoolUnavailableAllocationUnits;
    ulong UsedAllocationUnits;
    ulong TotalReservedAllocationUnits;
    ulong VolumeStorageReserveAllocationUnits;
    ulong AvailableCommittedAllocationUnits;
    ulong PoolAvailableAllocationUnits;
    uint SectorsPerAllocationUnit;
    uint BytesPerSector;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DISK_SPACE_INFORMATION サイズ: 96 バイト(x64)
dim st, 24    ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; ActualTotalAllocationUnits : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; ActualAvailableAllocationUnits : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ActualPoolUnavailableAllocationUnits : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; CallerTotalAllocationUnits : ULONGLONG (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; CallerAvailableAllocationUnits : ULONGLONG (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; CallerPoolUnavailableAllocationUnits : ULONGLONG (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; UsedAllocationUnits : ULONGLONG (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; TotalReservedAllocationUnits : ULONGLONG (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; VolumeStorageReserveAllocationUnits : ULONGLONG (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; AvailableCommittedAllocationUnits : ULONGLONG (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; PoolAvailableAllocationUnits : ULONGLONG (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; SectorsPerAllocationUnit : DWORD (+88, 4byte)  st.22 = 値  /  値 = st.22   (lpoke/lpeek も可)
; BytesPerSector : DWORD (+92, 4byte)  st.23 = 値  /  値 = st.23   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DISK_SPACE_INFORMATION
    #field int64 ActualTotalAllocationUnits
    #field int64 ActualAvailableAllocationUnits
    #field int64 ActualPoolUnavailableAllocationUnits
    #field int64 CallerTotalAllocationUnits
    #field int64 CallerAvailableAllocationUnits
    #field int64 CallerPoolUnavailableAllocationUnits
    #field int64 UsedAllocationUnits
    #field int64 TotalReservedAllocationUnits
    #field int64 VolumeStorageReserveAllocationUnits
    #field int64 AvailableCommittedAllocationUnits
    #field int64 PoolAvailableAllocationUnits
    #field int SectorsPerAllocationUnit
    #field int BytesPerSector
#endstruct

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