ホーム › Devices.AllJoyn › alljoyn_busattachment_namehasowner
alljoyn_busattachment_namehasowner
関数指定したバス名に所有者が存在するか確認する。
シグネチャ
// MSAJApi.dll
#include <windows.h>
QStatus alljoyn_busattachment_namehasowner(
alljoyn_busattachment bus,
LPCSTR name,
INT* hasOwner
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| bus | alljoyn_busattachment | in | 操作対象のバスアタッチメントハンドル。AllJoyn接続を表す。 |
| name | LPCSTR | in | 所有者の有無を調べるウェルノウン名。 |
| hasOwner | INT* | inout | [出力]所有者が存在すれば非0、なければ0を受け取るポインタ。 |
戻り値の型: QStatus
各言語での呼び出し定義
// MSAJApi.dll
#include <windows.h>
QStatus alljoyn_busattachment_namehasowner(
alljoyn_busattachment bus,
LPCSTR name,
INT* hasOwner
);[DllImport("MSAJApi.dll", ExactSpelling = true)]
static extern int alljoyn_busattachment_namehasowner(
IntPtr bus, // alljoyn_busattachment
[MarshalAs(UnmanagedType.LPStr)] string name, // LPCSTR
ref int hasOwner // INT* in/out
);<DllImport("MSAJApi.dll", ExactSpelling:=True)>
Public Shared Function alljoyn_busattachment_namehasowner(
bus As IntPtr, ' alljoyn_busattachment
<MarshalAs(UnmanagedType.LPStr)> name As String, ' LPCSTR
ByRef hasOwner As Integer ' INT* in/out
) As Integer
End Function' bus : alljoyn_busattachment
' name : LPCSTR
' hasOwner : INT* in/out
Declare PtrSafe Function alljoyn_busattachment_namehasowner Lib "msajapi" ( _
ByVal bus As LongPtr, _
ByVal name As String, _
ByRef hasOwner As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
alljoyn_busattachment_namehasowner = ctypes.windll.msajapi.alljoyn_busattachment_namehasowner
alljoyn_busattachment_namehasowner.restype = ctypes.c_int
alljoyn_busattachment_namehasowner.argtypes = [
ctypes.c_ssize_t, # bus : alljoyn_busattachment
wintypes.LPCSTR, # name : LPCSTR
ctypes.POINTER(ctypes.c_int), # hasOwner : INT* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSAJApi.dll')
alljoyn_busattachment_namehasowner = Fiddle::Function.new(
lib['alljoyn_busattachment_namehasowner'],
[
Fiddle::TYPE_INTPTR_T, # bus : alljoyn_busattachment
Fiddle::TYPE_VOIDP, # name : LPCSTR
Fiddle::TYPE_VOIDP, # hasOwner : INT* in/out
],
Fiddle::TYPE_INT)#[link(name = "msajapi")]
extern "system" {
fn alljoyn_busattachment_namehasowner(
bus: isize, // alljoyn_busattachment
name: *const u8, // LPCSTR
hasOwner: *mut i32 // INT* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSAJApi.dll")]
public static extern int alljoyn_busattachment_namehasowner(IntPtr bus, [MarshalAs(UnmanagedType.LPStr)] string name, ref int hasOwner);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSAJApi_alljoyn_busattachment_namehasowner' -Namespace Win32 -PassThru
# $api::alljoyn_busattachment_namehasowner(bus, name, hasOwner)#uselib "MSAJApi.dll"
#func global alljoyn_busattachment_namehasowner "alljoyn_busattachment_namehasowner" sptr, sptr, sptr
; alljoyn_busattachment_namehasowner bus, name, varptr(hasOwner) ; 戻り値は stat
; bus : alljoyn_busattachment -> "sptr"
; name : LPCSTR -> "sptr"
; hasOwner : INT* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MSAJApi.dll" #cfunc global alljoyn_busattachment_namehasowner "alljoyn_busattachment_namehasowner" sptr, str, var ; res = alljoyn_busattachment_namehasowner(bus, name, hasOwner) ; bus : alljoyn_busattachment -> "sptr" ; name : LPCSTR -> "str" ; hasOwner : INT* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MSAJApi.dll" #cfunc global alljoyn_busattachment_namehasowner "alljoyn_busattachment_namehasowner" sptr, str, sptr ; res = alljoyn_busattachment_namehasowner(bus, name, varptr(hasOwner)) ; bus : alljoyn_busattachment -> "sptr" ; name : LPCSTR -> "str" ; hasOwner : INT* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; QStatus alljoyn_busattachment_namehasowner(alljoyn_busattachment bus, LPCSTR name, INT* hasOwner) #uselib "MSAJApi.dll" #cfunc global alljoyn_busattachment_namehasowner "alljoyn_busattachment_namehasowner" intptr, str, var ; res = alljoyn_busattachment_namehasowner(bus, name, hasOwner) ; bus : alljoyn_busattachment -> "intptr" ; name : LPCSTR -> "str" ; hasOwner : INT* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; QStatus alljoyn_busattachment_namehasowner(alljoyn_busattachment bus, LPCSTR name, INT* hasOwner) #uselib "MSAJApi.dll" #cfunc global alljoyn_busattachment_namehasowner "alljoyn_busattachment_namehasowner" intptr, str, intptr ; res = alljoyn_busattachment_namehasowner(bus, name, varptr(hasOwner)) ; bus : alljoyn_busattachment -> "intptr" ; name : LPCSTR -> "str" ; hasOwner : INT* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msajapi = windows.NewLazySystemDLL("MSAJApi.dll")
procalljoyn_busattachment_namehasowner = msajapi.NewProc("alljoyn_busattachment_namehasowner")
)
// bus (alljoyn_busattachment), name (LPCSTR), hasOwner (INT* in/out)
r1, _, err := procalljoyn_busattachment_namehasowner.Call(
uintptr(bus),
uintptr(unsafe.Pointer(windows.BytePtrFromString(name))),
uintptr(hasOwner),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // QStatusfunction alljoyn_busattachment_namehasowner(
bus: NativeInt; // alljoyn_busattachment
name: PAnsiChar; // LPCSTR
hasOwner: Pointer // INT* in/out
): Integer; stdcall;
external 'MSAJApi.dll' name 'alljoyn_busattachment_namehasowner';result := DllCall("MSAJApi\alljoyn_busattachment_namehasowner"
, "Ptr", bus ; alljoyn_busattachment
, "AStr", name ; LPCSTR
, "Ptr", hasOwner ; INT* in/out
, "Int") ; return: QStatus●alljoyn_busattachment_namehasowner(bus, name, hasOwner) = DLL("MSAJApi.dll", "int alljoyn_busattachment_namehasowner(int, char*, void*)")
# 呼び出し: alljoyn_busattachment_namehasowner(bus, name, hasOwner)
# bus : alljoyn_busattachment -> "int"
# name : LPCSTR -> "char*"
# hasOwner : INT* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msajapi" fn alljoyn_busattachment_namehasowner(
bus: isize, // alljoyn_busattachment
name: [*c]const u8, // LPCSTR
hasOwner: [*c]i32 // INT* in/out
) callconv(std.os.windows.WINAPI) i32;proc alljoyn_busattachment_namehasowner(
bus: int, # alljoyn_busattachment
name: cstring, # LPCSTR
hasOwner: ptr int32 # INT* in/out
): int32 {.importc: "alljoyn_busattachment_namehasowner", stdcall, dynlib: "MSAJApi.dll".}pragma(lib, "msajapi");
extern(Windows)
int alljoyn_busattachment_namehasowner(
ptrdiff_t bus, // alljoyn_busattachment
const(char)* name, // LPCSTR
int* hasOwner // INT* in/out
);ccall((:alljoyn_busattachment_namehasowner, "MSAJApi.dll"), stdcall, Int32,
(Int, Cstring, Ptr{Int32}),
bus, name, hasOwner)
# bus : alljoyn_busattachment -> Int
# name : LPCSTR -> Cstring
# hasOwner : INT* in/out -> Ptr{Int32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t alljoyn_busattachment_namehasowner(
intptr_t bus,
const char* name,
int32_t* hasOwner);
]]
local msajapi = ffi.load("msajapi")
-- msajapi.alljoyn_busattachment_namehasowner(bus, name, hasOwner)
-- bus : alljoyn_busattachment
-- name : LPCSTR
-- hasOwner : INT* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MSAJApi.dll');
const alljoyn_busattachment_namehasowner = lib.func('__stdcall', 'alljoyn_busattachment_namehasowner', 'int32_t', ['intptr_t', 'str', 'int32_t *']);
// alljoyn_busattachment_namehasowner(bus, name, hasOwner)
// bus : alljoyn_busattachment -> 'intptr_t'
// name : LPCSTR -> 'str'
// hasOwner : INT* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MSAJApi.dll", {
alljoyn_busattachment_namehasowner: { parameters: ["isize", "buffer", "pointer"], result: "i32" },
});
// lib.symbols.alljoyn_busattachment_namehasowner(bus, name, hasOwner)
// bus : alljoyn_busattachment -> "isize"
// name : LPCSTR -> "buffer"
// hasOwner : INT* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t alljoyn_busattachment_namehasowner(
intptr_t bus,
const char* name,
int32_t* hasOwner);
C, "MSAJApi.dll");
// $ffi->alljoyn_busattachment_namehasowner(bus, name, hasOwner);
// bus : alljoyn_busattachment
// name : LPCSTR
// hasOwner : INT* in/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 Msajapi extends StdCallLibrary {
Msajapi INSTANCE = Native.load("msajapi", Msajapi.class);
int alljoyn_busattachment_namehasowner(
long bus, // alljoyn_busattachment
String name, // LPCSTR
IntByReference hasOwner // INT* in/out
);
}@[Link("msajapi")]
lib LibMSAJApi
fun alljoyn_busattachment_namehasowner = alljoyn_busattachment_namehasowner(
bus : LibC::SSizeT, # alljoyn_busattachment
name : UInt8*, # LPCSTR
hasOwner : Int32* # INT* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef alljoyn_busattachment_namehasownerNative = Int32 Function(IntPtr, Pointer<Utf8>, Pointer<Int32>);
typedef alljoyn_busattachment_namehasownerDart = int Function(int, Pointer<Utf8>, Pointer<Int32>);
final alljoyn_busattachment_namehasowner = DynamicLibrary.open('MSAJApi.dll')
.lookupFunction<alljoyn_busattachment_namehasownerNative, alljoyn_busattachment_namehasownerDart>('alljoyn_busattachment_namehasowner');
// bus : alljoyn_busattachment -> IntPtr
// name : LPCSTR -> Pointer<Utf8>
// hasOwner : INT* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function alljoyn_busattachment_namehasowner(
bus: NativeInt; // alljoyn_busattachment
name: PAnsiChar; // LPCSTR
hasOwner: Pointer // INT* in/out
): Integer; stdcall;
external 'MSAJApi.dll' name 'alljoyn_busattachment_namehasowner';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "alljoyn_busattachment_namehasowner"
c_alljoyn_busattachment_namehasowner :: CIntPtr -> CString -> Ptr Int32 -> IO Int32
-- bus : alljoyn_busattachment -> CIntPtr
-- name : LPCSTR -> CString
-- hasOwner : INT* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let alljoyn_busattachment_namehasowner =
foreign "alljoyn_busattachment_namehasowner"
(intptr_t @-> string @-> (ptr int32_t) @-> returning int32_t)
(* bus : alljoyn_busattachment -> intptr_t *)
(* name : LPCSTR -> string *)
(* hasOwner : INT* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msajapi (t "MSAJApi.dll"))
(cffi:use-foreign-library msajapi)
(cffi:defcfun ("alljoyn_busattachment_namehasowner" alljoyn-busattachment-namehasowner :convention :stdcall) :int32
(bus :int64) ; alljoyn_busattachment
(name :string) ; LPCSTR
(has-owner :pointer)) ; INT* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $alljoyn_busattachment_namehasowner = Win32::API::More->new('MSAJApi',
'int alljoyn_busattachment_namehasowner(LPARAM bus, LPCSTR name, LPVOID hasOwner)');
# my $ret = $alljoyn_busattachment_namehasowner->Call($bus, $name, $hasOwner);
# bus : alljoyn_busattachment -> LPARAM
# name : LPCSTR -> LPCSTR
# hasOwner : INT* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型