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

MprAdminMIBEntryDelete

関数
ルーティングプロトコルのMIBエントリを削除する。
DLLMPRAPI.dll呼出規約winapi対応OSwindowsserver2000

シグネチャ

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

DWORD MprAdminMIBEntryDelete(
    INT_PTR hMibServer,
    DWORD dwProtocolId,
    DWORD dwRoutingPid,
    void* lpEntry,
    DWORD dwEntrySize
);

パラメーター

名前方向説明
hMibServerINT_PTRinMprAdminMIBServerConnectで取得したMIBサーバー接続ハンドル。
dwProtocolIdDWORDinエントリを削除するルーティングプロトコルの識別子。
dwRoutingPidDWORDinルーティングサブプロトコル(IP/IPX)の識別子。
lpEntryvoid*in削除対象MIBエントリを特定するデータを格納したバッファへのポインタ。
dwEntrySizeDWORDinlpEntryが指すバッファのサイズ(バイト単位)。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD MprAdminMIBEntryDelete(
    INT_PTR hMibServer,
    DWORD dwProtocolId,
    DWORD dwRoutingPid,
    void* lpEntry,
    DWORD dwEntrySize
);
[DllImport("MPRAPI.dll", ExactSpelling = true)]
static extern uint MprAdminMIBEntryDelete(
    IntPtr hMibServer,   // INT_PTR
    uint dwProtocolId,   // DWORD
    uint dwRoutingPid,   // DWORD
    IntPtr lpEntry,   // void*
    uint dwEntrySize   // DWORD
);
<DllImport("MPRAPI.dll", ExactSpelling:=True)>
Public Shared Function MprAdminMIBEntryDelete(
    hMibServer As IntPtr,   ' INT_PTR
    dwProtocolId As UInteger,   ' DWORD
    dwRoutingPid As UInteger,   ' DWORD
    lpEntry As IntPtr,   ' void*
    dwEntrySize As UInteger   ' DWORD
) As UInteger
End Function
' hMibServer : INT_PTR
' dwProtocolId : DWORD
' dwRoutingPid : DWORD
' lpEntry : void*
' dwEntrySize : DWORD
Declare PtrSafe Function MprAdminMIBEntryDelete Lib "mprapi" ( _
    ByVal hMibServer As LongPtr, _
    ByVal dwProtocolId As Long, _
    ByVal dwRoutingPid As Long, _
    ByVal lpEntry As LongPtr, _
    ByVal dwEntrySize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MprAdminMIBEntryDelete = ctypes.windll.mprapi.MprAdminMIBEntryDelete
MprAdminMIBEntryDelete.restype = wintypes.DWORD
MprAdminMIBEntryDelete.argtypes = [
    ctypes.c_ssize_t,  # hMibServer : INT_PTR
    wintypes.DWORD,  # dwProtocolId : DWORD
    wintypes.DWORD,  # dwRoutingPid : DWORD
    ctypes.POINTER(None),  # lpEntry : void*
    wintypes.DWORD,  # dwEntrySize : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
	procMprAdminMIBEntryDelete = mprapi.NewProc("MprAdminMIBEntryDelete")
)

// hMibServer (INT_PTR), dwProtocolId (DWORD), dwRoutingPid (DWORD), lpEntry (void*), dwEntrySize (DWORD)
r1, _, err := procMprAdminMIBEntryDelete.Call(
	uintptr(hMibServer),
	uintptr(dwProtocolId),
	uintptr(dwRoutingPid),
	uintptr(lpEntry),
	uintptr(dwEntrySize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function MprAdminMIBEntryDelete(
  hMibServer: NativeInt;   // INT_PTR
  dwProtocolId: DWORD;   // DWORD
  dwRoutingPid: DWORD;   // DWORD
  lpEntry: Pointer;   // void*
  dwEntrySize: DWORD   // DWORD
): DWORD; stdcall;
  external 'MPRAPI.dll' name 'MprAdminMIBEntryDelete';
result := DllCall("MPRAPI\MprAdminMIBEntryDelete"
    , "Ptr", hMibServer   ; INT_PTR
    , "UInt", dwProtocolId   ; DWORD
    , "UInt", dwRoutingPid   ; DWORD
    , "Ptr", lpEntry   ; void*
    , "UInt", dwEntrySize   ; DWORD
    , "UInt")   ; return: DWORD
●MprAdminMIBEntryDelete(hMibServer, dwProtocolId, dwRoutingPid, lpEntry, dwEntrySize) = DLL("MPRAPI.dll", "dword MprAdminMIBEntryDelete(int, dword, dword, void*, dword)")
# 呼び出し: MprAdminMIBEntryDelete(hMibServer, dwProtocolId, dwRoutingPid, lpEntry, dwEntrySize)
# hMibServer : INT_PTR -> "int"
# dwProtocolId : DWORD -> "dword"
# dwRoutingPid : DWORD -> "dword"
# lpEntry : void* -> "void*"
# dwEntrySize : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "mprapi" fn MprAdminMIBEntryDelete(
    hMibServer: isize, // INT_PTR
    dwProtocolId: u32, // DWORD
    dwRoutingPid: u32, // DWORD
    lpEntry: ?*anyopaque, // void*
    dwEntrySize: u32 // DWORD
) callconv(std.os.windows.WINAPI) u32;
proc MprAdminMIBEntryDelete(
    hMibServer: int,  # INT_PTR
    dwProtocolId: uint32,  # DWORD
    dwRoutingPid: uint32,  # DWORD
    lpEntry: pointer,  # void*
    dwEntrySize: uint32  # DWORD
): uint32 {.importc: "MprAdminMIBEntryDelete", stdcall, dynlib: "MPRAPI.dll".}
pragma(lib, "mprapi");
extern(Windows)
uint MprAdminMIBEntryDelete(
    ptrdiff_t hMibServer,   // INT_PTR
    uint dwProtocolId,   // DWORD
    uint dwRoutingPid,   // DWORD
    void* lpEntry,   // void*
    uint dwEntrySize   // DWORD
);
ccall((:MprAdminMIBEntryDelete, "MPRAPI.dll"), stdcall, UInt32,
      (Int, UInt32, UInt32, Ptr{Cvoid}, UInt32),
      hMibServer, dwProtocolId, dwRoutingPid, lpEntry, dwEntrySize)
# hMibServer : INT_PTR -> Int
# dwProtocolId : DWORD -> UInt32
# dwRoutingPid : DWORD -> UInt32
# lpEntry : void* -> Ptr{Cvoid}
# dwEntrySize : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t MprAdminMIBEntryDelete(
    intptr_t hMibServer,
    uint32_t dwProtocolId,
    uint32_t dwRoutingPid,
    void* lpEntry,
    uint32_t dwEntrySize);
]]
local mprapi = ffi.load("mprapi")
-- mprapi.MprAdminMIBEntryDelete(hMibServer, dwProtocolId, dwRoutingPid, lpEntry, dwEntrySize)
-- hMibServer : INT_PTR
-- dwProtocolId : DWORD
-- dwRoutingPid : DWORD
-- lpEntry : void*
-- dwEntrySize : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MPRAPI.dll');
const MprAdminMIBEntryDelete = lib.func('__stdcall', 'MprAdminMIBEntryDelete', 'uint32_t', ['intptr_t', 'uint32_t', 'uint32_t', 'void *', 'uint32_t']);
// MprAdminMIBEntryDelete(hMibServer, dwProtocolId, dwRoutingPid, lpEntry, dwEntrySize)
// hMibServer : INT_PTR -> 'intptr_t'
// dwProtocolId : DWORD -> 'uint32_t'
// dwRoutingPid : DWORD -> 'uint32_t'
// lpEntry : void* -> 'void *'
// dwEntrySize : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MPRAPI.dll", {
  MprAdminMIBEntryDelete: { parameters: ["isize", "u32", "u32", "pointer", "u32"], result: "u32" },
});
// lib.symbols.MprAdminMIBEntryDelete(hMibServer, dwProtocolId, dwRoutingPid, lpEntry, dwEntrySize)
// hMibServer : INT_PTR -> "isize"
// dwProtocolId : DWORD -> "u32"
// dwRoutingPid : DWORD -> "u32"
// lpEntry : void* -> "pointer"
// dwEntrySize : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t MprAdminMIBEntryDelete(
    intptr_t hMibServer,
    uint32_t dwProtocolId,
    uint32_t dwRoutingPid,
    void* lpEntry,
    uint32_t dwEntrySize);
