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

WlanSetProfileList

関数
無線LANプロファイルの優先順位リストを設定する。
DLLwlanapi.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD WlanSetProfileList(
    HANDLE hClientHandle,
    const GUID* pInterfaceGuid,
    DWORD dwItems,
    LPCWSTR* strProfileNames,
    void* pReserved   // optional
);

パラメーター

名前方向
hClientHandleHANDLEin
pInterfaceGuidGUID*in
dwItemsDWORDin
strProfileNamesLPCWSTR*in
pReservedvoid*optional

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD WlanSetProfileList(
    HANDLE hClientHandle,
    const GUID* pInterfaceGuid,
    DWORD dwItems,
    LPCWSTR* strProfileNames,
    void* pReserved   // optional
);
[DllImport("wlanapi.dll", ExactSpelling = true)]
static extern uint WlanSetProfileList(
    IntPtr hClientHandle,   // HANDLE
    ref Guid pInterfaceGuid,   // GUID*
    uint dwItems,   // DWORD
    IntPtr strProfileNames,   // LPCWSTR*
    IntPtr pReserved   // void* optional
);
<DllImport("wlanapi.dll", ExactSpelling:=True)>
Public Shared Function WlanSetProfileList(
    hClientHandle As IntPtr,   ' HANDLE
    ByRef pInterfaceGuid As Guid,   ' GUID*
    dwItems As UInteger,   ' DWORD
    strProfileNames As IntPtr,   ' LPCWSTR*
    pReserved As IntPtr   ' void* optional
) As UInteger
End Function
' hClientHandle : HANDLE
' pInterfaceGuid : GUID*
' dwItems : DWORD
' strProfileNames : LPCWSTR*
' pReserved : void* optional
Declare PtrSafe Function WlanSetProfileList Lib "wlanapi" ( _
    ByVal hClientHandle As LongPtr, _
    ByVal pInterfaceGuid As LongPtr, _
    ByVal dwItems As Long, _
    ByVal strProfileNames As LongPtr, _
    ByVal pReserved As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WlanSetProfileList = ctypes.windll.wlanapi.WlanSetProfileList
WlanSetProfileList.restype = wintypes.DWORD
WlanSetProfileList.argtypes = [
    wintypes.HANDLE,  # hClientHandle : HANDLE
    ctypes.c_void_p,  # pInterfaceGuid : GUID*
    wintypes.DWORD,  # dwItems : DWORD
    ctypes.c_void_p,  # strProfileNames : LPCWSTR*
    ctypes.POINTER(None),  # pReserved : void* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wlanapi.dll')
WlanSetProfileList = Fiddle::Function.new(
  lib['WlanSetProfileList'],
  [
    Fiddle::TYPE_VOIDP,  # hClientHandle : HANDLE
    Fiddle::TYPE_VOIDP,  # pInterfaceGuid : GUID*
    -Fiddle::TYPE_INT,  # dwItems : DWORD
    Fiddle::TYPE_VOIDP,  # strProfileNames : LPCWSTR*
    Fiddle::TYPE_VOIDP,  # pReserved : void* optional
  ],
  -Fiddle::TYPE_INT)
#[link(name = "wlanapi")]
extern "system" {
    fn WlanSetProfileList(
        hClientHandle: *mut core::ffi::c_void,  // HANDLE
        pInterfaceGuid: *const GUID,  // GUID*
        dwItems: u32,  // DWORD
        strProfileNames: *const *const u16,  // LPCWSTR*
        pReserved: *mut ()  // void* optional
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("wlanapi.dll")]
public static extern uint WlanSetProfileList(IntPtr hClientHandle, ref Guid pInterfaceGuid, uint dwItems, IntPtr strProfileNames, IntPtr pReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wlanapi_WlanSetProfileList' -Namespace Win32 -PassThru
# $api::WlanSetProfileList(hClientHandle, pInterfaceGuid, dwItems, strProfileNames, pReserved)
#uselib "wlanapi.dll"
#func global WlanSetProfileList "WlanSetProfileList" sptr, sptr, sptr, sptr, sptr
; WlanSetProfileList hClientHandle, varptr(pInterfaceGuid), dwItems, varptr(strProfileNames), pReserved   ; 戻り値は stat
; hClientHandle : HANDLE -> "sptr"
; pInterfaceGuid : GUID* -> "sptr"
; dwItems : DWORD -> "sptr"
; strProfileNames : LPCWSTR* -> "sptr"
; pReserved : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "wlanapi.dll"
#cfunc global WlanSetProfileList "WlanSetProfileList" sptr, var, int, var, sptr
; res = WlanSetProfileList(hClientHandle, pInterfaceGuid, dwItems, strProfileNames, pReserved)
; hClientHandle : HANDLE -> "sptr"
; pInterfaceGuid : GUID* -> "var"
; dwItems : DWORD -> "int"
; strProfileNames : LPCWSTR* -> "var"
; pReserved : void* optional -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD WlanSetProfileList(HANDLE hClientHandle, GUID* pInterfaceGuid, DWORD dwItems, LPCWSTR* strProfileNames, void* pReserved)
#uselib "wlanapi.dll"
#cfunc global WlanSetProfileList "WlanSetProfileList" intptr, var, int, var, intptr
; res = WlanSetProfileList(hClientHandle, pInterfaceGuid, dwItems, strProfileNames, pReserved)
; hClientHandle : HANDLE -> "intptr"
; pInterfaceGuid : GUID* -> "var"
; dwItems : DWORD -> "int"
; strProfileNames : LPCWSTR* -> "var"
; pReserved : void* optional -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wlanapi = windows.NewLazySystemDLL("wlanapi.dll")
	procWlanSetProfileList = wlanapi.NewProc("WlanSetProfileList")
)

// hClientHandle (HANDLE), pInterfaceGuid (GUID*), dwItems (DWORD), strProfileNames (LPCWSTR*), pReserved (void* optional)
r1, _, err := procWlanSetProfileList.Call(
	uintptr(hClientHandle),
	uintptr(pInterfaceGuid),
	uintptr(dwItems),
	uintptr(strProfileNames),
	uintptr(pReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function WlanSetProfileList(
  hClientHandle: THandle;   // HANDLE
  pInterfaceGuid: PGUID;   // GUID*
  dwItems: DWORD;   // DWORD
  strProfileNames: PPWideChar;   // LPCWSTR*
  pReserved: Pointer   // void* optional
): DWORD; stdcall;
  external 'wlanapi.dll' name 'WlanSetProfileList';
result := DllCall("wlanapi\WlanSetProfileList"
    , "Ptr", hClientHandle   ; HANDLE
    , "Ptr", pInterfaceGuid   ; GUID*
    , "UInt", dwItems   ; DWORD
    , "Ptr", strProfileNames   ; LPCWSTR*
    , "Ptr", pReserved   ; void* optional
    , "UInt")   ; return: DWORD
●WlanSetProfileList(hClientHandle, pInterfaceGuid, dwItems, strProfileNames, pReserved) = DLL("wlanapi.dll", "dword WlanSetProfileList(void*, void*, dword, void*, void*)")
# 呼び出し: WlanSetProfileList(hClientHandle, pInterfaceGuid, dwItems, strProfileNames, pReserved)
# hClientHandle : HANDLE -> "void*"
# pInterfaceGuid : GUID* -> "void*"
# dwItems : DWORD -> "dword"
# strProfileNames : LPCWSTR* -> "void*"
# pReserved : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。