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

DhcpV4FailoverDeleteScopeFromRelationship

関数
IPv4フェールオーバー関係からスコープを削除する。
DLLDHCPSAPI.dll呼出規約winapi対応OSwindowsserver2012

シグネチャ

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

DWORD DhcpV4FailoverDeleteScopeFromRelationship(
    LPWSTR ServerIpAddress,   // optional
    DHCP_FAILOVER_RELATIONSHIP* pRelationship
);

パラメーター

名前方向説明
ServerIpAddressLPWSTRinoptional対象DHCPサーバーのIPアドレスを示すUnicode文字列。ローカルならNULL可。
pRelationshipDHCP_FAILOVER_RELATIONSHIP*inスコープを除外する対象フェールオーバー関係を表すDHCP_FAILOVER_RELATIONSHIP構造体へのポインタ。pScopes配列に対象スコープを格納する。

戻り値の型: DWORD

各言語での呼び出し定義

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

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

DhcpV4FailoverDeleteScopeFromRelationship = ctypes.windll.dhcpsapi.DhcpV4FailoverDeleteScopeFromRelationship
DhcpV4FailoverDeleteScopeFromRelationship.restype = wintypes.DWORD
DhcpV4FailoverDeleteScopeFromRelationship.argtypes = [
    wintypes.LPCWSTR,  # ServerIpAddress : LPWSTR optional
    ctypes.c_void_p,  # pRelationship : DHCP_FAILOVER_RELATIONSHIP*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	dhcpsapi = windows.NewLazySystemDLL("DHCPSAPI.dll")
	procDhcpV4FailoverDeleteScopeFromRelationship = dhcpsapi.NewProc("DhcpV4FailoverDeleteScopeFromRelationship")
)

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