Win32 API 日本語リファレンス
ホームNetworking.WindowsWebServices › WsVerifyXmlNCName

WsVerifyXmlNCName

関数
文字列が有効なXMLのNC名か検証する。
DLLwebservices.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT WsVerifyXmlNCName(
    LPCWSTR ncNameChars,
    DWORD ncNameCharCount,
    WS_ERROR* error   // optional
);

パラメーター

名前方向
ncNameCharsLPCWSTRin
ncNameCharCountDWORDin
errorWS_ERROR*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WsVerifyXmlNCName(
    LPCWSTR ncNameChars,
    DWORD ncNameCharCount,
    WS_ERROR* error   // optional
);
[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsVerifyXmlNCName(
    [MarshalAs(UnmanagedType.LPWStr)] string ncNameChars,   // LPCWSTR
    uint ncNameCharCount,   // DWORD
    IntPtr error   // WS_ERROR* optional
);
<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsVerifyXmlNCName(
    <MarshalAs(UnmanagedType.LPWStr)> ncNameChars As String,   ' LPCWSTR
    ncNameCharCount As UInteger,   ' DWORD
    [error] As IntPtr   ' WS_ERROR* optional
) As Integer
End Function
' ncNameChars : LPCWSTR
' ncNameCharCount : DWORD
' error : WS_ERROR* optional
Declare PtrSafe Function WsVerifyXmlNCName Lib "webservices" ( _
    ByVal ncNameChars As LongPtr, _
    ByVal ncNameCharCount As Long, _
    ByVal error As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WsVerifyXmlNCName = ctypes.windll.webservices.WsVerifyXmlNCName
WsVerifyXmlNCName.restype = ctypes.c_int
WsVerifyXmlNCName.argtypes = [
    wintypes.LPCWSTR,  # ncNameChars : LPCWSTR
    wintypes.DWORD,  # ncNameCharCount : DWORD
    ctypes.c_void_p,  # error : WS_ERROR* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('webservices.dll')
WsVerifyXmlNCName = Fiddle::Function.new(
  lib['WsVerifyXmlNCName'],
  [
    Fiddle::TYPE_VOIDP,  # ncNameChars : LPCWSTR
    -Fiddle::TYPE_INT,  # ncNameCharCount : DWORD
    Fiddle::TYPE_VOIDP,  # error : WS_ERROR* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "webservices")]
extern "system" {
    fn WsVerifyXmlNCName(
        ncNameChars: *const u16,  // LPCWSTR
        ncNameCharCount: u32,  // DWORD
        error: *mut isize  // WS_ERROR* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("webservices.dll")]
public static extern int WsVerifyXmlNCName([MarshalAs(UnmanagedType.LPWStr)] string ncNameChars, uint ncNameCharCount, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsVerifyXmlNCName' -Namespace Win32 -PassThru
# $api::WsVerifyXmlNCName(ncNameChars, ncNameCharCount, error)
#uselib "webservices.dll"
#func global WsVerifyXmlNCName "WsVerifyXmlNCName" sptr, sptr, sptr
; WsVerifyXmlNCName ncNameChars, ncNameCharCount, error   ; 戻り値は stat
; ncNameChars : LPCWSTR -> "sptr"
; ncNameCharCount : DWORD -> "sptr"
; error : WS_ERROR* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "webservices.dll"
#cfunc global WsVerifyXmlNCName "WsVerifyXmlNCName" wstr, int, int
; res = WsVerifyXmlNCName(ncNameChars, ncNameCharCount, error)
; ncNameChars : LPCWSTR -> "wstr"
; ncNameCharCount : DWORD -> "int"
; error : WS_ERROR* optional -> "int"
; HRESULT WsVerifyXmlNCName(LPCWSTR ncNameChars, DWORD ncNameCharCount, WS_ERROR* error)
#uselib "webservices.dll"
#cfunc global WsVerifyXmlNCName "WsVerifyXmlNCName" wstr, int, int
; res = WsVerifyXmlNCName(ncNameChars, ncNameCharCount, error)
; ncNameChars : LPCWSTR -> "wstr"
; ncNameCharCount : DWORD -> "int"
; error : WS_ERROR* optional -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	webservices = windows.NewLazySystemDLL("webservices.dll")
	procWsVerifyXmlNCName = webservices.NewProc("WsVerifyXmlNCName")
)

// ncNameChars (LPCWSTR), ncNameCharCount (DWORD), error (WS_ERROR* optional)
r1, _, err := procWsVerifyXmlNCName.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(ncNameChars))),
	uintptr(ncNameCharCount),
	uintptr(error),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WsVerifyXmlNCName(
  ncNameChars: PWideChar;   // LPCWSTR
  ncNameCharCount: DWORD;   // DWORD
  error: Pointer   // WS_ERROR* optional
): Integer; stdcall;
  external 'webservices.dll' name 'WsVerifyXmlNCName';
result := DllCall("webservices\WsVerifyXmlNCName"
    , "WStr", ncNameChars   ; LPCWSTR
    , "UInt", ncNameCharCount   ; DWORD
    , "Ptr", error   ; WS_ERROR* optional
    , "Int")   ; return: HRESULT
●WsVerifyXmlNCName(ncNameChars, ncNameCharCount, error) = DLL("webservices.dll", "int WsVerifyXmlNCName(char*, dword, void*)")
# 呼び出し: WsVerifyXmlNCName(ncNameChars, ncNameCharCount, error)
# ncNameChars : LPCWSTR -> "char*"
# ncNameCharCount : DWORD -> "dword"
# error : WS_ERROR* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。