Win32 API 日本語リファレンス
ホームNetworkManagement.IpHelper › SetPerTcp6ConnectionEStats

SetPerTcp6ConnectionEStats

関数
指定IPv6 TCP接続の拡張統計(ESTATS)収集を設定する。
DLLIPHLPAPI.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// IPHLPAPI.dll
#include <windows.h>

DWORD SetPerTcp6ConnectionEStats(
    MIB_TCP6ROW* Row,
    TCP_ESTATS_TYPE EstatsType,
    BYTE* Rw,
    DWORD RwVersion,
    DWORD RwSize,
    DWORD Offset
);

パラメーター

名前方向
RowMIB_TCP6ROW*in
EstatsTypeTCP_ESTATS_TYPEin
RwBYTE*in
RwVersionDWORDin
RwSizeDWORDin
OffsetDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

// IPHLPAPI.dll
#include <windows.h>

DWORD SetPerTcp6ConnectionEStats(
    MIB_TCP6ROW* Row,
    TCP_ESTATS_TYPE EstatsType,
    BYTE* Rw,
    DWORD RwVersion,
    DWORD RwSize,
    DWORD Offset
);
[DllImport("IPHLPAPI.dll", ExactSpelling = true)]
static extern uint SetPerTcp6ConnectionEStats(
    IntPtr Row,   // MIB_TCP6ROW*
    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 SetPerTcp6ConnectionEStats(
    Row As IntPtr,   ' MIB_TCP6ROW*
    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_TCP6ROW*
' EstatsType : TCP_ESTATS_TYPE
' Rw : BYTE*
' RwVersion : DWORD
' RwSize : DWORD
' Offset : DWORD
Declare PtrSafe Function SetPerTcp6ConnectionEStats 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

SetPerTcp6ConnectionEStats = ctypes.windll.iphlpapi.SetPerTcp6ConnectionEStats
SetPerTcp6ConnectionEStats.restype = wintypes.DWORD
SetPerTcp6ConnectionEStats.argtypes = [
    ctypes.c_void_p,  # Row : MIB_TCP6ROW*
    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')
SetPerTcp6ConnectionEStats = Fiddle::Function.new(
  lib['SetPerTcp6ConnectionEStats'],
  [
    Fiddle::TYPE_VOIDP,  # Row : MIB_TCP6ROW*
    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 SetPerTcp6ConnectionEStats(
        Row: *mut MIB_TCP6ROW,  // MIB_TCP6ROW*
        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 SetPerTcp6ConnectionEStats(IntPtr Row, int EstatsType, IntPtr Rw, uint RwVersion, uint RwSize, uint Offset);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IPHLPAPI_SetPerTcp6ConnectionEStats' -Namespace Win32 -PassThru
# $api::SetPerTcp6ConnectionEStats(Row, EstatsType, Rw, RwVersion, RwSize, Offset)
#uselib "IPHLPAPI.dll"
#func global SetPerTcp6ConnectionEStats "SetPerTcp6ConnectionEStats" sptr, sptr, sptr, sptr, sptr, sptr
; SetPerTcp6ConnectionEStats varptr(Row), EstatsType, varptr(Rw), RwVersion, RwSize, Offset   ; 戻り値は stat
; Row : MIB_TCP6ROW* -> "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 SetPerTcp6ConnectionEStats "SetPerTcp6ConnectionEStats" var, int, var, int, int, int
; res = SetPerTcp6ConnectionEStats(Row, EstatsType, Rw, RwVersion, RwSize, Offset)
; Row : MIB_TCP6ROW* -> "var"
; EstatsType : TCP_ESTATS_TYPE -> "int"
; Rw : BYTE* -> "var"
; RwVersion : DWORD -> "int"
; RwSize : DWORD -> "int"
; Offset : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD SetPerTcp6ConnectionEStats(MIB_TCP6ROW* Row, TCP_ESTATS_TYPE EstatsType, BYTE* Rw, DWORD RwVersion, DWORD RwSize, DWORD Offset)
#uselib "IPHLPAPI.dll"
#cfunc global SetPerTcp6ConnectionEStats "SetPerTcp6ConnectionEStats" var, int, var, int, int, int
; res = SetPerTcp6ConnectionEStats(Row, EstatsType, Rw, RwVersion, RwSize, Offset)
; Row : MIB_TCP6ROW* -> "var"
; EstatsType : TCP_ESTATS_TYPE -> "int"
; Rw : BYTE* -> "var"
; RwVersion : DWORD -> "int"
; RwSize : DWORD -> "int"
; Offset : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	iphlpapi = windows.NewLazySystemDLL("IPHLPAPI.dll")
	procSetPerTcp6ConnectionEStats = iphlpapi.NewProc("SetPerTcp6ConnectionEStats")
)

// Row (MIB_TCP6ROW*), EstatsType (TCP_ESTATS_TYPE), Rw (BYTE*), RwVersion (DWORD), RwSize (DWORD), Offset (DWORD)
r1, _, err := procSetPerTcp6ConnectionEStats.Call(
	uintptr(Row),
	uintptr(EstatsType),
	uintptr(Rw),
	uintptr(RwVersion),
	uintptr(RwSize),
	uintptr(Offset),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function SetPerTcp6ConnectionEStats(
  Row: Pointer;   // MIB_TCP6ROW*
  EstatsType: Integer;   // TCP_ESTATS_TYPE
  Rw: Pointer;   // BYTE*
  RwVersion: DWORD;   // DWORD
  RwSize: DWORD;   // DWORD
  Offset: DWORD   // DWORD
): DWORD; stdcall;
  external 'IPHLPAPI.dll' name 'SetPerTcp6ConnectionEStats';
result := DllCall("IPHLPAPI\SetPerTcp6ConnectionEStats"
    , "Ptr", Row   ; MIB_TCP6ROW*
    , "Int", EstatsType   ; TCP_ESTATS_TYPE
    , "Ptr", Rw   ; BYTE*
    , "UInt", RwVersion   ; DWORD
    , "UInt", RwSize   ; DWORD
    , "UInt", Offset   ; DWORD
    , "UInt")   ; return: DWORD
●SetPerTcp6ConnectionEStats(Row, EstatsType, Rw, RwVersion, RwSize, Offset) = DLL("IPHLPAPI.dll", "dword SetPerTcp6ConnectionEStats(void*, int, void*, dword, dword, dword)")
# 呼び出し: SetPerTcp6ConnectionEStats(Row, EstatsType, Rw, RwVersion, RwSize, Offset)
# Row : MIB_TCP6ROW* -> "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)。