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

DnsQueryRawResultFree

関数
DnsQueryRawの結果に割り当てられたメモリを解放する。
DLLDNSAPI.dll呼出規約winapi

シグネチャ

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

void DnsQueryRawResultFree(
    DNS_QUERY_RAW_RESULT* queryResults   // optional
);

パラメーター

名前方向説明
queryResultsDNS_QUERY_RAW_RESULT*inoptional解放対象のDnsQueryRaw結果を格納したDNS_QUERY_RAW_RESULT構造体へのポインタ。

戻り値の型: void

各言語での呼び出し定義

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

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

DnsQueryRawResultFree = ctypes.windll.dnsapi.DnsQueryRawResultFree
DnsQueryRawResultFree.restype = None
DnsQueryRawResultFree.argtypes = [
    ctypes.c_void_p,  # queryResults : DNS_QUERY_RAW_RESULT* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('DNSAPI.dll')
DnsQueryRawResultFree = Fiddle::Function.new(
  lib['DnsQueryRawResultFree'],
  [
    Fiddle::TYPE_VOIDP,  # queryResults : DNS_QUERY_RAW_RESULT* optional
  ],
  Fiddle::TYPE_VOID)
#[link(name = "dnsapi")]
extern "system" {
    fn DnsQueryRawResultFree(
        queryResults: *mut DNS_QUERY_RAW_RESULT  // DNS_QUERY_RAW_RESULT* optional
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("DNSAPI.dll")]
public static extern void DnsQueryRawResultFree(IntPtr queryResults);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DNSAPI_DnsQueryRawResultFree' -Namespace Win32 -PassThru
# $api::DnsQueryRawResultFree(queryResults)
#uselib "DNSAPI.dll"
#func global DnsQueryRawResultFree "DnsQueryRawResultFree" sptr
; DnsQueryRawResultFree varptr(queryResults)
; queryResults : DNS_QUERY_RAW_RESULT* optional -> "sptr"
出力引数:
#uselib "DNSAPI.dll"
#func global DnsQueryRawResultFree "DnsQueryRawResultFree" var
; DnsQueryRawResultFree queryResults
; queryResults : DNS_QUERY_RAW_RESULT* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void DnsQueryRawResultFree(DNS_QUERY_RAW_RESULT* queryResults)
#uselib "DNSAPI.dll"
#func global DnsQueryRawResultFree "DnsQueryRawResultFree" var
; DnsQueryRawResultFree queryResults
; queryResults : DNS_QUERY_RAW_RESULT* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dnsapi = windows.NewLazySystemDLL("DNSAPI.dll")
	procDnsQueryRawResultFree = dnsapi.NewProc("DnsQueryRawResultFree")
)

// queryResults (DNS_QUERY_RAW_RESULT* optional)
r1, _, err := procDnsQueryRawResultFree.Call(
	uintptr(queryResults),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure DnsQueryRawResultFree(
  queryResults: Pointer   // DNS_QUERY_RAW_RESULT* optional
); stdcall;
  external 'DNSAPI.dll' name 'DnsQueryRawResultFree';
result := DllCall("DNSAPI\DnsQueryRawResultFree"
    , "Ptr", queryResults   ; DNS_QUERY_RAW_RESULT* optional
    , "Int")   ; return: void
●DnsQueryRawResultFree(queryResults) = DLL("DNSAPI.dll", "int DnsQueryRawResultFree(void*)")
# 呼び出し: DnsQueryRawResultFree(queryResults)
# queryResults : DNS_QUERY_RAW_RESULT* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "dnsapi" fn DnsQueryRawResultFree(
    queryResults: [*c]DNS_QUERY_RAW_RESULT // DNS_QUERY_RAW_RESULT* optional
) callconv(std.os.windows.WINAPI) void;
proc DnsQueryRawResultFree(
    queryResults: ptr DNS_QUERY_RAW_RESULT  # DNS_QUERY_RAW_RESULT* optional
) {.importc: "DnsQueryRawResultFree", stdcall, dynlib: "DNSAPI.dll".}
pragma(lib, "dnsapi");
extern(Windows)
void DnsQueryRawResultFree(
    DNS_QUERY_RAW_RESULT* queryResults   // DNS_QUERY_RAW_RESULT* optional
);
ccall((:DnsQueryRawResultFree, "DNSAPI.dll"), stdcall, Cvoid,
      (Ptr{DNS_QUERY_RAW_RESULT},),
      queryResults)
# queryResults : DNS_QUERY_RAW_RESULT* optional -> Ptr{DNS_QUERY_RAW_RESULT}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void DnsQueryRawResultFree(
    void* queryResults);
]]
local dnsapi = ffi.load("dnsapi")
-- dnsapi.DnsQueryRawResultFree(queryResults)
-- queryResults : DNS_QUERY_RAW_RESULT* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('DNSAPI.dll');
const DnsQueryRawResultFree = lib.func('__stdcall', 'DnsQueryRawResultFree', 'void', ['void *']);
// DnsQueryRawResultFree(queryResults)
// queryResults : DNS_QUERY_RAW_RESULT* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("DNSAPI.dll", {
  DnsQueryRawResultFree: { parameters: ["pointer"], result: "void" },
});
// lib.symbols.DnsQueryRawResultFree(queryResults)
// queryResults : DNS_QUERY_RAW_RESULT* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void DnsQueryRawResultFree(
    void* queryResults);
C, "DNSAPI.dll");
// $ffi->DnsQueryRawResultFree(queryResults);
// queryResults : DNS_QUERY_RAW_RESULT* optional
// 構造体/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 DnsQueryRawResultFree(
        Pointer queryResults   // DNS_QUERY_RAW_RESULT* optional
    );
}
@[Link("dnsapi")]
lib LibDNSAPI
  fun DnsQueryRawResultFree = DnsQueryRawResultFree(
    queryResults : DNS_QUERY_RAW_RESULT*   # DNS_QUERY_RAW_RESULT* optional
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef DnsQueryRawResultFreeNative = Void Function(Pointer<Void>);
typedef DnsQueryRawResultFreeDart = void Function(Pointer<Void>);
final DnsQueryRawResultFree = DynamicLibrary.open('DNSAPI.dll')
    .lookupFunction<DnsQueryRawResultFreeNative, DnsQueryRawResultFreeDart>('DnsQueryRawResultFree');
// queryResults : DNS_QUERY_RAW_RESULT* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure DnsQueryRawResultFree(
  queryResults: Pointer   // DNS_QUERY_RAW_RESULT* optional
); stdcall;
  external 'DNSAPI.dll' name 'DnsQueryRawResultFree';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "DnsQueryRawResultFree"
  c_DnsQueryRawResultFree :: Ptr () -> IO ()
-- queryResults : DNS_QUERY_RAW_RESULT* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let dnsqueryrawresultfree =
  foreign "DnsQueryRawResultFree"
    ((ptr void) @-> returning void)
(* queryResults : DNS_QUERY_RAW_RESULT* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library dnsapi (t "DNSAPI.dll"))
(cffi:use-foreign-library dnsapi)

(cffi:defcfun ("DnsQueryRawResultFree" dns-query-raw-result-free :convention :stdcall) :void
  (query-results :pointer))   ; DNS_QUERY_RAW_RESULT* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $DnsQueryRawResultFree = Win32::API::More->new('DNSAPI',
    'void DnsQueryRawResultFree(LPVOID queryResults)');
# my $ret = $DnsQueryRawResultFree->Call($queryResults);
# queryResults : DNS_QUERY_RAW_RESULT* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型