ホーム › NetworkManagement.WindowsConnectionManager › WcmGetProfileList
WcmGetProfileList
関数接続マネージャーが管理する接続プロファイル一覧を取得する。
シグネチャ
// wcmapi.dll
#include <windows.h>
DWORD WcmGetProfileList(
void* pReserved, // optional
WCM_PROFILE_INFO_LIST** ppProfileList
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pReserved | void* | optional | 予約領域。NULLを指定する必要がある。 |
| ppProfileList | WCM_PROFILE_INFO_LIST** | out | プロファイル一覧を受け取るポインター。WcmFreeMemoryで解放する。 |
戻り値の型: 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 方式にも切替可。#uselib "wcmapi.dll" #cfunc global WcmGetProfileList "WcmGetProfileList" sptr, sptr ; res = WcmGetProfileList(pReserved, varptr(ppProfileList)) ; pReserved : void* optional -> "sptr" ; ppProfileList : WCM_PROFILE_INFO_LIST** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; DWORD WcmGetProfileList(void* pReserved, WCM_PROFILE_INFO_LIST** ppProfileList) #uselib "wcmapi.dll" #cfunc global WcmGetProfileList "WcmGetProfileList" intptr, intptr ; res = WcmGetProfileList(pReserved, varptr(ppProfileList)) ; pReserved : void* optional -> "intptr" ; ppProfileList : WCM_PROFILE_INFO_LIST** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // DWORDfunction 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)。const std = @import("std");
extern "wcmapi" fn WcmGetProfileList(
pReserved: ?*anyopaque, // void* optional
ppProfileList: [*c][*c]WCM_PROFILE_INFO_LIST // WCM_PROFILE_INFO_LIST** out
) callconv(std.os.windows.WINAPI) u32;proc WcmGetProfileList(
pReserved: pointer, # void* optional
ppProfileList: ptr WCM_PROFILE_INFO_LIST # WCM_PROFILE_INFO_LIST** out
): uint32 {.importc: "WcmGetProfileList", stdcall, dynlib: "wcmapi.dll".}pragma(lib, "wcmapi");
extern(Windows)
uint WcmGetProfileList(
void* pReserved, // void* optional
WCM_PROFILE_INFO_LIST** ppProfileList // WCM_PROFILE_INFO_LIST** out
);ccall((:WcmGetProfileList, "wcmapi.dll"), stdcall, UInt32,
(Ptr{Cvoid}, Ptr{WCM_PROFILE_INFO_LIST}),
pReserved, ppProfileList)
# pReserved : void* optional -> Ptr{Cvoid}
# ppProfileList : WCM_PROFILE_INFO_LIST** out -> Ptr{WCM_PROFILE_INFO_LIST}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t WcmGetProfileList(
void* pReserved,
void* ppProfileList);
]]
local wcmapi = ffi.load("wcmapi")
-- wcmapi.WcmGetProfileList(pReserved, ppProfileList)
-- pReserved : void* optional
-- ppProfileList : WCM_PROFILE_INFO_LIST** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('wcmapi.dll');
const WcmGetProfileList = lib.func('__stdcall', 'WcmGetProfileList', 'uint32_t', ['void *', 'void *']);
// WcmGetProfileList(pReserved, ppProfileList)
// pReserved : void* optional -> 'void *'
// ppProfileList : WCM_PROFILE_INFO_LIST** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("wcmapi.dll", {
WcmGetProfileList: { parameters: ["pointer", "pointer"], result: "u32" },
});
// lib.symbols.WcmGetProfileList(pReserved, ppProfileList)
// pReserved : void* optional -> "pointer"
// ppProfileList : WCM_PROFILE_INFO_LIST** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t WcmGetProfileList(
void* pReserved,
void* ppProfileList);
C, "wcmapi.dll");
// $ffi->WcmGetProfileList(pReserved, ppProfileList);
// pReserved : void* optional
// ppProfileList : WCM_PROFILE_INFO_LIST** out
// 構造体/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 Wcmapi extends StdCallLibrary {
Wcmapi INSTANCE = Native.load("wcmapi", Wcmapi.class);
int WcmGetProfileList(
Pointer pReserved, // void* optional
Pointer ppProfileList // WCM_PROFILE_INFO_LIST** out
);
}@[Link("wcmapi")]
lib Libwcmapi
fun WcmGetProfileList = WcmGetProfileList(
pReserved : Void*, # void* optional
ppProfileList : WCM_PROFILE_INFO_LIST** # WCM_PROFILE_INFO_LIST** out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef WcmGetProfileListNative = Uint32 Function(Pointer<Void>, Pointer<Void>);
typedef WcmGetProfileListDart = int Function(Pointer<Void>, Pointer<Void>);
final WcmGetProfileList = DynamicLibrary.open('wcmapi.dll')
.lookupFunction<WcmGetProfileListNative, WcmGetProfileListDart>('WcmGetProfileList');
// pReserved : void* optional -> Pointer<Void>
// ppProfileList : WCM_PROFILE_INFO_LIST** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function WcmGetProfileList(
pReserved: Pointer; // void* optional
ppProfileList: Pointer // WCM_PROFILE_INFO_LIST** out
): DWORD; stdcall;
external 'wcmapi.dll' name 'WcmGetProfileList';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "WcmGetProfileList"
c_WcmGetProfileList :: Ptr () -> Ptr () -> IO Word32
-- pReserved : void* optional -> Ptr ()
-- ppProfileList : WCM_PROFILE_INFO_LIST** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let wcmgetprofilelist =
foreign "WcmGetProfileList"
((ptr void) @-> (ptr void) @-> returning uint32_t)
(* pReserved : void* optional -> (ptr void) *)
(* ppProfileList : WCM_PROFILE_INFO_LIST** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wcmapi (t "wcmapi.dll"))
(cffi:use-foreign-library wcmapi)
(cffi:defcfun ("WcmGetProfileList" wcm-get-profile-list :convention :stdcall) :uint32
(p-reserved :pointer) ; void* optional
(pp-profile-list :pointer)) ; WCM_PROFILE_INFO_LIST** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $WcmGetProfileList = Win32::API::More->new('wcmapi',
'DWORD WcmGetProfileList(LPVOID pReserved, LPVOID ppProfileList)');
# my $ret = $WcmGetProfileList->Call($pReserved, $ppProfileList);
# pReserved : void* optional -> LPVOID
# ppProfileList : WCM_PROFILE_INFO_LIST** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。