ホーム › System.Rpc › RpcNsProfileEltRemoveW
RpcNsProfileEltRemoveW
関数ネームサービスのプロファイルから要素を削除する(Unicode版)。
シグネチャ
// RPCNS4.dll (Unicode / -W)
#include <windows.h>
RPC_STATUS RpcNsProfileEltRemoveW(
DWORD ProfileNameSyntax,
LPWSTR ProfileName,
RPC_IF_ID* IfId, // optional
DWORD MemberNameSyntax,
LPWSTR MemberName
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ProfileNameSyntax | DWORD | in | ProfileNameの名前構文を指定するDWORD。0で既定構文を使用する。 |
| ProfileName | LPWSTR | in | 要素を削除する対象プロファイルのエントリ名(Unicode文字列)。 |
| IfId | RPC_IF_ID* | inoptional | 削除する要素のインターフェイス識別子(RPC_IF_ID)へのポインタ。 |
| MemberNameSyntax | DWORD | in | MemberNameの名前構文を指定するDWORD。0で既定構文を使用する。 |
| MemberName | LPWSTR | in | 削除する要素が参照するメンバーのエントリ名(Unicode文字列)。 |
戻り値の型: 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 方式にも切替可。#uselib "RPCNS4.dll" #cfunc global RpcNsProfileEltRemoveW "RpcNsProfileEltRemoveW" int, wstr, sptr, int, wstr ; res = RpcNsProfileEltRemoveW(ProfileNameSyntax, ProfileName, varptr(IfId), MemberNameSyntax, MemberName) ; ProfileNameSyntax : DWORD -> "int" ; ProfileName : LPWSTR -> "wstr" ; IfId : RPC_IF_ID* optional -> "sptr" ; MemberNameSyntax : DWORD -> "int" ; MemberName : LPWSTR -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; RPC_STATUS RpcNsProfileEltRemoveW(DWORD ProfileNameSyntax, LPWSTR ProfileName, RPC_IF_ID* IfId, DWORD MemberNameSyntax, LPWSTR MemberName) #uselib "RPCNS4.dll" #cfunc global RpcNsProfileEltRemoveW "RpcNsProfileEltRemoveW" int, wstr, intptr, int, wstr ; res = RpcNsProfileEltRemoveW(ProfileNameSyntax, ProfileName, varptr(IfId), MemberNameSyntax, MemberName) ; ProfileNameSyntax : DWORD -> "int" ; ProfileName : LPWSTR -> "wstr" ; IfId : RPC_IF_ID* optional -> "intptr" ; MemberNameSyntax : DWORD -> "int" ; MemberName : LPWSTR -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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_STATUSfunction 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 版の利用を推奨。const std = @import("std");
extern "rpcns4" fn RpcNsProfileEltRemoveW(
ProfileNameSyntax: u32, // DWORD
ProfileName: [*c]const u16, // LPWSTR
IfId: [*c]RPC_IF_ID, // RPC_IF_ID* optional
MemberNameSyntax: u32, // DWORD
MemberName: [*c]const u16 // LPWSTR
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc RpcNsProfileEltRemoveW(
ProfileNameSyntax: uint32, # DWORD
ProfileName: WideCString, # LPWSTR
IfId: ptr RPC_IF_ID, # RPC_IF_ID* optional
MemberNameSyntax: uint32, # DWORD
MemberName: WideCString # LPWSTR
): int32 {.importc: "RpcNsProfileEltRemoveW", stdcall, dynlib: "RPCNS4.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "rpcns4");
extern(Windows)
int RpcNsProfileEltRemoveW(
uint ProfileNameSyntax, // DWORD
const(wchar)* ProfileName, // LPWSTR
RPC_IF_ID* IfId, // RPC_IF_ID* optional
uint MemberNameSyntax, // DWORD
const(wchar)* MemberName // LPWSTR
);ccall((:RpcNsProfileEltRemoveW, "RPCNS4.dll"), stdcall, Int32,
(UInt32, Cwstring, Ptr{RPC_IF_ID}, UInt32, Cwstring),
ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName)
# ProfileNameSyntax : DWORD -> UInt32
# ProfileName : LPWSTR -> Cwstring
# IfId : RPC_IF_ID* optional -> Ptr{RPC_IF_ID}
# MemberNameSyntax : DWORD -> UInt32
# MemberName : LPWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
int32_t RpcNsProfileEltRemoveW(
uint32_t ProfileNameSyntax,
const uint16_t* ProfileName,
void* IfId,
uint32_t MemberNameSyntax,
const uint16_t* MemberName);
]]
local rpcns4 = ffi.load("rpcns4")
-- rpcns4.RpcNsProfileEltRemoveW(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName)
-- ProfileNameSyntax : DWORD
-- ProfileName : LPWSTR
-- IfId : RPC_IF_ID* optional
-- MemberNameSyntax : DWORD
-- MemberName : LPWSTR
-- 構造体/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 RpcNsProfileEltRemoveW = lib.func('__stdcall', 'RpcNsProfileEltRemoveW', 'int32_t', ['uint32_t', 'str16', 'void *', 'uint32_t', 'str16']);
// RpcNsProfileEltRemoveW(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName)
// ProfileNameSyntax : DWORD -> 'uint32_t'
// ProfileName : LPWSTR -> 'str16'
// IfId : RPC_IF_ID* optional -> 'void *'
// MemberNameSyntax : DWORD -> 'uint32_t'
// MemberName : LPWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("RPCNS4.dll", {
RpcNsProfileEltRemoveW: { parameters: ["u32", "buffer", "pointer", "u32", "buffer"], result: "i32" },
});
// lib.symbols.RpcNsProfileEltRemoveW(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName)
// ProfileNameSyntax : DWORD -> "u32"
// ProfileName : LPWSTR -> "buffer"
// IfId : RPC_IF_ID* optional -> "pointer"
// MemberNameSyntax : DWORD -> "u32"
// MemberName : LPWSTR -> "buffer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t RpcNsProfileEltRemoveW(
uint32_t ProfileNameSyntax,
const uint16_t* ProfileName,
void* IfId,
uint32_t MemberNameSyntax,
const uint16_t* MemberName);
C, "RPCNS4.dll");
// $ffi->RpcNsProfileEltRemoveW(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName);
// ProfileNameSyntax : DWORD
// ProfileName : LPWSTR
// IfId : RPC_IF_ID* optional
// MemberNameSyntax : DWORD
// MemberName : LPWSTR
// 構造体/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 RpcNsProfileEltRemoveW(
int ProfileNameSyntax, // DWORD
WString ProfileName, // LPWSTR
Pointer IfId, // RPC_IF_ID* optional
int MemberNameSyntax, // DWORD
WString MemberName // LPWSTR
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("rpcns4")]
lib LibRPCNS4
fun RpcNsProfileEltRemoveW = RpcNsProfileEltRemoveW(
ProfileNameSyntax : UInt32, # DWORD
ProfileName : UInt16*, # LPWSTR
IfId : RPC_IF_ID*, # RPC_IF_ID* optional
MemberNameSyntax : UInt32, # DWORD
MemberName : UInt16* # LPWSTR
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RpcNsProfileEltRemoveWNative = Int32 Function(Uint32, Pointer<Utf16>, Pointer<Void>, Uint32, Pointer<Utf16>);
typedef RpcNsProfileEltRemoveWDart = int Function(int, Pointer<Utf16>, Pointer<Void>, int, Pointer<Utf16>);
final RpcNsProfileEltRemoveW = DynamicLibrary.open('RPCNS4.dll')
.lookupFunction<RpcNsProfileEltRemoveWNative, RpcNsProfileEltRemoveWDart>('RpcNsProfileEltRemoveW');
// ProfileNameSyntax : DWORD -> Uint32
// ProfileName : LPWSTR -> Pointer<Utf16>
// IfId : RPC_IF_ID* optional -> Pointer<Void>
// MemberNameSyntax : DWORD -> Uint32
// MemberName : LPWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
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';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RpcNsProfileEltRemoveW"
c_RpcNsProfileEltRemoveW :: Word32 -> CWString -> Ptr () -> Word32 -> CWString -> IO Int32
-- ProfileNameSyntax : DWORD -> Word32
-- ProfileName : LPWSTR -> CWString
-- IfId : RPC_IF_ID* optional -> Ptr ()
-- MemberNameSyntax : DWORD -> Word32
-- MemberName : LPWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let rpcnsprofileeltremovew =
foreign "RpcNsProfileEltRemoveW"
(uint32_t @-> (ptr uint16_t) @-> (ptr void) @-> uint32_t @-> (ptr uint16_t) @-> returning int32_t)
(* ProfileNameSyntax : DWORD -> uint32_t *)
(* ProfileName : LPWSTR -> (ptr uint16_t) *)
(* IfId : RPC_IF_ID* optional -> (ptr void) *)
(* MemberNameSyntax : DWORD -> uint32_t *)
(* MemberName : LPWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library rpcns4 (t "RPCNS4.dll"))
(cffi:use-foreign-library rpcns4)
(cffi:defcfun ("RpcNsProfileEltRemoveW" rpc-ns-profile-elt-remove-w :convention :stdcall) :int32
(profile-name-syntax :uint32) ; DWORD
(profile-name (:string :encoding :utf-16le)) ; LPWSTR
(if-id :pointer) ; RPC_IF_ID* optional
(member-name-syntax :uint32) ; DWORD
(member-name (:string :encoding :utf-16le))) ; LPWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RpcNsProfileEltRemoveW = Win32::API::More->new('RPCNS4',
'int RpcNsProfileEltRemoveW(DWORD ProfileNameSyntax, LPCWSTR ProfileName, LPVOID IfId, DWORD MemberNameSyntax, LPCWSTR MemberName)');
# my $ret = $RpcNsProfileEltRemoveW->Call($ProfileNameSyntax, $ProfileName, $IfId, $MemberNameSyntax, $MemberName);
# ProfileNameSyntax : DWORD -> DWORD
# ProfileName : LPWSTR -> LPCWSTR
# IfId : RPC_IF_ID* optional -> LPVOID
# MemberNameSyntax : DWORD -> DWORD
# MemberName : LPWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
文字セット違い
- f RpcNsProfileEltRemoveA (ANSI版) — ネームサービスのプロファイルから要素を削除する(ANSI版)。