ホーム › System.Rpc › MIDL_STUB_DESC
MIDL_STUB_DESC
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| RpcInterfaceInformation | void* | 8/4 | +0 | +0 | 対応するRPCインターフェイス情報構造体へのポインタ。スタブが属するインターフェイスを指す。 |
| pfnAllocate | PFN_RPC_ALLOCATE | 8/4 | +8 | +4 | マーシャリング時に使用するメモリ割り当てルーチンへの関数ポインタ。通常はmidl_user_allocate。 |
| pfnFree | PFN_RPC_FREE | 8/4 | +16 | +8 | 割り当てたメモリを解放するルーチンへの関数ポインタ。通常はmidl_user_free。 |
| IMPLICIT_HANDLE_INFO | _IMPLICIT_HANDLE_INFO_e__Union | 8/4 | +24 | +12 | 暗黙バインドハンドルに関する情報を保持する共用体。自動/プリミティブ/汎用ハンドルを表す。 |
| apfnNdrRundownRoutines | NDR_RUNDOWN* | 8/4 | +32 | +16 | コンテキストハンドルのランダウンルーチンへのポインタ配列。接続切断時の後始末に使う。 |
| aGenericBindingRoutinePairs | GENERIC_BINDING_ROUTINE_PAIR* | 8/4 | +40 | +20 | 汎用バインドハンドルのbind/unbindルーチン対の配列へのポインタ。 |
| apfnExprEval | EXPR_EVAL* | 8/4 | +48 | +24 | 正格性/サイズ式を評価する式評価ルーチンの配列へのポインタ。 |
| aXmitQuintuple | XMIT_ROUTINE_QUINTUPLE* | 8/4 | +56 | +28 | transmit_as属性の5要素変換ルーチン群の配列へのポインタ。 |
| pFormatTypes | BYTE* | 8/4 | +64 | +32 | 型を記述するNDRフォーマット文字列(バイト列)の先頭へのポインタ。 |
| fCheckBounds | INT | 4 | +72 | +36 | 境界チェックを行うかを示すフラグ。非0で配列等の境界検証を実施する。 |
| Version | DWORD | 4 | +76 | +40 | このスタブ記述子の構造体バージョン番号。MIDLランタイム互換性判定に用いる。 |
| pMallocFreeStruct | MALLOC_FREE_STRUCT* | 8/4 | +80 | +44 | 独自のmalloc/freeルーチンを保持する構造体へのポインタ。NULL可。 |
| MIDLVersion | INT | 4 | +88 | +48 | スタブを生成したMIDLコンパイラのバージョン番号。 |
| CommFaultOffsets | COMM_FAULT_OFFSETS* | 8/4 | +96 | +52 | 通信状態/フォールト状態を格納するパラメータのオフセット情報へのポインタ。NULL可。 |
| aUserMarshalQuadruple | USER_MARSHAL_ROUTINE_QUADRUPLE* | 8/4 | +104 | +56 | wire_marshal/user_marshal用の4要素ルーチン群配列へのポインタ。 |
| NotifyRoutineTable | NDR_NOTIFY_ROUTINE* | 8/4 | +112 | +60 | [notify]/[notify_flag]属性に対応する通知ルーチンテーブルへのポインタ。 |
| mFlags | UINT_PTR | 8/4 | +120 | +64 | スタブ記述子の各種挙動を制御するフラグ群を保持するポインタサイズ整数。 |
| CsRoutineTables | NDR_CS_ROUTINES* | 8/4 | +128 | +68 | 国際化(コード/文字セット変換)用のルーチンテーブルへのポインタ。 |
| ProxyServerInfo | void* | 8/4 | +136 | +72 | プロキシ/サーバ情報構造体へのポインタ。スタブレスプロキシ等で使用。 |
| pExprInfo | NDR_EXPR_DESC* | 8/4 | +144 | +76 | NDR式記述(NDR_EXPR_DESC)へのポインタ。条件式の評価情報を保持する。 |
共用体: _IMPLICIT_HANDLE_INFO_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| pAutoHandle | void** | 8/4 | +0 | +0 |
| pPrimitiveHandle | void** | 8/4 | +0 | +0 |
| pGenericBindingInfo | GENERIC_BINDING_INFO* | 8/4 | +0 | +0 |
各言語での定義
#include <windows.h>
// MIDL_STUB_DESC (x64 152 / x86 80 バイト)
typedef struct MIDL_STUB_DESC {
void* RpcInterfaceInformation;
PFN_RPC_ALLOCATE pfnAllocate;
PFN_RPC_FREE pfnFree;
_IMPLICIT_HANDLE_INFO_e__Union IMPLICIT_HANDLE_INFO;
NDR_RUNDOWN* apfnNdrRundownRoutines;
GENERIC_BINDING_ROUTINE_PAIR* aGenericBindingRoutinePairs;
EXPR_EVAL* apfnExprEval;
XMIT_ROUTINE_QUINTUPLE* aXmitQuintuple;
BYTE* pFormatTypes;
INT fCheckBounds;
DWORD Version;
MALLOC_FREE_STRUCT* pMallocFreeStruct;
INT MIDLVersion;
COMM_FAULT_OFFSETS* CommFaultOffsets;
USER_MARSHAL_ROUTINE_QUADRUPLE* aUserMarshalQuadruple;
NDR_NOTIFY_ROUTINE* NotifyRoutineTable;
UINT_PTR mFlags;
NDR_CS_ROUTINES* CsRoutineTables;
void* ProxyServerInfo;
NDR_EXPR_DESC* pExprInfo;
} MIDL_STUB_DESC;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MIDL_STUB_DESC
{
public IntPtr RpcInterfaceInformation;
public IntPtr pfnAllocate;
public IntPtr pfnFree;
public _IMPLICIT_HANDLE_INFO_e__Union IMPLICIT_HANDLE_INFO;
public IntPtr apfnNdrRundownRoutines;
public IntPtr aGenericBindingRoutinePairs;
public IntPtr apfnExprEval;
public IntPtr aXmitQuintuple;
public IntPtr pFormatTypes;
public int fCheckBounds;
public uint Version;
public IntPtr pMallocFreeStruct;
public int MIDLVersion;
public IntPtr CommFaultOffsets;
public IntPtr aUserMarshalQuadruple;
public IntPtr NotifyRoutineTable;
public UIntPtr mFlags;
public IntPtr CsRoutineTables;
public IntPtr ProxyServerInfo;
public IntPtr pExprInfo;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MIDL_STUB_DESC
Public RpcInterfaceInformation As IntPtr
Public pfnAllocate As IntPtr
Public pfnFree As IntPtr
Public IMPLICIT_HANDLE_INFO As _IMPLICIT_HANDLE_INFO_e__Union
Public apfnNdrRundownRoutines As IntPtr
Public aGenericBindingRoutinePairs As IntPtr
Public apfnExprEval As IntPtr
Public aXmitQuintuple As IntPtr
Public pFormatTypes As IntPtr
Public fCheckBounds As Integer
Public Version As UInteger
Public pMallocFreeStruct As IntPtr
Public MIDLVersion As Integer
Public CommFaultOffsets As IntPtr
Public aUserMarshalQuadruple As IntPtr
Public NotifyRoutineTable As IntPtr
Public mFlags As UIntPtr
Public CsRoutineTables As IntPtr
Public ProxyServerInfo As IntPtr
Public pExprInfo As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class MIDL_STUB_DESC(ctypes.Structure):
_fields_ = [
("RpcInterfaceInformation", ctypes.c_void_p),
("pfnAllocate", ctypes.c_void_p),
("pfnFree", ctypes.c_void_p),
("IMPLICIT_HANDLE_INFO", _IMPLICIT_HANDLE_INFO_e__Union),
("apfnNdrRundownRoutines", ctypes.c_void_p),
("aGenericBindingRoutinePairs", ctypes.c_void_p),
("apfnExprEval", ctypes.c_void_p),
("aXmitQuintuple", ctypes.c_void_p),
("pFormatTypes", ctypes.c_void_p),
("fCheckBounds", ctypes.c_int),
("Version", wintypes.DWORD),
("pMallocFreeStruct", ctypes.c_void_p),
("MIDLVersion", ctypes.c_int),
("CommFaultOffsets", ctypes.c_void_p),
("aUserMarshalQuadruple", ctypes.c_void_p),
("NotifyRoutineTable", ctypes.c_void_p),
("mFlags", ctypes.c_size_t),
("CsRoutineTables", ctypes.c_void_p),
("ProxyServerInfo", ctypes.c_void_p),
("pExprInfo", ctypes.c_void_p),
]#[repr(C)]
pub struct MIDL_STUB_DESC {
pub RpcInterfaceInformation: *mut core::ffi::c_void,
pub pfnAllocate: *mut core::ffi::c_void,
pub pfnFree: *mut core::ffi::c_void,
pub IMPLICIT_HANDLE_INFO: _IMPLICIT_HANDLE_INFO_e__Union,
pub apfnNdrRundownRoutines: *mut core::ffi::c_void,
pub aGenericBindingRoutinePairs: *mut core::ffi::c_void,
pub apfnExprEval: *mut core::ffi::c_void,
pub aXmitQuintuple: *mut core::ffi::c_void,
pub pFormatTypes: *mut core::ffi::c_void,
pub fCheckBounds: i32,
pub Version: u32,
pub pMallocFreeStruct: *mut core::ffi::c_void,
pub MIDLVersion: i32,
pub CommFaultOffsets: *mut core::ffi::c_void,
pub aUserMarshalQuadruple: *mut core::ffi::c_void,
pub NotifyRoutineTable: *mut core::ffi::c_void,
pub mFlags: usize,
pub CsRoutineTables: *mut core::ffi::c_void,
pub ProxyServerInfo: *mut core::ffi::c_void,
pub pExprInfo: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type MIDL_STUB_DESC struct {
RpcInterfaceInformation uintptr
pfnAllocate uintptr
pfnFree uintptr
IMPLICIT_HANDLE_INFO _IMPLICIT_HANDLE_INFO_e__Union
apfnNdrRundownRoutines uintptr
aGenericBindingRoutinePairs uintptr
apfnExprEval uintptr
aXmitQuintuple uintptr
pFormatTypes uintptr
fCheckBounds int32
Version uint32
pMallocFreeStruct uintptr
MIDLVersion int32
CommFaultOffsets uintptr
aUserMarshalQuadruple uintptr
NotifyRoutineTable uintptr
mFlags uintptr
CsRoutineTables uintptr
ProxyServerInfo uintptr
pExprInfo uintptr
}type
MIDL_STUB_DESC = record
RpcInterfaceInformation: Pointer;
pfnAllocate: Pointer;
pfnFree: Pointer;
IMPLICIT_HANDLE_INFO: _IMPLICIT_HANDLE_INFO_e__Union;
apfnNdrRundownRoutines: Pointer;
aGenericBindingRoutinePairs: Pointer;
apfnExprEval: Pointer;
aXmitQuintuple: Pointer;
pFormatTypes: Pointer;
fCheckBounds: Integer;
Version: DWORD;
pMallocFreeStruct: Pointer;
MIDLVersion: Integer;
CommFaultOffsets: Pointer;
aUserMarshalQuadruple: Pointer;
NotifyRoutineTable: Pointer;
mFlags: NativeUInt;
CsRoutineTables: Pointer;
ProxyServerInfo: Pointer;
pExprInfo: Pointer;
end;const MIDL_STUB_DESC = extern struct {
RpcInterfaceInformation: ?*anyopaque,
pfnAllocate: ?*anyopaque,
pfnFree: ?*anyopaque,
IMPLICIT_HANDLE_INFO: _IMPLICIT_HANDLE_INFO_e__Union,
apfnNdrRundownRoutines: ?*anyopaque,
aGenericBindingRoutinePairs: ?*anyopaque,
apfnExprEval: ?*anyopaque,
aXmitQuintuple: ?*anyopaque,
pFormatTypes: ?*anyopaque,
fCheckBounds: i32,
Version: u32,
pMallocFreeStruct: ?*anyopaque,
MIDLVersion: i32,
CommFaultOffsets: ?*anyopaque,
aUserMarshalQuadruple: ?*anyopaque,
NotifyRoutineTable: ?*anyopaque,
mFlags: usize,
CsRoutineTables: ?*anyopaque,
ProxyServerInfo: ?*anyopaque,
pExprInfo: ?*anyopaque,
};type
MIDL_STUB_DESC {.bycopy.} = object
RpcInterfaceInformation: pointer
pfnAllocate: pointer
pfnFree: pointer
IMPLICIT_HANDLE_INFO: _IMPLICIT_HANDLE_INFO_e__Union
apfnNdrRundownRoutines: pointer
aGenericBindingRoutinePairs: pointer
apfnExprEval: pointer
aXmitQuintuple: pointer
pFormatTypes: pointer
fCheckBounds: int32
Version: uint32
pMallocFreeStruct: pointer
MIDLVersion: int32
CommFaultOffsets: pointer
aUserMarshalQuadruple: pointer
NotifyRoutineTable: pointer
mFlags: uint
CsRoutineTables: pointer
ProxyServerInfo: pointer
pExprInfo: pointerstruct MIDL_STUB_DESC
{
void* RpcInterfaceInformation;
void* pfnAllocate;
void* pfnFree;
_IMPLICIT_HANDLE_INFO_e__Union IMPLICIT_HANDLE_INFO;
void* apfnNdrRundownRoutines;
void* aGenericBindingRoutinePairs;
void* apfnExprEval;
void* aXmitQuintuple;
void* pFormatTypes;
int fCheckBounds;
uint Version;
void* pMallocFreeStruct;
int MIDLVersion;
void* CommFaultOffsets;
void* aUserMarshalQuadruple;
void* NotifyRoutineTable;
size_t mFlags;
void* CsRoutineTables;
void* ProxyServerInfo;
void* pExprInfo;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MIDL_STUB_DESC サイズ: 80 バイト(x86)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; RpcInterfaceInformation : void* (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pfnAllocate : PFN_RPC_ALLOCATE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; pfnFree : PFN_RPC_FREE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; IMPLICIT_HANDLE_INFO : _IMPLICIT_HANDLE_INFO_e__Union (+12, 4byte) varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; apfnNdrRundownRoutines : NDR_RUNDOWN* (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; aGenericBindingRoutinePairs : GENERIC_BINDING_ROUTINE_PAIR* (+20, 4byte) varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; apfnExprEval : EXPR_EVAL* (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; aXmitQuintuple : XMIT_ROUTINE_QUINTUPLE* (+28, 4byte) varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; pFormatTypes : BYTE* (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; fCheckBounds : INT (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; Version : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; pMallocFreeStruct : MALLOC_FREE_STRUCT* (+44, 4byte) varptr(st)+44 を基点に操作(4byte:入れ子/配列)
; MIDLVersion : INT (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; CommFaultOffsets : COMM_FAULT_OFFSETS* (+52, 4byte) varptr(st)+52 を基点に操作(4byte:入れ子/配列)
; aUserMarshalQuadruple : USER_MARSHAL_ROUTINE_QUADRUPLE* (+56, 4byte) varptr(st)+56 を基点に操作(4byte:入れ子/配列)
; NotifyRoutineTable : NDR_NOTIFY_ROUTINE* (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; mFlags : UINT_PTR (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; CsRoutineTables : NDR_CS_ROUTINES* (+68, 4byte) varptr(st)+68 を基点に操作(4byte:入れ子/配列)
; ProxyServerInfo : void* (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; pExprInfo : NDR_EXPR_DESC* (+76, 4byte) varptr(st)+76 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MIDL_STUB_DESC サイズ: 152 バイト(x64)
dim st, 38 ; 4byte整数×38(構造体サイズ 152 / 4 切り上げ)
; RpcInterfaceInformation : void* (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; pfnAllocate : PFN_RPC_ALLOCATE (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pfnFree : PFN_RPC_FREE (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; IMPLICIT_HANDLE_INFO : _IMPLICIT_HANDLE_INFO_e__Union (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; apfnNdrRundownRoutines : NDR_RUNDOWN* (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; aGenericBindingRoutinePairs : GENERIC_BINDING_ROUTINE_PAIR* (+40, 8byte) varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; apfnExprEval : EXPR_EVAL* (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; aXmitQuintuple : XMIT_ROUTINE_QUINTUPLE* (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; pFormatTypes : BYTE* (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; fCheckBounds : INT (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; Version : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; pMallocFreeStruct : MALLOC_FREE_STRUCT* (+80, 8byte) varptr(st)+80 を基点に操作(8byte:入れ子/配列)
; MIDLVersion : INT (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; CommFaultOffsets : COMM_FAULT_OFFSETS* (+96, 8byte) varptr(st)+96 を基点に操作(8byte:入れ子/配列)
; aUserMarshalQuadruple : USER_MARSHAL_ROUTINE_QUADRUPLE* (+104, 8byte) varptr(st)+104 を基点に操作(8byte:入れ子/配列)
; NotifyRoutineTable : NDR_NOTIFY_ROUTINE* (+112, 8byte) qpoke st,112,値 / qpeek(st,112) ※IronHSPのみ。3.7/3.8は lpoke st,112,下位 : lpoke st,116,上位
; mFlags : UINT_PTR (+120, 8byte) qpoke st,120,値 / qpeek(st,120) ※IronHSPのみ。3.7/3.8は lpoke st,120,下位 : lpoke st,124,上位
; CsRoutineTables : NDR_CS_ROUTINES* (+128, 8byte) varptr(st)+128 を基点に操作(8byte:入れ子/配列)
; ProxyServerInfo : void* (+136, 8byte) qpoke st,136,値 / qpeek(st,136) ※IronHSPのみ。3.7/3.8は lpoke st,136,下位 : lpoke st,140,上位
; pExprInfo : NDR_EXPR_DESC* (+144, 8byte) varptr(st)+144 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MIDL_STUB_DESC
#field intptr RpcInterfaceInformation
#field intptr pfnAllocate
#field intptr pfnFree
#field byte IMPLICIT_HANDLE_INFO 8
#field intptr apfnNdrRundownRoutines
#field intptr aGenericBindingRoutinePairs
#field intptr apfnExprEval
#field intptr aXmitQuintuple
#field intptr pFormatTypes
#field int fCheckBounds
#field int Version
#field intptr pMallocFreeStruct
#field int MIDLVersion
#field intptr CommFaultOffsets
#field intptr aUserMarshalQuadruple
#field intptr NotifyRoutineTable
#field intptr mFlags
#field intptr CsRoutineTables
#field intptr ProxyServerInfo
#field intptr pExprInfo
#endstruct
stdim st, MIDL_STUB_DESC ; NSTRUCT 変数を確保
st->fCheckBounds = 100
mes "fCheckBounds=" + st->fCheckBounds
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。