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