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

RpcNsGroupDeleteW

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

シグネチャ

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

RPC_STATUS RpcNsGroupDeleteW(
    GROUP_NAME_SYNTAX GroupNameSyntax,
    LPWSTR GroupName   // optional
);

パラメーター

名前方向
GroupNameSyntaxGROUP_NAME_SYNTAXin
GroupNameLPWSTRinoptional

戻り値の型: RPC_STATUS

各言語での呼び出し定義

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

RPC_STATUS RpcNsGroupDeleteW(
    GROUP_NAME_SYNTAX GroupNameSyntax,
    LPWSTR GroupName   // optional
);
[DllImport("RPCNS4.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RpcNsGroupDeleteW(
    uint GroupNameSyntax,   // GROUP_NAME_SYNTAX
    [MarshalAs(UnmanagedType.LPWStr)] string GroupName   // LPWSTR optional
);
<DllImport("RPCNS4.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RpcNsGroupDeleteW(
    GroupNameSyntax As UInteger,   ' GROUP_NAME_SYNTAX
    <MarshalAs(UnmanagedType.LPWStr)> GroupName As String   ' LPWSTR optional
) As Integer
End Function
' GroupNameSyntax : GROUP_NAME_SYNTAX
' GroupName : LPWSTR optional
Declare PtrSafe Function RpcNsGroupDeleteW Lib "rpcns4" ( _
    ByVal GroupNameSyntax As Long, _
    ByVal GroupName 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

RpcNsGroupDeleteW = ctypes.windll.rpcns4.RpcNsGroupDeleteW
RpcNsGroupDeleteW.restype = ctypes.c_int
RpcNsGroupDeleteW.argtypes = [
    wintypes.DWORD,  # GroupNameSyntax : GROUP_NAME_SYNTAX
    wintypes.LPCWSTR,  # GroupName : LPWSTR optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCNS4.dll')
RpcNsGroupDeleteW = Fiddle::Function.new(
  lib['RpcNsGroupDeleteW'],
  [
    -Fiddle::TYPE_INT,  # GroupNameSyntax : GROUP_NAME_SYNTAX
    Fiddle::TYPE_VOIDP,  # GroupName : LPWSTR optional
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "rpcns4")]
extern "system" {
    fn RpcNsGroupDeleteW(
        GroupNameSyntax: u32,  // GROUP_NAME_SYNTAX
        GroupName: *mut u16  // LPWSTR optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCNS4.dll", CharSet = CharSet.Unicode)]
public static extern int RpcNsGroupDeleteW(uint GroupNameSyntax, [MarshalAs(UnmanagedType.LPWStr)] string GroupName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCNS4_RpcNsGroupDeleteW' -Namespace Win32 -PassThru
# $api::RpcNsGroupDeleteW(GroupNameSyntax, GroupName)
#uselib "RPCNS4.dll"
#func global RpcNsGroupDeleteW "RpcNsGroupDeleteW" wptr, wptr
; RpcNsGroupDeleteW GroupNameSyntax, GroupName   ; 戻り値は stat
; GroupNameSyntax : GROUP_NAME_SYNTAX -> "wptr"
; GroupName : LPWSTR optional -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "RPCNS4.dll"
#cfunc global RpcNsGroupDeleteW "RpcNsGroupDeleteW" int, wstr
; res = RpcNsGroupDeleteW(GroupNameSyntax, GroupName)
; GroupNameSyntax : GROUP_NAME_SYNTAX -> "int"
; GroupName : LPWSTR optional -> "wstr"
; RPC_STATUS RpcNsGroupDeleteW(GROUP_NAME_SYNTAX GroupNameSyntax, LPWSTR GroupName)
#uselib "RPCNS4.dll"
#cfunc global RpcNsGroupDeleteW "RpcNsGroupDeleteW" int, wstr
; res = RpcNsGroupDeleteW(GroupNameSyntax, GroupName)
; GroupNameSyntax : GROUP_NAME_SYNTAX -> "int"
; GroupName : LPWSTR optional -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcns4 = windows.NewLazySystemDLL("RPCNS4.dll")
	procRpcNsGroupDeleteW = rpcns4.NewProc("RpcNsGroupDeleteW")
)

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