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

WlanSaveTemporaryProfile

関数
一時的な無線LANプロファイルを永続的に保存する。
DLLwlanapi.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD WlanSaveTemporaryProfile(
    HANDLE hClientHandle,
    const GUID* pInterfaceGuid,
    LPCWSTR strProfileName,
    LPCWSTR strAllUserProfileSecurity,   // optional
    DWORD dwFlags,
    BOOL bOverWrite,
    void* pReserved   // optional
);

パラメーター

名前方向
hClientHandleHANDLEin
pInterfaceGuidGUID*in
strProfileNameLPCWSTRin
strAllUserProfileSecurityLPCWSTRinoptional
dwFlagsDWORDin
bOverWriteBOOLin
pReservedvoid*optional

戻り値の型: 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 方式にも切替可。
出力引数:
; 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 方式にも切替可。
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   // DWORD
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';
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)。