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

DnsServiceFreeInstance

関数
DNS-SDサービスインスタンス構造体のメモリを解放する。
DLLDNSAPI.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

void DnsServiceFreeInstance(
    DNS_SERVICE_INSTANCE* pInstance
);

パラメーター

名前方向
pInstanceDNS_SERVICE_INSTANCE*in

戻り値の型: void

各言語での呼び出し定義

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

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

DnsServiceFreeInstance = ctypes.windll.dnsapi.DnsServiceFreeInstance
DnsServiceFreeInstance.restype = None
DnsServiceFreeInstance.argtypes = [
    ctypes.c_void_p,  # pInstance : DNS_SERVICE_INSTANCE*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	dnsapi = windows.NewLazySystemDLL("DNSAPI.dll")
	procDnsServiceFreeInstance = dnsapi.NewProc("DnsServiceFreeInstance")
)

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