Win32 API 日本語リファレンス
ホームSystem.RemoteDesktop › WRDS_CONNECTION_SETTINGS

WRDS_CONNECTION_SETTINGS

構造体
サイズx64: 3760 バイト / x86: 3724 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
WRdsConnectionSettingLevelWRDS_CONNECTION_SETTING_LEVEL4+0+0接続設定のレベルを示す列挙値。共用体の解釈を決める。
WRdsConnectionSettingWRDS_CONNECTION_SETTING3752/3720+8+4レベルに応じた接続設定本体。WRDS_CONNECTION_SETTING共用体。

各言語での定義

#include <windows.h>

// WTS_SOCKADDR  (x64 16 / x86 8 バイト)
typedef struct WTS_SOCKADDR {
    WORD sin_family;
    _u_e__Union u;
} WTS_SOCKADDR;

// WTS_SYSTEMTIME  (x64 16 / x86 16 バイト)
typedef struct WTS_SYSTEMTIME {
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} WTS_SYSTEMTIME;

// WTS_TIME_ZONE_INFORMATION  (x64 172 / x86 172 バイト)
typedef struct WTS_TIME_ZONE_INFORMATION {
    INT Bias;
    WCHAR StandardName[32];
    WTS_SYSTEMTIME StandardDate;
    INT StandardBias;
    WCHAR DaylightName[32];
    WTS_SYSTEMTIME DaylightDate;
    INT DaylightBias;
} WTS_TIME_ZONE_INFORMATION;

// WRDS_LISTENER_SETTINGS_1  (x64 16 / x86 12 バイト)
typedef struct WRDS_LISTENER_SETTINGS_1 {
    DWORD MaxProtocolListenerConnectionCount;
    DWORD SecurityDescriptorSize;
    BYTE* pSecurityDescriptor;
} WRDS_LISTENER_SETTINGS_1;

// WRDS_LISTENER_SETTING  (x64 16 / x86 12 バイト)
typedef struct WRDS_LISTENER_SETTING {
    WRDS_LISTENER_SETTINGS_1 WRdsListenerSettings1;
} WRDS_LISTENER_SETTING;

// WRDS_LISTENER_SETTINGS  (x64 24 / x86 16 バイト)
typedef struct WRDS_LISTENER_SETTINGS {
    WRDS_LISTENER_SETTING_LEVEL WRdsListenerSettingLevel;
    WRDS_LISTENER_SETTING WRdsListenerSetting;
} WRDS_LISTENER_SETTINGS;

// WRDS_CONNECTION_SETTINGS_1  (x64 3752 / x86 3720 バイト)
typedef struct WRDS_CONNECTION_SETTINGS_1 {
    BOOLEAN fInheritInitialProgram;
    BOOLEAN fInheritColorDepth;
    BOOLEAN fHideTitleBar;
    BOOLEAN fInheritAutoLogon;
    BOOLEAN fMaximizeShell;
    BOOLEAN fDisablePNP;
    BOOLEAN fPasswordIsScPin;
    BOOLEAN fPromptForPassword;
    BOOLEAN fDisableCpm;
    BOOLEAN fDisableCdm;
    BOOLEAN fDisableCcm;
    BOOLEAN fDisableLPT;
    BOOLEAN fDisableClip;
    BOOLEAN fResetBroken;
    BOOLEAN fDisableEncryption;
    BOOLEAN fDisableAutoReconnect;
    BOOLEAN fDisableCtrlAltDel;
    BOOLEAN fDoubleClickDetect;
    BOOLEAN fEnableWindowsKey;
    BOOLEAN fUsingSavedCreds;
    BOOLEAN fMouse;
    BOOLEAN fNoAudioPlayback;
    BOOLEAN fRemoteConsoleAudio;
    BYTE EncryptionLevel;
    WORD ColorDepth;
    WORD ProtocolType;
    WORD HRes;
    WORD VRes;
    WORD ClientProductId;
    WORD OutBufCountHost;
    WORD OutBufCountClient;
    WORD OutBufLength;
    DWORD KeyboardLayout;
    DWORD MaxConnectionTime;
    DWORD MaxDisconnectionTime;
    DWORD MaxIdleTime;
    DWORD PerformanceFlags;
    DWORD KeyboardType;
    DWORD KeyboardSubType;
    DWORD KeyboardFunctionKey;
    DWORD ActiveInputLocale;
    DWORD SerialNumber;
    DWORD ClientAddressFamily;
    DWORD ClientBuildNumber;
    DWORD ClientSessionId;
    WCHAR WorkDirectory[257];
    WCHAR InitialProgram[257];
    WCHAR UserName[256];
    WCHAR Domain[256];
    WCHAR Password[256];
    WCHAR ProtocolName[9];
    WCHAR DisplayDriverName[9];
    WCHAR DisplayDeviceName[20];
    WCHAR imeFileName[33];
    WCHAR AudioDriverName[9];
    WCHAR ClientName[21];
    WCHAR ClientAddress[31];
    WCHAR ClientDirectory[257];
    WCHAR ClientDigProductId[33];
    WTS_SOCKADDR ClientSockAddress;
    WTS_TIME_ZONE_INFORMATION ClientTimeZone;
    WRDS_LISTENER_SETTINGS WRdsListenerSettings;
    GUID EventLogActivityId;
    DWORD ContextSize;
    BYTE* ContextData;
} WRDS_CONNECTION_SETTINGS_1;

// WRDS_CONNECTION_SETTING  (x64 3752 / x86 3720 バイト)
typedef struct WRDS_CONNECTION_SETTING {
    WRDS_CONNECTION_SETTINGS_1 WRdsConnectionSettings1;
} WRDS_CONNECTION_SETTING;

