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

ResUtilIsPathValid

関数
指定したパスが有効かを判定する。
DLLRESUTILS.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

BOOL ResUtilIsPathValid(
    LPCWSTR pszPath
);

パラメーター

名前方向
pszPathLPCWSTRin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL ResUtilIsPathValid(
    LPCWSTR pszPath
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("RESUTILS.dll", ExactSpelling = true)]
static extern bool ResUtilIsPathValid(
    [MarshalAs(UnmanagedType.LPWStr)] string pszPath   // LPCWSTR
);
<DllImport("RESUTILS.dll", ExactSpelling:=True)>
Public Shared Function ResUtilIsPathValid(
    <MarshalAs(UnmanagedType.LPWStr)> pszPath As String   ' LPCWSTR
) As Boolean
End Function
' pszPath : LPCWSTR
Declare PtrSafe Function ResUtilIsPathValid Lib "resutils" ( _
    ByVal pszPath As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ResUtilIsPathValid = ctypes.windll.resutils.ResUtilIsPathValid
ResUtilIsPathValid.restype = wintypes.BOOL
ResUtilIsPathValid.argtypes = [
    wintypes.LPCWSTR,  # pszPath : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	resutils = windows.NewLazySystemDLL("RESUTILS.dll")
	procResUtilIsPathValid = resutils.NewProc("ResUtilIsPathValid")
)

// pszPath (LPCWSTR)
r1, _, err := procResUtilIsPathValid.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszPath))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function ResUtilIsPathValid(
  pszPath: PWideChar   // LPCWSTR
): BOOL; stdcall;
  external 'RESUTILS.dll' name 'ResUtilIsPathValid';
result := DllCall("RESUTILS\ResUtilIsPathValid"
    , "WStr", pszPath   ; LPCWSTR
    , "Int")   ; return: BOOL
●ResUtilIsPathValid(pszPath) = DLL("RESUTILS.dll", "bool ResUtilIsPathValid(char*)")
# 呼び出し: ResUtilIsPathValid(pszPath)
# pszPath : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。