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