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

MI_ObjectDecl

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

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

フィールド

フィールドサイズx64x86説明
flagsDWORD4+0+0オブジェクト宣言の属性を示すフラグ群。
codeDWORD4+4+4宣言を識別するハッシュコード。検索高速化に用いる。
nameWORD*8/4+8+8オブジェクト名へのワイド文字列ポインタ。
qualifiersMI_Qualifier**8/4+16+12オブジェクトに付与された修飾子配列へのポインタ。
numQualifiersDWORD4+24+16修飾子配列の要素数。
propertiesMI_PropertyDecl**8/4+32+20プロパティ宣言配列へのポインタ。
numPropertiesDWORD4+40+24プロパティ宣言の数。
sizeDWORD4+44+28このオブジェクトのメモリ上のサイズ(バイト)。

各言語での定義

#include <windows.h>

// MI_ObjectDecl  (x64 48 / x86 32 バイト)
typedef struct MI_ObjectDecl {
    DWORD flags;
    DWORD code;
    WORD* name;
    MI_Qualifier** qualifiers;
    DWORD numQualifiers;
    MI_PropertyDecl** properties;
    DWORD numProperties;
    DWORD size;
} MI_ObjectDecl;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MI_ObjectDecl
{
    public uint flags;
    public uint code;
    public IntPtr name;
    public IntPtr qualifiers;
    public uint numQualifiers;
    public IntPtr properties;
    public uint numProperties;
    public uint size;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MI_ObjectDecl
    Public flags As UInteger
    Public code As UInteger
    Public name As IntPtr
    Public qualifiers As IntPtr
    Public numQualifiers As UInteger
    Public properties As IntPtr
    Public numProperties As UInteger
    Public size As UInteger
End Structure
import ctypes
from ctypes import wintypes

class MI_ObjectDecl(ctypes.Structure):
    _fields_ = [
        ("flags", wintypes.DWORD),
        ("code", wintypes.DWORD),
        ("name", ctypes.c_void_p),
        ("qualifiers", ctypes.c_void_p),
        ("numQualifiers", wintypes.DWORD),
        ("properties", ctypes.c_void_p),
        ("numProperties", wintypes.DWORD),
        ("size", wintypes.DWORD),
    ]
#[repr(C)]
pub struct MI_ObjectDecl {
    pub flags: u32,
    pub code: u32,
    pub name: *mut core::ffi::c_void,
    pub qualifiers: *mut core::ffi::c_void,
    pub numQualifiers: u32,
    pub properties: *mut core::ffi::c_void,
    pub numProperties: u32,
    pub size: u32,
}
import "golang.org/x/sys/windows"

type MI_ObjectDecl struct {
	flags uint32
	code uint32
	name uintptr
	qualifiers uintptr
	numQualifiers uint32
	properties uintptr
	numProperties uint32
	size uint32
}
type
  MI_ObjectDecl = record
    flags: DWORD;
    code: DWORD;
    name: Pointer;
    qualifiers: Pointer;
    numQualifiers: DWORD;
    properties: Pointer;
    numProperties: DWORD;
    size: DWORD;
  end;
const MI_ObjectDecl = extern struct {
    flags: u32,
    code: u32,
    name: ?*anyopaque,
    qualifiers: ?*anyopaque,
    numQualifiers: u32,
    properties: ?*anyopaque,
    numProperties: u32,
    size: u32,
};
type
  MI_ObjectDecl {.bycopy.} = object
    flags: uint32
    code: uint32
    name: pointer
    qualifiers: pointer
    numQualifiers: uint32
    properties: pointer
    numProperties: uint32
    size: uint32
struct MI_ObjectDecl
{
    uint flags;
    uint code;
    void* name;
    void* qualifiers;
    uint numQualifiers;
    void* properties;
    uint numProperties;
    uint size;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MI_ObjectDecl サイズ: 32 バイト(x86)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; flags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; code : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; name : WORD* (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; qualifiers : MI_Qualifier** (+12, 4byte)  varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; numQualifiers : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; properties : MI_PropertyDecl** (+20, 4byte)  varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; numProperties : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; size : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MI_ObjectDecl サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; flags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; code : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; name : WORD* (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; qualifiers : MI_Qualifier** (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; numQualifiers : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; properties : MI_PropertyDecl** (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; numProperties : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; size : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MI_ObjectDecl
    #field int flags
    #field int code
    #field intptr name
    #field intptr qualifiers
    #field int numQualifiers
    #field intptr properties
    #field int numProperties
    #field int size
#endstruct

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