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

WTS_PROTOCOL_STATUS

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

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

フィールド

フィールドサイズx64x86説明
OutputWTS_PROTOCOL_COUNTERS464+0+0出力方向のプロトコルカウンター。WTS_PROTOCOL_COUNTERSで表す。
InputWTS_PROTOCOL_COUNTERS464+464+464入力方向のプロトコルカウンター。WTS_PROTOCOL_COUNTERSで表す。
CacheWTS_CACHE_STATS88+928+928キャッシュ統計。WTS_CACHE_STATSで表す。
AsyncSignalDWORD4+1016+1016非同期シグナルの状態を示す値。
AsyncSignalMaskDWORD4+1020+1020非同期シグナルのマスク値。
CountersLONGLONG800+1024+1024汎用カウンター値。LONGLONGで表す。

各言語での定義

#include <windows.h>

// WTS_PROTOCOL_COUNTERS  (x64 464 / x86 464 バイト)
typedef struct WTS_PROTOCOL_COUNTERS {
    DWORD WdBytes;
    DWORD WdFrames;
    DWORD WaitForOutBuf;
    DWORD Frames;
    DWORD Bytes;
    DWORD CompressedBytes;
    DWORD CompressFlushes;
    DWORD Errors;
    DWORD Timeouts;
    DWORD AsyncFramingError;
    DWORD AsyncOverrunError;
    DWORD AsyncOverflowError;
    DWORD AsyncParityError;
    DWORD TdErrors;
    WORD ProtocolType;
    WORD Length;
    WORD Specific;
    DWORD Reserved[100];
} WTS_PROTOCOL_COUNTERS;

// WTS_PROTOCOL_CACHE  (x64 8 / x86 8 バイト)
typedef struct WTS_PROTOCOL_CACHE {
    DWORD CacheReads;
    DWORD CacheHits;
} WTS_PROTOCOL_CACHE;

// WTS_CACHE_STATS_UN  (x64 80 / x86 80 バイト)
typedef struct WTS_CACHE_STATS_UN {
    WTS_PROTOCOL_CACHE ProtocolCache[4];
    DWORD TShareCacheStats;
    DWORD Reserved[20];
} WTS_CACHE_STATS_UN;

// WTS_CACHE_STATS  (x64 88 / x86 88 バイト)
typedef struct WTS_CACHE_STATS {
    DWORD Specific;
    WTS_CACHE_STATS_UN Data;
    WORD ProtocolType;
    WORD Length;
} WTS_CACHE_STATS;

// WTS_PROTOCOL_STATUS  (x64 1824 / x86 1824 バイト)
typedef struct WTS_PROTOCOL_STATUS {
    WTS_PROTOCOL_COUNTERS Output;
    WTS_PROTOCOL_COUNTERS Input;
    WTS_CACHE_STATS Cache;
    DWORD AsyncSignal;
    DWORD AsyncSignalMask;
    LONGLONG Counters[100];
} WTS_PROTOCOL_STATUS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTS_PROTOCOL_COUNTERS
{
    public uint WdBytes;
    public uint WdFrames;
    public uint WaitForOutBuf;
    public uint Frames;
    public uint Bytes;
    public uint CompressedBytes;
    public uint CompressFlushes;
    public uint Errors;
    public uint Timeouts;
    public uint AsyncFramingError;
    public uint AsyncOverrunError;
    public uint AsyncOverflowError;
    public uint AsyncParityError;
    public uint TdErrors;
    public ushort ProtocolType;
    public ushort Length;
    public ushort Specific;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 100)] public uint[] Reserved;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTS_PROTOCOL_CACHE
{
    public uint CacheReads;
    public uint CacheHits;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTS_CACHE_STATS_UN
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public WTS_PROTOCOL_CACHE[] ProtocolCache;
    public uint TShareCacheStats;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public uint[] Reserved;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTS_CACHE_STATS
{
    public uint Specific;
    public WTS_CACHE_STATS_UN Data;
    public ushort ProtocolType;
    public ushort Length;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTS_PROTOCOL_STATUS
{
    public WTS_PROTOCOL_COUNTERS Output;
    public WTS_PROTOCOL_COUNTERS Input;
    public WTS_CACHE_STATS Cache;
    public uint AsyncSignal;
    public uint AsyncSignalMask;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 100)] public long[] Counters;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTS_PROTOCOL_COUNTERS
    Public WdBytes As UInteger
    Public WdFrames As UInteger
    Public WaitForOutBuf As UInteger
    Public Frames As UInteger
    Public Bytes As UInteger
    Public CompressedBytes As UInteger
    Public CompressFlushes As UInteger
    Public Errors As UInteger
    Public Timeouts As UInteger
    Public AsyncFramingError As UInteger
    Public AsyncOverrunError As UInteger
    Public AsyncOverflowError As UInteger
    Public AsyncParityError As UInteger
    Public TdErrors As UInteger
    Public ProtocolType As UShort
    Public Length As UShort
    Public Specific As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=100)> Public Reserved() As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTS_PROTOCOL_CACHE
    Public CacheReads As UInteger
    Public CacheHits As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTS_CACHE_STATS_UN
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public ProtocolCache() As WTS_PROTOCOL_CACHE
    Public TShareCacheStats As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=20)> Public Reserved() As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTS_CACHE_STATS
    Public Specific As UInteger
    Public Data As WTS_CACHE_STATS_UN
    Public ProtocolType As UShort
    Public Length As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTS_PROTOCOL_STATUS
    Public Output As WTS_PROTOCOL_COUNTERS
    Public Input As WTS_PROTOCOL_COUNTERS
    Public Cache As WTS_CACHE_STATS
    Public AsyncSignal As UInteger
    Public AsyncSignalMask As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=100)> Public Counters() As Long
