ホーム › System.Wmi › MI_DatetimeField
MI_DatetimeField
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| value | MI_Datetime | 36 | +0 | +0 | 日時/時間間隔(MI_Datetime)のフィールド値。 |
| exists | BYTE | 1 | +36 | +36 | 値が設定されているかを示すフラグ(非0で存在)。 |
| flags | BYTE | 1 | +37 | +37 | フィールドの属性を示すフラグ。 |
各言語での定義
#include <windows.h>
// MI_Datetime (x64 36 / x86 36 バイト)
typedef struct MI_Datetime {
DWORD isTimestamp;
_u_e__Union u;
} MI_Datetime;
// MI_DatetimeField (x64 40 / x86 40 バイト)
typedef struct MI_DatetimeField {
MI_Datetime value;
BYTE exists;
BYTE flags;
} MI_DatetimeField;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MI_Datetime
{
public uint isTimestamp;
public _u_e__Union u;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MI_DatetimeField
{
public MI_Datetime value;
public byte exists;
public byte flags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MI_Datetime
Public isTimestamp As UInteger
Public u As _u_e__Union
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MI_DatetimeField
Public value As MI_Datetime
Public exists As Byte
Public flags As Byte
End Structureimport ctypes
from ctypes import wintypes
class MI_Datetime(ctypes.Structure):
_fields_ = [
("isTimestamp", wintypes.DWORD),
("u", _u_e__Union),
]
class MI_DatetimeField(ctypes.Structure):
_fields_ = [
("value", MI_Datetime),
("exists", ctypes.c_ubyte),
("flags", ctypes.c_ubyte),
]#[repr(C)]
pub struct MI_Datetime {
pub isTimestamp: u32,
pub u: _u_e__Union,
}
#[repr(C)]
pub struct MI_DatetimeField {
pub value: MI_Datetime,
pub exists: u8,
pub flags: u8,
}import "golang.org/x/sys/windows"
type MI_Datetime struct {
isTimestamp uint32
u _u_e__Union
}
type MI_DatetimeField struct {
value MI_Datetime
exists byte
flags byte
}type
MI_Datetime = record
isTimestamp: DWORD;
u: _u_e__Union;
end;
MI_DatetimeField = record
value: MI_Datetime;
exists: Byte;
flags: Byte;
end;const MI_Datetime = extern struct {
isTimestamp: u32,
u: _u_e__Union,
};
const MI_DatetimeField = extern struct {
value: MI_Datetime,
exists: u8,
flags: u8,
};type
MI_Datetime {.bycopy.} = object
isTimestamp: uint32
u: _u_e__Union
MI_DatetimeField {.bycopy.} = object
value: MI_Datetime
exists: uint8
flags: uint8struct MI_Datetime
{
uint isTimestamp;
_u_e__Union u;
}
struct MI_DatetimeField
{
MI_Datetime value;
ubyte exists;
ubyte flags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MI_DatetimeField サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; value : MI_Datetime (+0, 36byte) varptr(st)+0 を基点に操作(36byte:入れ子/配列)
; exists : BYTE (+36, 1byte) poke st,36,値 / 値 = peek(st,36)
; flags : BYTE (+37, 1byte) poke st,37,値 / 値 = peek(st,37)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global MI_Datetime
#field int isTimestamp
#field byte u 32
#endstruct
#defstruct global MI_DatetimeField
#field MI_Datetime value
#field byte exists
#field byte flags
#endstruct
stdim st, MI_DatetimeField ; NSTRUCT 変数を確保
st->exists = 100
mes "exists=" + st->exists