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

DeleteProxyArpEntry

関数
指定したプロキシARPエントリを削除する。
DLLIPHLPAPI.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

DWORD DeleteProxyArpEntry(
    DWORD dwAddress,
    DWORD dwMask,
    DWORD dwIfIndex
);

パラメーター

名前方向説明
dwAddressDWORDinこのコンピューターがプロキシとして動作する対象の IPv4 アドレスです。
dwMaskDWORDindwAddress パラメーターで指定された IPv4 アドレスに対するサブネットマスクです。
dwIfIndexDWORDindwAddress パラメーターで指定された IP アドレスに対して、このコンピューターがプロキシ ARP をサポートするインターフェイスのインデックスです。

戻り値の型: DWORD

公式ドキュメント

DeleteProxyArpEntry 関数は、dwAddress および dwIfIndex パラメーターで指定された、ローカルコンピューター上の PARP エントリを削除します。

戻り値

関数が成功した場合、NO_ERROR(ゼロ)を返します。

関数が失敗した場合、戻り値は次のいずれかのエラーコードになります。

戻り値コード 説明
ERROR_ACCESS_DENIED
アクセスが拒否されました。このエラーは、Windows Vista および Windows Server 2008 において、次のような複数の条件で返されます。すなわち、ローカルコンピューター上で必要な管理者権限がユーザーに不足している場合、またはアプリケーションが組み込み Administrator(管理者として実行)として拡張シェルで実行されていない場合などです。
ERROR_INVALID_PARAMETER
入力パラメーターが無効であり、処理は行われませんでした。
ERROR_NOT_SUPPORTED
ローカルコンピューターで IPv4 トランスポートが構成されていません。
その他
返されたエラーのメッセージ文字列を取得するには、 FormatMessage を使用してください。

解説(Remarks)

ARP テーブルを取得するには、GetIpNetTable 関数を呼び出します。

Windows Vista 以降では、DeleteProxyArpEntry 関数は Administrators グループのメンバーとしてログオンしているユーザーのみが呼び出せます。Administrators グループのメンバーでないユーザーが DeleteProxyArpEntry を呼び出した場合、関数呼び出しは失敗し、ERROR_ACCESS_DENIED が返されます。この関数は、Windows Vista 以降のユーザーアカウント制御(UAC)が原因で失敗することもあります。この関数を含むアプリケーションが、組み込み Administrator 以外の Administrators グループのメンバーとしてログオンしているユーザーによって実行された場合、そのアプリケーションのマニフェストファイルで requestedExecutionLevel が requireAdministrator に設定されていない限り、この呼び出しは失敗します。Windows Vista 以降でアプリケーションにこのマニフェストファイルがない場合、この関数を成功させるには、組み込み Administrator 以外の Administrators グループのメンバーとしてログオンしているユーザーが、組み込み Administrator(管理者として実行)として拡張シェルでアプリケーションを実行する必要があります。

注意 この関数は特権操作を実行します。この関数を正常に実行するには、呼び出し元が Administrators グループまたは NetworkConfigurationOperators グループのメンバーとしてログオンしている必要があります。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

