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

NdrServerContextNewMarshall

関数
NDRで新形式のサーバーコンテキストハンドルをマーシャリングする。
DLLRPCRT4.dll呼出規約winapi

シグネチャ

// RPCRT4.dll
#include <windows.h>

void NdrServerContextNewMarshall(
    MIDL_STUB_MESSAGE* pStubMsg,
    NDR_SCONTEXT* ContextHandle,
    NDR_RUNDOWN RundownRoutine,
    BYTE* pFormat
);

パラメーター

名前方向
pStubMsgMIDL_STUB_MESSAGE*inout
ContextHandleNDR_SCONTEXT*inout
RundownRoutineNDR_RUNDOWNin
pFormatBYTE*inout

戻り値の型: void

各言語での呼び出し定義

// RPCRT4.dll
#include <windows.h>

void NdrServerContextNewMarshall(
    MIDL_STUB_MESSAGE* pStubMsg,
    NDR_SCONTEXT* ContextHandle,
    NDR_RUNDOWN RundownRoutine,
    BYTE* pFormat
);
[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern void NdrServerContextNewMarshall(
    IntPtr pStubMsg,   // MIDL_STUB_MESSAGE* in/out
    IntPtr ContextHandle,   // NDR_SCONTEXT* in/out
    IntPtr RundownRoutine,   // NDR_RUNDOWN
    IntPtr pFormat   // BYTE* in/out
);
<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Sub NdrServerContextNewMarshall(
    pStubMsg As IntPtr,   ' MIDL_STUB_MESSAGE* in/out
    ContextHandle As IntPtr,   ' NDR_SCONTEXT* in/out
    RundownRoutine As IntPtr,   ' NDR_RUNDOWN
    pFormat As IntPtr   ' BYTE* in/out
)
End Sub
' pStubMsg : MIDL_STUB_MESSAGE* in/out
' ContextHandle : NDR_SCONTEXT* in/out
' RundownRoutine : NDR_RUNDOWN
' pFormat : BYTE* in/out
Declare PtrSafe Sub NdrServerContextNewMarshall Lib "rpcrt4" ( _
    ByVal pStubMsg As LongPtr, _
    ByVal ContextHandle As LongPtr, _
    ByVal RundownRoutine As LongPtr, _
    ByVal pFormat As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

NdrServerContextNewMarshall = ctypes.windll.rpcrt4.NdrServerContextNewMarshall
NdrServerContextNewMarshall.restype = None
NdrServerContextNewMarshall.argtypes = [
    ctypes.c_void_p,  # pStubMsg : MIDL_STUB_MESSAGE* in/out
    ctypes.c_void_p,  # ContextHandle : NDR_SCONTEXT* in/out
    ctypes.c_void_p,  # RundownRoutine : NDR_RUNDOWN
    ctypes.POINTER(ctypes.c_ubyte),  # pFormat : BYTE* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
NdrServerContextNewMarshall = Fiddle::Function.new(
  lib['NdrServerContextNewMarshall'],
  [
    Fiddle::TYPE_VOIDP,  # pStubMsg : MIDL_STUB_MESSAGE* in/out
    Fiddle::TYPE_VOIDP,  # ContextHandle : NDR_SCONTEXT* in/out
    Fiddle::TYPE_VOIDP,  # RundownRoutine : NDR_RUNDOWN
    Fiddle::TYPE_VOIDP,  # pFormat : BYTE* in/out
  ],
  Fiddle::TYPE_VOID)
#[link(name = "rpcrt4")]
extern "system" {
    fn NdrServerContextNewMarshall(
        pStubMsg: *mut MIDL_STUB_MESSAGE,  // MIDL_STUB_MESSAGE* in/out
        ContextHandle: *mut NDR_SCONTEXT,  // NDR_SCONTEXT* in/out
        RundownRoutine: *const core::ffi::c_void,  // NDR_RUNDOWN
        pFormat: *mut u8  // BYTE* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll")]
public static extern void NdrServerContextNewMarshall(IntPtr pStubMsg, IntPtr ContextHandle, IntPtr RundownRoutine, IntPtr pFormat);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_NdrServerContextNewMarshall' -Namespace Win32 -PassThru
# $api::NdrServerContextNewMarshall(pStubMsg, ContextHandle, RundownRoutine, pFormat)
#uselib "RPCRT4.dll"
#func global NdrServerContextNewMarshall "NdrServerContextNewMarshall" sptr, sptr, sptr, sptr
; NdrServerContextNewMarshall varptr(pStubMsg), varptr(ContextHandle), RundownRoutine, varptr(pFormat)
; pStubMsg : MIDL_STUB_MESSAGE* in/out -> "sptr"
; ContextHandle : NDR_SCONTEXT* in/out -> "sptr"
; RundownRoutine : NDR_RUNDOWN -> "sptr"
; pFormat : BYTE* in/out -> "sptr"
出力引数:
#uselib "RPCRT4.dll"
#func global NdrServerContextNewMarshall "NdrServerContextNewMarshall" var, var, sptr, var
; NdrServerContextNewMarshall pStubMsg, ContextHandle, RundownRoutine, pFormat
; pStubMsg : MIDL_STUB_MESSAGE* in/out -> "var"
; ContextHandle : NDR_SCONTEXT* in/out -> "var"
; RundownRoutine : NDR_RUNDOWN -> "sptr"
; pFormat : BYTE* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void NdrServerContextNewMarshall(MIDL_STUB_MESSAGE* pStubMsg, NDR_SCONTEXT* ContextHandle, NDR_RUNDOWN RundownRoutine, BYTE* pFormat)
#uselib "RPCRT4.dll"
#func global NdrServerContextNewMarshall "NdrServerContextNewMarshall" var, var, intptr, var
; NdrServerContextNewMarshall pStubMsg, ContextHandle, RundownRoutine, pFormat
; pStubMsg : MIDL_STUB_MESSAGE* in/out -> "var"
; ContextHandle : NDR_SCONTEXT* in/out -> "var"
; RundownRoutine : NDR_RUNDOWN -> "intptr"
; pFormat : BYTE* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procNdrServerContextNewMarshall = rpcrt4.NewProc("NdrServerContextNewMarshall")
)

// pStubMsg (MIDL_STUB_MESSAGE* in/out), ContextHandle (NDR_SCONTEXT* in/out), RundownRoutine (NDR_RUNDOWN), pFormat (BYTE* in/out)
r1, _, err := procNdrServerContextNewMarshall.Call(
	uintptr(pStubMsg),
	uintptr(ContextHandle),
	uintptr(RundownRoutine),
	uintptr(pFormat),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure NdrServerContextNewMarshall(
  pStubMsg: Pointer;   // MIDL_STUB_MESSAGE* in/out
  ContextHandle: Pointer;   // NDR_SCONTEXT* in/out
  RundownRoutine: Pointer;   // NDR_RUNDOWN
  pFormat: Pointer   // BYTE* in/out
); stdcall;
  external 'RPCRT4.dll' name 'NdrServerContextNewMarshall';
result := DllCall("RPCRT4\NdrServerContextNewMarshall"
    , "Ptr", pStubMsg   ; MIDL_STUB_MESSAGE* in/out
    , "Ptr", ContextHandle   ; NDR_SCONTEXT* in/out
    , "Ptr", RundownRoutine   ; NDR_RUNDOWN
    , "Ptr", pFormat   ; BYTE* in/out
    , "Int")   ; return: void
●NdrServerContextNewMarshall(pStubMsg, ContextHandle, RundownRoutine, pFormat) = DLL("RPCRT4.dll", "int NdrServerContextNewMarshall(void*, void*, void*, void*)")
# 呼び出し: NdrServerContextNewMarshall(pStubMsg, ContextHandle, RundownRoutine, pFormat)
# pStubMsg : MIDL_STUB_MESSAGE* in/out -> "void*"
# ContextHandle : NDR_SCONTEXT* in/out -> "void*"
# RundownRoutine : NDR_RUNDOWN -> "void*"
# pFormat : BYTE* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。