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

MI_MethodDecl

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

サイズ=各フィールドのバイト数(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修飾子配列の要素数。
parametersMI_ParameterDecl**8/4+32+20メソッドパラメータ宣言配列へのポインタ。
numParametersDWORD4+40+24パラメータ宣言の数。
sizeDWORD4+44+28パラメータ構造体のメモリサイズ(バイト)。
returnTypeDWORD4+48+32メソッド戻り値のMI型を示す値。
originWORD*8/4+56+36このメソッドを最初に定義したクラス名へのポインタ。
propagatorWORD*8/4+64+40このメソッドを伝播したクラス名へのポインタ。
schemaMI_SchemaDecl*8/4+72+44このメソッドを含むスキーマ宣言へのポインタ。
functionMI_MethodDecl_Invoke8/4+80+48メソッド本体を呼び出す関数ポインタ。

各言語での定義

#include <windows.h>

// MI_MethodDecl  (x64 88 / x86 52 バイト)
typedef struct MI_MethodDecl {
    DWORD flags;
    DWORD code;
    WORD* name;
    MI_Qualifier** qualifiers;
    DWORD numQualifiers;
    MI_ParameterDecl** parameters;
    DWORD numParameters;
    DWORD size;
    DWORD returnType;
    WORD* origin;
    WORD* propagator;
    MI_SchemaDecl* schema;
    MI_MethodDecl_Invoke function;
} MI_MethodDecl;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MI_MethodDecl
{
    public uint flags;
    public uint code;
    public IntPtr name;
    public IntPtr qualifiers;
    public uint numQualifiers;
    public IntPtr parameters;
    public uint numParameters;
    public uint size;
    public uint returnType;
    public IntPtr origin;
    public IntPtr propagator;
    public IntPtr schema;
    public IntPtr function;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MI_MethodDecl
    Public flags As UInteger
    Public code As UInteger
    Public name As IntPtr
    Public qualifiers As IntPtr
    Public numQualifiers As UInteger
    Public parameters As IntPtr
    Public numParameters As UInteger
    Public size As UInteger
    Public returnType As UInteger
    Public origin As IntPtr
    Public propagator As IntPtr
    Public schema As IntPtr
    Public function As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class MI_MethodDecl(ctypes.Structure):
    _fields_ = [
        ("flags", wintypes.DWORD),
        ("code", wintypes.DWORD),
        ("name", ctypes.c_void_p),
        ("qualifiers", ctypes.c_void_p),
        ("numQualifiers", wintypes.DWORD),
        ("parameters", ctypes.c_void_p),
        ("numParameters", wintypes.DWORD),
        ("size", wintypes.DWORD),
        ("returnType", wintypes.DWORD),
        ("origin", ctypes.c_void_p),
        ("propagator", ctypes.c_void_p),
        ("schema", ctypes.c_void_p),
        ("function", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct MI_MethodDecl {
    pub flags: u32,
    pub code: u32,
    pub name: *mut core::ffi::c_void,
    pub qualifiers: *mut core::ffi::c_void,
    pub numQualifiers: u32,
    pub parameters: *mut core::ffi::c_void,
    pub numParameters: u32,
    pub size: u32,
    pub returnType: u32,
    pub origin: *mut core::ffi::c_void,
    pub propagator: *mut core::ffi::c_void,
    pub schema: *mut core::ffi::c_void,
    pub function: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type MI_MethodDecl struct {
	flags uint32
	code uint32
	name uintptr
	qualifiers uintptr
	numQualifiers uint32
	parameters uintptr
	numParameters uint32
	size uint32
	returnType uint32
	origin uintptr
	propagator uintptr
	schema uintptr
	function uintptr
}
type
  MI_MethodDecl = record
    flags: DWORD;
    code: DWORD;
    name: Pointer;
    qualifiers: Pointer;
    numQualifiers: DWORD;
    parameters: Pointer;
    numParameters: DWORD;
    size: DWORD;
    returnType: DWORD;
    origin: Pointer;
    propagator: Pointer;
    schema: Pointer;
    function: Pointer;
  end;
const MI_MethodDecl = extern struct {
    flags: u32,
    code: u32,
    name: ?*anyopaque,
    qualifiers: ?*anyopaque,
    numQualifiers: u32,
    parameters: ?*anyopaque,
    numParameters: u32,
    size: u32,
    returnType: u32,
    origin: ?*anyopaque,
    propagator: ?*anyopaque,
    schema: ?*anyopaque,
    function: ?*anyopaque,
};
type
  MI_MethodDecl {.bycopy.} = object
    flags: uint32
    code: uint32
    name: pointer
    qualifiers: pointer
    numQualifiers: uint32
    parameters: pointer
    numParameters: uint32
    size: uint32
    returnType: uint32
    origin: pointer
    propagator: pointer
    schema: pointer
    function: pointer
struct MI_MethodDecl
{
    uint flags;
    uint code;
    void* name;
    void* qualifiers;
    uint numQualifiers;
    void* parameters;
    uint numParameters;
    uint size;
    uint returnType;
    void* origin;
    void* propagator;
    void* schema;
    void* function;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MI_MethodDecl サイズ: 52 バイト(x86)
dim st, 13    ; 4byte整数×13(構造体サイズ 52 / 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 も可)
; parameters : MI_ParameterDecl** (+20, 4byte)  varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; numParameters : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; size : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; returnType : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; origin : WORD* (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; propagator : WORD* (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; schema : MI_SchemaDecl* (+44, 4byte)  varptr(st)+44 を基点に操作(4byte:入れ子/配列)
; function : MI_MethodDecl_Invoke (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MI_MethodDecl サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 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 も可)
; parameters : MI_ParameterDecl** (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; numParameters : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; size : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; returnType : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; origin : WORD* (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; propagator : WORD* (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; schema : MI_SchemaDecl* (+72, 8byte)  varptr(st)+72 を基点に操作(8byte:入れ子/配列)
; function : MI_MethodDecl_Invoke (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MI_MethodDecl
    #field int flags
    #field int code
    #field intptr name
    #field intptr qualifiers
    #field int numQualifiers
    #field intptr parameters
    #field int numParameters
    #field int size
    #field int returnType
    #field intptr origin
    #field intptr propagator
    #field intptr schema
    #field intptr function
#endstruct

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