ホーム › NetworkManagement.Dhcp › Dhcpv6RenewPrefix
Dhcpv6RenewPrefix
関数DHCPv6で委任されたプレフィックスのリースを更新する。
シグネチャ
// dhcpcsvc6.dll
#include <windows.h>
DWORD Dhcpv6RenewPrefix(
LPWSTR adapterName,
DHCPV6CAPI_CLASSID* pclassId,
DHCPV6PrefixLeaseInformation* prefixleaseInfo,
DWORD* pdwTimeToWait,
DWORD bValidatePrefix
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| adapterName | LPWSTR | in |
| pclassId | DHCPV6CAPI_CLASSID* | inout |
| prefixleaseInfo | DHCPV6PrefixLeaseInformation* | inout |
| pdwTimeToWait | DWORD* | out |
| bValidatePrefix | DWORD | in |
戻り値の型: DWORD
各言語での呼び出し定義
// dhcpcsvc6.dll
#include <windows.h>
DWORD Dhcpv6RenewPrefix(
LPWSTR adapterName,
DHCPV6CAPI_CLASSID* pclassId,
DHCPV6PrefixLeaseInformation* prefixleaseInfo,
DWORD* pdwTimeToWait,
DWORD bValidatePrefix
);[DllImport("dhcpcsvc6.dll", ExactSpelling = true)]
static extern uint Dhcpv6RenewPrefix(
[MarshalAs(UnmanagedType.LPWStr)] string adapterName, // LPWSTR
IntPtr pclassId, // DHCPV6CAPI_CLASSID* in/out
IntPtr prefixleaseInfo, // DHCPV6PrefixLeaseInformation* in/out
out uint pdwTimeToWait, // DWORD* out
uint bValidatePrefix // DWORD
);<DllImport("dhcpcsvc6.dll", ExactSpelling:=True)>
Public Shared Function Dhcpv6RenewPrefix(
<MarshalAs(UnmanagedType.LPWStr)> adapterName As String, ' LPWSTR
pclassId As IntPtr, ' DHCPV6CAPI_CLASSID* in/out
prefixleaseInfo As IntPtr, ' DHCPV6PrefixLeaseInformation* in/out
<Out> ByRef pdwTimeToWait As UInteger, ' DWORD* out
bValidatePrefix As UInteger ' DWORD
) As UInteger
End Function' adapterName : LPWSTR
' pclassId : DHCPV6CAPI_CLASSID* in/out
' prefixleaseInfo : DHCPV6PrefixLeaseInformation* in/out
' pdwTimeToWait : DWORD* out
' bValidatePrefix : DWORD
Declare PtrSafe Function Dhcpv6RenewPrefix Lib "dhcpcsvc6" ( _
ByVal adapterName As LongPtr, _
ByVal pclassId As LongPtr, _
ByVal prefixleaseInfo As LongPtr, _
ByRef pdwTimeToWait As Long, _
ByVal bValidatePrefix As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
Dhcpv6RenewPrefix = ctypes.windll.dhcpcsvc6.Dhcpv6RenewPrefix
Dhcpv6RenewPrefix.restype = wintypes.DWORD
Dhcpv6RenewPrefix.argtypes = [
wintypes.LPCWSTR, # adapterName : LPWSTR
ctypes.c_void_p, # pclassId : DHCPV6CAPI_CLASSID* in/out
ctypes.c_void_p, # prefixleaseInfo : DHCPV6PrefixLeaseInformation* in/out
ctypes.POINTER(wintypes.DWORD), # pdwTimeToWait : DWORD* out
wintypes.DWORD, # bValidatePrefix : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dhcpcsvc6.dll')
Dhcpv6RenewPrefix = Fiddle::Function.new(
lib['Dhcpv6RenewPrefix'],
[
Fiddle::TYPE_VOIDP, # adapterName : LPWSTR
Fiddle::TYPE_VOIDP, # pclassId : DHCPV6CAPI_CLASSID* in/out
Fiddle::TYPE_VOIDP, # prefixleaseInfo : DHCPV6PrefixLeaseInformation* in/out
Fiddle::TYPE_VOIDP, # pdwTimeToWait : DWORD* out
-Fiddle::TYPE_INT, # bValidatePrefix : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "dhcpcsvc6")]
extern "system" {
fn Dhcpv6RenewPrefix(
adapterName: *mut u16, // LPWSTR
pclassId: *mut DHCPV6CAPI_CLASSID, // DHCPV6CAPI_CLASSID* in/out
prefixleaseInfo: *mut DHCPV6PrefixLeaseInformation, // DHCPV6PrefixLeaseInformation* in/out
pdwTimeToWait: *mut u32, // DWORD* out
bValidatePrefix: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("dhcpcsvc6.dll")]
public static extern uint Dhcpv6RenewPrefix([MarshalAs(UnmanagedType.LPWStr)] string adapterName, IntPtr pclassId, IntPtr prefixleaseInfo, out uint pdwTimeToWait, uint bValidatePrefix);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dhcpcsvc6_Dhcpv6RenewPrefix' -Namespace Win32 -PassThru
# $api::Dhcpv6RenewPrefix(adapterName, pclassId, prefixleaseInfo, pdwTimeToWait, bValidatePrefix)#uselib "dhcpcsvc6.dll"
#func global Dhcpv6RenewPrefix "Dhcpv6RenewPrefix" sptr, sptr, sptr, sptr, sptr
; Dhcpv6RenewPrefix adapterName, varptr(pclassId), varptr(prefixleaseInfo), varptr(pdwTimeToWait), bValidatePrefix ; 戻り値は stat
; adapterName : LPWSTR -> "sptr"
; pclassId : DHCPV6CAPI_CLASSID* in/out -> "sptr"
; prefixleaseInfo : DHCPV6PrefixLeaseInformation* in/out -> "sptr"
; pdwTimeToWait : DWORD* out -> "sptr"
; bValidatePrefix : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "dhcpcsvc6.dll" #cfunc global Dhcpv6RenewPrefix "Dhcpv6RenewPrefix" wstr, var, var, var, int ; res = Dhcpv6RenewPrefix(adapterName, pclassId, prefixleaseInfo, pdwTimeToWait, bValidatePrefix) ; adapterName : LPWSTR -> "wstr" ; pclassId : DHCPV6CAPI_CLASSID* in/out -> "var" ; prefixleaseInfo : DHCPV6PrefixLeaseInformation* in/out -> "var" ; pdwTimeToWait : DWORD* out -> "var" ; bValidatePrefix : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "dhcpcsvc6.dll" #cfunc global Dhcpv6RenewPrefix "Dhcpv6RenewPrefix" wstr, sptr, sptr, sptr, int ; res = Dhcpv6RenewPrefix(adapterName, varptr(pclassId), varptr(prefixleaseInfo), varptr(pdwTimeToWait), bValidatePrefix) ; adapterName : LPWSTR -> "wstr" ; pclassId : DHCPV6CAPI_CLASSID* in/out -> "sptr" ; prefixleaseInfo : DHCPV6PrefixLeaseInformation* in/out -> "sptr" ; pdwTimeToWait : DWORD* out -> "sptr" ; bValidatePrefix : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD Dhcpv6RenewPrefix(LPWSTR adapterName, DHCPV6CAPI_CLASSID* pclassId, DHCPV6PrefixLeaseInformation* prefixleaseInfo, DWORD* pdwTimeToWait, DWORD bValidatePrefix) #uselib "dhcpcsvc6.dll" #cfunc global Dhcpv6RenewPrefix "Dhcpv6RenewPrefix" wstr, var, var, var, int ; res = Dhcpv6RenewPrefix(adapterName, pclassId, prefixleaseInfo, pdwTimeToWait, bValidatePrefix) ; adapterName : LPWSTR -> "wstr" ; pclassId : DHCPV6CAPI_CLASSID* in/out -> "var" ; prefixleaseInfo : DHCPV6PrefixLeaseInformation* in/out -> "var" ; pdwTimeToWait : DWORD* out -> "var" ; bValidatePrefix : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD Dhcpv6RenewPrefix(LPWSTR adapterName, DHCPV6CAPI_CLASSID* pclassId, DHCPV6PrefixLeaseInformation* prefixleaseInfo, DWORD* pdwTimeToWait, DWORD bValidatePrefix) #uselib "dhcpcsvc6.dll" #cfunc global Dhcpv6RenewPrefix "Dhcpv6RenewPrefix" wstr, intptr, intptr, intptr, int ; res = Dhcpv6RenewPrefix(adapterName, varptr(pclassId), varptr(prefixleaseInfo), varptr(pdwTimeToWait), bValidatePrefix) ; adapterName : LPWSTR -> "wstr" ; pclassId : DHCPV6CAPI_CLASSID* in/out -> "intptr" ; prefixleaseInfo : DHCPV6PrefixLeaseInformation* in/out -> "intptr" ; pdwTimeToWait : DWORD* out -> "intptr" ; bValidatePrefix : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dhcpcsvc6 = windows.NewLazySystemDLL("dhcpcsvc6.dll")
procDhcpv6RenewPrefix = dhcpcsvc6.NewProc("Dhcpv6RenewPrefix")
)
// adapterName (LPWSTR), pclassId (DHCPV6CAPI_CLASSID* in/out), prefixleaseInfo (DHCPV6PrefixLeaseInformation* in/out), pdwTimeToWait (DWORD* out), bValidatePrefix (DWORD)
r1, _, err := procDhcpv6RenewPrefix.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(adapterName))),
uintptr(pclassId),
uintptr(prefixleaseInfo),
uintptr(pdwTimeToWait),
uintptr(bValidatePrefix),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction Dhcpv6RenewPrefix(
adapterName: PWideChar; // LPWSTR
pclassId: Pointer; // DHCPV6CAPI_CLASSID* in/out
prefixleaseInfo: Pointer; // DHCPV6PrefixLeaseInformation* in/out
pdwTimeToWait: Pointer; // DWORD* out
bValidatePrefix: DWORD // DWORD
): DWORD; stdcall;
external 'dhcpcsvc6.dll' name 'Dhcpv6RenewPrefix';result := DllCall("dhcpcsvc6\Dhcpv6RenewPrefix"
, "WStr", adapterName ; LPWSTR
, "Ptr", pclassId ; DHCPV6CAPI_CLASSID* in/out
, "Ptr", prefixleaseInfo ; DHCPV6PrefixLeaseInformation* in/out
, "Ptr", pdwTimeToWait ; DWORD* out
, "UInt", bValidatePrefix ; DWORD
, "UInt") ; return: DWORD●Dhcpv6RenewPrefix(adapterName, pclassId, prefixleaseInfo, pdwTimeToWait, bValidatePrefix) = DLL("dhcpcsvc6.dll", "dword Dhcpv6RenewPrefix(char*, void*, void*, void*, dword)")
# 呼び出し: Dhcpv6RenewPrefix(adapterName, pclassId, prefixleaseInfo, pdwTimeToWait, bValidatePrefix)
# adapterName : LPWSTR -> "char*"
# pclassId : DHCPV6CAPI_CLASSID* in/out -> "void*"
# prefixleaseInfo : DHCPV6PrefixLeaseInformation* in/out -> "void*"
# pdwTimeToWait : DWORD* out -> "void*"
# bValidatePrefix : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。