ホーム › Storage.IscsiDisc › ISCSI_TARGET_PORTALW
ISCSI_TARGET_PORTALW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| SymbolicName | WCHAR | 512 | +0 | +0 | ポータルを識別する任意のシンボリック名を保持する固定長WCHAR配列。 |
| Address | WCHAR | 512 | +512 | +512 | ポータルのIPアドレスまたはDNS名を保持する固定長WCHAR配列。 |
| Socket | WORD | 2 | +1024 | +1024 | ポータルのTCPポート番号。既定のiSCSIポートは3260。 |
各言語での定義
#include <windows.h>
// ISCSI_TARGET_PORTALW (x64 1026 / x86 1026 バイト)
typedef struct ISCSI_TARGET_PORTALW {
WCHAR SymbolicName[256];
WCHAR Address[256];
WORD Socket;
} ISCSI_TARGET_PORTALW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ISCSI_TARGET_PORTALW
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string SymbolicName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string Address;
public ushort Socket;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ISCSI_TARGET_PORTALW
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public SymbolicName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public Address As String
Public Socket As UShort
End Structureimport ctypes
from ctypes import wintypes
class ISCSI_TARGET_PORTALW(ctypes.Structure):
_fields_ = [
("SymbolicName", ctypes.c_wchar * 256),
("Address", ctypes.c_wchar * 256),
("Socket", ctypes.c_ushort),
]#[repr(C)]
pub struct ISCSI_TARGET_PORTALW {
pub SymbolicName: [u16; 256],
pub Address: [u16; 256],
pub Socket: u16,
}import "golang.org/x/sys/windows"
type ISCSI_TARGET_PORTALW struct {
SymbolicName [256]uint16
Address [256]uint16
Socket uint16
}type
ISCSI_TARGET_PORTALW = record
SymbolicName: array[0..255] of WideChar;
Address: array[0..255] of WideChar;
Socket: Word;
end;const ISCSI_TARGET_PORTALW = extern struct {
SymbolicName: [256]u16,
Address: [256]u16,
Socket: u16,
};type
ISCSI_TARGET_PORTALW {.bycopy.} = object
SymbolicName: array[256, uint16]
Address: array[256, uint16]
Socket: uint16struct ISCSI_TARGET_PORTALW
{
wchar[256] SymbolicName;
wchar[256] Address;
ushort Socket;
}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_PORTALW サイズ: 1026 バイト(x64)
dim st, 257 ; 4byte整数×257(構造体サイズ 1026 / 4 切り上げ)
; SymbolicName : WCHAR (+0, 512byte) varptr(st)+0 を基点に操作(512byte:入れ子/配列)
; Address : WCHAR (+512, 512byte) varptr(st)+512 を基点に操作(512byte:入れ子/配列)
; Socket : WORD (+1024, 2byte) wpoke st,1024,値 / 値 = wpeek(st,1024)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ISCSI_TARGET_PORTALW
#field wchar SymbolicName 256
#field wchar Address 256
#field short Socket
#endstruct
stdim st, ISCSI_TARGET_PORTALW ; NSTRUCT 変数を確保
st->Socket = 100
mes "Socket=" + st->Socket