ホーム › Devices.AllJoyn › alljoyn_message_getargs
alljoyn_message_getargs
関数AllJoynメッセージに含まれる引数の個数と引数配列を取得する。
シグネチャ
// MSAJApi.dll
#include <windows.h>
void alljoyn_message_getargs(
alljoyn_message msg,
UINT_PTR* numArgs,
alljoyn_msgarg* args
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| msg | alljoyn_message | in | 引数を取得する対象のメッセージハンドル。 |
| numArgs | UINT_PTR* | inout | 取得した引数の個数を受け取る出力ポインタ。 |
| args | alljoyn_msgarg* | inout | 引数配列の先頭を受け取るメッセージ引数ポインタ。 |
戻り値の型: void
各言語での呼び出し定義
// MSAJApi.dll
#include <windows.h>
void alljoyn_message_getargs(
alljoyn_message msg,
UINT_PTR* numArgs,
alljoyn_msgarg* args
);[DllImport("MSAJApi.dll", ExactSpelling = true)]
static extern void alljoyn_message_getargs(
IntPtr msg, // alljoyn_message
ref UIntPtr numArgs, // UINT_PTR* in/out
ref IntPtr args // alljoyn_msgarg* in/out
);<DllImport("MSAJApi.dll", ExactSpelling:=True)>
Public Shared Sub alljoyn_message_getargs(
msg As IntPtr, ' alljoyn_message
ByRef numArgs As UIntPtr, ' UINT_PTR* in/out
ByRef args As IntPtr ' alljoyn_msgarg* in/out
)
End Sub' msg : alljoyn_message
' numArgs : UINT_PTR* in/out
' args : alljoyn_msgarg* in/out
Declare PtrSafe Sub alljoyn_message_getargs Lib "msajapi" ( _
ByVal msg As LongPtr, _
ByRef numArgs As LongPtr, _
ByRef args As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
alljoyn_message_getargs = ctypes.windll.msajapi.alljoyn_message_getargs
alljoyn_message_getargs.restype = None
alljoyn_message_getargs.argtypes = [
ctypes.c_ssize_t, # msg : alljoyn_message
ctypes.POINTER(ctypes.c_size_t), # numArgs : UINT_PTR* in/out
ctypes.c_void_p, # args : alljoyn_msgarg* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSAJApi.dll')
alljoyn_message_getargs = Fiddle::Function.new(
lib['alljoyn_message_getargs'],
[
Fiddle::TYPE_INTPTR_T, # msg : alljoyn_message
Fiddle::TYPE_VOIDP, # numArgs : UINT_PTR* in/out
Fiddle::TYPE_VOIDP, # args : alljoyn_msgarg* in/out
],
Fiddle::TYPE_VOID)#[link(name = "msajapi")]
extern "system" {
fn alljoyn_message_getargs(
msg: isize, // alljoyn_message
numArgs: *mut usize, // UINT_PTR* in/out
args: *mut isize // alljoyn_msgarg* in/out
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSAJApi.dll")]
public static extern void alljoyn_message_getargs(IntPtr msg, ref UIntPtr numArgs, ref IntPtr args);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSAJApi_alljoyn_message_getargs' -Namespace Win32 -PassThru
# $api::alljoyn_message_getargs(msg, numArgs, args)#uselib "MSAJApi.dll"
#func global alljoyn_message_getargs "alljoyn_message_getargs" sptr, sptr, sptr
; alljoyn_message_getargs msg, varptr(numArgs), varptr(args)
; msg : alljoyn_message -> "sptr"
; numArgs : UINT_PTR* in/out -> "sptr"
; args : alljoyn_msgarg* in/out -> "sptr"出力引数:
#uselib "MSAJApi.dll" #func global alljoyn_message_getargs "alljoyn_message_getargs" sptr, var, var ; alljoyn_message_getargs msg, numArgs, args ; msg : alljoyn_message -> "sptr" ; numArgs : UINT_PTR* in/out -> "var" ; args : alljoyn_msgarg* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MSAJApi.dll" #func global alljoyn_message_getargs "alljoyn_message_getargs" sptr, sptr, sptr ; alljoyn_message_getargs msg, varptr(numArgs), varptr(args) ; msg : alljoyn_message -> "sptr" ; numArgs : UINT_PTR* in/out -> "sptr" ; args : alljoyn_msgarg* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void alljoyn_message_getargs(alljoyn_message msg, UINT_PTR* numArgs, alljoyn_msgarg* args) #uselib "MSAJApi.dll" #func global alljoyn_message_getargs "alljoyn_message_getargs" intptr, var, var ; alljoyn_message_getargs msg, numArgs, args ; msg : alljoyn_message -> "intptr" ; numArgs : UINT_PTR* in/out -> "var" ; args : alljoyn_msgarg* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void alljoyn_message_getargs(alljoyn_message msg, UINT_PTR* numArgs, alljoyn_msgarg* args) #uselib "MSAJApi.dll" #func global alljoyn_message_getargs "alljoyn_message_getargs" intptr, intptr, intptr ; alljoyn_message_getargs msg, varptr(numArgs), varptr(args) ; msg : alljoyn_message -> "intptr" ; numArgs : UINT_PTR* in/out -> "intptr" ; args : alljoyn_msgarg* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msajapi = windows.NewLazySystemDLL("MSAJApi.dll")
procalljoyn_message_getargs = msajapi.NewProc("alljoyn_message_getargs")
)
// msg (alljoyn_message), numArgs (UINT_PTR* in/out), args (alljoyn_msgarg* in/out)
r1, _, err := procalljoyn_message_getargs.Call(
uintptr(msg),
uintptr(numArgs),
uintptr(args),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure alljoyn_message_getargs(
msg: NativeInt; // alljoyn_message
numArgs: Pointer; // UINT_PTR* in/out
args: Pointer // alljoyn_msgarg* in/out
); stdcall;
external 'MSAJApi.dll' name 'alljoyn_message_getargs';result := DllCall("MSAJApi\alljoyn_message_getargs"
, "Ptr", msg ; alljoyn_message
, "Ptr", numArgs ; UINT_PTR* in/out
, "Ptr", args ; alljoyn_msgarg* in/out
, "Int") ; return: void●alljoyn_message_getargs(msg, numArgs, args) = DLL("MSAJApi.dll", "int alljoyn_message_getargs(int, void*, void*)")
# 呼び出し: alljoyn_message_getargs(msg, numArgs, args)
# msg : alljoyn_message -> "int"
# numArgs : UINT_PTR* in/out -> "void*"
# args : alljoyn_msgarg* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msajapi" fn alljoyn_message_getargs(
msg: isize, // alljoyn_message
numArgs: [*c]usize, // UINT_PTR* in/out
args: [*c]isize // alljoyn_msgarg* in/out
) callconv(std.os.windows.WINAPI) void;proc alljoyn_message_getargs(
msg: int, # alljoyn_message
numArgs: ptr uint, # UINT_PTR* in/out
args: ptr int # alljoyn_msgarg* in/out
) {.importc: "alljoyn_message_getargs", stdcall, dynlib: "MSAJApi.dll".}pragma(lib, "msajapi");
extern(Windows)
void alljoyn_message_getargs(
ptrdiff_t msg, // alljoyn_message
size_t* numArgs, // UINT_PTR* in/out
ptrdiff_t* args // alljoyn_msgarg* in/out
);ccall((:alljoyn_message_getargs, "MSAJApi.dll"), stdcall, Cvoid,
(Int, Ptr{Csize_t}, Ptr{Int}),
msg, numArgs, args)
# msg : alljoyn_message -> Int
# numArgs : UINT_PTR* in/out -> Ptr{Csize_t}
# args : alljoyn_msgarg* in/out -> Ptr{Int}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void alljoyn_message_getargs(
intptr_t msg,
uintptr_t* numArgs,
intptr_t* args);
]]
local msajapi = ffi.load("msajapi")
-- msajapi.alljoyn_message_getargs(msg, numArgs, args)
-- msg : alljoyn_message
-- numArgs : UINT_PTR* in/out
-- args : alljoyn_msgarg* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MSAJApi.dll');
const alljoyn_message_getargs = lib.func('__stdcall', 'alljoyn_message_getargs', 'void', ['intptr_t', 'uintptr_t *', 'intptr_t *']);
// alljoyn_message_getargs(msg, numArgs, args)
// msg : alljoyn_message -> 'intptr_t'
// numArgs : UINT_PTR* in/out -> 'uintptr_t *'
// args : alljoyn_msgarg* in/out -> 'intptr_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MSAJApi.dll", {
alljoyn_message_getargs: { parameters: ["isize", "pointer", "pointer"], result: "void" },
});
// lib.symbols.alljoyn_message_getargs(msg, numArgs, args)
// msg : alljoyn_message -> "isize"
// numArgs : UINT_PTR* in/out -> "pointer"
// args : alljoyn_msgarg* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void alljoyn_message_getargs(
intptr_t msg,
size_t* numArgs,
intptr_t* args);
C, "MSAJApi.dll");
// $ffi->alljoyn_message_getargs(msg, numArgs, args);
// msg : alljoyn_message
// numArgs : UINT_PTR* in/out
// args : alljoyn_msgarg* 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);
void alljoyn_message_getargs(
long msg, // alljoyn_message
LongByReference numArgs, // UINT_PTR* in/out
LongByReference args // alljoyn_msgarg* in/out
);
}@[Link("msajapi")]
lib LibMSAJApi
fun alljoyn_message_getargs = alljoyn_message_getargs(
msg : LibC::SSizeT, # alljoyn_message
numArgs : LibC::SizeT*, # UINT_PTR* in/out
args : LibC::SSizeT* # alljoyn_msgarg* in/out
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef alljoyn_message_getargsNative = Void Function(IntPtr, Pointer<UintPtr>, Pointer<IntPtr>);
typedef alljoyn_message_getargsDart = void Function(int, Pointer<UintPtr>, Pointer<IntPtr>);
final alljoyn_message_getargs = DynamicLibrary.open('MSAJApi.dll')
.lookupFunction<alljoyn_message_getargsNative, alljoyn_message_getargsDart>('alljoyn_message_getargs');
// msg : alljoyn_message -> IntPtr
// numArgs : UINT_PTR* in/out -> Pointer<UintPtr>
// args : alljoyn_msgarg* in/out -> Pointer<IntPtr>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure alljoyn_message_getargs(
msg: NativeInt; // alljoyn_message
numArgs: Pointer; // UINT_PTR* in/out
args: Pointer // alljoyn_msgarg* in/out
); stdcall;
external 'MSAJApi.dll' name 'alljoyn_message_getargs';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "alljoyn_message_getargs"
c_alljoyn_message_getargs :: CIntPtr -> Ptr CUIntPtr -> Ptr CIntPtr -> IO ()
-- msg : alljoyn_message -> CIntPtr
-- numArgs : UINT_PTR* in/out -> Ptr CUIntPtr
-- args : alljoyn_msgarg* in/out -> Ptr CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let alljoyn_message_getargs =
foreign "alljoyn_message_getargs"
(intptr_t @-> (ptr size_t) @-> (ptr intptr_t) @-> returning void)
(* msg : alljoyn_message -> intptr_t *)
(* numArgs : UINT_PTR* in/out -> (ptr size_t) *)
(* args : alljoyn_msgarg* in/out -> (ptr intptr_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msajapi (t "MSAJApi.dll"))
(cffi:use-foreign-library msajapi)
(cffi:defcfun ("alljoyn_message_getargs" alljoyn-message-getargs :convention :stdcall) :void
(msg :int64) ; alljoyn_message
(num-args :pointer) ; UINT_PTR* in/out
(args :pointer)) ; alljoyn_msgarg* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $alljoyn_message_getargs = Win32::API::More->new('MSAJApi',
'void alljoyn_message_getargs(LPARAM msg, LPVOID numArgs, LPVOID args)');
# my $ret = $alljoyn_message_getargs->Call($msg, $numArgs, $args);
# msg : alljoyn_message -> LPARAM
# numArgs : UINT_PTR* in/out -> LPVOID
# args : alljoyn_msgarg* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。