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

ISCSI_TARGET_PORTAL_GROUPA

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

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

フィールド

フィールドサイズx64x86説明
CountDWORD4+0+0Portals配列に格納されるポータル数。
PortalsISCSI_TARGET_PORTALA514+4+4ポータルグループを構成するISCSI_TARGET_PORTALAの可変長配列(先頭1要素を宣言)。

各言語での定義

#include <windows.h>

// ISCSI_TARGET_PORTALA  (x64 514 / x86 514 バイト)
typedef struct ISCSI_TARGET_PORTALA {
    CHAR SymbolicName[256];
    CHAR Address[256];
    WORD Socket;
} ISCSI_TARGET_PORTALA;

// ISCSI_TARGET_PORTAL_GROUPA  (x64 520 / x86 520 バイト)
typedef struct ISCSI_TARGET_PORTAL_GROUPA {
    DWORD Count;
    ISCSI_TARGET_PORTALA Portals[1];
} ISCSI_TARGET_PORTAL_GROUPA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ISCSI_TARGET_PORTALA
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public sbyte[] SymbolicName;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public sbyte[] Address;
    public ushort Socket;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ISCSI_TARGET_PORTAL_GROUPA
{
    public uint Count;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public ISCSI_TARGET_PORTALA[] Portals;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ISCSI_TARGET_PORTALA
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)> Public SymbolicName() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)> Public Address() As SByte
    Public Socket As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ISCSI_TARGET_PORTAL_GROUPA
    Public Count As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Portals() As ISCSI_TARGET_PORTALA
End Structure
import ctypes
from ctypes import wintypes

class ISCSI_TARGET_PORTALA(ctypes.Structure):
    _fields_ = [
        ("SymbolicName", ctypes.c_byte * 256),
        ("Address", ctypes.c_byte * 256),
        ("Socket", ctypes.c_ushort),
    ]

class ISCSI_TARGET_PORTAL_GROUPA(ctypes.Structure):
    _fields_ = [
        ("Count", wintypes.DWORD),
        ("Portals", ISCSI_TARGET_PORTALA * 1),
    ]
#[repr(C)]
pub struct ISCSI_TARGET_PORTALA {
    pub SymbolicName: [i8; 256],
    pub Address: [i8; 256],
    pub Socket: u16,
}

#[repr(C)]
pub struct ISCSI_TARGET_PORTAL_GROUPA {
    pub Count: u32,
    pub Portals: [ISCSI_TARGET_PORTALA; 1],
}
import "golang.org/x/sys/windows"

type ISCSI_TARGET_PORTALA struct {
	SymbolicName [256]int8
	Address [256]int8
	Socket uint16
}

type ISCSI_TARGET_PORTAL_GROUPA struct {
	Count uint32
	Portals [1]ISCSI_TARGET_PORTALA
}
type
  ISCSI_TARGET_PORTALA = record
    SymbolicName: array[0..255] of Shortint;
    Address: array[0..255] of Shortint;
    Socket: Word;
  end;

  ISCSI_TARGET_PORTAL_GROUPA = record
    Count: DWORD;
    Portals: array[0..0] of ISCSI_TARGET_PORTALA;
  end;
const ISCSI_TARGET_PORTALA = extern struct {
    SymbolicName: [256]i8,
    Address: [256]i8,
    Socket: u16,
};

const ISCSI_TARGET_PORTAL_GROUPA = extern struct {
    Count: u32,
    Portals: [1]ISCSI_TARGET_PORTALA,
};
type
  ISCSI_TARGET_PORTALA {.bycopy.} = object
    SymbolicName: array[256, int8]
    Address: array[256, int8]
    Socket: uint16

  ISCSI_TARGET_PORTAL_GROUPA {.bycopy.} = object
    Count: uint32
    Portals: array[1, ISCSI_TARGET_PORTALA]
struct ISCSI_TARGET_PORTALA
{
    byte[256] SymbolicName;
    byte[256] Address;
    ushort Socket;
}

struct ISCSI_TARGET_PORTAL_GROUPA
{
    uint Count;
    ISCSI_TARGET_PORTALA[1] Portals;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ISCSI_TARGET_PORTAL_GROUPA サイズ: 520 バイト(x64)
dim st, 130    ; 4byte整数×130(構造体サイズ 520 / 4 切り上げ)
; Count : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Portals : ISCSI_TARGET_PORTALA (+4, 514byte)  varptr(st)+4 を基点に操作(514byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global ISCSI_TARGET_PORTALA
    #field byte SymbolicName 256
    #field byte Address 256
    #field short Socket
#endstruct

#defstruct global ISCSI_TARGET_PORTAL_GROUPA
    #field int Count
    #field ISCSI_TARGET_PORTALA Portals 1
#endstruct

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