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

NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG

構造体
サイズx64: 4096 バイト / x86: 4096 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
UnsupportedCountWORD2+0+0サポートされていない要件の個数。
Reserved0BYTE14+2+2予約領域。将来拡張用で0とする。
UnsupportedReqListUNSUPPORTED_REQUIREMENT4048+16+16サポートされていない要件IDの配列。
Reserved1BYTE14+4064+4064予約領域。将来拡張用で0とする。
LogPageVersionNumberWORD2+4078+4078このログページの版数。
LogPageGUIDGUID16+4080+4080ログページを識別する16バイトGUID。

各言語での定義

#include <windows.h>

// UNSUPPORTED_REQUIREMENT  (x64 16 / x86 16 バイト)
typedef struct UNSUPPORTED_REQUIREMENT {
    BYTE ReqId[16];
} UNSUPPORTED_REQUIREMENT;

// NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG  (x64 4096 / x86 4096 バイト)
#pragma pack(push, 1)
typedef struct NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG {
    WORD UnsupportedCount;
    BYTE Reserved0[14];
    UNSUPPORTED_REQUIREMENT UnsupportedReqList[253];
    BYTE Reserved1[14];
    WORD LogPageVersionNumber;
    GUID LogPageGUID;
} NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct UNSUPPORTED_REQUIREMENT
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] ReqId;
}

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG
{
    public ushort UnsupportedCount;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] Reserved0;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 253)] public UNSUPPORTED_REQUIREMENT[] UnsupportedReqList;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] Reserved1;
    public ushort LogPageVersionNumber;
    public Guid LogPageGUID;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure UNSUPPORTED_REQUIREMENT
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public ReqId() As Byte
End Structure

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG
    Public UnsupportedCount As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=14)> Public Reserved0() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=253)> Public UnsupportedReqList() As UNSUPPORTED_REQUIREMENT
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=14)> Public Reserved1() As Byte
    Public LogPageVersionNumber As UShort
    Public LogPageGUID As Guid
End Structure
import ctypes
from ctypes import wintypes

class UNSUPPORTED_REQUIREMENT(ctypes.Structure):
    _fields_ = [
        ("ReqId", ctypes.c_ubyte * 16),
    ]

class NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("UnsupportedCount", ctypes.c_ushort),
        ("Reserved0", ctypes.c_ubyte * 14),
        ("UnsupportedReqList", UNSUPPORTED_REQUIREMENT * 253),
        ("Reserved1", ctypes.c_ubyte * 14),
        ("LogPageVersionNumber", ctypes.c_ushort),
        ("LogPageGUID", GUID),
    ]
#[repr(C)]
pub struct UNSUPPORTED_REQUIREMENT {
    pub ReqId: [u8; 16],
}

#[repr(C, packed(1))]
pub struct NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG {
    pub UnsupportedCount: u16,
    pub Reserved0: [u8; 14],
    pub UnsupportedReqList: [UNSUPPORTED_REQUIREMENT; 253],
    pub Reserved1: [u8; 14],
    pub LogPageVersionNumber: u16,
    pub LogPageGUID: GUID,
}
import "golang.org/x/sys/windows"

type UNSUPPORTED_REQUIREMENT struct {
	ReqId [16]byte
}

type NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG struct {
	UnsupportedCount uint16
	Reserved0 [14]byte
	UnsupportedReqList [253]UNSUPPORTED_REQUIREMENT
	Reserved1 [14]byte
	LogPageVersionNumber uint16
	LogPageGUID windows.GUID
}
type
  UNSUPPORTED_REQUIREMENT = record
    ReqId: array[0..15] of Byte;
  end;

  NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG = packed record
    UnsupportedCount: Word;
    Reserved0: array[0..13] of Byte;
    UnsupportedReqList: array[0..252] of UNSUPPORTED_REQUIREMENT;
    Reserved1: array[0..13] of Byte;
    LogPageVersionNumber: Word;
    LogPageGUID: TGUID;
  end;
const UNSUPPORTED_REQUIREMENT = extern struct {
    ReqId: [16]u8,
};

const NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG = extern struct {
    UnsupportedCount: u16,
    Reserved0: [14]u8,
    UnsupportedReqList: [253]UNSUPPORTED_REQUIREMENT,
    Reserved1: [14]u8,
    LogPageVersionNumber: u16,
    LogPageGUID: GUID,
};
type
  UNSUPPORTED_REQUIREMENT {.bycopy.} = object
    ReqId: array[16, uint8]

  NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG {.packed.} = object
    UnsupportedCount: uint16
    Reserved0: array[14, uint8]
    UnsupportedReqList: array[253, UNSUPPORTED_REQUIREMENT]
    Reserved1: array[14, uint8]
    LogPageVersionNumber: uint16
    LogPageGUID: GUID
struct UNSUPPORTED_REQUIREMENT
{
    ubyte[16] ReqId;
}

align(1)
struct NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG
{
    ushort UnsupportedCount;
    ubyte[14] Reserved0;
    UNSUPPORTED_REQUIREMENT[253] UnsupportedReqList;
    ubyte[14] Reserved1;
    ushort LogPageVersionNumber;
    GUID LogPageGUID;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG サイズ: 4096 バイト(x64)
dim st, 1024    ; 4byte整数×1024(構造体サイズ 4096 / 4 切り上げ)
; UnsupportedCount : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Reserved0 : BYTE (+2, 14byte)  varptr(st)+2 を基点に操作(14byte:入れ子/配列)
; UnsupportedReqList : UNSUPPORTED_REQUIREMENT (+16, 4048byte)  varptr(st)+16 を基点に操作(4048byte:入れ子/配列)
; Reserved1 : BYTE (+4064, 14byte)  varptr(st)+4064 を基点に操作(14byte:入れ子/配列)
; LogPageVersionNumber : WORD (+4078, 2byte)  wpoke st,4078,値  /  値 = wpeek(st,4078)
; LogPageGUID : GUID (+4080, 16byte)  varptr(st)+4080 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global UNSUPPORTED_REQUIREMENT
    #field byte ReqId 16
#endstruct

#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global NVME_OCP_DEVICE_UNSUPPORTED_REQUIREMENTS_LOG, pack=1
    #field short UnsupportedCount
    #field byte Reserved0 14
    #field UNSUPPORTED_REQUIREMENT UnsupportedReqList 253
    #field byte Reserved1 14
    #field short LogPageVersionNumber
    #field GUID LogPageGUID
#endstruct

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