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

VDS_ISCSI_TARGET_PROP

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

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

フィールド

フィールドサイズx64x86説明
idGUID16+0+0iSCSIターゲットを一意に識別するGUID。
pwszIscsiNameLPWSTR8/4+16+16ターゲットのiSCSI修飾名(IQN等)を表すワイド文字列。
pwszFriendlyNameLPWSTR8/4+24+20ターゲットのユーザー向け表示名を表すワイド文字列。
bChapEnabledBOOL4+32+24CHAP認証が有効か否かを示すBOOL値。

各言語での定義

#include <windows.h>

// VDS_ISCSI_TARGET_PROP  (x64 40 / x86 28 バイト)
typedef struct VDS_ISCSI_TARGET_PROP {
    GUID id;
    LPWSTR pwszIscsiName;
    LPWSTR pwszFriendlyName;
    BOOL bChapEnabled;
} VDS_ISCSI_TARGET_PROP;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_ISCSI_TARGET_PROP
{
    public Guid id;
    public IntPtr pwszIscsiName;
    public IntPtr pwszFriendlyName;
    [MarshalAs(UnmanagedType.Bool)] public bool bChapEnabled;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_ISCSI_TARGET_PROP
    Public id As Guid
    Public pwszIscsiName As IntPtr
    Public pwszFriendlyName As IntPtr
    <MarshalAs(UnmanagedType.Bool)> Public bChapEnabled As Boolean
End Structure
import ctypes
from ctypes import wintypes

class VDS_ISCSI_TARGET_PROP(ctypes.Structure):
    _fields_ = [
        ("id", GUID),
        ("pwszIscsiName", ctypes.c_void_p),
        ("pwszFriendlyName", ctypes.c_void_p),
        ("bChapEnabled", wintypes.BOOL),
    ]
#[repr(C)]
pub struct VDS_ISCSI_TARGET_PROP {
    pub id: GUID,
    pub pwszIscsiName: *mut core::ffi::c_void,
    pub pwszFriendlyName: *mut core::ffi::c_void,
    pub bChapEnabled: i32,
}
import "golang.org/x/sys/windows"

type VDS_ISCSI_TARGET_PROP struct {
	id windows.GUID
	pwszIscsiName uintptr
	pwszFriendlyName uintptr
	bChapEnabled int32
}
type
  VDS_ISCSI_TARGET_PROP = record
    id: TGUID;
    pwszIscsiName: Pointer;
    pwszFriendlyName: Pointer;
    bChapEnabled: BOOL;
  end;
const VDS_ISCSI_TARGET_PROP = extern struct {
    id: GUID,
    pwszIscsiName: ?*anyopaque,
    pwszFriendlyName: ?*anyopaque,
    bChapEnabled: i32,
};
type
  VDS_ISCSI_TARGET_PROP {.bycopy.} = object
    id: GUID
    pwszIscsiName: pointer
    pwszFriendlyName: pointer
    bChapEnabled: int32
struct VDS_ISCSI_TARGET_PROP
{
    GUID id;
    void* pwszIscsiName;
    void* pwszFriendlyName;
    int bChapEnabled;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; VDS_ISCSI_TARGET_PROP サイズ: 28 バイト(x86)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; id : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; pwszIscsiName : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; pwszFriendlyName : LPWSTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; bChapEnabled : BOOL (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VDS_ISCSI_TARGET_PROP サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; id : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; pwszIscsiName : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; pwszFriendlyName : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; bChapEnabled : BOOL (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global VDS_ISCSI_TARGET_PROP
    #field GUID id
    #field intptr pwszIscsiName
    #field intptr pwszFriendlyName
    #field bool bChapEnabled
#endstruct

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