ホーム › NetworkManagement.WiFi › WlanSaveTemporaryProfile
WlanSaveTemporaryProfile
関数一時的な無線LANプロファイルを永続的に保存する。
シグネチャ
// wlanapi.dll
#include <windows.h>
DWORD WlanSaveTemporaryProfile(
HANDLE hClientHandle,
const GUID* pInterfaceGuid,
LPCWSTR strProfileName,
LPCWSTR strAllUserProfileSecurity, // optional
DWORD dwFlags,
BOOL bOverWrite,
void* pReserved // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hClientHandle | HANDLE | in | WlanOpenHandleで取得したクライアントセッションのハンドル。 |
| pInterfaceGuid | GUID* | in | 対象の無線LANインターフェースを識別するGUIDへのポインター。 |
| strProfileName | LPCWSTR | in | 永続化する対象の一時プロファイルの名前を指す文字列。 |
| strAllUserProfileSecurity | LPCWSTR | inoptional | 全ユーザープロファイルのアクセス制御を記述したSDDL文字列。NULL可。 |
| dwFlags | DWORD | in | 保存するプロファイルの種別を示すフラグ。 |
| bOverWrite | BOOL | in | TRUEなら既存の同名プロファイルを上書きする。 |
| pReserved | void* | optional | 予約領域。NULLを指定する必要がある。 |
戻り値の型: DWORD
各言語での呼び出し定義
// wlanapi.dll
#include <windows.h>
DWORD WlanSaveTemporaryProfile(
HANDLE hClientHandle,
const GUID* pInterfaceGuid,
LPCWSTR strProfileName,
LPCWSTR strAllUserProfileSecurity, // optional
DWORD dwFlags,
BOOL bOverWrite,
void* pReserved // optional
);[DllImport("wlanapi.dll", ExactSpelling = true)]
static extern uint WlanSaveTemporaryProfile(
IntPtr hClientHandle, // HANDLE
ref Guid pInterfaceGuid, // GUID*
[MarshalAs(UnmanagedType.LPWStr)] string strProfileName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string strAllUserProfileSecurity, // LPCWSTR optional
uint dwFlags, // DWORD
bool bOverWrite, // BOOL
IntPtr pReserved // void* optional
);<DllImport("wlanapi.dll", ExactSpelling:=True)>
Public Shared Function WlanSaveTemporaryProfile(
hClientHandle As IntPtr, ' HANDLE
ByRef pInterfaceGuid As Guid, ' GUID*
<MarshalAs(UnmanagedType.LPWStr)> strProfileName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> strAllUserProfileSecurity As String, ' LPCWSTR optional
dwFlags As UInteger, ' DWORD
bOverWrite As Boolean, ' BOOL
pReserved As IntPtr ' void* optional
) As UInteger
End Function' hClientHandle : HANDLE
' pInterfaceGuid : GUID*
' strProfileName : LPCWSTR
' strAllUserProfileSecurity : LPCWSTR optional
' dwFlags : DWORD
' bOverWrite : BOOL
' pReserved : void* optional
Declare PtrSafe Function WlanSaveTemporaryProfile Lib "wlanapi" ( _
ByVal hClientHandle As LongPtr, _
ByVal pInterfaceGuid As LongPtr, _
ByVal strProfileName As LongPtr, _
ByVal strAllUserProfileSecurity As LongPtr, _
ByVal dwFlags As Long, _
ByVal bOverWrite 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
WlanSaveTemporaryProfile = ctypes.windll.wlanapi.WlanSaveTemporaryProfile
WlanSaveTemporaryProfile.restype = wintypes.DWORD
WlanSaveTemporaryProfile.argtypes = [
wintypes.HANDLE, # hClientHandle : HANDLE
ctypes.c_void_p, # pInterfaceGuid : GUID*
wintypes.LPCWSTR, # strProfileName : LPCWSTR
wintypes.LPCWSTR, # strAllUserProfileSecurity : LPCWSTR optional
wintypes.DWORD, # dwFlags : DWORD
wintypes.BOOL, # bOverWrite : BOOL
ctypes.POINTER(None), # pReserved : void* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('wlanapi.dll')
WlanSaveTemporaryProfile = Fiddle::Function.new(
lib['WlanSaveTemporaryProfile'],
[
Fiddle::TYPE_VOIDP, # hClientHandle : HANDLE
Fiddle::TYPE_VOIDP, # pInterfaceGuid : GUID*
Fiddle::TYPE_VOIDP, # strProfileName : LPCWSTR
Fiddle::TYPE_VOIDP, # strAllUserProfileSecurity : LPCWSTR optional
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_INT, # bOverWrite : BOOL
Fiddle::TYPE_VOIDP, # pReserved : void* optional
],
-Fiddle::TYPE_INT)#[link(name = "wlanapi")]
extern "system" {
fn WlanSaveTemporaryProfile(
hClientHandle: *mut core::ffi::c_void, // HANDLE
pInterfaceGuid: *const GUID, // GUID*
strProfileName: *const u16, // LPCWSTR
strAllUserProfileSecurity: *const u16, // LPCWSTR optional
dwFlags: u32, // DWORD
bOverWrite: 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 WlanSaveTemporaryProfile(IntPtr hClientHandle, ref Guid pInterfaceGuid, [MarshalAs(UnmanagedType.LPWStr)] string strProfileName, [MarshalAs(UnmanagedType.LPWStr)] string strAllUserProfileSecurity, uint dwFlags, bool bOverWrite, IntPtr pReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wlanapi_WlanSaveTemporaryProfile' -Namespace Win32 -PassThru
# $api::WlanSaveTemporaryProfile(hClientHandle, pInterfaceGuid, strProfileName, strAllUserProfileSecurity, dwFlags, bOverWrite, pReserved)#uselib "wlanapi.dll"
#func global WlanSaveTemporaryProfile "WlanSaveTemporaryProfile" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; WlanSaveTemporaryProfile hClientHandle, varptr(pInterfaceGuid), strProfileName, strAllUserProfileSecurity, dwFlags, bOverWrite, pReserved ; 戻り値は stat
; hClientHandle : HANDLE -> "sptr"
; pInterfaceGuid : GUID* -> "sptr"
; strProfileName : LPCWSTR -> "sptr"
; strAllUserProfileSecurity : LPCWSTR optional -> "sptr"
; dwFlags : DWORD -> "sptr"
; bOverWrite : BOOL -> "sptr"
; pReserved : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "wlanapi.dll" #cfunc global WlanSaveTemporaryProfile "WlanSaveTemporaryProfile" sptr, var, wstr, wstr, int, int, sptr ; res = WlanSaveTemporaryProfile(hClientHandle, pInterfaceGuid, strProfileName, strAllUserProfileSecurity, dwFlags, bOverWrite, pReserved) ; hClientHandle : HANDLE -> "sptr" ; pInterfaceGuid : GUID* -> "var" ; strProfileName : LPCWSTR -> "wstr" ; strAllUserProfileSecurity : LPCWSTR optional -> "wstr" ; dwFlags : DWORD -> "int" ; bOverWrite : BOOL -> "int" ; pReserved : void* optional -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "wlanapi.dll" #cfunc global WlanSaveTemporaryProfile "WlanSaveTemporaryProfile" sptr, sptr, wstr, wstr, int, int, sptr ; res = WlanSaveTemporaryProfile(hClientHandle, varptr(pInterfaceGuid), strProfileName, strAllUserProfileSecurity, dwFlags, bOverWrite, pReserved) ; hClientHandle : HANDLE -> "sptr" ; pInterfaceGuid : GUID* -> "sptr" ; strProfileName : LPCWSTR -> "wstr" ; strAllUserProfileSecurity : LPCWSTR optional -> "wstr" ; dwFlags : DWORD -> "int" ; bOverWrite : BOOL -> "int" ; pReserved : void* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD WlanSaveTemporaryProfile(HANDLE hClientHandle, GUID* pInterfaceGuid, LPCWSTR strProfileName, LPCWSTR strAllUserProfileSecurity, DWORD dwFlags, BOOL bOverWrite, void* pReserved) #uselib "wlanapi.dll" #cfunc global WlanSaveTemporaryProfile "WlanSaveTemporaryProfile" intptr, var, wstr, wstr, int, int, intptr ; res = WlanSaveTemporaryProfile(hClientHandle, pInterfaceGuid, strProfileName, strAllUserProfileSecurity, dwFlags, bOverWrite, pReserved) ; hClientHandle : HANDLE -> "intptr" ; pInterfaceGuid : GUID* -> "var" ; strProfileName : LPCWSTR -> "wstr" ; strAllUserProfileSecurity : LPCWSTR optional -> "wstr" ; dwFlags : DWORD -> "int" ; bOverWrite : BOOL -> "int" ; pReserved : void* optional -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD WlanSaveTemporaryProfile(HANDLE hClientHandle, GUID* pInterfaceGuid, LPCWSTR strProfileName, LPCWSTR strAllUserProfileSecurity, DWORD dwFlags, BOOL bOverWrite, void* pReserved) #uselib "wlanapi.dll" #cfunc global WlanSaveTemporaryProfile "WlanSaveTemporaryProfile" intptr, intptr, wstr, wstr, int, int, intptr ; res = WlanSaveTemporaryProfile(hClientHandle, varptr(pInterfaceGuid), strProfileName, strAllUserProfileSecurity, dwFlags, bOverWrite, pReserved) ; hClientHandle : HANDLE -> "intptr" ; pInterfaceGuid : GUID* -> "intptr" ; strProfileName : LPCWSTR -> "wstr" ; strAllUserProfileSecurity : LPCWSTR optional -> "wstr" ; dwFlags : DWORD -> "int" ; bOverWrite : BOOL -> "int" ; pReserved : void* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wlanapi = windows.NewLazySystemDLL("wlanapi.dll")
procWlanSaveTemporaryProfile = wlanapi.NewProc("WlanSaveTemporaryProfile")
)
// hClientHandle (HANDLE), pInterfaceGuid (GUID*), strProfileName (LPCWSTR), strAllUserProfileSecurity (LPCWSTR optional), dwFlags (DWORD), bOverWrite (BOOL), pReserved (void* optional)
r1, _, err := procWlanSaveTemporaryProfile.Call(
uintptr(hClientHandle),
uintptr(pInterfaceGuid),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(strProfileName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(strAllUserProfileSecurity))),
uintptr(dwFlags),
uintptr(bOverWrite),
uintptr(pReserved),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction WlanSaveTemporaryProfile(
hClientHandle: THandle; // HANDLE
pInterfaceGuid: PGUID; // GUID*
strProfileName: PWideChar; // LPCWSTR
strAllUserProfileSecurity: PWideChar; // LPCWSTR optional
dwFlags: DWORD; // DWORD
bOverWrite: BOOL; // BOOL
pReserved: Pointer // void* optional
): DWORD; stdcall;
external 'wlanapi.dll' name 'WlanSaveTemporaryProfile';result := DllCall("wlanapi\WlanSaveTemporaryProfile"
, "Ptr", hClientHandle ; HANDLE
, "Ptr", pInterfaceGuid ; GUID*
, "WStr", strProfileName ; LPCWSTR
, "WStr", strAllUserProfileSecurity ; LPCWSTR optional
, "UInt", dwFlags ; DWORD
, "Int", bOverWrite ; BOOL
, "Ptr", pReserved ; void* optional
, "UInt") ; return: DWORD●WlanSaveTemporaryProfile(hClientHandle, pInterfaceGuid, strProfileName, strAllUserProfileSecurity, dwFlags, bOverWrite, pReserved) = DLL("wlanapi.dll", "dword WlanSaveTemporaryProfile(void*, void*, char*, char*, dword, bool, void*)")
# 呼び出し: WlanSaveTemporaryProfile(hClientHandle, pInterfaceGuid, strProfileName, strAllUserProfileSecurity, dwFlags, bOverWrite, pReserved)
# hClientHandle : HANDLE -> "void*"
# pInterfaceGuid : GUID* -> "void*"
# strProfileName : LPCWSTR -> "char*"
# strAllUserProfileSecurity : LPCWSTR optional -> "char*"
# dwFlags : DWORD -> "dword"
# bOverWrite : BOOL -> "bool"
# pReserved : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "wlanapi" fn WlanSaveTemporaryProfile(
hClientHandle: ?*anyopaque, // HANDLE
pInterfaceGuid: [*c]GUID, // GUID*
strProfileName: [*c]const u16, // LPCWSTR
strAllUserProfileSecurity: [*c]const u16, // LPCWSTR optional
dwFlags: u32, // DWORD
bOverWrite: i32, // BOOL
pReserved: ?*anyopaque // void* optional
) callconv(std.os.windows.WINAPI) u32;proc WlanSaveTemporaryProfile(
hClientHandle: pointer, # HANDLE
pInterfaceGuid: ptr GUID, # GUID*
strProfileName: WideCString, # LPCWSTR
strAllUserProfileSecurity: WideCString, # LPCWSTR optional
dwFlags: uint32, # DWORD
bOverWrite: int32, # BOOL
pReserved: pointer # void* optional
): uint32 {.importc: "WlanSaveTemporaryProfile", stdcall, dynlib: "wlanapi.dll".}pragma(lib, "wlanapi");
extern(Windows)
uint WlanSaveTemporaryProfile(
void* hClientHandle, // HANDLE
GUID* pInterfaceGuid, // GUID*
const(wchar)* strProfileName, // LPCWSTR
const(wchar)* strAllUserProfileSecurity, // LPCWSTR optional
uint dwFlags, // DWORD
int bOverWrite, // BOOL
void* pReserved // void* optional
);ccall((:WlanSaveTemporaryProfile, "wlanapi.dll"), stdcall, UInt32,
(Ptr{Cvoid}, Ptr{GUID}, Cwstring, Cwstring, UInt32, Int32, Ptr{Cvoid}),
hClientHandle, pInterfaceGuid, strProfileName, strAllUserProfileSecurity, dwFlags, bOverWrite, pReserved)
# hClientHandle : HANDLE -> Ptr{Cvoid}
# pInterfaceGuid : GUID* -> Ptr{GUID}
# strProfileName : LPCWSTR -> Cwstring
# strAllUserProfileSecurity : LPCWSTR optional -> Cwstring
# dwFlags : DWORD -> UInt32
# bOverWrite : BOOL -> Int32
# pReserved : void* optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t WlanSaveTemporaryProfile(
void* hClientHandle,
void* pInterfaceGuid,
const uint16_t* strProfileName,
const uint16_t* strAllUserProfileSecurity,
uint32_t dwFlags,
int32_t bOverWrite,
void* pReserved);
]]
local wlanapi = ffi.load("wlanapi")
-- wlanapi.WlanSaveTemporaryProfile(hClientHandle, pInterfaceGuid, strProfileName, strAllUserProfileSecurity, dwFlags, bOverWrite, pReserved)
-- hClientHandle : HANDLE
-- pInterfaceGuid : GUID*
-- strProfileName : LPCWSTR
-- strAllUserProfileSecurity : LPCWSTR optional
-- dwFlags : DWORD
-- bOverWrite : BOOL
-- pReserved : void* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('wlanapi.dll');
const WlanSaveTemporaryProfile = lib.func('__stdcall', 'WlanSaveTemporaryProfile', 'uint32_t', ['void *', 'void *', 'str16', 'str16', 'uint32_t', 'int32_t', 'void *']);
// WlanSaveTemporaryProfile(hClientHandle, pInterfaceGuid, strProfileName, strAllUserProfileSecurity, dwFlags, bOverWrite, pReserved)
// hClientHandle : HANDLE -> 'void *'
// pInterfaceGuid : GUID* -> 'void *'
// strProfileName : LPCWSTR -> 'str16'
// strAllUserProfileSecurity : LPCWSTR optional -> 'str16'
// dwFlags : DWORD -> 'uint32_t'
// bOverWrite : BOOL -> 'int32_t'
// pReserved : void* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("wlanapi.dll", {
WlanSaveTemporaryProfile: { parameters: ["pointer", "pointer", "buffer", "buffer", "u32", "i32", "pointer"], result: "u32" },
});
// lib.symbols.WlanSaveTemporaryProfile(hClientHandle, pInterfaceGuid, strProfileName, strAllUserProfileSecurity, dwFlags, bOverWrite, pReserved)
// hClientHandle : HANDLE -> "pointer"
// pInterfaceGuid : GUID* -> "pointer"
// strProfileName : LPCWSTR -> "buffer"
// strAllUserProfileSecurity : LPCWSTR optional -> "buffer"
// dwFlags : DWORD -> "u32"
// bOverWrite : BOOL -> "i32"
// pReserved : void* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t WlanSaveTemporaryProfile(
void* hClientHandle,
void* pInterfaceGuid,
const uint16_t* strProfileName,
const uint16_t* strAllUserProfileSecurity,
uint32_t dwFlags,
int32_t bOverWrite,
void* pReserved);
C, "wlanapi.dll");
// $ffi->WlanSaveTemporaryProfile(hClientHandle, pInterfaceGuid, strProfileName, strAllUserProfileSecurity, dwFlags, bOverWrite, pReserved);
// hClientHandle : HANDLE
// pInterfaceGuid : GUID*
// strProfileName : LPCWSTR
// strAllUserProfileSecurity : LPCWSTR optional
// dwFlags : DWORD
// bOverWrite : 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 WlanSaveTemporaryProfile(
Pointer hClientHandle, // HANDLE
Pointer pInterfaceGuid, // GUID*
WString strProfileName, // LPCWSTR
WString strAllUserProfileSecurity, // LPCWSTR optional
int dwFlags, // DWORD
boolean bOverWrite, // BOOL
Pointer pReserved // void* optional
);
}@[Link("wlanapi")]
lib Libwlanapi
fun WlanSaveTemporaryProfile = WlanSaveTemporaryProfile(
hClientHandle : Void*, # HANDLE
pInterfaceGuid : GUID*, # GUID*
strProfileName : UInt16*, # LPCWSTR
strAllUserProfileSecurity : UInt16*, # LPCWSTR optional
dwFlags : UInt32, # DWORD
bOverWrite : 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 WlanSaveTemporaryProfileNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, Uint32, Int32, Pointer<Void>);
typedef WlanSaveTemporaryProfileDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, int, int, Pointer<Void>);
final WlanSaveTemporaryProfile = DynamicLibrary.open('wlanapi.dll')
.lookupFunction<WlanSaveTemporaryProfileNative, WlanSaveTemporaryProfileDart>('WlanSaveTemporaryProfile');
// hClientHandle : HANDLE -> Pointer<Void>
// pInterfaceGuid : GUID* -> Pointer<Void>
// strProfileName : LPCWSTR -> Pointer<Utf16>
// strAllUserProfileSecurity : LPCWSTR optional -> Pointer<Utf16>
// dwFlags : DWORD -> Uint32
// bOverWrite : BOOL -> Int32
// pReserved : void* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function WlanSaveTemporaryProfile(
hClientHandle: THandle; // HANDLE
pInterfaceGuid: PGUID; // GUID*
strProfileName: PWideChar; // LPCWSTR
strAllUserProfileSecurity: PWideChar; // LPCWSTR optional
dwFlags: DWORD; // DWORD
bOverWrite: BOOL; // BOOL
pReserved: Pointer // void* optional
): DWORD; stdcall;
external 'wlanapi.dll' name 'WlanSaveTemporaryProfile';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "WlanSaveTemporaryProfile"
c_WlanSaveTemporaryProfile :: Ptr () -> Ptr () -> CWString -> CWString -> Word32 -> CInt -> Ptr () -> IO Word32
-- hClientHandle : HANDLE -> Ptr ()
-- pInterfaceGuid : GUID* -> Ptr ()
-- strProfileName : LPCWSTR -> CWString
-- strAllUserProfileSecurity : LPCWSTR optional -> CWString
-- dwFlags : DWORD -> Word32
-- bOverWrite : BOOL -> CInt
-- pReserved : void* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let wlansavetemporaryprofile =
foreign "WlanSaveTemporaryProfile"
((ptr void) @-> (ptr void) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> uint32_t @-> int32_t @-> (ptr void) @-> returning uint32_t)
(* hClientHandle : HANDLE -> (ptr void) *)
(* pInterfaceGuid : GUID* -> (ptr void) *)
(* strProfileName : LPCWSTR -> (ptr uint16_t) *)
(* strAllUserProfileSecurity : LPCWSTR optional -> (ptr uint16_t) *)
(* dwFlags : DWORD -> uint32_t *)
(* bOverWrite : 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 ("WlanSaveTemporaryProfile" wlan-save-temporary-profile :convention :stdcall) :uint32
(h-client-handle :pointer) ; HANDLE
(p-interface-guid :pointer) ; GUID*
(str-profile-name (:string :encoding :utf-16le)) ; LPCWSTR
(str-all-user-profile-security (:string :encoding :utf-16le)) ; LPCWSTR optional
(dw-flags :uint32) ; DWORD
(b-over-write :int32) ; BOOL
(p-reserved :pointer)) ; void* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $WlanSaveTemporaryProfile = Win32::API::More->new('wlanapi',
'DWORD WlanSaveTemporaryProfile(HANDLE hClientHandle, LPVOID pInterfaceGuid, LPCWSTR strProfileName, LPCWSTR strAllUserProfileSecurity, DWORD dwFlags, BOOL bOverWrite, LPVOID pReserved)');
# my $ret = $WlanSaveTemporaryProfile->Call($hClientHandle, $pInterfaceGuid, $strProfileName, $strAllUserProfileSecurity, $dwFlags, $bOverWrite, $pReserved);
# hClientHandle : HANDLE -> HANDLE
# pInterfaceGuid : GUID* -> LPVOID
# strProfileName : LPCWSTR -> LPCWSTR
# strAllUserProfileSecurity : LPCWSTR optional -> LPCWSTR
# dwFlags : DWORD -> DWORD
# bOverWrite : BOOL -> BOOL
# pReserved : void* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。