FindNLSString
関数シグネチャ
// KERNEL32.dll
#include <windows.h>
INT FindNLSString(
DWORD Locale,
DWORD dwFindNLSStringFlags,
LPCWSTR lpStringSource,
INT cchSource,
LPCWSTR lpStringValue,
INT cchValue,
INT* pcchFound // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| Locale | DWORD | in | ロケールを指定する ロケール識別子です。MAKELCID マクロを使用して識別子を作成するか、次の定義済みの値のいずれかを使用できます。 Windows Vista 以降: 次のカスタムロケール識別子もサポートされています。 |
| dwFindNLSStringFlags | DWORD | in | 検索操作の詳細を指定するフラグです。詳細な定義については、FindNLSStringEx の dwFindNLSStringFlags パラメーターを参照してください。 |
| lpStringSource | LPCWSTR | in | ソース文字列へのポインターです。関数はこの文字列内で、lpStringValue で指定された文字列を検索します。 |
| cchSource | INT | in | lpStringSource で示される文字列の、終端の null 文字を除いた文字数単位のサイズです。このパラメーターに 0、または -1 以外の負の数を指定することはできません。ソース文字列が null 終端されており、関数にサイズを自動的に計算させる場合は -1 を指定します。 |
| lpStringValue | LPCWSTR | in | 検索文字列へのポインターです。関数はソース文字列内でこの文字列を検索します。 |
| cchValue | INT | in | lpStringValue で示される文字列の、終端の null 文字を除いた文字数単位のサイズです。このパラメーターに 0、または -1 以外の負の数を指定することはできません。検索文字列が null 終端されており、関数にサイズを自動的に計算させる場合は -1 を指定します。 |
| pcchFound | INT* | outoptional | 関数が見つけた文字列の長さを格納するバッファーへのポインターです。詳細については、FindNLSStringEx の pcchFound パラメーターを参照してください。 |
戻り値の型: INT
公式ドキュメント
識別子で指定したロケールについて、Unicode 文字列(ワイド文字)またはそれに相当する文字列を、別の Unicode 文字列内で検索します。注意 バイナリ表現が大きく異なる文字列でも同一として比較されることがあるため、この関数には一定のセキュリティ上の懸念があります。詳細については、Security Considerations: International Features の比較関数に関する説明を参照してください。メモ 相互運用性の観点から、アプリケーションでは FindNLSStringEx 関数の使用を推奨します。Microsoft では、新しいロケールについてロケール識別子の代わりにロケール名を使用する方向へ移行しているためです。FindNLSString はカスタムロケールをサポートしていますが、この種のサポートが必要な場合、ほとんどのアプリケーションでは FindNLSStringEx を使用してください。
戻り値
成功した場合、lpStringSource で示されるソース文字列への 0 始まりのインデックスを返します。このインデックスは、pcchFound の値と組み合わせることで、見つかった文字列全体のソース文字列内における正確な位置を示します。戻り値 0 はエラーのないソース文字列へのインデックスであり、一致した文字列がソース文字列のオフセット 0 にあることを意味します。
関数が成功しなかった場合は -1 を返します。拡張エラー情報を取得するには、アプリケーションから GetLastError を呼び出します。これにより、次のいずれかのエラーコードが返される場合があります。
- ERROR_INVALID_FLAGS。フラグに指定された値が無効でした。
- ERROR_INVALID_PARAMETER。いずれかのパラメーター値が無効でした。
- ERROR_SUCCESS。処理は正常に完了しましたが、結果は得られませんでした。
解説(Remarks)
「解説」については FindNLSStringEx を参照してください。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
INT FindNLSString(
DWORD Locale,
DWORD dwFindNLSStringFlags,
LPCWSTR lpStringSource,
INT cchSource,
LPCWSTR lpStringValue,
INT cchValue,
INT* pcchFound // optional
);[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern int FindNLSString(
uint Locale, // DWORD
uint dwFindNLSStringFlags, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string lpStringSource, // LPCWSTR
int cchSource, // INT
[MarshalAs(UnmanagedType.LPWStr)] string lpStringValue, // LPCWSTR
int cchValue, // INT
IntPtr pcchFound // INT* optional, out
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function FindNLSString(
Locale As UInteger, ' DWORD
dwFindNLSStringFlags As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> lpStringSource As String, ' LPCWSTR
cchSource As Integer, ' INT
<MarshalAs(UnmanagedType.LPWStr)> lpStringValue As String, ' LPCWSTR
cchValue As Integer, ' INT
pcchFound As IntPtr ' INT* optional, out
) As Integer
End Function' Locale : DWORD
' dwFindNLSStringFlags : DWORD
' lpStringSource : LPCWSTR
' cchSource : INT
' lpStringValue : LPCWSTR
' cchValue : INT
' pcchFound : INT* optional, out
Declare PtrSafe Function FindNLSString Lib "kernel32" ( _
ByVal Locale As Long, _
ByVal dwFindNLSStringFlags As Long, _
ByVal lpStringSource As LongPtr, _
ByVal cchSource As Long, _
ByVal lpStringValue As LongPtr, _
ByVal cchValue As Long, _
ByVal pcchFound As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
FindNLSString = ctypes.windll.kernel32.FindNLSString
FindNLSString.restype = ctypes.c_int
FindNLSString.argtypes = [
wintypes.DWORD, # Locale : DWORD
wintypes.DWORD, # dwFindNLSStringFlags : DWORD
wintypes.LPCWSTR, # lpStringSource : LPCWSTR
ctypes.c_int, # cchSource : INT
wintypes.LPCWSTR, # lpStringValue : LPCWSTR
ctypes.c_int, # cchValue : INT
ctypes.POINTER(ctypes.c_int), # pcchFound : INT* optional, out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
FindNLSString = Fiddle::Function.new(
lib['FindNLSString'],
[
-Fiddle::TYPE_INT, # Locale : DWORD
-Fiddle::TYPE_INT, # dwFindNLSStringFlags : DWORD
Fiddle::TYPE_VOIDP, # lpStringSource : LPCWSTR
Fiddle::TYPE_INT, # cchSource : INT
Fiddle::TYPE_VOIDP, # lpStringValue : LPCWSTR
Fiddle::TYPE_INT, # cchValue : INT
Fiddle::TYPE_VOIDP, # pcchFound : INT* optional, out
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn FindNLSString(
Locale: u32, // DWORD
dwFindNLSStringFlags: u32, // DWORD
lpStringSource: *const u16, // LPCWSTR
cchSource: i32, // INT
lpStringValue: *const u16, // LPCWSTR
cchValue: i32, // INT
pcchFound: *mut i32 // INT* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern int FindNLSString(uint Locale, uint dwFindNLSStringFlags, [MarshalAs(UnmanagedType.LPWStr)] string lpStringSource, int cchSource, [MarshalAs(UnmanagedType.LPWStr)] string lpStringValue, int cchValue, IntPtr pcchFound);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_FindNLSString' -Namespace Win32 -PassThru
# $api::FindNLSString(Locale, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, pcchFound)#uselib "KERNEL32.dll"
#func global FindNLSString "FindNLSString" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; FindNLSString Locale, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, varptr(pcchFound) ; 戻り値は stat
; Locale : DWORD -> "sptr"
; dwFindNLSStringFlags : DWORD -> "sptr"
; lpStringSource : LPCWSTR -> "sptr"
; cchSource : INT -> "sptr"
; lpStringValue : LPCWSTR -> "sptr"
; cchValue : INT -> "sptr"
; pcchFound : INT* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll" #cfunc global FindNLSString "FindNLSString" int, int, wstr, int, wstr, int, var ; res = FindNLSString(Locale, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, pcchFound) ; Locale : DWORD -> "int" ; dwFindNLSStringFlags : DWORD -> "int" ; lpStringSource : LPCWSTR -> "wstr" ; cchSource : INT -> "int" ; lpStringValue : LPCWSTR -> "wstr" ; cchValue : INT -> "int" ; pcchFound : INT* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "KERNEL32.dll" #cfunc global FindNLSString "FindNLSString" int, int, wstr, int, wstr, int, sptr ; res = FindNLSString(Locale, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, varptr(pcchFound)) ; Locale : DWORD -> "int" ; dwFindNLSStringFlags : DWORD -> "int" ; lpStringSource : LPCWSTR -> "wstr" ; cchSource : INT -> "int" ; lpStringValue : LPCWSTR -> "wstr" ; cchValue : INT -> "int" ; pcchFound : INT* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
; INT FindNLSString(DWORD Locale, DWORD dwFindNLSStringFlags, LPCWSTR lpStringSource, INT cchSource, LPCWSTR lpStringValue, INT cchValue, INT* pcchFound) #uselib "KERNEL32.dll" #cfunc global FindNLSString "FindNLSString" int, int, wstr, int, wstr, int, var ; res = FindNLSString(Locale, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, pcchFound) ; Locale : DWORD -> "int" ; dwFindNLSStringFlags : DWORD -> "int" ; lpStringSource : LPCWSTR -> "wstr" ; cchSource : INT -> "int" ; lpStringValue : LPCWSTR -> "wstr" ; cchValue : INT -> "int" ; pcchFound : INT* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT FindNLSString(DWORD Locale, DWORD dwFindNLSStringFlags, LPCWSTR lpStringSource, INT cchSource, LPCWSTR lpStringValue, INT cchValue, INT* pcchFound) #uselib "KERNEL32.dll" #cfunc global FindNLSString "FindNLSString" int, int, wstr, int, wstr, int, intptr ; res = FindNLSString(Locale, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, varptr(pcchFound)) ; Locale : DWORD -> "int" ; dwFindNLSStringFlags : DWORD -> "int" ; lpStringSource : LPCWSTR -> "wstr" ; cchSource : INT -> "int" ; lpStringValue : LPCWSTR -> "wstr" ; cchValue : INT -> "int" ; pcchFound : INT* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procFindNLSString = kernel32.NewProc("FindNLSString")
)
// Locale (DWORD), dwFindNLSStringFlags (DWORD), lpStringSource (LPCWSTR), cchSource (INT), lpStringValue (LPCWSTR), cchValue (INT), pcchFound (INT* optional, out)
r1, _, err := procFindNLSString.Call(
uintptr(Locale),
uintptr(dwFindNLSStringFlags),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpStringSource))),
uintptr(cchSource),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpStringValue))),
uintptr(cchValue),
uintptr(pcchFound),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction FindNLSString(
Locale: DWORD; // DWORD
dwFindNLSStringFlags: DWORD; // DWORD
lpStringSource: PWideChar; // LPCWSTR
cchSource: Integer; // INT
lpStringValue: PWideChar; // LPCWSTR
cchValue: Integer; // INT
pcchFound: Pointer // INT* optional, out
): Integer; stdcall;
external 'KERNEL32.dll' name 'FindNLSString';result := DllCall("KERNEL32\FindNLSString"
, "UInt", Locale ; DWORD
, "UInt", dwFindNLSStringFlags ; DWORD
, "WStr", lpStringSource ; LPCWSTR
, "Int", cchSource ; INT
, "WStr", lpStringValue ; LPCWSTR
, "Int", cchValue ; INT
, "Ptr", pcchFound ; INT* optional, out
, "Int") ; return: INT●FindNLSString(Locale, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, pcchFound) = DLL("KERNEL32.dll", "int FindNLSString(dword, dword, char*, int, char*, int, void*)")
# 呼び出し: FindNLSString(Locale, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, pcchFound)
# Locale : DWORD -> "dword"
# dwFindNLSStringFlags : DWORD -> "dword"
# lpStringSource : LPCWSTR -> "char*"
# cchSource : INT -> "int"
# lpStringValue : LPCWSTR -> "char*"
# cchValue : INT -> "int"
# pcchFound : INT* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "kernel32" fn FindNLSString(
Locale: u32, // DWORD
dwFindNLSStringFlags: u32, // DWORD
lpStringSource: [*c]const u16, // LPCWSTR
cchSource: i32, // INT
lpStringValue: [*c]const u16, // LPCWSTR
cchValue: i32, // INT
pcchFound: [*c]i32 // INT* optional, out
) callconv(std.os.windows.WINAPI) i32;proc FindNLSString(
Locale: uint32, # DWORD
dwFindNLSStringFlags: uint32, # DWORD
lpStringSource: WideCString, # LPCWSTR
cchSource: int32, # INT
lpStringValue: WideCString, # LPCWSTR
cchValue: int32, # INT
pcchFound: ptr int32 # INT* optional, out
): int32 {.importc: "FindNLSString", stdcall, dynlib: "KERNEL32.dll".}pragma(lib, "kernel32");
extern(Windows)
int FindNLSString(
uint Locale, // DWORD
uint dwFindNLSStringFlags, // DWORD
const(wchar)* lpStringSource, // LPCWSTR
int cchSource, // INT
const(wchar)* lpStringValue, // LPCWSTR
int cchValue, // INT
int* pcchFound // INT* optional, out
);ccall((:FindNLSString, "KERNEL32.dll"), stdcall, Int32,
(UInt32, UInt32, Cwstring, Int32, Cwstring, Int32, Ptr{Int32}),
Locale, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, pcchFound)
# Locale : DWORD -> UInt32
# dwFindNLSStringFlags : DWORD -> UInt32
# lpStringSource : LPCWSTR -> Cwstring
# cchSource : INT -> Int32
# lpStringValue : LPCWSTR -> Cwstring
# cchValue : INT -> Int32
# pcchFound : INT* optional, out -> Ptr{Int32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t FindNLSString(
uint32_t Locale,
uint32_t dwFindNLSStringFlags,
const uint16_t* lpStringSource,
int32_t cchSource,
const uint16_t* lpStringValue,
int32_t cchValue,
int32_t* pcchFound);
]]
local kernel32 = ffi.load("kernel32")
-- kernel32.FindNLSString(Locale, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, pcchFound)
-- Locale : DWORD
-- dwFindNLSStringFlags : DWORD
-- lpStringSource : LPCWSTR
-- cchSource : INT
-- lpStringValue : LPCWSTR
-- cchValue : INT
-- pcchFound : INT* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('KERNEL32.dll');
const FindNLSString = lib.func('__stdcall', 'FindNLSString', 'int32_t', ['uint32_t', 'uint32_t', 'str16', 'int32_t', 'str16', 'int32_t', 'int32_t *']);
// FindNLSString(Locale, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, pcchFound)
// Locale : DWORD -> 'uint32_t'
// dwFindNLSStringFlags : DWORD -> 'uint32_t'
// lpStringSource : LPCWSTR -> 'str16'
// cchSource : INT -> 'int32_t'
// lpStringValue : LPCWSTR -> 'str16'
// cchValue : INT -> 'int32_t'
// pcchFound : INT* optional, out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("KERNEL32.dll", {
FindNLSString: { parameters: ["u32", "u32", "buffer", "i32", "buffer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.FindNLSString(Locale, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, pcchFound)
// Locale : DWORD -> "u32"
// dwFindNLSStringFlags : DWORD -> "u32"
// lpStringSource : LPCWSTR -> "buffer"
// cchSource : INT -> "i32"
// lpStringValue : LPCWSTR -> "buffer"
// cchValue : INT -> "i32"
// pcchFound : INT* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t FindNLSString(
uint32_t Locale,
uint32_t dwFindNLSStringFlags,
const uint16_t* lpStringSource,
int32_t cchSource,
const uint16_t* lpStringValue,
int32_t cchValue,
int32_t* pcchFound);
C, "KERNEL32.dll");
// $ffi->FindNLSString(Locale, dwFindNLSStringFlags, lpStringSource, cchSource, lpStringValue, cchValue, pcchFound);
// Locale : DWORD
// dwFindNLSStringFlags : DWORD
// lpStringSource : LPCWSTR
// cchSource : INT
// lpStringValue : LPCWSTR
// cchValue : INT
// pcchFound : INT* optional, out
// 構造体/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 Kernel32 extends StdCallLibrary {
Kernel32 INSTANCE = Native.load("kernel32", Kernel32.class);
int FindNLSString(
int Locale, // DWORD
int dwFindNLSStringFlags, // DWORD
WString lpStringSource, // LPCWSTR
int cchSource, // INT
WString lpStringValue, // LPCWSTR
int cchValue, // INT
IntByReference pcchFound // INT* optional, out
);
}@[Link("kernel32")]
lib LibKERNEL32
fun FindNLSString = FindNLSString(
Locale : UInt32, # DWORD
dwFindNLSStringFlags : UInt32, # DWORD
lpStringSource : UInt16*, # LPCWSTR
cchSource : Int32, # INT
lpStringValue : UInt16*, # LPCWSTR
cchValue : Int32, # INT
pcchFound : Int32* # INT* optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef FindNLSStringNative = Int32 Function(Uint32, Uint32, Pointer<Utf16>, Int32, Pointer<Utf16>, Int32, Pointer<Int32>);
typedef FindNLSStringDart = int Function(int, int, Pointer<Utf16>, int, Pointer<Utf16>, int, Pointer<Int32>);
final FindNLSString = DynamicLibrary.open('KERNEL32.dll')
.lookupFunction<FindNLSStringNative, FindNLSStringDart>('FindNLSString');
// Locale : DWORD -> Uint32
// dwFindNLSStringFlags : DWORD -> Uint32
// lpStringSource : LPCWSTR -> Pointer<Utf16>
// cchSource : INT -> Int32
// lpStringValue : LPCWSTR -> Pointer<Utf16>
// cchValue : INT -> Int32
// pcchFound : INT* optional, out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function FindNLSString(
Locale: DWORD; // DWORD
dwFindNLSStringFlags: DWORD; // DWORD
lpStringSource: PWideChar; // LPCWSTR
cchSource: Integer; // INT
lpStringValue: PWideChar; // LPCWSTR
cchValue: Integer; // INT
pcchFound: Pointer // INT* optional, out
): Integer; stdcall;
external 'KERNEL32.dll' name 'FindNLSString';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "FindNLSString"
c_FindNLSString :: Word32 -> Word32 -> CWString -> Int32 -> CWString -> Int32 -> Ptr Int32 -> IO Int32
-- Locale : DWORD -> Word32
-- dwFindNLSStringFlags : DWORD -> Word32
-- lpStringSource : LPCWSTR -> CWString
-- cchSource : INT -> Int32
-- lpStringValue : LPCWSTR -> CWString
-- cchValue : INT -> Int32
-- pcchFound : INT* optional, out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let findnlsstring =
foreign "FindNLSString"
(uint32_t @-> uint32_t @-> (ptr uint16_t) @-> int32_t @-> (ptr uint16_t) @-> int32_t @-> (ptr int32_t) @-> returning int32_t)
(* Locale : DWORD -> uint32_t *)
(* dwFindNLSStringFlags : DWORD -> uint32_t *)
(* lpStringSource : LPCWSTR -> (ptr uint16_t) *)
(* cchSource : INT -> int32_t *)
(* lpStringValue : LPCWSTR -> (ptr uint16_t) *)
(* cchValue : INT -> int32_t *)
(* pcchFound : INT* optional, out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library kernel32 (t "KERNEL32.dll"))
(cffi:use-foreign-library kernel32)
(cffi:defcfun ("FindNLSString" find-nlsstring :convention :stdcall) :int32
(locale :uint32) ; DWORD
(dw-find-nlsstring-flags :uint32) ; DWORD
(lp-string-source (:string :encoding :utf-16le)) ; LPCWSTR
(cch-source :int32) ; INT
(lp-string-value (:string :encoding :utf-16le)) ; LPCWSTR
(cch-value :int32) ; INT
(pcch-found :pointer)) ; INT* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $FindNLSString = Win32::API::More->new('KERNEL32',
'int FindNLSString(DWORD Locale, DWORD dwFindNLSStringFlags, LPCWSTR lpStringSource, int cchSource, LPCWSTR lpStringValue, int cchValue, LPVOID pcchFound)');
# my $ret = $FindNLSString->Call($Locale, $dwFindNLSStringFlags, $lpStringSource, $cchSource, $lpStringValue, $cchValue, $pcchFound);
# Locale : DWORD -> DWORD
# dwFindNLSStringFlags : DWORD -> DWORD
# lpStringSource : LPCWSTR -> LPCWSTR
# cchSource : INT -> int
# lpStringValue : LPCWSTR -> LPCWSTR
# cchValue : INT -> int
# pcchFound : INT* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
- f FindNLSStringEx — ロケール名を指定して文字列内から部分文字列を検索する。
- f CompareStringW — ロケールに従い二つのUnicode文字列を比較する。
- f LCMapStringW — Unicode文字列にロケール依存のマッピング変換を行う。