Win32 API 日本語リファレンス
ホームNetworkManagement.NetManagement › NetLocalGroupDel

NetLocalGroupDel

関数
サーバーからローカルグループを削除する。
DLLNETAPI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// NETAPI32.dll
#include <windows.h>

DWORD NetLocalGroupDel(
    LPCWSTR servername,   // optional
    LPCWSTR groupname
);

パラメーター

名前方向
servernameLPCWSTRinoptional
groupnameLPCWSTRin

戻り値の型: DWORD

各言語での呼び出し定義

// NETAPI32.dll
#include <windows.h>

DWORD NetLocalGroupDel(
    LPCWSTR servername,   // optional
    LPCWSTR groupname
);
[DllImport("NETAPI32.dll", ExactSpelling = true)]
static extern uint NetLocalGroupDel(
    [MarshalAs(UnmanagedType.LPWStr)] string servername,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string groupname   // LPCWSTR
);
<DllImport("NETAPI32.dll", ExactSpelling:=True)>
Public Shared Function NetLocalGroupDel(
    <MarshalAs(UnmanagedType.LPWStr)> servername As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> groupname As String   ' LPCWSTR
) As UInteger
End Function
' servername : LPCWSTR optional
' groupname : LPCWSTR
Declare PtrSafe Function NetLocalGroupDel Lib "netapi32" ( _
    ByVal servername As LongPtr, _
    ByVal groupname As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

NetLocalGroupDel = ctypes.windll.netapi32.NetLocalGroupDel
NetLocalGroupDel.restype = wintypes.DWORD
NetLocalGroupDel.argtypes = [
    wintypes.LPCWSTR,  # servername : LPCWSTR optional
    wintypes.LPCWSTR,  # groupname : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('NETAPI32.dll')
NetLocalGroupDel = Fiddle::Function.new(
  lib['NetLocalGroupDel'],
  [
    Fiddle::TYPE_VOIDP,  # servername : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # groupname : LPCWSTR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "netapi32")]
extern "system" {
    fn NetLocalGroupDel(
        servername: *const u16,  // LPCWSTR optional
        groupname: *const u16  // LPCWSTR
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("NETAPI32.dll")]
public static extern uint NetLocalGroupDel([MarshalAs(UnmanagedType.LPWStr)] string servername, [MarshalAs(UnmanagedType.LPWStr)] string groupname);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NETAPI32_NetLocalGroupDel' -Namespace Win32 -PassThru
# $api::NetLocalGroupDel(servername, groupname)
#uselib "NETAPI32.dll"
#func global NetLocalGroupDel "NetLocalGroupDel" sptr, sptr
; NetLocalGroupDel servername, groupname   ; 戻り値は stat
; servername : LPCWSTR optional -> "sptr"
; groupname : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "NETAPI32.dll"
#cfunc global NetLocalGroupDel "NetLocalGroupDel" wstr, wstr
; res = NetLocalGroupDel(servername, groupname)
; servername : LPCWSTR optional -> "wstr"
; groupname : LPCWSTR -> "wstr"
; DWORD NetLocalGroupDel(LPCWSTR servername, LPCWSTR groupname)
#uselib "NETAPI32.dll"
#cfunc global NetLocalGroupDel "NetLocalGroupDel" wstr, wstr
; res = NetLocalGroupDel(servername, groupname)
; servername : LPCWSTR optional -> "wstr"
; groupname : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	netapi32 = windows.NewLazySystemDLL("NETAPI32.dll")
	procNetLocalGroupDel = netapi32.NewProc("NetLocalGroupDel")
)

// servername (LPCWSTR optional), groupname (LPCWSTR)
r1, _, err := procNetLocalGroupDel.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(servername))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(groupname))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function NetLocalGroupDel(
  servername: PWideChar;   // LPCWSTR optional
  groupname: PWideChar   // LPCWSTR
): DWORD; stdcall;
  external 'NETAPI32.dll' name 'NetLocalGroupDel';
result := DllCall("NETAPI32\NetLocalGroupDel"
    , "WStr", servername   ; LPCWSTR optional
    , "WStr", groupname   ; LPCWSTR
    , "UInt")   ; return: DWORD
●NetLocalGroupDel(servername, groupname) = DLL("NETAPI32.dll", "dword NetLocalGroupDel(char*, char*)")
# 呼び出し: NetLocalGroupDel(servername, groupname)
# servername : LPCWSTR optional -> "char*"
# groupname : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。