// WRDS_CONNECTION_SETTINGS  (x64 3760 / x86 3724 バイト)
typedef struct WRDS_CONNECTION_SETTINGS {
    WRDS_CONNECTION_SETTING_LEVEL WRdsConnectionSettingLevel;
    WRDS_CONNECTION_SETTING WRdsConnectionSetting;
} WRDS_CONNECTION_SETTINGS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTS_SOCKADDR
{
    public ushort sin_family;
    public _u_e__Union u;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTS_SYSTEMTIME
{
    public ushort wYear;
    public ushort wMonth;
    public ushort wDayOfWeek;
    public ushort wDay;
    public ushort wHour;
    public ushort wMinute;
    public ushort wSecond;
    public ushort wMilliseconds;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTS_TIME_ZONE_INFORMATION
{
    public int Bias;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string StandardName;
    public WTS_SYSTEMTIME StandardDate;
    public int StandardBias;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string DaylightName;
    public WTS_SYSTEMTIME DaylightDate;
    public int DaylightBias;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WRDS_LISTENER_SETTINGS_1
{
    public uint MaxProtocolListenerConnectionCount;
    public uint SecurityDescriptorSize;
    public IntPtr pSecurityDescriptor;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WRDS_LISTENER_SETTING
{
    public WRDS_LISTENER_SETTINGS_1 WRdsListenerSettings1;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WRDS_LISTENER_SETTINGS
{
    public int WRdsListenerSettingLevel;
    public WRDS_LISTENER_SETTING WRdsListenerSetting;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WRDS_CONNECTION_SETTINGS_1
{
    [MarshalAs(UnmanagedType.U1)] public bool fInheritInitialProgram;
    [MarshalAs(UnmanagedType.U1)] public bool fInheritColorDepth;
    [MarshalAs(UnmanagedType.U1)] public bool fHideTitleBar;
    [MarshalAs(UnmanagedType.U1)] public bool fInheritAutoLogon;
    [MarshalAs(UnmanagedType.U1)] public bool fMaximizeShell;
    [MarshalAs(UnmanagedType.U1)] public bool fDisablePNP;
    [MarshalAs(UnmanagedType.U1)] public bool fPasswordIsScPin;
    [MarshalAs(UnmanagedType.U1)] public bool fPromptForPassword;
    [MarshalAs(UnmanagedType.U1)] public bool fDisableCpm;
    [MarshalAs(UnmanagedType.U1)] public bool fDisableCdm;
    [MarshalAs(UnmanagedType.U1)] public bool fDisableCcm;
    [MarshalAs(UnmanagedType.U1)] public bool fDisableLPT;
    [MarshalAs(UnmanagedType.U1)] public bool fDisableClip;
    [MarshalAs(UnmanagedType.U1)] public bool fResetBroken;
    [MarshalAs(UnmanagedType.U1)] public bool fDisableEncryption;
    [MarshalAs(UnmanagedType.U1)] public bool fDisableAutoReconnect;
    [MarshalAs(UnmanagedType.U1)] public bool fDisableCtrlAltDel;
    [MarshalAs(UnmanagedType.U1)] public bool fDoubleClickDetect;
    [MarshalAs(UnmanagedType.U1)] public bool fEnableWindowsKey;
    [MarshalAs(UnmanagedType.U1)] public bool fUsingSavedCreds;
    [MarshalAs(UnmanagedType.U1)] public bool fMouse;
    [MarshalAs(UnmanagedType.U1)] public bool fNoAudioPlayback;
    [MarshalAs(UnmanagedType.U1)] public bool fRemoteConsoleAudio;
    public byte EncryptionLevel;
    public ushort ColorDepth;
    public ushort ProtocolType;
    public ushort HRes;
    public ushort VRes;
    public ushort ClientProductId;
    public ushort OutBufCountHost;
    public ushort OutBufCountClient;
    public ushort OutBufLength;
    public uint KeyboardLayout;
    public uint MaxConnectionTime;
    public uint MaxDisconnectionTime;
    public uint MaxIdleTime;
    public uint PerformanceFlags;
    public uint KeyboardType;
    public uint KeyboardSubType;
    public uint KeyboardFunctionKey;
    public uint ActiveInputLocale;
    public uint SerialNumber;
    public uint ClientAddressFamily;
    public uint ClientBuildNumber;
    public uint ClientSessionId;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 257)] public string WorkDirectory;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 257)] public string InitialProgram;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string UserName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string Domain;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string Password;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 9)] public string ProtocolName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 9)] public string DisplayDriverName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] public string DisplayDeviceName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)] public string imeFileName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 9)] public string AudioDriverName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 21)] public string ClientName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)] public string ClientAddress;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 257)] public string ClientDirectory;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)] public string ClientDigProductId;
    public WTS_SOCKADDR ClientSockAddress;
    public WTS_TIME_ZONE_INFORMATION ClientTimeZone;
    public WRDS_LISTENER_SETTINGS WRdsListenerSettings;
    public Guid EventLogActivityId;
    public uint ContextSize;
    public IntPtr ContextData;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WRDS_CONNECTION_SETTING
{
    public WRDS_CONNECTION_SETTINGS_1 WRdsConnectionSettings1;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WRDS_CONNECTION_SETTINGS
{
    public int WRdsConnectionSettingLevel;
    public WRDS_CONNECTION_SETTING WRdsConnectionSetting;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTS_SOCKADDR
    Public sin_family As UShort
    Public u As _u_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTS_SYSTEMTIME
    Public wYear As UShort
    Public wMonth As UShort
    Public wDayOfWeek As UShort
    Public wDay As UShort
    Public wHour As UShort
    Public wMinute As UShort
    Public wSecond As UShort
    Public wMilliseconds As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTS_TIME_ZONE_INFORMATION
    Public Bias As Integer
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> Public StandardName As String
    Public StandardDate As WTS_SYSTEMTIME
    Public StandardBias As Integer
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> Public DaylightName As String
    Public DaylightDate As WTS_SYSTEMTIME
    Public DaylightBias As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WRDS_LISTENER_SETTINGS_1
    Public MaxProtocolListenerConnectionCount As UInteger
    Public SecurityDescriptorSize As UInteger
    Public pSecurityDescriptor As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WRDS_LISTENER_SETTING
    Public WRdsListenerSettings1 As WRDS_LISTENER_SETTINGS_1
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WRDS_LISTENER_SETTINGS
    Public WRdsListenerSettingLevel As Integer
    Public WRdsListenerSetting As WRDS_LISTENER_SETTING
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WRDS_CONNECTION_SETTINGS_1
    <MarshalAs(UnmanagedType.U1)> Public fInheritInitialProgram As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fInheritColorDepth As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fHideTitleBar As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fInheritAutoLogon As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fMaximizeShell As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fDisablePNP As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fPasswordIsScPin As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fPromptForPassword As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fDisableCpm As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fDisableCdm As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fDisableCcm As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fDisableLPT As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fDisableClip As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fResetBroken As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fDisableEncryption As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fDisableAutoReconnect As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fDisableCtrlAltDel As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fDoubleClickDetect As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fEnableWindowsKey As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fUsingSavedCreds As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fMouse As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fNoAudioPlayback As Boolean
    <MarshalAs(UnmanagedType.U1)> Public fRemoteConsoleAudio As Boolean
    Public EncryptionLevel As Byte
    Public ColorDepth As UShort
    Public ProtocolType As UShort
    Public HRes As UShort
    Public VRes As UShort
    Public ClientProductId As UShort
    Public OutBufCountHost As UShort
    Public OutBufCountClient As UShort
    Public OutBufLength As UShort
    Public KeyboardLayout As UInteger
    Public MaxConnectionTime As UInteger
    Public MaxDisconnectionTime As UInteger
    Public MaxIdleTime As UInteger
    Public PerformanceFlags As UInteger
    Public KeyboardType As UInteger
    Public KeyboardSubType As UInteger
    Public KeyboardFunctionKey As UInteger
    Public ActiveInputLocale As UInteger
    Public SerialNumber As UInteger
    Public ClientAddressFamily As UInteger
    Public ClientBuildNumber As UInteger
    Public ClientSessionId As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=257)> Public WorkDirectory As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=257)> Public InitialProgram As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public UserName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public Domain As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public Password As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=9)> Public ProtocolName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=9)> Public DisplayDriverName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=20)> Public DisplayDeviceName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=33)> Public imeFileName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=9)> Public AudioDriverName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=21)> Public ClientName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=31)> Public ClientAddress As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=257)> Public ClientDirectory As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=33)> Public ClientDigProductId As String
    Public ClientSockAddress As WTS_SOCKADDR
    Public ClientTimeZone As WTS_TIME_ZONE_INFORMATION
    Public WRdsListenerSettings As WRDS_LISTENER_SETTINGS
    Public EventLogActivityId As Guid
    Public ContextSize As UInteger
    Public ContextData As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WRDS_CONNECTION_SETTING
    Public WRdsConnectionSettings1 As WRDS_CONNECTION_SETTINGS_1
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WRDS_CONNECTION_SETTINGS
    Public WRdsConnectionSettingLevel As Integer
    Public WRdsConnectionSetting As WRDS_CONNECTION_SETTING
