ホーム › Globalization › ScriptStringValidate
ScriptStringValidate
関数解析済み文字列オブジェクトの有効性を検証する。
シグネチャ
// USP10.dll
#include <windows.h>
HRESULT ScriptStringValidate(
void* ssa
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ssa | void* | in | 文字列に対する SCRIPT_STRING_ANALYSIS 構造体。 |
戻り値の型: HRESULT
公式ドキュメント
SCRIPT_STRING_ANALYSIS 構造体に無効なシーケンスが含まれていないかを確認します。
戻り値
無効なシーケンスが見つからない場合は S_OK を返します。1 つ以上の無効なシーケンスが見つかった場合は S_FALSE を返します。処理に失敗した場合は、0 以外の HRESULT 値を返します。
解説(Remarks)
この関数は、無効なシーケンスの入力を拒否するエディターでの使用を想定しています。
無効なシーケンスのチェックは、関連付けられた SCRIPT_PROPERTIES 構造体の fRejectInvalid メンバーが設定されているスクリプトに対してのみ行われます。たとえば、メモ帳が無効なタイ文字のシーケンスを拒否するのは慣例的なものです。一方、無効なインド系文字のシーケンスは慣例的に拒否されず、代わりにベース文字が欠落したことを示す記号と組み合わせて表示されます。
重要 Windows 8 以降: Windows 7 上で実行できる状態を維持するには、Uniscribe を使用するモジュールはライブラリ一覧で Usp10.lib を gdi32.lib より前に指定する必要があります。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// USP10.dll
#include <windows.h>
HRESULT ScriptStringValidate(
void* ssa
);[DllImport("USP10.dll", ExactSpelling = true)]
static extern int ScriptStringValidate(
IntPtr ssa // void*
);<DllImport("USP10.dll", ExactSpelling:=True)>
Public Shared Function ScriptStringValidate(
ssa As IntPtr ' void*
) As Integer
End Function' ssa : void*
Declare PtrSafe Function ScriptStringValidate Lib "usp10" ( _
ByVal ssa As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ScriptStringValidate = ctypes.windll.usp10.ScriptStringValidate
ScriptStringValidate.restype = ctypes.c_int
ScriptStringValidate.argtypes = [
ctypes.POINTER(None), # ssa : void*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USP10.dll')
ScriptStringValidate = Fiddle::Function.new(
lib['ScriptStringValidate'],
[
Fiddle::TYPE_VOIDP, # ssa : void*
],
Fiddle::TYPE_INT)#[link(name = "usp10")]
extern "system" {
fn ScriptStringValidate(
ssa: *mut () // void*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USP10.dll")]
public static extern int ScriptStringValidate(IntPtr ssa);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USP10_ScriptStringValidate' -Namespace Win32 -PassThru
# $api::ScriptStringValidate(ssa)#uselib "USP10.dll"
#func global ScriptStringValidate "ScriptStringValidate" sptr
; ScriptStringValidate ssa ; 戻り値は stat
; ssa : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USP10.dll"
#cfunc global ScriptStringValidate "ScriptStringValidate" sptr
; res = ScriptStringValidate(ssa)
; ssa : void* -> "sptr"; HRESULT ScriptStringValidate(void* ssa)
#uselib "USP10.dll"
#cfunc global ScriptStringValidate "ScriptStringValidate" intptr
; res = ScriptStringValidate(ssa)
; ssa : void* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
usp10 = windows.NewLazySystemDLL("USP10.dll")
procScriptStringValidate = usp10.NewProc("ScriptStringValidate")
)
// ssa (void*)
r1, _, err := procScriptStringValidate.Call(
uintptr(ssa),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction ScriptStringValidate(
ssa: Pointer // void*
): Integer; stdcall;
external 'USP10.dll' name 'ScriptStringValidate';result := DllCall("USP10\ScriptStringValidate"
, "Ptr", ssa ; void*
, "Int") ; return: HRESULT●ScriptStringValidate(ssa) = DLL("USP10.dll", "int ScriptStringValidate(void*)")
# 呼び出し: ScriptStringValidate(ssa)
# ssa : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "usp10" fn ScriptStringValidate(
ssa: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) i32;proc ScriptStringValidate(
ssa: pointer # void*
): int32 {.importc: "ScriptStringValidate", stdcall, dynlib: "USP10.dll".}pragma(lib, "usp10");
extern(Windows)
int ScriptStringValidate(
void* ssa // void*
);ccall((:ScriptStringValidate, "USP10.dll"), stdcall, Int32,
(Ptr{Cvoid},),
ssa)
# ssa : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t ScriptStringValidate(
void* ssa);
]]
local usp10 = ffi.load("usp10")
-- usp10.ScriptStringValidate(ssa)
-- ssa : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('USP10.dll');
const ScriptStringValidate = lib.func('__stdcall', 'ScriptStringValidate', 'int32_t', ['void *']);
// ScriptStringValidate(ssa)
// ssa : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("USP10.dll", {
ScriptStringValidate: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.ScriptStringValidate(ssa)
// ssa : void* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ScriptStringValidate(
void* ssa);
C, "USP10.dll");
// $ffi->ScriptStringValidate(ssa);
// ssa : void*
// 構造体/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 Usp10 extends StdCallLibrary {
Usp10 INSTANCE = Native.load("usp10", Usp10.class);
int ScriptStringValidate(
Pointer ssa // void*
);
}@[Link("usp10")]
lib LibUSP10
fun ScriptStringValidate = ScriptStringValidate(
ssa : Void* # void*
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ScriptStringValidateNative = Int32 Function(Pointer<Void>);
typedef ScriptStringValidateDart = int Function(Pointer<Void>);
final ScriptStringValidate = DynamicLibrary.open('USP10.dll')
.lookupFunction<ScriptStringValidateNative, ScriptStringValidateDart>('ScriptStringValidate');
// ssa : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ScriptStringValidate(
ssa: Pointer // void*
): Integer; stdcall;
external 'USP10.dll' name 'ScriptStringValidate';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ScriptStringValidate"
c_ScriptStringValidate :: Ptr () -> IO Int32
-- ssa : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let scriptstringvalidate =
foreign "ScriptStringValidate"
((ptr void) @-> returning int32_t)
(* ssa : void* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library usp10 (t "USP10.dll"))
(cffi:use-foreign-library usp10)
(cffi:defcfun ("ScriptStringValidate" script-string-validate :convention :stdcall) :int32
(ssa :pointer)) ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ScriptStringValidate = Win32::API::More->new('USP10',
'int ScriptStringValidate(LPVOID ssa)');
# my $ret = $ScriptStringValidate->Call($ssa);
# ssa : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目