ホーム › NetworkManagement.WiFi › WlanGetNetworkBssList
WlanGetNetworkBssList
関数指定SSIDの無線LAN BSS(基地局)一覧を取得する。
シグネチャ
// wlanapi.dll
#include <windows.h>
DWORD WlanGetNetworkBssList(
HANDLE hClientHandle,
const GUID* pInterfaceGuid,
const DOT11_SSID* pDot11Ssid, // optional
DOT11_BSS_TYPE dot11BssType,
BOOL bSecurityEnabled,
void* pReserved, // optional
WLAN_BSS_LIST** ppWlanBssList
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hClientHandle | HANDLE | in |
| pInterfaceGuid | GUID* | in |
| pDot11Ssid | DOT11_SSID* | inoptional |
| dot11BssType | DOT11_BSS_TYPE | in |
| bSecurityEnabled | BOOL | in |
| pReserved | void* | optional |
| ppWlanBssList | WLAN_BSS_LIST** | out |
戻り値の型: DWORD
各言語での呼び出し定義
// wlanapi.dll
#include <windows.h>
DWORD WlanGetNetworkBssList(
HANDLE hClientHandle,
const GUID* pInterfaceGuid,
const DOT11_SSID* pDot11Ssid, // optional
DOT11_BSS_TYPE dot11BssType,
BOOL bSecurityEnabled,
void* pReserved, // optional
WLAN_BSS_LIST** ppWlanBssList
);[DllImport("wlanapi.dll", ExactSpelling = true)]
static extern uint WlanGetNetworkBssList(
IntPtr hClientHandle, // HANDLE
ref Guid pInterfaceGuid, // GUID*
IntPtr pDot11Ssid, // DOT11_SSID* optional
int dot11BssType, // DOT11_BSS_TYPE
bool bSecurityEnabled, // BOOL
IntPtr pReserved, // void* optional
IntPtr ppWlanBssList // WLAN_BSS_LIST** out
);<DllImport("wlanapi.dll", ExactSpelling:=True)>
Public Shared Function WlanGetNetworkBssList(
hClientHandle As IntPtr, ' HANDLE
ByRef pInterfaceGuid As Guid, ' GUID*
pDot11Ssid As IntPtr, ' DOT11_SSID* optional
dot11BssType As Integer, ' DOT11_BSS_TYPE
bSecurityEnabled As Boolean, ' BOOL
pReserved As IntPtr, ' void* optional
ppWlanBssList As IntPtr ' WLAN_BSS_LIST** out
) As UInteger
End Function' hClientHandle : HANDLE
' pInterfaceGuid : GUID*
' pDot11Ssid : DOT11_SSID* optional
' dot11BssType : DOT11_BSS_TYPE
' bSecurityEnabled : BOOL
' pReserved : void* optional
' ppWlanBssList : WLAN_BSS_LIST** out
Declare PtrSafe Function WlanGetNetworkBssList Lib "wlanapi" ( _
ByVal hClientHandle As LongPtr, _
ByVal pInterfaceGuid As LongPtr, _
ByVal pDot11Ssid As LongPtr, _
ByVal dot11BssType As Long, _
ByVal bSecurityEnabled As Long, _
ByVal pReserved As LongPtr, _
ByVal ppWlanBssList As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WlanGetNetworkBssList = ctypes.windll.wlanapi.WlanGetNetworkBssList
WlanGetNetworkBssList.restype = wintypes.DWORD
WlanGetNetworkBssList.argtypes = [
wintypes.HANDLE, # hClientHandle : HANDLE
ctypes.c_void_p, # pInterfaceGuid : GUID*
ctypes.c_void_p, # pDot11Ssid : DOT11_SSID* optional
ctypes.c_int, # dot11BssType : DOT11_BSS_TYPE
wintypes.BOOL, # bSecurityEnabled : BOOL
ctypes.POINTER(None), # pReserved : void* optional
ctypes.c_void_p, # ppWlanBssList : WLAN_BSS_LIST** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('wlanapi.dll')
WlanGetNetworkBssList = Fiddle::Function.new(
lib['WlanGetNetworkBssList'],
[
Fiddle::TYPE_VOIDP, # hClientHandle : HANDLE
Fiddle::TYPE_VOIDP, # pInterfaceGuid : GUID*
Fiddle::TYPE_VOIDP, # pDot11Ssid : DOT11_SSID* optional
Fiddle::TYPE_INT, # dot11BssType : DOT11_BSS_TYPE
Fiddle::TYPE_INT, # bSecurityEnabled : BOOL
Fiddle::TYPE_VOIDP, # pReserved : void* optional
Fiddle::TYPE_VOIDP, # ppWlanBssList : WLAN_BSS_LIST** out
],
-Fiddle::TYPE_INT)#[link(name = "wlanapi")]
extern "system" {
fn WlanGetNetworkBssList(
hClientHandle: *mut core::ffi::c_void, // HANDLE
pInterfaceGuid: *const GUID, // GUID*
pDot11Ssid: *const DOT11_SSID, // DOT11_SSID* optional
dot11BssType: i32, // DOT11_BSS_TYPE
bSecurityEnabled: i32, // BOOL
pReserved: *mut (), // void* optional
ppWlanBssList: *mut *mut WLAN_BSS_LIST // WLAN_BSS_LIST** out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("wlanapi.dll")]
public static extern uint WlanGetNetworkBssList(IntPtr hClientHandle, ref Guid pInterfaceGuid, IntPtr pDot11Ssid, int dot11BssType, bool bSecurityEnabled, IntPtr pReserved, IntPtr ppWlanBssList);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wlanapi_WlanGetNetworkBssList' -Namespace Win32 -PassThru
# $api::WlanGetNetworkBssList(hClientHandle, pInterfaceGuid, pDot11Ssid, dot11BssType, bSecurityEnabled, pReserved, ppWlanBssList)#uselib "wlanapi.dll"
#func global WlanGetNetworkBssList "WlanGetNetworkBssList" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; WlanGetNetworkBssList hClientHandle, varptr(pInterfaceGuid), varptr(pDot11Ssid), dot11BssType, bSecurityEnabled, pReserved, varptr(ppWlanBssList) ; 戻り値は stat
; hClientHandle : HANDLE -> "sptr"
; pInterfaceGuid : GUID* -> "sptr"
; pDot11Ssid : DOT11_SSID* optional -> "sptr"
; dot11BssType : DOT11_BSS_TYPE -> "sptr"
; bSecurityEnabled : BOOL -> "sptr"
; pReserved : void* optional -> "sptr"
; ppWlanBssList : WLAN_BSS_LIST** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "wlanapi.dll" #cfunc global WlanGetNetworkBssList "WlanGetNetworkBssList" sptr, var, var, int, int, sptr, var ; res = WlanGetNetworkBssList(hClientHandle, pInterfaceGuid, pDot11Ssid, dot11BssType, bSecurityEnabled, pReserved, ppWlanBssList) ; hClientHandle : HANDLE -> "sptr" ; pInterfaceGuid : GUID* -> "var" ; pDot11Ssid : DOT11_SSID* optional -> "var" ; dot11BssType : DOT11_BSS_TYPE -> "int" ; bSecurityEnabled : BOOL -> "int" ; pReserved : void* optional -> "sptr" ; ppWlanBssList : WLAN_BSS_LIST** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "wlanapi.dll" #cfunc global WlanGetNetworkBssList "WlanGetNetworkBssList" sptr, sptr, sptr, int, int, sptr, sptr ; res = WlanGetNetworkBssList(hClientHandle, varptr(pInterfaceGuid), varptr(pDot11Ssid), dot11BssType, bSecurityEnabled, pReserved, varptr(ppWlanBssList)) ; hClientHandle : HANDLE -> "sptr" ; pInterfaceGuid : GUID* -> "sptr" ; pDot11Ssid : DOT11_SSID* optional -> "sptr" ; dot11BssType : DOT11_BSS_TYPE -> "int" ; bSecurityEnabled : BOOL -> "int" ; pReserved : void* optional -> "sptr" ; ppWlanBssList : WLAN_BSS_LIST** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD WlanGetNetworkBssList(HANDLE hClientHandle, GUID* pInterfaceGuid, DOT11_SSID* pDot11Ssid, DOT11_BSS_TYPE dot11BssType, BOOL bSecurityEnabled, void* pReserved, WLAN_BSS_LIST** ppWlanBssList) #uselib "wlanapi.dll" #cfunc global WlanGetNetworkBssList "WlanGetNetworkBssList" intptr, var, var, int, int, intptr, var ; res = WlanGetNetworkBssList(hClientHandle, pInterfaceGuid, pDot11Ssid, dot11BssType, bSecurityEnabled, pReserved, ppWlanBssList) ; hClientHandle : HANDLE -> "intptr" ; pInterfaceGuid : GUID* -> "var" ; pDot11Ssid : DOT11_SSID* optional -> "var" ; dot11BssType : DOT11_BSS_TYPE -> "int" ; bSecurityEnabled : BOOL -> "int" ; pReserved : void* optional -> "intptr" ; ppWlanBssList : WLAN_BSS_LIST** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD WlanGetNetworkBssList(HANDLE hClientHandle, GUID* pInterfaceGuid, DOT11_SSID* pDot11Ssid, DOT11_BSS_TYPE dot11BssType, BOOL bSecurityEnabled, void* pReserved, WLAN_BSS_LIST** ppWlanBssList) #uselib "wlanapi.dll" #cfunc global WlanGetNetworkBssList "WlanGetNetworkBssList" intptr, intptr, intptr, int, int, intptr, intptr ; res = WlanGetNetworkBssList(hClientHandle, varptr(pInterfaceGuid), varptr(pDot11Ssid), dot11BssType, bSecurityEnabled, pReserved, varptr(ppWlanBssList)) ; hClientHandle : HANDLE -> "intptr" ; pInterfaceGuid : GUID* -> "intptr" ; pDot11Ssid : DOT11_SSID* optional -> "intptr" ; dot11BssType : DOT11_BSS_TYPE -> "int" ; bSecurityEnabled : BOOL -> "int" ; pReserved : void* optional -> "intptr" ; ppWlanBssList : WLAN_BSS_LIST** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wlanapi = windows.NewLazySystemDLL("wlanapi.dll")
procWlanGetNetworkBssList = wlanapi.NewProc("WlanGetNetworkBssList")
)
// hClientHandle (HANDLE), pInterfaceGuid (GUID*), pDot11Ssid (DOT11_SSID* optional), dot11BssType (DOT11_BSS_TYPE), bSecurityEnabled (BOOL), pReserved (void* optional), ppWlanBssList (WLAN_BSS_LIST** out)
r1, _, err := procWlanGetNetworkBssList.Call(
uintptr(hClientHandle),
uintptr(pInterfaceGuid),
uintptr(pDot11Ssid),
uintptr(dot11BssType),
uintptr(bSecurityEnabled),
uintptr(pReserved),
uintptr(ppWlanBssList),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction WlanGetNetworkBssList(
hClientHandle: THandle; // HANDLE
pInterfaceGuid: PGUID; // GUID*
pDot11Ssid: Pointer; // DOT11_SSID* optional
dot11BssType: Integer; // DOT11_BSS_TYPE
bSecurityEnabled: BOOL; // BOOL
pReserved: Pointer; // void* optional
ppWlanBssList: Pointer // WLAN_BSS_LIST** out
): DWORD; stdcall;
external 'wlanapi.dll' name 'WlanGetNetworkBssList';result := DllCall("wlanapi\WlanGetNetworkBssList"
, "Ptr", hClientHandle ; HANDLE
, "Ptr", pInterfaceGuid ; GUID*
, "Ptr", pDot11Ssid ; DOT11_SSID* optional
, "Int", dot11BssType ; DOT11_BSS_TYPE
, "Int", bSecurityEnabled ; BOOL
, "Ptr", pReserved ; void* optional
, "Ptr", ppWlanBssList ; WLAN_BSS_LIST** out
, "UInt") ; return: DWORD●WlanGetNetworkBssList(hClientHandle, pInterfaceGuid, pDot11Ssid, dot11BssType, bSecurityEnabled, pReserved, ppWlanBssList) = DLL("wlanapi.dll", "dword WlanGetNetworkBssList(void*, void*, void*, int, bool, void*, void*)")
# 呼び出し: WlanGetNetworkBssList(hClientHandle, pInterfaceGuid, pDot11Ssid, dot11BssType, bSecurityEnabled, pReserved, ppWlanBssList)
# hClientHandle : HANDLE -> "void*"
# pInterfaceGuid : GUID* -> "void*"
# pDot11Ssid : DOT11_SSID* optional -> "void*"
# dot11BssType : DOT11_BSS_TYPE -> "int"
# bSecurityEnabled : BOOL -> "bool"
# pReserved : void* optional -> "void*"
# ppWlanBssList : WLAN_BSS_LIST** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。