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

WTSCONFIGINFOW

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

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

フィールド

フィールドサイズx64x86説明
versionDWORD4+0+0この構成情報構造体のバージョン番号。
fConnectClientDrivesAtLogonDWORD4+4+4ログオン時にクライアントドライブを接続するか。
fConnectPrinterAtLogonDWORD4+8+8ログオン時にクライアントプリンタを接続するか。
fDisablePrinterRedirectionDWORD4+12+12プリンタリダイレクトを無効にするかを示す。
fDisableDefaultMainClientPrinterDWORD4+16+16既定メインクライアントプリンタを無効化するか。
ShadowSettingsDWORD4+20+20セッションシャドウ(監視)の設定を示す値。
LogonUserNameWCHAR42+24+24ログオンユーザー名(Unicode)。
LogonDomainWCHAR36+66+66ログオンドメイン名(Unicode)。
WorkDirectoryWCHAR522+102+102作業ディレクトリのパス(Unicode)。
InitialProgramWCHAR522+624+624起動時に実行する初期プログラム(Unicode)。
ApplicationNameWCHAR522+1146+1146アプリケーション名(Unicode)。

各言語での定義

#include <windows.h>

// WTSCONFIGINFOW  (x64 1668 / x86 1668 バイト)
typedef struct WTSCONFIGINFOW {
    DWORD version;
    DWORD fConnectClientDrivesAtLogon;
    DWORD fConnectPrinterAtLogon;
    DWORD fDisablePrinterRedirection;
    DWORD fDisableDefaultMainClientPrinter;
    DWORD ShadowSettings;
    WCHAR LogonUserName[21];
    WCHAR LogonDomain[18];
    WCHAR WorkDirectory[261];
    WCHAR InitialProgram[261];
    WCHAR ApplicationName[261];
} WTSCONFIGINFOW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTSCONFIGINFOW
{
    public uint version;
    public uint fConnectClientDrivesAtLogon;
    public uint fConnectPrinterAtLogon;
    public uint fDisablePrinterRedirection;
    public uint fDisableDefaultMainClientPrinter;
    public uint ShadowSettings;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 21)] public string LogonUserName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 18)] public string LogonDomain;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 261)] public string WorkDirectory;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 261)] public string InitialProgram;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 261)] public string ApplicationName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTSCONFIGINFOW
    Public version As UInteger
    Public fConnectClientDrivesAtLogon As UInteger
    Public fConnectPrinterAtLogon As UInteger
    Public fDisablePrinterRedirection As UInteger
    Public fDisableDefaultMainClientPrinter As UInteger
    Public ShadowSettings As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=21)> Public LogonUserName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=18)> Public LogonDomain As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=261)> Public WorkDirectory As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=261)> Public InitialProgram As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=261)> Public ApplicationName As String
End Structure
import ctypes
from ctypes import wintypes

class WTSCONFIGINFOW(ctypes.Structure):
    _fields_ = [
        ("version", wintypes.DWORD),
        ("fConnectClientDrivesAtLogon", wintypes.DWORD),
        ("fConnectPrinterAtLogon", wintypes.DWORD),
        ("fDisablePrinterRedirection", wintypes.DWORD),
        ("fDisableDefaultMainClientPrinter", wintypes.DWORD),
        ("ShadowSettings", wintypes.DWORD),
        ("LogonUserName", ctypes.c_wchar * 21),
        ("LogonDomain", ctypes.c_wchar * 18),
        ("WorkDirectory", ctypes.c_wchar * 261),
        ("InitialProgram", ctypes.c_wchar * 261),
        ("ApplicationName", ctypes.c_wchar * 261),
    ]
#[repr(C)]
pub struct WTSCONFIGINFOW {
    pub version: u32,
    pub fConnectClientDrivesAtLogon: u32,
    pub fConnectPrinterAtLogon: u32,
    pub fDisablePrinterRedirection: u32,
    pub fDisableDefaultMainClientPrinter: u32,
    pub ShadowSettings: u32,
    pub LogonUserName: [u16; 21],
    pub LogonDomain: [u16; 18],
    pub WorkDirectory: [u16; 261],
    pub InitialProgram: [u16; 261],
    pub ApplicationName: [u16; 261],
}
import "golang.org/x/sys/windows"

