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

SnmpDuplicateVbl

関数
WinSNMPの変数バインドリストを複製する。
DLLwsnmp32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

INT_PTR SnmpDuplicateVbl(
    INT_PTR session,
    INT_PTR vbl
);

パラメーター

名前方向
sessionINT_PTRin
vblINT_PTRin

戻り値の型: INT_PTR

各言語での呼び出し定義

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

INT_PTR SnmpDuplicateVbl(
    INT_PTR session,
    INT_PTR vbl
);
[DllImport("wsnmp32.dll", ExactSpelling = true)]
static extern IntPtr SnmpDuplicateVbl(
    IntPtr session,   // INT_PTR
    IntPtr vbl   // INT_PTR
);
<DllImport("wsnmp32.dll", ExactSpelling:=True)>
Public Shared Function SnmpDuplicateVbl(
    session As IntPtr,   ' INT_PTR
    vbl As IntPtr   ' INT_PTR
) As IntPtr
End Function
' session : INT_PTR
' vbl : INT_PTR
Declare PtrSafe Function SnmpDuplicateVbl Lib "wsnmp32" ( _
    ByVal session As LongPtr, _
    ByVal vbl As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SnmpDuplicateVbl = ctypes.windll.wsnmp32.SnmpDuplicateVbl
SnmpDuplicateVbl.restype = ctypes.c_ssize_t
SnmpDuplicateVbl.argtypes = [
    ctypes.c_ssize_t,  # session : INT_PTR
    ctypes.c_ssize_t,  # vbl : INT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wsnmp32.dll')
SnmpDuplicateVbl = Fiddle::Function.new(
  lib['SnmpDuplicateVbl'],
  [
    Fiddle::TYPE_INTPTR_T,  # session : INT_PTR
    Fiddle::TYPE_INTPTR_T,  # vbl : INT_PTR
  ],
  Fiddle::TYPE_INTPTR_T)
#[link(name = "wsnmp32")]
extern "system" {
    fn SnmpDuplicateVbl(
        session: isize,  // INT_PTR
        vbl: isize  // INT_PTR
    ) -> isize;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("wsnmp32.dll")]
public static extern IntPtr SnmpDuplicateVbl(IntPtr session, IntPtr vbl);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wsnmp32_SnmpDuplicateVbl' -Namespace Win32 -PassThru
# $api::SnmpDuplicateVbl(session, vbl)
#uselib "wsnmp32.dll"
#func global SnmpDuplicateVbl "SnmpDuplicateVbl" sptr, sptr
; SnmpDuplicateVbl session, vbl   ; 戻り値は stat
; session : INT_PTR -> "sptr"
; vbl : INT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "wsnmp32.dll"
#cfunc global SnmpDuplicateVbl "SnmpDuplicateVbl" sptr, sptr
; res = SnmpDuplicateVbl(session, vbl)
; session : INT_PTR -> "sptr"
; vbl : INT_PTR -> "sptr"
; INT_PTR SnmpDuplicateVbl(INT_PTR session, INT_PTR vbl)
#uselib "wsnmp32.dll"
#cfunc global SnmpDuplicateVbl "SnmpDuplicateVbl" intptr, intptr
; res = SnmpDuplicateVbl(session, vbl)
; session : INT_PTR -> "intptr"
; vbl : INT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wsnmp32 = windows.NewLazySystemDLL("wsnmp32.dll")
	procSnmpDuplicateVbl = wsnmp32.NewProc("SnmpDuplicateVbl")
)

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