C, "MPRAPI.dll");
// $ffi->MprAdminMIBEntryDelete(hMibServer, dwProtocolId, dwRoutingPid, lpEntry, dwEntrySize);
// hMibServer : INT_PTR
// dwProtocolId : DWORD
// dwRoutingPid : DWORD
// lpEntry : void*
// dwEntrySize : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Mprapi extends StdCallLibrary {
    Mprapi INSTANCE = Native.load("mprapi", Mprapi.class);
    int MprAdminMIBEntryDelete(
        long hMibServer,   // INT_PTR
        int dwProtocolId,   // DWORD
        int dwRoutingPid,   // DWORD
        Pointer lpEntry,   // void*
        int dwEntrySize   // DWORD
    );
}
@[Link("mprapi")]
lib LibMPRAPI
  fun MprAdminMIBEntryDelete = MprAdminMIBEntryDelete(
    hMibServer : LibC::SSizeT,   # INT_PTR
    dwProtocolId : UInt32,   # DWORD
    dwRoutingPid : UInt32,   # DWORD
    lpEntry : Void*,   # void*
    dwEntrySize : UInt32   # DWORD
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef MprAdminMIBEntryDeleteNative = Uint32 Function(IntPtr, Uint32, Uint32, Pointer<Void>, Uint32);
typedef MprAdminMIBEntryDeleteDart = int Function(int, int, int, Pointer<Void>, int);
final MprAdminMIBEntryDelete = DynamicLibrary.open('MPRAPI.dll')
    .lookupFunction<MprAdminMIBEntryDeleteNative, MprAdminMIBEntryDeleteDart>('MprAdminMIBEntryDelete');
// hMibServer : INT_PTR -> IntPtr
// dwProtocolId : DWORD -> Uint32
// dwRoutingPid : DWORD -> Uint32
// lpEntry : void* -> Pointer<Void>
// dwEntrySize : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MprAdminMIBEntryDelete(
  hMibServer: NativeInt;   // INT_PTR
  dwProtocolId: DWORD;   // DWORD
  dwRoutingPid: DWORD;   // DWORD
  lpEntry: Pointer;   // void*
  dwEntrySize: DWORD   // DWORD
): DWORD; stdcall;
  external 'MPRAPI.dll' name 'MprAdminMIBEntryDelete';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MprAdminMIBEntryDelete"
  c_MprAdminMIBEntryDelete :: CIntPtr -> Word32 -> Word32 -> Ptr () -> Word32 -> IO Word32
