Win32 API 日本語リファレンス
ホームSystem.WinRT › WindowsStringHasEmbeddedNull

WindowsStringHasEmbeddedNull

関数
HSTRINGに埋め込みのNULL文字が含まれるかを判定する。
DLLapi-ms-win-core-winrt-string-l1-1-0.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// api-ms-win-core-winrt-string-l1-1-0.dll
#include <windows.h>

HRESULT WindowsStringHasEmbeddedNull(
    HSTRING string,   // optional
    BOOL* hasEmbedNull
);

パラメーター

名前方向
stringHSTRINGinoptional
hasEmbedNullBOOL*out

戻り値の型: HRESULT

各言語での呼び出し定義

// api-ms-win-core-winrt-string-l1-1-0.dll
#include <windows.h>

HRESULT WindowsStringHasEmbeddedNull(
    HSTRING string,   // optional
    BOOL* hasEmbedNull
);
[DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", ExactSpelling = true)]
static extern int WindowsStringHasEmbeddedNull(
    IntPtr string,   // HSTRING optional
    out int hasEmbedNull   // BOOL* out
);
<DllImport("api-ms-win-core-winrt-string-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Function WindowsStringHasEmbeddedNull(
    [string] As IntPtr,   ' HSTRING optional
    <Out> ByRef hasEmbedNull As Integer   ' BOOL* out
) As Integer
End Function
' string : HSTRING optional
' hasEmbedNull : BOOL* out
Declare PtrSafe Function WindowsStringHasEmbeddedNull Lib "api-ms-win-core-winrt-string-l1-1-0" ( _
    ByVal string As LongPtr, _
    ByRef hasEmbedNull As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WindowsStringHasEmbeddedNull = ctypes.windll.LoadLibrary("api-ms-win-core-winrt-string-l1-1-0.dll").WindowsStringHasEmbeddedNull
WindowsStringHasEmbeddedNull.restype = ctypes.c_int
WindowsStringHasEmbeddedNull.argtypes = [
    wintypes.HANDLE,  # string : HSTRING optional
    ctypes.c_void_p,  # hasEmbedNull : BOOL* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('api-ms-win-core-winrt-string-l1-1-0.dll')
WindowsStringHasEmbeddedNull = Fiddle::Function.new(
  lib['WindowsStringHasEmbeddedNull'],
  [
    Fiddle::TYPE_VOIDP,  # string : HSTRING optional
    Fiddle::TYPE_VOIDP,  # hasEmbedNull : BOOL* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "api-ms-win-core-winrt-string-l1-1-0")]
extern "system" {
    fn WindowsStringHasEmbeddedNull(
        string: *mut core::ffi::c_void,  // HSTRING optional
        hasEmbedNull: *mut i32  // BOOL* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("api-ms-win-core-winrt-string-l1-1-0.dll")]
public static extern int WindowsStringHasEmbeddedNull(IntPtr string, out int hasEmbedNull);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-winrt-string-l1-1-0_WindowsStringHasEmbeddedNull' -Namespace Win32 -PassThru
# $api::WindowsStringHasEmbeddedNull(string, hasEmbedNull)
#uselib "api-ms-win-core-winrt-string-l1-1-0.dll"
#func global WindowsStringHasEmbeddedNull "WindowsStringHasEmbeddedNull" sptr, sptr
; WindowsStringHasEmbeddedNull string, hasEmbedNull   ; 戻り値は stat
; string : HSTRING optional -> "sptr"
; hasEmbedNull : BOOL* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "api-ms-win-core-winrt-string-l1-1-0.dll"
#cfunc global WindowsStringHasEmbeddedNull "WindowsStringHasEmbeddedNull" sptr, int
; res = WindowsStringHasEmbeddedNull(string, hasEmbedNull)
; string : HSTRING optional -> "sptr"
; hasEmbedNull : BOOL* out -> "int"
; HRESULT WindowsStringHasEmbeddedNull(HSTRING string, BOOL* hasEmbedNull)
#uselib "api-ms-win-core-winrt-string-l1-1-0.dll"
#cfunc global WindowsStringHasEmbeddedNull "WindowsStringHasEmbeddedNull" intptr, int
; res = WindowsStringHasEmbeddedNull(string, hasEmbedNull)
; string : HSTRING optional -> "intptr"
; hasEmbedNull : BOOL* out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	api_ms_win_core_winrt_string_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-core-winrt-string-l1-1-0.dll")
	procWindowsStringHasEmbeddedNull = api_ms_win_core_winrt_string_l1_1_0.NewProc("WindowsStringHasEmbeddedNull")
)

// string (HSTRING optional), hasEmbedNull (BOOL* out)
r1, _, err := procWindowsStringHasEmbeddedNull.Call(
	uintptr(string),
	uintptr(hasEmbedNull),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WindowsStringHasEmbeddedNull(
  string: THandle;   // HSTRING optional
  hasEmbedNull: Pointer   // BOOL* out
): Integer; stdcall;
  external 'api-ms-win-core-winrt-string-l1-1-0.dll' name 'WindowsStringHasEmbeddedNull';
result := DllCall("api-ms-win-core-winrt-string-l1-1-0\WindowsStringHasEmbeddedNull"
    , "Ptr", string   ; HSTRING optional
    , "Ptr", hasEmbedNull   ; BOOL* out
    , "Int")   ; return: HRESULT
●WindowsStringHasEmbeddedNull(string, hasEmbedNull) = DLL("api-ms-win-core-winrt-string-l1-1-0.dll", "int WindowsStringHasEmbeddedNull(void*, void*)")
# 呼び出し: WindowsStringHasEmbeddedNull(string, hasEmbedNull)
# string : HSTRING optional -> "void*"
# hasEmbedNull : BOOL* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。