DWORD DeleteProxyArpEntry(
    DWORD dwAddress,
    DWORD dwMask,
    DWORD dwIfIndex
);
[DllImport("IPHLPAPI.dll", ExactSpelling = true)]
static extern uint DeleteProxyArpEntry(
    uint dwAddress,   // DWORD
    uint dwMask,   // DWORD
    uint dwIfIndex   // DWORD
);
<DllImport("IPHLPAPI.dll", ExactSpelling:=True)>
Public Shared Function DeleteProxyArpEntry(
    dwAddress As UInteger,   ' DWORD
    dwMask As UInteger,   ' DWORD
    dwIfIndex As UInteger   ' DWORD
) As UInteger
End Function
' dwAddress : DWORD
' dwMask : DWORD
' dwIfIndex : DWORD
Declare PtrSafe Function DeleteProxyArpEntry Lib "iphlpapi" ( _
    ByVal dwAddress As Long, _
    ByVal dwMask As Long, _
    ByVal dwIfIndex As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DeleteProxyArpEntry = ctypes.windll.iphlpapi.DeleteProxyArpEntry
DeleteProxyArpEntry.restype = wintypes.DWORD
DeleteProxyArpEntry.argtypes = [
    wintypes.DWORD,  # dwAddress : DWORD
    wintypes.DWORD,  # dwMask : DWORD
    wintypes.DWORD,  # dwIfIndex : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	iphlpapi = windows.NewLazySystemDLL("IPHLPAPI.dll")
	procDeleteProxyArpEntry = iphlpapi.NewProc("DeleteProxyArpEntry")
)

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

extern "iphlpapi" fn DeleteProxyArpEntry(
    dwAddress: u32, // DWORD
    dwMask: u32, // DWORD
    dwIfIndex: u32 // DWORD
) callconv(std.os.windows.WINAPI) u32;
proc DeleteProxyArpEntry(
    dwAddress: uint32,  # DWORD
    dwMask: uint32,  # DWORD
    dwIfIndex: uint32  # DWORD
): uint32 {.importc: "DeleteProxyArpEntry", stdcall, dynlib: "IPHLPAPI.dll".}
pragma(lib, "iphlpapi");
extern(Windows)
uint DeleteProxyArpEntry(
    uint dwAddress,   // DWORD
    uint dwMask,   // DWORD
    uint dwIfIndex   // DWORD
);
ccall((:DeleteProxyArpEntry, "IPHLPAPI.dll"), stdcall, UInt32,
      (UInt32, UInt32, UInt32),
      dwAddress, dwMask, dwIfIndex)
# dwAddress : DWORD -> UInt32
# dwMask : DWORD -> UInt32
# dwIfIndex : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t DeleteProxyArpEntry(
    uint32_t dwAddress,
    uint32_t dwMask,
    uint32_t dwIfIndex);
]]
local iphlpapi = ffi.load("iphlpapi")
-- iphlpapi.DeleteProxyArpEntry(dwAddress, dwMask, dwIfIndex)
-- dwAddress : DWORD
-- dwMask : DWORD
-- dwIfIndex : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('IPHLPAPI.dll');
const DeleteProxyArpEntry = lib.func('__stdcall', 'DeleteProxyArpEntry', 'uint32_t', ['uint32_t', 'uint32_t', 'uint32_t']);
// DeleteProxyArpEntry(dwAddress, dwMask, dwIfIndex)
// dwAddress : DWORD -> 'uint32_t'
// dwMask : DWORD -> 'uint32_t'
// dwIfIndex : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("IPHLPAPI.dll", {
  DeleteProxyArpEntry: { parameters: ["u32", "u32", "u32"], result: "u32" },
});
// lib.symbols.DeleteProxyArpEntry(dwAddress, dwMask, dwIfIndex)
// dwAddress : DWORD -> "u32"
// dwMask : DWORD -> "u32"
// dwIfIndex : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t DeleteProxyArpEntry(
    uint32_t dwAddress,
    uint32_t dwMask,
    uint32_t dwIfIndex);
C, "IPHLPAPI.dll");
// $ffi->DeleteProxyArpEntry(dwAddress, dwMask, dwIfIndex);
// dwAddress : DWORD
// dwMask : DWORD
// dwIfIndex : 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 Iphlpapi extends StdCallLibrary {
    Iphlpapi INSTANCE = Native.load("iphlpapi", Iphlpapi.class);
    int DeleteProxyArpEntry(
        int dwAddress,   // DWORD
        int dwMask,   // DWORD
        int dwIfIndex   // DWORD
    );
}
@[Link("iphlpapi")]
lib LibIPHLPAPI
  fun DeleteProxyArpEntry = DeleteProxyArpEntry(
    dwAddress : UInt32,   # DWORD
    dwMask : UInt32,   # DWORD
    dwIfIndex : 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 DeleteProxyArpEntryNative = Uint32 Function(Uint32, Uint32, Uint32);
typedef DeleteProxyArpEntryDart = int Function(int, int, int);
final DeleteProxyArpEntry = DynamicLibrary.open('IPHLPAPI.dll')
    .lookupFunction<DeleteProxyArpEntryNative, DeleteProxyArpEntryDart>('DeleteProxyArpEntry');
// dwAddress : DWORD -> Uint32
// dwMask : DWORD -> Uint32
// dwIfIndex : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function DeleteProxyArpEntry(
  dwAddress: DWORD;   // DWORD
  dwMask: DWORD;   // DWORD
  dwIfIndex: DWORD   // DWORD
): DWORD; stdcall;
  external 'IPHLPAPI.dll' name 'DeleteProxyArpEntry';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "DeleteProxyArpEntry"
  c_DeleteProxyArpEntry :: Word32 -> Word32 -> Word32 -> IO Word32
-- dwAddress : DWORD -> Word32
-- dwMask : DWORD -> Word32
-- dwIfIndex : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let deleteproxyarpentry =
  foreign "DeleteProxyArpEntry"
    (uint32_t @-> uint32_t @-> uint32_t @-> returning uint32_t)
(* dwAddress : DWORD -> uint32_t *)
(* dwMask : DWORD -> uint32_t *)
(* dwIfIndex : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library iphlpapi (t "IPHLPAPI.dll"))
(cffi:use-foreign-library iphlpapi)

(cffi:defcfun ("DeleteProxyArpEntry" delete-proxy-arp-entry :convention :stdcall) :uint32
  (dw-address :uint32)   ; DWORD
  (dw-mask :uint32)   ; DWORD
  (dw-if-index :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $DeleteProxyArpEntry = Win32::API::More->new('IPHLPAPI',
    'DWORD DeleteProxyArpEntry(DWORD dwAddress, DWORD dwMask, DWORD dwIfIndex)');
# my $ret = $DeleteProxyArpEntry->Call($dwAddress, $dwMask, $dwIfIndex);
# dwAddress : DWORD -> DWORD
# dwMask : DWORD -> DWORD
# dwIfIndex : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

公式の関連項目