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

RpcNsProfileEltRemoveW

関数
ネームサービスのプロファイルから要素を削除する(Unicode版)。
DLLRPCNS4.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

RPC_STATUS RpcNsProfileEltRemoveW(
    DWORD ProfileNameSyntax,
    LPWSTR ProfileName,
    RPC_IF_ID* IfId,   // optional
    DWORD MemberNameSyntax,
    LPWSTR MemberName
);

パラメーター

名前方向
ProfileNameSyntaxDWORDin
ProfileNameLPWSTRin
IfIdRPC_IF_ID*inoptional
MemberNameSyntaxDWORDin
MemberNameLPWSTRin

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

RPC_STATUS RpcNsProfileEltRemoveW(
    DWORD ProfileNameSyntax,
    LPWSTR ProfileName,
    RPC_IF_ID* IfId,   // optional
    DWORD MemberNameSyntax,
    LPWSTR MemberName
);
[DllImport("RPCNS4.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RpcNsProfileEltRemoveW(
    uint ProfileNameSyntax,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string ProfileName,   // LPWSTR
    IntPtr IfId,   // RPC_IF_ID* optional
    uint MemberNameSyntax,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string MemberName   // LPWSTR
);
<DllImport("RPCNS4.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RpcNsProfileEltRemoveW(
    ProfileNameSyntax As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> ProfileName As String,   ' LPWSTR
    IfId As IntPtr,   ' RPC_IF_ID* optional
    MemberNameSyntax As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> MemberName As String   ' LPWSTR
) As Integer
End Function
' ProfileNameSyntax : DWORD
' ProfileName : LPWSTR
' IfId : RPC_IF_ID* optional
' MemberNameSyntax : DWORD
' MemberName : LPWSTR
Declare PtrSafe Function RpcNsProfileEltRemoveW Lib "rpcns4" ( _
    ByVal ProfileNameSyntax As Long, _
    ByVal ProfileName As LongPtr, _
    ByVal IfId As LongPtr, _
    ByVal MemberNameSyntax As Long, _
    ByVal MemberName 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

RpcNsProfileEltRemoveW = ctypes.windll.rpcns4.RpcNsProfileEltRemoveW
RpcNsProfileEltRemoveW.restype = ctypes.c_int
RpcNsProfileEltRemoveW.argtypes = [
    wintypes.DWORD,  # ProfileNameSyntax : DWORD
    wintypes.LPCWSTR,  # ProfileName : LPWSTR
    ctypes.c_void_p,  # IfId : RPC_IF_ID* optional
    wintypes.DWORD,  # MemberNameSyntax : DWORD
    wintypes.LPCWSTR,  # MemberName : LPWSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rpcns4 = windows.NewLazySystemDLL("RPCNS4.dll")
	procRpcNsProfileEltRemoveW = rpcns4.NewProc("RpcNsProfileEltRemoveW")
)

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