ホーム › System.Ioctl › STORAGE_COUNTER
STORAGE_COUNTER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Type | STORAGE_COUNTER_TYPE | 4 | +0 | +0 | カウンタの種類を示す列挙値。 |
| Value | _Value_e__Union | 8 | +8 | +8 | カウンタの値を保持する共用体。Typeに応じて解釈する。 |
共用体: _Value_e__Union x64 8B / x86 8B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| ManufactureDate | _ManufactureDate_e__Struct | 8/4 | +0 | +0 |
| AsUlonglong | ULONGLONG | 8 | +0 | +0 |
各言語での定義
#include <windows.h>
// STORAGE_COUNTER (x64 16 / x86 16 バイト)
typedef struct STORAGE_COUNTER {
STORAGE_COUNTER_TYPE Type;
_Value_e__Union Value;
} STORAGE_COUNTER;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STORAGE_COUNTER
{
public int Type;
public _Value_e__Union Value;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STORAGE_COUNTER
Public Type As Integer
Public Value As _Value_e__Union
End Structureimport ctypes
from ctypes import wintypes
class STORAGE_COUNTER(ctypes.Structure):
_fields_ = [
("Type", ctypes.c_int),
("Value", _Value_e__Union),
]#[repr(C)]
pub struct STORAGE_COUNTER {
pub Type: i32,
pub Value: _Value_e__Union,
}import "golang.org/x/sys/windows"
type STORAGE_COUNTER struct {
Type int32
Value _Value_e__Union
}type
STORAGE_COUNTER = record
Type: Integer;
Value: _Value_e__Union;
end;const STORAGE_COUNTER = extern struct {
Type: i32,
Value: _Value_e__Union,
};type
STORAGE_COUNTER {.bycopy.} = object
Type: int32
Value: _Value_e__Unionstruct STORAGE_COUNTER
{
int Type;
_Value_e__Union Value;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STORAGE_COUNTER サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Type : STORAGE_COUNTER_TYPE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Value : _Value_e__Union (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STORAGE_COUNTER
#field int Type
#field byte Value 8
#endstruct
stdim st, STORAGE_COUNTER ; NSTRUCT 変数を確保
st->Type = 100
mes "Type=" + st->Type
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。