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

NdfCloseIncident

関数
診断インシデントを閉じて関連リソースを解放する。
DLLNDFAPI.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT NdfCloseIncident(
    void* handle
);

パラメーター

名前方向説明
handlevoid*inout閉じる診断インシデントのハンドルを指定する。

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

NdfCloseIncident = ctypes.windll.ndfapi.NdfCloseIncident
NdfCloseIncident.restype = ctypes.c_int
NdfCloseIncident.argtypes = [
    ctypes.POINTER(None),  # handle : void* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('NDFAPI.dll')
NdfCloseIncident = Fiddle::Function.new(
  lib['NdfCloseIncident'],
  [
    Fiddle::TYPE_VOIDP,  # handle : void* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "ndfapi")]
extern "system" {
    fn NdfCloseIncident(
        handle: *mut ()  // void* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("NDFAPI.dll")]
public static extern int NdfCloseIncident(IntPtr handle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NDFAPI_NdfCloseIncident' -Namespace Win32 -PassThru
# $api::NdfCloseIncident(handle)
#uselib "NDFAPI.dll"
#func global NdfCloseIncident "NdfCloseIncident" sptr
; NdfCloseIncident handle   ; 戻り値は stat
; handle : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "NDFAPI.dll"
#cfunc global NdfCloseIncident "NdfCloseIncident" sptr
; res = NdfCloseIncident(handle)
; handle : void* in/out -> "sptr"
; HRESULT NdfCloseIncident(void* handle)
#uselib "NDFAPI.dll"
#cfunc global NdfCloseIncident "NdfCloseIncident" intptr
; res = NdfCloseIncident(handle)
; handle : void* in/out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ndfapi = windows.NewLazySystemDLL("NDFAPI.dll")
	procNdfCloseIncident = ndfapi.NewProc("NdfCloseIncident")
)

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

extern "ndfapi" fn NdfCloseIncident(
    handle: ?*anyopaque // void* in/out
) callconv(std.os.windows.WINAPI) i32;
proc NdfCloseIncident(
    handle: pointer  # void* in/out
): int32 {.importc: "NdfCloseIncident", stdcall, dynlib: "NDFAPI.dll".}
pragma(lib, "ndfapi");
extern(Windows)
int NdfCloseIncident(
    void* handle   // void* in/out
);
ccall((:NdfCloseIncident, "NDFAPI.dll"), stdcall, Int32,
      (Ptr{Cvoid},),
      handle)
# handle : void* in/out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t NdfCloseIncident(
    void* handle);
]]
local ndfapi = ffi.load("ndfapi")
-- ndfapi.NdfCloseIncident(handle)
-- handle : void* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('NDFAPI.dll');
const NdfCloseIncident = lib.func('__stdcall', 'NdfCloseIncident', 'int32_t', ['void *']);
// NdfCloseIncident(handle)
// handle : void* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("NDFAPI.dll", {
  NdfCloseIncident: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.NdfCloseIncident(handle)
// handle : void* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t NdfCloseIncident(
    void* handle);
C, "NDFAPI.dll");
// $ffi->NdfCloseIncident(handle);
// handle : void* 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 Ndfapi extends StdCallLibrary {
    Ndfapi INSTANCE = Native.load("ndfapi", Ndfapi.class);
    int NdfCloseIncident(
        Pointer handle   // void* in/out
    );
}
@[Link("ndfapi")]
lib LibNDFAPI
  fun NdfCloseIncident = NdfCloseIncident(
    handle : Void*   # void* 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 NdfCloseIncidentNative = Int32 Function(Pointer<Void>);
typedef NdfCloseIncidentDart = int Function(Pointer<Void>);
final NdfCloseIncident = DynamicLibrary.open('NDFAPI.dll')
    .lookupFunction<NdfCloseIncidentNative, NdfCloseIncidentDart>('NdfCloseIncident');
// handle : void* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function NdfCloseIncident(
  handle: Pointer   // void* in/out
): Integer; stdcall;
  external 'NDFAPI.dll' name 'NdfCloseIncident';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "NdfCloseIncident"
  c_NdfCloseIncident :: Ptr () -> IO Int32
-- handle : void* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ndfcloseincident =
  foreign "NdfCloseIncident"
    ((ptr void) @-> returning int32_t)
(* handle : void* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library ndfapi (t "NDFAPI.dll"))
(cffi:use-foreign-library ndfapi)

(cffi:defcfun ("NdfCloseIncident" ndf-close-incident :convention :stdcall) :int32
  (handle :pointer))   ; void* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $NdfCloseIncident = Win32::API::More->new('NDFAPI',
    'int NdfCloseIncident(LPVOID handle)');
# my $ret = $NdfCloseIncident->Call($handle);
# handle : void* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。