ホーム › NetworkManagement.Dns › DnsServiceFreeInstance
DnsServiceFreeInstance
関数DNS-SDサービスインスタンス構造体のメモリを解放する。
シグネチャ
// DNSAPI.dll
#include <windows.h>
void DnsServiceFreeInstance(
DNS_SERVICE_INSTANCE* pInstance
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pInstance | DNS_SERVICE_INSTANCE* | in | 解放対象のDNS_SERVICE_INSTANCE構造体へのポインタ。 |
戻り値の型: 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 方式にも切替可。#uselib "DNSAPI.dll" #func global DnsServiceFreeInstance "DnsServiceFreeInstance" sptr ; DnsServiceFreeInstance varptr(pInstance) ; pInstance : DNS_SERVICE_INSTANCE* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void DnsServiceFreeInstance(DNS_SERVICE_INSTANCE* pInstance) #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" intptr ; DnsServiceFreeInstance varptr(pInstance) ; pInstance : DNS_SERVICE_INSTANCE* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // voidprocedure 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)。const std = @import("std");
extern "dnsapi" fn DnsServiceFreeInstance(
pInstance: [*c]DNS_SERVICE_INSTANCE // DNS_SERVICE_INSTANCE*
) callconv(std.os.windows.WINAPI) void;proc DnsServiceFreeInstance(
pInstance: ptr DNS_SERVICE_INSTANCE # DNS_SERVICE_INSTANCE*
) {.importc: "DnsServiceFreeInstance", stdcall, dynlib: "DNSAPI.dll".}pragma(lib, "dnsapi");
extern(Windows)
void DnsServiceFreeInstance(
DNS_SERVICE_INSTANCE* pInstance // DNS_SERVICE_INSTANCE*
);ccall((:DnsServiceFreeInstance, "DNSAPI.dll"), stdcall, Cvoid,
(Ptr{DNS_SERVICE_INSTANCE},),
pInstance)
# pInstance : DNS_SERVICE_INSTANCE* -> Ptr{DNS_SERVICE_INSTANCE}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void DnsServiceFreeInstance(
void* pInstance);
]]
local dnsapi = ffi.load("dnsapi")
-- dnsapi.DnsServiceFreeInstance(pInstance)
-- pInstance : DNS_SERVICE_INSTANCE*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('DNSAPI.dll');
const DnsServiceFreeInstance = lib.func('__stdcall', 'DnsServiceFreeInstance', 'void', ['void *']);
// DnsServiceFreeInstance(pInstance)
// pInstance : DNS_SERVICE_INSTANCE* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("DNSAPI.dll", {
DnsServiceFreeInstance: { parameters: ["pointer"], result: "void" },
});
// lib.symbols.DnsServiceFreeInstance(pInstance)
// pInstance : DNS_SERVICE_INSTANCE* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void DnsServiceFreeInstance(
void* pInstance);
C, "DNSAPI.dll");
// $ffi->DnsServiceFreeInstance(pInstance);
// pInstance : DNS_SERVICE_INSTANCE*
// 構造体/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 Dnsapi extends StdCallLibrary {
Dnsapi INSTANCE = Native.load("dnsapi", Dnsapi.class);
void DnsServiceFreeInstance(
Pointer pInstance // DNS_SERVICE_INSTANCE*
);
}@[Link("dnsapi")]
lib LibDNSAPI
fun DnsServiceFreeInstance = DnsServiceFreeInstance(
pInstance : DNS_SERVICE_INSTANCE* # DNS_SERVICE_INSTANCE*
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DnsServiceFreeInstanceNative = Void Function(Pointer<Void>);
typedef DnsServiceFreeInstanceDart = void Function(Pointer<Void>);
final DnsServiceFreeInstance = DynamicLibrary.open('DNSAPI.dll')
.lookupFunction<DnsServiceFreeInstanceNative, DnsServiceFreeInstanceDart>('DnsServiceFreeInstance');
// pInstance : DNS_SERVICE_INSTANCE* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure DnsServiceFreeInstance(
pInstance: Pointer // DNS_SERVICE_INSTANCE*
); stdcall;
external 'DNSAPI.dll' name 'DnsServiceFreeInstance';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DnsServiceFreeInstance"
c_DnsServiceFreeInstance :: Ptr () -> IO ()
-- pInstance : DNS_SERVICE_INSTANCE* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let dnsservicefreeinstance =
foreign "DnsServiceFreeInstance"
((ptr void) @-> returning void)
(* pInstance : DNS_SERVICE_INSTANCE* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library dnsapi (t "DNSAPI.dll"))
(cffi:use-foreign-library dnsapi)
(cffi:defcfun ("DnsServiceFreeInstance" dns-service-free-instance :convention :stdcall) :void
(p-instance :pointer)) ; DNS_SERVICE_INSTANCE*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DnsServiceFreeInstance = Win32::API::More->new('DNSAPI',
'void DnsServiceFreeInstance(LPVOID pInstance)');
# my $ret = $DnsServiceFreeInstance->Call($pInstance);
# pInstance : DNS_SERVICE_INSTANCE* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。