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

NDRCContextMarshall

関数
クライアントコンテキストハンドルをバッファにマーシャリングする。
DLLRPCRT4.dll呼出規約winapi

シグネチャ

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

void NDRCContextMarshall(
    INT_PTR CContext,   // optional
    void* pBuff
);

パラメーター

名前方向
CContextINT_PTRinoptional
pBuffvoid*out

戻り値の型: void

各言語での呼び出し定義

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

void NDRCContextMarshall(
    INT_PTR CContext,   // optional
    void* pBuff
);
[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern void NDRCContextMarshall(
    IntPtr CContext,   // INT_PTR optional
    IntPtr pBuff   // void* out
);
<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Sub NDRCContextMarshall(
    CContext As IntPtr,   ' INT_PTR optional
    pBuff As IntPtr   ' void* out
)
End Sub
' CContext : INT_PTR optional
' pBuff : void* out
Declare PtrSafe Sub NDRCContextMarshall Lib "rpcrt4" ( _
    ByVal CContext As LongPtr, _
    ByVal pBuff As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

NDRCContextMarshall = ctypes.windll.rpcrt4.NDRCContextMarshall
NDRCContextMarshall.restype = None
NDRCContextMarshall.argtypes = [
    ctypes.c_ssize_t,  # CContext : INT_PTR optional
    ctypes.POINTER(None),  # pBuff : void* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
NDRCContextMarshall = Fiddle::Function.new(
  lib['NDRCContextMarshall'],
  [
    Fiddle::TYPE_INTPTR_T,  # CContext : INT_PTR optional
    Fiddle::TYPE_VOIDP,  # pBuff : void* out
  ],
  Fiddle::TYPE_VOID)
#[link(name = "rpcrt4")]
extern "system" {
    fn NDRCContextMarshall(
        CContext: isize,  // INT_PTR optional
        pBuff: *mut ()  // void* out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll")]
public static extern void NDRCContextMarshall(IntPtr CContext, IntPtr pBuff);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_NDRCContextMarshall' -Namespace Win32 -PassThru
# $api::NDRCContextMarshall(CContext, pBuff)
#uselib "RPCRT4.dll"
#func global NDRCContextMarshall "NDRCContextMarshall" sptr, sptr
; NDRCContextMarshall CContext, pBuff
; CContext : INT_PTR optional -> "sptr"
; pBuff : void* out -> "sptr"
#uselib "RPCRT4.dll"
#func global NDRCContextMarshall "NDRCContextMarshall" sptr, sptr
; NDRCContextMarshall CContext, pBuff
; CContext : INT_PTR optional -> "sptr"
; pBuff : void* out -> "sptr"
; void NDRCContextMarshall(INT_PTR CContext, void* pBuff)
#uselib "RPCRT4.dll"
#func global NDRCContextMarshall "NDRCContextMarshall" intptr, intptr
; NDRCContextMarshall CContext, pBuff
; CContext : INT_PTR optional -> "intptr"
; pBuff : void* out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procNDRCContextMarshall = rpcrt4.NewProc("NDRCContextMarshall")
)

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