ホーム › System.Performance › PdhValidatePathW
PdhValidatePathW
関数カウンターパスが存在し有効か検証する。
シグネチャ
// pdh.dll (Unicode / -W)
#include <windows.h>
DWORD PdhValidatePathW(
LPCWSTR szFullPathBuffer
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| szFullPathBuffer | LPCWSTR | in |
戻り値の型: DWORD
各言語での呼び出し定義
// pdh.dll (Unicode / -W)
#include <windows.h>
DWORD PdhValidatePathW(
LPCWSTR szFullPathBuffer
);[DllImport("pdh.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint PdhValidatePathW(
[MarshalAs(UnmanagedType.LPWStr)] string szFullPathBuffer // LPCWSTR
);<DllImport("pdh.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function PdhValidatePathW(
<MarshalAs(UnmanagedType.LPWStr)> szFullPathBuffer As String ' LPCWSTR
) As UInteger
End Function' szFullPathBuffer : LPCWSTR
Declare PtrSafe Function PdhValidatePathW Lib "pdh" ( _
ByVal szFullPathBuffer 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
PdhValidatePathW = ctypes.windll.pdh.PdhValidatePathW
PdhValidatePathW.restype = wintypes.DWORD
PdhValidatePathW.argtypes = [
wintypes.LPCWSTR, # szFullPathBuffer : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('pdh.dll')
PdhValidatePathW = Fiddle::Function.new(
lib['PdhValidatePathW'],
[
Fiddle::TYPE_VOIDP, # szFullPathBuffer : LPCWSTR
],
-Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "pdh")]
extern "system" {
fn PdhValidatePathW(
szFullPathBuffer: *const u16 // LPCWSTR
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("pdh.dll", CharSet = CharSet.Unicode)]
public static extern uint PdhValidatePathW([MarshalAs(UnmanagedType.LPWStr)] string szFullPathBuffer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'pdh_PdhValidatePathW' -Namespace Win32 -PassThru
# $api::PdhValidatePathW(szFullPathBuffer)#uselib "pdh.dll"
#func global PdhValidatePathW "PdhValidatePathW" wptr
; PdhValidatePathW szFullPathBuffer ; 戻り値は stat
; szFullPathBuffer : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "pdh.dll"
#cfunc global PdhValidatePathW "PdhValidatePathW" wstr
; res = PdhValidatePathW(szFullPathBuffer)
; szFullPathBuffer : LPCWSTR -> "wstr"; DWORD PdhValidatePathW(LPCWSTR szFullPathBuffer)
#uselib "pdh.dll"
#cfunc global PdhValidatePathW "PdhValidatePathW" wstr
; res = PdhValidatePathW(szFullPathBuffer)
; szFullPathBuffer : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
pdh = windows.NewLazySystemDLL("pdh.dll")
procPdhValidatePathW = pdh.NewProc("PdhValidatePathW")
)
// szFullPathBuffer (LPCWSTR)
r1, _, err := procPdhValidatePathW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szFullPathBuffer))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction PdhValidatePathW(
szFullPathBuffer: PWideChar // LPCWSTR
): DWORD; stdcall;
external 'pdh.dll' name 'PdhValidatePathW';result := DllCall("pdh\PdhValidatePathW"
, "WStr", szFullPathBuffer ; LPCWSTR
, "UInt") ; return: DWORD●PdhValidatePathW(szFullPathBuffer) = DLL("pdh.dll", "dword PdhValidatePathW(char*)")
# 呼び出し: PdhValidatePathW(szFullPathBuffer)
# szFullPathBuffer : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。