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