ホーム › NetworkManagement.Multicast › McastEnumerateScopes
McastEnumerateScopes
関数利用可能なマルチキャストアドレススコープを列挙する。
シグネチャ
// dhcpcsvc.dll
#include <windows.h>
DWORD McastEnumerateScopes(
WORD AddrFamily,
BOOL ReQuery,
MCAST_SCOPE_ENTRY* pScopeList,
DWORD* pScopeLen,
DWORD* pScopeCount
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| AddrFamily | WORD | in |
| ReQuery | BOOL | in |
| pScopeList | MCAST_SCOPE_ENTRY* | inout |
| pScopeLen | DWORD* | inout |
| pScopeCount | DWORD* | inout |
戻り値の型: DWORD
各言語での呼び出し定義
// dhcpcsvc.dll
#include <windows.h>
DWORD McastEnumerateScopes(
WORD AddrFamily,
BOOL ReQuery,
MCAST_SCOPE_ENTRY* pScopeList,
DWORD* pScopeLen,
DWORD* pScopeCount
);[DllImport("dhcpcsvc.dll", ExactSpelling = true)]
static extern uint McastEnumerateScopes(
ushort AddrFamily, // WORD
bool ReQuery, // BOOL
IntPtr pScopeList, // MCAST_SCOPE_ENTRY* in/out
ref uint pScopeLen, // DWORD* in/out
ref uint pScopeCount // DWORD* in/out
);<DllImport("dhcpcsvc.dll", ExactSpelling:=True)>
Public Shared Function McastEnumerateScopes(
AddrFamily As UShort, ' WORD
ReQuery As Boolean, ' BOOL
pScopeList As IntPtr, ' MCAST_SCOPE_ENTRY* in/out
ByRef pScopeLen As UInteger, ' DWORD* in/out
ByRef pScopeCount As UInteger ' DWORD* in/out
) As UInteger
End Function' AddrFamily : WORD
' ReQuery : BOOL
' pScopeList : MCAST_SCOPE_ENTRY* in/out
' pScopeLen : DWORD* in/out
' pScopeCount : DWORD* in/out
Declare PtrSafe Function McastEnumerateScopes Lib "dhcpcsvc" ( _
ByVal AddrFamily As Integer, _
ByVal ReQuery As Long, _
ByVal pScopeList As LongPtr, _
ByRef pScopeLen As Long, _
ByRef pScopeCount As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
McastEnumerateScopes = ctypes.windll.dhcpcsvc.McastEnumerateScopes
McastEnumerateScopes.restype = wintypes.DWORD
McastEnumerateScopes.argtypes = [
ctypes.c_ushort, # AddrFamily : WORD
wintypes.BOOL, # ReQuery : BOOL
ctypes.c_void_p, # pScopeList : MCAST_SCOPE_ENTRY* in/out
ctypes.POINTER(wintypes.DWORD), # pScopeLen : DWORD* in/out
ctypes.POINTER(wintypes.DWORD), # pScopeCount : DWORD* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dhcpcsvc.dll')
McastEnumerateScopes = Fiddle::Function.new(
lib['McastEnumerateScopes'],
[
-Fiddle::TYPE_SHORT, # AddrFamily : WORD
Fiddle::TYPE_INT, # ReQuery : BOOL
Fiddle::TYPE_VOIDP, # pScopeList : MCAST_SCOPE_ENTRY* in/out
Fiddle::TYPE_VOIDP, # pScopeLen : DWORD* in/out
Fiddle::TYPE_VOIDP, # pScopeCount : DWORD* in/out
],
-Fiddle::TYPE_INT)#[link(name = "dhcpcsvc")]
extern "system" {
fn McastEnumerateScopes(
AddrFamily: u16, // WORD
ReQuery: i32, // BOOL
pScopeList: *mut MCAST_SCOPE_ENTRY, // MCAST_SCOPE_ENTRY* in/out
pScopeLen: *mut u32, // DWORD* in/out
pScopeCount: *mut u32 // DWORD* in/out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("dhcpcsvc.dll")]
public static extern uint McastEnumerateScopes(ushort AddrFamily, bool ReQuery, IntPtr pScopeList, ref uint pScopeLen, ref uint pScopeCount);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dhcpcsvc_McastEnumerateScopes' -Namespace Win32 -PassThru
# $api::McastEnumerateScopes(AddrFamily, ReQuery, pScopeList, pScopeLen, pScopeCount)#uselib "dhcpcsvc.dll"
#func global McastEnumerateScopes "McastEnumerateScopes" sptr, sptr, sptr, sptr, sptr
; McastEnumerateScopes AddrFamily, ReQuery, varptr(pScopeList), varptr(pScopeLen), varptr(pScopeCount) ; 戻り値は stat
; AddrFamily : WORD -> "sptr"
; ReQuery : BOOL -> "sptr"
; pScopeList : MCAST_SCOPE_ENTRY* in/out -> "sptr"
; pScopeLen : DWORD* in/out -> "sptr"
; pScopeCount : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "dhcpcsvc.dll" #cfunc global McastEnumerateScopes "McastEnumerateScopes" int, int, var, var, var ; res = McastEnumerateScopes(AddrFamily, ReQuery, pScopeList, pScopeLen, pScopeCount) ; AddrFamily : WORD -> "int" ; ReQuery : BOOL -> "int" ; pScopeList : MCAST_SCOPE_ENTRY* in/out -> "var" ; pScopeLen : DWORD* in/out -> "var" ; pScopeCount : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "dhcpcsvc.dll" #cfunc global McastEnumerateScopes "McastEnumerateScopes" int, int, sptr, sptr, sptr ; res = McastEnumerateScopes(AddrFamily, ReQuery, varptr(pScopeList), varptr(pScopeLen), varptr(pScopeCount)) ; AddrFamily : WORD -> "int" ; ReQuery : BOOL -> "int" ; pScopeList : MCAST_SCOPE_ENTRY* in/out -> "sptr" ; pScopeLen : DWORD* in/out -> "sptr" ; pScopeCount : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD McastEnumerateScopes(WORD AddrFamily, BOOL ReQuery, MCAST_SCOPE_ENTRY* pScopeList, DWORD* pScopeLen, DWORD* pScopeCount) #uselib "dhcpcsvc.dll" #cfunc global McastEnumerateScopes "McastEnumerateScopes" int, int, var, var, var ; res = McastEnumerateScopes(AddrFamily, ReQuery, pScopeList, pScopeLen, pScopeCount) ; AddrFamily : WORD -> "int" ; ReQuery : BOOL -> "int" ; pScopeList : MCAST_SCOPE_ENTRY* in/out -> "var" ; pScopeLen : DWORD* in/out -> "var" ; pScopeCount : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD McastEnumerateScopes(WORD AddrFamily, BOOL ReQuery, MCAST_SCOPE_ENTRY* pScopeList, DWORD* pScopeLen, DWORD* pScopeCount) #uselib "dhcpcsvc.dll" #cfunc global McastEnumerateScopes "McastEnumerateScopes" int, int, intptr, intptr, intptr ; res = McastEnumerateScopes(AddrFamily, ReQuery, varptr(pScopeList), varptr(pScopeLen), varptr(pScopeCount)) ; AddrFamily : WORD -> "int" ; ReQuery : BOOL -> "int" ; pScopeList : MCAST_SCOPE_ENTRY* in/out -> "intptr" ; pScopeLen : DWORD* in/out -> "intptr" ; pScopeCount : DWORD* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dhcpcsvc = windows.NewLazySystemDLL("dhcpcsvc.dll")
procMcastEnumerateScopes = dhcpcsvc.NewProc("McastEnumerateScopes")
)
// AddrFamily (WORD), ReQuery (BOOL), pScopeList (MCAST_SCOPE_ENTRY* in/out), pScopeLen (DWORD* in/out), pScopeCount (DWORD* in/out)
r1, _, err := procMcastEnumerateScopes.Call(
uintptr(AddrFamily),
uintptr(ReQuery),
uintptr(pScopeList),
uintptr(pScopeLen),
uintptr(pScopeCount),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction McastEnumerateScopes(
AddrFamily: Word; // WORD
ReQuery: BOOL; // BOOL
pScopeList: Pointer; // MCAST_SCOPE_ENTRY* in/out
pScopeLen: Pointer; // DWORD* in/out
pScopeCount: Pointer // DWORD* in/out
): DWORD; stdcall;
external 'dhcpcsvc.dll' name 'McastEnumerateScopes';result := DllCall("dhcpcsvc\McastEnumerateScopes"
, "UShort", AddrFamily ; WORD
, "Int", ReQuery ; BOOL
, "Ptr", pScopeList ; MCAST_SCOPE_ENTRY* in/out
, "Ptr", pScopeLen ; DWORD* in/out
, "Ptr", pScopeCount ; DWORD* in/out
, "UInt") ; return: DWORD●McastEnumerateScopes(AddrFamily, ReQuery, pScopeList, pScopeLen, pScopeCount) = DLL("dhcpcsvc.dll", "dword McastEnumerateScopes(int, bool, void*, void*, void*)")
# 呼び出し: McastEnumerateScopes(AddrFamily, ReQuery, pScopeList, pScopeLen, pScopeCount)
# AddrFamily : WORD -> "int"
# ReQuery : BOOL -> "bool"
# pScopeList : MCAST_SCOPE_ENTRY* in/out -> "void*"
# pScopeLen : DWORD* in/out -> "void*"
# pScopeCount : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。