ホーム › System.RemoteDesktop › WTSINFOEX_LEVEL_A
WTSINFOEX_LEVEL_A
共用体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| WTSInfoExLevel1 | WTSINFOEX_LEVEL1_A | 152 | +0 | +0 | レベル1の拡張セッション情報(ANSI)。 |
各言語での定義
#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;
// WTSINFOEX_LEVEL_A (x64 152 / x86 152 バイト)
typedef struct WTSINFOEX_LEVEL_A {
WTSINFOEX_LEVEL1_A WTSInfoExLevel1;
} WTSINFOEX_LEVEL_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;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTSINFOEX_LEVEL_A
{
public WTSINFOEX_LEVEL1_A WTSInfoExLevel1;
}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 Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTSINFOEX_LEVEL_A
Public WTSInfoExLevel1 As WTSINFOEX_LEVEL1_A
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),
]
class WTSINFOEX_LEVEL_A(ctypes.Structure):
_fields_ = [
("WTSInfoExLevel1", WTSINFOEX_LEVEL1_A),
]#[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,
}
#[repr(C)]
pub struct WTSINFOEX_LEVEL_A {
pub WTSInfoExLevel1: WTSINFOEX_LEVEL1_A,
}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_LEVEL_A struct {
WTSInfoExLevel1 WTSINFOEX_LEVEL1_A
}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;
WTSINFOEX_LEVEL_A = record
WTSInfoExLevel1: WTSINFOEX_LEVEL1_A;
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,
};
const WTSINFOEX_LEVEL_A = extern struct {
WTSInfoExLevel1: WTSINFOEX_LEVEL1_A,
};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: uint32
WTSINFOEX_LEVEL_A {.bycopy.} = object
WTSInfoExLevel1: WTSINFOEX_LEVEL1_Astruct 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;
}
struct WTSINFOEX_LEVEL_A
{
WTSINFOEX_LEVEL1_A WTSInfoExLevel1;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WTSINFOEX_LEVEL_A サイズ: 152 バイト(x64)
dim st, 38 ; 4byte整数×38(構造体サイズ 152 / 4 切り上げ)
; WTSInfoExLevel1 : WTSINFOEX_LEVEL1_A (+0, 152byte) varptr(st)+0 を基点に操作(152byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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
#defstruct global WTSINFOEX_LEVEL_A
#field WTSINFOEX_LEVEL1_A WTSInfoExLevel1
#endstruct
stdim st, WTSINFOEX_LEVEL_A ; NSTRUCT 変数を確保