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