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

NdrServerContextNewUnmarshall

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

シグネチャ

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

NDR_SCONTEXT* NdrServerContextNewUnmarshall(
    MIDL_STUB_MESSAGE* pStubMsg,
    BYTE* pFormat
);

パラメーター

名前方向
pStubMsgMIDL_STUB_MESSAGE*in
pFormatBYTE*in

戻り値の型: NDR_SCONTEXT*

各言語での呼び出し定義

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

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

NdrServerContextNewUnmarshall = ctypes.windll.rpcrt4.NdrServerContextNewUnmarshall
NdrServerContextNewUnmarshall.restype = ctypes.c_void_p
NdrServerContextNewUnmarshall.argtypes = [
    ctypes.c_void_p,  # pStubMsg : MIDL_STUB_MESSAGE*
    ctypes.POINTER(ctypes.c_ubyte),  # pFormat : BYTE*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
NdrServerContextNewUnmarshall = Fiddle::Function.new(
  lib['NdrServerContextNewUnmarshall'],
  [
    Fiddle::TYPE_VOIDP,  # pStubMsg : MIDL_STUB_MESSAGE*
    Fiddle::TYPE_VOIDP,  # pFormat : BYTE*
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "rpcrt4")]
extern "system" {
    fn NdrServerContextNewUnmarshall(
        pStubMsg: *mut MIDL_STUB_MESSAGE,  // MIDL_STUB_MESSAGE*
        pFormat: *mut u8  // BYTE*
    ) -> *mut NDR_SCONTEXT;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll")]
public static extern IntPtr NdrServerContextNewUnmarshall(IntPtr pStubMsg, IntPtr pFormat);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_NdrServerContextNewUnmarshall' -Namespace Win32 -PassThru
# $api::NdrServerContextNewUnmarshall(pStubMsg, pFormat)
#uselib "RPCRT4.dll"
#func global NdrServerContextNewUnmarshall "NdrServerContextNewUnmarshall" sptr, sptr
; NdrServerContextNewUnmarshall varptr(pStubMsg), varptr(pFormat)   ; 戻り値は stat
; pStubMsg : MIDL_STUB_MESSAGE* -> "sptr"
; pFormat : BYTE* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RPCRT4.dll"
#cfunc global NdrServerContextNewUnmarshall "NdrServerContextNewUnmarshall" var, var
; res = NdrServerContextNewUnmarshall(pStubMsg, pFormat)
; pStubMsg : MIDL_STUB_MESSAGE* -> "var"
; pFormat : BYTE* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; NDR_SCONTEXT* NdrServerContextNewUnmarshall(MIDL_STUB_MESSAGE* pStubMsg, BYTE* pFormat)
#uselib "RPCRT4.dll"
#cfunc global NdrServerContextNewUnmarshall "NdrServerContextNewUnmarshall" var, var
; res = NdrServerContextNewUnmarshall(pStubMsg, pFormat)
; pStubMsg : MIDL_STUB_MESSAGE* -> "var"
; pFormat : BYTE* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procNdrServerContextNewUnmarshall = rpcrt4.NewProc("NdrServerContextNewUnmarshall")
)

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