ホーム › System.RemoteDesktop › WTS_CACHE_STATS
WTS_CACHE_STATS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Specific | DWORD | 4 | +0 | +0 | プロトコル固有のキャッシュ統計値。 |
| Data | WTS_CACHE_STATS_UN | 80 | +4 | +4 | キャッシュ統計データの共用体。WTS_CACHE_STATS_UNで表す。 |
| ProtocolType | WORD | 2 | +84 | +84 | 対象プロトコルの種別を示す数値。 |
| Length | WORD | 2 | +86 | +86 | この構造体の長さをバイト単位で表す。 |
各言語での定義
#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;
// 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;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;
}
[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;
}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
<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 Structureimport 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),
]
class WTS_CACHE_STATS(ctypes.Structure):
_fields_ = [
("Specific", wintypes.DWORD),
("Data", WTS_CACHE_STATS_UN),
("ProtocolType", ctypes.c_ushort),
("Length", ctypes.c_ushort),
]#[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,
}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_CACHE_STATS struct {
Specific uint32
Data WTS_CACHE_STATS_UN
ProtocolType uint16
Length uint16
}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;
WTS_CACHE_STATS = record
Specific: DWORD;
Data: WTS_CACHE_STATS_UN;
ProtocolType: Word;
Length: Word;
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,
};
const WTS_CACHE_STATS = extern struct {
Specific: u32,
Data: WTS_CACHE_STATS_UN,
ProtocolType: u16,
Length: u16,
};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]
WTS_CACHE_STATS {.bycopy.} = object
Specific: uint32
Data: WTS_CACHE_STATS_UN
ProtocolType: uint16
Length: uint16struct 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;
}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 サイズ: 88 バイト(x64)
dim st, 22 ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; Specific : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Data : WTS_CACHE_STATS_UN (+4, 80byte) varptr(st)+4 を基点に操作(80byte:入れ子/配列)
; ProtocolType : WORD (+84, 2byte) wpoke st,84,値 / 値 = wpeek(st,84)
; Length : WORD (+86, 2byte) wpoke st,86,値 / 値 = wpeek(st,86)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WTS_CACHE_STATS
#field int Specific
#field byte Data 80
#field short ProtocolType
#field short Length
#endstruct
stdim st, WTS_CACHE_STATS ; NSTRUCT 変数を確保
st->Specific = 100
mes "Specific=" + st->Specific
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。