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

NVMEOF_AUTH_DHCHAP_SUCCESS2

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

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

フィールド

フィールドサイズx64x86説明
AUTH_TYPEBYTE1+0+0認証タイプ(Authentication Type)を表す8ビット値である。
AUTH_IDBYTE1+1+1認証手順の識別子(Authentication Protocol ID)を表す8ビット値である。
Reserved0WORD2+2+2将来の拡張用に予約された16ビットフィールドである。
T_IDWORD2+4+4認証トランザクション識別子(Transaction ID)を表す16ビット値である。
Reserved1BYTE10+6+6将来の拡張用に予約された未使用バイト列である。

各言語での定義

#include <windows.h>

// NVMEOF_AUTH_DHCHAP_SUCCESS2  (x64 16 / x86 16 バイト)
typedef struct NVMEOF_AUTH_DHCHAP_SUCCESS2 {
    BYTE AUTH_TYPE;
    BYTE AUTH_ID;
    WORD Reserved0;
    WORD T_ID;
    BYTE Reserved1[10];
} NVMEOF_AUTH_DHCHAP_SUCCESS2;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVMEOF_AUTH_DHCHAP_SUCCESS2
{
    public byte AUTH_TYPE;
    public byte AUTH_ID;
    public ushort Reserved0;
    public ushort T_ID;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public byte[] Reserved1;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVMEOF_AUTH_DHCHAP_SUCCESS2
    Public AUTH_TYPE As Byte
    Public AUTH_ID As Byte
    Public Reserved0 As UShort
    Public T_ID As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> Public Reserved1() As Byte
End Structure
import ctypes
from ctypes import wintypes

class NVMEOF_AUTH_DHCHAP_SUCCESS2(ctypes.Structure):
    _fields_ = [
        ("AUTH_TYPE", ctypes.c_ubyte),
        ("AUTH_ID", ctypes.c_ubyte),
        ("Reserved0", ctypes.c_ushort),
        ("T_ID", ctypes.c_ushort),
        ("Reserved1", ctypes.c_ubyte * 10),
    ]
#[repr(C)]
pub struct NVMEOF_AUTH_DHCHAP_SUCCESS2 {
    pub AUTH_TYPE: u8,
    pub AUTH_ID: u8,
    pub Reserved0: u16,
    pub T_ID: u16,
    pub Reserved1: [u8; 10],
}
import "golang.org/x/sys/windows"

type NVMEOF_AUTH_DHCHAP_SUCCESS2 struct {
	AUTH_TYPE byte
	AUTH_ID byte
	Reserved0 uint16
	T_ID uint16
	Reserved1 [10]byte
}
type
  NVMEOF_AUTH_DHCHAP_SUCCESS2 = record
    AUTH_TYPE: Byte;
    AUTH_ID: Byte;
    Reserved0: Word;
    T_ID: Word;
    Reserved1: array[0..9] of Byte;
  end;
const NVMEOF_AUTH_DHCHAP_SUCCESS2 = extern struct {
    AUTH_TYPE: u8,
    AUTH_ID: u8,
    Reserved0: u16,
    T_ID: u16,
    Reserved1: [10]u8,
};
type
  NVMEOF_AUTH_DHCHAP_SUCCESS2 {.bycopy.} = object
    AUTH_TYPE: uint8
    AUTH_ID: uint8
    Reserved0: uint16
    T_ID: uint16
    Reserved1: array[10, uint8]
struct NVMEOF_AUTH_DHCHAP_SUCCESS2
{
    ubyte AUTH_TYPE;
    ubyte AUTH_ID;
    ushort Reserved0;
    ushort T_ID;
    ubyte[10] Reserved1;
}

HSP用 定義

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

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

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