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

WcmGetProfileList

関数
接続マネージャーが管理する接続プロファイル一覧を取得する。
DLLwcmapi.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD WcmGetProfileList(
    void* pReserved,   // optional
    WCM_PROFILE_INFO_LIST** ppProfileList
);

パラメーター

名前方向
pReservedvoid*optional
ppProfileListWCM_PROFILE_INFO_LIST**out

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD WcmGetProfileList(
    void* pReserved,   // optional
    WCM_PROFILE_INFO_LIST** ppProfileList
);
[DllImport("wcmapi.dll", ExactSpelling = true)]
static extern uint WcmGetProfileList(
    IntPtr pReserved,   // void* optional
    IntPtr ppProfileList   // WCM_PROFILE_INFO_LIST** out
);
<DllImport("wcmapi.dll", ExactSpelling:=True)>
Public Shared Function WcmGetProfileList(
    pReserved As IntPtr,   ' void* optional
    ppProfileList As IntPtr   ' WCM_PROFILE_INFO_LIST** out
) As UInteger
End Function
' pReserved : void* optional
' ppProfileList : WCM_PROFILE_INFO_LIST** out
Declare PtrSafe Function WcmGetProfileList Lib "wcmapi" ( _
    ByVal pReserved As LongPtr, _
    ByVal ppProfileList As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WcmGetProfileList = ctypes.windll.wcmapi.WcmGetProfileList
WcmGetProfileList.restype = wintypes.DWORD
WcmGetProfileList.argtypes = [
    ctypes.POINTER(None),  # pReserved : void* optional
    ctypes.c_void_p,  # ppProfileList : WCM_PROFILE_INFO_LIST** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wcmapi = windows.NewLazySystemDLL("wcmapi.dll")
	procWcmGetProfileList = wcmapi.NewProc("WcmGetProfileList")
)

// pReserved (void* optional), ppProfileList (WCM_PROFILE_INFO_LIST** out)
r1, _, err := procWcmGetProfileList.Call(
	uintptr(pReserved),
	uintptr(ppProfileList),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function WcmGetProfileList(
  pReserved: Pointer;   // void* optional
  ppProfileList: Pointer   // WCM_PROFILE_INFO_LIST** out
): DWORD; stdcall;
  external 'wcmapi.dll' name 'WcmGetProfileList';
result := DllCall("wcmapi\WcmGetProfileList"
    , "Ptr", pReserved   ; void* optional
    , "Ptr", ppProfileList   ; WCM_PROFILE_INFO_LIST** out
    , "UInt")   ; return: DWORD
●WcmGetProfileList(pReserved, ppProfileList) = DLL("wcmapi.dll", "dword WcmGetProfileList(void*, void*)")
# 呼び出し: WcmGetProfileList(pReserved, ppProfileList)
# pReserved : void* optional -> "void*"
# ppProfileList : WCM_PROFILE_INFO_LIST** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。