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

MI_ConstDatetimeField

構造体
サイズx64: 40 バイト / x86: 40 バイト

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

フィールド

フィールドサイズx64x86説明
valueMI_Datetime36+0+0読み取り専用の日時/時間間隔(MI_Datetime)フィールド値。
existsBYTE1+36+36値が設定されているかを示すフラグ(非0で存在)。
flagsBYTE1+37+37フィールドの属性を示すフラグ。

各言語での定義

#include <windows.h>

// MI_Datetime  (x64 36 / x86 36 バイト)
typedef struct MI_Datetime {
    DWORD isTimestamp;
    _u_e__Union u;
} MI_Datetime;

// MI_ConstDatetimeField  (x64 40 / x86 40 バイト)
typedef struct MI_ConstDatetimeField {
    MI_Datetime value;
    BYTE exists;
    BYTE flags;
} MI_ConstDatetimeField;
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_ConstDatetimeField
{
    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_ConstDatetimeField
    Public value As MI_Datetime
    Public exists As Byte
    Public flags As Byte
End Structure
import ctypes
from ctypes import wintypes

class MI_Datetime(ctypes.Structure):
    _fields_ = [
        ("isTimestamp", wintypes.DWORD),
        ("u", _u_e__Union),
    ]

class MI_ConstDatetimeField(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_ConstDatetimeField {
    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_ConstDatetimeField struct {
	value MI_Datetime
	exists byte
	flags byte
}
type
  MI_Datetime = record
    isTimestamp: DWORD;
    u: _u_e__Union;
  end;

  MI_ConstDatetimeField = record
    value: MI_Datetime;
    exists: Byte;
    flags: Byte;
  end;
const MI_Datetime = extern struct {
    isTimestamp: u32,
    u: _u_e__Union,
};

const MI_ConstDatetimeField = extern struct {
    value: MI_Datetime,
    exists: u8,
    flags: u8,
};
type
  MI_Datetime {.bycopy.} = object
    isTimestamp: uint32
    u: _u_e__Union

  MI_ConstDatetimeField {.bycopy.} = object
    value: MI_Datetime
    exists: uint8
    flags: uint8
struct MI_Datetime
{
    uint isTimestamp;
    _u_e__Union u;
}

struct MI_ConstDatetimeField
{
    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_ConstDatetimeField サイズ: 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_ConstDatetimeField
    #field MI_Datetime value
    #field byte exists
    #field byte flags
#endstruct

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