ホーム › Networking.WinSock › WSPDATA
WSPDATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| wVersion | WORD | 2 | +0 | +0 | プロバイダがサポートするWinsock仕様バージョンを示す。 |
| wHighVersion | WORD | 2 | +2 | +2 | プロバイダがサポートする最高Winsock仕様バージョンを示す。 |
| szDescription | WCHAR | 512 | +4 | +4 | サービスプロバイダの説明文字列(WCHAR配列)。 |
各言語での定義
#include <windows.h>
// WSPDATA (x64 516 / x86 516 バイト)
typedef struct WSPDATA {
WORD wVersion;
WORD wHighVersion;
WCHAR szDescription[256];
} WSPDATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WSPDATA
{
public ushort wVersion;
public ushort wHighVersion;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string szDescription;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WSPDATA
Public wVersion As UShort
Public wHighVersion As UShort
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public szDescription As String
End Structureimport ctypes
from ctypes import wintypes
class WSPDATA(ctypes.Structure):
_fields_ = [
("wVersion", ctypes.c_ushort),
("wHighVersion", ctypes.c_ushort),
("szDescription", ctypes.c_wchar * 256),
]#[repr(C)]
pub struct WSPDATA {
pub wVersion: u16,
pub wHighVersion: u16,
pub szDescription: [u16; 256],
}import "golang.org/x/sys/windows"
type WSPDATA struct {
wVersion uint16
wHighVersion uint16
szDescription [256]uint16
}type
WSPDATA = record
wVersion: Word;
wHighVersion: Word;
szDescription: array[0..255] of WideChar;
end;const WSPDATA = extern struct {
wVersion: u16,
wHighVersion: u16,
szDescription: [256]u16,
};type
WSPDATA {.bycopy.} = object
wVersion: uint16
wHighVersion: uint16
szDescription: array[256, uint16]struct WSPDATA
{
ushort wVersion;
ushort wHighVersion;
wchar[256] szDescription;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WSPDATA サイズ: 516 バイト(x64)
dim st, 129 ; 4byte整数×129(構造体サイズ 516 / 4 切り上げ)
; wVersion : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; wHighVersion : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; szDescription : WCHAR (+4, 512byte) varptr(st)+4 を基点に操作(512byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WSPDATA
#field short wVersion
#field short wHighVersion
#field wchar szDescription 256
#endstruct
stdim st, WSPDATA ; NSTRUCT 変数を確保
st->wVersion = 100
mes "wVersion=" + st->wVersion