ホーム › NetworkManagement.Dhcp › DhcpAddSecurityGroup
DhcpAddSecurityGroup
関数DHCP管理用のユーザーおよび管理者セキュリティグループを作成する。
シグネチャ
// DHCPSAPI.dll
#include <windows.h>
DWORD DhcpAddSecurityGroup(
LPWSTR pServer // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pServer | LPWSTR | inoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// DHCPSAPI.dll
#include <windows.h>
DWORD DhcpAddSecurityGroup(
LPWSTR pServer // optional
);[DllImport("DHCPSAPI.dll", ExactSpelling = true)]
static extern uint DhcpAddSecurityGroup(
[MarshalAs(UnmanagedType.LPWStr)] string pServer // LPWSTR optional
);<DllImport("DHCPSAPI.dll", ExactSpelling:=True)>
Public Shared Function DhcpAddSecurityGroup(
<MarshalAs(UnmanagedType.LPWStr)> pServer As String ' LPWSTR optional
) As UInteger
End Function' pServer : LPWSTR optional
Declare PtrSafe Function DhcpAddSecurityGroup Lib "dhcpsapi" ( _
ByVal pServer As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DhcpAddSecurityGroup = ctypes.windll.dhcpsapi.DhcpAddSecurityGroup
DhcpAddSecurityGroup.restype = wintypes.DWORD
DhcpAddSecurityGroup.argtypes = [
wintypes.LPCWSTR, # pServer : LPWSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('DHCPSAPI.dll')
DhcpAddSecurityGroup = Fiddle::Function.new(
lib['DhcpAddSecurityGroup'],
[
Fiddle::TYPE_VOIDP, # pServer : LPWSTR optional
],
-Fiddle::TYPE_INT)#[link(name = "dhcpsapi")]
extern "system" {
fn DhcpAddSecurityGroup(
pServer: *mut u16 // LPWSTR optional
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("DHCPSAPI.dll")]
public static extern uint DhcpAddSecurityGroup([MarshalAs(UnmanagedType.LPWStr)] string pServer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DHCPSAPI_DhcpAddSecurityGroup' -Namespace Win32 -PassThru
# $api::DhcpAddSecurityGroup(pServer)#uselib "DHCPSAPI.dll"
#func global DhcpAddSecurityGroup "DhcpAddSecurityGroup" sptr
; DhcpAddSecurityGroup pServer ; 戻り値は stat
; pServer : LPWSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "DHCPSAPI.dll"
#cfunc global DhcpAddSecurityGroup "DhcpAddSecurityGroup" wstr
; res = DhcpAddSecurityGroup(pServer)
; pServer : LPWSTR optional -> "wstr"; DWORD DhcpAddSecurityGroup(LPWSTR pServer)
#uselib "DHCPSAPI.dll"
#cfunc global DhcpAddSecurityGroup "DhcpAddSecurityGroup" wstr
; res = DhcpAddSecurityGroup(pServer)
; pServer : LPWSTR optional -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dhcpsapi = windows.NewLazySystemDLL("DHCPSAPI.dll")
procDhcpAddSecurityGroup = dhcpsapi.NewProc("DhcpAddSecurityGroup")
)
// pServer (LPWSTR optional)
r1, _, err := procDhcpAddSecurityGroup.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pServer))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction DhcpAddSecurityGroup(
pServer: PWideChar // LPWSTR optional
): DWORD; stdcall;
external 'DHCPSAPI.dll' name 'DhcpAddSecurityGroup';result := DllCall("DHCPSAPI\DhcpAddSecurityGroup"
, "WStr", pServer ; LPWSTR optional
, "UInt") ; return: DWORD●DhcpAddSecurityGroup(pServer) = DLL("DHCPSAPI.dll", "dword DhcpAddSecurityGroup(char*)")
# 呼び出し: DhcpAddSecurityGroup(pServer)
# pServer : LPWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。