Win32 API 日本語リファレンス
ホームNetworking.WinSock › WSAPROTOCOLCHAIN

WSAPROTOCOLCHAIN

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

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

フィールド

フィールドサイズx64x86説明
ChainLenINT4+0+0プロトコルチェーンの層数である。0は階層化なし、1は基底プロトコルを示す。
ChainEntriesDWORD28+4+4チェーンを構成する各層のカタログエントリID配列である。

各言語での定義

#include <windows.h>

// WSAPROTOCOLCHAIN  (x64 32 / x86 32 バイト)
typedef struct WSAPROTOCOLCHAIN {
    INT ChainLen;
    DWORD ChainEntries[7];
} WSAPROTOCOLCHAIN;
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;
}
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
import ctypes
from ctypes import wintypes

class WSAPROTOCOLCHAIN(ctypes.Structure):
    _fields_ = [
        ("ChainLen", ctypes.c_int),
        ("ChainEntries", wintypes.DWORD * 7),
    ]
#[repr(C)]
pub struct WSAPROTOCOLCHAIN {
    pub ChainLen: i32,
    pub ChainEntries: [u32; 7],
}
import "golang.org/x/sys/windows"

type WSAPROTOCOLCHAIN struct {
	ChainLen int32
	ChainEntries [7]uint32
}
type
  WSAPROTOCOLCHAIN = record
    ChainLen: Integer;
    ChainEntries: array[0..6] of DWORD;
  end;
const WSAPROTOCOLCHAIN = extern struct {
    ChainLen: i32,
    ChainEntries: [7]u32,
};
type
  WSAPROTOCOLCHAIN {.bycopy.} = object
    ChainLen: int32
    ChainEntries: array[7, uint32]
struct WSAPROTOCOLCHAIN
{
    int ChainLen;
    uint[7] ChainEntries;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WSAPROTOCOLCHAIN サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; ChainLen : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; ChainEntries : DWORD (+4, 28byte)  varptr(st)+4 を基点に操作(28byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WSAPROTOCOLCHAIN
    #field int ChainLen
    #field int ChainEntries 7
#endstruct

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