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

NVME_COMPLETION_ENTRY

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

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

フィールド

フィールドサイズx64x86説明
DW0DWORD4+0+0完了エントリのDword 0。コマンド固有の戻り値を格納する。
DW1DWORD4+4+4完了エントリのDword 1。コマンド固有の戻り値を格納する。
DW2_DW2_e__Union8/4+8+8完了エントリのDword 2。SQヘッドポインタとSQ識別子を保持する共用体。
DW3_DW3_e__Union8/4+16+12完了エントリのDword 3。コマンド識別子・フェーズタグ・ステータスを保持する共用体。

共用体: _DW2_e__Union x64 8B / x86 4B

フィールドサイズx64x86
Anonymous_Anonymous_e__Struct8/4+0+0
AsUlongDWORD4+0+0

共用体: _DW3_e__Union x64 8B / x86 4B

フィールドサイズx64x86
Anonymous_Anonymous_e__Struct8/4+0+0
AsUlongDWORD4+0+0

各言語での定義

#include <windows.h>

// NVME_COMPLETION_ENTRY  (x64 24 / x86 16 バイト)
typedef struct NVME_COMPLETION_ENTRY {
    DWORD DW0;
    DWORD DW1;
    _DW2_e__Union DW2;
    _DW3_e__Union DW3;
} NVME_COMPLETION_ENTRY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_COMPLETION_ENTRY
{
    public uint DW0;
    public uint DW1;
    public _DW2_e__Union DW2;
    public _DW3_e__Union DW3;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_COMPLETION_ENTRY
    Public DW0 As UInteger
    Public DW1 As UInteger
    Public DW2 As _DW2_e__Union
    Public DW3 As _DW3_e__Union
End Structure
import ctypes
from ctypes import wintypes

class NVME_COMPLETION_ENTRY(ctypes.Structure):
    _fields_ = [
        ("DW0", wintypes.DWORD),
        ("DW1", wintypes.DWORD),
        ("DW2", _DW2_e__Union),
        ("DW3", _DW3_e__Union),
    ]
#[repr(C)]
pub struct NVME_COMPLETION_ENTRY {
    pub DW0: u32,
    pub DW1: u32,
    pub DW2: _DW2_e__Union,
    pub DW3: _DW3_e__Union,
}
import "golang.org/x/sys/windows"

type NVME_COMPLETION_ENTRY struct {
	DW0 uint32
	DW1 uint32
	DW2 _DW2_e__Union
	DW3 _DW3_e__Union
}
type
  NVME_COMPLETION_ENTRY = record
    DW0: DWORD;
    DW1: DWORD;
    DW2: _DW2_e__Union;
    DW3: _DW3_e__Union;
  end;
const NVME_COMPLETION_ENTRY = extern struct {
    DW0: u32,
    DW1: u32,
    DW2: _DW2_e__Union,
    DW3: _DW3_e__Union,
};
type
  NVME_COMPLETION_ENTRY {.bycopy.} = object
    DW0: uint32
    DW1: uint32
    DW2: _DW2_e__Union
    DW3: _DW3_e__Union
struct NVME_COMPLETION_ENTRY
{
    uint DW0;
    uint DW1;
    _DW2_e__Union DW2;
    _DW3_e__Union DW3;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NVME_COMPLETION_ENTRY サイズ: 16 バイト(x86)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; DW0 : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; DW1 : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; DW2 : _DW2_e__Union (+8, 4byte)  varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; DW3 : _DW3_e__Union (+12, 4byte)  varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVME_COMPLETION_ENTRY サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; DW0 : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; DW1 : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; DW2 : _DW2_e__Union (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; DW3 : _DW3_e__Union (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NVME_COMPLETION_ENTRY
    #field int DW0
    #field int DW1
    #field byte DW2 8
    #field byte DW3 8
#endstruct

stdim st, NVME_COMPLETION_ENTRY        ; NSTRUCT 変数を確保
st->DW0 = 100
mes "DW0=" + st->DW0
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。