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

PdhValidatePathA

関数
カウンターパスが有効か検証する(ANSI版)。
DLLpdh.dll文字セットANSI (-A)呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

DWORD PdhValidatePathA(
    LPCSTR szFullPathBuffer
);

パラメーター

名前方向
szFullPathBufferLPCSTRin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

PdhValidatePathA = ctypes.windll.pdh.PdhValidatePathA
PdhValidatePathA.restype = wintypes.DWORD
PdhValidatePathA.argtypes = [
    wintypes.LPCSTR,  # szFullPathBuffer : LPCSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	pdh = windows.NewLazySystemDLL("pdh.dll")
	procPdhValidatePathA = pdh.NewProc("PdhValidatePathA")
)

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