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