End Structure
import ctypes
from ctypes import wintypes

class WTS_SOCKADDR(ctypes.Structure):
    _fields_ = [
        ("sin_family", ctypes.c_ushort),
        ("u", _u_e__Union),
    ]

class WTS_SYSTEMTIME(ctypes.Structure):
    _fields_ = [
        ("wYear", ctypes.c_ushort),
        ("wMonth", ctypes.c_ushort),
        ("wDayOfWeek", ctypes.c_ushort),
        ("wDay", ctypes.c_ushort),
        ("wHour", ctypes.c_ushort),
        ("wMinute", ctypes.c_ushort),
        ("wSecond", ctypes.c_ushort),
        ("wMilliseconds", ctypes.c_ushort),
    ]

class WTS_TIME_ZONE_INFORMATION(ctypes.Structure):
    _fields_ = [
        ("Bias", ctypes.c_int),
        ("StandardName", ctypes.c_wchar * 32),
        ("StandardDate", WTS_SYSTEMTIME),
        ("StandardBias", ctypes.c_int),
        ("DaylightName", ctypes.c_wchar * 32),
        ("DaylightDate", WTS_SYSTEMTIME),
        ("DaylightBias", ctypes.c_int),
    ]

class WRDS_LISTENER_SETTINGS_1(ctypes.Structure):
    _fields_ = [
        ("MaxProtocolListenerConnectionCount", wintypes.DWORD),
        ("SecurityDescriptorSize", wintypes.DWORD),
        ("pSecurityDescriptor", ctypes.c_void_p),
    ]

class WRDS_LISTENER_SETTING(ctypes.Structure):
    _fields_ = [
        ("WRdsListenerSettings1", WRDS_LISTENER_SETTINGS_1),
    ]

class WRDS_LISTENER_SETTINGS(ctypes.Structure):
    _fields_ = [
        ("WRdsListenerSettingLevel", ctypes.c_int),
        ("WRdsListenerSetting", WRDS_LISTENER_SETTING),
    ]

