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

RPC_MESSAGE

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

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

フィールド

フィールドサイズx64x86説明
Handlevoid*8/4+0+0RPCバインディングまたは呼び出しのハンドル。
DataRepresentationDWORD4+8+4データ表現(NDR形式:バイトオーダー等)を示す値。
Buffervoid*8/4+16+8マーシャリングデータを格納するバッファへのポインター。
BufferLengthDWORD4+24+12バッファの長さをバイト単位で表す。
ProcNumDWORD4+28+16呼び出すプロシージャの番号(オペコード)。
TransferSyntaxRPC_SYNTAX_IDENTIFIER*8/4+32+20使用する転送構文へのポインター。RPC_SYNTAX_IDENTIFIER。
RpcInterfaceInformationvoid*8/4+40+24RPCインターフェイス情報へのポインター。
ReservedForRuntimevoid*8/4+48+28ランタイム予約フィールド。内部利用。
ManagerEpvvoid*8/4+56+32マネージャーのエントリーポイントベクターへのポインター。
ImportContextvoid*8/4+64+36インポートコンテキストへのポインター。
RpcFlagsDWORD4+72+40RPC呼び出しの動作を制御するフラグ。

各言語での定義

#include <windows.h>

// RPC_MESSAGE  (x64 80 / x86 44 バイト)
typedef struct RPC_MESSAGE {
    void* Handle;
    DWORD DataRepresentation;
    void* Buffer;
    DWORD BufferLength;
    DWORD ProcNum;
    RPC_SYNTAX_IDENTIFIER* TransferSyntax;
    void* RpcInterfaceInformation;
    void* ReservedForRuntime;
    void* ManagerEpv;
    void* ImportContext;
    DWORD RpcFlags;
} RPC_MESSAGE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RPC_MESSAGE
{
    public IntPtr Handle;
    public uint DataRepresentation;
    public IntPtr Buffer;
    public uint BufferLength;
    public uint ProcNum;
    public IntPtr TransferSyntax;
    public IntPtr RpcInterfaceInformation;
    public IntPtr ReservedForRuntime;
    public IntPtr ManagerEpv;
    public IntPtr ImportContext;
    public uint RpcFlags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RPC_MESSAGE
    Public Handle As IntPtr
    Public DataRepresentation As UInteger
    Public Buffer As IntPtr
    Public BufferLength As UInteger
    Public ProcNum As UInteger
    Public TransferSyntax As IntPtr
    Public RpcInterfaceInformation As IntPtr
    Public ReservedForRuntime As IntPtr
    Public ManagerEpv As IntPtr
    Public ImportContext As IntPtr
    Public RpcFlags As UInteger
End Structure
import ctypes
from ctypes import wintypes

class RPC_MESSAGE(ctypes.Structure):
    _fields_ = [
        ("Handle", ctypes.c_void_p),
        ("DataRepresentation", wintypes.DWORD),
        ("Buffer", ctypes.c_void_p),
        ("BufferLength", wintypes.DWORD),
        ("ProcNum", wintypes.DWORD),
        ("TransferSyntax", ctypes.c_void_p),
        ("RpcInterfaceInformation", ctypes.c_void_p),
        ("ReservedForRuntime", ctypes.c_void_p),
        ("ManagerEpv", ctypes.c_void_p),
        ("ImportContext", ctypes.c_void_p),
        ("RpcFlags", wintypes.DWORD),
    ]
#[repr(C)]
pub struct RPC_MESSAGE {
    pub Handle: *mut core::ffi::c_void,
    pub DataRepresentation: u32,
    pub Buffer: *mut core::ffi::c_void,
    pub BufferLength: u32,
    pub ProcNum: u32,
    pub TransferSyntax: *mut core::ffi::c_void,
    pub RpcInterfaceInformation: *mut core::ffi::c_void,
    pub ReservedForRuntime: *mut core::ffi::c_void,
    pub ManagerEpv: *mut core::ffi::c_void,
    pub ImportContext: *mut core::ffi::c_void,
    pub RpcFlags: u32,
}
import "golang.org/x/sys/windows"

type RPC_MESSAGE struct {
	Handle uintptr
	DataRepresentation uint32
	Buffer uintptr
	BufferLength uint32
	ProcNum uint32
	TransferSyntax uintptr
	RpcInterfaceInformation uintptr
	ReservedForRuntime uintptr
	ManagerEpv uintptr
	ImportContext uintptr
	RpcFlags uint32
}
type
  RPC_MESSAGE = record
    Handle: Pointer;
    DataRepresentation: DWORD;
    Buffer: Pointer;
    BufferLength: DWORD;
    ProcNum: DWORD;
    TransferSyntax: Pointer;
    RpcInterfaceInformation: Pointer;
    ReservedForRuntime: Pointer;
    ManagerEpv: Pointer;
    ImportContext: Pointer;
    RpcFlags: DWORD;
  end;
const RPC_MESSAGE = extern struct {
    Handle: ?*anyopaque,
    DataRepresentation: u32,
    Buffer: ?*anyopaque,
    BufferLength: u32,
    ProcNum: u32,
    TransferSyntax: ?*anyopaque,
    RpcInterfaceInformation: ?*anyopaque,
    ReservedForRuntime: ?*anyopaque,
    ManagerEpv: ?*anyopaque,
    ImportContext: ?*anyopaque,
    RpcFlags: u32,
};
type
  RPC_MESSAGE {.bycopy.} = object
    Handle: pointer
    DataRepresentation: uint32
    Buffer: pointer
    BufferLength: uint32
    ProcNum: uint32
    TransferSyntax: pointer
    RpcInterfaceInformation: pointer
    ReservedForRuntime: pointer
    ManagerEpv: pointer
    ImportContext: pointer
    RpcFlags: uint32
struct RPC_MESSAGE
{
    void* Handle;
    uint DataRepresentation;
    void* Buffer;
    uint BufferLength;
    uint ProcNum;
    void* TransferSyntax;
    void* RpcInterfaceInformation;
    void* ReservedForRuntime;
    void* ManagerEpv;
    void* ImportContext;
    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 レイアウト)
; RPC_MESSAGE サイズ: 44 バイト(x86)
dim st, 11    ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; Handle : 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 も可)
; BufferLength : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ProcNum : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; TransferSyntax : RPC_SYNTAX_IDENTIFIER* (+20, 4byte)  varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; RpcInterfaceInformation : void* (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ReservedForRuntime : void* (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ManagerEpv : void* (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ImportContext : void* (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; RpcFlags : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; RPC_MESSAGE サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; Handle : 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,上位
; BufferLength : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ProcNum : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; TransferSyntax : RPC_SYNTAX_IDENTIFIER* (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; RpcInterfaceInformation : void* (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ReservedForRuntime : void* (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; ManagerEpv : void* (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; ImportContext : void* (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; RpcFlags : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global RPC_MESSAGE
    #field intptr Handle
    #field int DataRepresentation
    #field intptr Buffer
    #field int BufferLength
    #field int ProcNum
    #field intptr TransferSyntax
    #field intptr RpcInterfaceInformation
    #field intptr ReservedForRuntime
    #field intptr ManagerEpv
    #field intptr ImportContext
    #field int RpcFlags
#endstruct

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