ホーム › System.HostComputeNetwork › HcnQueryEndpointStats
HcnQueryEndpointStats
関数エンドポイントの統計情報を照会して取得する。
シグネチャ
// computenetwork.dll
#include <windows.h>
HRESULT HcnQueryEndpointStats(
void* Endpoint,
LPCWSTR Query,
LPWSTR* Stats,
LPWSTR* ErrorRecord // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Endpoint | void* | in |
| Query | LPCWSTR | in |
| Stats | LPWSTR* | out |
| ErrorRecord | LPWSTR* | outoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// computenetwork.dll
#include <windows.h>
HRESULT HcnQueryEndpointStats(
void* Endpoint,
LPCWSTR Query,
LPWSTR* Stats,
LPWSTR* ErrorRecord // optional
);[DllImport("computenetwork.dll", ExactSpelling = true)]
static extern int HcnQueryEndpointStats(
IntPtr Endpoint, // void*
[MarshalAs(UnmanagedType.LPWStr)] string Query, // LPCWSTR
IntPtr Stats, // LPWSTR* out
IntPtr ErrorRecord // LPWSTR* optional, out
);<DllImport("computenetwork.dll", ExactSpelling:=True)>
Public Shared Function HcnQueryEndpointStats(
Endpoint As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPWStr)> Query As String, ' LPCWSTR
Stats As IntPtr, ' LPWSTR* out
ErrorRecord As IntPtr ' LPWSTR* optional, out
) As Integer
End Function' Endpoint : void*
' Query : LPCWSTR
' Stats : LPWSTR* out
' ErrorRecord : LPWSTR* optional, out
Declare PtrSafe Function HcnQueryEndpointStats Lib "computenetwork" ( _
ByVal Endpoint As LongPtr, _
ByVal Query As LongPtr, _
ByVal Stats As LongPtr, _
ByVal ErrorRecord As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HcnQueryEndpointStats = ctypes.windll.computenetwork.HcnQueryEndpointStats
HcnQueryEndpointStats.restype = ctypes.c_int
HcnQueryEndpointStats.argtypes = [
ctypes.POINTER(None), # Endpoint : void*
wintypes.LPCWSTR, # Query : LPCWSTR
ctypes.c_void_p, # Stats : LPWSTR* out
ctypes.c_void_p, # ErrorRecord : LPWSTR* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('computenetwork.dll')
HcnQueryEndpointStats = Fiddle::Function.new(
lib['HcnQueryEndpointStats'],
[
Fiddle::TYPE_VOIDP, # Endpoint : void*
Fiddle::TYPE_VOIDP, # Query : LPCWSTR
Fiddle::TYPE_VOIDP, # Stats : LPWSTR* out
Fiddle::TYPE_VOIDP, # ErrorRecord : LPWSTR* optional, out
],
Fiddle::TYPE_INT)#[link(name = "computenetwork")]
extern "system" {
fn HcnQueryEndpointStats(
Endpoint: *mut (), // void*
Query: *const u16, // LPCWSTR
Stats: *mut *mut u16, // LPWSTR* out
ErrorRecord: *mut *mut u16 // LPWSTR* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("computenetwork.dll")]
public static extern int HcnQueryEndpointStats(IntPtr Endpoint, [MarshalAs(UnmanagedType.LPWStr)] string Query, IntPtr Stats, IntPtr ErrorRecord);
"@
$api = Add-Type -MemberDefinition $sig -Name 'computenetwork_HcnQueryEndpointStats' -Namespace Win32 -PassThru
# $api::HcnQueryEndpointStats(Endpoint, Query, Stats, ErrorRecord)#uselib "computenetwork.dll"
#func global HcnQueryEndpointStats "HcnQueryEndpointStats" sptr, sptr, sptr, sptr
; HcnQueryEndpointStats Endpoint, Query, varptr(Stats), varptr(ErrorRecord) ; 戻り値は stat
; Endpoint : void* -> "sptr"
; Query : LPCWSTR -> "sptr"
; Stats : LPWSTR* out -> "sptr"
; ErrorRecord : LPWSTR* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "computenetwork.dll" #cfunc global HcnQueryEndpointStats "HcnQueryEndpointStats" sptr, wstr, var, var ; res = HcnQueryEndpointStats(Endpoint, Query, Stats, ErrorRecord) ; Endpoint : void* -> "sptr" ; Query : LPCWSTR -> "wstr" ; Stats : LPWSTR* out -> "var" ; ErrorRecord : LPWSTR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "computenetwork.dll" #cfunc global HcnQueryEndpointStats "HcnQueryEndpointStats" sptr, wstr, sptr, sptr ; res = HcnQueryEndpointStats(Endpoint, Query, varptr(Stats), varptr(ErrorRecord)) ; Endpoint : void* -> "sptr" ; Query : LPCWSTR -> "wstr" ; Stats : LPWSTR* out -> "sptr" ; ErrorRecord : LPWSTR* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT HcnQueryEndpointStats(void* Endpoint, LPCWSTR Query, LPWSTR* Stats, LPWSTR* ErrorRecord) #uselib "computenetwork.dll" #cfunc global HcnQueryEndpointStats "HcnQueryEndpointStats" intptr, wstr, var, var ; res = HcnQueryEndpointStats(Endpoint, Query, Stats, ErrorRecord) ; Endpoint : void* -> "intptr" ; Query : LPCWSTR -> "wstr" ; Stats : LPWSTR* out -> "var" ; ErrorRecord : LPWSTR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT HcnQueryEndpointStats(void* Endpoint, LPCWSTR Query, LPWSTR* Stats, LPWSTR* ErrorRecord) #uselib "computenetwork.dll" #cfunc global HcnQueryEndpointStats "HcnQueryEndpointStats" intptr, wstr, intptr, intptr ; res = HcnQueryEndpointStats(Endpoint, Query, varptr(Stats), varptr(ErrorRecord)) ; Endpoint : void* -> "intptr" ; Query : LPCWSTR -> "wstr" ; Stats : LPWSTR* out -> "intptr" ; ErrorRecord : LPWSTR* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
computenetwork = windows.NewLazySystemDLL("computenetwork.dll")
procHcnQueryEndpointStats = computenetwork.NewProc("HcnQueryEndpointStats")
)
// Endpoint (void*), Query (LPCWSTR), Stats (LPWSTR* out), ErrorRecord (LPWSTR* optional, out)
r1, _, err := procHcnQueryEndpointStats.Call(
uintptr(Endpoint),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Query))),
uintptr(Stats),
uintptr(ErrorRecord),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction HcnQueryEndpointStats(
Endpoint: Pointer; // void*
Query: PWideChar; // LPCWSTR
Stats: PPWideChar; // LPWSTR* out
ErrorRecord: PPWideChar // LPWSTR* optional, out
): Integer; stdcall;
external 'computenetwork.dll' name 'HcnQueryEndpointStats';result := DllCall("computenetwork\HcnQueryEndpointStats"
, "Ptr", Endpoint ; void*
, "WStr", Query ; LPCWSTR
, "Ptr", Stats ; LPWSTR* out
, "Ptr", ErrorRecord ; LPWSTR* optional, out
, "Int") ; return: HRESULT●HcnQueryEndpointStats(Endpoint, Query, Stats, ErrorRecord) = DLL("computenetwork.dll", "int HcnQueryEndpointStats(void*, char*, void*, void*)")
# 呼び出し: HcnQueryEndpointStats(Endpoint, Query, Stats, ErrorRecord)
# Endpoint : void* -> "void*"
# Query : LPCWSTR -> "char*"
# Stats : LPWSTR* out -> "void*"
# ErrorRecord : LPWSTR* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。