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

RpcNsProfileEltRemoveA

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

シグネチャ

// RPCNS4.dll  (ANSI / -A)
#include <windows.h>

RPC_STATUS RpcNsProfileEltRemoveA(
    DWORD ProfileNameSyntax,
    LPSTR ProfileName,
    RPC_IF_ID* IfId,   // optional
    DWORD MemberNameSyntax,
    LPSTR MemberName
);

パラメーター

名前方向説明
ProfileNameSyntaxDWORDinProfileNameの名前構文を指定するDWORD。0で既定構文を使用する。
ProfileNameLPSTRin要素を削除する対象プロファイルのエントリ名(ANSI文字列)。
IfIdRPC_IF_ID*inoptional削除する要素のインターフェイス識別子(RPC_IF_ID)へのポインタ。
MemberNameSyntaxDWORDinMemberNameの名前構文を指定するDWORD。0で既定構文を使用する。
MemberNameLPSTRin削除する要素が参照するメンバーのエントリ名(ANSI文字列)。

戻り値の型: RPC_STATUS

各言語での呼び出し定義

// RPCNS4.dll  (ANSI / -A)
#include <windows.h>

RPC_STATUS RpcNsProfileEltRemoveA(
    DWORD ProfileNameSyntax,
    LPSTR ProfileName,
    RPC_IF_ID* IfId,   // optional
    DWORD MemberNameSyntax,
    LPSTR MemberName
);
[DllImport("RPCNS4.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int RpcNsProfileEltRemoveA(
    uint ProfileNameSyntax,   // DWORD
    [MarshalAs(UnmanagedType.LPStr)] string ProfileName,   // LPSTR
    IntPtr IfId,   // RPC_IF_ID* optional
    uint MemberNameSyntax,   // DWORD
    [MarshalAs(UnmanagedType.LPStr)] string MemberName   // LPSTR
);
<DllImport("RPCNS4.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function RpcNsProfileEltRemoveA(
    ProfileNameSyntax As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPStr)> ProfileName As String,   ' LPSTR
    IfId As IntPtr,   ' RPC_IF_ID* optional
    MemberNameSyntax As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPStr)> MemberName As String   ' LPSTR
) As Integer
End Function
' ProfileNameSyntax : DWORD
' ProfileName : LPSTR
' IfId : RPC_IF_ID* optional
' MemberNameSyntax : DWORD
' MemberName : LPSTR
Declare PtrSafe Function RpcNsProfileEltRemoveA Lib "rpcns4" ( _
    ByVal ProfileNameSyntax As Long, _
    ByVal ProfileName As String, _
    ByVal IfId As LongPtr, _
    ByVal MemberNameSyntax As Long, _
    ByVal MemberName As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

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

var (
	rpcns4 = windows.NewLazySystemDLL("RPCNS4.dll")
	procRpcNsProfileEltRemoveA = rpcns4.NewProc("RpcNsProfileEltRemoveA")
)

// ProfileNameSyntax (DWORD), ProfileName (LPSTR), IfId (RPC_IF_ID* optional), MemberNameSyntax (DWORD), MemberName (LPSTR)
r1, _, err := procRpcNsProfileEltRemoveA.Call(
	uintptr(ProfileNameSyntax),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(ProfileName))),
	uintptr(IfId),
	uintptr(MemberNameSyntax),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(MemberName))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // RPC_STATUS
function RpcNsProfileEltRemoveA(
  ProfileNameSyntax: DWORD;   // DWORD
  ProfileName: PAnsiChar;   // LPSTR
  IfId: Pointer;   // RPC_IF_ID* optional
  MemberNameSyntax: DWORD;   // DWORD
  MemberName: PAnsiChar   // LPSTR
): Integer; stdcall;
  external 'RPCNS4.dll' name 'RpcNsProfileEltRemoveA';
result := DllCall("RPCNS4\RpcNsProfileEltRemoveA"
    , "UInt", ProfileNameSyntax   ; DWORD
    , "AStr", ProfileName   ; LPSTR
    , "Ptr", IfId   ; RPC_IF_ID* optional
    , "UInt", MemberNameSyntax   ; DWORD
    , "AStr", MemberName   ; LPSTR
    , "Int")   ; return: RPC_STATUS
