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

RpcNsMgmtBindingUnexportW

関数
名前エントリからバインディング情報のエクスポートを解除する(Unicode版)。
DLLRPCNS4.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// RPCNS4.dll  (Unicode / -W)
#include <windows.h>

RPC_STATUS RpcNsMgmtBindingUnexportW(
    DWORD EntryNameSyntax,
    LPWSTR EntryName,
    RPC_IF_ID* IfId,   // optional
    DWORD VersOption,
    UUID_VECTOR* ObjectUuidVec   // optional
);

パラメーター

名前方向説明
EntryNameSyntaxDWORDinEntryNameの名前構文を指定するDWORD。0で既定構文を使用する。
EntryNameLPWSTRinバインディングを管理削除する対象エントリ名(Unicode文字列)。
IfIdRPC_IF_ID*inoptional削除対象のインターフェイス識別子(RPC_IF_ID)へのポインタ。NULL可。
VersOptionDWORDinIfIdのバージョン照合方法を指定する値。
ObjectUuidVecUUID_VECTOR*inoptional削除対象のオブジェクトUUIDベクターへのポインタ。NULL可。

戻り値の型: RPC_STATUS

各言語での呼び出し定義

// RPCNS4.dll  (Unicode / -W)
#include <windows.h>

RPC_STATUS RpcNsMgmtBindingUnexportW(
    DWORD EntryNameSyntax,
    LPWSTR EntryName,
    RPC_IF_ID* IfId,   // optional
    DWORD VersOption,
    UUID_VECTOR* ObjectUuidVec   // optional
);
[DllImport("RPCNS4.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RpcNsMgmtBindingUnexportW(
    uint EntryNameSyntax,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string EntryName,   // LPWSTR
    IntPtr IfId,   // RPC_IF_ID* optional
    uint VersOption,   // DWORD
    IntPtr ObjectUuidVec   // UUID_VECTOR* optional
);
<DllImport("RPCNS4.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RpcNsMgmtBindingUnexportW(
    EntryNameSyntax As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> EntryName As String,   ' LPWSTR
    IfId As IntPtr,   ' RPC_IF_ID* optional
    VersOption As UInteger,   ' DWORD
    ObjectUuidVec As IntPtr   ' UUID_VECTOR* optional
) As Integer
End Function
' EntryNameSyntax : DWORD
' EntryName : LPWSTR
' IfId : RPC_IF_ID* optional
' VersOption : DWORD
' ObjectUuidVec : UUID_VECTOR* optional
Declare PtrSafe Function RpcNsMgmtBindingUnexportW Lib "rpcns4" ( _
    ByVal EntryNameSyntax As Long, _
    ByVal EntryName As LongPtr, _
    ByVal IfId As LongPtr, _
    ByVal VersOption As Long, _
    ByVal ObjectUuidVec As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RpcNsMgmtBindingUnexportW = ctypes.windll.rpcns4.RpcNsMgmtBindingUnexportW
RpcNsMgmtBindingUnexportW.restype = ctypes.c_int
RpcNsMgmtBindingUnexportW.argtypes = [
    wintypes.DWORD,  # EntryNameSyntax : DWORD
    wintypes.LPCWSTR,  # EntryName : LPWSTR
    ctypes.c_void_p,  # IfId : RPC_IF_ID* optional
    wintypes.DWORD,  # VersOption : DWORD
    ctypes.c_void_p,  # ObjectUuidVec : UUID_VECTOR* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCNS4.dll')
RpcNsMgmtBindingUnexportW = Fiddle::Function.new(
  lib['RpcNsMgmtBindingUnexportW'],
  [
    -Fiddle::TYPE_INT,  # EntryNameSyntax : DWORD
    Fiddle::TYPE_VOIDP,  # EntryName : LPWSTR
    Fiddle::TYPE_VOIDP,  # IfId : RPC_IF_ID* optional
    -Fiddle::TYPE_INT,  # VersOption : DWORD
    Fiddle::TYPE_VOIDP,  # ObjectUuidVec : UUID_VECTOR* optional
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "rpcns4")]
extern "system" {
    fn RpcNsMgmtBindingUnexportW(
        EntryNameSyntax: u32,  // DWORD
        EntryName: *mut u16,  // LPWSTR
        IfId: *mut RPC_IF_ID,  // RPC_IF_ID* optional
        VersOption: u32,  // DWORD
        ObjectUuidVec: *mut UUID_VECTOR  // UUID_VECTOR* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCNS4.dll", CharSet = CharSet.Unicode)]
public static extern int RpcNsMgmtBindingUnexportW(uint EntryNameSyntax, [MarshalAs(UnmanagedType.LPWStr)] string EntryName, IntPtr IfId, uint VersOption, IntPtr ObjectUuidVec);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCNS4_RpcNsMgmtBindingUnexportW' -Namespace Win32 -PassThru
# $api::RpcNsMgmtBindingUnexportW(EntryNameSyntax, EntryName, IfId, VersOption, ObjectUuidVec)
#uselib "RPCNS4.dll"
#func global RpcNsMgmtBindingUnexportW "RpcNsMgmtBindingUnexportW" wptr, wptr, wptr, wptr, wptr
; RpcNsMgmtBindingUnexportW EntryNameSyntax, EntryName, varptr(IfId), VersOption, varptr(ObjectUuidVec)   ; 戻り値は stat
; EntryNameSyntax : DWORD -> "wptr"
; EntryName : LPWSTR -> "wptr"
; IfId : RPC_IF_ID* optional -> "wptr"
; VersOption : DWORD -> "wptr"
; ObjectUuidVec : UUID_VECTOR* optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "RPCNS4.dll"
#cfunc global RpcNsMgmtBindingUnexportW "RpcNsMgmtBindingUnexportW" int, wstr, var, int, var
; res = RpcNsMgmtBindingUnexportW(EntryNameSyntax, EntryName, IfId, VersOption, ObjectUuidVec)
; EntryNameSyntax : DWORD -> "int"
; EntryName : LPWSTR -> "wstr"
; IfId : RPC_IF_ID* optional -> "var"
; VersOption : DWORD -> "int"
; ObjectUuidVec : UUID_VECTOR* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; RPC_STATUS RpcNsMgmtBindingUnexportW(DWORD EntryNameSyntax, LPWSTR EntryName, RPC_IF_ID* IfId, DWORD VersOption, UUID_VECTOR* ObjectUuidVec)
#uselib "RPCNS4.dll"
#cfunc global RpcNsMgmtBindingUnexportW "RpcNsMgmtBindingUnexportW" int, wstr, var, int, var
; res = RpcNsMgmtBindingUnexportW(EntryNameSyntax, EntryName, IfId, VersOption, ObjectUuidVec)
; EntryNameSyntax : DWORD -> "int"
; EntryName : LPWSTR -> "wstr"
; IfId : RPC_IF_ID* optional -> "var"
; VersOption : DWORD -> "int"
; ObjectUuidVec : UUID_VECTOR* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcns4 = windows.NewLazySystemDLL("RPCNS4.dll")
	procRpcNsMgmtBindingUnexportW = rpcns4.NewProc("RpcNsMgmtBindingUnexportW")
)

// EntryNameSyntax (DWORD), EntryName (LPWSTR), IfId (RPC_IF_ID* optional), VersOption (DWORD), ObjectUuidVec (UUID_VECTOR* optional)
r1, _, err := procRpcNsMgmtBindingUnexportW.Call(
	uintptr(EntryNameSyntax),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(EntryName))),
	uintptr(IfId),
	uintptr(VersOption),
	uintptr(ObjectUuidVec),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // RPC_STATUS
function RpcNsMgmtBindingUnexportW(
  EntryNameSyntax: DWORD;   // DWORD
  EntryName: PWideChar;   // LPWSTR
  IfId: Pointer;   // RPC_IF_ID* optional
  VersOption: DWORD;   // DWORD
  ObjectUuidVec: Pointer   // UUID_VECTOR* optional
): Integer; stdcall;
  external 'RPCNS4.dll' name 'RpcNsMgmtBindingUnexportW';
result := DllCall("RPCNS4\RpcNsMgmtBindingUnexportW"
    , "UInt", EntryNameSyntax   ; DWORD
    , "WStr", EntryName   ; LPWSTR
    , "Ptr", IfId   ; RPC_IF_ID* optional
    , "UInt", VersOption   ; DWORD
    , "Ptr", ObjectUuidVec   ; UUID_VECTOR* optional
    , "Int")   ; return: RPC_STATUS
●RpcNsMgmtBindingUnexportW(EntryNameSyntax, EntryName, IfId, VersOption, ObjectUuidVec) = DLL("RPCNS4.dll", "int RpcNsMgmtBindingUnexportW(dword, char*, void*, dword, void*)")
# 呼び出し: RpcNsMgmtBindingUnexportW(EntryNameSyntax, EntryName, IfId, VersOption, ObjectUuidVec)
# EntryNameSyntax : DWORD -> "dword"
# EntryName : LPWSTR -> "char*"
# IfId : RPC_IF_ID* optional -> "void*"
# VersOption : DWORD -> "dword"
# ObjectUuidVec : UUID_VECTOR* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。
const std = @import("std");

extern "rpcns4" fn RpcNsMgmtBindingUnexportW(
    EntryNameSyntax: u32, // DWORD
    EntryName: [*c]const u16, // LPWSTR
    IfId: [*c]RPC_IF_ID, // RPC_IF_ID* optional
    VersOption: u32, // DWORD
    ObjectUuidVec: [*c]UUID_VECTOR // UUID_VECTOR* optional
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc RpcNsMgmtBindingUnexportW(
    EntryNameSyntax: uint32,  # DWORD
    EntryName: WideCString,  # LPWSTR
    IfId: ptr RPC_IF_ID,  # RPC_IF_ID* optional
    VersOption: uint32,  # DWORD
    ObjectUuidVec: ptr UUID_VECTOR  # UUID_VECTOR* optional
): int32 {.importc: "RpcNsMgmtBindingUnexportW", stdcall, dynlib: "RPCNS4.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "rpcns4");
extern(Windows)
int RpcNsMgmtBindingUnexportW(
    uint EntryNameSyntax,   // DWORD
    const(wchar)* EntryName,   // LPWSTR
    RPC_IF_ID* IfId,   // RPC_IF_ID* optional
    uint VersOption,   // DWORD
    UUID_VECTOR* ObjectUuidVec   // UUID_VECTOR* optional
);
ccall((:RpcNsMgmtBindingUnexportW, "RPCNS4.dll"), stdcall, Int32,
      (UInt32, Cwstring, Ptr{RPC_IF_ID}, UInt32, Ptr{UUID_VECTOR}),
      EntryNameSyntax, EntryName, IfId, VersOption, ObjectUuidVec)
# EntryNameSyntax : DWORD -> UInt32
# EntryName : LPWSTR -> Cwstring
# IfId : RPC_IF_ID* optional -> Ptr{RPC_IF_ID}
# VersOption : DWORD -> UInt32
# ObjectUuidVec : UUID_VECTOR* optional -> Ptr{UUID_VECTOR}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
int32_t RpcNsMgmtBindingUnexportW(
    uint32_t EntryNameSyntax,
    const uint16_t* EntryName,
    void* IfId,
    uint32_t VersOption,
    void* ObjectUuidVec);
]]
local rpcns4 = ffi.load("rpcns4")
-- rpcns4.RpcNsMgmtBindingUnexportW(EntryNameSyntax, EntryName, IfId, VersOption, ObjectUuidVec)
-- EntryNameSyntax : DWORD
-- EntryName : LPWSTR
-- IfId : RPC_IF_ID* optional
-- VersOption : DWORD
-- ObjectUuidVec : UUID_VECTOR* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。
const koffi = require('koffi');
const lib = koffi.load('RPCNS4.dll');
const RpcNsMgmtBindingUnexportW = lib.func('__stdcall', 'RpcNsMgmtBindingUnexportW', 'int32_t', ['uint32_t', 'str16', 'void *', 'uint32_t', 'void *']);
// RpcNsMgmtBindingUnexportW(EntryNameSyntax, EntryName, IfId, VersOption, ObjectUuidVec)
// EntryNameSyntax : DWORD -> 'uint32_t'
// EntryName : LPWSTR -> 'str16'
// IfId : RPC_IF_ID* optional -> 'void *'
// VersOption : DWORD -> 'uint32_t'
// ObjectUuidVec : UUID_VECTOR* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("RPCNS4.dll", {
  RpcNsMgmtBindingUnexportW: { parameters: ["u32", "buffer", "pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.RpcNsMgmtBindingUnexportW(EntryNameSyntax, EntryName, IfId, VersOption, ObjectUuidVec)
// EntryNameSyntax : DWORD -> "u32"
// EntryName : LPWSTR -> "buffer"
// IfId : RPC_IF_ID* optional -> "pointer"
// VersOption : DWORD -> "u32"
// ObjectUuidVec : UUID_VECTOR* optional -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t RpcNsMgmtBindingUnexportW(
    uint32_t EntryNameSyntax,
    const uint16_t* EntryName,
    void* IfId,
    uint32_t VersOption,
    void* ObjectUuidVec);
C, "RPCNS4.dll");
// $ffi->RpcNsMgmtBindingUnexportW(EntryNameSyntax, EntryName, IfId, VersOption, ObjectUuidVec);
// EntryNameSyntax : DWORD
// EntryName : LPWSTR
// IfId : RPC_IF_ID* optional
// VersOption : DWORD
// ObjectUuidVec : 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.UNICODE_OPTIONS);
    int RpcNsMgmtBindingUnexportW(
        int EntryNameSyntax,   // DWORD
        WString EntryName,   // LPWSTR
        Pointer IfId,   // RPC_IF_ID* optional
        int VersOption,   // DWORD
        Pointer ObjectUuidVec   // UUID_VECTOR* optional
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("rpcns4")]
lib LibRPCNS4
  fun RpcNsMgmtBindingUnexportW = RpcNsMgmtBindingUnexportW(
    EntryNameSyntax : UInt32,   # DWORD
    EntryName : UInt16*,   # LPWSTR
    IfId : RPC_IF_ID*,   # RPC_IF_ID* optional
    VersOption : UInt32,   # DWORD
    ObjectUuidVec : 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 RpcNsMgmtBindingUnexportWNative = Int32 Function(Uint32, Pointer<Utf16>, Pointer<Void>, Uint32, Pointer<Void>);
typedef RpcNsMgmtBindingUnexportWDart = int Function(int, Pointer<Utf16>, Pointer<Void>, int, Pointer<Void>);
final RpcNsMgmtBindingUnexportW = DynamicLibrary.open('RPCNS4.dll')
    .lookupFunction<RpcNsMgmtBindingUnexportWNative, RpcNsMgmtBindingUnexportWDart>('RpcNsMgmtBindingUnexportW');
// EntryNameSyntax : DWORD -> Uint32
// EntryName : LPWSTR -> Pointer<Utf16>
// IfId : RPC_IF_ID* optional -> Pointer<Void>
// VersOption : DWORD -> Uint32
// ObjectUuidVec : UUID_VECTOR* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function RpcNsMgmtBindingUnexportW(
  EntryNameSyntax: DWORD;   // DWORD
  EntryName: PWideChar;   // LPWSTR
  IfId: Pointer;   // RPC_IF_ID* optional
  VersOption: DWORD;   // DWORD
  ObjectUuidVec: Pointer   // UUID_VECTOR* optional
): Integer; stdcall;
  external 'RPCNS4.dll' name 'RpcNsMgmtBindingUnexportW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RpcNsMgmtBindingUnexportW"
  c_RpcNsMgmtBindingUnexportW :: Word32 -> CWString -> Ptr () -> Word32 -> Ptr () -> IO Int32
-- EntryNameSyntax : DWORD -> Word32
-- EntryName : LPWSTR -> CWString
-- IfId : RPC_IF_ID* optional -> Ptr ()
-- VersOption : DWORD -> Word32
-- ObjectUuidVec : UUID_VECTOR* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let rpcnsmgmtbindingunexportw =
  foreign "RpcNsMgmtBindingUnexportW"
    (uint32_t @-> (ptr uint16_t) @-> (ptr void) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* EntryNameSyntax : DWORD -> uint32_t *)
(* EntryName : LPWSTR -> (ptr uint16_t) *)
(* IfId : RPC_IF_ID* optional -> (ptr void) *)
(* VersOption : DWORD -> uint32_t *)
(* ObjectUuidVec : 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 ("RpcNsMgmtBindingUnexportW" rpc-ns-mgmt-binding-unexport-w :convention :stdcall) :int32
  (entry-name-syntax :uint32)   ; DWORD
  (entry-name (:string :encoding :utf-16le))   ; LPWSTR
  (if-id :pointer)   ; RPC_IF_ID* optional
  (vers-option :uint32)   ; DWORD
  (object-uuid-vec :pointer))   ; UUID_VECTOR* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RpcNsMgmtBindingUnexportW = Win32::API::More->new('RPCNS4',
    'int RpcNsMgmtBindingUnexportW(DWORD EntryNameSyntax, LPCWSTR EntryName, LPVOID IfId, DWORD VersOption, LPVOID ObjectUuidVec)');
# my $ret = $RpcNsMgmtBindingUnexportW->Call($EntryNameSyntax, $EntryName, $IfId, $VersOption, $ObjectUuidVec);
# EntryNameSyntax : DWORD -> DWORD
# EntryName : LPWSTR -> LPCWSTR
# IfId : RPC_IF_ID* optional -> LPVOID
# VersOption : DWORD -> DWORD
# ObjectUuidVec : UUID_VECTOR* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

文字セット違い
使用する型