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