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

MI_OperationCallbacks

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

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

フィールド

フィールドサイズx64x86説明
callbackContextvoid*8/4+0+0各コールバックに渡されるユーザー定義コンテキスト。NULL可。
promptUserMI_OperationCallback_PromptUser8/4+8+4ユーザー確認プロンプト時に呼ばれるコールバック。
writeErrorMI_OperationCallback_WriteError8/4+16+8エラー書き込み時に呼ばれるコールバック。
writeMessageMI_OperationCallback_WriteMessage8/4+24+12メッセージ書き込み時に呼ばれるコールバック。
writeProgressMI_OperationCallback_WriteProgress8/4+32+16進捗書き込み時に呼ばれるコールバック。
instanceResultMI_OperationCallback_Instance8/4+40+20インスタンス結果受信時に呼ばれるコールバック。
indicationResultMI_OperationCallback_Indication8/4+48+24インディケーション結果受信時に呼ばれるコールバック。
classResultMI_OperationCallback_Class8/4+56+28クラス結果受信時に呼ばれるコールバック。
streamedParameterResultMI_OperationCallback_StreamedParameter8/4+64+32ストリームパラメータ結果受信時に呼ばれるコールバック。

各言語での定義

#include <windows.h>

// MI_OperationCallbacks  (x64 72 / x86 36 バイト)
typedef struct MI_OperationCallbacks {
    void* callbackContext;
    MI_OperationCallback_PromptUser promptUser;
    MI_OperationCallback_WriteError writeError;
    MI_OperationCallback_WriteMessage writeMessage;
    MI_OperationCallback_WriteProgress writeProgress;
    MI_OperationCallback_Instance instanceResult;
    MI_OperationCallback_Indication indicationResult;
    MI_OperationCallback_Class classResult;
    MI_OperationCallback_StreamedParameter streamedParameterResult;
} MI_OperationCallbacks;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MI_OperationCallbacks
{
    public IntPtr callbackContext;
    public IntPtr promptUser;
    public IntPtr writeError;
    public IntPtr writeMessage;
    public IntPtr writeProgress;
    public IntPtr instanceResult;
    public IntPtr indicationResult;
    public IntPtr classResult;
    public IntPtr streamedParameterResult;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MI_OperationCallbacks
    Public callbackContext As IntPtr
    Public promptUser As IntPtr
    Public writeError As IntPtr
    Public writeMessage As IntPtr
    Public writeProgress As IntPtr
    Public instanceResult As IntPtr
    Public indicationResult As IntPtr
    Public classResult As IntPtr
    Public streamedParameterResult As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class MI_OperationCallbacks(ctypes.Structure):
    _fields_ = [
        ("callbackContext", ctypes.c_void_p),
        ("promptUser", ctypes.c_void_p),
        ("writeError", ctypes.c_void_p),
        ("writeMessage", ctypes.c_void_p),
        ("writeProgress", ctypes.c_void_p),
        ("instanceResult", ctypes.c_void_p),
        ("indicationResult", ctypes.c_void_p),
        ("classResult", ctypes.c_void_p),
        ("streamedParameterResult", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct MI_OperationCallbacks {
    pub callbackContext: *mut core::ffi::c_void,
    pub promptUser: *mut core::ffi::c_void,
    pub writeError: *mut core::ffi::c_void,
    pub writeMessage: *mut core::ffi::c_void,
    pub writeProgress: *mut core::ffi::c_void,
    pub instanceResult: *mut core::ffi::c_void,
    pub indicationResult: *mut core::ffi::c_void,
    pub classResult: *mut core::ffi::c_void,
    pub streamedParameterResult: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type MI_OperationCallbacks struct {
	callbackContext uintptr
	promptUser uintptr
	writeError uintptr
	writeMessage uintptr
	writeProgress uintptr
	instanceResult uintptr
	indicationResult uintptr
	classResult uintptr
	streamedParameterResult uintptr
}
type
  MI_OperationCallbacks = record
    callbackContext: Pointer;
    promptUser: Pointer;
    writeError: Pointer;
    writeMessage: Pointer;
    writeProgress: Pointer;
    instanceResult: Pointer;
    indicationResult: Pointer;
    classResult: Pointer;
    streamedParameterResult: Pointer;
  end;
const MI_OperationCallbacks = extern struct {
    callbackContext: ?*anyopaque,
    promptUser: ?*anyopaque,
    writeError: ?*anyopaque,
    writeMessage: ?*anyopaque,
    writeProgress: ?*anyopaque,
    instanceResult: ?*anyopaque,
    indicationResult: ?*anyopaque,
    classResult: ?*anyopaque,
    streamedParameterResult: ?*anyopaque,
};
type
  MI_OperationCallbacks {.bycopy.} = object
    callbackContext: pointer
    promptUser: pointer
    writeError: pointer
    writeMessage: pointer
    writeProgress: pointer
    instanceResult: pointer
    indicationResult: pointer
    classResult: pointer
    streamedParameterResult: pointer
struct MI_OperationCallbacks
{
    void* callbackContext;
    void* promptUser;
    void* writeError;
    void* writeMessage;
    void* writeProgress;
    void* instanceResult;
    void* indicationResult;
    void* classResult;
    void* streamedParameterResult;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MI_OperationCallbacks サイズ: 36 バイト(x86)
dim st, 9    ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; callbackContext : void* (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; promptUser : MI_OperationCallback_PromptUser (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; writeError : MI_OperationCallback_WriteError (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; writeMessage : MI_OperationCallback_WriteMessage (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; writeProgress : MI_OperationCallback_WriteProgress (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; instanceResult : MI_OperationCallback_Instance (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; indicationResult : MI_OperationCallback_Indication (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; classResult : MI_OperationCallback_Class (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; streamedParameterResult : MI_OperationCallback_StreamedParameter (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MI_OperationCallbacks サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; callbackContext : void* (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; promptUser : MI_OperationCallback_PromptUser (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; writeError : MI_OperationCallback_WriteError (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; writeMessage : MI_OperationCallback_WriteMessage (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; writeProgress : MI_OperationCallback_WriteProgress (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; instanceResult : MI_OperationCallback_Instance (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; indicationResult : MI_OperationCallback_Indication (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; classResult : MI_OperationCallback_Class (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; streamedParameterResult : MI_OperationCallback_StreamedParameter (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MI_OperationCallbacks
    #field intptr callbackContext
    #field intptr promptUser
    #field intptr writeError
    #field intptr writeMessage
    #field intptr writeProgress
    #field intptr instanceResult
    #field intptr indicationResult
    #field intptr classResult
    #field intptr streamedParameterResult
#endstruct

stdim st, MI_OperationCallbacks        ; NSTRUCT 変数を確保