class WRDS_CONNECTION_SETTINGS_1(ctypes.Structure):
    _fields_ = [
        ("fInheritInitialProgram", ctypes.c_byte),
        ("fInheritColorDepth", ctypes.c_byte),
        ("fHideTitleBar", ctypes.c_byte),
        ("fInheritAutoLogon", ctypes.c_byte),
        ("fMaximizeShell", ctypes.c_byte),
        ("fDisablePNP", ctypes.c_byte),
        ("fPasswordIsScPin", ctypes.c_byte),
        ("fPromptForPassword", ctypes.c_byte),
        ("fDisableCpm", ctypes.c_byte),
        ("fDisableCdm", ctypes.c_byte),
        ("fDisableCcm", ctypes.c_byte),
        ("fDisableLPT", ctypes.c_byte),
        ("fDisableClip", ctypes.c_byte),
        ("fResetBroken", ctypes.c_byte),
        ("fDisableEncryption", ctypes.c_byte),
        ("fDisableAutoReconnect", ctypes.c_byte),
        ("fDisableCtrlAltDel", ctypes.c_byte),
        ("fDoubleClickDetect", ctypes.c_byte),
        ("fEnableWindowsKey", ctypes.c_byte),
        ("fUsingSavedCreds", ctypes.c_byte),
        ("fMouse", ctypes.c_byte),
        ("fNoAudioPlayback", ctypes.c_byte),
        ("fRemoteConsoleAudio", ctypes.c_byte),
        ("EncryptionLevel", ctypes.c_ubyte),
        ("ColorDepth", ctypes.c_ushort),
        ("ProtocolType", ctypes.c_ushort),
        ("HRes", ctypes.c_ushort),
        ("VRes", ctypes.c_ushort),
        ("ClientProductId", ctypes.c_ushort),
        ("OutBufCountHost", ctypes.c_ushort),
        ("OutBufCountClient", ctypes.c_ushort),
        ("OutBufLength", ctypes.c_ushort),
        ("KeyboardLayout", wintypes.DWORD),
        ("MaxConnectionTime", wintypes.DWORD),
        ("MaxDisconnectionTime", wintypes.DWORD),
        ("MaxIdleTime", wintypes.DWORD),
        ("PerformanceFlags", wintypes.DWORD),
        ("KeyboardType", wintypes.DWORD),
        ("KeyboardSubType", wintypes.DWORD),
        ("KeyboardFunctionKey", wintypes.DWORD),
        ("ActiveInputLocale", wintypes.DWORD),
        ("SerialNumber", wintypes.DWORD),
        ("ClientAddressFamily", wintypes.DWORD),
        ("ClientBuildNumber", wintypes.DWORD),
        ("ClientSessionId", wintypes.DWORD),
        ("WorkDirectory", ctypes.c_wchar * 257),
        ("InitialProgram", ctypes.c_wchar * 257),
        ("UserName", ctypes.c_wchar * 256),
        ("Domain", ctypes.c_wchar * 256),
        ("Password", ctypes.c_wchar * 256),
        ("ProtocolName", ctypes.c_wchar * 9),
        ("DisplayDriverName", ctypes.c_wchar * 9),
        ("DisplayDeviceName", ctypes.c_wchar * 20),
        ("imeFileName", ctypes.c_wchar * 33),
        ("AudioDriverName", ctypes.c_wchar * 9),
        ("ClientName", ctypes.c_wchar * 21),
        ("ClientAddress", ctypes.c_wchar * 31),
        ("ClientDirectory", ctypes.c_wchar * 257),
        ("ClientDigProductId", ctypes.c_wchar * 33),
        ("ClientSockAddress", WTS_SOCKADDR),
        ("ClientTimeZone", WTS_TIME_ZONE_INFORMATION),
        ("WRdsListenerSettings", WRDS_LISTENER_SETTINGS),
        ("EventLogActivityId", GUID),
        ("ContextSize", wintypes.DWORD),
        ("ContextData", ctypes.c_void_p),
    ]

class WRDS_CONNECTION_SETTING(ctypes.Structure):
    _fields_ = [
        ("WRdsConnectionSettings1", WRDS_CONNECTION_SETTINGS_1),
    ]

class WRDS_CONNECTION_SETTINGS(ctypes.Structure):
    _fields_ = [
        ("WRdsConnectionSettingLevel", ctypes.c_int),
        ("WRdsConnectionSetting", WRDS_CONNECTION_SETTING),
    ]
#[repr(C)]
pub struct WTS_SOCKADDR {
    pub sin_family: u16,
    pub u: _u_e__Union,
}

#[repr(C)]
pub struct WTS_SYSTEMTIME {
    pub wYear: u16,
    pub wMonth: u16,
    pub wDayOfWeek: u16,
    pub wDay: u16,
    pub wHour: u16,
    pub wMinute: u16,
    pub wSecond: u16,
    pub wMilliseconds: u16,
}

#[repr(C)]
pub struct WTS_TIME_ZONE_INFORMATION {
    pub Bias: i32,
    pub StandardName: [u16; 32],
    pub StandardDate: WTS_SYSTEMTIME,
    pub StandardBias: i32,
    pub DaylightName: [u16; 32],
    pub DaylightDate: WTS_SYSTEMTIME,
    pub DaylightBias: i32,
}

