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

DnsServiceRegisterCancel

関数
実行中のDNS-SDサービス登録操作をキャンセルする。
DLLDNSAPI.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

DWORD DnsServiceRegisterCancel(
    DNS_SERVICE_CANCEL* pCancelHandle
);

パラメーター

名前方向
pCancelHandleDNS_SERVICE_CANCEL*in

戻り値の型: DWORD

各言語での呼び出し定義

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

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

DnsServiceRegisterCancel = ctypes.windll.dnsapi.DnsServiceRegisterCancel
DnsServiceRegisterCancel.restype = wintypes.DWORD
DnsServiceRegisterCancel.argtypes = [
    ctypes.c_void_p,  # pCancelHandle : DNS_SERVICE_CANCEL*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('DNSAPI.dll')
DnsServiceRegisterCancel = Fiddle::Function.new(
  lib['DnsServiceRegisterCancel'],
  [
    Fiddle::TYPE_VOIDP,  # pCancelHandle : DNS_SERVICE_CANCEL*
  ],
  -Fiddle::TYPE_INT)
#[link(name = "dnsapi")]
extern "system" {
    fn DnsServiceRegisterCancel(
        pCancelHandle: *mut DNS_SERVICE_CANCEL  // DNS_SERVICE_CANCEL*
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("DNSAPI.dll")]
public static extern uint DnsServiceRegisterCancel(IntPtr pCancelHandle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DNSAPI_DnsServiceRegisterCancel' -Namespace Win32 -PassThru
# $api::DnsServiceRegisterCancel(pCancelHandle)
#uselib "DNSAPI.dll"
#func global DnsServiceRegisterCancel "DnsServiceRegisterCancel" sptr
; DnsServiceRegisterCancel varptr(pCancelHandle)   ; 戻り値は stat
; pCancelHandle : DNS_SERVICE_CANCEL* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "DNSAPI.dll"
#cfunc global DnsServiceRegisterCancel "DnsServiceRegisterCancel" var
; res = DnsServiceRegisterCancel(pCancelHandle)
; pCancelHandle : DNS_SERVICE_CANCEL* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD DnsServiceRegisterCancel(DNS_SERVICE_CANCEL* pCancelHandle)
#uselib "DNSAPI.dll"
#cfunc global DnsServiceRegisterCancel "DnsServiceRegisterCancel" var
; res = DnsServiceRegisterCancel(pCancelHandle)
; pCancelHandle : DNS_SERVICE_CANCEL* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dnsapi = windows.NewLazySystemDLL("DNSAPI.dll")
	procDnsServiceRegisterCancel = dnsapi.NewProc("DnsServiceRegisterCancel")
)

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