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

NdfCreateNetConnectionIncident

関数
ネットワーク接続に関する診断インシデントを作成する。
DLLNDFAPI.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

HRESULT NdfCreateNetConnectionIncident(
    void** handle,
    GUID id
);

パラメーター

名前方向
handlevoid**out
idGUIDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT NdfCreateNetConnectionIncident(
    void** handle,
    GUID id
);
[DllImport("NDFAPI.dll", ExactSpelling = true)]
static extern int NdfCreateNetConnectionIncident(
    IntPtr handle,   // void** out
    Guid id   // GUID
);
<DllImport("NDFAPI.dll", ExactSpelling:=True)>
Public Shared Function NdfCreateNetConnectionIncident(
    handle As IntPtr,   ' void** out
    id As Guid   ' GUID
) As Integer
End Function
' handle : void** out
' id : GUID
Declare PtrSafe Function NdfCreateNetConnectionIncident Lib "ndfapi" ( _
    ByVal handle As LongPtr, _
    ByVal id As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

NdfCreateNetConnectionIncident = ctypes.windll.ndfapi.NdfCreateNetConnectionIncident
NdfCreateNetConnectionIncident.restype = ctypes.c_int
NdfCreateNetConnectionIncident.argtypes = [
    ctypes.c_void_p,  # handle : void** out
    ctypes.c_void_p,  # id : GUID
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('NDFAPI.dll')
NdfCreateNetConnectionIncident = Fiddle::Function.new(
  lib['NdfCreateNetConnectionIncident'],
  [
    Fiddle::TYPE_VOIDP,  # handle : void** out
    Fiddle::TYPE_VOIDP,  # id : GUID
  ],
  Fiddle::TYPE_INT)
#[link(name = "ndfapi")]
extern "system" {
    fn NdfCreateNetConnectionIncident(
        handle: *mut *mut (),  // void** out
        id: GUID  // GUID
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("NDFAPI.dll")]
public static extern int NdfCreateNetConnectionIncident(IntPtr handle, Guid id);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NDFAPI_NdfCreateNetConnectionIncident' -Namespace Win32 -PassThru
# $api::NdfCreateNetConnectionIncident(handle, id)
#uselib "NDFAPI.dll"
#func global NdfCreateNetConnectionIncident "NdfCreateNetConnectionIncident" sptr, sptr
; NdfCreateNetConnectionIncident handle, id   ; 戻り値は stat
; handle : void** out -> "sptr"
; id : GUID -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "NDFAPI.dll"
#cfunc global NdfCreateNetConnectionIncident "NdfCreateNetConnectionIncident" sptr, int
; res = NdfCreateNetConnectionIncident(handle, id)
; handle : void** out -> "sptr"
; id : GUID -> "int"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; HRESULT NdfCreateNetConnectionIncident(void** handle, GUID id)
#uselib "NDFAPI.dll"
#cfunc global NdfCreateNetConnectionIncident "NdfCreateNetConnectionIncident" intptr, int
; res = NdfCreateNetConnectionIncident(handle, id)
; handle : void** out -> "intptr"
; id : GUID -> "int"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ndfapi = windows.NewLazySystemDLL("NDFAPI.dll")
	procNdfCreateNetConnectionIncident = ndfapi.NewProc("NdfCreateNetConnectionIncident")
)

// handle (void** out), id (GUID)
r1, _, err := procNdfCreateNetConnectionIncident.Call(
	uintptr(handle),
	uintptr(id),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function NdfCreateNetConnectionIncident(
  handle: Pointer;   // void** out
  id: TGUID   // GUID
): Integer; stdcall;
  external 'NDFAPI.dll' name 'NdfCreateNetConnectionIncident';
result := DllCall("NDFAPI\NdfCreateNetConnectionIncident"
    , "Ptr", handle   ; void** out
    , "Ptr", id   ; GUID
    , "Int")   ; return: HRESULT
●NdfCreateNetConnectionIncident(handle, id) = DLL("NDFAPI.dll", "int NdfCreateNetConnectionIncident(void*, void*)")
# 呼び出し: NdfCreateNetConnectionIncident(handle, id)
# handle : void** out -> "void*"
# id : GUID -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。