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

NVMEOF_AUTH_DHCHAP_SUCCESS1

構造体
サイズ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ビット値である。
HLBYTE1+6+6応答ハッシュ値の長さ(Hash Length)をバイト単位で表す8ビット値である。
Reserved1BYTE1+7+7将来の拡張用に予約された未使用バイトである。
RVALIDBYTE1+8+8双方向認証の応答値が含まれるか否かを示すフラグ(Response Valid)である。
Reserved2BYTE7+9+9将来の拡張用に予約された未使用バイトである。

各言語での定義

#include <windows.h>

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

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

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

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

type NVMEOF_AUTH_DHCHAP_SUCCESS1 struct {
	AUTH_TYPE byte
	AUTH_ID byte
	Reserved0 uint16
	T_ID uint16
	HL byte
	Reserved1 byte
	RVALID byte
	Reserved2 [7]byte
}
type
  NVMEOF_AUTH_DHCHAP_SUCCESS1 = record
    AUTH_TYPE: Byte;
    AUTH_ID: Byte;
    Reserved0: Word;
    T_ID: Word;
    HL: Byte;
    Reserved1: Byte;
    RVALID: Byte;
    Reserved2: array[0..6] of Byte;
  end;
const NVMEOF_AUTH_DHCHAP_SUCCESS1 = extern struct {
    AUTH_TYPE: u8,
    AUTH_ID: u8,
    Reserved0: u16,
    T_ID: u16,
    HL: u8,
    Reserved1: u8,
    RVALID: u8,
    Reserved2: [7]u8,
};
type
  NVMEOF_AUTH_DHCHAP_SUCCESS1 {.bycopy.} = object
    AUTH_TYPE: uint8
    AUTH_ID: uint8
    Reserved0: uint16
    T_ID: uint16
    HL: uint8
    Reserved1: uint8
    RVALID: uint8
    Reserved2: array[7, uint8]
struct NVMEOF_AUTH_DHCHAP_SUCCESS1
{
    ubyte AUTH_TYPE;
    ubyte AUTH_ID;
    ushort Reserved0;
    ushort T_ID;
    ubyte HL;
    ubyte Reserved1;
    ubyte RVALID;
    ubyte[7] Reserved2;
}

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_SUCCESS1 サイズ: 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)
; HL : BYTE (+6, 1byte)  poke st,6,値  /  値 = peek(st,6)
; Reserved1 : BYTE (+7, 1byte)  poke st,7,値  /  値 = peek(st,7)
; RVALID : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; Reserved2 : BYTE (+9, 7byte)  varptr(st)+9 を基点に操作(7byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NVMEOF_AUTH_DHCHAP_SUCCESS1
    #field byte AUTH_TYPE
    #field byte AUTH_ID
    #field short Reserved0
    #field short T_ID
    #field byte HL
    #field byte Reserved1
    #field byte RVALID
    #field byte Reserved2 7
#endstruct

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