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

FreeInterfaceDnsSettings

関数
インターフェイスDNS設定構造体のメモリを解放する。
DLLIPHLPAPI.dll呼出規約winapi

シグネチャ

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

void FreeInterfaceDnsSettings(
    DNS_INTERFACE_SETTINGS* Settings
);

パラメーター

名前方向
SettingsDNS_INTERFACE_SETTINGS*inout

戻り値の型: void

各言語での呼び出し定義

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

void FreeInterfaceDnsSettings(
    DNS_INTERFACE_SETTINGS* Settings
);
[DllImport("IPHLPAPI.dll", ExactSpelling = true)]
static extern void FreeInterfaceDnsSettings(
    IntPtr Settings   // DNS_INTERFACE_SETTINGS* in/out
);
<DllImport("IPHLPAPI.dll", ExactSpelling:=True)>
Public Shared Sub FreeInterfaceDnsSettings(
    Settings As IntPtr   ' DNS_INTERFACE_SETTINGS* in/out
)
End Sub
' Settings : DNS_INTERFACE_SETTINGS* in/out
Declare PtrSafe Sub FreeInterfaceDnsSettings Lib "iphlpapi" ( _
    ByVal Settings As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

FreeInterfaceDnsSettings = ctypes.windll.iphlpapi.FreeInterfaceDnsSettings
FreeInterfaceDnsSettings.restype = None
FreeInterfaceDnsSettings.argtypes = [
    ctypes.c_void_p,  # Settings : DNS_INTERFACE_SETTINGS* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('IPHLPAPI.dll')
FreeInterfaceDnsSettings = Fiddle::Function.new(
  lib['FreeInterfaceDnsSettings'],
  [
    Fiddle::TYPE_VOIDP,  # Settings : DNS_INTERFACE_SETTINGS* in/out
  ],
  Fiddle::TYPE_VOID)
#[link(name = "iphlpapi")]
extern "system" {
    fn FreeInterfaceDnsSettings(
        Settings: *mut DNS_INTERFACE_SETTINGS  // DNS_INTERFACE_SETTINGS* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("IPHLPAPI.dll")]
public static extern void FreeInterfaceDnsSettings(IntPtr Settings);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IPHLPAPI_FreeInterfaceDnsSettings' -Namespace Win32 -PassThru
# $api::FreeInterfaceDnsSettings(Settings)
#uselib "IPHLPAPI.dll"
#func global FreeInterfaceDnsSettings "FreeInterfaceDnsSettings" sptr
; FreeInterfaceDnsSettings varptr(Settings)
; Settings : DNS_INTERFACE_SETTINGS* in/out -> "sptr"
出力引数:
#uselib "IPHLPAPI.dll"
#func global FreeInterfaceDnsSettings "FreeInterfaceDnsSettings" var
; FreeInterfaceDnsSettings Settings
; Settings : DNS_INTERFACE_SETTINGS* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void FreeInterfaceDnsSettings(DNS_INTERFACE_SETTINGS* Settings)
#uselib "IPHLPAPI.dll"
#func global FreeInterfaceDnsSettings "FreeInterfaceDnsSettings" var
; FreeInterfaceDnsSettings Settings
; Settings : DNS_INTERFACE_SETTINGS* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	iphlpapi = windows.NewLazySystemDLL("IPHLPAPI.dll")
	procFreeInterfaceDnsSettings = iphlpapi.NewProc("FreeInterfaceDnsSettings")
)

// Settings (DNS_INTERFACE_SETTINGS* in/out)
r1, _, err := procFreeInterfaceDnsSettings.Call(
	uintptr(Settings),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure FreeInterfaceDnsSettings(
  Settings: Pointer   // DNS_INTERFACE_SETTINGS* in/out
); stdcall;
  external 'IPHLPAPI.dll' name 'FreeInterfaceDnsSettings';
result := DllCall("IPHLPAPI\FreeInterfaceDnsSettings"
    , "Ptr", Settings   ; DNS_INTERFACE_SETTINGS* in/out
    , "Int")   ; return: void
●FreeInterfaceDnsSettings(Settings) = DLL("IPHLPAPI.dll", "int FreeInterfaceDnsSettings(void*)")
# 呼び出し: FreeInterfaceDnsSettings(Settings)
# Settings : DNS_INTERFACE_SETTINGS* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。