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

RpcNetworkIsProtseqValidA

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

シグネチャ

// RPCRT4.dll  (ANSI / -A)
#include <windows.h>

RPC_STATUS RpcNetworkIsProtseqValidA(
    LPSTR Protseq
);

パラメーター

名前方向
ProtseqLPSTRin

戻り値の型: RPC_STATUS

各言語での呼び出し定義

// RPCRT4.dll  (ANSI / -A)
#include <windows.h>

RPC_STATUS RpcNetworkIsProtseqValidA(
    LPSTR Protseq
);
[DllImport("RPCRT4.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int RpcNetworkIsProtseqValidA(
    [MarshalAs(UnmanagedType.LPStr)] string Protseq   // LPSTR
);
<DllImport("RPCRT4.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function RpcNetworkIsProtseqValidA(
    <MarshalAs(UnmanagedType.LPStr)> Protseq As String   ' LPSTR
) As Integer
End Function
' Protseq : LPSTR
Declare PtrSafe Function RpcNetworkIsProtseqValidA Lib "rpcrt4" ( _
    ByVal Protseq As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RpcNetworkIsProtseqValidA = ctypes.windll.rpcrt4.RpcNetworkIsProtseqValidA
RpcNetworkIsProtseqValidA.restype = ctypes.c_int
RpcNetworkIsProtseqValidA.argtypes = [
    wintypes.LPCSTR,  # Protseq : LPSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcNetworkIsProtseqValidA = rpcrt4.NewProc("RpcNetworkIsProtseqValidA")
)

// Protseq (LPSTR)
r1, _, err := procRpcNetworkIsProtseqValidA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(Protseq))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // RPC_STATUS
function RpcNetworkIsProtseqValidA(
  Protseq: PAnsiChar   // LPSTR
): Integer; stdcall;
  external 'RPCRT4.dll' name 'RpcNetworkIsProtseqValidA';
result := DllCall("RPCRT4\RpcNetworkIsProtseqValidA"
    , "AStr", Protseq   ; LPSTR
    , "Int")   ; return: RPC_STATUS
●RpcNetworkIsProtseqValidA(Protseq) = DLL("RPCRT4.dll", "int RpcNetworkIsProtseqValidA(char*)")
# 呼び出し: RpcNetworkIsProtseqValidA(Protseq)
# Protseq : LPSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。