#[repr(C)]
pub struct WRDS_LISTENER_SETTINGS_1 {
    pub MaxProtocolListenerConnectionCount: u32,
    pub SecurityDescriptorSize: u32,
    pub pSecurityDescriptor: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct WRDS_LISTENER_SETTING {
    pub WRdsListenerSettings1: WRDS_LISTENER_SETTINGS_1,
}

#[repr(C)]
pub struct WRDS_LISTENER_SETTINGS {
    pub WRdsListenerSettingLevel: i32,
    pub WRdsListenerSetting: WRDS_LISTENER_SETTING,
}

#[repr(C)]
pub struct WRDS_CONNECTION_SETTINGS_1 {
    pub fInheritInitialProgram: u8,
    pub fInheritColorDepth: u8,
    pub fHideTitleBar: u8,
    pub fInheritAutoLogon: u8,
    pub fMaximizeShell: u8,
    pub fDisablePNP: u8,
    pub fPasswordIsScPin: u8,
    pub fPromptForPassword: u8,
    pub fDisableCpm: u8,
    pub fDisableCdm: u8,
    pub fDisableCcm: u8,
    pub fDisableLPT: u8,
    pub fDisableClip: u8,
    pub fResetBroken: u8,
    pub fDisableEncryption: u8,
    pub fDisableAutoReconnect: u8,
    pub fDisableCtrlAltDel: u8,
    pub fDoubleClickDetect: u8,
    pub fEnableWindowsKey: u8,
    pub fUsingSavedCreds: u8,
    pub fMouse: u8,
    pub fNoAudioPlayback: u8,
    pub fRemoteConsoleAudio: u8,
    pub EncryptionLevel: u8,
    pub ColorDepth: u16,
    pub ProtocolType: u16,
    pub HRes: u16,
    pub VRes: u16,
    pub ClientProductId: u16,
    pub OutBufCountHost: u16,
    pub OutBufCountClient: u16,
    pub OutBufLength: u16,
    pub KeyboardLayout: u32,
    pub MaxConnectionTime: u32,
    pub MaxDisconnectionTime: u32,
    pub MaxIdleTime: u32,
    pub PerformanceFlags: u32,
    pub KeyboardType: u32,
    pub KeyboardSubType: u32,
    pub KeyboardFunctionKey: u32,
    pub ActiveInputLocale: u32,
    pub SerialNumber: u32,
    pub ClientAddressFamily: u32,
    pub ClientBuildNumber: u32,
    pub ClientSessionId: u32,
    pub WorkDirectory: [u16; 257],
    pub InitialProgram: [u16; 257],
    pub UserName: [u16; 256],
    pub Domain: [u16; 256],
    pub Password: [u16; 256],
    pub ProtocolName: [u16; 9],
    pub DisplayDriverName: [u16; 9],
    pub DisplayDeviceName: [u16; 20],
    pub imeFileName: [u16; 33],
    pub AudioDriverName: [u16; 9],
    pub ClientName: [u16; 21],
    pub ClientAddress: [u16; 31],
    pub ClientDirectory: [u16; 257],
    pub ClientDigProductId: [u16; 33],
    pub ClientSockAddress: WTS_SOCKADDR,
    pub ClientTimeZone: WTS_TIME_ZONE_INFORMATION,
    pub WRdsListenerSettings: WRDS_LISTENER_SETTINGS,
    pub EventLogActivityId: GUID,
    pub ContextSize: u32,
    pub ContextData: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct WRDS_CONNECTION_SETTING {
    pub WRdsConnectionSettings1: WRDS_CONNECTION_SETTINGS_1,
}

#[repr(C)]
pub struct WRDS_CONNECTION_SETTINGS {
    pub WRdsConnectionSettingLevel: i32,
    pub WRdsConnectionSetting: WRDS_CONNECTION_SETTING,
}
import "golang.org/x/sys/windows"

type WTS_SOCKADDR struct {
	sin_family uint16
	u _u_e__Union
}

type WTS_SYSTEMTIME struct {
	wYear uint16
	wMonth uint16
	wDayOfWeek uint16
	wDay uint16
	wHour uint16
	wMinute uint16
	wSecond uint16
	wMilliseconds uint16
}

type WTS_TIME_ZONE_INFORMATION struct {
	Bias int32
	StandardName [32]uint16
	StandardDate WTS_SYSTEMTIME
	StandardBias int32
	DaylightName [32]uint16
	DaylightDate WTS_SYSTEMTIME
	DaylightBias int32
}

type WRDS_LISTENER_SETTINGS_1 struct {
	MaxProtocolListenerConnectionCount uint32
	SecurityDescriptorSize uint32
	pSecurityDescriptor uintptr
}

type WRDS_LISTENER_SETTING struct {
	WRdsListenerSettings1 WRDS_LISTENER_SETTINGS_1
}

type WRDS_LISTENER_SETTINGS struct {
	WRdsListenerSettingLevel int32
	WRdsListenerSetting WRDS_LISTENER_SETTING
}

type WRDS_CONNECTION_SETTINGS_1 struct {
	fInheritInitialProgram byte
	fInheritColorDepth byte
	fHideTitleBar byte
	fInheritAutoLogon byte
	fMaximizeShell byte
	fDisablePNP byte
	fPasswordIsScPin byte
	fPromptForPassword byte
	fDisableCpm byte
	fDisableCdm byte
	fDisableCcm byte
	fDisableLPT byte
	fDisableClip byte
	fResetBroken byte
	fDisableEncryption byte
	fDisableAutoReconnect byte
	fDisableCtrlAltDel byte
	fDoubleClickDetect byte
	fEnableWindowsKey byte
	fUsingSavedCreds byte
	fMouse byte
	fNoAudioPlayback byte
	fRemoteConsoleAudio byte
	EncryptionLevel byte
	ColorDepth uint16
	ProtocolType uint16
	HRes uint16
	VRes uint16
	ClientProductId uint16
	OutBufCountHost uint16
	OutBufCountClient uint16
	OutBufLength uint16
	KeyboardLayout uint32
	MaxConnectionTime uint32
	MaxDisconnectionTime uint32
	MaxIdleTime uint32
	PerformanceFlags uint32
	KeyboardType uint32
	KeyboardSubType uint32
	KeyboardFunctionKey uint32
	ActiveInputLocale uint32
	SerialNumber uint32
	ClientAddressFamily uint32
	ClientBuildNumber uint32
	ClientSessionId uint32
	WorkDirectory [257]uint16
	InitialProgram [257]uint16
	UserName [256]uint16
	Domain [256]uint16
	Password [256]uint16
	ProtocolName [9]uint16
	DisplayDriverName [9]uint16
	DisplayDeviceName [20]uint16
	imeFileName [33]uint16
	AudioDriverName [9]uint16
	ClientName [21]uint16
	ClientAddress [31]uint16
	ClientDirectory [257]uint16
	ClientDigProductId [33]uint16
	ClientSockAddress WTS_SOCKADDR
	ClientTimeZone WTS_TIME_ZONE_INFORMATION
	WRdsListenerSettings WRDS_LISTENER_SETTINGS
	EventLogActivityId windows.GUID
	ContextSize uint32
	ContextData uintptr
}

type WRDS_CONNECTION_SETTING struct {
	WRdsConnectionSettings1 WRDS_CONNECTION_SETTINGS_1
}

type WRDS_CONNECTION_SETTINGS struct {
	WRdsConnectionSettingLevel int32
	WRdsConnectionSetting WRDS_CONNECTION_SETTING
}
type
  WTS_SOCKADDR = record
    sin_family: Word;
    u: _u_e__Union;
  end;

