ホーム › NetworkManagement.Dhcp › DhcpDeleteSuperScopeV4
DhcpDeleteSuperScopeV4
関数DHCPサーバーから指定したスーパースコープを削除する。
シグネチャ
// DHCPSAPI.dll
#include <windows.h>
DWORD DhcpDeleteSuperScopeV4(
LPCWSTR ServerIpAddress, // optional
LPCWSTR SuperScopeName
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ServerIpAddress | LPCWSTR | inoptional | 操作対象DHCPサーバのIPアドレスまたはホスト名(Unicode)。 |
| SuperScopeName | LPCWSTR | in | 削除するスーパースコープの名前(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 // DWORDfunction 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)。const std = @import("std");
extern "dhcpsapi" fn DhcpDeleteSuperScopeV4(
ServerIpAddress: [*c]const u16, // LPCWSTR optional
SuperScopeName: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) u32;proc DhcpDeleteSuperScopeV4(
ServerIpAddress: WideCString, # LPCWSTR optional
SuperScopeName: WideCString # LPCWSTR
): uint32 {.importc: "DhcpDeleteSuperScopeV4", stdcall, dynlib: "DHCPSAPI.dll".}pragma(lib, "dhcpsapi");
extern(Windows)
uint DhcpDeleteSuperScopeV4(
const(wchar)* ServerIpAddress, // LPCWSTR optional
const(wchar)* SuperScopeName // LPCWSTR
);ccall((:DhcpDeleteSuperScopeV4, "DHCPSAPI.dll"), stdcall, UInt32,
(Cwstring, Cwstring),
ServerIpAddress, SuperScopeName)
# ServerIpAddress : LPCWSTR optional -> Cwstring
# SuperScopeName : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t DhcpDeleteSuperScopeV4(
const uint16_t* ServerIpAddress,
const uint16_t* SuperScopeName);
]]
local dhcpsapi = ffi.load("dhcpsapi")
-- dhcpsapi.DhcpDeleteSuperScopeV4(ServerIpAddress, SuperScopeName)
-- ServerIpAddress : LPCWSTR optional
-- SuperScopeName : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('DHCPSAPI.dll');
const DhcpDeleteSuperScopeV4 = lib.func('__stdcall', 'DhcpDeleteSuperScopeV4', 'uint32_t', ['str16', 'str16']);
// DhcpDeleteSuperScopeV4(ServerIpAddress, SuperScopeName)
// ServerIpAddress : LPCWSTR optional -> 'str16'
// SuperScopeName : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("DHCPSAPI.dll", {
DhcpDeleteSuperScopeV4: { parameters: ["buffer", "buffer"], result: "u32" },
});
// lib.symbols.DhcpDeleteSuperScopeV4(ServerIpAddress, SuperScopeName)
// ServerIpAddress : LPCWSTR optional -> "buffer"
// SuperScopeName : LPCWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t DhcpDeleteSuperScopeV4(
const uint16_t* ServerIpAddress,
const uint16_t* SuperScopeName);
C, "DHCPSAPI.dll");
// $ffi->DhcpDeleteSuperScopeV4(ServerIpAddress, SuperScopeName);
// ServerIpAddress : LPCWSTR optional
// SuperScopeName : LPCWSTR
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Dhcpsapi extends StdCallLibrary {
Dhcpsapi INSTANCE = Native.load("dhcpsapi", Dhcpsapi.class);
int DhcpDeleteSuperScopeV4(
WString ServerIpAddress, // LPCWSTR optional
WString SuperScopeName // LPCWSTR
);
}@[Link("dhcpsapi")]
lib LibDHCPSAPI
fun DhcpDeleteSuperScopeV4 = DhcpDeleteSuperScopeV4(
ServerIpAddress : UInt16*, # LPCWSTR optional
SuperScopeName : UInt16* # LPCWSTR
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DhcpDeleteSuperScopeV4Native = Uint32 Function(Pointer<Utf16>, Pointer<Utf16>);
typedef DhcpDeleteSuperScopeV4Dart = int Function(Pointer<Utf16>, Pointer<Utf16>);
final DhcpDeleteSuperScopeV4 = DynamicLibrary.open('DHCPSAPI.dll')
.lookupFunction<DhcpDeleteSuperScopeV4Native, DhcpDeleteSuperScopeV4Dart>('DhcpDeleteSuperScopeV4');
// ServerIpAddress : LPCWSTR optional -> Pointer<Utf16>
// SuperScopeName : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DhcpDeleteSuperScopeV4(
ServerIpAddress: PWideChar; // LPCWSTR optional
SuperScopeName: PWideChar // LPCWSTR
): DWORD; stdcall;
external 'DHCPSAPI.dll' name 'DhcpDeleteSuperScopeV4';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DhcpDeleteSuperScopeV4"
c_DhcpDeleteSuperScopeV4 :: CWString -> CWString -> IO Word32
-- ServerIpAddress : LPCWSTR optional -> CWString
-- SuperScopeName : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let dhcpdeletesuperscopev4 =
foreign "DhcpDeleteSuperScopeV4"
((ptr uint16_t) @-> (ptr uint16_t) @-> returning uint32_t)
(* ServerIpAddress : LPCWSTR optional -> (ptr uint16_t) *)
(* SuperScopeName : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library dhcpsapi (t "DHCPSAPI.dll"))
(cffi:use-foreign-library dhcpsapi)
(cffi:defcfun ("DhcpDeleteSuperScopeV4" dhcp-delete-super-scope-v4 :convention :stdcall) :uint32
(server-ip-address (:string :encoding :utf-16le)) ; LPCWSTR optional
(super-scope-name (:string :encoding :utf-16le))) ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DhcpDeleteSuperScopeV4 = Win32::API::More->new('DHCPSAPI',
'DWORD DhcpDeleteSuperScopeV4(LPCWSTR ServerIpAddress, LPCWSTR SuperScopeName)');
# my $ret = $DhcpDeleteSuperScopeV4->Call($ServerIpAddress, $SuperScopeName);
# ServerIpAddress : LPCWSTR optional -> LPCWSTR
# SuperScopeName : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。