ホーム › Networking.Clustering › MONITOR_STATE
MONITOR_STATE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| LastUpdate | LONGLONG | 8 | +0 | +0 | 状態が最後に更新された時刻を示す符号付き64ビット値である。 |
| State | RESOURCE_MONITOR_STATE | 4 | +8 | +8 | リソースモニターの状態を示すRESOURCE_MONITOR_STATE列挙値である。 |
| ActiveResource | HANDLE | 8/4 | +16 | +12 | 現在処理中のアクティブリソースのハンドルである。 |
| ResmonStop | BOOL | 4 | +24 | +16 | リソースモニターの停止が要求されたかを示すBOOL値である。 |
各言語での定義
#include <windows.h>
// MONITOR_STATE (x64 32 / x86 24 バイト)
typedef struct MONITOR_STATE {
LONGLONG LastUpdate;
RESOURCE_MONITOR_STATE State;
HANDLE ActiveResource;
BOOL ResmonStop;
} MONITOR_STATE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MONITOR_STATE
{
public long LastUpdate;
public int State;
public IntPtr ActiveResource;
[MarshalAs(UnmanagedType.Bool)] public bool ResmonStop;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MONITOR_STATE
Public LastUpdate As Long
Public State As Integer
Public ActiveResource As IntPtr
<MarshalAs(UnmanagedType.Bool)> Public ResmonStop As Boolean
End Structureimport ctypes
from ctypes import wintypes
class MONITOR_STATE(ctypes.Structure):
_fields_ = [
("LastUpdate", ctypes.c_longlong),
("State", ctypes.c_int),
("ActiveResource", ctypes.c_void_p),
("ResmonStop", wintypes.BOOL),
]#[repr(C)]
pub struct MONITOR_STATE {
pub LastUpdate: i64,
pub State: i32,
pub ActiveResource: *mut core::ffi::c_void,
pub ResmonStop: i32,
}import "golang.org/x/sys/windows"
type MONITOR_STATE struct {
LastUpdate int64
State int32
ActiveResource uintptr
ResmonStop int32
}type
MONITOR_STATE = record
LastUpdate: Int64;
State: Integer;
ActiveResource: Pointer;
ResmonStop: BOOL;
end;const MONITOR_STATE = extern struct {
LastUpdate: i64,
State: i32,
ActiveResource: ?*anyopaque,
ResmonStop: i32,
};type
MONITOR_STATE {.bycopy.} = object
LastUpdate: int64
State: int32
ActiveResource: pointer
ResmonStop: int32struct MONITOR_STATE
{
long LastUpdate;
int State;
void* ActiveResource;
int ResmonStop;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MONITOR_STATE サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; LastUpdate : LONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; State : RESOURCE_MONITOR_STATE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ActiveResource : HANDLE (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ResmonStop : BOOL (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MONITOR_STATE サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; LastUpdate : LONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; State : RESOURCE_MONITOR_STATE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ActiveResource : HANDLE (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; ResmonStop : BOOL (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MONITOR_STATE
#field int64 LastUpdate
#field int State
#field intptr ActiveResource
#field bool ResmonStop
#endstruct
stdim st, MONITOR_STATE ; NSTRUCT 変数を確保
st->LastUpdate = 100
mes "LastUpdate=" + st->LastUpdate