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

alljoyn_interfacedescription_getdescriptionforlanguage

関数
指定言語のインターフェイス説明文を取得する。
DLLMSAJApi.dll呼出規約winapi

シグネチャ

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

UINT_PTR alljoyn_interfacedescription_getdescriptionforlanguage(
    alljoyn_interfacedescription iface,
    LPSTR description,
    UINT_PTR maxLanguageLength,
    LPCSTR languageTag
);

パラメーター

名前方向説明
ifacealljoyn_interfacedescriptionin対象のインターフェース記述ハンドル。
descriptionLPSTRin取得した説明文を受け取るバッファ。NULLで必要長のみ取得可。
maxLanguageLengthUINT_PTRindescriptionバッファのバイト容量を指定する。
languageTagLPCSTRin取得する説明の言語タグを指すNULL終端文字列。

戻り値の型: UINT_PTR

各言語での呼び出し定義

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

UINT_PTR alljoyn_interfacedescription_getdescriptionforlanguage(
    alljoyn_interfacedescription iface,
    LPSTR description,
    UINT_PTR maxLanguageLength,
    LPCSTR languageTag
);
[DllImport("MSAJApi.dll", ExactSpelling = true)]
static extern UIntPtr alljoyn_interfacedescription_getdescriptionforlanguage(
    IntPtr iface,   // alljoyn_interfacedescription
    [MarshalAs(UnmanagedType.LPStr)] string description,   // LPSTR
    UIntPtr maxLanguageLength,   // UINT_PTR
    [MarshalAs(UnmanagedType.LPStr)] string languageTag   // LPCSTR
);
<DllImport("MSAJApi.dll", ExactSpelling:=True)>
Public Shared Function alljoyn_interfacedescription_getdescriptionforlanguage(
    iface As IntPtr,   ' alljoyn_interfacedescription
    <MarshalAs(UnmanagedType.LPStr)> description As String,   ' LPSTR
    maxLanguageLength As UIntPtr,   ' UINT_PTR
    <MarshalAs(UnmanagedType.LPStr)> languageTag As String   ' LPCSTR
) As UIntPtr
End Function
' iface : alljoyn_interfacedescription
' description : LPSTR
' maxLanguageLength : UINT_PTR
' languageTag : LPCSTR
Declare PtrSafe Function alljoyn_interfacedescription_getdescriptionforlanguage Lib "msajapi" ( _
    ByVal iface As LongPtr, _
    ByVal description As String, _
    ByVal maxLanguageLength As LongPtr, _
    ByVal languageTag As String) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

