ホーム › System.RemoteDesktop › WTSCLIENTW
WTSCLIENTW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ClientName | WCHAR | 42 | +0 | +0 | クライアントコンピュータ名(Unicode)。 |
| Domain | WCHAR | 36 | +42 | +42 | クライアントのドメイン名(Unicode)。 |
| UserName | WCHAR | 42 | +78 | +78 | クライアントのユーザー名(Unicode)。 |
| WorkDirectory | WCHAR | 522 | +120 | +120 | 作業ディレクトリのパス(Unicode)。 |
| InitialProgram | WCHAR | 522 | +642 | +642 | 起動時に実行する初期プログラム(Unicode)。 |
| EncryptionLevel | BYTE | 1 | +1164 | +1164 | 接続の暗号化レベルを示す値。 |
| ClientAddressFamily | DWORD | 4 | +1168 | +1168 | クライアントアドレスのアドレスファミリ(AF_INET等)。 |
| ClientAddress | WORD | 62 | +1172 | +1172 | クライアントのネットワークアドレス(WORD配列)。 |
| HRes | WORD | 2 | +1234 | +1234 | クライアント表示の水平解像度。ピクセル数で表す。 |
| VRes | WORD | 2 | +1236 | +1236 | クライアント表示の垂直解像度。ピクセル数で表す。 |
| ColorDepth | WORD | 2 | +1238 | +1238 | クライアント表示の色深度を示す値。 |
| ClientDirectory | WCHAR | 522 | +1240 | +1240 | クライアントのインストールディレクトリ(Unicode)。 |
| ClientBuildNumber | DWORD | 4 | +1764 | +1764 | クライアントソフトウェアのビルド番号。 |
| ClientHardwareId | DWORD | 4 | +1768 | +1768 | クライアントのハードウェア識別子。 |
| ClientProductId | WORD | 2 | +1772 | +1772 | クライアントの製品識別子。 |
| OutBufCountHost | WORD | 2 | +1774 | +1774 | ホスト側の出力バッファ数。 |
| OutBufCountClient | WORD | 2 | +1776 | +1776 | クライアント側の出力バッファ数。 |
| OutBufLength | WORD | 2 | +1778 | +1778 | 出力バッファの長さ。バイト数で表す。 |
| DeviceId | WCHAR | 522 | +1780 | +1780 | クライアントデバイスの識別子(Unicode)。 |
各言語での定義
#include <windows.h>
// WTSCLIENTW (x64 2304 / x86 2304 バイト)
typedef struct WTSCLIENTW {
WCHAR ClientName[21];
WCHAR Domain[18];
WCHAR UserName[21];
WCHAR WorkDirectory[261];
WCHAR InitialProgram[261];
BYTE EncryptionLevel;
DWORD ClientAddressFamily;
WORD ClientAddress[31];
WORD HRes;
WORD VRes;
WORD ColorDepth;
WCHAR ClientDirectory[261];
DWORD ClientBuildNumber;
DWORD ClientHardwareId;
WORD ClientProductId;
WORD OutBufCountHost;
WORD OutBufCountClient;
WORD OutBufLength;
WCHAR DeviceId[261];
} WTSCLIENTW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTSCLIENTW
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 21)] public string ClientName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 18)] public string Domain;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 21)] public string UserName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 261)] public string WorkDirectory;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 261)] public string InitialProgram;
public byte EncryptionLevel;
public uint ClientAddressFamily;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] public ushort[] ClientAddress;
public ushort HRes;
public ushort VRes;
public ushort ColorDepth;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 261)] public string ClientDirectory;
public uint ClientBuildNumber;
public uint ClientHardwareId;
public ushort ClientProductId;
public ushort OutBufCountHost;
public ushort OutBufCountClient;
public ushort OutBufLength;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 261)] public string DeviceId;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTSCLIENTW
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=21)> Public ClientName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=18)> Public Domain As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=21)> Public UserName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=261)> Public WorkDirectory As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=261)> Public InitialProgram As String
Public EncryptionLevel As Byte
Public ClientAddressFamily As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=31)> Public ClientAddress() As UShort
Public HRes As UShort
Public VRes As UShort
Public ColorDepth As UShort
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=261)> Public ClientDirectory As String
Public ClientBuildNumber As UInteger
Public ClientHardwareId As UInteger
Public ClientProductId As UShort
Public OutBufCountHost As UShort
Public OutBufCountClient As UShort
Public OutBufLength As UShort
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=261)> Public DeviceId As String
End Structureimport ctypes
from ctypes import wintypes
class WTSCLIENTW(ctypes.Structure):
_fields_ = [
("ClientName", ctypes.c_wchar * 21),
("Domain", ctypes.c_wchar * 18),
("UserName", ctypes.c_wchar * 21),
("WorkDirectory", ctypes.c_wchar * 261),
("InitialProgram", ctypes.c_wchar * 261),
("EncryptionLevel", ctypes.c_ubyte),
("ClientAddressFamily", wintypes.DWORD),
("ClientAddress", ctypes.c_ushort * 31),
("HRes", ctypes.c_ushort),
("VRes", ctypes.c_ushort),
("ColorDepth", ctypes.c_ushort),
("ClientDirectory", ctypes.c_wchar * 261),
("ClientBuildNumber", wintypes.DWORD),
("ClientHardwareId", wintypes.DWORD),
("ClientProductId", ctypes.c_ushort),
("OutBufCountHost", ctypes.c_ushort),
("OutBufCountClient", ctypes.c_ushort),
("OutBufLength", ctypes.c_ushort),
("DeviceId", ctypes.c_wchar * 261),
]#[repr(C)]
pub struct WTSCLIENTW {
pub ClientName: [u16; 21],
pub Domain: [u16; 18],
pub UserName: [u16; 21],
pub WorkDirectory: [u16; 261],
pub InitialProgram: [u16; 261],
pub EncryptionLevel: u8,
pub ClientAddressFamily: u32,
pub ClientAddress: [u16; 31],
pub HRes: u16,
pub VRes: u16,
pub ColorDepth: u16,
pub ClientDirectory: [u16; 261],
pub ClientBuildNumber: u32,
pub ClientHardwareId: u32,
pub ClientProductId: u16,
pub OutBufCountHost: u16,
pub OutBufCountClient: u16,
pub OutBufLength: u16,
pub DeviceId: [u16; 261],
}import "golang.org/x/sys/windows"
type WTSCLIENTW struct {
ClientName [21]uint16
Domain [18]uint16
UserName [21]uint16
WorkDirectory [261]uint16
InitialProgram [261]uint16
EncryptionLevel byte
ClientAddressFamily uint32
ClientAddress [31]uint16
HRes uint16
VRes uint16
ColorDepth uint16
ClientDirectory [261]uint16
ClientBuildNumber uint32
ClientHardwareId uint32
ClientProductId uint16
OutBufCountHost uint16
OutBufCountClient uint16
OutBufLength uint16
DeviceId [261]uint16
}type
WTSCLIENTW = record
ClientName: array[0..20] of WideChar;
Domain: array[0..17] of WideChar;
UserName: array[0..20] of WideChar;
WorkDirectory: array[0..260] of WideChar;
InitialProgram: array[0..260] of WideChar;
EncryptionLevel: Byte;
ClientAddressFamily: DWORD;
ClientAddress: array[0..30] of Word;
HRes: Word;
VRes: Word;
ColorDepth: Word;
ClientDirectory: array[0..260] of WideChar;
ClientBuildNumber: DWORD;
ClientHardwareId: DWORD;
ClientProductId: Word;
OutBufCountHost: Word;
OutBufCountClient: Word;
OutBufLength: Word;
DeviceId: array[0..260] of WideChar;
end;const WTSCLIENTW = extern struct {
ClientName: [21]u16,
Domain: [18]u16,
UserName: [21]u16,
WorkDirectory: [261]u16,
InitialProgram: [261]u16,
EncryptionLevel: u8,
ClientAddressFamily: u32,
ClientAddress: [31]u16,
HRes: u16,
VRes: u16,
ColorDepth: u16,
ClientDirectory: [261]u16,
ClientBuildNumber: u32,
ClientHardwareId: u32,
ClientProductId: u16,
OutBufCountHost: u16,
OutBufCountClient: u16,
OutBufLength: u16,
DeviceId: [261]u16,
};type
WTSCLIENTW {.bycopy.} = object
ClientName: array[21, uint16]
Domain: array[18, uint16]
UserName: array[21, uint16]
WorkDirectory: array[261, uint16]
InitialProgram: array[261, uint16]
EncryptionLevel: uint8
ClientAddressFamily: uint32
ClientAddress: array[31, uint16]
HRes: uint16
VRes: uint16
ColorDepth: uint16
ClientDirectory: array[261, uint16]
ClientBuildNumber: uint32
ClientHardwareId: uint32
ClientProductId: uint16
OutBufCountHost: uint16
OutBufCountClient: uint16
OutBufLength: uint16
DeviceId: array[261, uint16]struct WTSCLIENTW
{
wchar[21] ClientName;
wchar[18] Domain;
wchar[21] UserName;
wchar[261] WorkDirectory;
wchar[261] InitialProgram;
ubyte EncryptionLevel;
uint ClientAddressFamily;
ushort[31] ClientAddress;
ushort HRes;
ushort VRes;
ushort ColorDepth;
wchar[261] ClientDirectory;
uint ClientBuildNumber;
uint ClientHardwareId;
ushort ClientProductId;
ushort OutBufCountHost;
ushort OutBufCountClient;
ushort OutBufLength;
wchar[261] DeviceId;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WTSCLIENTW サイズ: 2304 バイト(x64)
dim st, 576 ; 4byte整数×576(構造体サイズ 2304 / 4 切り上げ)
; ClientName : WCHAR (+0, 42byte) varptr(st)+0 を基点に操作(42byte:入れ子/配列)
; Domain : WCHAR (+42, 36byte) varptr(st)+42 を基点に操作(36byte:入れ子/配列)
; UserName : WCHAR (+78, 42byte) varptr(st)+78 を基点に操作(42byte:入れ子/配列)
; WorkDirectory : WCHAR (+120, 522byte) varptr(st)+120 を基点に操作(522byte:入れ子/配列)
; InitialProgram : WCHAR (+642, 522byte) varptr(st)+642 を基点に操作(522byte:入れ子/配列)
; EncryptionLevel : BYTE (+1164, 1byte) poke st,1164,値 / 値 = peek(st,1164)
; ClientAddressFamily : DWORD (+1168, 4byte) st.292 = 値 / 値 = st.292 (lpoke/lpeek も可)
; ClientAddress : WORD (+1172, 62byte) varptr(st)+1172 を基点に操作(62byte:入れ子/配列)
; HRes : WORD (+1234, 2byte) wpoke st,1234,値 / 値 = wpeek(st,1234)
; VRes : WORD (+1236, 2byte) wpoke st,1236,値 / 値 = wpeek(st,1236)
; ColorDepth : WORD (+1238, 2byte) wpoke st,1238,値 / 値 = wpeek(st,1238)
; ClientDirectory : WCHAR (+1240, 522byte) varptr(st)+1240 を基点に操作(522byte:入れ子/配列)
; ClientBuildNumber : DWORD (+1764, 4byte) st.441 = 値 / 値 = st.441 (lpoke/lpeek も可)
; ClientHardwareId : DWORD (+1768, 4byte) st.442 = 値 / 値 = st.442 (lpoke/lpeek も可)
; ClientProductId : WORD (+1772, 2byte) wpoke st,1772,値 / 値 = wpeek(st,1772)
; OutBufCountHost : WORD (+1774, 2byte) wpoke st,1774,値 / 値 = wpeek(st,1774)
; OutBufCountClient : WORD (+1776, 2byte) wpoke st,1776,値 / 値 = wpeek(st,1776)
; OutBufLength : WORD (+1778, 2byte) wpoke st,1778,値 / 値 = wpeek(st,1778)
; DeviceId : WCHAR (+1780, 522byte) varptr(st)+1780 を基点に操作(522byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WTSCLIENTW
#field wchar ClientName 21
#field wchar Domain 18
#field wchar UserName 21
#field wchar WorkDirectory 261
#field wchar InitialProgram 261
#field byte EncryptionLevel
#field int ClientAddressFamily
#field short ClientAddress 31
#field short HRes
#field short VRes
#field short ColorDepth
#field wchar ClientDirectory 261
#field int ClientBuildNumber
#field int ClientHardwareId
#field short ClientProductId
#field short OutBufCountHost
#field short OutBufCountClient
#field short OutBufLength
#field wchar DeviceId 261
#endstruct
stdim st, WTSCLIENTW ; NSTRUCT 変数を確保
st->EncryptionLevel = 100
mes "EncryptionLevel=" + st->EncryptionLevel