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

RpcNetworkIsProtseqValidW

関数
プロトコルシーケンスが利用可能か検証する(Unicode版)。
DLLRPCRT4.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// RPCRT4.dll  (Unicode / -W)
#include <windows.h>

RPC_STATUS RpcNetworkIsProtseqValidW(
    LPWSTR Protseq
);

パラメーター

名前方向
ProtseqLPWSTRin

戻り値の型: RPC_STATUS

各言語での呼び出し定義

// RPCRT4.dll  (Unicode / -W)
#include <windows.h>

RPC_STATUS RpcNetworkIsProtseqValidW(
    LPWSTR Protseq
);
[DllImport("RPCRT4.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RpcNetworkIsProtseqValidW(
    [MarshalAs(UnmanagedType.LPWStr)] string Protseq   // LPWSTR
);
<DllImport("RPCRT4.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RpcNetworkIsProtseqValidW(
    <MarshalAs(UnmanagedType.LPWStr)> Protseq As String   ' LPWSTR
) As Integer
End Function
' Protseq : LPWSTR
Declare PtrSafe Function RpcNetworkIsProtseqValidW Lib "rpcrt4" ( _
    ByVal Protseq As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RpcNetworkIsProtseqValidW = ctypes.windll.rpcrt4.RpcNetworkIsProtseqValidW
RpcNetworkIsProtseqValidW.restype = ctypes.c_int
RpcNetworkIsProtseqValidW.argtypes = [
    wintypes.LPCWSTR,  # Protseq : LPWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
RpcNetworkIsProtseqValidW = Fiddle::Function.new(
  lib['RpcNetworkIsProtseqValidW'],
  [
    Fiddle::TYPE_VOIDP,  # Protseq : LPWSTR
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "rpcrt4")]
extern "system" {
    fn RpcNetworkIsProtseqValidW(
        Protseq: *mut u16  // LPWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll", CharSet = CharSet.Unicode)]
public static extern int RpcNetworkIsProtseqValidW([MarshalAs(UnmanagedType.LPWStr)] string Protseq);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcNetworkIsProtseqValidW' -Namespace Win32 -PassThru
# $api::RpcNetworkIsProtseqValidW(Protseq)
#uselib "RPCRT4.dll"
#func global RpcNetworkIsProtseqValidW "RpcNetworkIsProtseqValidW" wptr
; RpcNetworkIsProtseqValidW Protseq   ; 戻り値は stat
; Protseq : LPWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "RPCRT4.dll"
#cfunc global RpcNetworkIsProtseqValidW "RpcNetworkIsProtseqValidW" wstr
; res = RpcNetworkIsProtseqValidW(Protseq)
; Protseq : LPWSTR -> "wstr"
; RPC_STATUS RpcNetworkIsProtseqValidW(LPWSTR Protseq)
#uselib "RPCRT4.dll"
#cfunc global RpcNetworkIsProtseqValidW "RpcNetworkIsProtseqValidW" wstr
; res = RpcNetworkIsProtseqValidW(Protseq)
; Protseq : LPWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcNetworkIsProtseqValidW = rpcrt4.NewProc("RpcNetworkIsProtseqValidW")
)

// Protseq (LPWSTR)
r1, _, err := procRpcNetworkIsProtseqValidW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Protseq))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // RPC_STATUS
function RpcNetworkIsProtseqValidW(
  Protseq: PWideChar   // LPWSTR
): Integer; stdcall;
  external 'RPCRT4.dll' name 'RpcNetworkIsProtseqValidW';
result := DllCall("RPCRT4\RpcNetworkIsProtseqValidW"
    , "WStr", Protseq   ; LPWSTR
    , "Int")   ; return: RPC_STATUS
●RpcNetworkIsProtseqValidW(Protseq) = DLL("RPCRT4.dll", "int RpcNetworkIsProtseqValidW(char*)")
# 呼び出し: RpcNetworkIsProtseqValidW(Protseq)
# Protseq : LPWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。