ホーム › Storage.Nvme › NVME_CONTROLLER_LIST
NVME_CONTROLLER_LIST
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| NumberOfIdentifiers | WORD | 2 | +0 | +0 | リスト内の有効なコントローラ識別子の個数。 |
| ControllerID | WORD | 4094 | +2 | +2 | コントローラ識別子の配列。昇順で格納される。 |
各言語での定義
#include <windows.h>
// NVME_CONTROLLER_LIST (x64 4096 / x86 4096 バイト)
typedef struct NVME_CONTROLLER_LIST {
WORD NumberOfIdentifiers;
WORD ControllerID[2047];
} NVME_CONTROLLER_LIST;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_CONTROLLER_LIST
{
public ushort NumberOfIdentifiers;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2047)] public ushort[] ControllerID;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_CONTROLLER_LIST
Public NumberOfIdentifiers As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2047)> Public ControllerID() As UShort
End Structureimport ctypes
from ctypes import wintypes
class NVME_CONTROLLER_LIST(ctypes.Structure):
_fields_ = [
("NumberOfIdentifiers", ctypes.c_ushort),
("ControllerID", ctypes.c_ushort * 2047),
]#[repr(C)]
pub struct NVME_CONTROLLER_LIST {
pub NumberOfIdentifiers: u16,
pub ControllerID: [u16; 2047],
}import "golang.org/x/sys/windows"
type NVME_CONTROLLER_LIST struct {
NumberOfIdentifiers uint16
ControllerID [2047]uint16
}type
NVME_CONTROLLER_LIST = record
NumberOfIdentifiers: Word;
ControllerID: array[0..2046] of Word;
end;const NVME_CONTROLLER_LIST = extern struct {
NumberOfIdentifiers: u16,
ControllerID: [2047]u16,
};type
NVME_CONTROLLER_LIST {.bycopy.} = object
NumberOfIdentifiers: uint16
ControllerID: array[2047, uint16]struct NVME_CONTROLLER_LIST
{
ushort NumberOfIdentifiers;
ushort[2047] ControllerID;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVME_CONTROLLER_LIST サイズ: 4096 バイト(x64)
dim st, 1024 ; 4byte整数×1024(構造体サイズ 4096 / 4 切り上げ)
; NumberOfIdentifiers : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; ControllerID : WORD (+2, 4094byte) varptr(st)+2 を基点に操作(4094byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NVME_CONTROLLER_LIST
#field short NumberOfIdentifiers
#field short ControllerID 2047
#endstruct
stdim st, NVME_CONTROLLER_LIST ; NSTRUCT 変数を確保
st->NumberOfIdentifiers = 100
mes "NumberOfIdentifiers=" + st->NumberOfIdentifiers