  WTS_SYSTEMTIME = record
    wYear: Word;
    wMonth: Word;
    wDayOfWeek: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
  end;

  WTS_TIME_ZONE_INFORMATION = record
    Bias: Integer;
    StandardName: array[0..31] of WideChar;
    StandardDate: WTS_SYSTEMTIME;
    StandardBias: Integer;
    DaylightName: array[0..31] of WideChar;
    DaylightDate: WTS_SYSTEMTIME;
    DaylightBias: Integer;
  end;

  WRDS_LISTENER_SETTINGS_1 = record
    MaxProtocolListenerConnectionCount: DWORD;
    SecurityDescriptorSize: DWORD;
    pSecurityDescriptor: Pointer;
  end;

  WRDS_LISTENER_SETTING = record
    WRdsListenerSettings1: WRDS_LISTENER_SETTINGS_1;
  end;

  WRDS_LISTENER_SETTINGS = record
    WRdsListenerSettingLevel: Integer;
    WRdsListenerSetting: WRDS_LISTENER_SETTING;
  end;

  WRDS_CONNECTION_SETTINGS_1 = record
    fInheritInitialProgram: ByteBool;
    fInheritColorDepth: ByteBool;
    fHideTitleBar: ByteBool;
    fInheritAutoLogon: ByteBool;
    fMaximizeShell: ByteBool;
    fDisablePNP: ByteBool;
    fPasswordIsScPin: ByteBool;
    fPromptForPassword: ByteBool;
    fDisableCpm: ByteBool;
    fDisableCdm: ByteBool;
    fDisableCcm: ByteBool;
    fDisableLPT: ByteBool;
    fDisableClip: ByteBool;
    fResetBroken: ByteBool;
    fDisableEncryption: ByteBool;
    fDisableAutoReconnect: ByteBool;
    fDisableCtrlAltDel: ByteBool;
    fDoubleClickDetect: ByteBool;
    fEnableWindowsKey: ByteBool;
    fUsingSavedCreds: ByteBool;
    fMouse: ByteBool;
    fNoAudioPlayback: ByteBool;
    fRemoteConsoleAudio: ByteBool;
    EncryptionLevel: Byte;
    ColorDepth: Word;
    ProtocolType: Word;
    HRes: Word;
    VRes: Word;
    ClientProductId: Word;
    OutBufCountHost: Word;
    OutBufCountClient: Word;
    OutBufLength: Word;
    KeyboardLayout: DWORD;
    MaxConnectionTime: DWORD;
    MaxDisconnectionTime: DWORD;
    MaxIdleTime: DWORD;
    PerformanceFlags: DWORD;
    KeyboardType: DWORD;
    KeyboardSubType: DWORD;
    KeyboardFunctionKey: DWORD;
    ActiveInputLocale: DWORD;
    SerialNumber: DWORD;
    ClientAddressFamily: DWORD;
    ClientBuildNumber: DWORD;
    ClientSessionId: DWORD;
    WorkDirectory: array[0..256] of WideChar;
    InitialProgram: array[0..256] of WideChar;
    UserName: array[0..255] of WideChar;
    Domain: array[0..255] of WideChar;
    Password: array[0..255] of WideChar;
    ProtocolName: array[0..8] of WideChar;
    DisplayDriverName: array[0..8] of WideChar;
    DisplayDeviceName: array[0..19] of WideChar;
    imeFileName: array[0..32] of WideChar;
    AudioDriverName: array[0..8] of WideChar;
    ClientName: array[0..20] of WideChar;
    ClientAddress: array[0..30] of WideChar;
    ClientDirectory: array[0..256] of WideChar;
    ClientDigProductId: array[0..32] of WideChar;
    ClientSockAddress: WTS_SOCKADDR;
    ClientTimeZone: WTS_TIME_ZONE_INFORMATION;
    WRdsListenerSettings: WRDS_LISTENER_SETTINGS;
    EventLogActivityId: TGUID;
    ContextSize: DWORD;
    ContextData: Pointer;
  end;

  WRDS_CONNECTION_SETTING = record
    WRdsConnectionSettings1: WRDS_CONNECTION_SETTINGS_1;
  end;

