ホーム › System.Wmi › MI_OperationCallbacks
MI_OperationCallbacks
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| callbackContext | void* | 8/4 | +0 | +0 | すべてのコールバックに渡される、クライアント固有のコンテキストです。これは、コールバックを関連する操作に対応付けるために使用されます。この値は、すべての操作コールバックに渡されます。 |
| promptUser | MI_OperationCallback_PromptUser | 8/4 | +8 | +4 | サーバーからのユーザーへのプロンプト要求を処理する、省略可能なコールバックです。 |
| writeError | MI_OperationCallback_WriteError | 8/4 | +16 | +8 | サーバーからの書き込みエラーメッセージを受け取る、省略可能なコールバックです。 |
| writeMessage | MI_OperationCallback_WriteMessage | 8/4 | +24 | +12 | サーバーからの書き込みメッセージを受け取る、省略可能なコールバックです。 |
| writeProgress | MI_OperationCallback_WriteProgress | 8/4 | +32 | +16 | サーバーからの進行状況レポートを受け取る、省略可能なコールバックです。 |
| instanceResult | MI_OperationCallback_Instance | 8/4 | +40 | +20 | 操作から非同期の結果を取得する、省略可能なインスタンスコールバックです。これが指定されておらず、かつ操作がインスタンス操作である場合、クライアントは結果を取得するために同期 API を使用する必要があります。 |
| indicationResult | MI_OperationCallback_Indication | 8/4 | +48 | +24 | 操作からインジケーション (サブスクライブ) の結果を取得する、省略可能なインスタンスコールバックです。これが指定されておらず、かつ操作がインスタンス操作である場合、クライアントは結果を取得するために同期 API を使用する必要があります。 |
| classResult | MI_OperationCallback_Class | 8/4 | +56 | +28 | 操作からクラスおよびクラスオプションを取得する、省略可能なインスタンスコールバックです。これが指定されておらず、かつ操作がインスタンス操作である場合、クライアントは結果を取得するために同期 API を使用する必要があります。 |
| streamedParameterResult | MI_OperationCallback_StreamedParameter | 8/4 | +64 | +32 | メソッド呼び出し操作からストリーミングされたパラメーター結果を取得する、省略可能なコールバックです。 |
公式ドキュメント
操作を実行するためのすべてのコールバック関数ポインターを保持する構造体です。
解説(Remarks)
PowerShell のセマンティクスおよびストリーミング結果に関するコールバックは、すべて省略可能です。 受け取りたいコールバックのみを含めてください。操作に関連付けられた操作コールバックが設定されていない場合、すなわち NULL に設定されている場合、その操作は同期的に実行されます。クライアントは、結果を受け取るために適切な MI_Operation 関数を呼び出す必要があります。結果コールバックは、moreResults フィールドが MI_FALSE と等しくなるまで呼び出され続けます。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#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 Structureimport 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: pointerstruct 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 変数を確保