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

WTSCONFIGINFOA

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

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

フィールド

フィールドサイズx64x86説明
versionDWORD4+0+0このメンバーは予約済みです。
fConnectClientDrivesAtLogonDWORD4+4+4このメンバーは予約済みです。
fConnectPrinterAtLogonDWORD4+8+8このメンバーは予約済みです。
fDisablePrinterRedirectionDWORD4+12+12

クライアントがプリンターのリダイレクトを使用できるかどうかを指定します。

0

クライアントのプリンター リダイレクトを有効にします。

1

クライアントのプリンター リダイレクトを無効にします。

fDisableDefaultMainClientPrinterDWORD4+16+16

クライアントに接続されているプリンターをユーザーの既定のプリンターにするかどうかを指定します。

0

クライアントに接続されているプリンターは、ユーザーの既定のプリンターではありません。

1

クライアントに接続されているプリンターは、ユーザーの既定のプリンターです。

ShadowSettingsDWORD4+20+20

リモート コントロールの設定です。リモート コントロールを使用すると、あるユーザーが別のユーザーの画面上の操作をリモートで監視できます。このメンバーには、次のいずれかの値を指定できます。

0

リモート コントロールは無効です。

1

リモート コントロールの実行者は、ユーザーの許可を得たうえで、そのユーザーのセッションを完全に制御できます。

2

リモート コントロールの実行者は、そのユーザーのセッションを完全に制御できます。ユーザーの許可は 必要ありません。

3

リモート コントロールの実行者は、ユーザーの許可を得たうえでセッションをリモートで表示できます。リモート ユーザーが セッションを能動的に制御することはできません。

4

リモート コントロールの実行者は、セッションをリモートで表示できますが、能動的に制御することはできません。 ユーザーの許可は必要ありません。

LogonUserNameCHAR21+24+24自動ログオンのシナリオで使用されるユーザー名を格納する、NULL で終わる文字列です。
LogonDomainCHAR18+45+45自動ログオンのシナリオで使用されるドメイン名を格納する、NULL で終わる文字列です。
WorkDirectoryCHAR261+63+63初期プログラムの作業ディレクトリのパスを格納する、NULL で終わる文字列です。
InitialProgramCHAR261+324+324ユーザーがサーバーにログオンした直後に開始するプログラムの名前を格納する、NULL で終わる文字列です。
ApplicationNameCHAR261+585+585このメンバーは予約済みです。

公式ドキュメント

リモート デスクトップ サービス セッションに関する情報を格納します。この構造体は、WTSInfoClass パラメーターに "WTSConfigInfo" を指定したときに WTSQuerySessionInformation 関数から返されます。

解説(Remarks)

メモ

wtsapi32.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして WTSCONFIGINFO を定義しています。エンコード中立のエイリアスを、エンコード中立でないコードと混在させて使用すると、不一致が生じてコンパイル エラーや実行時エラーの原因となる場合があります。詳細については、Conventions for Function Prototypes を参照してください。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

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

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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTSCONFIGINFOA
    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.ByValArray, SizeConst:=21)> Public LogonUserName() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=18)> Public LogonDomain() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=261)> Public WorkDirectory() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=261)> Public InitialProgram() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=261)> Public ApplicationName() As SByte
End Structure
import ctypes
from ctypes import wintypes

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

type WTSCONFIGINFOA struct {
	version uint32
	fConnectClientDrivesAtLogon uint32
	fConnectPrinterAtLogon uint32
	fDisablePrinterRedirection uint32
	fDisableDefaultMainClientPrinter uint32
	ShadowSettings uint32
	LogonUserName [21]int8
	LogonDomain [18]int8
	WorkDirectory [261]int8
	InitialProgram [261]int8
	ApplicationName [261]int8
}
type
  WTSCONFIGINFOA = record
    version: DWORD;
    fConnectClientDrivesAtLogon: DWORD;
    fConnectPrinterAtLogon: DWORD;
    fDisablePrinterRedirection: DWORD;
    fDisableDefaultMainClientPrinter: DWORD;
    ShadowSettings: DWORD;
    LogonUserName: array[0..20] of Shortint;
    LogonDomain: array[0..17] of Shortint;
    WorkDirectory: array[0..260] of Shortint;
    InitialProgram: array[0..260] of Shortint;
    ApplicationName: array[0..260] of Shortint;
  end;
const WTSCONFIGINFOA = extern struct {
    version: u32,
    fConnectClientDrivesAtLogon: u32,
    fConnectPrinterAtLogon: u32,
    fDisablePrinterRedirection: u32,
    fDisableDefaultMainClientPrinter: u32,
    ShadowSettings: u32,
    LogonUserName: [21]i8,
    LogonDomain: [18]i8,
    WorkDirectory: [261]i8,
    InitialProgram: [261]i8,
    ApplicationName: [261]i8,
};
type
  WTSCONFIGINFOA {.bycopy.} = object
    version: uint32
    fConnectClientDrivesAtLogon: uint32
    fConnectPrinterAtLogon: uint32
    fDisablePrinterRedirection: uint32
    fDisableDefaultMainClientPrinter: uint32
    ShadowSettings: uint32
    LogonUserName: array[21, int8]
    LogonDomain: array[18, int8]
    WorkDirectory: array[261, int8]
    InitialProgram: array[261, int8]
    ApplicationName: array[261, int8]
struct WTSCONFIGINFOA
{
    uint version;
    uint fConnectClientDrivesAtLogon;
    uint fConnectPrinterAtLogon;
    uint fDisablePrinterRedirection;
    uint fDisableDefaultMainClientPrinter;
    uint ShadowSettings;
    byte[21] LogonUserName;
    byte[18] LogonDomain;
    byte[261] WorkDirectory;
    byte[261] InitialProgram;
    byte[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 レイアウト)
; WTSCONFIGINFOA サイズ: 848 バイト(x64)
dim st, 212    ; 4byte整数×212(構造体サイズ 848 / 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 : CHAR (+24, 21byte)  varptr(st)+24 を基点に操作(21byte:入れ子/配列)
; LogonDomain : CHAR (+45, 18byte)  varptr(st)+45 を基点に操作(18byte:入れ子/配列)
; WorkDirectory : CHAR (+63, 261byte)  varptr(st)+63 を基点に操作(261byte:入れ子/配列)
; InitialProgram : CHAR (+324, 261byte)  varptr(st)+324 を基点に操作(261byte:入れ子/配列)
; ApplicationName : CHAR (+585, 261byte)  varptr(st)+585 を基点に操作(261byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WTSCONFIGINFOA
    #field int version
    #field int fConnectClientDrivesAtLogon
    #field int fConnectPrinterAtLogon
    #field int fDisablePrinterRedirection
    #field int fDisableDefaultMainClientPrinter
    #field int ShadowSettings
    #field byte LogonUserName 21
    #field byte LogonDomain 18
    #field byte WorkDirectory 261
    #field byte InitialProgram 261
    #field byte ApplicationName 261
#endstruct

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