ホーム › System.RemoteDesktop › WTSINFOA
WTSINFOA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| State | WTS_CONNECTSTATE_CLASS | 4 | +0 | +0 | セッションの現在の接続状態を示す WTS_CONNECTSTATE_CLASS 列挙型の値です。 |
| SessionId | DWORD | 4 | +4 | +4 | セッション識別子です。 |
| IncomingBytes | DWORD | 4 | +8 | +8 | クライアントからサーバーへの非圧縮のリモート デスクトップ プロトコル (RDP) データです。 |
| OutgoingBytes | DWORD | 4 | +12 | +12 | サーバーからクライアントへの非圧縮の RDP データです。 |
| IncomingFrames | DWORD | 4 | +16 | +16 | クライアントが接続してから、クライアントからサーバーへ送信された RDP データのフレーム数です。 |
| OutgoingFrames | DWORD | 4 | +20 | +20 | クライアントが接続してから、サーバーからクライアントへ送信された RDP データのフレーム数です。 |
| IncomingCompressedBytes | DWORD | 4 | +24 | +24 | クライアントからサーバーへの圧縮された RDP データです。 |
| OutgoingCompressedBy | DWORD | 4 | +28 | +28 | 圧縮された送信バイト数。 |
| WinStationName | CHAR | 32 | +32 | +32 | セッションの WinStation 名を格納する、null で終わる文字列です。 |
| Domain | CHAR | 17 | +64 | +64 | ユーザーが所属するドメインの名前を格納する、null で終わる文字列です。 |
| UserName | CHAR | 21 | +81 | +81 | セッションを所有するユーザーの名前を格納する、null で終わる文字列です。 |
| ConnectTime | LONGLONG | 8 | +104 | +104 | 最新のクライアント接続時刻です。 |
| DisconnectTime | LONGLONG | 8 | +112 | +112 | 最後にクライアントが切断した時刻です。 |
| LastInputTime | LONGLONG | 8 | +120 | +120 | セッションで最後にユーザー入力が行われた時刻です。 |
| LogonTime | LONGLONG | 8 | +128 | +128 | ユーザーがセッションにログオンした時刻です。 |
| CurrentTime | LONGLONG | 8 | +136 | +136 | WTSINFO データ構造体が呼び出された時刻です。 - OutgoingCompressedBytesサーバーからクライアントへの圧縮された RDP データです。 |
公式ドキュメント
リモート デスクトップ サービス セッションに関する情報を格納します。
解説(Remarks)
メモ
wtsapi32.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして WTSINFO を定義します。エンコード中立のエイリアスの使用と、エンコード中立でないコードを混在させると、不一致が生じ、コンパイル エラーまたは実行時エラーを引き起こす可能性があります。詳細については、「Conventions for Function Prototypes」を参照してください。
出典・ライセンス: 上記「公式ドキュメント」の内容は 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>
// WTSINFOA (x64 144 / x86 144 バイト)
typedef struct WTSINFOA {
WTS_CONNECTSTATE_CLASS State;
DWORD SessionId;
DWORD IncomingBytes;
DWORD OutgoingBytes;
DWORD IncomingFrames;
DWORD OutgoingFrames;
DWORD IncomingCompressedBytes;
DWORD OutgoingCompressedBy;
CHAR WinStationName[32];
CHAR Domain[17];
CHAR UserName[21];
LONGLONG ConnectTime;
LONGLONG DisconnectTime;
LONGLONG LastInputTime;
LONGLONG LogonTime;
LONGLONG CurrentTime;
} WTSINFOA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTSINFOA
{
public int State;
public uint SessionId;
public uint IncomingBytes;
public uint OutgoingBytes;
public uint IncomingFrames;
public uint OutgoingFrames;
public uint IncomingCompressedBytes;
public uint OutgoingCompressedBy;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public sbyte[] WinStationName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] public sbyte[] Domain;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 21)] public sbyte[] UserName;
public long ConnectTime;
public long DisconnectTime;
public long LastInputTime;
public long LogonTime;
public long CurrentTime;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTSINFOA
Public State As Integer
Public SessionId As UInteger
Public IncomingBytes As UInteger
Public OutgoingBytes As UInteger
Public IncomingFrames As UInteger
Public OutgoingFrames As UInteger
Public IncomingCompressedBytes As UInteger
Public OutgoingCompressedBy As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public WinStationName() As SByte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=17)> Public Domain() As SByte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=21)> Public UserName() As SByte
Public ConnectTime As Long
Public DisconnectTime As Long
Public LastInputTime As Long
Public LogonTime As Long
Public CurrentTime As Long
End Structureimport ctypes
from ctypes import wintypes
class WTSINFOA(ctypes.Structure):
_fields_ = [
("State", ctypes.c_int),
("SessionId", wintypes.DWORD),
("IncomingBytes", wintypes.DWORD),
("OutgoingBytes", wintypes.DWORD),
("IncomingFrames", wintypes.DWORD),
("OutgoingFrames", wintypes.DWORD),
("IncomingCompressedBytes", wintypes.DWORD),
("OutgoingCompressedBy", wintypes.DWORD),
("WinStationName", ctypes.c_byte * 32),
("Domain", ctypes.c_byte * 17),
("UserName", ctypes.c_byte * 21),
("ConnectTime", ctypes.c_longlong),
("DisconnectTime", ctypes.c_longlong),
("LastInputTime", ctypes.c_longlong),
("LogonTime", ctypes.c_longlong),
("CurrentTime", ctypes.c_longlong),
]#[repr(C)]
pub struct WTSINFOA {
pub State: i32,
pub SessionId: u32,
pub IncomingBytes: u32,
pub OutgoingBytes: u32,
pub IncomingFrames: u32,
pub OutgoingFrames: u32,
pub IncomingCompressedBytes: u32,
pub OutgoingCompressedBy: u32,
pub WinStationName: [i8; 32],
pub Domain: [i8; 17],
pub UserName: [i8; 21],
pub ConnectTime: i64,
pub DisconnectTime: i64,
pub LastInputTime: i64,
pub LogonTime: i64,
pub CurrentTime: i64,
}import "golang.org/x/sys/windows"
type WTSINFOA struct {
State int32
SessionId uint32
IncomingBytes uint32
OutgoingBytes uint32
IncomingFrames uint32
OutgoingFrames uint32
IncomingCompressedBytes uint32
OutgoingCompressedBy uint32
WinStationName [32]int8
Domain [17]int8
UserName [21]int8
ConnectTime int64
DisconnectTime int64
LastInputTime int64
LogonTime int64
CurrentTime int64
}type
WTSINFOA = record
State: Integer;
SessionId: DWORD;
IncomingBytes: DWORD;
OutgoingBytes: DWORD;
IncomingFrames: DWORD;
OutgoingFrames: DWORD;
IncomingCompressedBytes: DWORD;
OutgoingCompressedBy: DWORD;
WinStationName: array[0..31] of Shortint;
Domain: array[0..16] of Shortint;
UserName: array[0..20] of Shortint;
ConnectTime: Int64;
DisconnectTime: Int64;
LastInputTime: Int64;
LogonTime: Int64;
CurrentTime: Int64;
end;const WTSINFOA = extern struct {
State: i32,
SessionId: u32,
IncomingBytes: u32,
OutgoingBytes: u32,
IncomingFrames: u32,
OutgoingFrames: u32,
IncomingCompressedBytes: u32,
OutgoingCompressedBy: u32,
WinStationName: [32]i8,
Domain: [17]i8,
UserName: [21]i8,
ConnectTime: i64,
DisconnectTime: i64,
LastInputTime: i64,
LogonTime: i64,
CurrentTime: i64,
};type
WTSINFOA {.bycopy.} = object
State: int32
SessionId: uint32
IncomingBytes: uint32
OutgoingBytes: uint32
IncomingFrames: uint32
OutgoingFrames: uint32
IncomingCompressedBytes: uint32
OutgoingCompressedBy: uint32
WinStationName: array[32, int8]
Domain: array[17, int8]
UserName: array[21, int8]
ConnectTime: int64
DisconnectTime: int64
LastInputTime: int64
LogonTime: int64
CurrentTime: int64struct WTSINFOA
{
int State;
uint SessionId;
uint IncomingBytes;
uint OutgoingBytes;
uint IncomingFrames;
uint OutgoingFrames;
uint IncomingCompressedBytes;
uint OutgoingCompressedBy;
byte[32] WinStationName;
byte[17] Domain;
byte[21] UserName;
long ConnectTime;
long DisconnectTime;
long LastInputTime;
long LogonTime;
long CurrentTime;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WTSINFOA サイズ: 144 バイト(x64)
dim st, 36 ; 4byte整数×36(構造体サイズ 144 / 4 切り上げ)
; State : WTS_CONNECTSTATE_CLASS (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; SessionId : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; IncomingBytes : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; OutgoingBytes : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; IncomingFrames : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; OutgoingFrames : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; IncomingCompressedBytes : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; OutgoingCompressedBy : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; WinStationName : CHAR (+32, 32byte) varptr(st)+32 を基点に操作(32byte:入れ子/配列)
; Domain : CHAR (+64, 17byte) varptr(st)+64 を基点に操作(17byte:入れ子/配列)
; UserName : CHAR (+81, 21byte) varptr(st)+81 を基点に操作(21byte:入れ子/配列)
; ConnectTime : LONGLONG (+104, 8byte) qpoke st,104,値 / qpeek(st,104) ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; DisconnectTime : LONGLONG (+112, 8byte) qpoke st,112,値 / qpeek(st,112) ※IronHSPのみ。3.7/3.8は lpoke st,112,下位 : lpoke st,116,上位
; LastInputTime : LONGLONG (+120, 8byte) qpoke st,120,値 / qpeek(st,120) ※IronHSPのみ。3.7/3.8は lpoke st,120,下位 : lpoke st,124,上位
; LogonTime : LONGLONG (+128, 8byte) qpoke st,128,値 / qpeek(st,128) ※IronHSPのみ。3.7/3.8は lpoke st,128,下位 : lpoke st,132,上位
; CurrentTime : LONGLONG (+136, 8byte) qpoke st,136,値 / qpeek(st,136) ※IronHSPのみ。3.7/3.8は lpoke st,136,下位 : lpoke st,140,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WTSINFOA
#field int State
#field int SessionId
#field int IncomingBytes
#field int OutgoingBytes
#field int IncomingFrames
#field int OutgoingFrames
#field int IncomingCompressedBytes
#field int OutgoingCompressedBy
#field byte WinStationName 32
#field byte Domain 17
#field byte UserName 21
#field int64 ConnectTime
#field int64 DisconnectTime
#field int64 LastInputTime
#field int64 LogonTime
#field int64 CurrentTime
#endstruct
stdim st, WTSINFOA ; NSTRUCT 変数を確保
st->State = 100
mes "State=" + st->State