ホーム › System.Rpc › NdrConvert2
NdrConvert2
関数受信RPCバッファのデータ表現を端数指定で変換する。
シグネチャ
// RPCRT4.dll
#include <windows.h>
void NdrConvert2(
MIDL_STUB_MESSAGE* pStubMsg,
BYTE* pFormat,
INT NumberParams
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pStubMsg | MIDL_STUB_MESSAGE* | inout |
| pFormat | BYTE* | inout |
| NumberParams | INT | in |
戻り値の型: void
各言語での呼び出し定義
// RPCRT4.dll
#include <windows.h>
void NdrConvert2(
MIDL_STUB_MESSAGE* pStubMsg,
BYTE* pFormat,
INT NumberParams
);[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern void NdrConvert2(
IntPtr pStubMsg, // MIDL_STUB_MESSAGE* in/out
IntPtr pFormat, // BYTE* in/out
int NumberParams // INT
);<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Sub NdrConvert2(
pStubMsg As IntPtr, ' MIDL_STUB_MESSAGE* in/out
pFormat As IntPtr, ' BYTE* in/out
NumberParams As Integer ' INT
)
End Sub' pStubMsg : MIDL_STUB_MESSAGE* in/out
' pFormat : BYTE* in/out
' NumberParams : INT
Declare PtrSafe Sub NdrConvert2 Lib "rpcrt4" ( _
ByVal pStubMsg As LongPtr, _
ByVal pFormat As LongPtr, _
ByVal NumberParams As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
NdrConvert2 = ctypes.windll.rpcrt4.NdrConvert2
NdrConvert2.restype = None
NdrConvert2.argtypes = [
ctypes.c_void_p, # pStubMsg : MIDL_STUB_MESSAGE* in/out
ctypes.POINTER(ctypes.c_ubyte), # pFormat : BYTE* in/out
ctypes.c_int, # NumberParams : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
NdrConvert2 = Fiddle::Function.new(
lib['NdrConvert2'],
[
Fiddle::TYPE_VOIDP, # pStubMsg : MIDL_STUB_MESSAGE* in/out
Fiddle::TYPE_VOIDP, # pFormat : BYTE* in/out
Fiddle::TYPE_INT, # NumberParams : INT
],
Fiddle::TYPE_VOID)#[link(name = "rpcrt4")]
extern "system" {
fn NdrConvert2(
pStubMsg: *mut MIDL_STUB_MESSAGE, // MIDL_STUB_MESSAGE* in/out
pFormat: *mut u8, // BYTE* in/out
NumberParams: i32 // INT
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RPCRT4.dll")]
public static extern void NdrConvert2(IntPtr pStubMsg, IntPtr pFormat, int NumberParams);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_NdrConvert2' -Namespace Win32 -PassThru
# $api::NdrConvert2(pStubMsg, pFormat, NumberParams)#uselib "RPCRT4.dll"
#func global NdrConvert2 "NdrConvert2" sptr, sptr, sptr
; NdrConvert2 varptr(pStubMsg), varptr(pFormat), NumberParams
; pStubMsg : MIDL_STUB_MESSAGE* in/out -> "sptr"
; pFormat : BYTE* in/out -> "sptr"
; NumberParams : INT -> "sptr"出力引数:
#uselib "RPCRT4.dll" #func global NdrConvert2 "NdrConvert2" var, var, int ; NdrConvert2 pStubMsg, pFormat, NumberParams ; pStubMsg : MIDL_STUB_MESSAGE* in/out -> "var" ; pFormat : BYTE* in/out -> "var" ; NumberParams : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RPCRT4.dll" #func global NdrConvert2 "NdrConvert2" sptr, sptr, int ; NdrConvert2 varptr(pStubMsg), varptr(pFormat), NumberParams ; pStubMsg : MIDL_STUB_MESSAGE* in/out -> "sptr" ; pFormat : BYTE* in/out -> "sptr" ; NumberParams : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void NdrConvert2(MIDL_STUB_MESSAGE* pStubMsg, BYTE* pFormat, INT NumberParams) #uselib "RPCRT4.dll" #func global NdrConvert2 "NdrConvert2" var, var, int ; NdrConvert2 pStubMsg, pFormat, NumberParams ; pStubMsg : MIDL_STUB_MESSAGE* in/out -> "var" ; pFormat : BYTE* in/out -> "var" ; NumberParams : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void NdrConvert2(MIDL_STUB_MESSAGE* pStubMsg, BYTE* pFormat, INT NumberParams) #uselib "RPCRT4.dll" #func global NdrConvert2 "NdrConvert2" intptr, intptr, int ; NdrConvert2 varptr(pStubMsg), varptr(pFormat), NumberParams ; pStubMsg : MIDL_STUB_MESSAGE* in/out -> "intptr" ; pFormat : BYTE* in/out -> "intptr" ; NumberParams : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procNdrConvert2 = rpcrt4.NewProc("NdrConvert2")
)
// pStubMsg (MIDL_STUB_MESSAGE* in/out), pFormat (BYTE* in/out), NumberParams (INT)
r1, _, err := procNdrConvert2.Call(
uintptr(pStubMsg),
uintptr(pFormat),
uintptr(NumberParams),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure NdrConvert2(
pStubMsg: Pointer; // MIDL_STUB_MESSAGE* in/out
pFormat: Pointer; // BYTE* in/out
NumberParams: Integer // INT
); stdcall;
external 'RPCRT4.dll' name 'NdrConvert2';result := DllCall("RPCRT4\NdrConvert2"
, "Ptr", pStubMsg ; MIDL_STUB_MESSAGE* in/out
, "Ptr", pFormat ; BYTE* in/out
, "Int", NumberParams ; INT
, "Int") ; return: void●NdrConvert2(pStubMsg, pFormat, NumberParams) = DLL("RPCRT4.dll", "int NdrConvert2(void*, void*, int)")
# 呼び出し: NdrConvert2(pStubMsg, pFormat, NumberParams)
# pStubMsg : MIDL_STUB_MESSAGE* in/out -> "void*"
# pFormat : BYTE* in/out -> "void*"
# NumberParams : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。