ホーム › NetworkManagement.Dhcp › DhcpSetServerBindingInfoV6
DhcpSetServerBindingInfoV6
関数DHCPサーバーのIPv6エンドポイントのバインド情報を設定する。
シグネチャ
// DHCPSAPI.dll
#include <windows.h>
DWORD DhcpSetServerBindingInfoV6(
LPCWSTR ServerIpAddress, // optional
DWORD Flags,
DHCPV6_BIND_ELEMENT_ARRAY* BindElementInfo
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ServerIpAddress | LPCWSTR | inoptional |
| Flags | DWORD | in |
| BindElementInfo | DHCPV6_BIND_ELEMENT_ARRAY* | inout |
戻り値の型: DWORD
各言語での呼び出し定義
// DHCPSAPI.dll
#include <windows.h>
DWORD DhcpSetServerBindingInfoV6(
LPCWSTR ServerIpAddress, // optional
DWORD Flags,
DHCPV6_BIND_ELEMENT_ARRAY* BindElementInfo
);[DllImport("DHCPSAPI.dll", ExactSpelling = true)]
static extern uint DhcpSetServerBindingInfoV6(
[MarshalAs(UnmanagedType.LPWStr)] string ServerIpAddress, // LPCWSTR optional
uint Flags, // DWORD
IntPtr BindElementInfo // DHCPV6_BIND_ELEMENT_ARRAY* in/out
);<DllImport("DHCPSAPI.dll", ExactSpelling:=True)>
Public Shared Function DhcpSetServerBindingInfoV6(
<MarshalAs(UnmanagedType.LPWStr)> ServerIpAddress As String, ' LPCWSTR optional
Flags As UInteger, ' DWORD
BindElementInfo As IntPtr ' DHCPV6_BIND_ELEMENT_ARRAY* in/out
) As UInteger
End Function' ServerIpAddress : LPCWSTR optional
' Flags : DWORD
' BindElementInfo : DHCPV6_BIND_ELEMENT_ARRAY* in/out
Declare PtrSafe Function DhcpSetServerBindingInfoV6 Lib "dhcpsapi" ( _
ByVal ServerIpAddress As LongPtr, _
ByVal Flags As Long, _
ByVal BindElementInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DhcpSetServerBindingInfoV6 = ctypes.windll.dhcpsapi.DhcpSetServerBindingInfoV6
DhcpSetServerBindingInfoV6.restype = wintypes.DWORD
DhcpSetServerBindingInfoV6.argtypes = [
wintypes.LPCWSTR, # ServerIpAddress : LPCWSTR optional
wintypes.DWORD, # Flags : DWORD
ctypes.c_void_p, # BindElementInfo : DHCPV6_BIND_ELEMENT_ARRAY* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('DHCPSAPI.dll')
DhcpSetServerBindingInfoV6 = Fiddle::Function.new(
lib['DhcpSetServerBindingInfoV6'],
[
Fiddle::TYPE_VOIDP, # ServerIpAddress : LPCWSTR optional
-Fiddle::TYPE_INT, # Flags : DWORD
Fiddle::TYPE_VOIDP, # BindElementInfo : DHCPV6_BIND_ELEMENT_ARRAY* in/out
],
-Fiddle::TYPE_INT)#[link(name = "dhcpsapi")]
extern "system" {
fn DhcpSetServerBindingInfoV6(
ServerIpAddress: *const u16, // LPCWSTR optional
Flags: u32, // DWORD
BindElementInfo: *mut DHCPV6_BIND_ELEMENT_ARRAY // DHCPV6_BIND_ELEMENT_ARRAY* in/out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("DHCPSAPI.dll")]
public static extern uint DhcpSetServerBindingInfoV6([MarshalAs(UnmanagedType.LPWStr)] string ServerIpAddress, uint Flags, IntPtr BindElementInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DHCPSAPI_DhcpSetServerBindingInfoV6' -Namespace Win32 -PassThru
# $api::DhcpSetServerBindingInfoV6(ServerIpAddress, Flags, BindElementInfo)#uselib "DHCPSAPI.dll"
#func global DhcpSetServerBindingInfoV6 "DhcpSetServerBindingInfoV6" sptr, sptr, sptr
; DhcpSetServerBindingInfoV6 ServerIpAddress, Flags, varptr(BindElementInfo) ; 戻り値は stat
; ServerIpAddress : LPCWSTR optional -> "sptr"
; Flags : DWORD -> "sptr"
; BindElementInfo : DHCPV6_BIND_ELEMENT_ARRAY* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "DHCPSAPI.dll" #cfunc global DhcpSetServerBindingInfoV6 "DhcpSetServerBindingInfoV6" wstr, int, var ; res = DhcpSetServerBindingInfoV6(ServerIpAddress, Flags, BindElementInfo) ; ServerIpAddress : LPCWSTR optional -> "wstr" ; Flags : DWORD -> "int" ; BindElementInfo : DHCPV6_BIND_ELEMENT_ARRAY* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "DHCPSAPI.dll" #cfunc global DhcpSetServerBindingInfoV6 "DhcpSetServerBindingInfoV6" wstr, int, sptr ; res = DhcpSetServerBindingInfoV6(ServerIpAddress, Flags, varptr(BindElementInfo)) ; ServerIpAddress : LPCWSTR optional -> "wstr" ; Flags : DWORD -> "int" ; BindElementInfo : DHCPV6_BIND_ELEMENT_ARRAY* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD DhcpSetServerBindingInfoV6(LPCWSTR ServerIpAddress, DWORD Flags, DHCPV6_BIND_ELEMENT_ARRAY* BindElementInfo) #uselib "DHCPSAPI.dll" #cfunc global DhcpSetServerBindingInfoV6 "DhcpSetServerBindingInfoV6" wstr, int, var ; res = DhcpSetServerBindingInfoV6(ServerIpAddress, Flags, BindElementInfo) ; ServerIpAddress : LPCWSTR optional -> "wstr" ; Flags : DWORD -> "int" ; BindElementInfo : DHCPV6_BIND_ELEMENT_ARRAY* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD DhcpSetServerBindingInfoV6(LPCWSTR ServerIpAddress, DWORD Flags, DHCPV6_BIND_ELEMENT_ARRAY* BindElementInfo) #uselib "DHCPSAPI.dll" #cfunc global DhcpSetServerBindingInfoV6 "DhcpSetServerBindingInfoV6" wstr, int, intptr ; res = DhcpSetServerBindingInfoV6(ServerIpAddress, Flags, varptr(BindElementInfo)) ; ServerIpAddress : LPCWSTR optional -> "wstr" ; Flags : DWORD -> "int" ; BindElementInfo : DHCPV6_BIND_ELEMENT_ARRAY* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dhcpsapi = windows.NewLazySystemDLL("DHCPSAPI.dll")
procDhcpSetServerBindingInfoV6 = dhcpsapi.NewProc("DhcpSetServerBindingInfoV6")
)
// ServerIpAddress (LPCWSTR optional), Flags (DWORD), BindElementInfo (DHCPV6_BIND_ELEMENT_ARRAY* in/out)
r1, _, err := procDhcpSetServerBindingInfoV6.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(ServerIpAddress))),
uintptr(Flags),
uintptr(BindElementInfo),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction DhcpSetServerBindingInfoV6(
ServerIpAddress: PWideChar; // LPCWSTR optional
Flags: DWORD; // DWORD
BindElementInfo: Pointer // DHCPV6_BIND_ELEMENT_ARRAY* in/out
): DWORD; stdcall;
external 'DHCPSAPI.dll' name 'DhcpSetServerBindingInfoV6';result := DllCall("DHCPSAPI\DhcpSetServerBindingInfoV6"
, "WStr", ServerIpAddress ; LPCWSTR optional
, "UInt", Flags ; DWORD
, "Ptr", BindElementInfo ; DHCPV6_BIND_ELEMENT_ARRAY* in/out
, "UInt") ; return: DWORD●DhcpSetServerBindingInfoV6(ServerIpAddress, Flags, BindElementInfo) = DLL("DHCPSAPI.dll", "dword DhcpSetServerBindingInfoV6(char*, dword, void*)")
# 呼び出し: DhcpSetServerBindingInfoV6(ServerIpAddress, Flags, BindElementInfo)
# ServerIpAddress : LPCWSTR optional -> "char*"
# Flags : DWORD -> "dword"
# BindElementInfo : DHCPV6_BIND_ELEMENT_ARRAY* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。