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

WTS_CACHE_STATS_UN

共用体
サイズx64: 80 バイト / x86: 80 バイト

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

フィールド

フィールドサイズx64x86説明
ProtocolCacheWTS_PROTOCOL_CACHE32+0+0プロトコル別キャッシュ統計。WTS_PROTOCOL_CACHEで表す共用体メンバー。
TShareCacheStatsDWORD4+0+0T.Shareプロトコルのキャッシュ統計値を表す共用体メンバー。
ReservedDWORD80+0+0予約済みの共用体メンバー。将来の拡張用。

各言語での定義

#include <windows.h>

// 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;
using System;
using System.Runtime.InteropServices;

[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;
}
Imports System.Runtime.InteropServices

<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
import ctypes
from ctypes import wintypes

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),
    ]
#[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],
}
import "golang.org/x/sys/windows"

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_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;
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,
};
type
  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]
struct WTS_PROTOCOL_CACHE
{
    uint CacheReads;
    uint CacheHits;
}

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

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WTS_CACHE_STATS_UN サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; ProtocolCache : WTS_PROTOCOL_CACHE (+0, 32byte)  varptr(st)+0 を基点に操作(32byte:入れ子/配列)
; TShareCacheStats : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Reserved : DWORD (+0, 80byte)  varptr(st)+0 を基点に操作(80byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WTS_PROTOCOL_CACHE
    #field int CacheReads
    #field int CacheHits
#endstruct

#defstruct global WTS_CACHE_STATS_UN
    #field WTS_PROTOCOL_CACHE ProtocolCache 4
    #field int TShareCacheStats
    #field int Reserved 20
#endstruct

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