ホーム › System.Rpc › RpcEpRegisterA
RpcEpRegisterA
関数RPCインターフェイスのバインディングをエンドポイントマッパーへ登録する(ANSI版)。
シグネチャ
// RPCRT4.dll (ANSI / -A)
#include <windows.h>
RPC_STATUS RpcEpRegisterA(
void* IfSpec,
RPC_BINDING_VECTOR* BindingVector,
UUID_VECTOR* UuidVector, // optional
LPSTR Annotation // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| IfSpec | void* | in | エンドポイントマッパーへ登録するインターフェイス仕様ハンドル。 |
| BindingVector | RPC_BINDING_VECTOR* | in | 登録するサーバーバインディング群を保持するRPC_BINDING_VECTORへのポインタ。 |
| UuidVector | UUID_VECTOR* | inoptional | 関連付けるオブジェクトUUID群へのポインタ。NULL可。 |
| Annotation | LPSTR | inoptional | 登録に付与する注釈文字列(ANSI、最大64文字)。NULL可。 |
戻り値の型: RPC_STATUS
各言語での呼び出し定義
// RPCRT4.dll (ANSI / -A)
#include <windows.h>
RPC_STATUS RpcEpRegisterA(
void* IfSpec,
RPC_BINDING_VECTOR* BindingVector,
UUID_VECTOR* UuidVector, // optional
LPSTR Annotation // optional
);[DllImport("RPCRT4.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int RpcEpRegisterA(
IntPtr IfSpec, // void*
IntPtr BindingVector, // RPC_BINDING_VECTOR*
IntPtr UuidVector, // UUID_VECTOR* optional
[MarshalAs(UnmanagedType.LPStr)] string Annotation // LPSTR optional
);<DllImport("RPCRT4.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function RpcEpRegisterA(
IfSpec As IntPtr, ' void*
BindingVector As IntPtr, ' RPC_BINDING_VECTOR*
UuidVector As IntPtr, ' UUID_VECTOR* optional
<MarshalAs(UnmanagedType.LPStr)> Annotation As String ' LPSTR optional
) As Integer
End Function' IfSpec : void*
' BindingVector : RPC_BINDING_VECTOR*
' UuidVector : UUID_VECTOR* optional
' Annotation : LPSTR optional
Declare PtrSafe Function RpcEpRegisterA Lib "rpcrt4" ( _
ByVal IfSpec As LongPtr, _
ByVal BindingVector As LongPtr, _
ByVal UuidVector As LongPtr, _
ByVal Annotation As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RpcEpRegisterA = ctypes.windll.rpcrt4.RpcEpRegisterA
RpcEpRegisterA.restype = ctypes.c_int
RpcEpRegisterA.argtypes = [
ctypes.POINTER(None), # IfSpec : void*
ctypes.c_void_p, # BindingVector : RPC_BINDING_VECTOR*
ctypes.c_void_p, # UuidVector : UUID_VECTOR* optional
wintypes.LPCSTR, # Annotation : LPSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
RpcEpRegisterA = Fiddle::Function.new(
lib['RpcEpRegisterA'],
[
Fiddle::TYPE_VOIDP, # IfSpec : void*
Fiddle::TYPE_VOIDP, # BindingVector : RPC_BINDING_VECTOR*
Fiddle::TYPE_VOIDP, # UuidVector : UUID_VECTOR* optional
Fiddle::TYPE_VOIDP, # Annotation : LPSTR optional
],
Fiddle::TYPE_INT)#[link(name = "rpcrt4")]
extern "system" {
fn RpcEpRegisterA(
IfSpec: *mut (), // void*
BindingVector: *mut RPC_BINDING_VECTOR, // RPC_BINDING_VECTOR*
UuidVector: *mut UUID_VECTOR, // UUID_VECTOR* optional
Annotation: *mut u8 // LPSTR optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RPCRT4.dll", CharSet = CharSet.Ansi)]
public static extern int RpcEpRegisterA(IntPtr IfSpec, IntPtr BindingVector, IntPtr UuidVector, [MarshalAs(UnmanagedType.LPStr)] string Annotation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcEpRegisterA' -Namespace Win32 -PassThru
# $api::RpcEpRegisterA(IfSpec, BindingVector, UuidVector, Annotation)#uselib "RPCRT4.dll"
#func global RpcEpRegisterA "RpcEpRegisterA" sptr, sptr, sptr, sptr
; RpcEpRegisterA IfSpec, varptr(BindingVector), varptr(UuidVector), Annotation ; 戻り値は stat
; IfSpec : void* -> "sptr"
; BindingVector : RPC_BINDING_VECTOR* -> "sptr"
; UuidVector : UUID_VECTOR* optional -> "sptr"
; Annotation : LPSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RPCRT4.dll" #cfunc global RpcEpRegisterA "RpcEpRegisterA" sptr, var, var, str ; res = RpcEpRegisterA(IfSpec, BindingVector, UuidVector, Annotation) ; IfSpec : void* -> "sptr" ; BindingVector : RPC_BINDING_VECTOR* -> "var" ; UuidVector : UUID_VECTOR* optional -> "var" ; Annotation : LPSTR optional -> "str" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RPCRT4.dll" #cfunc global RpcEpRegisterA "RpcEpRegisterA" sptr, sptr, sptr, str ; res = RpcEpRegisterA(IfSpec, varptr(BindingVector), varptr(UuidVector), Annotation) ; IfSpec : void* -> "sptr" ; BindingVector : RPC_BINDING_VECTOR* -> "sptr" ; UuidVector : UUID_VECTOR* optional -> "sptr" ; Annotation : LPSTR optional -> "str" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; RPC_STATUS RpcEpRegisterA(void* IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, LPSTR Annotation) #uselib "RPCRT4.dll" #cfunc global RpcEpRegisterA "RpcEpRegisterA" intptr, var, var, str ; res = RpcEpRegisterA(IfSpec, BindingVector, UuidVector, Annotation) ; IfSpec : void* -> "intptr" ; BindingVector : RPC_BINDING_VECTOR* -> "var" ; UuidVector : UUID_VECTOR* optional -> "var" ; Annotation : LPSTR optional -> "str" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; RPC_STATUS RpcEpRegisterA(void* IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, LPSTR Annotation) #uselib "RPCRT4.dll" #cfunc global RpcEpRegisterA "RpcEpRegisterA" intptr, intptr, intptr, str ; res = RpcEpRegisterA(IfSpec, varptr(BindingVector), varptr(UuidVector), Annotation) ; IfSpec : void* -> "intptr" ; BindingVector : RPC_BINDING_VECTOR* -> "intptr" ; UuidVector : UUID_VECTOR* optional -> "intptr" ; Annotation : LPSTR optional -> "str" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procRpcEpRegisterA = rpcrt4.NewProc("RpcEpRegisterA")
)
// IfSpec (void*), BindingVector (RPC_BINDING_VECTOR*), UuidVector (UUID_VECTOR* optional), Annotation (LPSTR optional)
r1, _, err := procRpcEpRegisterA.Call(
uintptr(IfSpec),
uintptr(BindingVector),
uintptr(UuidVector),
uintptr(unsafe.Pointer(windows.BytePtrFromString(Annotation))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // RPC_STATUSfunction RpcEpRegisterA(
IfSpec: Pointer; // void*
BindingVector: Pointer; // RPC_BINDING_VECTOR*
UuidVector: Pointer; // UUID_VECTOR* optional
Annotation: PAnsiChar // LPSTR optional
): Integer; stdcall;
external 'RPCRT4.dll' name 'RpcEpRegisterA';result := DllCall("RPCRT4\RpcEpRegisterA"
, "Ptr", IfSpec ; void*
, "Ptr", BindingVector ; RPC_BINDING_VECTOR*
, "Ptr", UuidVector ; UUID_VECTOR* optional
, "AStr", Annotation ; LPSTR optional
, "Int") ; return: RPC_STATUS●RpcEpRegisterA(IfSpec, BindingVector, UuidVector, Annotation) = DLL("RPCRT4.dll", "int RpcEpRegisterA(void*, void*, void*, char*)")
# 呼び出し: RpcEpRegisterA(IfSpec, BindingVector, UuidVector, Annotation)
# IfSpec : void* -> "void*"
# BindingVector : RPC_BINDING_VECTOR* -> "void*"
# UuidVector : UUID_VECTOR* optional -> "void*"
# Annotation : LPSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "rpcrt4" fn RpcEpRegisterA(
IfSpec: ?*anyopaque, // void*
BindingVector: [*c]RPC_BINDING_VECTOR, // RPC_BINDING_VECTOR*
UuidVector: [*c]UUID_VECTOR, // UUID_VECTOR* optional
Annotation: [*c]const u8 // LPSTR optional
) callconv(std.os.windows.WINAPI) i32;proc RpcEpRegisterA(
IfSpec: pointer, # void*
BindingVector: ptr RPC_BINDING_VECTOR, # RPC_BINDING_VECTOR*
UuidVector: ptr UUID_VECTOR, # UUID_VECTOR* optional
Annotation: cstring # LPSTR optional
): int32 {.importc: "RpcEpRegisterA", stdcall, dynlib: "RPCRT4.dll".}pragma(lib, "rpcrt4");
extern(Windows)
int RpcEpRegisterA(
void* IfSpec, // void*
RPC_BINDING_VECTOR* BindingVector, // RPC_BINDING_VECTOR*
UUID_VECTOR* UuidVector, // UUID_VECTOR* optional
const(char)* Annotation // LPSTR optional
);ccall((:RpcEpRegisterA, "RPCRT4.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{RPC_BINDING_VECTOR}, Ptr{UUID_VECTOR}, Cstring),
IfSpec, BindingVector, UuidVector, Annotation)
# IfSpec : void* -> Ptr{Cvoid}
# BindingVector : RPC_BINDING_VECTOR* -> Ptr{RPC_BINDING_VECTOR}
# UuidVector : UUID_VECTOR* optional -> Ptr{UUID_VECTOR}
# Annotation : LPSTR optional -> Cstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t RpcEpRegisterA(
void* IfSpec,
void* BindingVector,
void* UuidVector,
const char* Annotation);
]]
local rpcrt4 = ffi.load("rpcrt4")
-- rpcrt4.RpcEpRegisterA(IfSpec, BindingVector, UuidVector, Annotation)
-- IfSpec : void*
-- BindingVector : RPC_BINDING_VECTOR*
-- UuidVector : UUID_VECTOR* optional
-- Annotation : LPSTR optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('RPCRT4.dll');
const RpcEpRegisterA = lib.func('__stdcall', 'RpcEpRegisterA', 'int32_t', ['void *', 'void *', 'void *', 'str']);
// RpcEpRegisterA(IfSpec, BindingVector, UuidVector, Annotation)
// IfSpec : void* -> 'void *'
// BindingVector : RPC_BINDING_VECTOR* -> 'void *'
// UuidVector : UUID_VECTOR* optional -> 'void *'
// Annotation : LPSTR optional -> 'str'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("RPCRT4.dll", {
RpcEpRegisterA: { parameters: ["pointer", "pointer", "pointer", "buffer"], result: "i32" },
});
// lib.symbols.RpcEpRegisterA(IfSpec, BindingVector, UuidVector, Annotation)
// IfSpec : void* -> "pointer"
// BindingVector : RPC_BINDING_VECTOR* -> "pointer"
// UuidVector : UUID_VECTOR* optional -> "pointer"
// Annotation : LPSTR optional -> "buffer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t RpcEpRegisterA(
void* IfSpec,
void* BindingVector,
void* UuidVector,
const char* Annotation);
C, "RPCRT4.dll");
// $ffi->RpcEpRegisterA(IfSpec, BindingVector, UuidVector, Annotation);
// IfSpec : void*
// BindingVector : RPC_BINDING_VECTOR*
// UuidVector : UUID_VECTOR* optional
// Annotation : LPSTR optional
// 構造体/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, W32APIOptions.ASCII_OPTIONS);
int RpcEpRegisterA(
Pointer IfSpec, // void*
Pointer BindingVector, // RPC_BINDING_VECTOR*
Pointer UuidVector, // UUID_VECTOR* optional
String Annotation // LPSTR optional
);
}@[Link("rpcrt4")]
lib LibRPCRT4
fun RpcEpRegisterA = RpcEpRegisterA(
IfSpec : Void*, # void*
BindingVector : RPC_BINDING_VECTOR*, # RPC_BINDING_VECTOR*
UuidVector : UUID_VECTOR*, # UUID_VECTOR* optional
Annotation : UInt8* # LPSTR optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RpcEpRegisterANative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Utf8>);
typedef RpcEpRegisterADart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Utf8>);
final RpcEpRegisterA = DynamicLibrary.open('RPCRT4.dll')
.lookupFunction<RpcEpRegisterANative, RpcEpRegisterADart>('RpcEpRegisterA');
// IfSpec : void* -> Pointer<Void>
// BindingVector : RPC_BINDING_VECTOR* -> Pointer<Void>
// UuidVector : UUID_VECTOR* optional -> Pointer<Void>
// Annotation : LPSTR optional -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function RpcEpRegisterA(
IfSpec: Pointer; // void*
BindingVector: Pointer; // RPC_BINDING_VECTOR*
UuidVector: Pointer; // UUID_VECTOR* optional
Annotation: PAnsiChar // LPSTR optional
): Integer; stdcall;
external 'RPCRT4.dll' name 'RpcEpRegisterA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RpcEpRegisterA"
c_RpcEpRegisterA :: Ptr () -> Ptr () -> Ptr () -> CString -> IO Int32
-- IfSpec : void* -> Ptr ()
-- BindingVector : RPC_BINDING_VECTOR* -> Ptr ()
-- UuidVector : UUID_VECTOR* optional -> Ptr ()
-- Annotation : LPSTR optional -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let rpcepregistera =
foreign "RpcEpRegisterA"
((ptr void) @-> (ptr void) @-> (ptr void) @-> string @-> returning int32_t)
(* IfSpec : void* -> (ptr void) *)
(* BindingVector : RPC_BINDING_VECTOR* -> (ptr void) *)
(* UuidVector : UUID_VECTOR* optional -> (ptr void) *)
(* Annotation : LPSTR optional -> string *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library rpcrt4 (t "RPCRT4.dll"))
(cffi:use-foreign-library rpcrt4)
(cffi:defcfun ("RpcEpRegisterA" rpc-ep-register-a :convention :stdcall) :int32
(if-spec :pointer) ; void*
(binding-vector :pointer) ; RPC_BINDING_VECTOR*
(uuid-vector :pointer) ; UUID_VECTOR* optional
(annotation :string)) ; LPSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RpcEpRegisterA = Win32::API::More->new('RPCRT4',
'int RpcEpRegisterA(LPVOID IfSpec, LPVOID BindingVector, LPVOID UuidVector, LPCSTR Annotation)');
# my $ret = $RpcEpRegisterA->Call($IfSpec, $BindingVector, $UuidVector, $Annotation);
# IfSpec : void* -> LPVOID
# BindingVector : RPC_BINDING_VECTOR* -> LPVOID
# UuidVector : UUID_VECTOR* optional -> LPVOID
# Annotation : LPSTR optional -> LPCSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f RpcEpRegisterW (Unicode版) — RPCインターフェイスのバインディングをエンドポイントマッパーへ登録する(Unicode版)。