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

USER_MARSHAL_CB

構造体
サイズx64: 48 バイト / x86: 28 バイト

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

フィールド

フィールドサイズx64x86説明
FlagsDWORD4+0+0マーシャリング動作を制御するフラグ。
pStubMsgMIDL_STUB_MESSAGE*8/4+8+4関連するスタブメッセージへのポインター。MIDL_STUB_MESSAGE。
pReserveBYTE*8/4+16+8予約済みバッファへのポインター。
SignatureDWORD4+24+12コールバックの整合性検証用シグネチャ。
CBTypeUSER_MARSHAL_CB_TYPE4+28+16コールバックの種別。USER_MARSHAL_CB_TYPEで表す。
pFormatBYTE*8/4+32+20型のフォーマット記述へのポインター。
pTypeFormatBYTE*8/4+40+24型フォーマット文字列へのポインター。

各言語での定義

#include <windows.h>

// USER_MARSHAL_CB  (x64 48 / x86 28 バイト)
typedef struct USER_MARSHAL_CB {
    DWORD Flags;
    MIDL_STUB_MESSAGE* pStubMsg;
    BYTE* pReserve;
    DWORD Signature;
    USER_MARSHAL_CB_TYPE CBType;
    BYTE* pFormat;
    BYTE* pTypeFormat;
} USER_MARSHAL_CB;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USER_MARSHAL_CB
{
    public uint Flags;
    public IntPtr pStubMsg;
    public IntPtr pReserve;
    public uint Signature;
    public int CBType;
    public IntPtr pFormat;
    public IntPtr pTypeFormat;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USER_MARSHAL_CB
    Public Flags As UInteger
    Public pStubMsg As IntPtr
    Public pReserve As IntPtr
    Public Signature As UInteger
    Public CBType As Integer
    Public pFormat As IntPtr
    Public pTypeFormat As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class USER_MARSHAL_CB(ctypes.Structure):
    _fields_ = [
        ("Flags", wintypes.DWORD),
        ("pStubMsg", ctypes.c_void_p),
        ("pReserve", ctypes.c_void_p),
        ("Signature", wintypes.DWORD),
        ("CBType", ctypes.c_int),
        ("pFormat", ctypes.c_void_p),
        ("pTypeFormat", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct USER_MARSHAL_CB {
    pub Flags: u32,
    pub pStubMsg: *mut core::ffi::c_void,
    pub pReserve: *mut core::ffi::c_void,
    pub Signature: u32,
    pub CBType: i32,
    pub pFormat: *mut core::ffi::c_void,
    pub pTypeFormat: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type USER_MARSHAL_CB struct {
	Flags uint32
	pStubMsg uintptr
	pReserve uintptr
	Signature uint32
	CBType int32
	pFormat uintptr
	pTypeFormat uintptr
}
type
  USER_MARSHAL_CB = record
    Flags: DWORD;
    pStubMsg: Pointer;
    pReserve: Pointer;
    Signature: DWORD;
    CBType: Integer;
    pFormat: Pointer;
    pTypeFormat: Pointer;
  end;
const USER_MARSHAL_CB = extern struct {
    Flags: u32,
    pStubMsg: ?*anyopaque,
    pReserve: ?*anyopaque,
    Signature: u32,
    CBType: i32,
    pFormat: ?*anyopaque,
    pTypeFormat: ?*anyopaque,
};
type
  USER_MARSHAL_CB {.bycopy.} = object
    Flags: uint32
    pStubMsg: pointer
    pReserve: pointer
    Signature: uint32
    CBType: int32
    pFormat: pointer
    pTypeFormat: pointer
struct USER_MARSHAL_CB
{
    uint Flags;
    void* pStubMsg;
    void* pReserve;
    uint Signature;
    int CBType;
    void* pFormat;
    void* pTypeFormat;
}

HSP用 定義

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

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

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