ホーム › NetworkManagement.WiFi › WlanRegisterVirtualStationNotification
WlanRegisterVirtualStationNotification
関数仮想ステーションの通知登録または解除を行う。
シグネチャ
// wlanapi.dll
#include <windows.h>
DWORD WlanRegisterVirtualStationNotification(
HANDLE hClientHandle,
BOOL bRegister,
void* pReserved // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hClientHandle | HANDLE | in | WlanOpenHandleで取得したクライアントセッションのハンドル。 |
| bRegister | BOOL | in | TRUEで仮想ステーション通知を登録、FALSEで登録解除する。 |
| pReserved | void* | optional | 予約領域。NULLを指定する必要がある。 |
戻り値の型: DWORD
各言語での呼び出し定義
// wlanapi.dll
#include <windows.h>
DWORD WlanRegisterVirtualStationNotification(
HANDLE hClientHandle,
BOOL bRegister,
void* pReserved // optional
);[DllImport("wlanapi.dll", ExactSpelling = true)]
static extern uint WlanRegisterVirtualStationNotification(
IntPtr hClientHandle, // HANDLE
bool bRegister, // BOOL
IntPtr pReserved // void* optional
);<DllImport("wlanapi.dll", ExactSpelling:=True)>
Public Shared Function WlanRegisterVirtualStationNotification(
hClientHandle As IntPtr, ' HANDLE
bRegister As Boolean, ' BOOL
pReserved As IntPtr ' void* optional
) As UInteger
End Function' hClientHandle : HANDLE
' bRegister : BOOL
' pReserved : void* optional
Declare PtrSafe Function WlanRegisterVirtualStationNotification Lib "wlanapi" ( _
ByVal hClientHandle As LongPtr, _
ByVal bRegister As Long, _
ByVal pReserved As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WlanRegisterVirtualStationNotification = ctypes.windll.wlanapi.WlanRegisterVirtualStationNotification
WlanRegisterVirtualStationNotification.restype = wintypes.DWORD
WlanRegisterVirtualStationNotification.argtypes = [
wintypes.HANDLE, # hClientHandle : HANDLE
wintypes.BOOL, # bRegister : BOOL
ctypes.POINTER(None), # pReserved : void* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('wlanapi.dll')
WlanRegisterVirtualStationNotification = Fiddle::Function.new(
lib['WlanRegisterVirtualStationNotification'],
[
Fiddle::TYPE_VOIDP, # hClientHandle : HANDLE
Fiddle::TYPE_INT, # bRegister : BOOL
Fiddle::TYPE_VOIDP, # pReserved : void* optional
],
-Fiddle::TYPE_INT)#[link(name = "wlanapi")]
extern "system" {
fn WlanRegisterVirtualStationNotification(
hClientHandle: *mut core::ffi::c_void, // HANDLE
bRegister: i32, // BOOL
pReserved: *mut () // void* optional
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("wlanapi.dll")]
public static extern uint WlanRegisterVirtualStationNotification(IntPtr hClientHandle, bool bRegister, IntPtr pReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wlanapi_WlanRegisterVirtualStationNotification' -Namespace Win32 -PassThru
# $api::WlanRegisterVirtualStationNotification(hClientHandle, bRegister, pReserved)#uselib "wlanapi.dll"
#func global WlanRegisterVirtualStationNotification "WlanRegisterVirtualStationNotification" sptr, sptr, sptr
; WlanRegisterVirtualStationNotification hClientHandle, bRegister, pReserved ; 戻り値は stat
; hClientHandle : HANDLE -> "sptr"
; bRegister : BOOL -> "sptr"
; pReserved : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "wlanapi.dll"
#cfunc global WlanRegisterVirtualStationNotification "WlanRegisterVirtualStationNotification" sptr, int, sptr
; res = WlanRegisterVirtualStationNotification(hClientHandle, bRegister, pReserved)
; hClientHandle : HANDLE -> "sptr"
; bRegister : BOOL -> "int"
; pReserved : void* optional -> "sptr"; DWORD WlanRegisterVirtualStationNotification(HANDLE hClientHandle, BOOL bRegister, void* pReserved)
#uselib "wlanapi.dll"
#cfunc global WlanRegisterVirtualStationNotification "WlanRegisterVirtualStationNotification" intptr, int, intptr
; res = WlanRegisterVirtualStationNotification(hClientHandle, bRegister, pReserved)
; hClientHandle : HANDLE -> "intptr"
; bRegister : BOOL -> "int"
; pReserved : void* optional -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wlanapi = windows.NewLazySystemDLL("wlanapi.dll")
procWlanRegisterVirtualStationNotification = wlanapi.NewProc("WlanRegisterVirtualStationNotification")
)
// hClientHandle (HANDLE), bRegister (BOOL), pReserved (void* optional)
r1, _, err := procWlanRegisterVirtualStationNotification.Call(
uintptr(hClientHandle),
uintptr(bRegister),
uintptr(pReserved),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction WlanRegisterVirtualStationNotification(
hClientHandle: THandle; // HANDLE
bRegister: BOOL; // BOOL
pReserved: Pointer // void* optional
): DWORD; stdcall;
external 'wlanapi.dll' name 'WlanRegisterVirtualStationNotification';result := DllCall("wlanapi\WlanRegisterVirtualStationNotification"
, "Ptr", hClientHandle ; HANDLE
, "Int", bRegister ; BOOL
, "Ptr", pReserved ; void* optional
, "UInt") ; return: DWORD●WlanRegisterVirtualStationNotification(hClientHandle, bRegister, pReserved) = DLL("wlanapi.dll", "dword WlanRegisterVirtualStationNotification(void*, bool, void*)")
# 呼び出し: WlanRegisterVirtualStationNotification(hClientHandle, bRegister, pReserved)
# hClientHandle : HANDLE -> "void*"
# bRegister : BOOL -> "bool"
# pReserved : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "wlanapi" fn WlanRegisterVirtualStationNotification(
hClientHandle: ?*anyopaque, // HANDLE
bRegister: i32, // BOOL
pReserved: ?*anyopaque // void* optional
) callconv(std.os.windows.WINAPI) u32;proc WlanRegisterVirtualStationNotification(
hClientHandle: pointer, # HANDLE
bRegister: int32, # BOOL
pReserved: pointer # void* optional
): uint32 {.importc: "WlanRegisterVirtualStationNotification", stdcall, dynlib: "wlanapi.dll".}pragma(lib, "wlanapi");
extern(Windows)
uint WlanRegisterVirtualStationNotification(
void* hClientHandle, // HANDLE
int bRegister, // BOOL
void* pReserved // void* optional
);ccall((:WlanRegisterVirtualStationNotification, "wlanapi.dll"), stdcall, UInt32,
(Ptr{Cvoid}, Int32, Ptr{Cvoid}),
hClientHandle, bRegister, pReserved)
# hClientHandle : HANDLE -> Ptr{Cvoid}
# bRegister : BOOL -> Int32
# pReserved : void* optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t WlanRegisterVirtualStationNotification(
void* hClientHandle,
int32_t bRegister,
void* pReserved);
]]
local wlanapi = ffi.load("wlanapi")
-- wlanapi.WlanRegisterVirtualStationNotification(hClientHandle, bRegister, pReserved)
-- hClientHandle : HANDLE
-- bRegister : BOOL
-- pReserved : void* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('wlanapi.dll');
const WlanRegisterVirtualStationNotification = lib.func('__stdcall', 'WlanRegisterVirtualStationNotification', 'uint32_t', ['void *', 'int32_t', 'void *']);
// WlanRegisterVirtualStationNotification(hClientHandle, bRegister, pReserved)
// hClientHandle : HANDLE -> 'void *'
// bRegister : BOOL -> 'int32_t'
// pReserved : void* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("wlanapi.dll", {
WlanRegisterVirtualStationNotification: { parameters: ["pointer", "i32", "pointer"], result: "u32" },
});
// lib.symbols.WlanRegisterVirtualStationNotification(hClientHandle, bRegister, pReserved)
// hClientHandle : HANDLE -> "pointer"
// bRegister : BOOL -> "i32"
// pReserved : void* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t WlanRegisterVirtualStationNotification(
void* hClientHandle,
int32_t bRegister,
void* pReserved);
C, "wlanapi.dll");
// $ffi->WlanRegisterVirtualStationNotification(hClientHandle, bRegister, pReserved);
// hClientHandle : HANDLE
// bRegister : BOOL
// pReserved : void* optional
// 構造体/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 WlanRegisterVirtualStationNotification(
Pointer hClientHandle, // HANDLE
boolean bRegister, // BOOL
Pointer pReserved // void* optional
);
}@[Link("wlanapi")]
lib Libwlanapi
fun WlanRegisterVirtualStationNotification = WlanRegisterVirtualStationNotification(
hClientHandle : Void*, # HANDLE
bRegister : Int32, # BOOL
pReserved : Void* # void* optional
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef WlanRegisterVirtualStationNotificationNative = Uint32 Function(Pointer<Void>, Int32, Pointer<Void>);
typedef WlanRegisterVirtualStationNotificationDart = int Function(Pointer<Void>, int, Pointer<Void>);
final WlanRegisterVirtualStationNotification = DynamicLibrary.open('wlanapi.dll')
.lookupFunction<WlanRegisterVirtualStationNotificationNative, WlanRegisterVirtualStationNotificationDart>('WlanRegisterVirtualStationNotification');
// hClientHandle : HANDLE -> Pointer<Void>
// bRegister : BOOL -> Int32
// pReserved : void* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function WlanRegisterVirtualStationNotification(
hClientHandle: THandle; // HANDLE
bRegister: BOOL; // BOOL
pReserved: Pointer // void* optional
): DWORD; stdcall;
external 'wlanapi.dll' name 'WlanRegisterVirtualStationNotification';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "WlanRegisterVirtualStationNotification"
c_WlanRegisterVirtualStationNotification :: Ptr () -> CInt -> Ptr () -> IO Word32
-- hClientHandle : HANDLE -> Ptr ()
-- bRegister : BOOL -> CInt
-- pReserved : void* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let wlanregistervirtualstationnotification =
foreign "WlanRegisterVirtualStationNotification"
((ptr void) @-> int32_t @-> (ptr void) @-> returning uint32_t)
(* hClientHandle : HANDLE -> (ptr void) *)
(* bRegister : BOOL -> int32_t *)
(* pReserved : void* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wlanapi (t "wlanapi.dll"))
(cffi:use-foreign-library wlanapi)
(cffi:defcfun ("WlanRegisterVirtualStationNotification" wlan-register-virtual-station-notification :convention :stdcall) :uint32
(h-client-handle :pointer) ; HANDLE
(b-register :int32) ; BOOL
(p-reserved :pointer)) ; void* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $WlanRegisterVirtualStationNotification = Win32::API::More->new('wlanapi',
'DWORD WlanRegisterVirtualStationNotification(HANDLE hClientHandle, BOOL bRegister, LPVOID pReserved)');
# my $ret = $WlanRegisterVirtualStationNotification->Call($hClientHandle, $bRegister, $pReserved);
# hClientHandle : HANDLE -> HANDLE
# bRegister : BOOL -> BOOL
# pReserved : void* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。