ホーム › Devices.AllJoyn › alljoyn_credentials_setcertchain
alljoyn_credentials_setcertchain
関数資格情報に証明書チェーンを設定する。
シグネチャ
// MSAJApi.dll
#include <windows.h>
void alljoyn_credentials_setcertchain(
alljoyn_credentials cred,
LPCSTR certChain
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| cred | alljoyn_credentials | in | 設定対象の資格情報ハンドル。 |
| certChain | LPCSTR | in | 設定する証明書チェーンをPEM形式で表すNULL終端文字列。 |
戻り値の型: void
各言語での呼び出し定義
// MSAJApi.dll
#include <windows.h>
void alljoyn_credentials_setcertchain(
alljoyn_credentials cred,
LPCSTR certChain
);[DllImport("MSAJApi.dll", ExactSpelling = true)]
static extern void alljoyn_credentials_setcertchain(
IntPtr cred, // alljoyn_credentials
[MarshalAs(UnmanagedType.LPStr)] string certChain // LPCSTR
);<DllImport("MSAJApi.dll", ExactSpelling:=True)>
Public Shared Sub alljoyn_credentials_setcertchain(
cred As IntPtr, ' alljoyn_credentials
<MarshalAs(UnmanagedType.LPStr)> certChain As String ' LPCSTR
)
End Sub' cred : alljoyn_credentials
' certChain : LPCSTR
Declare PtrSafe Sub alljoyn_credentials_setcertchain Lib "msajapi" ( _
ByVal cred As LongPtr, _
ByVal certChain As String)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
alljoyn_credentials_setcertchain = ctypes.windll.msajapi.alljoyn_credentials_setcertchain
alljoyn_credentials_setcertchain.restype = None
alljoyn_credentials_setcertchain.argtypes = [
ctypes.c_ssize_t, # cred : alljoyn_credentials
wintypes.LPCSTR, # certChain : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSAJApi.dll')
alljoyn_credentials_setcertchain = Fiddle::Function.new(
lib['alljoyn_credentials_setcertchain'],
[
Fiddle::TYPE_INTPTR_T, # cred : alljoyn_credentials
Fiddle::TYPE_VOIDP, # certChain : LPCSTR
],
Fiddle::TYPE_VOID)#[link(name = "msajapi")]
extern "system" {
fn alljoyn_credentials_setcertchain(
cred: isize, // alljoyn_credentials
certChain: *const u8 // LPCSTR
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSAJApi.dll")]
public static extern void alljoyn_credentials_setcertchain(IntPtr cred, [MarshalAs(UnmanagedType.LPStr)] string certChain);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSAJApi_alljoyn_credentials_setcertchain' -Namespace Win32 -PassThru
# $api::alljoyn_credentials_setcertchain(cred, certChain)#uselib "MSAJApi.dll"
#func global alljoyn_credentials_setcertchain "alljoyn_credentials_setcertchain" sptr, sptr
; alljoyn_credentials_setcertchain cred, certChain
; cred : alljoyn_credentials -> "sptr"
; certChain : LPCSTR -> "sptr"#uselib "MSAJApi.dll"
#func global alljoyn_credentials_setcertchain "alljoyn_credentials_setcertchain" sptr, str
; alljoyn_credentials_setcertchain cred, certChain
; cred : alljoyn_credentials -> "sptr"
; certChain : LPCSTR -> "str"; void alljoyn_credentials_setcertchain(alljoyn_credentials cred, LPCSTR certChain)
#uselib "MSAJApi.dll"
#func global alljoyn_credentials_setcertchain "alljoyn_credentials_setcertchain" intptr, str
; alljoyn_credentials_setcertchain cred, certChain
; cred : alljoyn_credentials -> "intptr"
; certChain : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msajapi = windows.NewLazySystemDLL("MSAJApi.dll")
procalljoyn_credentials_setcertchain = msajapi.NewProc("alljoyn_credentials_setcertchain")
)
// cred (alljoyn_credentials), certChain (LPCSTR)
r1, _, err := procalljoyn_credentials_setcertchain.Call(
uintptr(cred),
uintptr(unsafe.Pointer(windows.BytePtrFromString(certChain))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure alljoyn_credentials_setcertchain(
cred: NativeInt; // alljoyn_credentials
certChain: PAnsiChar // LPCSTR
); stdcall;
external 'MSAJApi.dll' name 'alljoyn_credentials_setcertchain';result := DllCall("MSAJApi\alljoyn_credentials_setcertchain"
, "Ptr", cred ; alljoyn_credentials
, "AStr", certChain ; LPCSTR
, "Int") ; return: void●alljoyn_credentials_setcertchain(cred, certChain) = DLL("MSAJApi.dll", "int alljoyn_credentials_setcertchain(int, char*)")
# 呼び出し: alljoyn_credentials_setcertchain(cred, certChain)
# cred : alljoyn_credentials -> "int"
# certChain : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msajapi" fn alljoyn_credentials_setcertchain(
cred: isize, // alljoyn_credentials
certChain: [*c]const u8 // LPCSTR
) callconv(std.os.windows.WINAPI) void;proc alljoyn_credentials_setcertchain(
cred: int, # alljoyn_credentials
certChain: cstring # LPCSTR
) {.importc: "alljoyn_credentials_setcertchain", stdcall, dynlib: "MSAJApi.dll".}pragma(lib, "msajapi");
extern(Windows)
void alljoyn_credentials_setcertchain(
ptrdiff_t cred, // alljoyn_credentials
const(char)* certChain // LPCSTR
);ccall((:alljoyn_credentials_setcertchain, "MSAJApi.dll"), stdcall, Cvoid,
(Int, Cstring),
cred, certChain)
# cred : alljoyn_credentials -> Int
# certChain : LPCSTR -> Cstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void alljoyn_credentials_setcertchain(
intptr_t cred,
const char* certChain);
]]
local msajapi = ffi.load("msajapi")
-- msajapi.alljoyn_credentials_setcertchain(cred, certChain)
-- cred : alljoyn_credentials
-- certChain : LPCSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MSAJApi.dll');
const alljoyn_credentials_setcertchain = lib.func('__stdcall', 'alljoyn_credentials_setcertchain', 'void', ['intptr_t', 'str']);
// alljoyn_credentials_setcertchain(cred, certChain)
// cred : alljoyn_credentials -> 'intptr_t'
// certChain : LPCSTR -> 'str'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MSAJApi.dll", {
alljoyn_credentials_setcertchain: { parameters: ["isize", "buffer"], result: "void" },
});
// lib.symbols.alljoyn_credentials_setcertchain(cred, certChain)
// cred : alljoyn_credentials -> "isize"
// certChain : LPCSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void alljoyn_credentials_setcertchain(
intptr_t cred,
const char* certChain);
C, "MSAJApi.dll");
// $ffi->alljoyn_credentials_setcertchain(cred, certChain);
// cred : alljoyn_credentials
// certChain : LPCSTR
// 構造体/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 Msajapi extends StdCallLibrary {
Msajapi INSTANCE = Native.load("msajapi", Msajapi.class);
void alljoyn_credentials_setcertchain(
long cred, // alljoyn_credentials
String certChain // LPCSTR
);
}@[Link("msajapi")]
lib LibMSAJApi
fun alljoyn_credentials_setcertchain = alljoyn_credentials_setcertchain(
cred : LibC::SSizeT, # alljoyn_credentials
certChain : UInt8* # LPCSTR
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef alljoyn_credentials_setcertchainNative = Void Function(IntPtr, Pointer<Utf8>);
typedef alljoyn_credentials_setcertchainDart = void Function(int, Pointer<Utf8>);
final alljoyn_credentials_setcertchain = DynamicLibrary.open('MSAJApi.dll')
.lookupFunction<alljoyn_credentials_setcertchainNative, alljoyn_credentials_setcertchainDart>('alljoyn_credentials_setcertchain');
// cred : alljoyn_credentials -> IntPtr
// certChain : LPCSTR -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure alljoyn_credentials_setcertchain(
cred: NativeInt; // alljoyn_credentials
certChain: PAnsiChar // LPCSTR
); stdcall;
external 'MSAJApi.dll' name 'alljoyn_credentials_setcertchain';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "alljoyn_credentials_setcertchain"
c_alljoyn_credentials_setcertchain :: CIntPtr -> CString -> IO ()
-- cred : alljoyn_credentials -> CIntPtr
-- certChain : LPCSTR -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let alljoyn_credentials_setcertchain =
foreign "alljoyn_credentials_setcertchain"
(intptr_t @-> string @-> returning void)
(* cred : alljoyn_credentials -> intptr_t *)
(* certChain : LPCSTR -> string *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msajapi (t "MSAJApi.dll"))
(cffi:use-foreign-library msajapi)
(cffi:defcfun ("alljoyn_credentials_setcertchain" alljoyn-credentials-setcertchain :convention :stdcall) :void
(cred :int64) ; alljoyn_credentials
(cert-chain :string)) ; LPCSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $alljoyn_credentials_setcertchain = Win32::API::More->new('MSAJApi',
'void alljoyn_credentials_setcertchain(LPARAM cred, LPCSTR certChain)');
# my $ret = $alljoyn_credentials_setcertchain->Call($cred, $certChain);
# cred : alljoyn_credentials -> LPARAM
# certChain : LPCSTR -> LPCSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。