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