ホーム › NetworkManagement.Dns › DnsServiceCopyInstance
DnsServiceCopyInstance
関数DNS-SDサービスインスタンス構造体を複製する。
シグネチャ
// DNSAPI.dll
#include <windows.h>
DNS_SERVICE_INSTANCE* DnsServiceCopyInstance(
DNS_SERVICE_INSTANCE* pOrig
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pOrig | DNS_SERVICE_INSTANCE* | in |
戻り値の型: DNS_SERVICE_INSTANCE*
各言語での呼び出し定義
// DNSAPI.dll
#include <windows.h>
DNS_SERVICE_INSTANCE* DnsServiceCopyInstance(
DNS_SERVICE_INSTANCE* pOrig
);[DllImport("DNSAPI.dll", ExactSpelling = true)]
static extern IntPtr DnsServiceCopyInstance(
IntPtr pOrig // DNS_SERVICE_INSTANCE*
);<DllImport("DNSAPI.dll", ExactSpelling:=True)>
Public Shared Function DnsServiceCopyInstance(
pOrig As IntPtr ' DNS_SERVICE_INSTANCE*
) As IntPtr
End Function' pOrig : DNS_SERVICE_INSTANCE*
Declare PtrSafe Function DnsServiceCopyInstance Lib "dnsapi" ( _
ByVal pOrig As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DnsServiceCopyInstance = ctypes.windll.dnsapi.DnsServiceCopyInstance
DnsServiceCopyInstance.restype = ctypes.c_void_p
DnsServiceCopyInstance.argtypes = [
ctypes.c_void_p, # pOrig : DNS_SERVICE_INSTANCE*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('DNSAPI.dll')
DnsServiceCopyInstance = Fiddle::Function.new(
lib['DnsServiceCopyInstance'],
[
Fiddle::TYPE_VOIDP, # pOrig : DNS_SERVICE_INSTANCE*
],
Fiddle::TYPE_VOIDP)#[link(name = "dnsapi")]
extern "system" {
fn DnsServiceCopyInstance(
pOrig: *mut DNS_SERVICE_INSTANCE // DNS_SERVICE_INSTANCE*
) -> *mut DNS_SERVICE_INSTANCE;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("DNSAPI.dll")]
public static extern IntPtr DnsServiceCopyInstance(IntPtr pOrig);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DNSAPI_DnsServiceCopyInstance' -Namespace Win32 -PassThru
# $api::DnsServiceCopyInstance(pOrig)#uselib "DNSAPI.dll"
#func global DnsServiceCopyInstance "DnsServiceCopyInstance" sptr
; DnsServiceCopyInstance varptr(pOrig) ; 戻り値は stat
; pOrig : DNS_SERVICE_INSTANCE* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "DNSAPI.dll" #cfunc global DnsServiceCopyInstance "DnsServiceCopyInstance" var ; res = DnsServiceCopyInstance(pOrig) ; pOrig : DNS_SERVICE_INSTANCE* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "DNSAPI.dll" #cfunc global DnsServiceCopyInstance "DnsServiceCopyInstance" sptr ; res = DnsServiceCopyInstance(varptr(pOrig)) ; pOrig : DNS_SERVICE_INSTANCE* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DNS_SERVICE_INSTANCE* DnsServiceCopyInstance(DNS_SERVICE_INSTANCE* pOrig) #uselib "DNSAPI.dll" #cfunc global DnsServiceCopyInstance "DnsServiceCopyInstance" var ; res = DnsServiceCopyInstance(pOrig) ; pOrig : DNS_SERVICE_INSTANCE* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DNS_SERVICE_INSTANCE* DnsServiceCopyInstance(DNS_SERVICE_INSTANCE* pOrig) #uselib "DNSAPI.dll" #cfunc global DnsServiceCopyInstance "DnsServiceCopyInstance" intptr ; res = DnsServiceCopyInstance(varptr(pOrig)) ; pOrig : DNS_SERVICE_INSTANCE* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dnsapi = windows.NewLazySystemDLL("DNSAPI.dll")
procDnsServiceCopyInstance = dnsapi.NewProc("DnsServiceCopyInstance")
)
// pOrig (DNS_SERVICE_INSTANCE*)
r1, _, err := procDnsServiceCopyInstance.Call(
uintptr(pOrig),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DNS_SERVICE_INSTANCE*function DnsServiceCopyInstance(
pOrig: Pointer // DNS_SERVICE_INSTANCE*
): Pointer; stdcall;
external 'DNSAPI.dll' name 'DnsServiceCopyInstance';result := DllCall("DNSAPI\DnsServiceCopyInstance"
, "Ptr", pOrig ; DNS_SERVICE_INSTANCE*
, "Ptr") ; return: DNS_SERVICE_INSTANCE*●DnsServiceCopyInstance(pOrig) = DLL("DNSAPI.dll", "void* DnsServiceCopyInstance(void*)")
# 呼び出し: DnsServiceCopyInstance(pOrig)
# pOrig : DNS_SERVICE_INSTANCE* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。