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

WS_ENDPOINT_ADDRESS

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

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

フィールド

フィールドサイズx64x86説明
urlWS_STRING16/8+0+0エンドポイントのアドレスを表すURL文字列。
headersWS_XML_BUFFER*8/4+16+8エンドポイント参照に付随する参照ヘッダーを保持するXMLバッファへのポインタ。NULL可。
extensionsWS_XML_BUFFER*8/4+24+12エンドポイント参照の拡張要素を保持するXMLバッファへのポインタ。NULL可。
identityWS_ENDPOINT_IDENTITY*8/4+32+16エンドポイントのID情報へのポインタ。NULL可。

各言語での定義

#include <windows.h>

// WS_STRING  (x64 16 / x86 8 バイト)
typedef struct WS_STRING {
    DWORD length;
    LPWSTR chars;
} WS_STRING;

// WS_ENDPOINT_ADDRESS  (x64 40 / x86 20 バイト)
typedef struct WS_ENDPOINT_ADDRESS {
    WS_STRING url;
    WS_XML_BUFFER* headers;
    WS_XML_BUFFER* extensions;
    WS_ENDPOINT_IDENTITY* identity;
} WS_ENDPOINT_ADDRESS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WS_STRING
{
    public uint length;
    public IntPtr chars;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WS_ENDPOINT_ADDRESS
{
    public WS_STRING url;
    public IntPtr headers;
    public IntPtr extensions;
    public IntPtr identity;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WS_STRING
    Public length As UInteger
    Public chars As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WS_ENDPOINT_ADDRESS
    Public url As WS_STRING
    Public headers As IntPtr
    Public extensions As IntPtr
    Public identity As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class WS_STRING(ctypes.Structure):
    _fields_ = [
        ("length", wintypes.DWORD),
        ("chars", ctypes.c_void_p),
    ]

class WS_ENDPOINT_ADDRESS(ctypes.Structure):
    _fields_ = [
        ("url", WS_STRING),
        ("headers", ctypes.c_void_p),
        ("extensions", ctypes.c_void_p),
        ("identity", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct WS_STRING {
    pub length: u32,
    pub chars: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct WS_ENDPOINT_ADDRESS {
    pub url: WS_STRING,
    pub headers: *mut core::ffi::c_void,
    pub extensions: *mut core::ffi::c_void,
    pub identity: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type WS_STRING struct {
	length uint32
	chars uintptr
}

type WS_ENDPOINT_ADDRESS struct {
	url WS_STRING
	headers uintptr
	extensions uintptr
	identity uintptr
}
type
  WS_STRING = record
    length: DWORD;
    chars: Pointer;
  end;

  WS_ENDPOINT_ADDRESS = record
    url: WS_STRING;
    headers: Pointer;
    extensions: Pointer;
    identity: Pointer;
  end;
const WS_STRING = extern struct {
    length: u32,
    chars: ?*anyopaque,
};

const WS_ENDPOINT_ADDRESS = extern struct {
    url: WS_STRING,
    headers: ?*anyopaque,
    extensions: ?*anyopaque,
    identity: ?*anyopaque,
};
type
  WS_STRING {.bycopy.} = object
    length: uint32
    chars: pointer

  WS_ENDPOINT_ADDRESS {.bycopy.} = object
    url: WS_STRING
    headers: pointer
    extensions: pointer
    identity: pointer
struct WS_STRING
{
    uint length;
    void* chars;
}

struct WS_ENDPOINT_ADDRESS
{
    WS_STRING url;
    void* headers;
    void* extensions;
    void* identity;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WS_ENDPOINT_ADDRESS サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; url : WS_STRING (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; headers : WS_XML_BUFFER* (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; extensions : WS_XML_BUFFER* (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; identity : WS_ENDPOINT_IDENTITY* (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WS_ENDPOINT_ADDRESS サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; url : WS_STRING (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; headers : WS_XML_BUFFER* (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; extensions : WS_XML_BUFFER* (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; identity : WS_ENDPOINT_IDENTITY* (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WS_STRING
    #field int length
    #field intptr chars
#endstruct

#defstruct global WS_ENDPOINT_ADDRESS
    #field WS_STRING url
    #field intptr headers
    #field intptr extensions
    #field intptr identity
#endstruct

stdim st, WS_ENDPOINT_ADDRESS        ; NSTRUCT 変数を確保