ホーム › System.RemoteDesktop › WTSINFOEX_LEVEL1_A
WTSINFOEX_LEVEL1_A
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| SessionId | DWORD | 4 | +0 | +0 | セッション識別子です。 |
| SessionState | WTS_CONNECTSTATE_CLASS | 4 | +4 | +4 | リモート デスクトップ サービス セッションの接続状態を指定する WTS_CONNECTSTATE_CLASS 列挙型の値です。 |
| SessionFlags | INT | 4 | +8 | +8 | セッションの状態です。次の値の 1 つ以上を指定できます。 WTS_SESSIONSTATE_UNKNOWN (4294967295 (0xFFFFFFFF))セッションの状態は不明です。 WTS_SESSIONSTATE_LOCK (0 (0x0))セッションはロックされています。 WTS_SESSIONSTATE_UNLOCK (1 (0x1))セッションのロックは解除されています。 Windows Server 2008 R2 および Windows 7: コードの不具合により、WTS_SESSIONSTATE_LOCK フラグと WTS_SESSIONSTATE_UNLOCK フラグの意味が逆になっています。つまり、WTS_SESSIONSTATE_LOCK はセッションのロックが解除されていることを示し、WTS_SESSIONSTATE_UNLOCK はセッションがロックされていることを示します。 |
| WinStationName | CHAR | 33 | +12 | +12 | セッションのウィンドウ ステーションの名前を格納する null 終端文字列です。 |
| UserName | CHAR | 21 | +45 | +45 | セッションを所有するユーザーの名前を格納する null 終端文字列です。 |
| DomainName | CHAR | 18 | +66 | +66 | ユーザーが属するドメインの名前を格納する null 終端文字列です。 |
| LogonTime | LONGLONG | 8 | +88 | +88 | ユーザーがセッションにログオンした時刻です。この値は、協定世界時 (グリニッジ標準時) の 1601 年 1 月 1 日からの 100 ナノ秒間隔の数を表す大きな整数として格納されます。 |
| ConnectTime | LONGLONG | 8 | +96 | +96 | クライアントがこのセッションに最後に接続した時刻です。この値は、協定世界時の 1601 年 1 月 1 日からの 100 ナノ秒間隔の数を表す大きな整数として格納されます。 |
| DisconnectTime | LONGLONG | 8 | +104 | +104 | クライアントがこのセッションから最後に切断した時刻です。この値は、協定世界時の 1601 年 1 月 1 日からの 100 ナノ秒間隔の数を表す大きな整数として格納されます。 |
| LastInputTime | LONGLONG | 8 | +112 | +112 | このセッションで最後にユーザー入力が行われた時刻です。この値は、協定世界時の 1601 年 1 月 1 日からの 100 ナノ秒間隔の数を表す大きな整数として格納されます。 |
| CurrentTime | LONGLONG | 8 | +120 | +120 | この構造体に情報が設定された時刻です。この値は、協定世界時の 1601 年 1 月 1 日からの 100 ナノ秒間隔の数を表す大きな整数として格納されます。 |
| IncomingBytes | DWORD | 4 | +128 | +128 | クライアントが接続してから、クライアントからサーバーへ送信された非圧縮のリモート デスクトップ プロトコル (RDP) データのバイト数です。 |
| OutgoingBytes | DWORD | 4 | +132 | +132 | クライアントが接続してから、サーバーからクライアントへ送信された非圧縮の RDP データのバイト数です。 |
| IncomingFrames | DWORD | 4 | +136 | +136 | クライアントが接続してから、クライアントからサーバーへ送信された RDP データのフレーム数です。 |
| OutgoingFrames | DWORD | 4 | +140 | +140 | クライアントが接続してから、サーバーからクライアントへ送信された RDP データのフレーム数です。 |
| IncomingCompressedBytes | DWORD | 4 | +144 | +144 | クライアントが接続してから、クライアントからサーバーへ送信された圧縮された RDP データのバイト数です。 |
| OutgoingCompressedBytes | DWORD | 4 | +148 | +148 | クライアントが接続してから、サーバーからクライアントへ送信された圧縮された RDP データのバイト数です。 |
公式ドキュメント
リモート デスクトップ サービス セッションに関する拡張情報を格納します。
出典・ライセンス: 上記「公式ドキュメント」の内容は 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>
// WTSINFOEX_LEVEL1_A (x64 152 / x86 152 バイト)
typedef struct WTSINFOEX_LEVEL1_A {
DWORD SessionId;
WTS_CONNECTSTATE_CLASS SessionState;
INT SessionFlags;
CHAR WinStationName[33];
CHAR UserName[21];
CHAR DomainName[18];
LONGLONG LogonTime;
LONGLONG ConnectTime;
LONGLONG DisconnectTime;
LONGLONG LastInputTime;
LONGLONG CurrentTime;
DWORD IncomingBytes;
DWORD OutgoingBytes;
DWORD IncomingFrames;
DWORD OutgoingFrames;
DWORD IncomingCompressedBytes;
DWORD OutgoingCompressedBytes;
} WTSINFOEX_LEVEL1_A;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTSINFOEX_LEVEL1_A
{
public uint SessionId;
public int SessionState;
public int SessionFlags;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 33)] public sbyte[] WinStationName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 21)] public sbyte[] UserName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] public sbyte[] DomainName;
public long LogonTime;
public long ConnectTime;
public long DisconnectTime;
public long LastInputTime;
public long CurrentTime;
public uint IncomingBytes;
public uint OutgoingBytes;
public uint IncomingFrames;
public uint OutgoingFrames;
public uint IncomingCompressedBytes;
public uint OutgoingCompressedBytes;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTSINFOEX_LEVEL1_A
Public SessionId As UInteger
Public SessionState As Integer
Public SessionFlags As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=33)> Public WinStationName() As SByte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=21)> Public UserName() As SByte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=18)> Public DomainName() As SByte
Public LogonTime As Long
Public ConnectTime As Long
Public DisconnectTime As Long
Public LastInputTime As Long
Public CurrentTime As Long
Public IncomingBytes As UInteger
Public OutgoingBytes As UInteger
Public IncomingFrames As UInteger
Public OutgoingFrames As UInteger
Public IncomingCompressedBytes As UInteger
Public OutgoingCompressedBytes As UInteger
End Structureimport ctypes
from ctypes import wintypes
class WTSINFOEX_LEVEL1_A(ctypes.Structure):
_fields_ = [
("SessionId", wintypes.DWORD),
("SessionState", ctypes.c_int),
("SessionFlags", ctypes.c_int),
("WinStationName", ctypes.c_byte * 33),
("UserName", ctypes.c_byte * 21),
("DomainName", ctypes.c_byte * 18),
("LogonTime", ctypes.c_longlong),
("ConnectTime", ctypes.c_longlong),
("DisconnectTime", ctypes.c_longlong),
("LastInputTime", ctypes.c_longlong),
("CurrentTime", ctypes.c_longlong),
("IncomingBytes", wintypes.DWORD),
("OutgoingBytes", wintypes.DWORD),
("IncomingFrames", wintypes.DWORD),
("OutgoingFrames", wintypes.DWORD),
("IncomingCompressedBytes", wintypes.DWORD),
("OutgoingCompressedBytes", wintypes.DWORD),
]#[repr(C)]
pub struct WTSINFOEX_LEVEL1_A {
pub SessionId: u32,
pub SessionState: i32,
pub SessionFlags: i32,
pub WinStationName: [i8; 33],
pub UserName: [i8; 21],
pub DomainName: [i8; 18],
pub LogonTime: i64,
pub ConnectTime: i64,
pub DisconnectTime: i64,
pub LastInputTime: i64,
pub CurrentTime: i64,
pub IncomingBytes: u32,
pub OutgoingBytes: u32,
pub IncomingFrames: u32,
pub OutgoingFrames: u32,
pub IncomingCompressedBytes: u32,
pub OutgoingCompressedBytes: u32,
}import "golang.org/x/sys/windows"
type WTSINFOEX_LEVEL1_A struct {
SessionId uint32
SessionState int32
SessionFlags int32
WinStationName [33]int8
UserName [21]int8
DomainName [18]int8
LogonTime int64
ConnectTime int64
DisconnectTime int64
LastInputTime int64
CurrentTime int64
IncomingBytes uint32
OutgoingBytes uint32
IncomingFrames uint32
OutgoingFrames uint32
IncomingCompressedBytes uint32
OutgoingCompressedBytes uint32
}type
WTSINFOEX_LEVEL1_A = record
SessionId: DWORD;
SessionState: Integer;
SessionFlags: Integer;
WinStationName: array[0..32] of Shortint;
UserName: array[0..20] of Shortint;
DomainName: array[0..17] of Shortint;
LogonTime: Int64;
ConnectTime: Int64;
DisconnectTime: Int64;
LastInputTime: Int64;
CurrentTime: Int64;
IncomingBytes: DWORD;
OutgoingBytes: DWORD;
IncomingFrames: DWORD;
OutgoingFrames: DWORD;
IncomingCompressedBytes: DWORD;
OutgoingCompressedBytes: DWORD;
end;const WTSINFOEX_LEVEL1_A = extern struct {
SessionId: u32,
SessionState: i32,
SessionFlags: i32,
WinStationName: [33]i8,
UserName: [21]i8,
DomainName: [18]i8,
LogonTime: i64,
ConnectTime: i64,
DisconnectTime: i64,
LastInputTime: i64,
CurrentTime: i64,
IncomingBytes: u32,
OutgoingBytes: u32,
IncomingFrames: u32,
OutgoingFrames: u32,
IncomingCompressedBytes: u32,
OutgoingCompressedBytes: u32,
};type
WTSINFOEX_LEVEL1_A {.bycopy.} = object
SessionId: uint32
SessionState: int32
SessionFlags: int32
WinStationName: array[33, int8]
UserName: array[21, int8]
DomainName: array[18, int8]
LogonTime: int64
ConnectTime: int64
DisconnectTime: int64
LastInputTime: int64
CurrentTime: int64
IncomingBytes: uint32
OutgoingBytes: uint32
IncomingFrames: uint32
OutgoingFrames: uint32
IncomingCompressedBytes: uint32
OutgoingCompressedBytes: uint32struct WTSINFOEX_LEVEL1_A
{
uint SessionId;
int SessionState;
int SessionFlags;
byte[33] WinStationName;
byte[21] UserName;
byte[18] DomainName;
long LogonTime;
long ConnectTime;
long DisconnectTime;
long LastInputTime;
long CurrentTime;
uint IncomingBytes;
uint OutgoingBytes;
uint IncomingFrames;
uint OutgoingFrames;
uint IncomingCompressedBytes;
uint OutgoingCompressedBytes;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WTSINFOEX_LEVEL1_A サイズ: 152 バイト(x64)
dim st, 38 ; 4byte整数×38(構造体サイズ 152 / 4 切り上げ)
; SessionId : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; SessionState : WTS_CONNECTSTATE_CLASS (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; SessionFlags : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; WinStationName : CHAR (+12, 33byte) varptr(st)+12 を基点に操作(33byte:入れ子/配列)
; UserName : CHAR (+45, 21byte) varptr(st)+45 を基点に操作(21byte:入れ子/配列)
; DomainName : CHAR (+66, 18byte) varptr(st)+66 を基点に操作(18byte:入れ子/配列)
; LogonTime : LONGLONG (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; ConnectTime : LONGLONG (+96, 8byte) qpoke st,96,値 / qpeek(st,96) ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; DisconnectTime : LONGLONG (+104, 8byte) qpoke st,104,値 / qpeek(st,104) ※IronHSPのみ。3.7/3.8は lpoke st,104,下位 : lpoke st,108,上位
; LastInputTime : LONGLONG (+112, 8byte) qpoke st,112,値 / qpeek(st,112) ※IronHSPのみ。3.7/3.8は lpoke st,112,下位 : lpoke st,116,上位
; CurrentTime : LONGLONG (+120, 8byte) qpoke st,120,値 / qpeek(st,120) ※IronHSPのみ。3.7/3.8は lpoke st,120,下位 : lpoke st,124,上位
; IncomingBytes : DWORD (+128, 4byte) st.32 = 値 / 値 = st.32 (lpoke/lpeek も可)
; OutgoingBytes : DWORD (+132, 4byte) st.33 = 値 / 値 = st.33 (lpoke/lpeek も可)
; IncomingFrames : DWORD (+136, 4byte) st.34 = 値 / 値 = st.34 (lpoke/lpeek も可)
; OutgoingFrames : DWORD (+140, 4byte) st.35 = 値 / 値 = st.35 (lpoke/lpeek も可)
; IncomingCompressedBytes : DWORD (+144, 4byte) st.36 = 値 / 値 = st.36 (lpoke/lpeek も可)
; OutgoingCompressedBytes : DWORD (+148, 4byte) st.37 = 値 / 値 = st.37 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WTSINFOEX_LEVEL1_A
#field int SessionId
#field int SessionState
#field int SessionFlags
#field byte WinStationName 33
#field byte UserName 21
#field byte DomainName 18
#field int64 LogonTime
#field int64 ConnectTime
#field int64 DisconnectTime
#field int64 LastInputTime
#field int64 CurrentTime
#field int IncomingBytes
#field int OutgoingBytes
#field int IncomingFrames
#field int OutgoingFrames
#field int IncomingCompressedBytes
#field int OutgoingCompressedBytes
#endstruct
stdim st, WTSINFOEX_LEVEL1_A ; NSTRUCT 変数を確保
st->SessionId = 100
mes "SessionId=" + st->SessionId