Win32 API 日本語リファレンス
ホームGlobalization › uidna_labelToUnicode

uidna_labelToUnicode

関数
ASCII形式のドメインラベルをUnicodeへ逆変換する。
DLLicuuc.dll呼出規約cdecl

シグネチャ

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

INT uidna_labelToUnicode(
    const UIDNA* idna,
    const WORD* label,
    INT length,
    WORD* dest,
    INT capacity,
    UIDNAInfo* pInfo,
    UErrorCode* pErrorCode
);

パラメーター

名前方向説明
idnaUIDNA*in変換に用いる開いたUIDNAインスタンスを指す。
labelWORD*inUnicodeへ変換する単一ドメインラベルを指す。
lengthINTinlabelの長さをUChar単位で指定する。-1でNUL終端。
destWORD*inout変換結果のUnicodeラベルを格納する出力バッファ。NULL可。
capacityINTindestの容量をUChar単位で指定する。0で事前長取得。
pInfoUIDNAInfo*inout処理結果やエラーフラグを受け取るUIDNAInfo構造体を指す。
pErrorCodeUErrorCode*inoutICUエラーコードを入出力するポインタ。呼出前に成功値で初期化する。

戻り値の型: INT

各言語での呼び出し定義

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

INT uidna_labelToUnicode(
    const UIDNA* idna,
    const WORD* label,
    INT length,
    WORD* dest,
    INT capacity,
    UIDNAInfo* pInfo,
    UErrorCode* pErrorCode
);
[DllImport("icuuc.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int uidna_labelToUnicode(
    ref IntPtr idna,   // UIDNA*
    ref ushort label,   // WORD*
    int length,   // INT
    ref ushort dest,   // WORD* in/out
    int capacity,   // INT
    IntPtr pInfo,   // UIDNAInfo* in/out
    ref int pErrorCode   // UErrorCode* in/out
);
<DllImport("icuuc.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uidna_labelToUnicode(
    ByRef idna As IntPtr,   ' UIDNA*
    ByRef label As UShort,   ' WORD*
    length As Integer,   ' INT
    ByRef dest As UShort,   ' WORD* in/out
    capacity As Integer,   ' INT
    pInfo As IntPtr,   ' UIDNAInfo* in/out
    ByRef pErrorCode As Integer   ' UErrorCode* in/out
) As Integer
End Function
' idna : UIDNA*
' label : WORD*
' length : INT
' dest : WORD* in/out
' capacity : INT
' pInfo : UIDNAInfo* in/out
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function uidna_labelToUnicode Lib "icuuc" ( _
    ByRef idna As LongPtr, _
    ByRef label As Integer, _
    ByVal length As Long, _
    ByRef dest As Integer, _
    ByVal capacity As Long, _
    ByVal pInfo As LongPtr, _
    ByRef pErrorCode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

uidna_labelToUnicode = ctypes.cdll.icuuc.uidna_labelToUnicode
uidna_labelToUnicode.restype = ctypes.c_int
uidna_labelToUnicode.argtypes = [
    ctypes.c_void_p,  # idna : UIDNA*
    ctypes.POINTER(ctypes.c_ushort),  # label : WORD*
    ctypes.c_int,  # length : INT
    ctypes.POINTER(ctypes.c_ushort),  # dest : WORD* in/out
    ctypes.c_int,  # capacity : INT
    ctypes.c_void_p,  # pInfo : UIDNAInfo* in/out
    ctypes.c_void_p,  # pErrorCode : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuuc.dll')
uidna_labelToUnicode = Fiddle::Function.new(
  lib['uidna_labelToUnicode'],
  [
    Fiddle::TYPE_VOIDP,  # idna : UIDNA*
    Fiddle::TYPE_VOIDP,  # label : WORD*
    Fiddle::TYPE_INT,  # length : INT
    Fiddle::TYPE_VOIDP,  # dest : WORD* in/out
    Fiddle::TYPE_INT,  # capacity : INT
    Fiddle::TYPE_VOIDP,  # pInfo : UIDNAInfo* in/out
    Fiddle::TYPE_VOIDP,  # pErrorCode : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuuc")]
extern "C" {
    fn uidna_labelToUnicode(
        idna: *const isize,  // UIDNA*
        label: *const u16,  // WORD*
        length: i32,  // INT
        dest: *mut u16,  // WORD* in/out
        capacity: i32,  // INT
        pInfo: *mut UIDNAInfo,  // UIDNAInfo* in/out
        pErrorCode: *mut i32  // UErrorCode* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuuc.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int uidna_labelToUnicode(ref IntPtr idna, ref ushort label, int length, ref ushort dest, int capacity, IntPtr pInfo, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuuc_uidna_labelToUnicode' -Namespace Win32 -PassThru
# $api::uidna_labelToUnicode(idna, label, length, dest, capacity, pInfo, pErrorCode)
#uselib "icuuc.dll"
#func global uidna_labelToUnicode "uidna_labelToUnicode" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; uidna_labelToUnicode varptr(idna), varptr(label), length, varptr(dest), capacity, varptr(pInfo), varptr(pErrorCode)   ; 戻り値は stat
; idna : UIDNA* -> "sptr"
; label : WORD* -> "sptr"
; length : INT -> "sptr"
; dest : WORD* in/out -> "sptr"
; capacity : INT -> "sptr"
; pInfo : UIDNAInfo* in/out -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuuc.dll"
#cfunc global uidna_labelToUnicode "uidna_labelToUnicode" var, var, int, var, int, var, var
; res = uidna_labelToUnicode(idna, label, length, dest, capacity, pInfo, pErrorCode)
; idna : UIDNA* -> "var"
; label : WORD* -> "var"
; length : INT -> "int"
; dest : WORD* in/out -> "var"
; capacity : INT -> "int"
; pInfo : UIDNAInfo* in/out -> "var"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT uidna_labelToUnicode(UIDNA* idna, WORD* label, INT length, WORD* dest, INT capacity, UIDNAInfo* pInfo, UErrorCode* pErrorCode)
#uselib "icuuc.dll"
#cfunc global uidna_labelToUnicode "uidna_labelToUnicode" var, var, int, var, int, var, var
; res = uidna_labelToUnicode(idna, label, length, dest, capacity, pInfo, pErrorCode)
; idna : UIDNA* -> "var"
; label : WORD* -> "var"
; length : INT -> "int"
; dest : WORD* in/out -> "var"
; capacity : INT -> "int"
; pInfo : UIDNAInfo* in/out -> "var"
; pErrorCode : UErrorCode* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuuc = windows.NewLazySystemDLL("icuuc.dll")
	procuidna_labelToUnicode = icuuc.NewProc("uidna_labelToUnicode")
)

// idna (UIDNA*), label (WORD*), length (INT), dest (WORD* in/out), capacity (INT), pInfo (UIDNAInfo* in/out), pErrorCode (UErrorCode* in/out)
r1, _, err := procuidna_labelToUnicode.Call(
	uintptr(idna),
	uintptr(label),
	uintptr(length),
	uintptr(dest),
	uintptr(capacity),
	uintptr(pInfo),
	uintptr(pErrorCode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function uidna_labelToUnicode(
  idna: Pointer;   // UIDNA*
  label: Pointer;   // WORD*
  length: Integer;   // INT
  dest: Pointer;   // WORD* in/out
  capacity: Integer;   // INT
  pInfo: Pointer;   // UIDNAInfo* in/out
  pErrorCode: Pointer   // UErrorCode* in/out
): Integer; cdecl;
  external 'icuuc.dll' name 'uidna_labelToUnicode';
result := DllCall("icuuc\uidna_labelToUnicode"
    , "Ptr", idna   ; UIDNA*
    , "Ptr", label   ; WORD*
    , "Int", length   ; INT
    , "Ptr", dest   ; WORD* in/out
    , "Int", capacity   ; INT
    , "Ptr", pInfo   ; UIDNAInfo* in/out
    , "Ptr", pErrorCode   ; UErrorCode* in/out
    , "Cdecl Int")   ; return: INT
●uidna_labelToUnicode(idna, label, length, dest, capacity, pInfo, pErrorCode) = DLL("icuuc.dll", "int uidna_labelToUnicode(void*, void*, int, void*, int, void*, void*)")
# 呼び出し: uidna_labelToUnicode(idna, label, length, dest, capacity, pInfo, pErrorCode)
# idna : UIDNA* -> "void*"
# label : WORD* -> "void*"
# length : INT -> "int"
# dest : WORD* in/out -> "void*"
# capacity : INT -> "int"
# pInfo : UIDNAInfo* in/out -> "void*"
# pErrorCode : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。
const std = @import("std");

extern "icuuc" fn uidna_labelToUnicode(
    idna: [*c]isize, // UIDNA*
    label: [*c]u16, // WORD*
    length: i32, // INT
    dest: [*c]u16, // WORD* in/out
    capacity: i32, // INT
    pInfo: [*c]UIDNAInfo, // UIDNAInfo* in/out
    pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) i32;
proc uidna_labelToUnicode(
    idna: ptr int,  # UIDNA*
    label: ptr uint16,  # WORD*
    length: int32,  # INT
    dest: ptr uint16,  # WORD* in/out
    capacity: int32,  # INT
    pInfo: ptr UIDNAInfo,  # UIDNAInfo* in/out
    pErrorCode: ptr int32  # UErrorCode* in/out
): int32 {.importc: "uidna_labelToUnicode", cdecl, dynlib: "icuuc.dll".}
pragma(lib, "icuuc");
extern(C)
int uidna_labelToUnicode(
    ptrdiff_t* idna,   // UIDNA*
    ushort* label,   // WORD*
    int length,   // INT
    ushort* dest,   // WORD* in/out
    int capacity,   // INT
    UIDNAInfo* pInfo,   // UIDNAInfo* in/out
    int* pErrorCode   // UErrorCode* in/out
);
ccall((:uidna_labelToUnicode, "icuuc.dll"), Int32,
      (Ptr{Int}, Ptr{UInt16}, Int32, Ptr{UInt16}, Int32, Ptr{UIDNAInfo}, Ptr{Int32}),
      idna, label, length, dest, capacity, pInfo, pErrorCode)
# idna : UIDNA* -> Ptr{Int}
# label : WORD* -> Ptr{UInt16}
# length : INT -> Int32
# dest : WORD* in/out -> Ptr{UInt16}
# capacity : INT -> Int32
# pInfo : UIDNAInfo* in/out -> Ptr{UIDNAInfo}
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}
local ffi = require("ffi")
ffi.cdef[[
int32_t uidna_labelToUnicode(
    intptr_t* idna,
    uint16_t* label,
    int32_t length,
    uint16_t* dest,
    int32_t capacity,
    void* pInfo,
    int32_t* pErrorCode);
]]
local icuuc = ffi.load("icuuc")
-- icuuc.uidna_labelToUnicode(idna, label, length, dest, capacity, pInfo, pErrorCode)
-- idna : UIDNA*
-- label : WORD*
-- length : INT
-- dest : WORD* in/out
-- capacity : INT
-- pInfo : UIDNAInfo* in/out
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuuc.dll');
const uidna_labelToUnicode = lib.func('__cdecl', 'uidna_labelToUnicode', 'int32_t', ['intptr_t *', 'uint16_t *', 'int32_t', 'uint16_t *', 'int32_t', 'void *', 'int32_t *']);
// uidna_labelToUnicode(idna, label, length, dest, capacity, pInfo, pErrorCode)
// idna : UIDNA* -> 'intptr_t *'
// label : WORD* -> 'uint16_t *'
// length : INT -> 'int32_t'
// dest : WORD* in/out -> 'uint16_t *'
// capacity : INT -> 'int32_t'
// pInfo : UIDNAInfo* in/out -> 'void *'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuuc.dll", {
  uidna_labelToUnicode: { parameters: ["pointer", "pointer", "i32", "pointer", "i32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.uidna_labelToUnicode(idna, label, length, dest, capacity, pInfo, pErrorCode)
// idna : UIDNA* -> "pointer"
// label : WORD* -> "pointer"
// length : INT -> "i32"
// dest : WORD* in/out -> "pointer"
// capacity : INT -> "i32"
// pInfo : UIDNAInfo* in/out -> "pointer"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t uidna_labelToUnicode(
    intptr_t* idna,
    uint16_t* label,
    int32_t length,
    uint16_t* dest,
    int32_t capacity,
    void* pInfo,
    int32_t* pErrorCode);
C, "icuuc.dll");
// $ffi->uidna_labelToUnicode(idna, label, length, dest, capacity, pInfo, pErrorCode);
// idna : UIDNA*
// label : WORD*
// length : INT
// dest : WORD* in/out
// capacity : INT
// pInfo : UIDNAInfo* in/out
// pErrorCode : UErrorCode* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Icuuc extends Library {
    Icuuc INSTANCE = Native.load("icuuc", Icuuc.class);
    int uidna_labelToUnicode(
        LongByReference idna,   // UIDNA*
        ShortByReference label,   // WORD*
        int length,   // INT
        ShortByReference dest,   // WORD* in/out
        int capacity,   // INT
        Pointer pInfo,   // UIDNAInfo* in/out
        IntByReference pErrorCode   // UErrorCode* in/out
    );
}
@[Link("icuuc")]
lib Libicuuc
  fun uidna_labelToUnicode = uidna_labelToUnicode(
    idna : LibC::SSizeT*,   # UIDNA*
    label : UInt16*,   # WORD*
    length : Int32,   # INT
    dest : UInt16*,   # WORD* in/out
    capacity : Int32,   # INT
    pInfo : UIDNAInfo*,   # UIDNAInfo* in/out
    pErrorCode : Int32*   # UErrorCode* in/out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef uidna_labelToUnicodeNative = Int32 Function(Pointer<IntPtr>, Pointer<Uint16>, Int32, Pointer<Uint16>, Int32, Pointer<Void>, Pointer<Int32>);
typedef uidna_labelToUnicodeDart = int Function(Pointer<IntPtr>, Pointer<Uint16>, int, Pointer<Uint16>, int, Pointer<Void>, Pointer<Int32>);
final uidna_labelToUnicode = DynamicLibrary.open('icuuc.dll')
    .lookupFunction<uidna_labelToUnicodeNative, uidna_labelToUnicodeDart>('uidna_labelToUnicode');
// idna : UIDNA* -> Pointer<IntPtr>
// label : WORD* -> Pointer<Uint16>
// length : INT -> Int32
// dest : WORD* in/out -> Pointer<Uint16>
// capacity : INT -> Int32
// pInfo : UIDNAInfo* in/out -> Pointer<Void>
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function uidna_labelToUnicode(
  idna: Pointer;   // UIDNA*
  label: Pointer;   // WORD*
  length: Integer;   // INT
  dest: Pointer;   // WORD* in/out
  capacity: Integer;   // INT
  pInfo: Pointer;   // UIDNAInfo* in/out
  pErrorCode: Pointer   // UErrorCode* in/out
): Integer; cdecl;
  external 'icuuc.dll' name 'uidna_labelToUnicode';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "uidna_labelToUnicode"
  c_uidna_labelToUnicode :: Ptr CIntPtr -> Ptr Word16 -> Int32 -> Ptr Word16 -> Int32 -> Ptr () -> Ptr Int32 -> IO Int32
-- idna : UIDNA* -> Ptr CIntPtr
-- label : WORD* -> Ptr Word16
-- length : INT -> Int32
-- dest : WORD* in/out -> Ptr Word16
-- capacity : INT -> Int32
-- pInfo : UIDNAInfo* in/out -> Ptr ()
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let uidna_labeltounicode =
  foreign "uidna_labelToUnicode"
    ((ptr intptr_t) @-> (ptr uint16_t) @-> int32_t @-> (ptr uint16_t) @-> int32_t @-> (ptr void) @-> (ptr int32_t) @-> returning int32_t)
(* idna : UIDNA* -> (ptr intptr_t) *)
(* label : WORD* -> (ptr uint16_t) *)
(* length : INT -> int32_t *)
(* dest : WORD* in/out -> (ptr uint16_t) *)
(* capacity : INT -> int32_t *)
(* pInfo : UIDNAInfo* in/out -> (ptr void) *)
(* pErrorCode : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuuc (t "icuuc.dll"))
(cffi:use-foreign-library icuuc)

(cffi:defcfun ("uidna_labelToUnicode" uidna-label-to-unicode :convention :cdecl) :int32
  (idna :pointer)   ; UIDNA*
  (label :pointer)   ; WORD*
  (length :int32)   ; INT
  (dest :pointer)   ; WORD* in/out
  (capacity :int32)   ; INT
  (p-info :pointer)   ; UIDNAInfo* in/out
  (p-error-code :pointer))   ; UErrorCode* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $uidna_labelToUnicode = Win32::API::More->new('icuuc',
    'int uidna_labelToUnicode(LPVOID idna, LPVOID label, int length, LPVOID dest, int capacity, LPVOID pInfo, LPVOID pErrorCode)');
# my $ret = $uidna_labelToUnicode->Call($idna, $label, $length, $dest, $capacity, $pInfo, $pErrorCode);
# idna : UIDNA* -> LPVOID
# label : WORD* -> LPVOID
# length : INT -> int
# dest : WORD* in/out -> LPVOID
# capacity : INT -> int
# pInfo : UIDNAInfo* in/out -> LPVOID
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型