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

RpcNsProfileDeleteA

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

シグネチャ

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

RPC_STATUS RpcNsProfileDeleteA(
    DWORD ProfileNameSyntax,
    LPSTR ProfileName
);

パラメーター

名前方向
ProfileNameSyntaxDWORDin
ProfileNameLPSTRin

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

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

RpcNsProfileDeleteA = ctypes.windll.rpcns4.RpcNsProfileDeleteA
RpcNsProfileDeleteA.restype = ctypes.c_int
RpcNsProfileDeleteA.argtypes = [
    wintypes.DWORD,  # ProfileNameSyntax : DWORD
    wintypes.LPCSTR,  # ProfileName : LPSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCNS4.dll')
RpcNsProfileDeleteA = Fiddle::Function.new(
  lib['RpcNsProfileDeleteA'],
  [
    -Fiddle::TYPE_INT,  # ProfileNameSyntax : DWORD
    Fiddle::TYPE_VOIDP,  # ProfileName : LPSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "rpcns4")]
extern "system" {
    fn RpcNsProfileDeleteA(
        ProfileNameSyntax: u32,  // DWORD
        ProfileName: *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 RpcNsProfileDeleteA(uint ProfileNameSyntax, [MarshalAs(UnmanagedType.LPStr)] string ProfileName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCNS4_RpcNsProfileDeleteA' -Namespace Win32 -PassThru
# $api::RpcNsProfileDeleteA(ProfileNameSyntax, ProfileName)
#uselib "RPCNS4.dll"
#func global RpcNsProfileDeleteA "RpcNsProfileDeleteA" sptr, sptr
; RpcNsProfileDeleteA ProfileNameSyntax, ProfileName   ; 戻り値は stat
; ProfileNameSyntax : DWORD -> "sptr"
; ProfileName : LPSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "RPCNS4.dll"
#cfunc global RpcNsProfileDeleteA "RpcNsProfileDeleteA" int, str
; res = RpcNsProfileDeleteA(ProfileNameSyntax, ProfileName)
; ProfileNameSyntax : DWORD -> "int"
; ProfileName : LPSTR -> "str"
; RPC_STATUS RpcNsProfileDeleteA(DWORD ProfileNameSyntax, LPSTR ProfileName)
#uselib "RPCNS4.dll"
#cfunc global RpcNsProfileDeleteA "RpcNsProfileDeleteA" int, str
; res = RpcNsProfileDeleteA(ProfileNameSyntax, ProfileName)
; ProfileNameSyntax : DWORD -> "int"
; ProfileName : LPSTR -> "str"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcns4 = windows.NewLazySystemDLL("RPCNS4.dll")
	procRpcNsProfileDeleteA = rpcns4.NewProc("RpcNsProfileDeleteA")
)

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