ホーム › NetworkManagement.NetworkDiagnosticsFramework › NdfCreateDNSIncident
NdfCreateDNSIncident
関数DNS名前解決に関する診断インシデントを作成する。
シグネチャ
// NDFAPI.dll
#include <windows.h>
HRESULT NdfCreateDNSIncident(
LPCWSTR hostname,
WORD queryType,
void** handle
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hostname | LPCWSTR | in |
| queryType | WORD | in |
| handle | void** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// NDFAPI.dll
#include <windows.h>
HRESULT NdfCreateDNSIncident(
LPCWSTR hostname,
WORD queryType,
void** handle
);[DllImport("NDFAPI.dll", ExactSpelling = true)]
static extern int NdfCreateDNSIncident(
[MarshalAs(UnmanagedType.LPWStr)] string hostname, // LPCWSTR
ushort queryType, // WORD
IntPtr handle // void** out
);<DllImport("NDFAPI.dll", ExactSpelling:=True)>
Public Shared Function NdfCreateDNSIncident(
<MarshalAs(UnmanagedType.LPWStr)> hostname As String, ' LPCWSTR
queryType As UShort, ' WORD
handle As IntPtr ' void** out
) As Integer
End Function' hostname : LPCWSTR
' queryType : WORD
' handle : void** out
Declare PtrSafe Function NdfCreateDNSIncident Lib "ndfapi" ( _
ByVal hostname As LongPtr, _
ByVal queryType As Integer, _
ByVal handle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
NdfCreateDNSIncident = ctypes.windll.ndfapi.NdfCreateDNSIncident
NdfCreateDNSIncident.restype = ctypes.c_int
NdfCreateDNSIncident.argtypes = [
wintypes.LPCWSTR, # hostname : LPCWSTR
ctypes.c_ushort, # queryType : WORD
ctypes.c_void_p, # handle : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('NDFAPI.dll')
NdfCreateDNSIncident = Fiddle::Function.new(
lib['NdfCreateDNSIncident'],
[
Fiddle::TYPE_VOIDP, # hostname : LPCWSTR
-Fiddle::TYPE_SHORT, # queryType : WORD
Fiddle::TYPE_VOIDP, # handle : void** out
],
Fiddle::TYPE_INT)#[link(name = "ndfapi")]
extern "system" {
fn NdfCreateDNSIncident(
hostname: *const u16, // LPCWSTR
queryType: u16, // WORD
handle: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("NDFAPI.dll")]
public static extern int NdfCreateDNSIncident([MarshalAs(UnmanagedType.LPWStr)] string hostname, ushort queryType, IntPtr handle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NDFAPI_NdfCreateDNSIncident' -Namespace Win32 -PassThru
# $api::NdfCreateDNSIncident(hostname, queryType, handle)#uselib "NDFAPI.dll"
#func global NdfCreateDNSIncident "NdfCreateDNSIncident" sptr, sptr, sptr
; NdfCreateDNSIncident hostname, queryType, handle ; 戻り値は stat
; hostname : LPCWSTR -> "sptr"
; queryType : WORD -> "sptr"
; handle : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "NDFAPI.dll"
#cfunc global NdfCreateDNSIncident "NdfCreateDNSIncident" wstr, int, sptr
; res = NdfCreateDNSIncident(hostname, queryType, handle)
; hostname : LPCWSTR -> "wstr"
; queryType : WORD -> "int"
; handle : void** out -> "sptr"; HRESULT NdfCreateDNSIncident(LPCWSTR hostname, WORD queryType, void** handle)
#uselib "NDFAPI.dll"
#cfunc global NdfCreateDNSIncident "NdfCreateDNSIncident" wstr, int, intptr
; res = NdfCreateDNSIncident(hostname, queryType, handle)
; hostname : LPCWSTR -> "wstr"
; queryType : WORD -> "int"
; handle : void** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ndfapi = windows.NewLazySystemDLL("NDFAPI.dll")
procNdfCreateDNSIncident = ndfapi.NewProc("NdfCreateDNSIncident")
)
// hostname (LPCWSTR), queryType (WORD), handle (void** out)
r1, _, err := procNdfCreateDNSIncident.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(hostname))),
uintptr(queryType),
uintptr(handle),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction NdfCreateDNSIncident(
hostname: PWideChar; // LPCWSTR
queryType: Word; // WORD
handle: Pointer // void** out
): Integer; stdcall;
external 'NDFAPI.dll' name 'NdfCreateDNSIncident';result := DllCall("NDFAPI\NdfCreateDNSIncident"
, "WStr", hostname ; LPCWSTR
, "UShort", queryType ; WORD
, "Ptr", handle ; void** out
, "Int") ; return: HRESULT●NdfCreateDNSIncident(hostname, queryType, handle) = DLL("NDFAPI.dll", "int NdfCreateDNSIncident(char*, int, void*)")
# 呼び出し: NdfCreateDNSIncident(hostname, queryType, handle)
# hostname : LPCWSTR -> "char*"
# queryType : WORD -> "int"
# handle : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。