●RpcNsProfileEltRemoveA(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName) = DLL("RPCNS4.dll", "int RpcNsProfileEltRemoveA(dword, char*, void*, dword, char*)")
# 呼び出し: RpcNsProfileEltRemoveA(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName)
# ProfileNameSyntax : DWORD -> "dword"
# ProfileName : LPSTR -> "char*"
# IfId : RPC_IF_ID* optional -> "void*"
# MemberNameSyntax : DWORD -> "dword"
# MemberName : LPSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "rpcns4" fn RpcNsProfileEltRemoveA(
    ProfileNameSyntax: u32, // DWORD
    ProfileName: [*c]const u8, // LPSTR
    IfId: [*c]RPC_IF_ID, // RPC_IF_ID* optional
    MemberNameSyntax: u32, // DWORD
    MemberName: [*c]const u8 // LPSTR
) callconv(std.os.windows.WINAPI) i32;
proc RpcNsProfileEltRemoveA(
    ProfileNameSyntax: uint32,  # DWORD
    ProfileName: cstring,  # LPSTR
    IfId: ptr RPC_IF_ID,  # RPC_IF_ID* optional
    MemberNameSyntax: uint32,  # DWORD
    MemberName: cstring  # LPSTR
): int32 {.importc: "RpcNsProfileEltRemoveA", stdcall, dynlib: "RPCNS4.dll".}
pragma(lib, "rpcns4");
extern(Windows)
int RpcNsProfileEltRemoveA(
    uint ProfileNameSyntax,   // DWORD
    const(char)* ProfileName,   // LPSTR
    RPC_IF_ID* IfId,   // RPC_IF_ID* optional
    uint MemberNameSyntax,   // DWORD
    const(char)* MemberName   // LPSTR
);
ccall((:RpcNsProfileEltRemoveA, "RPCNS4.dll"), stdcall, Int32,
      (UInt32, Cstring, Ptr{RPC_IF_ID}, UInt32, Cstring),
      ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName)
# ProfileNameSyntax : DWORD -> UInt32
# ProfileName : LPSTR -> Cstring
# IfId : RPC_IF_ID* optional -> Ptr{RPC_IF_ID}
# MemberNameSyntax : DWORD -> UInt32
# MemberName : LPSTR -> Cstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t RpcNsProfileEltRemoveA(
    uint32_t ProfileNameSyntax,
    const char* ProfileName,
    void* IfId,
    uint32_t MemberNameSyntax,
    const char* MemberName);
]]
local rpcns4 = ffi.load("rpcns4")
-- rpcns4.RpcNsProfileEltRemoveA(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName)
-- ProfileNameSyntax : DWORD
-- ProfileName : LPSTR
-- IfId : RPC_IF_ID* optional
-- MemberNameSyntax : DWORD
-- MemberName : LPSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('RPCNS4.dll');
const RpcNsProfileEltRemoveA = lib.func('__stdcall', 'RpcNsProfileEltRemoveA', 'int32_t', ['uint32_t', 'str', 'void *', 'uint32_t', 'str']);
// RpcNsProfileEltRemoveA(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName)
// ProfileNameSyntax : DWORD -> 'uint32_t'
// ProfileName : LPSTR -> 'str'
// IfId : RPC_IF_ID* optional -> 'void *'
// MemberNameSyntax : DWORD -> 'uint32_t'
// MemberName : LPSTR -> 'str'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("RPCNS4.dll", {
  RpcNsProfileEltRemoveA: { parameters: ["u32", "buffer", "pointer", "u32", "buffer"], result: "i32" },
});
// lib.symbols.RpcNsProfileEltRemoveA(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName)
// ProfileNameSyntax : DWORD -> "u32"
// ProfileName : LPSTR -> "buffer"
// IfId : RPC_IF_ID* optional -> "pointer"
// MemberNameSyntax : DWORD -> "u32"
// MemberName : LPSTR -> "buffer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t RpcNsProfileEltRemoveA(
    uint32_t ProfileNameSyntax,
    const char* ProfileName,
    void* IfId,
    uint32_t MemberNameSyntax,
    const char* MemberName);
