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

DhcpDeleteSuperScopeV4

関数
DHCPサーバーから指定したスーパースコープを削除する。
DLLDHCPSAPI.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD DhcpDeleteSuperScopeV4(
    LPCWSTR ServerIpAddress,   // optional
    LPCWSTR SuperScopeName
);

パラメーター

名前方向説明
ServerIpAddressLPCWSTRinoptional操作対象DHCPサーバのIPアドレスまたはホスト名(Unicode)。
SuperScopeNameLPCWSTRin削除するスーパースコープの名前(Unicode)へのポインタ。

戻り値の型: DWORD

各言語での呼び出し定義

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

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

DhcpDeleteSuperScopeV4 = ctypes.windll.dhcpsapi.DhcpDeleteSuperScopeV4
DhcpDeleteSuperScopeV4.restype = wintypes.DWORD
DhcpDeleteSuperScopeV4.argtypes = [
    wintypes.LPCWSTR,  # ServerIpAddress : LPCWSTR optional
    wintypes.LPCWSTR,  # SuperScopeName : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('DHCPSAPI.dll')
DhcpDeleteSuperScopeV4 = Fiddle::Function.new(
  lib['DhcpDeleteSuperScopeV4'],
  [
    Fiddle::TYPE_VOIDP,  # ServerIpAddress : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # SuperScopeName : LPCWSTR
  ],
  -Fiddle::TYPE_INT)
#[link(name = "dhcpsapi")]
extern "system" {
    fn DhcpDeleteSuperScopeV4(
        ServerIpAddress: *const u16,  // LPCWSTR optional
        SuperScopeName: *const u16  // LPCWSTR
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("DHCPSAPI.dll")]
public static extern uint DhcpDeleteSuperScopeV4([MarshalAs(UnmanagedType.LPWStr)] string ServerIpAddress, [MarshalAs(UnmanagedType.LPWStr)] string SuperScopeName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DHCPSAPI_DhcpDeleteSuperScopeV4' -Namespace Win32 -PassThru
# $api::DhcpDeleteSuperScopeV4(ServerIpAddress, SuperScopeName)
#uselib "DHCPSAPI.dll"
#func global DhcpDeleteSuperScopeV4 "DhcpDeleteSuperScopeV4" sptr, sptr
; DhcpDeleteSuperScopeV4 ServerIpAddress, SuperScopeName   ; 戻り値は stat
; ServerIpAddress : LPCWSTR optional -> "sptr"
; SuperScopeName : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "DHCPSAPI.dll"
#cfunc global DhcpDeleteSuperScopeV4 "DhcpDeleteSuperScopeV4" wstr, wstr
; res = DhcpDeleteSuperScopeV4(ServerIpAddress, SuperScopeName)
; ServerIpAddress : LPCWSTR optional -> "wstr"
; SuperScopeName : LPCWSTR -> "wstr"
; DWORD DhcpDeleteSuperScopeV4(LPCWSTR ServerIpAddress, LPCWSTR SuperScopeName)
#uselib "DHCPSAPI.dll"
#cfunc global DhcpDeleteSuperScopeV4 "DhcpDeleteSuperScopeV4" wstr, wstr
; res = DhcpDeleteSuperScopeV4(ServerIpAddress, SuperScopeName)
; ServerIpAddress : LPCWSTR optional -> "wstr"
; SuperScopeName : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dhcpsapi = windows.NewLazySystemDLL("DHCPSAPI.dll")
	procDhcpDeleteSuperScopeV4 = dhcpsapi.NewProc("DhcpDeleteSuperScopeV4")
)

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