ホーム › NetworkManagement.WiFi › WlanSetSecuritySettings
WlanSetSecuritySettings
関数WLAN保護対象オブジェクトのセキュリティ設定を変更する。
シグネチャ
// wlanapi.dll
#include <windows.h>
DWORD WlanSetSecuritySettings(
HANDLE hClientHandle,
WLAN_SECURABLE_OBJECT SecurableObject,
LPCWSTR strModifiedSDDL
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hClientHandle | HANDLE | in |
| SecurableObject | WLAN_SECURABLE_OBJECT | in |
| strModifiedSDDL | LPCWSTR | in |
戻り値の型: DWORD
各言語での呼び出し定義
// wlanapi.dll
#include <windows.h>
DWORD WlanSetSecuritySettings(
HANDLE hClientHandle,
WLAN_SECURABLE_OBJECT SecurableObject,
LPCWSTR strModifiedSDDL
);[DllImport("wlanapi.dll", ExactSpelling = true)]
static extern uint WlanSetSecuritySettings(
IntPtr hClientHandle, // HANDLE
int SecurableObject, // WLAN_SECURABLE_OBJECT
[MarshalAs(UnmanagedType.LPWStr)] string strModifiedSDDL // LPCWSTR
);<DllImport("wlanapi.dll", ExactSpelling:=True)>
Public Shared Function WlanSetSecuritySettings(
hClientHandle As IntPtr, ' HANDLE
SecurableObject As Integer, ' WLAN_SECURABLE_OBJECT
<MarshalAs(UnmanagedType.LPWStr)> strModifiedSDDL As String ' LPCWSTR
) As UInteger
End Function' hClientHandle : HANDLE
' SecurableObject : WLAN_SECURABLE_OBJECT
' strModifiedSDDL : LPCWSTR
Declare PtrSafe Function WlanSetSecuritySettings Lib "wlanapi" ( _
ByVal hClientHandle As LongPtr, _
ByVal SecurableObject As Long, _
ByVal strModifiedSDDL As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WlanSetSecuritySettings = ctypes.windll.wlanapi.WlanSetSecuritySettings
WlanSetSecuritySettings.restype = wintypes.DWORD
WlanSetSecuritySettings.argtypes = [
wintypes.HANDLE, # hClientHandle : HANDLE
ctypes.c_int, # SecurableObject : WLAN_SECURABLE_OBJECT
wintypes.LPCWSTR, # strModifiedSDDL : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('wlanapi.dll')
WlanSetSecuritySettings = Fiddle::Function.new(
lib['WlanSetSecuritySettings'],
[
Fiddle::TYPE_VOIDP, # hClientHandle : HANDLE
Fiddle::TYPE_INT, # SecurableObject : WLAN_SECURABLE_OBJECT
Fiddle::TYPE_VOIDP, # strModifiedSDDL : LPCWSTR
],
-Fiddle::TYPE_INT)#[link(name = "wlanapi")]
extern "system" {
fn WlanSetSecuritySettings(
hClientHandle: *mut core::ffi::c_void, // HANDLE
SecurableObject: i32, // WLAN_SECURABLE_OBJECT
strModifiedSDDL: *const u16 // LPCWSTR
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("wlanapi.dll")]
public static extern uint WlanSetSecuritySettings(IntPtr hClientHandle, int SecurableObject, [MarshalAs(UnmanagedType.LPWStr)] string strModifiedSDDL);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wlanapi_WlanSetSecuritySettings' -Namespace Win32 -PassThru
# $api::WlanSetSecuritySettings(hClientHandle, SecurableObject, strModifiedSDDL)#uselib "wlanapi.dll"
#func global WlanSetSecuritySettings "WlanSetSecuritySettings" sptr, sptr, sptr
; WlanSetSecuritySettings hClientHandle, SecurableObject, strModifiedSDDL ; 戻り値は stat
; hClientHandle : HANDLE -> "sptr"
; SecurableObject : WLAN_SECURABLE_OBJECT -> "sptr"
; strModifiedSDDL : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "wlanapi.dll"
#cfunc global WlanSetSecuritySettings "WlanSetSecuritySettings" sptr, int, wstr
; res = WlanSetSecuritySettings(hClientHandle, SecurableObject, strModifiedSDDL)
; hClientHandle : HANDLE -> "sptr"
; SecurableObject : WLAN_SECURABLE_OBJECT -> "int"
; strModifiedSDDL : LPCWSTR -> "wstr"; DWORD WlanSetSecuritySettings(HANDLE hClientHandle, WLAN_SECURABLE_OBJECT SecurableObject, LPCWSTR strModifiedSDDL)
#uselib "wlanapi.dll"
#cfunc global WlanSetSecuritySettings "WlanSetSecuritySettings" intptr, int, wstr
; res = WlanSetSecuritySettings(hClientHandle, SecurableObject, strModifiedSDDL)
; hClientHandle : HANDLE -> "intptr"
; SecurableObject : WLAN_SECURABLE_OBJECT -> "int"
; strModifiedSDDL : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wlanapi = windows.NewLazySystemDLL("wlanapi.dll")
procWlanSetSecuritySettings = wlanapi.NewProc("WlanSetSecuritySettings")
)
// hClientHandle (HANDLE), SecurableObject (WLAN_SECURABLE_OBJECT), strModifiedSDDL (LPCWSTR)
r1, _, err := procWlanSetSecuritySettings.Call(
uintptr(hClientHandle),
uintptr(SecurableObject),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(strModifiedSDDL))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction WlanSetSecuritySettings(
hClientHandle: THandle; // HANDLE
SecurableObject: Integer; // WLAN_SECURABLE_OBJECT
strModifiedSDDL: PWideChar // LPCWSTR
): DWORD; stdcall;
external 'wlanapi.dll' name 'WlanSetSecuritySettings';result := DllCall("wlanapi\WlanSetSecuritySettings"
, "Ptr", hClientHandle ; HANDLE
, "Int", SecurableObject ; WLAN_SECURABLE_OBJECT
, "WStr", strModifiedSDDL ; LPCWSTR
, "UInt") ; return: DWORD●WlanSetSecuritySettings(hClientHandle, SecurableObject, strModifiedSDDL) = DLL("wlanapi.dll", "dword WlanSetSecuritySettings(void*, int, char*)")
# 呼び出し: WlanSetSecuritySettings(hClientHandle, SecurableObject, strModifiedSDDL)
# hClientHandle : HANDLE -> "void*"
# SecurableObject : WLAN_SECURABLE_OBJECT -> "int"
# strModifiedSDDL : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。