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

RPCOLEMESSAGE

構造体
サイズx64: 80 バイト / x86: 44 バイト

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

フィールド

フィールドサイズx64x86説明
reserved1void*8/4+0+0予約済みフィールド。
dataRepresentationDWORD4+8+4データ表現(バイトオーダ等)を示すNDR形式値。
Buffervoid*8/4+16+8マーシャリングデータを格納するバッファへのポインタ。
cbBufferDWORD4+24+12Bufferのバイトサイズ。
iMethodDWORD4+28+16呼び出されるメソッドのインデックス。
reserved2void*40/20+32+20予約済みフィールド配列。
rpcFlagsDWORD4+72+40RPC呼び出しの動作を制御するフラグ。

各言語での定義

#include <windows.h>

// RPCOLEMESSAGE  (x64 80 / x86 44 バイト)
typedef struct RPCOLEMESSAGE {
    void* reserved1;
    DWORD dataRepresentation;
    void* Buffer;
    DWORD cbBuffer;
    DWORD iMethod;
    void* reserved2[5];
    DWORD rpcFlags;
} RPCOLEMESSAGE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RPCOLEMESSAGE
{
    public IntPtr reserved1;
    public uint dataRepresentation;
    public IntPtr Buffer;
    public uint cbBuffer;
    public uint iMethod;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public IntPtr[] reserved2;
    public uint rpcFlags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RPCOLEMESSAGE
    Public reserved1 As IntPtr
    Public dataRepresentation As UInteger
    Public Buffer As IntPtr
    Public cbBuffer As UInteger
    Public iMethod As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=5)> Public reserved2() As IntPtr
    Public rpcFlags As UInteger
End Structure
import ctypes
from ctypes import wintypes

class RPCOLEMESSAGE(ctypes.Structure):
    _fields_ = [
        ("reserved1", ctypes.c_void_p),
        ("dataRepresentation", wintypes.DWORD),
        ("Buffer", ctypes.c_void_p),
        ("cbBuffer", wintypes.DWORD),
        ("iMethod", wintypes.DWORD),
        ("reserved2", ctypes.c_void_p * 5),
        ("rpcFlags", wintypes.DWORD),
    ]
#[repr(C)]
pub struct RPCOLEMESSAGE {
    pub reserved1: *mut core::ffi::c_void,
    pub dataRepresentation: u32,
    pub Buffer: *mut core::ffi::c_void,
    pub cbBuffer: u32,
    pub iMethod: u32,
    pub reserved2: [*mut core::ffi::c_void; 5],
    pub rpcFlags: u32,
}
import "golang.org/x/sys/windows"

type RPCOLEMESSAGE struct {
	reserved1 uintptr
	dataRepresentation uint32
	Buffer uintptr
	cbBuffer uint32
	iMethod uint32
	reserved2 [5]uintptr
	rpcFlags uint32
}
type
  RPCOLEMESSAGE = record
    reserved1: Pointer;
    dataRepresentation: DWORD;
    Buffer: Pointer;
    cbBuffer: DWORD;
    iMethod: DWORD;
    reserved2: array[0..4] of Pointer;
    rpcFlags: DWORD;
  end;
const RPCOLEMESSAGE = extern struct {
    reserved1: ?*anyopaque,
    dataRepresentation: u32,
    Buffer: ?*anyopaque,
    cbBuffer: u32,
    iMethod: u32,
    reserved2: [5]?*anyopaque,
    rpcFlags: u32,
};
type
  RPCOLEMESSAGE {.bycopy.} = object
    reserved1: pointer
    dataRepresentation: uint32
    Buffer: pointer
    cbBuffer: uint32
    iMethod: uint32
    reserved2: array[5, pointer]
    rpcFlags: uint32
struct RPCOLEMESSAGE
{
    void* reserved1;
    uint dataRepresentation;
    void* Buffer;
    uint cbBuffer;
    uint iMethod;
    void*[5] reserved2;
    uint rpcFlags;
}

HSP用 定義

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

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

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