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

MI_Module

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

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

フィールド

フィールドサイズx64x86説明
versionDWORD4+0+0このモジュールが準拠するMI APIバージョン。
generatorVersionDWORD4+4+4モジュールを生成したツールのバージョン。
flagsDWORD4+8+8モジュールの属性を示すフラグ群。
charSizeDWORD4+12+12文字幅(バイト)。通常はワイド文字を示す。
schemaDeclMI_SchemaDecl*8/4+16+16モジュールのスキーマ宣言へのポインタ。
LoadMI_Module_Load8/4+24+20モジュールロード時に呼ばれる初期化関数ポインタ。
UnloadMI_Module_Unload8/4+32+24モジュールアンロード時に呼ばれる終了関数ポインタ。
dynamicProviderFTMI_ProviderFT*8/4+40+28動的プロバイダー用の関数テーブルへのポインタ。NULL可。

各言語での定義

#include <windows.h>

// MI_Module  (x64 48 / x86 32 バイト)
typedef struct MI_Module {
    DWORD version;
    DWORD generatorVersion;
    DWORD flags;
    DWORD charSize;
    MI_SchemaDecl* schemaDecl;
    MI_Module_Load Load;
    MI_Module_Unload Unload;
    MI_ProviderFT* dynamicProviderFT;
} MI_Module;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MI_Module
{
    public uint version;
    public uint generatorVersion;
    public uint flags;
    public uint charSize;
    public IntPtr schemaDecl;
    public IntPtr Load;
    public IntPtr Unload;
    public IntPtr dynamicProviderFT;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MI_Module
    Public version As UInteger
    Public generatorVersion As UInteger
    Public flags As UInteger
    Public charSize As UInteger
    Public schemaDecl As IntPtr
    Public Load As IntPtr
    Public Unload As IntPtr
    Public dynamicProviderFT As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class MI_Module(ctypes.Structure):
    _fields_ = [
        ("version", wintypes.DWORD),
        ("generatorVersion", wintypes.DWORD),
        ("flags", wintypes.DWORD),
        ("charSize", wintypes.DWORD),
        ("schemaDecl", ctypes.c_void_p),
        ("Load", ctypes.c_void_p),
        ("Unload", ctypes.c_void_p),
        ("dynamicProviderFT", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct MI_Module {
    pub version: u32,
    pub generatorVersion: u32,
    pub flags: u32,
    pub charSize: u32,
    pub schemaDecl: *mut core::ffi::c_void,
    pub Load: *mut core::ffi::c_void,
    pub Unload: *mut core::ffi::c_void,
    pub dynamicProviderFT: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type MI_Module struct {
	version uint32
	generatorVersion uint32
	flags uint32
	charSize uint32
	schemaDecl uintptr
	Load uintptr
	Unload uintptr
	dynamicProviderFT uintptr
}
type
  MI_Module = record
    version: DWORD;
    generatorVersion: DWORD;
    flags: DWORD;
    charSize: DWORD;
    schemaDecl: Pointer;
    Load: Pointer;
    Unload: Pointer;
    dynamicProviderFT: Pointer;
  end;
const MI_Module = extern struct {
    version: u32,
    generatorVersion: u32,
    flags: u32,
    charSize: u32,
    schemaDecl: ?*anyopaque,
    Load: ?*anyopaque,
    Unload: ?*anyopaque,
    dynamicProviderFT: ?*anyopaque,
};
type
  MI_Module {.bycopy.} = object
    version: uint32
    generatorVersion: uint32
    flags: uint32
    charSize: uint32
    schemaDecl: pointer
    Load: pointer
    Unload: pointer
    dynamicProviderFT: pointer
struct MI_Module
{
    uint version;
    uint generatorVersion;
    uint flags;
    uint charSize;
    void* schemaDecl;
    void* Load;
    void* Unload;
    void* dynamicProviderFT;
}

HSP用 定義

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

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

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