ホーム › Globalization › uspoof_openFromSerialized
uspoof_openFromSerialized
関数直列化データから検査オブジェクトを復元生成する。
シグネチャ
// icuin.dll
#include <windows.h>
USpoofChecker* uspoof_openFromSerialized(
const void* data,
INT length,
INT* pActualLength,
UErrorCode* pErrorCode
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| data | void* | in | uspoof_serializeで直列化済みのスプーフ検出データを指すポインター。 |
| length | INT | in | 直列化データのバイト長。 |
| pActualLength | INT* | inout | 実際に読み取られたデータのバイト長を受け取る出力ポインター。NULL可。 |
| pErrorCode | UErrorCode* | inout | ICUのエラーコードを入出力するUErrorCodeへのポインター。 |
戻り値の型: USpoofChecker*
各言語での呼び出し定義
// icuin.dll
#include <windows.h>
USpoofChecker* uspoof_openFromSerialized(
const void* data,
INT length,
INT* pActualLength,
UErrorCode* pErrorCode
);[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr uspoof_openFromSerialized(
IntPtr data, // void*
int length, // INT
ref int pActualLength, // INT* in/out
ref int pErrorCode // UErrorCode* in/out
);<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uspoof_openFromSerialized(
data As IntPtr, ' void*
length As Integer, ' INT
ByRef pActualLength As Integer, ' INT* in/out
ByRef pErrorCode As Integer ' UErrorCode* in/out
) As IntPtr
End Function' data : void*
' length : INT
' pActualLength : INT* in/out
' pErrorCode : UErrorCode* in/out
Declare PtrSafe Function uspoof_openFromSerialized Lib "icuin" ( _
ByVal data As LongPtr, _
ByVal length As Long, _
ByRef pActualLength As Long, _
ByRef pErrorCode As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
uspoof_openFromSerialized = ctypes.cdll.icuin.uspoof_openFromSerialized
uspoof_openFromSerialized.restype = ctypes.c_void_p
uspoof_openFromSerialized.argtypes = [
ctypes.POINTER(None), # data : void*
ctypes.c_int, # length : INT
ctypes.POINTER(ctypes.c_int), # pActualLength : INT* in/out
ctypes.c_void_p, # pErrorCode : UErrorCode* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('icuin.dll')
uspoof_openFromSerialized = Fiddle::Function.new(
lib['uspoof_openFromSerialized'],
[
Fiddle::TYPE_VOIDP, # data : void*
Fiddle::TYPE_INT, # length : INT
Fiddle::TYPE_VOIDP, # pActualLength : INT* in/out
Fiddle::TYPE_VOIDP, # pErrorCode : UErrorCode* in/out
],
Fiddle::TYPE_VOIDP, Fiddle::Function::CDECL)#[link(name = "icuin")]
extern "C" {
fn uspoof_openFromSerialized(
data: *const (), // void*
length: i32, // INT
pActualLength: *mut i32, // INT* in/out
pErrorCode: *mut i32 // UErrorCode* in/out
) -> *mut isize;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr uspoof_openFromSerialized(IntPtr data, int length, ref int pActualLength, ref int pErrorCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_uspoof_openFromSerialized' -Namespace Win32 -PassThru
# $api::uspoof_openFromSerialized(data, length, pActualLength, pErrorCode)#uselib "icuin.dll"
#func global uspoof_openFromSerialized "uspoof_openFromSerialized" sptr, sptr, sptr, sptr
; uspoof_openFromSerialized data, length, varptr(pActualLength), varptr(pErrorCode) ; 戻り値は stat
; data : void* -> "sptr"
; length : INT -> "sptr"
; pActualLength : INT* in/out -> "sptr"
; pErrorCode : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "icuin.dll" #cfunc global uspoof_openFromSerialized "uspoof_openFromSerialized" sptr, int, var, var ; res = uspoof_openFromSerialized(data, length, pActualLength, pErrorCode) ; data : void* -> "sptr" ; length : INT -> "int" ; pActualLength : INT* in/out -> "var" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "icuin.dll" #cfunc global uspoof_openFromSerialized "uspoof_openFromSerialized" sptr, int, sptr, sptr ; res = uspoof_openFromSerialized(data, length, varptr(pActualLength), varptr(pErrorCode)) ; data : void* -> "sptr" ; length : INT -> "int" ; pActualLength : INT* in/out -> "sptr" ; pErrorCode : UErrorCode* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; USpoofChecker* uspoof_openFromSerialized(void* data, INT length, INT* pActualLength, UErrorCode* pErrorCode) #uselib "icuin.dll" #cfunc global uspoof_openFromSerialized "uspoof_openFromSerialized" intptr, int, var, var ; res = uspoof_openFromSerialized(data, length, pActualLength, pErrorCode) ; data : void* -> "intptr" ; length : INT -> "int" ; pActualLength : INT* in/out -> "var" ; pErrorCode : UErrorCode* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; USpoofChecker* uspoof_openFromSerialized(void* data, INT length, INT* pActualLength, UErrorCode* pErrorCode) #uselib "icuin.dll" #cfunc global uspoof_openFromSerialized "uspoof_openFromSerialized" intptr, int, intptr, intptr ; res = uspoof_openFromSerialized(data, length, varptr(pActualLength), varptr(pErrorCode)) ; data : void* -> "intptr" ; length : INT -> "int" ; pActualLength : INT* in/out -> "intptr" ; pErrorCode : UErrorCode* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
icuin = windows.NewLazySystemDLL("icuin.dll")
procuspoof_openFromSerialized = icuin.NewProc("uspoof_openFromSerialized")
)
// data (void*), length (INT), pActualLength (INT* in/out), pErrorCode (UErrorCode* in/out)
r1, _, err := procuspoof_openFromSerialized.Call(
uintptr(data),
uintptr(length),
uintptr(pActualLength),
uintptr(pErrorCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // USpoofChecker*function uspoof_openFromSerialized(
data: Pointer; // void*
length: Integer; // INT
pActualLength: Pointer; // INT* in/out
pErrorCode: Pointer // UErrorCode* in/out
): Pointer; cdecl;
external 'icuin.dll' name 'uspoof_openFromSerialized';result := DllCall("icuin\uspoof_openFromSerialized"
, "Ptr", data ; void*
, "Int", length ; INT
, "Ptr", pActualLength ; INT* in/out
, "Ptr", pErrorCode ; UErrorCode* in/out
, "Cdecl Ptr") ; return: USpoofChecker*●uspoof_openFromSerialized(data, length, pActualLength, pErrorCode) = DLL("icuin.dll", "void* uspoof_openFromSerialized(void*, int, void*, void*)")
# 呼び出し: uspoof_openFromSerialized(data, length, pActualLength, pErrorCode)
# data : void* -> "void*"
# length : INT -> "int"
# pActualLength : INT* 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 "icuin" fn uspoof_openFromSerialized(
data: ?*anyopaque, // void*
length: i32, // INT
pActualLength: [*c]i32, // INT* in/out
pErrorCode: [*c]i32 // UErrorCode* in/out
) callconv(.c) [*c]isize;proc uspoof_openFromSerialized(
data: pointer, # void*
length: int32, # INT
pActualLength: ptr int32, # INT* in/out
pErrorCode: ptr int32 # UErrorCode* in/out
): ptr int {.importc: "uspoof_openFromSerialized", cdecl, dynlib: "icuin.dll".}pragma(lib, "icuin");
extern(C)
ptrdiff_t* uspoof_openFromSerialized(
void* data, // void*
int length, // INT
int* pActualLength, // INT* in/out
int* pErrorCode // UErrorCode* in/out
);ccall((:uspoof_openFromSerialized, "icuin.dll"), Ptr{Int},
(Ptr{Cvoid}, Int32, Ptr{Int32}, Ptr{Int32}),
data, length, pActualLength, pErrorCode)
# data : void* -> Ptr{Cvoid}
# length : INT -> Int32
# pActualLength : INT* in/out -> Ptr{Int32}
# pErrorCode : UErrorCode* in/out -> Ptr{Int32}local ffi = require("ffi")
ffi.cdef[[
intptr_t* uspoof_openFromSerialized(
void* data,
int32_t length,
int32_t* pActualLength,
int32_t* pErrorCode);
]]
local icuin = ffi.load("icuin")
-- icuin.uspoof_openFromSerialized(data, length, pActualLength, pErrorCode)
-- data : void*
-- length : INT
-- pActualLength : INT* in/out
-- pErrorCode : UErrorCode* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const uspoof_openFromSerialized = lib.func('__cdecl', 'uspoof_openFromSerialized', 'intptr_t *', ['void *', 'int32_t', 'int32_t *', 'int32_t *']);
// uspoof_openFromSerialized(data, length, pActualLength, pErrorCode)
// data : void* -> 'void *'
// length : INT -> 'int32_t'
// pActualLength : INT* in/out -> 'int32_t *'
// pErrorCode : UErrorCode* in/out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("icuin.dll", {
uspoof_openFromSerialized: { parameters: ["pointer", "i32", "pointer", "pointer"], result: "pointer" },
});
// lib.symbols.uspoof_openFromSerialized(data, length, pActualLength, pErrorCode)
// data : void* -> "pointer"
// length : INT -> "i32"
// pActualLength : INT* in/out -> "pointer"
// pErrorCode : UErrorCode* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
intptr_t* uspoof_openFromSerialized(
void* data,
int32_t length,
int32_t* pActualLength,
int32_t* pErrorCode);
C, "icuin.dll");
// $ffi->uspoof_openFromSerialized(data, length, pActualLength, pErrorCode);
// data : void*
// length : INT
// pActualLength : INT* 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 Icuin extends Library {
Icuin INSTANCE = Native.load("icuin", Icuin.class);
Pointer uspoof_openFromSerialized(
Pointer data, // void*
int length, // INT
IntByReference pActualLength, // INT* in/out
IntByReference pErrorCode // UErrorCode* in/out
);
}@[Link("icuin")]
lib Libicuin
fun uspoof_openFromSerialized = uspoof_openFromSerialized(
data : Void*, # void*
length : Int32, # INT
pActualLength : Int32*, # INT* in/out
pErrorCode : Int32* # UErrorCode* in/out
) : LibC::SSizeT*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef uspoof_openFromSerializedNative = Pointer<IntPtr> Function(Pointer<Void>, Int32, Pointer<Int32>, Pointer<Int32>);
typedef uspoof_openFromSerializedDart = Pointer<IntPtr> Function(Pointer<Void>, int, Pointer<Int32>, Pointer<Int32>);
final uspoof_openFromSerialized = DynamicLibrary.open('icuin.dll')
.lookupFunction<uspoof_openFromSerializedNative, uspoof_openFromSerializedDart>('uspoof_openFromSerialized');
// data : void* -> Pointer<Void>
// length : INT -> Int32
// pActualLength : INT* in/out -> Pointer<Int32>
// pErrorCode : UErrorCode* in/out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function uspoof_openFromSerialized(
data: Pointer; // void*
length: Integer; // INT
pActualLength: Pointer; // INT* in/out
pErrorCode: Pointer // UErrorCode* in/out
): Pointer; cdecl;
external 'icuin.dll' name 'uspoof_openFromSerialized';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import ccall safe "uspoof_openFromSerialized"
c_uspoof_openFromSerialized :: Ptr () -> Int32 -> Ptr Int32 -> Ptr Int32 -> IO (Ptr CIntPtr)
-- data : void* -> Ptr ()
-- length : INT -> Int32
-- pActualLength : INT* in/out -> Ptr Int32
-- pErrorCode : UErrorCode* in/out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let uspoof_openfromserialized =
foreign "uspoof_openFromSerialized"
((ptr void) @-> int32_t @-> (ptr int32_t) @-> (ptr int32_t) @-> returning (ptr intptr_t))
(* data : void* -> (ptr void) *)
(* length : INT -> int32_t *)
(* pActualLength : INT* in/out -> (ptr int32_t) *)
(* pErrorCode : UErrorCode* in/out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)
(cffi:defcfun ("uspoof_openFromSerialized" uspoof-open-from-serialized :convention :cdecl) :pointer
(data :pointer) ; void*
(length :int32) ; INT
(p-actual-length :pointer) ; INT* 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 $uspoof_openFromSerialized = Win32::API::More->new('icuin',
'LPVOID uspoof_openFromSerialized(LPVOID data, int length, LPVOID pActualLength, LPVOID pErrorCode)');
# my $ret = $uspoof_openFromSerialized->Call($data, $length, $pActualLength, $pErrorCode);
# data : void* -> LPVOID
# length : INT -> int
# pActualLength : INT* in/out -> LPVOID
# pErrorCode : UErrorCode* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型