ホーム › NetworkManagement.Dns › DnsStopMulticastQuery
DnsStopMulticastQuery
関数実行中のマルチキャストDNS問い合わせを停止する。
シグネチャ
// DNSAPI.dll
#include <windows.h>
INT DnsStopMulticastQuery(
MDNS_QUERY_HANDLE* pHandle
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pHandle | MDNS_QUERY_HANDLE* | inout | 停止対象のマルチキャスト問い合わせを指すMDNS_QUERY_HANDLEへのポインタ。 |
戻り値の型: INT
各言語での呼び出し定義
// DNSAPI.dll
#include <windows.h>
INT DnsStopMulticastQuery(
MDNS_QUERY_HANDLE* pHandle
);[DllImport("DNSAPI.dll", SetLastError = true, ExactSpelling = true)]
static extern int DnsStopMulticastQuery(
IntPtr pHandle // MDNS_QUERY_HANDLE* in/out
);<DllImport("DNSAPI.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function DnsStopMulticastQuery(
pHandle As IntPtr ' MDNS_QUERY_HANDLE* in/out
) As Integer
End Function' pHandle : MDNS_QUERY_HANDLE* in/out
Declare PtrSafe Function DnsStopMulticastQuery Lib "dnsapi" ( _
ByVal pHandle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DnsStopMulticastQuery = ctypes.windll.dnsapi.DnsStopMulticastQuery
DnsStopMulticastQuery.restype = ctypes.c_int
DnsStopMulticastQuery.argtypes = [
ctypes.c_void_p, # pHandle : MDNS_QUERY_HANDLE* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('DNSAPI.dll')
DnsStopMulticastQuery = Fiddle::Function.new(
lib['DnsStopMulticastQuery'],
[
Fiddle::TYPE_VOIDP, # pHandle : MDNS_QUERY_HANDLE* in/out
],
Fiddle::TYPE_INT)#[link(name = "dnsapi")]
extern "system" {
fn DnsStopMulticastQuery(
pHandle: *mut MDNS_QUERY_HANDLE // MDNS_QUERY_HANDLE* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("DNSAPI.dll", SetLastError = true)]
public static extern int DnsStopMulticastQuery(IntPtr pHandle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DNSAPI_DnsStopMulticastQuery' -Namespace Win32 -PassThru
# $api::DnsStopMulticastQuery(pHandle)#uselib "DNSAPI.dll"
#func global DnsStopMulticastQuery "DnsStopMulticastQuery" sptr
; DnsStopMulticastQuery varptr(pHandle) ; 戻り値は stat
; pHandle : MDNS_QUERY_HANDLE* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "DNSAPI.dll" #cfunc global DnsStopMulticastQuery "DnsStopMulticastQuery" var ; res = DnsStopMulticastQuery(pHandle) ; pHandle : MDNS_QUERY_HANDLE* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "DNSAPI.dll" #cfunc global DnsStopMulticastQuery "DnsStopMulticastQuery" sptr ; res = DnsStopMulticastQuery(varptr(pHandle)) ; pHandle : MDNS_QUERY_HANDLE* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT DnsStopMulticastQuery(MDNS_QUERY_HANDLE* pHandle) #uselib "DNSAPI.dll" #cfunc global DnsStopMulticastQuery "DnsStopMulticastQuery" var ; res = DnsStopMulticastQuery(pHandle) ; pHandle : MDNS_QUERY_HANDLE* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT DnsStopMulticastQuery(MDNS_QUERY_HANDLE* pHandle) #uselib "DNSAPI.dll" #cfunc global DnsStopMulticastQuery "DnsStopMulticastQuery" intptr ; res = DnsStopMulticastQuery(varptr(pHandle)) ; pHandle : MDNS_QUERY_HANDLE* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dnsapi = windows.NewLazySystemDLL("DNSAPI.dll")
procDnsStopMulticastQuery = dnsapi.NewProc("DnsStopMulticastQuery")
)
// pHandle (MDNS_QUERY_HANDLE* in/out)
r1, _, err := procDnsStopMulticastQuery.Call(
uintptr(pHandle),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction DnsStopMulticastQuery(
pHandle: Pointer // MDNS_QUERY_HANDLE* in/out
): Integer; stdcall;
external 'DNSAPI.dll' name 'DnsStopMulticastQuery';result := DllCall("DNSAPI\DnsStopMulticastQuery"
, "Ptr", pHandle ; MDNS_QUERY_HANDLE* in/out
, "Int") ; return: INT●DnsStopMulticastQuery(pHandle) = DLL("DNSAPI.dll", "int DnsStopMulticastQuery(void*)")
# 呼び出し: DnsStopMulticastQuery(pHandle)
# pHandle : MDNS_QUERY_HANDLE* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "dnsapi" fn DnsStopMulticastQuery(
pHandle: [*c]MDNS_QUERY_HANDLE // MDNS_QUERY_HANDLE* in/out
) callconv(std.os.windows.WINAPI) i32;proc DnsStopMulticastQuery(
pHandle: ptr MDNS_QUERY_HANDLE # MDNS_QUERY_HANDLE* in/out
): int32 {.importc: "DnsStopMulticastQuery", stdcall, dynlib: "DNSAPI.dll".}pragma(lib, "dnsapi");
extern(Windows)
int DnsStopMulticastQuery(
MDNS_QUERY_HANDLE* pHandle // MDNS_QUERY_HANDLE* in/out
);ccall((:DnsStopMulticastQuery, "DNSAPI.dll"), stdcall, Int32,
(Ptr{MDNS_QUERY_HANDLE},),
pHandle)
# pHandle : MDNS_QUERY_HANDLE* in/out -> Ptr{MDNS_QUERY_HANDLE}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DnsStopMulticastQuery(
void* pHandle);
]]
local dnsapi = ffi.load("dnsapi")
-- dnsapi.DnsStopMulticastQuery(pHandle)
-- pHandle : MDNS_QUERY_HANDLE* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('DNSAPI.dll');
const DnsStopMulticastQuery = lib.func('__stdcall', 'DnsStopMulticastQuery', 'int32_t', ['void *']);
// DnsStopMulticastQuery(pHandle)
// pHandle : MDNS_QUERY_HANDLE* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("DNSAPI.dll", {
DnsStopMulticastQuery: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.DnsStopMulticastQuery(pHandle)
// pHandle : MDNS_QUERY_HANDLE* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DnsStopMulticastQuery(
void* pHandle);
C, "DNSAPI.dll");
// $ffi->DnsStopMulticastQuery(pHandle);
// pHandle : MDNS_QUERY_HANDLE* in/out
// 構造体/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 DnsStopMulticastQuery(
Pointer pHandle // MDNS_QUERY_HANDLE* in/out
);
}@[Link("dnsapi")]
lib LibDNSAPI
fun DnsStopMulticastQuery = DnsStopMulticastQuery(
pHandle : MDNS_QUERY_HANDLE* # MDNS_QUERY_HANDLE* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DnsStopMulticastQueryNative = Int32 Function(Pointer<Void>);
typedef DnsStopMulticastQueryDart = int Function(Pointer<Void>);
final DnsStopMulticastQuery = DynamicLibrary.open('DNSAPI.dll')
.lookupFunction<DnsStopMulticastQueryNative, DnsStopMulticastQueryDart>('DnsStopMulticastQuery');
// pHandle : MDNS_QUERY_HANDLE* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DnsStopMulticastQuery(
pHandle: Pointer // MDNS_QUERY_HANDLE* in/out
): Integer; stdcall;
external 'DNSAPI.dll' name 'DnsStopMulticastQuery';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DnsStopMulticastQuery"
c_DnsStopMulticastQuery :: Ptr () -> IO Int32
-- pHandle : MDNS_QUERY_HANDLE* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let dnsstopmulticastquery =
foreign "DnsStopMulticastQuery"
((ptr void) @-> returning int32_t)
(* pHandle : MDNS_QUERY_HANDLE* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library dnsapi (t "DNSAPI.dll"))
(cffi:use-foreign-library dnsapi)
(cffi:defcfun ("DnsStopMulticastQuery" dns-stop-multicast-query :convention :stdcall) :int32
(p-handle :pointer)) ; MDNS_QUERY_HANDLE* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DnsStopMulticastQuery = Win32::API::More->new('DNSAPI',
'int DnsStopMulticastQuery(LPVOID pHandle)');
# my $ret = $DnsStopMulticastQuery->Call($pHandle);
# pHandle : MDNS_QUERY_HANDLE* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型