Win32 API 日本語リファレンス
ホームSystem.RemoteDesktop › TSSD_ConnectionPoint

TSSD_ConnectionPoint

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

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

フィールド

フィールドサイズx64x86説明
ServerAddressBBYTE16+0+0サーバーアドレスのバイト配列。
AddressTypeTSSD_AddrV46Type4+16+16アドレスの種別(IPv4/IPv6)を示す列挙値。
PortNumberWORD2+20+20接続先のポート番号。
AddressScopeDWORD4+24+24アドレスのスコープ識別子。

各言語での定義

#include <windows.h>

// TSSD_ConnectionPoint  (x64 28 / x86 28 バイト)
typedef struct TSSD_ConnectionPoint {
    BYTE ServerAddressB[16];
    TSSD_AddrV46Type AddressType;
    WORD PortNumber;
    DWORD AddressScope;
} TSSD_ConnectionPoint;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TSSD_ConnectionPoint
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] ServerAddressB;
    public int AddressType;
    public ushort PortNumber;
    public uint AddressScope;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TSSD_ConnectionPoint
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public ServerAddressB() As Byte
    Public AddressType As Integer
    Public PortNumber As UShort
    Public AddressScope As UInteger
End Structure
import ctypes
from ctypes import wintypes

class TSSD_ConnectionPoint(ctypes.Structure):
    _fields_ = [
        ("ServerAddressB", ctypes.c_ubyte * 16),
        ("AddressType", ctypes.c_int),
        ("PortNumber", ctypes.c_ushort),
        ("AddressScope", wintypes.DWORD),
    ]
#[repr(C)]
pub struct TSSD_ConnectionPoint {
    pub ServerAddressB: [u8; 16],
    pub AddressType: i32,
    pub PortNumber: u16,
    pub AddressScope: u32,
}
import "golang.org/x/sys/windows"

type TSSD_ConnectionPoint struct {
	ServerAddressB [16]byte
	AddressType int32
	PortNumber uint16
	AddressScope uint32
}
type
  TSSD_ConnectionPoint = record
    ServerAddressB: array[0..15] of Byte;
    AddressType: Integer;
    PortNumber: Word;
    AddressScope: DWORD;
  end;
const TSSD_ConnectionPoint = extern struct {
    ServerAddressB: [16]u8,
    AddressType: i32,
    PortNumber: u16,
    AddressScope: u32,
};
type
  TSSD_ConnectionPoint {.bycopy.} = object
    ServerAddressB: array[16, uint8]
    AddressType: int32
    PortNumber: uint16
    AddressScope: uint32
struct TSSD_ConnectionPoint
{
    ubyte[16] ServerAddressB;
    int AddressType;
    ushort PortNumber;
    uint AddressScope;
}

HSP用 定義

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

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

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