ホーム › System.RemoteDesktop › WTS_SESSION_ADDRESS
WTS_SESSION_ADDRESS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| AddressFamily | DWORD | 4 | +0 | +0 | アドレスファミリーを格納する null 終端文字列です。このメンバーには常に "AF_INET" を設定します。 |
| Address | BYTE | 20 | +4 | +4 | セッションに割り当てられた仮想 IP アドレスです。このアドレスの形式は、WTS_CLIENT_ADDRESS 構造体で使用される形式と同一です。 |
公式ドキュメント
セッションに割り当てられた仮想 IP アドレスを格納します。この構造体は、WTSInfoClass パラメーターに "WTSSessionAddressV4" を指定したときに WTSQuerySessionInformation 関数から返されます。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// WTS_SESSION_ADDRESS (x64 24 / x86 24 バイト)
typedef struct WTS_SESSION_ADDRESS {
DWORD AddressFamily;
BYTE Address[20];
} WTS_SESSION_ADDRESS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTS_SESSION_ADDRESS
{
public uint AddressFamily;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] Address;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTS_SESSION_ADDRESS
Public AddressFamily As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=20)> Public Address() As Byte
End Structureimport ctypes
from ctypes import wintypes
class WTS_SESSION_ADDRESS(ctypes.Structure):
_fields_ = [
("AddressFamily", wintypes.DWORD),
("Address", ctypes.c_ubyte * 20),
]#[repr(C)]
pub struct WTS_SESSION_ADDRESS {
pub AddressFamily: u32,
pub Address: [u8; 20],
}import "golang.org/x/sys/windows"
type WTS_SESSION_ADDRESS struct {
AddressFamily uint32
Address [20]byte
}type
WTS_SESSION_ADDRESS = record
AddressFamily: DWORD;
Address: array[0..19] of Byte;
end;const WTS_SESSION_ADDRESS = extern struct {
AddressFamily: u32,
Address: [20]u8,
};type
WTS_SESSION_ADDRESS {.bycopy.} = object
AddressFamily: uint32
Address: array[20, uint8]struct WTS_SESSION_ADDRESS
{
uint AddressFamily;
ubyte[20] Address;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WTS_SESSION_ADDRESS サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; AddressFamily : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Address : BYTE (+4, 20byte) varptr(st)+4 を基点に操作(20byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WTS_SESSION_ADDRESS
#field int AddressFamily
#field byte Address 20
#endstruct
stdim st, WTS_SESSION_ADDRESS ; NSTRUCT 変数を確保
st->AddressFamily = 100
mes "AddressFamily=" + st->AddressFamily