ホーム › NetworkManagement.IpHelper › GetPerTcpConnectionEStats
GetPerTcpConnectionEStats
関数指定IPv4 TCP接続の拡張統計(ESTATS)情報を取得する。
シグネチャ
// IPHLPAPI.dll
#include <windows.h>
DWORD GetPerTcpConnectionEStats(
MIB_TCPROW_LH* Row,
TCP_ESTATS_TYPE EstatsType,
BYTE* Rw, // optional
DWORD RwVersion,
DWORD RwSize,
BYTE* Ros, // optional
DWORD RosVersion,
DWORD RosSize,
BYTE* Rod, // optional
DWORD RodVersion,
DWORD RodSize
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Row | MIB_TCPROW_LH* | in |
| EstatsType | TCP_ESTATS_TYPE | in |
| Rw | BYTE* | outoptional |
| RwVersion | DWORD | in |
| RwSize | DWORD | in |
| Ros | BYTE* | outoptional |
| RosVersion | DWORD | in |
| RosSize | DWORD | in |
| Rod | BYTE* | outoptional |
| RodVersion | DWORD | in |
| RodSize | DWORD | in |
戻り値の型: DWORD
各言語での呼び出し定義
// IPHLPAPI.dll
#include <windows.h>
DWORD GetPerTcpConnectionEStats(
MIB_TCPROW_LH* Row,
TCP_ESTATS_TYPE EstatsType,
BYTE* Rw, // optional
DWORD RwVersion,
DWORD RwSize,
BYTE* Ros, // optional
DWORD RosVersion,
DWORD RosSize,
BYTE* Rod, // optional
DWORD RodVersion,
DWORD RodSize
);[DllImport("IPHLPAPI.dll", ExactSpelling = true)]
static extern uint GetPerTcpConnectionEStats(
IntPtr Row, // MIB_TCPROW_LH*
int EstatsType, // TCP_ESTATS_TYPE
IntPtr Rw, // BYTE* optional, out
uint RwVersion, // DWORD
uint RwSize, // DWORD
IntPtr Ros, // BYTE* optional, out
uint RosVersion, // DWORD
uint RosSize, // DWORD
IntPtr Rod, // BYTE* optional, out
uint RodVersion, // DWORD
uint RodSize // DWORD
);<DllImport("IPHLPAPI.dll", ExactSpelling:=True)>
Public Shared Function GetPerTcpConnectionEStats(
Row As IntPtr, ' MIB_TCPROW_LH*
EstatsType As Integer, ' TCP_ESTATS_TYPE
Rw As IntPtr, ' BYTE* optional, out
RwVersion As UInteger, ' DWORD
RwSize As UInteger, ' DWORD
Ros As IntPtr, ' BYTE* optional, out
RosVersion As UInteger, ' DWORD
RosSize As UInteger, ' DWORD
Rod As IntPtr, ' BYTE* optional, out
RodVersion As UInteger, ' DWORD
RodSize As UInteger ' DWORD
) As UInteger
End Function' Row : MIB_TCPROW_LH*
' EstatsType : TCP_ESTATS_TYPE
' Rw : BYTE* optional, out
' RwVersion : DWORD
' RwSize : DWORD
' Ros : BYTE* optional, out
' RosVersion : DWORD
' RosSize : DWORD
' Rod : BYTE* optional, out
' RodVersion : DWORD
' RodSize : DWORD
Declare PtrSafe Function GetPerTcpConnectionEStats Lib "iphlpapi" ( _
ByVal Row As LongPtr, _
ByVal EstatsType As Long, _
ByVal Rw As LongPtr, _
ByVal RwVersion As Long, _
ByVal RwSize As Long, _
ByVal Ros As LongPtr, _
ByVal RosVersion As Long, _
ByVal RosSize As Long, _
ByVal Rod As LongPtr, _
ByVal RodVersion As Long, _
ByVal RodSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetPerTcpConnectionEStats = ctypes.windll.iphlpapi.GetPerTcpConnectionEStats
GetPerTcpConnectionEStats.restype = wintypes.DWORD
GetPerTcpConnectionEStats.argtypes = [
ctypes.c_void_p, # Row : MIB_TCPROW_LH*
ctypes.c_int, # EstatsType : TCP_ESTATS_TYPE
ctypes.POINTER(ctypes.c_ubyte), # Rw : BYTE* optional, out
wintypes.DWORD, # RwVersion : DWORD
wintypes.DWORD, # RwSize : DWORD
ctypes.POINTER(ctypes.c_ubyte), # Ros : BYTE* optional, out
wintypes.DWORD, # RosVersion : DWORD
wintypes.DWORD, # RosSize : DWORD
ctypes.POINTER(ctypes.c_ubyte), # Rod : BYTE* optional, out
wintypes.DWORD, # RodVersion : DWORD
wintypes.DWORD, # RodSize : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('IPHLPAPI.dll')
GetPerTcpConnectionEStats = Fiddle::Function.new(
lib['GetPerTcpConnectionEStats'],
[
Fiddle::TYPE_VOIDP, # Row : MIB_TCPROW_LH*
Fiddle::TYPE_INT, # EstatsType : TCP_ESTATS_TYPE
Fiddle::TYPE_VOIDP, # Rw : BYTE* optional, out
-Fiddle::TYPE_INT, # RwVersion : DWORD
-Fiddle::TYPE_INT, # RwSize : DWORD
Fiddle::TYPE_VOIDP, # Ros : BYTE* optional, out
-Fiddle::TYPE_INT, # RosVersion : DWORD
-Fiddle::TYPE_INT, # RosSize : DWORD
Fiddle::TYPE_VOIDP, # Rod : BYTE* optional, out
-Fiddle::TYPE_INT, # RodVersion : DWORD
-Fiddle::TYPE_INT, # RodSize : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "iphlpapi")]
extern "system" {
fn GetPerTcpConnectionEStats(
Row: *mut MIB_TCPROW_LH, // MIB_TCPROW_LH*
EstatsType: i32, // TCP_ESTATS_TYPE
Rw: *mut u8, // BYTE* optional, out
RwVersion: u32, // DWORD
RwSize: u32, // DWORD
Ros: *mut u8, // BYTE* optional, out
RosVersion: u32, // DWORD
RosSize: u32, // DWORD
Rod: *mut u8, // BYTE* optional, out
RodVersion: u32, // DWORD
RodSize: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("IPHLPAPI.dll")]
public static extern uint GetPerTcpConnectionEStats(IntPtr Row, int EstatsType, IntPtr Rw, uint RwVersion, uint RwSize, IntPtr Ros, uint RosVersion, uint RosSize, IntPtr Rod, uint RodVersion, uint RodSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IPHLPAPI_GetPerTcpConnectionEStats' -Namespace Win32 -PassThru
# $api::GetPerTcpConnectionEStats(Row, EstatsType, Rw, RwVersion, RwSize, Ros, RosVersion, RosSize, Rod, RodVersion, RodSize)#uselib "IPHLPAPI.dll"
#func global GetPerTcpConnectionEStats "GetPerTcpConnectionEStats" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; GetPerTcpConnectionEStats varptr(Row), EstatsType, varptr(Rw), RwVersion, RwSize, varptr(Ros), RosVersion, RosSize, varptr(Rod), RodVersion, RodSize ; 戻り値は stat
; Row : MIB_TCPROW_LH* -> "sptr"
; EstatsType : TCP_ESTATS_TYPE -> "sptr"
; Rw : BYTE* optional, out -> "sptr"
; RwVersion : DWORD -> "sptr"
; RwSize : DWORD -> "sptr"
; Ros : BYTE* optional, out -> "sptr"
; RosVersion : DWORD -> "sptr"
; RosSize : DWORD -> "sptr"
; Rod : BYTE* optional, out -> "sptr"
; RodVersion : DWORD -> "sptr"
; RodSize : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "IPHLPAPI.dll" #cfunc global GetPerTcpConnectionEStats "GetPerTcpConnectionEStats" var, int, var, int, int, var, int, int, var, int, int ; res = GetPerTcpConnectionEStats(Row, EstatsType, Rw, RwVersion, RwSize, Ros, RosVersion, RosSize, Rod, RodVersion, RodSize) ; Row : MIB_TCPROW_LH* -> "var" ; EstatsType : TCP_ESTATS_TYPE -> "int" ; Rw : BYTE* optional, out -> "var" ; RwVersion : DWORD -> "int" ; RwSize : DWORD -> "int" ; Ros : BYTE* optional, out -> "var" ; RosVersion : DWORD -> "int" ; RosSize : DWORD -> "int" ; Rod : BYTE* optional, out -> "var" ; RodVersion : DWORD -> "int" ; RodSize : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "IPHLPAPI.dll" #cfunc global GetPerTcpConnectionEStats "GetPerTcpConnectionEStats" sptr, int, sptr, int, int, sptr, int, int, sptr, int, int ; res = GetPerTcpConnectionEStats(varptr(Row), EstatsType, varptr(Rw), RwVersion, RwSize, varptr(Ros), RosVersion, RosSize, varptr(Rod), RodVersion, RodSize) ; Row : MIB_TCPROW_LH* -> "sptr" ; EstatsType : TCP_ESTATS_TYPE -> "int" ; Rw : BYTE* optional, out -> "sptr" ; RwVersion : DWORD -> "int" ; RwSize : DWORD -> "int" ; Ros : BYTE* optional, out -> "sptr" ; RosVersion : DWORD -> "int" ; RosSize : DWORD -> "int" ; Rod : BYTE* optional, out -> "sptr" ; RodVersion : DWORD -> "int" ; RodSize : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD GetPerTcpConnectionEStats(MIB_TCPROW_LH* Row, TCP_ESTATS_TYPE EstatsType, BYTE* Rw, DWORD RwVersion, DWORD RwSize, BYTE* Ros, DWORD RosVersion, DWORD RosSize, BYTE* Rod, DWORD RodVersion, DWORD RodSize) #uselib "IPHLPAPI.dll" #cfunc global GetPerTcpConnectionEStats "GetPerTcpConnectionEStats" var, int, var, int, int, var, int, int, var, int, int ; res = GetPerTcpConnectionEStats(Row, EstatsType, Rw, RwVersion, RwSize, Ros, RosVersion, RosSize, Rod, RodVersion, RodSize) ; Row : MIB_TCPROW_LH* -> "var" ; EstatsType : TCP_ESTATS_TYPE -> "int" ; Rw : BYTE* optional, out -> "var" ; RwVersion : DWORD -> "int" ; RwSize : DWORD -> "int" ; Ros : BYTE* optional, out -> "var" ; RosVersion : DWORD -> "int" ; RosSize : DWORD -> "int" ; Rod : BYTE* optional, out -> "var" ; RodVersion : DWORD -> "int" ; RodSize : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD GetPerTcpConnectionEStats(MIB_TCPROW_LH* Row, TCP_ESTATS_TYPE EstatsType, BYTE* Rw, DWORD RwVersion, DWORD RwSize, BYTE* Ros, DWORD RosVersion, DWORD RosSize, BYTE* Rod, DWORD RodVersion, DWORD RodSize) #uselib "IPHLPAPI.dll" #cfunc global GetPerTcpConnectionEStats "GetPerTcpConnectionEStats" intptr, int, intptr, int, int, intptr, int, int, intptr, int, int ; res = GetPerTcpConnectionEStats(varptr(Row), EstatsType, varptr(Rw), RwVersion, RwSize, varptr(Ros), RosVersion, RosSize, varptr(Rod), RodVersion, RodSize) ; Row : MIB_TCPROW_LH* -> "intptr" ; EstatsType : TCP_ESTATS_TYPE -> "int" ; Rw : BYTE* optional, out -> "intptr" ; RwVersion : DWORD -> "int" ; RwSize : DWORD -> "int" ; Ros : BYTE* optional, out -> "intptr" ; RosVersion : DWORD -> "int" ; RosSize : DWORD -> "int" ; Rod : BYTE* optional, out -> "intptr" ; RodVersion : DWORD -> "int" ; RodSize : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
iphlpapi = windows.NewLazySystemDLL("IPHLPAPI.dll")
procGetPerTcpConnectionEStats = iphlpapi.NewProc("GetPerTcpConnectionEStats")
)
// Row (MIB_TCPROW_LH*), EstatsType (TCP_ESTATS_TYPE), Rw (BYTE* optional, out), RwVersion (DWORD), RwSize (DWORD), Ros (BYTE* optional, out), RosVersion (DWORD), RosSize (DWORD), Rod (BYTE* optional, out), RodVersion (DWORD), RodSize (DWORD)
r1, _, err := procGetPerTcpConnectionEStats.Call(
uintptr(Row),
uintptr(EstatsType),
uintptr(Rw),
uintptr(RwVersion),
uintptr(RwSize),
uintptr(Ros),
uintptr(RosVersion),
uintptr(RosSize),
uintptr(Rod),
uintptr(RodVersion),
uintptr(RodSize),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction GetPerTcpConnectionEStats(
Row: Pointer; // MIB_TCPROW_LH*
EstatsType: Integer; // TCP_ESTATS_TYPE
Rw: Pointer; // BYTE* optional, out
RwVersion: DWORD; // DWORD
RwSize: DWORD; // DWORD
Ros: Pointer; // BYTE* optional, out
RosVersion: DWORD; // DWORD
RosSize: DWORD; // DWORD
Rod: Pointer; // BYTE* optional, out
RodVersion: DWORD; // DWORD
RodSize: DWORD // DWORD
): DWORD; stdcall;
external 'IPHLPAPI.dll' name 'GetPerTcpConnectionEStats';result := DllCall("IPHLPAPI\GetPerTcpConnectionEStats"
, "Ptr", Row ; MIB_TCPROW_LH*
, "Int", EstatsType ; TCP_ESTATS_TYPE
, "Ptr", Rw ; BYTE* optional, out
, "UInt", RwVersion ; DWORD
, "UInt", RwSize ; DWORD
, "Ptr", Ros ; BYTE* optional, out
, "UInt", RosVersion ; DWORD
, "UInt", RosSize ; DWORD
, "Ptr", Rod ; BYTE* optional, out
, "UInt", RodVersion ; DWORD
, "UInt", RodSize ; DWORD
, "UInt") ; return: DWORD●GetPerTcpConnectionEStats(Row, EstatsType, Rw, RwVersion, RwSize, Ros, RosVersion, RosSize, Rod, RodVersion, RodSize) = DLL("IPHLPAPI.dll", "dword GetPerTcpConnectionEStats(void*, int, void*, dword, dword, void*, dword, dword, void*, dword, dword)")
# 呼び出し: GetPerTcpConnectionEStats(Row, EstatsType, Rw, RwVersion, RwSize, Ros, RosVersion, RosSize, Rod, RodVersion, RodSize)
# Row : MIB_TCPROW_LH* -> "void*"
# EstatsType : TCP_ESTATS_TYPE -> "int"
# Rw : BYTE* optional, out -> "void*"
# RwVersion : DWORD -> "dword"
# RwSize : DWORD -> "dword"
# Ros : BYTE* optional, out -> "void*"
# RosVersion : DWORD -> "dword"
# RosSize : DWORD -> "dword"
# Rod : BYTE* optional, out -> "void*"
# RodVersion : DWORD -> "dword"
# RodSize : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。