  WRDS_CONNECTION_SETTINGS = record
    WRdsConnectionSettingLevel: Integer;
    WRdsConnectionSetting: WRDS_CONNECTION_SETTING;
  end;
const WTS_SOCKADDR = extern struct {
    sin_family: u16,
    u: _u_e__Union,
};

const WTS_SYSTEMTIME = extern struct {
    wYear: u16,
    wMonth: u16,
    wDayOfWeek: u16,
    wDay: u16,
    wHour: u16,
    wMinute: u16,
    wSecond: u16,
    wMilliseconds: u16,
};

const WTS_TIME_ZONE_INFORMATION = extern struct {
    Bias: i32,
    StandardName: [32]u16,
    StandardDate: WTS_SYSTEMTIME,
    StandardBias: i32,
    DaylightName: [32]u16,
    DaylightDate: WTS_SYSTEMTIME,
    DaylightBias: i32,
};

const WRDS_LISTENER_SETTINGS_1 = extern struct {
    MaxProtocolListenerConnectionCount: u32,
    SecurityDescriptorSize: u32,
    pSecurityDescriptor: ?*anyopaque,
};

const WRDS_LISTENER_SETTING = extern struct {
    WRdsListenerSettings1: WRDS_LISTENER_SETTINGS_1,
};

const WRDS_LISTENER_SETTINGS = extern struct {
    WRdsListenerSettingLevel: i32,
    WRdsListenerSetting: WRDS_LISTENER_SETTING,
};

const WRDS_CONNECTION_SETTINGS_1 = extern struct {
    fInheritInitialProgram: u8,
    fInheritColorDepth: u8,
    fHideTitleBar: u8,
    fInheritAutoLogon: u8,
    fMaximizeShell: u8,
    fDisablePNP: u8,
    fPasswordIsScPin: u8,
    fPromptForPassword: u8,
    fDisableCpm: u8,
    fDisableCdm: u8,
    fDisableCcm: u8,
    fDisableLPT: u8,
    fDisableClip: u8,
    fResetBroken: u8,
    fDisableEncryption: u8,
    fDisableAutoReconnect: u8,
    fDisableCtrlAltDel: u8,
    fDoubleClickDetect: u8,
    fEnableWindowsKey: u8,
    fUsingSavedCreds: u8,
    fMouse: u8,
    fNoAudioPlayback: u8,
    fRemoteConsoleAudio: u8,
    EncryptionLevel: u8,
    ColorDepth: u16,
    ProtocolType: u16,
    HRes: u16,
    VRes: u16,
    ClientProductId: u16,
    OutBufCountHost: u16,
    OutBufCountClient: u16,
    OutBufLength: u16,
    KeyboardLayout: u32,
    MaxConnectionTime: u32,
    MaxDisconnectionTime: u32,
    MaxIdleTime: u32,
    PerformanceFlags: u32,
    KeyboardType: u32,
    KeyboardSubType: u32,
    KeyboardFunctionKey: u32,
    ActiveInputLocale: u32,
    SerialNumber: u32,
    ClientAddressFamily: u32,
    ClientBuildNumber: u32,
    ClientSessionId: u32,
    WorkDirectory: [257]u16,
    InitialProgram: [257]u16,
    UserName: [256]u16,
    Domain: [256]u16,
    Password: [256]u16,
    ProtocolName: [9]u16,
    DisplayDriverName: [9]u16,
    DisplayDeviceName: [20]u16,
    imeFileName: [33]u16,
    AudioDriverName: [9]u16,
    ClientName: [21]u16,
    ClientAddress: [31]u16,
    ClientDirectory: [257]u16,
    ClientDigProductId: [33]u16,
    ClientSockAddress: WTS_SOCKADDR,
    ClientTimeZone: WTS_TIME_ZONE_INFORMATION,
    WRdsListenerSettings: WRDS_LISTENER_SETTINGS,
    EventLogActivityId: GUID,
    ContextSize: u32,
    ContextData: ?*anyopaque,
};

const WRDS_CONNECTION_SETTING = extern struct {
    WRdsConnectionSettings1: WRDS_CONNECTION_SETTINGS_1,
};

const WRDS_CONNECTION_SETTINGS = extern struct {
    WRdsConnectionSettingLevel: i32,
    WRdsConnectionSetting: WRDS_CONNECTION_SETTING,
};
type
  WTS_SOCKADDR {.bycopy.} = object
    sin_family: uint16
    u: _u_e__Union

  WTS_SYSTEMTIME {.bycopy.} = object
    wYear: uint16
    wMonth: uint16
    wDayOfWeek: uint16
    wDay: uint16
    wHour: uint16
    wMinute: uint16
    wSecond: uint16
    wMilliseconds: uint16

  WTS_TIME_ZONE_INFORMATION {.bycopy.} = object
    Bias: int32
    StandardName: array[32, uint16]
    StandardDate: WTS_SYSTEMTIME
    StandardBias: int32
    DaylightName: array[32, uint16]
    DaylightDate: WTS_SYSTEMTIME
    DaylightBias: int32

  WRDS_LISTENER_SETTINGS_1 {.bycopy.} = object
    MaxProtocolListenerConnectionCount: uint32
    SecurityDescriptorSize: uint32
    pSecurityDescriptor: pointer

  WRDS_LISTENER_SETTING {.bycopy.} = object
    WRdsListenerSettings1: WRDS_LISTENER_SETTINGS_1

  WRDS_LISTENER_SETTINGS {.bycopy.} = object
    WRdsListenerSettingLevel: int32
    WRdsListenerSetting: WRDS_LISTENER_SETTING

  WRDS_CONNECTION_SETTINGS_1 {.bycopy.} = object
    fInheritInitialProgram: uint8
    fInheritColorDepth: uint8
    fHideTitleBar: uint8
    fInheritAutoLogon: uint8
    fMaximizeShell: uint8
    fDisablePNP: uint8
    fPasswordIsScPin: uint8
    fPromptForPassword: uint8
    fDisableCpm: uint8
    fDisableCdm: uint8
    fDisableCcm: uint8
    fDisableLPT: uint8
    fDisableClip: uint8
    fResetBroken: uint8
    fDisableEncryption: uint8
    fDisableAutoReconnect: uint8
    fDisableCtrlAltDel: uint8
    fDoubleClickDetect: uint8
    fEnableWindowsKey: uint8
    fUsingSavedCreds: uint8
    fMouse: uint8
    fNoAudioPlayback: uint8
    fRemoteConsoleAudio: uint8
    EncryptionLevel: uint8
    ColorDepth: uint16
    ProtocolType: uint16
    HRes: uint16
    VRes: uint16
    ClientProductId: uint16
    OutBufCountHost: uint16
    OutBufCountClient: uint16
    OutBufLength: uint16
    KeyboardLayout: uint32
    MaxConnectionTime: uint32
    MaxDisconnectionTime: uint32
    MaxIdleTime: uint32
    PerformanceFlags: uint32
    KeyboardType: uint32
    KeyboardSubType: uint32
    KeyboardFunctionKey: uint32
    ActiveInputLocale: uint32
    SerialNumber: uint32
    ClientAddressFamily: uint32
    ClientBuildNumber: uint32
    ClientSessionId: uint32
    WorkDirectory: array[257, uint16]
    InitialProgram: array[257, uint16]
    UserName: array[256, uint16]
    Domain: array[256, uint16]
    Password: array[256, uint16]
    ProtocolName: array[9, uint16]
    DisplayDriverName: array[9, uint16]
    DisplayDeviceName: array[20, uint16]
    imeFileName: array[33, uint16]
    AudioDriverName: array[9, uint16]
    ClientName: array[21, uint16]
    ClientAddress: array[31, uint16]
    ClientDirectory: array[257, uint16]
    ClientDigProductId: array[33, uint16]
    ClientSockAddress: WTS_SOCKADDR
    ClientTimeZone: WTS_TIME_ZONE_INFORMATION
    WRdsListenerSettings: WRDS_LISTENER_SETTINGS
    EventLogActivityId: GUID
    ContextSize: uint32
    ContextData: pointer

