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