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

alljoyn_busattachment_enablepeersecurity

関数
認証機構を指定してピア間のセキュリティを有効化する。
DLLMSAJApi.dll呼出規約winapi

シグネチャ

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

QStatus alljoyn_busattachment_enablepeersecurity(
    alljoyn_busattachment bus,
    LPCSTR authMechanisms,
    alljoyn_authlistener listener,
    LPCSTR keyStoreFileName,
    INT isShared
);

パラメーター

名前方向
busalljoyn_busattachmentin
authMechanismsLPCSTRin
listeneralljoyn_authlistenerin
keyStoreFileNameLPCSTRin
isSharedINTin

戻り値の型: QStatus

各言語での呼び出し定義

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

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

alljoyn_busattachment_enablepeersecurity = ctypes.windll.msajapi.alljoyn_busattachment_enablepeersecurity
alljoyn_busattachment_enablepeersecurity.restype = ctypes.c_int
alljoyn_busattachment_enablepeersecurity.argtypes = [
    ctypes.c_ssize_t,  # bus : alljoyn_busattachment
    wintypes.LPCSTR,  # authMechanisms : LPCSTR
    ctypes.c_ssize_t,  # listener : alljoyn_authlistener
    wintypes.LPCSTR,  # keyStoreFileName : LPCSTR
    ctypes.c_int,  # isShared : INT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	msajapi = windows.NewLazySystemDLL("MSAJApi.dll")
	procalljoyn_busattachment_enablepeersecurity = msajapi.NewProc("alljoyn_busattachment_enablepeersecurity")
)

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