  WRDS_CONNECTION_SETTING {.bycopy.} = object
    WRdsConnectionSettings1: WRDS_CONNECTION_SETTINGS_1

  WRDS_CONNECTION_SETTINGS {.bycopy.} = object
    WRdsConnectionSettingLevel: int32
    WRdsConnectionSetting: WRDS_CONNECTION_SETTING
struct WTS_SOCKADDR
{
    ushort sin_family;
    _u_e__Union u;
}

struct WTS_SYSTEMTIME
{
    ushort wYear;
    ushort wMonth;
    ushort wDayOfWeek;
    ushort wDay;
    ushort wHour;
    ushort wMinute;
    ushort wSecond;
    ushort wMilliseconds;
}

struct WTS_TIME_ZONE_INFORMATION
{
    int Bias;
    wchar[32] StandardName;
    WTS_SYSTEMTIME StandardDate;
    int StandardBias;
    wchar[32] DaylightName;
    WTS_SYSTEMTIME DaylightDate;
    int DaylightBias;
}

struct WRDS_LISTENER_SETTINGS_1
{
    uint MaxProtocolListenerConnectionCount;
    uint SecurityDescriptorSize;
    void* pSecurityDescriptor;
}

struct WRDS_LISTENER_SETTING
{
    WRDS_LISTENER_SETTINGS_1 WRdsListenerSettings1;
}

struct WRDS_LISTENER_SETTINGS
{
    int WRdsListenerSettingLevel;
    WRDS_LISTENER_SETTING WRdsListenerSetting;
}

struct WRDS_CONNECTION_SETTINGS_1
{
    ubyte fInheritInitialProgram;
    ubyte fInheritColorDepth;
    ubyte fHideTitleBar;
    ubyte fInheritAutoLogon;
    ubyte fMaximizeShell;
    ubyte fDisablePNP;
    ubyte fPasswordIsScPin;
    ubyte fPromptForPassword;
    ubyte fDisableCpm;
    ubyte fDisableCdm;
    ubyte fDisableCcm;
    ubyte fDisableLPT;
    ubyte fDisableClip;
    ubyte fResetBroken;
    ubyte fDisableEncryption;
    ubyte fDisableAutoReconnect;
    ubyte fDisableCtrlAltDel;
    ubyte fDoubleClickDetect;
    ubyte fEnableWindowsKey;
    ubyte fUsingSavedCreds;
    ubyte fMouse;
    ubyte fNoAudioPlayback;
    ubyte fRemoteConsoleAudio;
    ubyte EncryptionLevel;
    ushort ColorDepth;
    ushort ProtocolType;
    ushort HRes;
    ushort VRes;
    ushort ClientProductId;
    ushort OutBufCountHost;
    ushort OutBufCountClient;
    ushort OutBufLength;
    uint KeyboardLayout;
    uint MaxConnectionTime;
    uint MaxDisconnectionTime;
    uint MaxIdleTime;
    uint PerformanceFlags;
    uint KeyboardType;
    uint KeyboardSubType;
    uint KeyboardFunctionKey;
    uint ActiveInputLocale;
    uint SerialNumber;
    uint ClientAddressFamily;
    uint ClientBuildNumber;
    uint ClientSessionId;
    wchar[257] WorkDirectory;
    wchar[257] InitialProgram;
    wchar[256] UserName;
    wchar[256] Domain;
    wchar[256] Password;
    wchar[9] ProtocolName;
    wchar[9] DisplayDriverName;
    wchar[20] DisplayDeviceName;
    wchar[33] imeFileName;
    wchar[9] AudioDriverName;
    wchar[21] ClientName;
    wchar[31] ClientAddress;
    wchar[257] ClientDirectory;
    wchar[33] ClientDigProductId;
    WTS_SOCKADDR ClientSockAddress;
    WTS_TIME_ZONE_INFORMATION ClientTimeZone;
    WRDS_LISTENER_SETTINGS WRdsListenerSettings;
    GUID EventLogActivityId;
    uint ContextSize;
    void* ContextData;
}

struct WRDS_CONNECTION_SETTING
{
    WRDS_CONNECTION_SETTINGS_1 WRdsConnectionSettings1;
}

struct WRDS_CONNECTION_SETTINGS
{
    int WRdsConnectionSettingLevel;
    WRDS_CONNECTION_SETTING WRdsConnectionSetting;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WRDS_CONNECTION_SETTINGS サイズ: 3724 バイト(x86)
dim st, 931    ; 4byte整数×931(構造体サイズ 3724 / 4 切り上げ)
; WRdsConnectionSettingLevel : WRDS_CONNECTION_SETTING_LEVEL (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; WRdsConnectionSetting : WRDS_CONNECTION_SETTING (+4, 3720byte)  varptr(st)+4 を基点に操作(3720byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WRDS_CONNECTION_SETTINGS サイズ: 3760 バイト(x64)
dim st, 940    ; 4byte整数×940(構造体サイズ 3760 / 4 切り上げ)
; WRdsConnectionSettingLevel : WRDS_CONNECTION_SETTING_LEVEL (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; WRdsConnectionSetting : WRDS_CONNECTION_SETTING (+8, 3752byte)  varptr(st)+8 を基点に操作(3752byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WRDS_CONNECTION_SETTINGS
    #field int WRdsConnectionSettingLevel
    #field byte WRdsConnectionSetting 3752
#endstruct

stdim st, WRDS_CONNECTION_SETTINGS        ; NSTRUCT 変数を確保
st->WRdsConnectionSettingLevel = 100
mes "WRdsConnectionSettingLevel=" + st->WRdsConnectionSettingLevel
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。