alljoyn_interfacedescription_getdescriptionforlanguage = ctypes.windll.msajapi.alljoyn_interfacedescription_getdescriptionforlanguage
alljoyn_interfacedescription_getdescriptionforlanguage.restype = ctypes.c_size_t
alljoyn_interfacedescription_getdescriptionforlanguage.argtypes = [
    ctypes.c_ssize_t,  # iface : alljoyn_interfacedescription
    wintypes.LPCSTR,  # description : LPSTR
    ctypes.c_size_t,  # maxLanguageLength : UINT_PTR
    wintypes.LPCSTR,  # languageTag : LPCSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MSAJApi.dll')
alljoyn_interfacedescription_getdescriptionforlanguage = Fiddle::Function.new(
  lib['alljoyn_interfacedescription_getdescriptionforlanguage'],
  [
    Fiddle::TYPE_INTPTR_T,  # iface : alljoyn_interfacedescription
    Fiddle::TYPE_VOIDP,  # description : LPSTR
    Fiddle::TYPE_UINTPTR_T,  # maxLanguageLength : UINT_PTR
    Fiddle::TYPE_VOIDP,  # languageTag : LPCSTR
  ],
  Fiddle::TYPE_UINTPTR_T)
#[link(name = "msajapi")]
extern "system" {
    fn alljoyn_interfacedescription_getdescriptionforlanguage(
        iface: isize,  // alljoyn_interfacedescription
        description: *mut u8,  // LPSTR
        maxLanguageLength: usize,  // UINT_PTR
        languageTag: *const u8  // LPCSTR
    ) -> usize;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MSAJApi.dll")]
public static extern UIntPtr alljoyn_interfacedescription_getdescriptionforlanguage(IntPtr iface, [MarshalAs(UnmanagedType.LPStr)] string description, UIntPtr maxLanguageLength, [MarshalAs(UnmanagedType.LPStr)] string languageTag);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSAJApi_alljoyn_interfacedescription_getdescriptionforlanguage' -Namespace Win32 -PassThru
# $api::alljoyn_interfacedescription_getdescriptionforlanguage(iface, description, maxLanguageLength, languageTag)
#uselib "MSAJApi.dll"
#func global alljoyn_interfacedescription_getdescriptionforlanguage "alljoyn_interfacedescription_getdescriptionforlanguage" sptr, sptr, sptr, sptr
; alljoyn_interfacedescription_getdescriptionforlanguage iface, description, maxLanguageLength, languageTag   ; 戻り値は stat
; iface : alljoyn_interfacedescription -> "sptr"
; description : LPSTR -> "sptr"
; maxLanguageLength : UINT_PTR -> "sptr"
; languageTag : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MSAJApi.dll"
#cfunc global alljoyn_interfacedescription_getdescriptionforlanguage "alljoyn_interfacedescription_getdescriptionforlanguage" sptr, str, sptr, str
; res = alljoyn_interfacedescription_getdescriptionforlanguage(iface, description, maxLanguageLength, languageTag)
; iface : alljoyn_interfacedescription -> "sptr"
; description : LPSTR -> "str"
; maxLanguageLength : UINT_PTR -> "sptr"
; languageTag : LPCSTR -> "str"
; UINT_PTR alljoyn_interfacedescription_getdescriptionforlanguage(alljoyn_interfacedescription iface, LPSTR description, UINT_PTR maxLanguageLength, LPCSTR languageTag)
#uselib "MSAJApi.dll"
#cfunc global alljoyn_interfacedescription_getdescriptionforlanguage "alljoyn_interfacedescription_getdescriptionforlanguage" intptr, str, intptr, str
; res = alljoyn_interfacedescription_getdescriptionforlanguage(iface, description, maxLanguageLength, languageTag)
; iface : alljoyn_interfacedescription -> "intptr"
; description : LPSTR -> "str"
; maxLanguageLength : UINT_PTR -> "intptr"
; languageTag : LPCSTR -> "str"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msajapi = windows.NewLazySystemDLL("MSAJApi.dll")
	procalljoyn_interfacedescription_getdescriptionforlanguage = msajapi.NewProc("alljoyn_interfacedescription_getdescriptionforlanguage")
)

// iface (alljoyn_interfacedescription), description (LPSTR), maxLanguageLength (UINT_PTR), languageTag (LPCSTR)
r1, _, err := procalljoyn_interfacedescription_getdescriptionforlanguage.Call(
	uintptr(iface),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(description))),
	uintptr(maxLanguageLength),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(languageTag))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // UINT_PTR
function alljoyn_interfacedescription_getdescriptionforlanguage(
  iface: NativeInt;   // alljoyn_interfacedescription
  description: PAnsiChar;   // LPSTR
  maxLanguageLength: NativeUInt;   // UINT_PTR
  languageTag: PAnsiChar   // LPCSTR
): NativeUInt; stdcall;
  external 'MSAJApi.dll' name 'alljoyn_interfacedescription_getdescriptionforlanguage';
result := DllCall("MSAJApi\alljoyn_interfacedescription_getdescriptionforlanguage"
    , "Ptr", iface   ; alljoyn_interfacedescription
    , "AStr", description   ; LPSTR
    , "UPtr", maxLanguageLength   ; UINT_PTR
    , "AStr", languageTag   ; LPCSTR
    , "UPtr")   ; return: UINT_PTR
