Win32 API 日本語リファレンス
ホームDevices.AllJoyn › alljoyn_busattachment_secureconnection

alljoyn_busattachment_secureconnection

関数
指定したピア名との間で安全な接続を同期的に確立する。
DLLMSAJApi.dll呼出規約winapi

シグネチャ

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

QStatus alljoyn_busattachment_secureconnection(
    alljoyn_busattachment bus,
    LPCSTR name,
    INT forceAuth
);

パラメーター

名前方向説明
busalljoyn_busattachmentin操作対象のバスアタッチメントハンドル。AllJoyn接続を表す。
nameLPCSTRinセキュア化する対象ピアのバス名。NULL指定で全ピア対象。
forceAuthINTin既存認証を破棄し再認証を強制するか。非0で強制する。

戻り値の型: QStatus

各言語での呼び出し定義

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

QStatus alljoyn_busattachment_secureconnection(
    alljoyn_busattachment bus,
    LPCSTR name,
    INT forceAuth
);
[DllImport("MSAJApi.dll", ExactSpelling = true)]
static extern int alljoyn_busattachment_secureconnection(
    IntPtr bus,   // alljoyn_busattachment
    [MarshalAs(UnmanagedType.LPStr)] string name,   // LPCSTR
    int forceAuth   // INT
);
<DllImport("MSAJApi.dll", ExactSpelling:=True)>
Public Shared Function alljoyn_busattachment_secureconnection(
    bus As IntPtr,   ' alljoyn_busattachment
    <MarshalAs(UnmanagedType.LPStr)> name As String,   ' LPCSTR
    forceAuth As Integer   ' INT
) As Integer
End Function
' bus : alljoyn_busattachment
' name : LPCSTR
' forceAuth : INT
Declare PtrSafe Function alljoyn_busattachment_secureconnection Lib "msajapi" ( _
    ByVal bus As LongPtr, _
    ByVal name As String, _
    ByVal forceAuth As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

alljoyn_busattachment_secureconnection = ctypes.windll.msajapi.alljoyn_busattachment_secureconnection
alljoyn_busattachment_secureconnection.restype = ctypes.c_int
alljoyn_busattachment_secureconnection.argtypes = [
    ctypes.c_ssize_t,  # bus : alljoyn_busattachment
    wintypes.LPCSTR,  # name : LPCSTR
    ctypes.c_int,  # forceAuth : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MSAJApi.dll')
alljoyn_busattachment_secureconnection = Fiddle::Function.new(
  lib['alljoyn_busattachment_secureconnection'],
  [
    Fiddle::TYPE_INTPTR_T,  # bus : alljoyn_busattachment
    Fiddle::TYPE_VOIDP,  # name : LPCSTR
    Fiddle::TYPE_INT,  # forceAuth : INT
  ],
  Fiddle::TYPE_INT)
#[link(name = "msajapi")]
extern "system" {
    fn alljoyn_busattachment_secureconnection(
        bus: isize,  // alljoyn_busattachment
        name: *const u8,  // LPCSTR
        forceAuth: i32  // INT
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MSAJApi.dll")]
public static extern int alljoyn_busattachment_secureconnection(IntPtr bus, [MarshalAs(UnmanagedType.LPStr)] string name, int forceAuth);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSAJApi_alljoyn_busattachment_secureconnection' -Namespace Win32 -PassThru
# $api::alljoyn_busattachment_secureconnection(bus, name, forceAuth)
#uselib "MSAJApi.dll"
#func global alljoyn_busattachment_secureconnection "alljoyn_busattachment_secureconnection" sptr, sptr, sptr
; alljoyn_busattachment_secureconnection bus, name, forceAuth   ; 戻り値は stat
; bus : alljoyn_busattachment -> "sptr"
; name : LPCSTR -> "sptr"
; forceAuth : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MSAJApi.dll"
#cfunc global alljoyn_busattachment_secureconnection "alljoyn_busattachment_secureconnection" sptr, str, int
; res = alljoyn_busattachment_secureconnection(bus, name, forceAuth)
; bus : alljoyn_busattachment -> "sptr"
; name : LPCSTR -> "str"
; forceAuth : INT -> "int"
; QStatus alljoyn_busattachment_secureconnection(alljoyn_busattachment bus, LPCSTR name, INT forceAuth)
#uselib "MSAJApi.dll"
#cfunc global alljoyn_busattachment_secureconnection "alljoyn_busattachment_secureconnection" intptr, str, int
; res = alljoyn_busattachment_secureconnection(bus, name, forceAuth)
; bus : alljoyn_busattachment -> "intptr"
; name : LPCSTR -> "str"
; forceAuth : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msajapi = windows.NewLazySystemDLL("MSAJApi.dll")
	procalljoyn_busattachment_secureconnection = msajapi.NewProc("alljoyn_busattachment_secureconnection")
)

// bus (alljoyn_busattachment), name (LPCSTR), forceAuth (INT)
r1, _, err := procalljoyn_busattachment_secureconnection.Call(
	uintptr(bus),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(name))),
	uintptr(forceAuth),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // QStatus
function alljoyn_busattachment_secureconnection(
  bus: NativeInt;   // alljoyn_busattachment
  name: PAnsiChar;   // LPCSTR
  forceAuth: Integer   // INT
): Integer; stdcall;
  external 'MSAJApi.dll' name 'alljoyn_busattachment_secureconnection';
result := DllCall("MSAJApi\alljoyn_busattachment_secureconnection"
    , "Ptr", bus   ; alljoyn_busattachment
    , "AStr", name   ; LPCSTR
    , "Int", forceAuth   ; INT
    , "Int")   ; return: QStatus
●alljoyn_busattachment_secureconnection(bus, name, forceAuth) = DLL("MSAJApi.dll", "int alljoyn_busattachment_secureconnection(int, char*, int)")
# 呼び出し: alljoyn_busattachment_secureconnection(bus, name, forceAuth)
# bus : alljoyn_busattachment -> "int"
# name : LPCSTR -> "char*"
# forceAuth : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。