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

McastRenewAddress

関数
リース済みマルチキャストアドレスのリースを更新する。
DLLdhcpcsvc.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD McastRenewAddress(
    WORD AddrFamily,
    MCAST_CLIENT_UID* pRequestID,
    MCAST_LEASE_REQUEST* pRenewRequest,
    MCAST_LEASE_RESPONSE* pRenewResponse
);

パラメーター

名前方向
AddrFamilyWORDin
pRequestIDMCAST_CLIENT_UID*inout
pRenewRequestMCAST_LEASE_REQUEST*inout
pRenewResponseMCAST_LEASE_RESPONSE*inout

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD McastRenewAddress(
    WORD AddrFamily,
    MCAST_CLIENT_UID* pRequestID,
    MCAST_LEASE_REQUEST* pRenewRequest,
    MCAST_LEASE_RESPONSE* pRenewResponse
);
[DllImport("dhcpcsvc.dll", ExactSpelling = true)]
static extern uint McastRenewAddress(
    ushort AddrFamily,   // WORD
    IntPtr pRequestID,   // MCAST_CLIENT_UID* in/out
    IntPtr pRenewRequest,   // MCAST_LEASE_REQUEST* in/out
    IntPtr pRenewResponse   // MCAST_LEASE_RESPONSE* in/out
);
<DllImport("dhcpcsvc.dll", ExactSpelling:=True)>
Public Shared Function McastRenewAddress(
    AddrFamily As UShort,   ' WORD
    pRequestID As IntPtr,   ' MCAST_CLIENT_UID* in/out
    pRenewRequest As IntPtr,   ' MCAST_LEASE_REQUEST* in/out
    pRenewResponse As IntPtr   ' MCAST_LEASE_RESPONSE* in/out
) As UInteger
End Function
' AddrFamily : WORD
' pRequestID : MCAST_CLIENT_UID* in/out
' pRenewRequest : MCAST_LEASE_REQUEST* in/out
' pRenewResponse : MCAST_LEASE_RESPONSE* in/out
Declare PtrSafe Function McastRenewAddress Lib "dhcpcsvc" ( _
    ByVal AddrFamily As Integer, _
    ByVal pRequestID As LongPtr, _
    ByVal pRenewRequest As LongPtr, _
    ByVal pRenewResponse As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

McastRenewAddress = ctypes.windll.dhcpcsvc.McastRenewAddress
McastRenewAddress.restype = wintypes.DWORD
McastRenewAddress.argtypes = [
    ctypes.c_ushort,  # AddrFamily : WORD
    ctypes.c_void_p,  # pRequestID : MCAST_CLIENT_UID* in/out
    ctypes.c_void_p,  # pRenewRequest : MCAST_LEASE_REQUEST* in/out
    ctypes.c_void_p,  # pRenewResponse : MCAST_LEASE_RESPONSE* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('dhcpcsvc.dll')
McastRenewAddress = Fiddle::Function.new(
  lib['McastRenewAddress'],
  [
    -Fiddle::TYPE_SHORT,  # AddrFamily : WORD
    Fiddle::TYPE_VOIDP,  # pRequestID : MCAST_CLIENT_UID* in/out
    Fiddle::TYPE_VOIDP,  # pRenewRequest : MCAST_LEASE_REQUEST* in/out
    Fiddle::TYPE_VOIDP,  # pRenewResponse : MCAST_LEASE_RESPONSE* in/out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "dhcpcsvc")]
extern "system" {
    fn McastRenewAddress(
        AddrFamily: u16,  // WORD
        pRequestID: *mut MCAST_CLIENT_UID,  // MCAST_CLIENT_UID* in/out
        pRenewRequest: *mut MCAST_LEASE_REQUEST,  // MCAST_LEASE_REQUEST* in/out
        pRenewResponse: *mut MCAST_LEASE_RESPONSE  // MCAST_LEASE_RESPONSE* in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("dhcpcsvc.dll")]
public static extern uint McastRenewAddress(ushort AddrFamily, IntPtr pRequestID, IntPtr pRenewRequest, IntPtr pRenewResponse);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dhcpcsvc_McastRenewAddress' -Namespace Win32 -PassThru
# $api::McastRenewAddress(AddrFamily, pRequestID, pRenewRequest, pRenewResponse)
#uselib "dhcpcsvc.dll"
#func global McastRenewAddress "McastRenewAddress" sptr, sptr, sptr, sptr
; McastRenewAddress AddrFamily, varptr(pRequestID), varptr(pRenewRequest), varptr(pRenewResponse)   ; 戻り値は stat
; AddrFamily : WORD -> "sptr"
; pRequestID : MCAST_CLIENT_UID* in/out -> "sptr"
; pRenewRequest : MCAST_LEASE_REQUEST* in/out -> "sptr"
; pRenewResponse : MCAST_LEASE_RESPONSE* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "dhcpcsvc.dll"
#cfunc global McastRenewAddress "McastRenewAddress" int, var, var, var
; res = McastRenewAddress(AddrFamily, pRequestID, pRenewRequest, pRenewResponse)
; AddrFamily : WORD -> "int"
; pRequestID : MCAST_CLIENT_UID* in/out -> "var"
; pRenewRequest : MCAST_LEASE_REQUEST* in/out -> "var"
; pRenewResponse : MCAST_LEASE_RESPONSE* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD McastRenewAddress(WORD AddrFamily, MCAST_CLIENT_UID* pRequestID, MCAST_LEASE_REQUEST* pRenewRequest, MCAST_LEASE_RESPONSE* pRenewResponse)
#uselib "dhcpcsvc.dll"
#cfunc global McastRenewAddress "McastRenewAddress" int, var, var, var
; res = McastRenewAddress(AddrFamily, pRequestID, pRenewRequest, pRenewResponse)
; AddrFamily : WORD -> "int"
; pRequestID : MCAST_CLIENT_UID* in/out -> "var"
; pRenewRequest : MCAST_LEASE_REQUEST* in/out -> "var"
; pRenewResponse : MCAST_LEASE_RESPONSE* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dhcpcsvc = windows.NewLazySystemDLL("dhcpcsvc.dll")
	procMcastRenewAddress = dhcpcsvc.NewProc("McastRenewAddress")
)

// AddrFamily (WORD), pRequestID (MCAST_CLIENT_UID* in/out), pRenewRequest (MCAST_LEASE_REQUEST* in/out), pRenewResponse (MCAST_LEASE_RESPONSE* in/out)
r1, _, err := procMcastRenewAddress.Call(
	uintptr(AddrFamily),
	uintptr(pRequestID),
	uintptr(pRenewRequest),
	uintptr(pRenewResponse),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function McastRenewAddress(
  AddrFamily: Word;   // WORD
  pRequestID: Pointer;   // MCAST_CLIENT_UID* in/out
  pRenewRequest: Pointer;   // MCAST_LEASE_REQUEST* in/out
  pRenewResponse: Pointer   // MCAST_LEASE_RESPONSE* in/out
): DWORD; stdcall;
  external 'dhcpcsvc.dll' name 'McastRenewAddress';
result := DllCall("dhcpcsvc\McastRenewAddress"
    , "UShort", AddrFamily   ; WORD
    , "Ptr", pRequestID   ; MCAST_CLIENT_UID* in/out
    , "Ptr", pRenewRequest   ; MCAST_LEASE_REQUEST* in/out
    , "Ptr", pRenewResponse   ; MCAST_LEASE_RESPONSE* in/out
    , "UInt")   ; return: DWORD
●McastRenewAddress(AddrFamily, pRequestID, pRenewRequest, pRenewResponse) = DLL("dhcpcsvc.dll", "dword McastRenewAddress(int, void*, void*, void*)")
# 呼び出し: McastRenewAddress(AddrFamily, pRequestID, pRenewRequest, pRenewResponse)
# AddrFamily : WORD -> "int"
# pRequestID : MCAST_CLIENT_UID* in/out -> "void*"
# pRenewRequest : MCAST_LEASE_REQUEST* in/out -> "void*"
# pRenewResponse : MCAST_LEASE_RESPONSE* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。