●alljoyn_interfacedescription_getdescriptionforlanguage(iface, description, maxLanguageLength, languageTag) = DLL("MSAJApi.dll", "int alljoyn_interfacedescription_getdescriptionforlanguage(int, char*, int, char*)")
# 呼び出し: alljoyn_interfacedescription_getdescriptionforlanguage(iface, description, maxLanguageLength, languageTag)
# iface : alljoyn_interfacedescription -> "int"
# description : LPSTR -> "char*"
# maxLanguageLength : UINT_PTR -> "int"
# languageTag : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "msajapi" fn alljoyn_interfacedescription_getdescriptionforlanguage(
    iface: isize, // alljoyn_interfacedescription
    description: [*c]const u8, // LPSTR
    maxLanguageLength: usize, // UINT_PTR
    languageTag: [*c]const u8 // LPCSTR
) callconv(std.os.windows.WINAPI) usize;
proc alljoyn_interfacedescription_getdescriptionforlanguage(
    iface: int,  # alljoyn_interfacedescription
    description: cstring,  # LPSTR
    maxLanguageLength: uint,  # UINT_PTR
    languageTag: cstring  # LPCSTR
): uint {.importc: "alljoyn_interfacedescription_getdescriptionforlanguage", stdcall, dynlib: "MSAJApi.dll".}
pragma(lib, "msajapi");
extern(Windows)
size_t alljoyn_interfacedescription_getdescriptionforlanguage(
    ptrdiff_t iface,   // alljoyn_interfacedescription
    const(char)* description,   // LPSTR
    size_t maxLanguageLength,   // UINT_PTR
    const(char)* languageTag   // LPCSTR
);
ccall((:alljoyn_interfacedescription_getdescriptionforlanguage, "MSAJApi.dll"), stdcall, Csize_t,
      (Int, Cstring, Csize_t, Cstring),
      iface, description, maxLanguageLength, languageTag)
# iface : alljoyn_interfacedescription -> Int
# description : LPSTR -> Cstring
# maxLanguageLength : UINT_PTR -> Csize_t
# languageTag : LPCSTR -> Cstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uintptr_t alljoyn_interfacedescription_getdescriptionforlanguage(
    intptr_t iface,
    const char* description,
    uintptr_t maxLanguageLength,
    const char* languageTag);
]]
local msajapi = ffi.load("msajapi")
-- msajapi.alljoyn_interfacedescription_getdescriptionforlanguage(iface, description, maxLanguageLength, languageTag)
-- iface : alljoyn_interfacedescription
-- description : LPSTR
-- maxLanguageLength : UINT_PTR
-- languageTag : LPCSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MSAJApi.dll');
const alljoyn_interfacedescription_getdescriptionforlanguage = lib.func('__stdcall', 'alljoyn_interfacedescription_getdescriptionforlanguage', 'uintptr_t', ['intptr_t', 'str', 'uintptr_t', 'str']);
// alljoyn_interfacedescription_getdescriptionforlanguage(iface, description, maxLanguageLength, languageTag)
// iface : alljoyn_interfacedescription -> 'intptr_t'
// description : LPSTR -> 'str'
// maxLanguageLength : UINT_PTR -> 'uintptr_t'
// languageTag : LPCSTR -> 'str'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MSAJApi.dll", {
  alljoyn_interfacedescription_getdescriptionforlanguage: { parameters: ["isize", "buffer", "usize", "buffer"], result: "usize" },
});
// lib.symbols.alljoyn_interfacedescription_getdescriptionforlanguage(iface, description, maxLanguageLength, languageTag)
// iface : alljoyn_interfacedescription -> "isize"
// description : LPSTR -> "buffer"
// maxLanguageLength : UINT_PTR -> "usize"
// languageTag : LPCSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
size_t alljoyn_interfacedescription_getdescriptionforlanguage(
    intptr_t iface,
    const char* description,
    size_t maxLanguageLength,
    const char* languageTag);
