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

DhcpDeleteClientInfoV6

関数
DHCPサーバーから指定したIPv6クライアントの情報を削除する。
DLLDHCPSAPI.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD DhcpDeleteClientInfoV6(
    LPCWSTR ServerIpAddress,   // optional
    const DHCP_SEARCH_INFO_V6* ClientInfo
);

パラメーター

名前方向説明
ServerIpAddressLPCWSTRinoptional対象DHCPv6サーバーのIPアドレスを示すUnicode文字列。ローカルならNULL可。
ClientInfoDHCP_SEARCH_INFO_V6*in削除対象クライアントを特定する検索条件を保持するDHCP_SEARCH_INFO_V6構造体へのポインタ。

戻り値の型: DWORD

各言語での呼び出し定義

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

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

DhcpDeleteClientInfoV6 = ctypes.windll.dhcpsapi.DhcpDeleteClientInfoV6
DhcpDeleteClientInfoV6.restype = wintypes.DWORD
DhcpDeleteClientInfoV6.argtypes = [
    wintypes.LPCWSTR,  # ServerIpAddress : LPCWSTR optional
    ctypes.c_void_p,  # ClientInfo : DHCP_SEARCH_INFO_V6*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('DHCPSAPI.dll')
DhcpDeleteClientInfoV6 = Fiddle::Function.new(
  lib['DhcpDeleteClientInfoV6'],
  [
    Fiddle::TYPE_VOIDP,  # ServerIpAddress : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # ClientInfo : DHCP_SEARCH_INFO_V6*
  ],
  -Fiddle::TYPE_INT)
#[link(name = "dhcpsapi")]
extern "system" {
    fn DhcpDeleteClientInfoV6(
        ServerIpAddress: *const u16,  // LPCWSTR optional
        ClientInfo: *const DHCP_SEARCH_INFO_V6  // DHCP_SEARCH_INFO_V6*
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("DHCPSAPI.dll")]
public static extern uint DhcpDeleteClientInfoV6([MarshalAs(UnmanagedType.LPWStr)] string ServerIpAddress, IntPtr ClientInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DHCPSAPI_DhcpDeleteClientInfoV6' -Namespace Win32 -PassThru
# $api::DhcpDeleteClientInfoV6(ServerIpAddress, ClientInfo)
#uselib "DHCPSAPI.dll"
#func global DhcpDeleteClientInfoV6 "DhcpDeleteClientInfoV6" sptr, sptr
; DhcpDeleteClientInfoV6 ServerIpAddress, varptr(ClientInfo)   ; 戻り値は stat
; ServerIpAddress : LPCWSTR optional -> "sptr"
; ClientInfo : DHCP_SEARCH_INFO_V6* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "DHCPSAPI.dll"
#cfunc global DhcpDeleteClientInfoV6 "DhcpDeleteClientInfoV6" wstr, var
; res = DhcpDeleteClientInfoV6(ServerIpAddress, ClientInfo)
; ServerIpAddress : LPCWSTR optional -> "wstr"
; ClientInfo : DHCP_SEARCH_INFO_V6* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD DhcpDeleteClientInfoV6(LPCWSTR ServerIpAddress, DHCP_SEARCH_INFO_V6* ClientInfo)
#uselib "DHCPSAPI.dll"
#cfunc global DhcpDeleteClientInfoV6 "DhcpDeleteClientInfoV6" wstr, var
; res = DhcpDeleteClientInfoV6(ServerIpAddress, ClientInfo)
; ServerIpAddress : LPCWSTR optional -> "wstr"
; ClientInfo : DHCP_SEARCH_INFO_V6* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dhcpsapi = windows.NewLazySystemDLL("DHCPSAPI.dll")
	procDhcpDeleteClientInfoV6 = dhcpsapi.NewProc("DhcpDeleteClientInfoV6")
)

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