ホーム › System.Ioctl › DISK_CACHE_INFORMATION
DISK_CACHE_INFORMATION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ParametersSavable | BOOLEAN | 1 | +0 | +0 | キャッシュ設定をデバイスに保存できるかを示す真偽値。 |
| ReadCacheEnabled | BOOLEAN | 1 | +1 | +1 | 読み取りキャッシュが有効かどうかを示す真偽値。 |
| WriteCacheEnabled | BOOLEAN | 1 | +2 | +2 | 書き込みキャッシュが有効かどうかを示す真偽値。 |
| ReadRetentionPriority | DISK_CACHE_RETENTION_PRIORITY | 4 | +4 | +4 | 読み取りデータのキャッシュ保持優先度を示す列挙値。 |
| WriteRetentionPriority | DISK_CACHE_RETENTION_PRIORITY | 4 | +8 | +8 | 書き込みデータのキャッシュ保持優先度を示す列挙値。 |
| DisablePrefetchTransferLength | WORD | 2 | +12 | +12 | プリフェッチを無効化する転送長のしきい値。 |
| PrefetchScalar | BOOLEAN | 1 | +14 | +14 | プリフェッチ量がスカラー指定かどうかを示す真偽値。 |
| Anonymous | _Anonymous_e__Union | 8/4 | +16 | +16 | スカラー/ブロック別のプリフェッチパラメータを保持する共用体。 |
共用体: _Anonymous_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| ScalarPrefetch | _ScalarPrefetch_e__Struct | 8/4 | +0 | +0 |
| BlockPrefetch | _BlockPrefetch_e__Struct | 8/4 | +0 | +0 |
各言語での定義
#include <windows.h>
// DISK_CACHE_INFORMATION (x64 24 / x86 20 バイト)
typedef struct DISK_CACHE_INFORMATION {
BOOLEAN ParametersSavable;
BOOLEAN ReadCacheEnabled;
BOOLEAN WriteCacheEnabled;
DISK_CACHE_RETENTION_PRIORITY ReadRetentionPriority;
DISK_CACHE_RETENTION_PRIORITY WriteRetentionPriority;
WORD DisablePrefetchTransferLength;
BOOLEAN PrefetchScalar;
_Anonymous_e__Union Anonymous;
} DISK_CACHE_INFORMATION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DISK_CACHE_INFORMATION
{
[MarshalAs(UnmanagedType.U1)] public bool ParametersSavable;
[MarshalAs(UnmanagedType.U1)] public bool ReadCacheEnabled;
[MarshalAs(UnmanagedType.U1)] public bool WriteCacheEnabled;
public int ReadRetentionPriority;
public int WriteRetentionPriority;
public ushort DisablePrefetchTransferLength;
[MarshalAs(UnmanagedType.U1)] public bool PrefetchScalar;
public _Anonymous_e__Union Anonymous;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DISK_CACHE_INFORMATION
<MarshalAs(UnmanagedType.U1)> Public ParametersSavable As Boolean
<MarshalAs(UnmanagedType.U1)> Public ReadCacheEnabled As Boolean
<MarshalAs(UnmanagedType.U1)> Public WriteCacheEnabled As Boolean
Public ReadRetentionPriority As Integer
Public WriteRetentionPriority As Integer
Public DisablePrefetchTransferLength As UShort
<MarshalAs(UnmanagedType.U1)> Public PrefetchScalar As Boolean
Public Anonymous As _Anonymous_e__Union
End Structureimport ctypes
from ctypes import wintypes
class DISK_CACHE_INFORMATION(ctypes.Structure):
_fields_ = [
("ParametersSavable", ctypes.c_byte),
("ReadCacheEnabled", ctypes.c_byte),
("WriteCacheEnabled", ctypes.c_byte),
("ReadRetentionPriority", ctypes.c_int),
("WriteRetentionPriority", ctypes.c_int),
("DisablePrefetchTransferLength", ctypes.c_ushort),
("PrefetchScalar", ctypes.c_byte),
("Anonymous", _Anonymous_e__Union),
]#[repr(C)]
pub struct DISK_CACHE_INFORMATION {
pub ParametersSavable: u8,
pub ReadCacheEnabled: u8,
pub WriteCacheEnabled: u8,
pub ReadRetentionPriority: i32,
pub WriteRetentionPriority: i32,
pub DisablePrefetchTransferLength: u16,
pub PrefetchScalar: u8,
pub Anonymous: _Anonymous_e__Union,
}import "golang.org/x/sys/windows"
type DISK_CACHE_INFORMATION struct {
ParametersSavable byte
ReadCacheEnabled byte
WriteCacheEnabled byte
ReadRetentionPriority int32
WriteRetentionPriority int32
DisablePrefetchTransferLength uint16
PrefetchScalar byte
Anonymous _Anonymous_e__Union
}type
DISK_CACHE_INFORMATION = record
ParametersSavable: ByteBool;
ReadCacheEnabled: ByteBool;
WriteCacheEnabled: ByteBool;
ReadRetentionPriority: Integer;
WriteRetentionPriority: Integer;
DisablePrefetchTransferLength: Word;
PrefetchScalar: ByteBool;
Anonymous: _Anonymous_e__Union;
end;const DISK_CACHE_INFORMATION = extern struct {
ParametersSavable: u8,
ReadCacheEnabled: u8,
WriteCacheEnabled: u8,
ReadRetentionPriority: i32,
WriteRetentionPriority: i32,
DisablePrefetchTransferLength: u16,
PrefetchScalar: u8,
Anonymous: _Anonymous_e__Union,
};type
DISK_CACHE_INFORMATION {.bycopy.} = object
ParametersSavable: uint8
ReadCacheEnabled: uint8
WriteCacheEnabled: uint8
ReadRetentionPriority: int32
WriteRetentionPriority: int32
DisablePrefetchTransferLength: uint16
PrefetchScalar: uint8
Anonymous: _Anonymous_e__Unionstruct DISK_CACHE_INFORMATION
{
ubyte ParametersSavable;
ubyte ReadCacheEnabled;
ubyte WriteCacheEnabled;
int ReadRetentionPriority;
int WriteRetentionPriority;
ushort DisablePrefetchTransferLength;
ubyte PrefetchScalar;
_Anonymous_e__Union Anonymous;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DISK_CACHE_INFORMATION サイズ: 20 バイト(x86)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; ParametersSavable : BOOLEAN (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; ReadCacheEnabled : BOOLEAN (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; WriteCacheEnabled : BOOLEAN (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; ReadRetentionPriority : DISK_CACHE_RETENTION_PRIORITY (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; WriteRetentionPriority : DISK_CACHE_RETENTION_PRIORITY (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; DisablePrefetchTransferLength : WORD (+12, 2byte) wpoke st,12,値 / 値 = wpeek(st,12)
; PrefetchScalar : BOOLEAN (+14, 1byte) poke st,14,値 / 値 = peek(st,14)
; Anonymous : _Anonymous_e__Union (+16, 4byte) varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DISK_CACHE_INFORMATION サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; ParametersSavable : BOOLEAN (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; ReadCacheEnabled : BOOLEAN (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; WriteCacheEnabled : BOOLEAN (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; ReadRetentionPriority : DISK_CACHE_RETENTION_PRIORITY (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; WriteRetentionPriority : DISK_CACHE_RETENTION_PRIORITY (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; DisablePrefetchTransferLength : WORD (+12, 2byte) wpoke st,12,値 / 値 = wpeek(st,12)
; PrefetchScalar : BOOLEAN (+14, 1byte) poke st,14,値 / 値 = peek(st,14)
; Anonymous : _Anonymous_e__Union (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DISK_CACHE_INFORMATION
#field bool1 ParametersSavable
#field bool1 ReadCacheEnabled
#field bool1 WriteCacheEnabled
#field int ReadRetentionPriority
#field int WriteRetentionPriority
#field short DisablePrefetchTransferLength
#field bool1 PrefetchScalar
#field byte Anonymous 8
#endstruct
stdim st, DISK_CACHE_INFORMATION ; NSTRUCT 変数を確保
st->ParametersSavable = 100
mes "ParametersSavable=" + st->ParametersSavable
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。