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