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

WlanGetSupportedDeviceServices

関数
インターフェイスが対応するデバイスサービスの一覧を取得する。
DLLwlanapi.dll呼出規約winapi

シグネチャ

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

DWORD WlanGetSupportedDeviceServices(
    HANDLE hClientHandle,
    const GUID* pInterfaceGuid,
    WLAN_DEVICE_SERVICE_GUID_LIST** ppDevSvcGuidList
);

パラメーター

名前方向説明
hClientHandleHANDLEinWlanOpenHandleで取得したクライアントセッションのハンドル。
pInterfaceGuidGUID*in対象の無線LANインターフェースを識別するGUIDへのポインター。
ppDevSvcGuidListWLAN_DEVICE_SERVICE_GUID_LIST**outサポートされるデバイスサービスGUID一覧を受け取るポインター。WlanFreeMemoryで解放する。

戻り値の型: DWORD

各言語での呼び出し定義

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

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

WlanGetSupportedDeviceServices = ctypes.windll.wlanapi.WlanGetSupportedDeviceServices
WlanGetSupportedDeviceServices.restype = wintypes.DWORD
WlanGetSupportedDeviceServices.argtypes = [
    wintypes.HANDLE,  # hClientHandle : HANDLE
    ctypes.c_void_p,  # pInterfaceGuid : GUID*
    ctypes.c_void_p,  # ppDevSvcGuidList : WLAN_DEVICE_SERVICE_GUID_LIST** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wlanapi = windows.NewLazySystemDLL("wlanapi.dll")
	procWlanGetSupportedDeviceServices = wlanapi.NewProc("WlanGetSupportedDeviceServices")
)

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

extern "wlanapi" fn WlanGetSupportedDeviceServices(
    hClientHandle: ?*anyopaque, // HANDLE
    pInterfaceGuid: [*c]GUID, // GUID*
    ppDevSvcGuidList: [*c][*c]WLAN_DEVICE_SERVICE_GUID_LIST // WLAN_DEVICE_SERVICE_GUID_LIST** out
) callconv(std.os.windows.WINAPI) u32;
proc WlanGetSupportedDeviceServices(
    hClientHandle: pointer,  # HANDLE
    pInterfaceGuid: ptr GUID,  # GUID*
    ppDevSvcGuidList: ptr WLAN_DEVICE_SERVICE_GUID_LIST  # WLAN_DEVICE_SERVICE_GUID_LIST** out
): uint32 {.importc: "WlanGetSupportedDeviceServices", stdcall, dynlib: "wlanapi.dll".}
pragma(lib, "wlanapi");
extern(Windows)
uint WlanGetSupportedDeviceServices(
    void* hClientHandle,   // HANDLE
    GUID* pInterfaceGuid,   // GUID*
    WLAN_DEVICE_SERVICE_GUID_LIST** ppDevSvcGuidList   // WLAN_DEVICE_SERVICE_GUID_LIST** out
);
ccall((:WlanGetSupportedDeviceServices, "wlanapi.dll"), stdcall, UInt32,
      (Ptr{Cvoid}, Ptr{GUID}, Ptr{WLAN_DEVICE_SERVICE_GUID_LIST}),
      hClientHandle, pInterfaceGuid, ppDevSvcGuidList)