End Structure
import ctypes
from ctypes import wintypes

class WTS_PROTOCOL_COUNTERS(ctypes.Structure):
    _fields_ = [
        ("WdBytes", wintypes.DWORD),
        ("WdFrames", wintypes.DWORD),
        ("WaitForOutBuf", wintypes.DWORD),
        ("Frames", wintypes.DWORD),
        ("Bytes", wintypes.DWORD),
        ("CompressedBytes", wintypes.DWORD),
        ("CompressFlushes", wintypes.DWORD),
        ("Errors", wintypes.DWORD),
        ("Timeouts", wintypes.DWORD),
        ("AsyncFramingError", wintypes.DWORD),
        ("AsyncOverrunError", wintypes.DWORD),
        ("AsyncOverflowError", wintypes.DWORD),
        ("AsyncParityError", wintypes.DWORD),
        ("TdErrors", wintypes.DWORD),
        ("ProtocolType", ctypes.c_ushort),
        ("Length", ctypes.c_ushort),
        ("Specific", ctypes.c_ushort),
        ("Reserved", wintypes.DWORD * 100),
    ]

class WTS_PROTOCOL_CACHE(ctypes.Structure):
    _fields_ = [
        ("CacheReads", wintypes.DWORD),
        ("CacheHits", wintypes.DWORD),
    ]

class WTS_CACHE_STATS_UN(ctypes.Structure):
    _fields_ = [
        ("ProtocolCache", WTS_PROTOCOL_CACHE * 4),
        ("TShareCacheStats", wintypes.DWORD),
        ("Reserved", wintypes.DWORD * 20),
    ]

class WTS_CACHE_STATS(ctypes.Structure):
    _fields_ = [
        ("Specific", wintypes.DWORD),
        ("Data", WTS_CACHE_STATS_UN),
        ("ProtocolType", ctypes.c_ushort),
        ("Length", ctypes.c_ushort),
    ]

class WTS_PROTOCOL_STATUS(ctypes.Structure):
    _fields_ = [
        ("Output", WTS_PROTOCOL_COUNTERS),
        ("Input", WTS_PROTOCOL_COUNTERS),
        ("Cache", WTS_CACHE_STATS),
        ("AsyncSignal", wintypes.DWORD),
        ("AsyncSignalMask", wintypes.DWORD),
        ("Counters", ctypes.c_longlong * 100),
    ]
#[repr(C)]
pub struct WTS_PROTOCOL_COUNTERS {
    pub WdBytes: u32,
    pub WdFrames: u32,
    pub WaitForOutBuf: u32,
    pub Frames: u32,
    pub Bytes: u32,
    pub CompressedBytes: u32,
    pub CompressFlushes: u32,
    pub Errors: u32,
    pub Timeouts: u32,
    pub AsyncFramingError: u32,
    pub AsyncOverrunError: u32,
    pub AsyncOverflowError: u32,
    pub AsyncParityError: u32,
    pub TdErrors: u32,
    pub ProtocolType: u16,
    pub Length: u16,
    pub Specific: u16,
    pub Reserved: [u32; 100],
}

#[repr(C)]
pub struct WTS_PROTOCOL_CACHE {
    pub CacheReads: u32,
    pub CacheHits: u32,
}

#[repr(C)]
pub struct WTS_CACHE_STATS_UN {
    pub ProtocolCache: [WTS_PROTOCOL_CACHE; 4],
    pub TShareCacheStats: u32,
    pub Reserved: [u32; 20],
}

#[repr(C)]
pub struct WTS_CACHE_STATS {
    pub Specific: u32,
    pub Data: WTS_CACHE_STATS_UN,
    pub ProtocolType: u16,
    pub Length: u16,
}

