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