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

NDRCContextUnmarshall

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

シグネチャ

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

void NDRCContextUnmarshall(
    INT_PTR* pCContext,   // optional
    void* hBinding,
    void* pBuff,
    DWORD DataRepresentation
);

パラメーター

名前方向説明
pCContextINT_PTR*inoutoptionalアンマーシャリングしたクライアントコンテキストハンドルを受け取るINT_PTRへのポインタ。
hBindingvoid*inコンテキストに関連付けるバインディングハンドル。
pBuffvoid*inシリアライズされたコンテキストデータを含む入力バッファへのポインタ。
DataRepresentationDWORDinデータ表現(バイトオーダー/文字/浮動小数形式)を指定するDWORD。

戻り値の型: void

各言語での呼び出し定義

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

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

NDRCContextUnmarshall = ctypes.windll.rpcrt4.NDRCContextUnmarshall
NDRCContextUnmarshall.restype = None
NDRCContextUnmarshall.argtypes = [
    ctypes.POINTER(ctypes.c_ssize_t),  # pCContext : INT_PTR* optional, in/out
    ctypes.POINTER(None),  # hBinding : void*
    ctypes.POINTER(None),  # pBuff : void*
    wintypes.DWORD,  # DataRepresentation : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
NDRCContextUnmarshall = Fiddle::Function.new(
  lib['NDRCContextUnmarshall'],
  [
    Fiddle::TYPE_VOIDP,  # pCContext : INT_PTR* optional, in/out
    Fiddle::TYPE_VOIDP,  # hBinding : void*
    Fiddle::TYPE_VOIDP,  # pBuff : void*
    -Fiddle::TYPE_INT,  # DataRepresentation : DWORD
  ],
  Fiddle::TYPE_VOID)
#[link(name = "rpcrt4")]
extern "system" {
    fn NDRCContextUnmarshall(
        pCContext: *mut isize,  // INT_PTR* optional, in/out
        hBinding: *mut (),  // void*
        pBuff: *mut (),  // void*
        DataRepresentation: u32  // DWORD
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll")]
public static extern void NDRCContextUnmarshall(IntPtr pCContext, IntPtr hBinding, IntPtr pBuff, uint DataRepresentation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_NDRCContextUnmarshall' -Namespace Win32 -PassThru
# $api::NDRCContextUnmarshall(pCContext, hBinding, pBuff, DataRepresentation)
#uselib "RPCRT4.dll"
#func global NDRCContextUnmarshall "NDRCContextUnmarshall" sptr, sptr, sptr, sptr
; NDRCContextUnmarshall varptr(pCContext), hBinding, pBuff, DataRepresentation
; pCContext : INT_PTR* optional, in/out -> "sptr"
; hBinding : void* -> "sptr"
; pBuff : void* -> "sptr"
; DataRepresentation : DWORD -> "sptr"
出力引数:
#uselib "RPCRT4.dll"
#func global NDRCContextUnmarshall "NDRCContextUnmarshall" var, sptr, sptr, int
; NDRCContextUnmarshall pCContext, hBinding, pBuff, DataRepresentation
; pCContext : INT_PTR* optional, in/out -> "var"
; hBinding : void* -> "sptr"
; pBuff : void* -> "sptr"
; DataRepresentation : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void NDRCContextUnmarshall(INT_PTR* pCContext, void* hBinding, void* pBuff, DWORD DataRepresentation)
#uselib "RPCRT4.dll"
#func global NDRCContextUnmarshall "NDRCContextUnmarshall" var, intptr, intptr, int
; NDRCContextUnmarshall pCContext, hBinding, pBuff, DataRepresentation
; pCContext : INT_PTR* optional, in/out -> "var"
; hBinding : void* -> "intptr"
; pBuff : void* -> "intptr"
; DataRepresentation : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procNDRCContextUnmarshall = rpcrt4.NewProc("NDRCContextUnmarshall")
)

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

extern "rpcrt4" fn NDRCContextUnmarshall(
    pCContext: [*c]isize, // INT_PTR* optional, in/out
    hBinding: ?*anyopaque, // void*
    pBuff: ?*anyopaque, // void*
    DataRepresentation: u32 // DWORD
) callconv(std.os.windows.WINAPI) void;
proc NDRCContextUnmarshall(
    pCContext: ptr int,  # INT_PTR* optional, in/out
    hBinding: pointer,  # void*
    pBuff: pointer,  # void*
    DataRepresentation: uint32  # DWORD
) {.importc: "NDRCContextUnmarshall", stdcall, dynlib: "RPCRT4.dll".}
pragma(lib, "rpcrt4");
extern(Windows)
void NDRCContextUnmarshall(
    ptrdiff_t* pCContext,   // INT_PTR* optional, in/out
    void* hBinding,   // void*
    void* pBuff,   // void*
    uint DataRepresentation   // DWORD
);
ccall((:NDRCContextUnmarshall, "RPCRT4.dll"), stdcall, Cvoid,
      (Ptr{Int}, Ptr{Cvoid}, Ptr{Cvoid}, UInt32),
      pCContext, hBinding, pBuff, DataRepresentation)
# pCContext : INT_PTR* optional, in/out -> Ptr{Int}
# hBinding : void* -> Ptr{Cvoid}
# pBuff : void* -> Ptr{Cvoid}
# DataRepresentation : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void NDRCContextUnmarshall(
    intptr_t* pCContext,
    void* hBinding,
    void* pBuff,
    uint32_t DataRepresentation);
]]
local rpcrt4 = ffi.load("rpcrt4")
-- rpcrt4.NDRCContextUnmarshall(pCContext, hBinding, pBuff, DataRepresentation)
-- pCContext : INT_PTR* optional, in/out
-- hBinding : void*
-- pBuff : void*
-- DataRepresentation : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('RPCRT4.dll');
const NDRCContextUnmarshall = lib.func('__stdcall', 'NDRCContextUnmarshall', 'void', ['intptr_t *', 'void *', 'void *', 'uint32_t']);
// NDRCContextUnmarshall(pCContext, hBinding, pBuff, DataRepresentation)
// pCContext : INT_PTR* optional, in/out -> 'intptr_t *'
// hBinding : void* -> 'void *'
// pBuff : void* -> 'void *'
// DataRepresentation : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("RPCRT4.dll", {
  NDRCContextUnmarshall: { parameters: ["pointer", "pointer", "pointer", "u32"], result: "void" },
});
// lib.symbols.NDRCContextUnmarshall(pCContext, hBinding, pBuff, DataRepresentation)
// pCContext : INT_PTR* optional, in/out -> "pointer"
// hBinding : void* -> "pointer"
// pBuff : void* -> "pointer"
// DataRepresentation : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void NDRCContextUnmarshall(
    intptr_t* pCContext,
    void* hBinding,
    void* pBuff,
    uint32_t DataRepresentation);
