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