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