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

SnmpGetRetry

関数
指定したエンティティの要求再試行回数を取得する。
DLLwsnmp32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD SnmpGetRetry(
    INT_PTR hEntity,
    DWORD* nPolicyRetry,
    DWORD* nActualRetry
);

パラメーター

名前方向
hEntityINT_PTRin
nPolicyRetryDWORD*inout
nActualRetryDWORD*inout

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD SnmpGetRetry(
    INT_PTR hEntity,
    DWORD* nPolicyRetry,
    DWORD* nActualRetry
);
[DllImport("wsnmp32.dll", ExactSpelling = true)]
static extern uint SnmpGetRetry(
    IntPtr hEntity,   // INT_PTR
    ref uint nPolicyRetry,   // DWORD* in/out
    ref uint nActualRetry   // DWORD* in/out
);
<DllImport("wsnmp32.dll", ExactSpelling:=True)>
Public Shared Function SnmpGetRetry(
    hEntity As IntPtr,   ' INT_PTR
    ByRef nPolicyRetry As UInteger,   ' DWORD* in/out
    ByRef nActualRetry As UInteger   ' DWORD* in/out
) As UInteger
End Function
' hEntity : INT_PTR
' nPolicyRetry : DWORD* in/out
' nActualRetry : DWORD* in/out
Declare PtrSafe Function SnmpGetRetry Lib "wsnmp32" ( _
    ByVal hEntity As LongPtr, _
    ByRef nPolicyRetry As Long, _
    ByRef nActualRetry As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SnmpGetRetry = ctypes.windll.wsnmp32.SnmpGetRetry
SnmpGetRetry.restype = wintypes.DWORD
SnmpGetRetry.argtypes = [
    ctypes.c_ssize_t,  # hEntity : INT_PTR
    ctypes.POINTER(wintypes.DWORD),  # nPolicyRetry : DWORD* in/out
    ctypes.POINTER(wintypes.DWORD),  # nActualRetry : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wsnmp32.dll')
SnmpGetRetry = Fiddle::Function.new(
  lib['SnmpGetRetry'],
  [
    Fiddle::TYPE_INTPTR_T,  # hEntity : INT_PTR
    Fiddle::TYPE_VOIDP,  # nPolicyRetry : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # nActualRetry : DWORD* in/out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "wsnmp32")]
extern "system" {
    fn SnmpGetRetry(
        hEntity: isize,  // INT_PTR
        nPolicyRetry: *mut u32,  // DWORD* in/out
        nActualRetry: *mut u32  // DWORD* in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("wsnmp32.dll")]
public static extern uint SnmpGetRetry(IntPtr hEntity, ref uint nPolicyRetry, ref uint nActualRetry);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wsnmp32_SnmpGetRetry' -Namespace Win32 -PassThru
# $api::SnmpGetRetry(hEntity, nPolicyRetry, nActualRetry)
#uselib "wsnmp32.dll"
#func global SnmpGetRetry "SnmpGetRetry" sptr, sptr, sptr
; SnmpGetRetry hEntity, varptr(nPolicyRetry), varptr(nActualRetry)   ; 戻り値は stat
; hEntity : INT_PTR -> "sptr"
; nPolicyRetry : DWORD* in/out -> "sptr"
; nActualRetry : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "wsnmp32.dll"
#cfunc global SnmpGetRetry "SnmpGetRetry" sptr, var, var
; res = SnmpGetRetry(hEntity, nPolicyRetry, nActualRetry)
; hEntity : INT_PTR -> "sptr"
; nPolicyRetry : DWORD* in/out -> "var"
; nActualRetry : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD SnmpGetRetry(INT_PTR hEntity, DWORD* nPolicyRetry, DWORD* nActualRetry)
#uselib "wsnmp32.dll"
#cfunc global SnmpGetRetry "SnmpGetRetry" intptr, var, var
; res = SnmpGetRetry(hEntity, nPolicyRetry, nActualRetry)
; hEntity : INT_PTR -> "intptr"
; nPolicyRetry : DWORD* in/out -> "var"
; nActualRetry : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wsnmp32 = windows.NewLazySystemDLL("wsnmp32.dll")
	procSnmpGetRetry = wsnmp32.NewProc("SnmpGetRetry")
)

// hEntity (INT_PTR), nPolicyRetry (DWORD* in/out), nActualRetry (DWORD* in/out)
r1, _, err := procSnmpGetRetry.Call(
	uintptr(hEntity),
	uintptr(nPolicyRetry),
	uintptr(nActualRetry),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function SnmpGetRetry(
  hEntity: NativeInt;   // INT_PTR
  nPolicyRetry: Pointer;   // DWORD* in/out
  nActualRetry: Pointer   // DWORD* in/out
): DWORD; stdcall;
  external 'wsnmp32.dll' name 'SnmpGetRetry';
result := DllCall("wsnmp32\SnmpGetRetry"
    , "Ptr", hEntity   ; INT_PTR
    , "Ptr", nPolicyRetry   ; DWORD* in/out
    , "Ptr", nActualRetry   ; DWORD* in/out
    , "UInt")   ; return: DWORD
●SnmpGetRetry(hEntity, nPolicyRetry, nActualRetry) = DLL("wsnmp32.dll", "dword SnmpGetRetry(int, void*, void*)")
# 呼び出し: SnmpGetRetry(hEntity, nPolicyRetry, nActualRetry)
# hEntity : INT_PTR -> "int"
# nPolicyRetry : DWORD* in/out -> "void*"
# nActualRetry : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。