ホーム › System.Rpc › NdrMesTypeAlignSize
NdrMesTypeAlignSize
関数シリアル化する型の整列済みサイズを算出する。
シグネチャ
// RPCRT4.dll
#include <windows.h>
UINT_PTR NdrMesTypeAlignSize(
void* Handle,
const MIDL_STUB_DESC* pStubDesc,
BYTE* pFormatString,
const void* pObject
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Handle | void* | inout |
| pStubDesc | MIDL_STUB_DESC* | in |
| pFormatString | BYTE* | inout |
| pObject | void* | in |
戻り値の型: UINT_PTR
各言語での呼び出し定義
// RPCRT4.dll
#include <windows.h>
UINT_PTR NdrMesTypeAlignSize(
void* Handle,
const MIDL_STUB_DESC* pStubDesc,
BYTE* pFormatString,
const void* pObject
);[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern UIntPtr NdrMesTypeAlignSize(
IntPtr Handle, // void* in/out
IntPtr pStubDesc, // MIDL_STUB_DESC*
IntPtr pFormatString, // BYTE* in/out
IntPtr pObject // void*
);<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function NdrMesTypeAlignSize(
Handle As IntPtr, ' void* in/out
pStubDesc As IntPtr, ' MIDL_STUB_DESC*
pFormatString As IntPtr, ' BYTE* in/out
pObject As IntPtr ' void*
) As UIntPtr
End Function' Handle : void* in/out
' pStubDesc : MIDL_STUB_DESC*
' pFormatString : BYTE* in/out
' pObject : void*
Declare PtrSafe Function NdrMesTypeAlignSize Lib "rpcrt4" ( _
ByVal Handle As LongPtr, _
ByVal pStubDesc As LongPtr, _
ByVal pFormatString As LongPtr, _
ByVal pObject As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
NdrMesTypeAlignSize = ctypes.windll.rpcrt4.NdrMesTypeAlignSize
NdrMesTypeAlignSize.restype = ctypes.c_size_t
NdrMesTypeAlignSize.argtypes = [
ctypes.POINTER(None), # Handle : void* in/out
ctypes.c_void_p, # pStubDesc : MIDL_STUB_DESC*
ctypes.POINTER(ctypes.c_ubyte), # pFormatString : BYTE* in/out
ctypes.POINTER(None), # pObject : void*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
NdrMesTypeAlignSize = Fiddle::Function.new(
lib['NdrMesTypeAlignSize'],
[
Fiddle::TYPE_VOIDP, # Handle : void* in/out
Fiddle::TYPE_VOIDP, # pStubDesc : MIDL_STUB_DESC*
Fiddle::TYPE_VOIDP, # pFormatString : BYTE* in/out
Fiddle::TYPE_VOIDP, # pObject : void*
],
Fiddle::TYPE_UINTPTR_T)#[link(name = "rpcrt4")]
extern "system" {
fn NdrMesTypeAlignSize(
Handle: *mut (), // void* in/out
pStubDesc: *const MIDL_STUB_DESC, // MIDL_STUB_DESC*
pFormatString: *mut u8, // BYTE* in/out
pObject: *const () // void*
) -> usize;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RPCRT4.dll")]
public static extern UIntPtr NdrMesTypeAlignSize(IntPtr Handle, IntPtr pStubDesc, IntPtr pFormatString, IntPtr pObject);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_NdrMesTypeAlignSize' -Namespace Win32 -PassThru
# $api::NdrMesTypeAlignSize(Handle, pStubDesc, pFormatString, pObject)#uselib "RPCRT4.dll"
#func global NdrMesTypeAlignSize "NdrMesTypeAlignSize" sptr, sptr, sptr, sptr
; NdrMesTypeAlignSize Handle, varptr(pStubDesc), varptr(pFormatString), pObject ; 戻り値は stat
; Handle : void* in/out -> "sptr"
; pStubDesc : MIDL_STUB_DESC* -> "sptr"
; pFormatString : BYTE* in/out -> "sptr"
; pObject : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RPCRT4.dll" #cfunc global NdrMesTypeAlignSize "NdrMesTypeAlignSize" sptr, var, var, sptr ; res = NdrMesTypeAlignSize(Handle, pStubDesc, pFormatString, pObject) ; Handle : void* in/out -> "sptr" ; pStubDesc : MIDL_STUB_DESC* -> "var" ; pFormatString : BYTE* in/out -> "var" ; pObject : void* -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RPCRT4.dll" #cfunc global NdrMesTypeAlignSize "NdrMesTypeAlignSize" sptr, sptr, sptr, sptr ; res = NdrMesTypeAlignSize(Handle, varptr(pStubDesc), varptr(pFormatString), pObject) ; Handle : void* in/out -> "sptr" ; pStubDesc : MIDL_STUB_DESC* -> "sptr" ; pFormatString : BYTE* in/out -> "sptr" ; pObject : void* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; UINT_PTR NdrMesTypeAlignSize(void* Handle, MIDL_STUB_DESC* pStubDesc, BYTE* pFormatString, void* pObject) #uselib "RPCRT4.dll" #cfunc global NdrMesTypeAlignSize "NdrMesTypeAlignSize" intptr, var, var, intptr ; res = NdrMesTypeAlignSize(Handle, pStubDesc, pFormatString, pObject) ; Handle : void* in/out -> "intptr" ; pStubDesc : MIDL_STUB_DESC* -> "var" ; pFormatString : BYTE* in/out -> "var" ; pObject : void* -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; UINT_PTR NdrMesTypeAlignSize(void* Handle, MIDL_STUB_DESC* pStubDesc, BYTE* pFormatString, void* pObject) #uselib "RPCRT4.dll" #cfunc global NdrMesTypeAlignSize "NdrMesTypeAlignSize" intptr, intptr, intptr, intptr ; res = NdrMesTypeAlignSize(Handle, varptr(pStubDesc), varptr(pFormatString), pObject) ; Handle : void* in/out -> "intptr" ; pStubDesc : MIDL_STUB_DESC* -> "intptr" ; pFormatString : BYTE* in/out -> "intptr" ; pObject : void* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procNdrMesTypeAlignSize = rpcrt4.NewProc("NdrMesTypeAlignSize")
)
// Handle (void* in/out), pStubDesc (MIDL_STUB_DESC*), pFormatString (BYTE* in/out), pObject (void*)
r1, _, err := procNdrMesTypeAlignSize.Call(
uintptr(Handle),
uintptr(pStubDesc),
uintptr(pFormatString),
uintptr(pObject),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // UINT_PTRfunction NdrMesTypeAlignSize(
Handle: Pointer; // void* in/out
pStubDesc: Pointer; // MIDL_STUB_DESC*
pFormatString: Pointer; // BYTE* in/out
pObject: Pointer // void*
): NativeUInt; stdcall;
external 'RPCRT4.dll' name 'NdrMesTypeAlignSize';result := DllCall("RPCRT4\NdrMesTypeAlignSize"
, "Ptr", Handle ; void* in/out
, "Ptr", pStubDesc ; MIDL_STUB_DESC*
, "Ptr", pFormatString ; BYTE* in/out
, "Ptr", pObject ; void*
, "UPtr") ; return: UINT_PTR●NdrMesTypeAlignSize(Handle, pStubDesc, pFormatString, pObject) = DLL("RPCRT4.dll", "int NdrMesTypeAlignSize(void*, void*, void*, void*)")
# 呼び出し: NdrMesTypeAlignSize(Handle, pStubDesc, pFormatString, pObject)
# Handle : void* in/out -> "void*"
# pStubDesc : MIDL_STUB_DESC* -> "void*"
# pFormatString : BYTE* in/out -> "void*"
# pObject : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。