C, "MSAJApi.dll");
// $ffi->alljoyn_interfacedescription_getdescriptionforlanguage(iface, description, maxLanguageLength, languageTag);
// iface : alljoyn_interfacedescription
// description : LPSTR
// maxLanguageLength : UINT_PTR
// languageTag : 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);
    long alljoyn_interfacedescription_getdescriptionforlanguage(
        long iface,   // alljoyn_interfacedescription
        String description,   // LPSTR
        long maxLanguageLength,   // UINT_PTR
        String languageTag   // LPCSTR
    );
}
@[Link("msajapi")]
lib LibMSAJApi
  fun alljoyn_interfacedescription_getdescriptionforlanguage = alljoyn_interfacedescription_getdescriptionforlanguage(
    iface : LibC::SSizeT,   # alljoyn_interfacedescription
    description : UInt8*,   # LPSTR
    maxLanguageLength : LibC::SizeT,   # UINT_PTR
    languageTag : UInt8*   # LPCSTR
  ) : LibC::SizeT
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef alljoyn_interfacedescription_getdescriptionforlanguageNative = UintPtr Function(IntPtr, Pointer<Utf8>, UintPtr, Pointer<Utf8>);
typedef alljoyn_interfacedescription_getdescriptionforlanguageDart = int Function(int, Pointer<Utf8>, int, Pointer<Utf8>);
final alljoyn_interfacedescription_getdescriptionforlanguage = DynamicLibrary.open('MSAJApi.dll')
    .lookupFunction<alljoyn_interfacedescription_getdescriptionforlanguageNative, alljoyn_interfacedescription_getdescriptionforlanguageDart>('alljoyn_interfacedescription_getdescriptionforlanguage');
// iface : alljoyn_interfacedescription -> IntPtr
// description : LPSTR -> Pointer<Utf8>
// maxLanguageLength : UINT_PTR -> UintPtr
// languageTag : LPCSTR -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function alljoyn_interfacedescription_getdescriptionforlanguage(
  iface: NativeInt;   // alljoyn_interfacedescription
  description: PAnsiChar;   // LPSTR
  maxLanguageLength: NativeUInt;   // UINT_PTR
  languageTag: PAnsiChar   // LPCSTR
): NativeUInt; stdcall;
  external 'MSAJApi.dll' name 'alljoyn_interfacedescription_getdescriptionforlanguage';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "alljoyn_interfacedescription_getdescriptionforlanguage"
  c_alljoyn_interfacedescription_getdescriptionforlanguage :: CIntPtr -> CString -> CUIntPtr -> CString -> IO CUIntPtr
-- iface : alljoyn_interfacedescription -> CIntPtr
-- description : LPSTR -> CString
-- maxLanguageLength : UINT_PTR -> CUIntPtr
-- languageTag : LPCSTR -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let alljoyn_interfacedescription_getdescriptionforlanguage =
  foreign "alljoyn_interfacedescription_getdescriptionforlanguage"
    (intptr_t @-> string @-> size_t @-> string @-> returning size_t)
(* iface : alljoyn_interfacedescription -> intptr_t *)
(* description : LPSTR -> string *)
(* maxLanguageLength : UINT_PTR -> size_t *)
(* languageTag : 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_interfacedescription_getdescriptionforlanguage" alljoyn-interfacedescription-getdescriptionforlanguage :convention :stdcall) :uint64
  (iface :int64)   ; alljoyn_interfacedescription
  (description :string)   ; LPSTR
  (max-language-length :uint64)   ; UINT_PTR
  (language-tag :string))   ; LPCSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $alljoyn_interfacedescription_getdescriptionforlanguage = Win32::API::More->new('MSAJApi',
    'WPARAM alljoyn_interfacedescription_getdescriptionforlanguage(LPARAM iface, LPCSTR description, WPARAM maxLanguageLength, LPCSTR languageTag)');
# my $ret = $alljoyn_interfacedescription_getdescriptionforlanguage->Call($iface, $description, $maxLanguageLength, $languageTag);
# iface : alljoyn_interfacedescription -> LPARAM
# description : LPSTR -> LPCSTR
# maxLanguageLength : UINT_PTR -> WPARAM
# languageTag : LPCSTR -> LPCSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。