#[repr(C)]
pub struct WTS_PROTOCOL_STATUS {
    pub Output: WTS_PROTOCOL_COUNTERS,
    pub Input: WTS_PROTOCOL_COUNTERS,
    pub Cache: WTS_CACHE_STATS,
    pub AsyncSignal: u32,
    pub AsyncSignalMask: u32,
    pub Counters: [i64; 100],
}
import "golang.org/x/sys/windows"

type WTS_PROTOCOL_COUNTERS struct {
	WdBytes uint32
	WdFrames uint32
	WaitForOutBuf uint32
	Frames uint32
	Bytes uint32
	CompressedBytes uint32
	CompressFlushes uint32
	Errors uint32
	Timeouts uint32
	AsyncFramingError uint32
	AsyncOverrunError uint32
	AsyncOverflowError uint32
	AsyncParityError uint32
	TdErrors uint32
	ProtocolType uint16
	Length uint16
	Specific uint16
	Reserved [100]uint32
}

type WTS_PROTOCOL_CACHE struct {
	CacheReads uint32
	CacheHits uint32
}

type WTS_CACHE_STATS_UN struct {
	ProtocolCache [4]WTS_PROTOCOL_CACHE
	TShareCacheStats uint32
	Reserved [20]uint32
}

type WTS_CACHE_STATS struct {
	Specific uint32
	Data WTS_CACHE_STATS_UN
	ProtocolType uint16
	Length uint16
}

type WTS_PROTOCOL_STATUS struct {
	Output WTS_PROTOCOL_COUNTERS
	Input WTS_PROTOCOL_COUNTERS
	Cache WTS_CACHE_STATS
	AsyncSignal uint32
	AsyncSignalMask uint32
	Counters [100]int64
}
type
  WTS_PROTOCOL_COUNTERS = record
    WdBytes: DWORD;
    WdFrames: DWORD;
    WaitForOutBuf: DWORD;
    Frames: DWORD;
    Bytes: DWORD;
    CompressedBytes: DWORD;
    CompressFlushes: DWORD;
    Errors: DWORD;
    Timeouts: DWORD;
    AsyncFramingError: DWORD;
    AsyncOverrunError: DWORD;
    AsyncOverflowError: DWORD;
    AsyncParityError: DWORD;
    TdErrors: DWORD;
    ProtocolType: Word;
    Length: Word;
    Specific: Word;
    Reserved: array[0..99] of DWORD;
  end;

  WTS_PROTOCOL_CACHE = record
    CacheReads: DWORD;
    CacheHits: DWORD;
  end;

  WTS_CACHE_STATS_UN = record
    ProtocolCache: array[0..3] of WTS_PROTOCOL_CACHE;
    TShareCacheStats: DWORD;
    Reserved: array[0..19] of DWORD;
  end;

  WTS_CACHE_STATS = record
    Specific: DWORD;
    Data: WTS_CACHE_STATS_UN;
    ProtocolType: Word;
    Length: Word;
  end;

  WTS_PROTOCOL_STATUS = record
    Output: WTS_PROTOCOL_COUNTERS;
    Input: WTS_PROTOCOL_COUNTERS;
    Cache: WTS_CACHE_STATS;
    AsyncSignal: DWORD;
    AsyncSignalMask: DWORD;
    Counters: array[0..99] of Int64;
  end;
const WTS_PROTOCOL_COUNTERS = extern struct {
    WdBytes: u32,
    WdFrames: u32,
    WaitForOutBuf: u32,
    Frames: u32,
    Bytes: u32,
    CompressedBytes: u32,
    CompressFlushes: u32,
    Errors: u32,
    Timeouts: u32,
    AsyncFramingError: u32,
    AsyncOverrunError: u32,
    AsyncOverflowError: u32,
    AsyncParityError: u32,
    TdErrors: u32,
    ProtocolType: u16,
    Length: u16,
    Specific: u16,
    Reserved: [100]u32,
};

const WTS_PROTOCOL_CACHE = extern struct {
    CacheReads: u32,
    CacheHits: u32,
};

const WTS_CACHE_STATS_UN = extern struct {
    ProtocolCache: [4]WTS_PROTOCOL_CACHE,
    TShareCacheStats: u32,
    Reserved: [20]u32,
};

const WTS_CACHE_STATS = extern struct {
    Specific: u32,
    Data: WTS_CACHE_STATS_UN,
    ProtocolType: u16,
    Length: u16,
};