# hClientHandle : HANDLE -> Ptr{Cvoid}
# pInterfaceGuid : GUID* -> Ptr{GUID}
# ppDevSvcGuidList : WLAN_DEVICE_SERVICE_GUID_LIST** out -> Ptr{WLAN_DEVICE_SERVICE_GUID_LIST}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t WlanGetSupportedDeviceServices(
    void* hClientHandle,
    void* pInterfaceGuid,
    void* ppDevSvcGuidList);
]]
local wlanapi = ffi.load("wlanapi")
-- wlanapi.WlanGetSupportedDeviceServices(hClientHandle, pInterfaceGuid, ppDevSvcGuidList)
-- hClientHandle : HANDLE
-- pInterfaceGuid : GUID*
-- ppDevSvcGuidList : WLAN_DEVICE_SERVICE_GUID_LIST** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('wlanapi.dll');
const WlanGetSupportedDeviceServices = lib.func('__stdcall', 'WlanGetSupportedDeviceServices', 'uint32_t', ['void *', 'void *', 'void *']);
// WlanGetSupportedDeviceServices(hClientHandle, pInterfaceGuid, ppDevSvcGuidList)
// hClientHandle : HANDLE -> 'void *'
// pInterfaceGuid : GUID* -> 'void *'
// ppDevSvcGuidList : WLAN_DEVICE_SERVICE_GUID_LIST** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("wlanapi.dll", {
  WlanGetSupportedDeviceServices: { parameters: ["pointer", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.WlanGetSupportedDeviceServices(hClientHandle, pInterfaceGuid, ppDevSvcGuidList)
// hClientHandle : HANDLE -> "pointer"
// pInterfaceGuid : GUID* -> "pointer"
// ppDevSvcGuidList : WLAN_DEVICE_SERVICE_GUID_LIST** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t WlanGetSupportedDeviceServices(
    void* hClientHandle,
    void* pInterfaceGuid,
    void* ppDevSvcGuidList);
C, "wlanapi.dll");
// $ffi->WlanGetSupportedDeviceServices(hClientHandle, pInterfaceGuid, ppDevSvcGuidList);
// hClientHandle : HANDLE
// pInterfaceGuid : GUID*
// ppDevSvcGuidList : WLAN_DEVICE_SERVICE_GUID_LIST** out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Wlanapi extends StdCallLibrary {
    Wlanapi INSTANCE = Native.load("wlanapi", Wlanapi.class);
    int WlanGetSupportedDeviceServices(
        Pointer hClientHandle,   // HANDLE
        Pointer pInterfaceGuid,   // GUID*
        Pointer ppDevSvcGuidList   // WLAN_DEVICE_SERVICE_GUID_LIST** out
    );
}
@[Link("wlanapi")]
lib Libwlanapi
  fun WlanGetSupportedDeviceServices = WlanGetSupportedDeviceServices(
    hClientHandle : Void*,   # HANDLE
    pInterfaceGuid : GUID*,   # GUID*
    ppDevSvcGuidList : WLAN_DEVICE_SERVICE_GUID_LIST**   # WLAN_DEVICE_SERVICE_GUID_LIST** out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef WlanGetSupportedDeviceServicesNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef WlanGetSupportedDeviceServicesDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
final WlanGetSupportedDeviceServices = DynamicLibrary.open('wlanapi.dll')
    .lookupFunction<WlanGetSupportedDeviceServicesNative, WlanGetSupportedDeviceServicesDart>('WlanGetSupportedDeviceServices');
// hClientHandle : HANDLE -> Pointer<Void>
// pInterfaceGuid : GUID* -> Pointer<Void>
// ppDevSvcGuidList : WLAN_DEVICE_SERVICE_GUID_LIST** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function WlanGetSupportedDeviceServices(
  hClientHandle: THandle;   // HANDLE
  pInterfaceGuid: PGUID;   // GUID*
  ppDevSvcGuidList: Pointer   // WLAN_DEVICE_SERVICE_GUID_LIST** out
): DWORD; stdcall;
  external 'wlanapi.dll' name 'WlanGetSupportedDeviceServices';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WlanGetSupportedDeviceServices"
  c_WlanGetSupportedDeviceServices :: Ptr () -> Ptr () -> Ptr () -> IO Word32
-- hClientHandle : HANDLE -> Ptr ()
-- pInterfaceGuid : GUID* -> Ptr ()
-- ppDevSvcGuidList : WLAN_DEVICE_SERVICE_GUID_LIST** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let wlangetsupporteddeviceservices =
  foreign "WlanGetSupportedDeviceServices"
    ((ptr void) @-> (ptr void) @-> (ptr void) @-> returning uint32_t)
(* hClientHandle : HANDLE -> (ptr void) *)
(* pInterfaceGuid : GUID* -> (ptr void) *)
(* ppDevSvcGuidList : WLAN_DEVICE_SERVICE_GUID_LIST** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wlanapi (t "wlanapi.dll"))
(cffi:use-foreign-library wlanapi)

(cffi:defcfun ("WlanGetSupportedDeviceServices" wlan-get-supported-device-services :convention :stdcall) :uint32
  (h-client-handle :pointer)   ; HANDLE
  (p-interface-guid :pointer)   ; GUID*
  (pp-dev-svc-guid-list :pointer))   ; WLAN_DEVICE_SERVICE_GUID_LIST** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WlanGetSupportedDeviceServices = Win32::API::More->new('wlanapi',
    'DWORD WlanGetSupportedDeviceServices(HANDLE hClientHandle, LPVOID pInterfaceGuid, LPVOID ppDevSvcGuidList)');
# my $ret = $WlanGetSupportedDeviceServices->Call($hClientHandle, $pInterfaceGuid, $ppDevSvcGuidList);
# hClientHandle : HANDLE -> HANDLE
# pInterfaceGuid : GUID* -> LPVOID
# ppDevSvcGuidList : WLAN_DEVICE_SERVICE_GUID_LIST** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型