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

VDS_ISCSI_PORTAL_PROP

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

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

フィールド

フィールドサイズx64x86説明
idGUID16+0+0iSCSIポータルを一意に識別するGUID。
addressVDS_IPADDRESS552+16+16ポータルのIPアドレス情報を保持するVDS_IPADDRESS構造体。
statusVDS_ISCSI_PORTAL_STATUS4+568+568ポータルの状態を示すVDS_ISCSI_PORTAL_STATUS列挙値。

各言語での定義

#include <windows.h>

// VDS_IPADDRESS  (x64 552 / x86 552 バイト)
typedef struct VDS_IPADDRESS {
    VDS_IPADDRESS_TYPE type;
    DWORD ipv4Address;
    BYTE ipv6Address[16];
    DWORD ulIpv6FlowInfo;
    DWORD ulIpv6ScopeId;
    WCHAR wszTextAddress[257];
    DWORD ulPort;
} VDS_IPADDRESS;

// VDS_ISCSI_PORTAL_PROP  (x64 572 / x86 572 バイト)
typedef struct VDS_ISCSI_PORTAL_PROP {
    GUID id;
    VDS_IPADDRESS address;
    VDS_ISCSI_PORTAL_STATUS status;
} VDS_ISCSI_PORTAL_PROP;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_IPADDRESS
{
    public int type;
    public uint ipv4Address;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] ipv6Address;
    public uint ulIpv6FlowInfo;
    public uint ulIpv6ScopeId;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 257)] public string wszTextAddress;
    public uint ulPort;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VDS_ISCSI_PORTAL_PROP
{
    public Guid id;
    public VDS_IPADDRESS address;
    public int status;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_IPADDRESS
    Public type As Integer
    Public ipv4Address As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public ipv6Address() As Byte
    Public ulIpv6FlowInfo As UInteger
    Public ulIpv6ScopeId As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=257)> Public wszTextAddress As String
    Public ulPort As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VDS_ISCSI_PORTAL_PROP
    Public id As Guid
    Public address As VDS_IPADDRESS
    Public status As Integer
End Structure
import ctypes
from ctypes import wintypes

class VDS_IPADDRESS(ctypes.Structure):
    _fields_ = [
        ("type", ctypes.c_int),
        ("ipv4Address", wintypes.DWORD),
        ("ipv6Address", ctypes.c_ubyte * 16),
        ("ulIpv6FlowInfo", wintypes.DWORD),
        ("ulIpv6ScopeId", wintypes.DWORD),
        ("wszTextAddress", ctypes.c_wchar * 257),
        ("ulPort", wintypes.DWORD),
    ]

class VDS_ISCSI_PORTAL_PROP(ctypes.Structure):
    _fields_ = [
        ("id", GUID),
        ("address", VDS_IPADDRESS),
        ("status", ctypes.c_int),
    ]
#[repr(C)]
pub struct VDS_IPADDRESS {
    pub type: i32,
    pub ipv4Address: u32,
    pub ipv6Address: [u8; 16],
    pub ulIpv6FlowInfo: u32,
    pub ulIpv6ScopeId: u32,
    pub wszTextAddress: [u16; 257],
    pub ulPort: u32,
}

#[repr(C)]
pub struct VDS_ISCSI_PORTAL_PROP {
    pub id: GUID,
    pub address: VDS_IPADDRESS,
    pub status: i32,
}
import "golang.org/x/sys/windows"

type VDS_IPADDRESS struct {
	type int32
	ipv4Address uint32
	ipv6Address [16]byte
	ulIpv6FlowInfo uint32
	ulIpv6ScopeId uint32
	wszTextAddress [257]uint16
	ulPort uint32
}

type VDS_ISCSI_PORTAL_PROP struct {
	id windows.GUID
	address VDS_IPADDRESS
	status int32
}
type
  VDS_IPADDRESS = record
    type: Integer;
    ipv4Address: DWORD;
    ipv6Address: array[0..15] of Byte;
    ulIpv6FlowInfo: DWORD;
    ulIpv6ScopeId: DWORD;
    wszTextAddress: array[0..256] of WideChar;
    ulPort: DWORD;
  end;

  VDS_ISCSI_PORTAL_PROP = record
    id: TGUID;
    address: VDS_IPADDRESS;
    status: Integer;
  end;
const VDS_IPADDRESS = extern struct {
    type: i32,
    ipv4Address: u32,
    ipv6Address: [16]u8,
    ulIpv6FlowInfo: u32,
    ulIpv6ScopeId: u32,
    wszTextAddress: [257]u16,
    ulPort: u32,
};

const VDS_ISCSI_PORTAL_PROP = extern struct {
    id: GUID,
    address: VDS_IPADDRESS,
    status: i32,
};
type
  VDS_IPADDRESS {.bycopy.} = object
    type: int32
    ipv4Address: uint32
    ipv6Address: array[16, uint8]
    ulIpv6FlowInfo: uint32
    ulIpv6ScopeId: uint32
    wszTextAddress: array[257, uint16]
    ulPort: uint32

  VDS_ISCSI_PORTAL_PROP {.bycopy.} = object
    id: GUID
    address: VDS_IPADDRESS
    status: int32
struct VDS_IPADDRESS
{
    int type;
    uint ipv4Address;
    ubyte[16] ipv6Address;
    uint ulIpv6FlowInfo;
    uint ulIpv6ScopeId;
    wchar[257] wszTextAddress;
    uint ulPort;
}

struct VDS_ISCSI_PORTAL_PROP
{
    GUID id;
    VDS_IPADDRESS address;
    int status;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VDS_ISCSI_PORTAL_PROP サイズ: 572 バイト(x64)
dim st, 143    ; 4byte整数×143(構造体サイズ 572 / 4 切り上げ)
; id : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; address : VDS_IPADDRESS (+16, 552byte)  varptr(st)+16 を基点に操作(552byte:入れ子/配列)
; status : VDS_ISCSI_PORTAL_STATUS (+568, 4byte)  st.142 = 値  /  値 = st.142   (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_IPADDRESS
    #field int type
    #field int ipv4Address
    #field byte ipv6Address 16
    #field int ulIpv6FlowInfo
    #field int ulIpv6ScopeId
    #field wchar wszTextAddress 257
    #field int ulPort
#endstruct

#defstruct global VDS_ISCSI_PORTAL_PROP
    #field GUID id
    #field VDS_IPADDRESS address
    #field int status
#endstruct

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