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

uspoof_getRestrictionLevel

関数
許容するスクリプト制限レベルを取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

URestrictionLevel uspoof_getRestrictionLevel(
    const USpoofChecker* sc
);

パラメーター

名前方向説明
scUSpoofChecker*in現在の制限レベルを取得する対象のUSpoofCheckerへのポインター。

戻り値の型: URestrictionLevel

各言語での呼び出し定義

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

URestrictionLevel uspoof_getRestrictionLevel(
    const USpoofChecker* sc
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern int uspoof_getRestrictionLevel(
    ref IntPtr sc   // USpoofChecker*
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Function uspoof_getRestrictionLevel(
    ByRef sc As IntPtr   ' USpoofChecker*
) As Integer
End Function
' sc : USpoofChecker*
Declare PtrSafe Function uspoof_getRestrictionLevel Lib "icuin" ( _
    ByRef sc As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

uspoof_getRestrictionLevel = ctypes.cdll.icuin.uspoof_getRestrictionLevel
uspoof_getRestrictionLevel.restype = ctypes.c_int
uspoof_getRestrictionLevel.argtypes = [
    ctypes.c_void_p,  # sc : USpoofChecker*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procuspoof_getRestrictionLevel = icuin.NewProc("uspoof_getRestrictionLevel")
)

// sc (USpoofChecker*)
r1, _, err := procuspoof_getRestrictionLevel.Call(
	uintptr(sc),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // URestrictionLevel
function uspoof_getRestrictionLevel(
  sc: Pointer   // USpoofChecker*
): Integer; cdecl;
  external 'icuin.dll' name 'uspoof_getRestrictionLevel';
result := DllCall("icuin\uspoof_getRestrictionLevel"
    , "Ptr", sc   ; USpoofChecker*
    , "Cdecl Int")   ; return: URestrictionLevel
●uspoof_getRestrictionLevel(sc) = DLL("icuin.dll", "int uspoof_getRestrictionLevel(void*)")
# 呼び出し: uspoof_getRestrictionLevel(sc)
# sc : USpoofChecker* -> "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_getRestrictionLevel(
    sc: [*c]isize // USpoofChecker*
) callconv(.c) i32;
proc uspoof_getRestrictionLevel(
    sc: ptr int  # USpoofChecker*
): int32 {.importc: "uspoof_getRestrictionLevel", cdecl, dynlib: "icuin.dll".}
pragma(lib, "icuin");
extern(C)
int uspoof_getRestrictionLevel(
    ptrdiff_t* sc   // USpoofChecker*
);
ccall((:uspoof_getRestrictionLevel, "icuin.dll"), Int32,
      (Ptr{Int},),
      sc)
# sc : USpoofChecker* -> Ptr{Int}
local ffi = require("ffi")
ffi.cdef[[
int32_t uspoof_getRestrictionLevel(
    intptr_t* sc);
]]
local icuin = ffi.load("icuin")
-- icuin.uspoof_getRestrictionLevel(sc)
-- sc : USpoofChecker*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('icuin.dll');
const uspoof_getRestrictionLevel = lib.func('__cdecl', 'uspoof_getRestrictionLevel', 'int32_t', ['intptr_t *']);
// uspoof_getRestrictionLevel(sc)
// sc : USpoofChecker* -> 'intptr_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("icuin.dll", {
  uspoof_getRestrictionLevel: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.uspoof_getRestrictionLevel(sc)
// sc : USpoofChecker* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t uspoof_getRestrictionLevel(
    intptr_t* sc);
C, "icuin.dll");
// $ffi->uspoof_getRestrictionLevel(sc);
// sc : USpoofChecker*
// 構造体/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);
    int uspoof_getRestrictionLevel(
        LongByReference sc   // USpoofChecker*
    );
}
@[Link("icuin")]
lib Libicuin
  fun uspoof_getRestrictionLevel = uspoof_getRestrictionLevel(
    sc : LibC::SSizeT*   # USpoofChecker*
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef uspoof_getRestrictionLevelNative = Int32 Function(Pointer<IntPtr>);
typedef uspoof_getRestrictionLevelDart = int Function(Pointer<IntPtr>);
final uspoof_getRestrictionLevel = DynamicLibrary.open('icuin.dll')
    .lookupFunction<uspoof_getRestrictionLevelNative, uspoof_getRestrictionLevelDart>('uspoof_getRestrictionLevel');
// sc : USpoofChecker* -> Pointer<IntPtr>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function uspoof_getRestrictionLevel(
  sc: Pointer   // USpoofChecker*
): Integer; cdecl;
  external 'icuin.dll' name 'uspoof_getRestrictionLevel';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import ccall safe "uspoof_getRestrictionLevel"
  c_uspoof_getRestrictionLevel :: Ptr CIntPtr -> IO Int32
-- sc : USpoofChecker* -> Ptr CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let uspoof_getrestrictionlevel =
  foreign "uspoof_getRestrictionLevel"
    ((ptr intptr_t) @-> returning int32_t)
(* sc : USpoofChecker* -> (ptr intptr_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library icuin (t "icuin.dll"))
(cffi:use-foreign-library icuin)

(cffi:defcfun ("uspoof_getRestrictionLevel" uspoof-get-restriction-level :convention :cdecl) :int32
  (sc :pointer))   ; USpoofChecker*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $uspoof_getRestrictionLevel = Win32::API::More->new('icuin',
    'int uspoof_getRestrictionLevel(LPVOID sc)');
# my $ret = $uspoof_getRestrictionLevel->Call($sc);
# sc : USpoofChecker* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型