type WTSCONFIGINFOW struct {
	version uint32
	fConnectClientDrivesAtLogon uint32
	fConnectPrinterAtLogon uint32
	fDisablePrinterRedirection uint32
	fDisableDefaultMainClientPrinter uint32
	ShadowSettings uint32
	LogonUserName [21]uint16
	LogonDomain [18]uint16
	WorkDirectory [261]uint16
	InitialProgram [261]uint16
	ApplicationName [261]uint16
}
type
  WTSCONFIGINFOW = record
    version: DWORD;
    fConnectClientDrivesAtLogon: DWORD;
    fConnectPrinterAtLogon: DWORD;
    fDisablePrinterRedirection: DWORD;
    fDisableDefaultMainClientPrinter: DWORD;
    ShadowSettings: DWORD;
    LogonUserName: array[0..20] of WideChar;
    LogonDomain: array[0..17] of WideChar;
    WorkDirectory: array[0..260] of WideChar;
    InitialProgram: array[0..260] of WideChar;
    ApplicationName: array[0..260] of WideChar;
  end;
const WTSCONFIGINFOW = extern struct {
    version: u32,
    fConnectClientDrivesAtLogon: u32,
    fConnectPrinterAtLogon: u32,
    fDisablePrinterRedirection: u32,
    fDisableDefaultMainClientPrinter: u32,
    ShadowSettings: u32,
    LogonUserName: [21]u16,
    LogonDomain: [18]u16,
    WorkDirectory: [261]u16,
    InitialProgram: [261]u16,
    ApplicationName: [261]u16,
};
type
  WTSCONFIGINFOW {.bycopy.} = object
    version: uint32
    fConnectClientDrivesAtLogon: uint32
    fConnectPrinterAtLogon: uint32
    fDisablePrinterRedirection: uint32
    fDisableDefaultMainClientPrinter: uint32
    ShadowSettings: uint32
    LogonUserName: array[21, uint16]
    LogonDomain: array[18, uint16]
    WorkDirectory: array[261, uint16]
    InitialProgram: array[261, uint16]
    ApplicationName: array[261, uint16]
struct WTSCONFIGINFOW
{
    uint version;
    uint fConnectClientDrivesAtLogon;
    uint fConnectPrinterAtLogon;
    uint fDisablePrinterRedirection;
    uint fDisableDefaultMainClientPrinter;
    uint ShadowSettings;
    wchar[21] LogonUserName;
    wchar[18] LogonDomain;
    wchar[261] WorkDirectory;
    wchar[261] InitialProgram;
    wchar[261] ApplicationName;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WTSCONFIGINFOW サイズ: 1668 バイト(x64)
dim st, 417    ; 4byte整数×417(構造体サイズ 1668 / 4 切り上げ)
; version : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; fConnectClientDrivesAtLogon : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; fConnectPrinterAtLogon : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; fDisablePrinterRedirection : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; fDisableDefaultMainClientPrinter : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ShadowSettings : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; LogonUserName : WCHAR (+24, 42byte)  varptr(st)+24 を基点に操作(42byte:入れ子/配列)
; LogonDomain : WCHAR (+66, 36byte)  varptr(st)+66 を基点に操作(36byte:入れ子/配列)
; WorkDirectory : WCHAR (+102, 522byte)  varptr(st)+102 を基点に操作(522byte:入れ子/配列)
; InitialProgram : WCHAR (+624, 522byte)  varptr(st)+624 を基点に操作(522byte:入れ子/配列)
; ApplicationName : WCHAR (+1146, 522byte)  varptr(st)+1146 を基点に操作(522byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WTSCONFIGINFOW
    #field int version
    #field int fConnectClientDrivesAtLogon
    #field int fConnectPrinterAtLogon
    #field int fDisablePrinterRedirection
    #field int fDisableDefaultMainClientPrinter
    #field int ShadowSettings
    #field wchar LogonUserName 21
    #field wchar LogonDomain 18
    #field wchar WorkDirectory 261
    #field wchar InitialProgram 261
    #field wchar ApplicationName 261
#endstruct

stdim st, WTSCONFIGINFOW        ; NSTRUCT 変数を確保
st->version = 100
mes "version=" + st->version