const WTS_PROTOCOL_STATUS = extern struct {
    Output: WTS_PROTOCOL_COUNTERS,
    Input: WTS_PROTOCOL_COUNTERS,
    Cache: WTS_CACHE_STATS,
    AsyncSignal: u32,
    AsyncSignalMask: u32,
    Counters: [100]i64,
};
type
  WTS_PROTOCOL_COUNTERS {.bycopy.} = object
    WdBytes: uint32
    WdFrames: uint32
    WaitForOutBuf: uint32
    Frames: uint32
    Bytes: uint32
    CompressedBytes: uint32
    CompressFlushes: uint32
    Errors: uint32
    Timeouts: uint32
    AsyncFramingError: uint32
    AsyncOverrunError: uint32
    AsyncOverflowError: uint32
    AsyncParityError: uint32
    TdErrors: uint32
    ProtocolType: uint16
    Length: uint16
    Specific: uint16
    Reserved: array[100, uint32]

  WTS_PROTOCOL_CACHE {.bycopy.} = object
    CacheReads: uint32
    CacheHits: uint32

  WTS_CACHE_STATS_UN {.bycopy.} = object
    ProtocolCache: array[4, WTS_PROTOCOL_CACHE]
    TShareCacheStats: uint32
    Reserved: array[20, uint32]

  WTS_CACHE_STATS {.bycopy.} = object
    Specific: uint32
    Data: WTS_CACHE_STATS_UN
    ProtocolType: uint16
    Length: uint16

  WTS_PROTOCOL_STATUS {.bycopy.} = object
    Output: WTS_PROTOCOL_COUNTERS
    Input: WTS_PROTOCOL_COUNTERS
    Cache: WTS_CACHE_STATS
    AsyncSignal: uint32
    AsyncSignalMask: uint32
    Counters: array[100, int64]
struct WTS_PROTOCOL_COUNTERS
{
    uint WdBytes;
    uint WdFrames;
    uint WaitForOutBuf;
    uint Frames;
    uint Bytes;
    uint CompressedBytes;
    uint CompressFlushes;
    uint Errors;
    uint Timeouts;
    uint AsyncFramingError;
    uint AsyncOverrunError;
    uint AsyncOverflowError;
    uint AsyncParityError;
    uint TdErrors;
    ushort ProtocolType;
    ushort Length;
    ushort Specific;
    uint[100] Reserved;
}

struct WTS_PROTOCOL_CACHE
{
    uint CacheReads;
    uint CacheHits;
}

struct WTS_CACHE_STATS_UN
{
    WTS_PROTOCOL_CACHE[4] ProtocolCache;
    uint TShareCacheStats;
    uint[20] Reserved;
}

struct WTS_CACHE_STATS
{
    uint Specific;
    WTS_CACHE_STATS_UN Data;
    ushort ProtocolType;
    ushort Length;
}

struct WTS_PROTOCOL_STATUS
{
    WTS_PROTOCOL_COUNTERS Output;
    WTS_PROTOCOL_COUNTERS Input;
    WTS_CACHE_STATS Cache;
    uint AsyncSignal;
    uint AsyncSignalMask;
    long[100] Counters;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WTS_PROTOCOL_STATUS サイズ: 1824 バイト(x64)
dim st, 456    ; 4byte整数×456(構造体サイズ 1824 / 4 切り上げ)
; Output : WTS_PROTOCOL_COUNTERS (+0, 464byte)  varptr(st)+0 を基点に操作(464byte:入れ子/配列)
; Input : WTS_PROTOCOL_COUNTERS (+464, 464byte)  varptr(st)+464 を基点に操作(464byte:入れ子/配列)
; Cache : WTS_CACHE_STATS (+928, 88byte)  varptr(st)+928 を基点に操作(88byte:入れ子/配列)
; AsyncSignal : DWORD (+1016, 4byte)  st.254 = 値  /  値 = st.254   (lpoke/lpeek も可)
; AsyncSignalMask : DWORD (+1020, 4byte)  st.255 = 値  /  値 = st.255   (lpoke/lpeek も可)
; Counters : LONGLONG (+1024, 800byte)  varptr(st)+1024 を基点に操作(800byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WTS_PROTOCOL_COUNTERS
    #field int WdBytes
    #field int WdFrames
    #field int WaitForOutBuf
    #field int Frames
    #field int Bytes
    #field int CompressedBytes
    #field int CompressFlushes
    #field int Errors
    #field int Timeouts
    #field int AsyncFramingError
    #field int AsyncOverrunError
    #field int AsyncOverflowError
    #field int AsyncParityError
    #field int TdErrors
    #field short ProtocolType
    #field short Length
    #field short Specific
    #field int Reserved 100
#endstruct

#defstruct global WTS_CACHE_STATS
    #field int Specific
    #field byte Data 80
    #field short ProtocolType
    #field short Length
#endstruct

#defstruct global WTS_PROTOCOL_STATUS
    #field WTS_PROTOCOL_COUNTERS Output
    #field WTS_PROTOCOL_COUNTERS Input
    #field WTS_CACHE_STATS Cache
    #field int AsyncSignal
    #field int AsyncSignalMask
    #field int64 Counters 100
#endstruct

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