C, "RPCNS4.dll");
// $ffi->RpcNsProfileEltRemoveA(ProfileNameSyntax, ProfileName, IfId, MemberNameSyntax, MemberName);
// ProfileNameSyntax : DWORD
// ProfileName : LPSTR
// IfId : RPC_IF_ID* optional
// MemberNameSyntax : DWORD
// MemberName : LPSTR
// 構造体/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 RpcNsProfileEltRemoveA(
        int ProfileNameSyntax,   // DWORD
        String ProfileName,   // LPSTR
        Pointer IfId,   // RPC_IF_ID* optional
        int MemberNameSyntax,   // DWORD
        String MemberName   // LPSTR
    );
}
@[Link("rpcns4")]
lib LibRPCNS4
  fun RpcNsProfileEltRemoveA = RpcNsProfileEltRemoveA(
    ProfileNameSyntax : UInt32,   # DWORD
    ProfileName : UInt8*,   # LPSTR
    IfId : RPC_IF_ID*,   # RPC_IF_ID* optional
    MemberNameSyntax : UInt32,   # DWORD
    MemberName : UInt8*   # LPSTR
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef RpcNsProfileEltRemoveANative = Int32 Function(Uint32, Pointer<Utf8>, Pointer<Void>, Uint32, Pointer<Utf8>);
typedef RpcNsProfileEltRemoveADart = int Function(int, Pointer<Utf8>, Pointer<Void>, int, Pointer<Utf8>);
final RpcNsProfileEltRemoveA = DynamicLibrary.open('RPCNS4.dll')
    .lookupFunction<RpcNsProfileEltRemoveANative, RpcNsProfileEltRemoveADart>('RpcNsProfileEltRemoveA');
// ProfileNameSyntax : DWORD -> Uint32
// ProfileName : LPSTR -> Pointer<Utf8>
// IfId : RPC_IF_ID* optional -> Pointer<Void>
// MemberNameSyntax : DWORD -> Uint32
// MemberName : LPSTR -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function RpcNsProfileEltRemoveA(
  ProfileNameSyntax: DWORD;   // DWORD
  ProfileName: PAnsiChar;   // LPSTR
  IfId: Pointer;   // RPC_IF_ID* optional
  MemberNameSyntax: DWORD;   // DWORD
  MemberName: PAnsiChar   // LPSTR
): Integer; stdcall;
  external 'RPCNS4.dll' name 'RpcNsProfileEltRemoveA';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RpcNsProfileEltRemoveA"
  c_RpcNsProfileEltRemoveA :: Word32 -> CString -> Ptr () -> Word32 -> CString -> IO Int32
-- ProfileNameSyntax : DWORD -> Word32
-- ProfileName : LPSTR -> CString
-- IfId : RPC_IF_ID* optional -> Ptr ()
-- MemberNameSyntax : DWORD -> Word32
-- MemberName : LPSTR -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let rpcnsprofileeltremovea =
  foreign "RpcNsProfileEltRemoveA"
    (uint32_t @-> string @-> (ptr void) @-> uint32_t @-> string @-> returning int32_t)
(* ProfileNameSyntax : DWORD -> uint32_t *)
(* ProfileName : LPSTR -> string *)
(* IfId : RPC_IF_ID* optional -> (ptr void) *)
(* MemberNameSyntax : DWORD -> uint32_t *)
(* MemberName : LPSTR -> string *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library rpcns4 (t "RPCNS4.dll"))
(cffi:use-foreign-library rpcns4)

(cffi:defcfun ("RpcNsProfileEltRemoveA" rpc-ns-profile-elt-remove-a :convention :stdcall) :int32
  (profile-name-syntax :uint32)   ; DWORD
  (profile-name :string)   ; LPSTR
  (if-id :pointer)   ; RPC_IF_ID* optional
  (member-name-syntax :uint32)   ; DWORD
  (member-name :string))   ; LPSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RpcNsProfileEltRemoveA = Win32::API::More->new('RPCNS4',
    'int RpcNsProfileEltRemoveA(DWORD ProfileNameSyntax, LPCSTR ProfileName, LPVOID IfId, DWORD MemberNameSyntax, LPCSTR MemberName)');
# my $ret = $RpcNsProfileEltRemoveA->Call($ProfileNameSyntax, $ProfileName, $IfId, $MemberNameSyntax, $MemberName);
# ProfileNameSyntax : DWORD -> DWORD
# ProfileName : LPSTR -> LPCSTR
# IfId : RPC_IF_ID* optional -> LPVOID
# MemberNameSyntax : DWORD -> DWORD
# MemberName : LPSTR -> LPCSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

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