ホーム › Networking.WinSock › WSAPROTOCOL_INFOW
WSAPROTOCOL_INFOW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwServiceFlags1 | DWORD | 4 | +0 | +0 | プロトコルが提供するサービスを示すフラグ群(その1)である。 |
| dwServiceFlags2 | DWORD | 4 | +4 | +4 | 予約フラグ群(その2)である。 |
| dwServiceFlags3 | DWORD | 4 | +8 | +8 | 予約フラグ群(その3)である。 |
| dwServiceFlags4 | DWORD | 4 | +12 | +12 | 予約フラグ群(その4)である。 |
| dwProviderFlags | DWORD | 4 | +16 | +16 | プロバイダ固有の動作を示すフラグ群である。 |
| ProviderId | GUID | 16 | +20 | +20 | プロトコルを提供するプロバイダを識別するGUIDである。 |
| dwCatalogEntryId | DWORD | 4 | +36 | +36 | Winsockカタログ内でのエントリ一意IDである。 |
| ProtocolChain | WSAPROTOCOLCHAIN | 32 | +40 | +40 | このプロトコルを構成するプロトコルチェーン情報である。 |
| iVersion | INT | 4 | +72 | +72 | プロトコルのバージョン番号である。 |
| iAddressFamily | INT | 4 | +76 | +76 | プロトコルが使用するアドレスファミリである。 |
| iMaxSockAddr | INT | 4 | +80 | +80 | ソケットアドレスの最大長をバイト単位で示す。 |
| iMinSockAddr | INT | 4 | +84 | +84 | ソケットアドレスの最小長をバイト単位で示す。 |
| iSocketType | INT | 4 | +88 | +88 | プロトコルのソケットタイプである。 |
| iProtocol | INT | 4 | +92 | +92 | プロトコル番号である。 |
| iProtocolMaxOffset | INT | 4 | +96 | +96 | iProtocolから加算可能な最大オフセット値である。 |
| iNetworkByteOrder | INT | 4 | +100 | +100 | ネットワークバイトオーダ(ビッグ/リトルエンディアン)を示す値である。 |
| iSecurityScheme | INT | 4 | +104 | +104 | プロトコルが使用するセキュリティスキームを示す値である。 |
| dwMessageSize | DWORD | 4 | +108 | +108 | 送受信可能なメッセージの最大サイズである。 |
| dwProviderReserved | DWORD | 4 | +112 | +112 | プロバイダ予約フィールドである。 |
| szProtocol | WCHAR | 512 | +116 | +116 | プロトコルの名前文字列(Unicode、固定長)である。 |
各言語での定義
#include <windows.h>
// WSAPROTOCOLCHAIN (x64 32 / x86 32 バイト)
typedef struct WSAPROTOCOLCHAIN {
INT ChainLen;
DWORD ChainEntries[7];
} WSAPROTOCOLCHAIN;
// WSAPROTOCOL_INFOW (x64 628 / x86 628 バイト)
typedef struct WSAPROTOCOL_INFOW {
DWORD dwServiceFlags1;
DWORD dwServiceFlags2;
DWORD dwServiceFlags3;
DWORD dwServiceFlags4;
DWORD dwProviderFlags;
GUID ProviderId;
DWORD dwCatalogEntryId;
WSAPROTOCOLCHAIN ProtocolChain;
INT iVersion;
INT iAddressFamily;
INT iMaxSockAddr;
INT iMinSockAddr;
INT iSocketType;
INT iProtocol;
INT iProtocolMaxOffset;
INT iNetworkByteOrder;
INT iSecurityScheme;
DWORD dwMessageSize;
DWORD dwProviderReserved;
WCHAR szProtocol[256];
} WSAPROTOCOL_INFOW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WSAPROTOCOLCHAIN
{
public int ChainLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public uint[] ChainEntries;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WSAPROTOCOL_INFOW
{
public uint dwServiceFlags1;
public uint dwServiceFlags2;
public uint dwServiceFlags3;
public uint dwServiceFlags4;
public uint dwProviderFlags;
public Guid ProviderId;
public uint dwCatalogEntryId;
public WSAPROTOCOLCHAIN ProtocolChain;
public int iVersion;
public int iAddressFamily;
public int iMaxSockAddr;
public int iMinSockAddr;
public int iSocketType;
public int iProtocol;
public int iProtocolMaxOffset;
public int iNetworkByteOrder;
public int iSecurityScheme;
public uint dwMessageSize;
public uint dwProviderReserved;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string szProtocol;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WSAPROTOCOLCHAIN
Public ChainLen As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=7)> Public ChainEntries() As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WSAPROTOCOL_INFOW
Public dwServiceFlags1 As UInteger
Public dwServiceFlags2 As UInteger
Public dwServiceFlags3 As UInteger
Public dwServiceFlags4 As UInteger
Public dwProviderFlags As UInteger
Public ProviderId As Guid
Public dwCatalogEntryId As UInteger
Public ProtocolChain As WSAPROTOCOLCHAIN
Public iVersion As Integer
Public iAddressFamily As Integer
Public iMaxSockAddr As Integer
Public iMinSockAddr As Integer
Public iSocketType As Integer
Public iProtocol As Integer
Public iProtocolMaxOffset As Integer
Public iNetworkByteOrder As Integer
Public iSecurityScheme As Integer
Public dwMessageSize As UInteger
Public dwProviderReserved As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public szProtocol As String
End Structureimport ctypes
from ctypes import wintypes
class WSAPROTOCOLCHAIN(ctypes.Structure):
_fields_ = [
("ChainLen", ctypes.c_int),
("ChainEntries", wintypes.DWORD * 7),
]
class WSAPROTOCOL_INFOW(ctypes.Structure):
_fields_ = [
("dwServiceFlags1", wintypes.DWORD),
("dwServiceFlags2", wintypes.DWORD),
("dwServiceFlags3", wintypes.DWORD),
("dwServiceFlags4", wintypes.DWORD),
("dwProviderFlags", wintypes.DWORD),
("ProviderId", GUID),
("dwCatalogEntryId", wintypes.DWORD),
("ProtocolChain", WSAPROTOCOLCHAIN),
("iVersion", ctypes.c_int),
("iAddressFamily", ctypes.c_int),
("iMaxSockAddr", ctypes.c_int),
("iMinSockAddr", ctypes.c_int),
("iSocketType", ctypes.c_int),
("iProtocol", ctypes.c_int),
("iProtocolMaxOffset", ctypes.c_int),
("iNetworkByteOrder", ctypes.c_int),
("iSecurityScheme", ctypes.c_int),
("dwMessageSize", wintypes.DWORD),
("dwProviderReserved", wintypes.DWORD),
("szProtocol", ctypes.c_wchar * 256),
]#[repr(C)]
pub struct WSAPROTOCOLCHAIN {
pub ChainLen: i32,
pub ChainEntries: [u32; 7],
}
#[repr(C)]
pub struct WSAPROTOCOL_INFOW {
pub dwServiceFlags1: u32,
pub dwServiceFlags2: u32,
pub dwServiceFlags3: u32,
pub dwServiceFlags4: u32,
pub dwProviderFlags: u32,
pub ProviderId: GUID,
pub dwCatalogEntryId: u32,
pub ProtocolChain: WSAPROTOCOLCHAIN,
pub iVersion: i32,
pub iAddressFamily: i32,
pub iMaxSockAddr: i32,
pub iMinSockAddr: i32,
pub iSocketType: i32,
pub iProtocol: i32,
pub iProtocolMaxOffset: i32,
pub iNetworkByteOrder: i32,
pub iSecurityScheme: i32,
pub dwMessageSize: u32,
pub dwProviderReserved: u32,
pub szProtocol: [u16; 256],
}import "golang.org/x/sys/windows"
type WSAPROTOCOLCHAIN struct {
ChainLen int32
ChainEntries [7]uint32
}
type WSAPROTOCOL_INFOW struct {
dwServiceFlags1 uint32
dwServiceFlags2 uint32
dwServiceFlags3 uint32
dwServiceFlags4 uint32
dwProviderFlags uint32
ProviderId windows.GUID
dwCatalogEntryId uint32
ProtocolChain WSAPROTOCOLCHAIN
iVersion int32
iAddressFamily int32
iMaxSockAddr int32
iMinSockAddr int32
iSocketType int32
iProtocol int32
iProtocolMaxOffset int32
iNetworkByteOrder int32
iSecurityScheme int32
dwMessageSize uint32
dwProviderReserved uint32
szProtocol [256]uint16
}type
WSAPROTOCOLCHAIN = record
ChainLen: Integer;
ChainEntries: array[0..6] of DWORD;
end;
WSAPROTOCOL_INFOW = record
dwServiceFlags1: DWORD;
dwServiceFlags2: DWORD;
dwServiceFlags3: DWORD;
dwServiceFlags4: DWORD;
dwProviderFlags: DWORD;
ProviderId: TGUID;
dwCatalogEntryId: DWORD;
ProtocolChain: WSAPROTOCOLCHAIN;
iVersion: Integer;
iAddressFamily: Integer;
iMaxSockAddr: Integer;
iMinSockAddr: Integer;
iSocketType: Integer;
iProtocol: Integer;
iProtocolMaxOffset: Integer;
iNetworkByteOrder: Integer;
iSecurityScheme: Integer;
dwMessageSize: DWORD;
dwProviderReserved: DWORD;
szProtocol: array[0..255] of WideChar;
end;const WSAPROTOCOLCHAIN = extern struct {
ChainLen: i32,
ChainEntries: [7]u32,
};
const WSAPROTOCOL_INFOW = extern struct {
dwServiceFlags1: u32,
dwServiceFlags2: u32,
dwServiceFlags3: u32,
dwServiceFlags4: u32,
dwProviderFlags: u32,
ProviderId: GUID,
dwCatalogEntryId: u32,
ProtocolChain: WSAPROTOCOLCHAIN,
iVersion: i32,
iAddressFamily: i32,
iMaxSockAddr: i32,
iMinSockAddr: i32,
iSocketType: i32,
iProtocol: i32,
iProtocolMaxOffset: i32,
iNetworkByteOrder: i32,
iSecurityScheme: i32,
dwMessageSize: u32,
dwProviderReserved: u32,
szProtocol: [256]u16,
};type
WSAPROTOCOLCHAIN {.bycopy.} = object
ChainLen: int32
ChainEntries: array[7, uint32]
WSAPROTOCOL_INFOW {.bycopy.} = object
dwServiceFlags1: uint32
dwServiceFlags2: uint32
dwServiceFlags3: uint32
dwServiceFlags4: uint32
dwProviderFlags: uint32
ProviderId: GUID
dwCatalogEntryId: uint32
ProtocolChain: WSAPROTOCOLCHAIN
iVersion: int32
iAddressFamily: int32
iMaxSockAddr: int32
iMinSockAddr: int32
iSocketType: int32
iProtocol: int32
iProtocolMaxOffset: int32
iNetworkByteOrder: int32
iSecurityScheme: int32
dwMessageSize: uint32
dwProviderReserved: uint32
szProtocol: array[256, uint16]struct WSAPROTOCOLCHAIN
{
int ChainLen;
uint[7] ChainEntries;
}
struct WSAPROTOCOL_INFOW
{
uint dwServiceFlags1;
uint dwServiceFlags2;
uint dwServiceFlags3;
uint dwServiceFlags4;
uint dwProviderFlags;
GUID ProviderId;
uint dwCatalogEntryId;
WSAPROTOCOLCHAIN ProtocolChain;
int iVersion;
int iAddressFamily;
int iMaxSockAddr;
int iMinSockAddr;
int iSocketType;
int iProtocol;
int iProtocolMaxOffset;
int iNetworkByteOrder;
int iSecurityScheme;
uint dwMessageSize;
uint dwProviderReserved;
wchar[256] szProtocol;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WSAPROTOCOL_INFOW サイズ: 628 バイト(x64)
dim st, 157 ; 4byte整数×157(構造体サイズ 628 / 4 切り上げ)
; dwServiceFlags1 : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwServiceFlags2 : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwServiceFlags3 : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwServiceFlags4 : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwProviderFlags : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ProviderId : GUID (+20, 16byte) varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; dwCatalogEntryId : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ProtocolChain : WSAPROTOCOLCHAIN (+40, 32byte) varptr(st)+40 を基点に操作(32byte:入れ子/配列)
; iVersion : INT (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; iAddressFamily : INT (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; iMaxSockAddr : INT (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; iMinSockAddr : INT (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; iSocketType : INT (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; iProtocol : INT (+92, 4byte) st.23 = 値 / 値 = st.23 (lpoke/lpeek も可)
; iProtocolMaxOffset : INT (+96, 4byte) st.24 = 値 / 値 = st.24 (lpoke/lpeek も可)
; iNetworkByteOrder : INT (+100, 4byte) st.25 = 値 / 値 = st.25 (lpoke/lpeek も可)
; iSecurityScheme : INT (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; dwMessageSize : DWORD (+108, 4byte) st.27 = 値 / 値 = st.27 (lpoke/lpeek も可)
; dwProviderReserved : DWORD (+112, 4byte) st.28 = 値 / 値 = st.28 (lpoke/lpeek も可)
; szProtocol : WCHAR (+116, 512byte) varptr(st)+116 を基点に操作(512byte:入れ子/配列)
; ※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 WSAPROTOCOLCHAIN
#field int ChainLen
#field int ChainEntries 7
#endstruct
#defstruct global WSAPROTOCOL_INFOW
#field int dwServiceFlags1
#field int dwServiceFlags2
#field int dwServiceFlags3
#field int dwServiceFlags4
#field int dwProviderFlags
#field GUID ProviderId
#field int dwCatalogEntryId
#field WSAPROTOCOLCHAIN ProtocolChain
#field int iVersion
#field int iAddressFamily
#field int iMaxSockAddr
#field int iMinSockAddr
#field int iSocketType
#field int iProtocol
#field int iProtocolMaxOffset
#field int iNetworkByteOrder
#field int iSecurityScheme
#field int dwMessageSize
#field int dwProviderReserved
#field wchar szProtocol 256
#endstruct
stdim st, WSAPROTOCOL_INFOW ; NSTRUCT 変数を確保
st->dwServiceFlags1 = 100
mes "dwServiceFlags1=" + st->dwServiceFlags1