ホーム › Storage.IscsiDisc › NVCACHE_HINT_PAYLOAD
NVCACHE_HINT_PAYLOAD
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Command | BYTE | 1 | +0 | +0 | ATAコマンドコード。 |
| Feature7_0 | BYTE | 1 | +1 | +1 | Featureレジスタの下位8ビット(ビット7..0)。 |
| Feature15_8 | BYTE | 1 | +2 | +2 | Featureレジスタの上位8ビット(ビット15..8)。 |
| Count15_8 | BYTE | 1 | +3 | +3 | Countレジスタの上位8ビット(ビット15..8)。 |
| LBA7_0 | BYTE | 1 | +4 | +4 | LBAのビット7..0。 |
| LBA15_8 | BYTE | 1 | +5 | +5 | LBAのビット15..8。 |
| LBA23_16 | BYTE | 1 | +6 | +6 | LBAのビット23..16。 |
| LBA31_24 | BYTE | 1 | +7 | +7 | LBAのビット31..24。 |
| LBA39_32 | BYTE | 1 | +8 | +8 | LBAのビット39..32。 |
| LBA47_40 | BYTE | 1 | +9 | +9 | LBAのビット47..40。 |
| Auxiliary7_0 | BYTE | 1 | +10 | +10 | Auxiliaryレジスタのビット7..0。 |
| Auxiliary23_16 | BYTE | 1 | +11 | +11 | Auxiliaryレジスタのビット23..16。 |
| Reserved | BYTE | 4 | +12 | +12 | 予約フィールド。0を設定する。 |
各言語での定義
#include <windows.h>
// NVCACHE_HINT_PAYLOAD (x64 16 / x86 16 バイト)
typedef struct NVCACHE_HINT_PAYLOAD {
BYTE Command;
BYTE Feature7_0;
BYTE Feature15_8;
BYTE Count15_8;
BYTE LBA7_0;
BYTE LBA15_8;
BYTE LBA23_16;
BYTE LBA31_24;
BYTE LBA39_32;
BYTE LBA47_40;
BYTE Auxiliary7_0;
BYTE Auxiliary23_16;
BYTE Reserved[4];
} NVCACHE_HINT_PAYLOAD;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVCACHE_HINT_PAYLOAD
{
public byte Command;
public byte Feature7_0;
public byte Feature15_8;
public byte Count15_8;
public byte LBA7_0;
public byte LBA15_8;
public byte LBA23_16;
public byte LBA31_24;
public byte LBA39_32;
public byte LBA47_40;
public byte Auxiliary7_0;
public byte Auxiliary23_16;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] Reserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVCACHE_HINT_PAYLOAD
Public Command As Byte
Public Feature7_0 As Byte
Public Feature15_8 As Byte
Public Count15_8 As Byte
Public LBA7_0 As Byte
Public LBA15_8 As Byte
Public LBA23_16 As Byte
Public LBA31_24 As Byte
Public LBA39_32 As Byte
Public LBA47_40 As Byte
Public Auxiliary7_0 As Byte
Public Auxiliary23_16 As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public Reserved() As Byte
End Structureimport ctypes
from ctypes import wintypes
class NVCACHE_HINT_PAYLOAD(ctypes.Structure):
_fields_ = [
("Command", ctypes.c_ubyte),
("Feature7_0", ctypes.c_ubyte),
("Feature15_8", ctypes.c_ubyte),
("Count15_8", ctypes.c_ubyte),
("LBA7_0", ctypes.c_ubyte),
("LBA15_8", ctypes.c_ubyte),
("LBA23_16", ctypes.c_ubyte),
("LBA31_24", ctypes.c_ubyte),
("LBA39_32", ctypes.c_ubyte),
("LBA47_40", ctypes.c_ubyte),
("Auxiliary7_0", ctypes.c_ubyte),
("Auxiliary23_16", ctypes.c_ubyte),
("Reserved", ctypes.c_ubyte * 4),
]#[repr(C)]
pub struct NVCACHE_HINT_PAYLOAD {
pub Command: u8,
pub Feature7_0: u8,
pub Feature15_8: u8,
pub Count15_8: u8,
pub LBA7_0: u8,
pub LBA15_8: u8,
pub LBA23_16: u8,
pub LBA31_24: u8,
pub LBA39_32: u8,
pub LBA47_40: u8,
pub Auxiliary7_0: u8,
pub Auxiliary23_16: u8,
pub Reserved: [u8; 4],
}import "golang.org/x/sys/windows"
type NVCACHE_HINT_PAYLOAD struct {
Command byte
Feature7_0 byte
Feature15_8 byte
Count15_8 byte
LBA7_0 byte
LBA15_8 byte
LBA23_16 byte
LBA31_24 byte
LBA39_32 byte
LBA47_40 byte
Auxiliary7_0 byte
Auxiliary23_16 byte
Reserved [4]byte
}type
NVCACHE_HINT_PAYLOAD = record
Command: Byte;
Feature7_0: Byte;
Feature15_8: Byte;
Count15_8: Byte;
LBA7_0: Byte;
LBA15_8: Byte;
LBA23_16: Byte;
LBA31_24: Byte;
LBA39_32: Byte;
LBA47_40: Byte;
Auxiliary7_0: Byte;
Auxiliary23_16: Byte;
Reserved: array[0..3] of Byte;
end;const NVCACHE_HINT_PAYLOAD = extern struct {
Command: u8,
Feature7_0: u8,
Feature15_8: u8,
Count15_8: u8,
LBA7_0: u8,
LBA15_8: u8,
LBA23_16: u8,
LBA31_24: u8,
LBA39_32: u8,
LBA47_40: u8,
Auxiliary7_0: u8,
Auxiliary23_16: u8,
Reserved: [4]u8,
};type
NVCACHE_HINT_PAYLOAD {.bycopy.} = object
Command: uint8
Feature7_0: uint8
Feature15_8: uint8
Count15_8: uint8
LBA7_0: uint8
LBA15_8: uint8
LBA23_16: uint8
LBA31_24: uint8
LBA39_32: uint8
LBA47_40: uint8
Auxiliary7_0: uint8
Auxiliary23_16: uint8
Reserved: array[4, uint8]struct NVCACHE_HINT_PAYLOAD
{
ubyte Command;
ubyte Feature7_0;
ubyte Feature15_8;
ubyte Count15_8;
ubyte LBA7_0;
ubyte LBA15_8;
ubyte LBA23_16;
ubyte LBA31_24;
ubyte LBA39_32;
ubyte LBA47_40;
ubyte Auxiliary7_0;
ubyte Auxiliary23_16;
ubyte[4] Reserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVCACHE_HINT_PAYLOAD サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Command : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; Feature7_0 : BYTE (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; Feature15_8 : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; Count15_8 : BYTE (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; LBA7_0 : BYTE (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; LBA15_8 : BYTE (+5, 1byte) poke st,5,値 / 値 = peek(st,5)
; LBA23_16 : BYTE (+6, 1byte) poke st,6,値 / 値 = peek(st,6)
; LBA31_24 : BYTE (+7, 1byte) poke st,7,値 / 値 = peek(st,7)
; LBA39_32 : BYTE (+8, 1byte) poke st,8,値 / 値 = peek(st,8)
; LBA47_40 : BYTE (+9, 1byte) poke st,9,値 / 値 = peek(st,9)
; Auxiliary7_0 : BYTE (+10, 1byte) poke st,10,値 / 値 = peek(st,10)
; Auxiliary23_16 : BYTE (+11, 1byte) poke st,11,値 / 値 = peek(st,11)
; Reserved : BYTE (+12, 4byte) varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NVCACHE_HINT_PAYLOAD
#field byte Command
#field byte Feature7_0
#field byte Feature15_8
#field byte Count15_8
#field byte LBA7_0
#field byte LBA15_8
#field byte LBA23_16
#field byte LBA31_24
#field byte LBA39_32
#field byte LBA47_40
#field byte Auxiliary7_0
#field byte Auxiliary23_16
#field byte Reserved 4
#endstruct
stdim st, NVCACHE_HINT_PAYLOAD ; NSTRUCT 変数を確保
st->Command = 100
mes "Command=" + st->Command