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