C, "RPCRT4.dll");
// $ffi->NDRCContextUnmarshall(pCContext, hBinding, pBuff, DataRepresentation);
// pCContext : INT_PTR* optional, in/out
// hBinding : void*
// pBuff : void*
// DataRepresentation : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Rpcrt4 extends StdCallLibrary {
    Rpcrt4 INSTANCE = Native.load("rpcrt4", Rpcrt4.class);
    void NDRCContextUnmarshall(
        LongByReference pCContext,   // INT_PTR* optional, in/out
        Pointer hBinding,   // void*
        Pointer pBuff,   // void*
        int DataRepresentation   // DWORD
    );
}
@[Link("rpcrt4")]
lib LibRPCRT4
  fun NDRCContextUnmarshall = NDRCContextUnmarshall(
    pCContext : LibC::SSizeT*,   # INT_PTR* optional, in/out
    hBinding : Void*,   # void*
    pBuff : Void*,   # void*
    DataRepresentation : UInt32   # DWORD
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef NDRCContextUnmarshallNative = Void Function(Pointer<IntPtr>, Pointer<Void>, Pointer<Void>, Uint32);
typedef NDRCContextUnmarshallDart = void Function(Pointer<IntPtr>, Pointer<Void>, Pointer<Void>, int);
final NDRCContextUnmarshall = DynamicLibrary.open('RPCRT4.dll')
    .lookupFunction<NDRCContextUnmarshallNative, NDRCContextUnmarshallDart>('NDRCContextUnmarshall');
// pCContext : INT_PTR* optional, in/out -> Pointer<IntPtr>
// hBinding : void* -> Pointer<Void>
// pBuff : void* -> Pointer<Void>
// DataRepresentation : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure NDRCContextUnmarshall(
  pCContext: Pointer;   // INT_PTR* optional, in/out
  hBinding: Pointer;   // void*
  pBuff: Pointer;   // void*
  DataRepresentation: DWORD   // DWORD
); stdcall;
  external 'RPCRT4.dll' name 'NDRCContextUnmarshall';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "NDRCContextUnmarshall"
  c_NDRCContextUnmarshall :: Ptr CIntPtr -> Ptr () -> Ptr () -> Word32 -> IO ()
-- pCContext : INT_PTR* optional, in/out -> Ptr CIntPtr
-- hBinding : void* -> Ptr ()
-- pBuff : void* -> Ptr ()
-- DataRepresentation : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ndrccontextunmarshall =
  foreign "NDRCContextUnmarshall"
    ((ptr intptr_t) @-> (ptr void) @-> (ptr void) @-> uint32_t @-> returning void)
(* pCContext : INT_PTR* optional, in/out -> (ptr intptr_t) *)
(* hBinding : void* -> (ptr void) *)
(* pBuff : void* -> (ptr void) *)
(* DataRepresentation : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library rpcrt4 (t "RPCRT4.dll"))
(cffi:use-foreign-library rpcrt4)

(cffi:defcfun ("NDRCContextUnmarshall" ndrccontext-unmarshall :convention :stdcall) :void
  (p-ccontext :pointer)   ; INT_PTR* optional, in/out
  (h-binding :pointer)   ; void*
  (p-buff :pointer)   ; void*
  (data-representation :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $NDRCContextUnmarshall = Win32::API::More->new('RPCRT4',
    'void NDRCContextUnmarshall(LPVOID pCContext, LPVOID hBinding, LPVOID pBuff, DWORD DataRepresentation)');
# my $ret = $NDRCContextUnmarshall->Call($pCContext, $hBinding, $pBuff, $DataRepresentation);
# pCContext : INT_PTR* optional, in/out -> LPVOID
# hBinding : void* -> LPVOID
# pBuff : void* -> LPVOID
# DataRepresentation : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。