-- hMibServer : INT_PTR -> CIntPtr
-- dwProtocolId : DWORD -> Word32
-- dwRoutingPid : DWORD -> Word32
-- lpEntry : void* -> Ptr ()
-- dwEntrySize : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let mpradminmibentrydelete =
  foreign "MprAdminMIBEntryDelete"
    (intptr_t @-> uint32_t @-> uint32_t @-> (ptr void) @-> uint32_t @-> returning uint32_t)
(* hMibServer : INT_PTR -> intptr_t *)
(* dwProtocolId : DWORD -> uint32_t *)
(* dwRoutingPid : DWORD -> uint32_t *)
(* lpEntry : void* -> (ptr void) *)
(* dwEntrySize : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mprapi (t "MPRAPI.dll"))
(cffi:use-foreign-library mprapi)

(cffi:defcfun ("MprAdminMIBEntryDelete" mpr-admin-mibentry-delete :convention :stdcall) :uint32
  (h-mib-server :int64)   ; INT_PTR
  (dw-protocol-id :uint32)   ; DWORD
  (dw-routing-pid :uint32)   ; DWORD
  (lp-entry :pointer)   ; void*
  (dw-entry-size :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MprAdminMIBEntryDelete = Win32::API::More->new('MPRAPI',
    'DWORD MprAdminMIBEntryDelete(LPARAM hMibServer, DWORD dwProtocolId, DWORD dwRoutingPid, LPVOID lpEntry, DWORD dwEntrySize)');
# my $ret = $MprAdminMIBEntryDelete->Call($hMibServer, $dwProtocolId, $dwRoutingPid, $lpEntry, $dwEntrySize);
# hMibServer : INT_PTR -> LPARAM
# dwProtocolId : DWORD -> DWORD
# dwRoutingPid : DWORD -> DWORD
# lpEntry : void* -> LPVOID
# dwEntrySize : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。