Win32 API 日本語リファレンス
ホームStorage.InstallableFileSystems › FilterClose

FilterClose

関数
ミニフィルターの通信ポートハンドルを閉じる。
DLLFLTLIB.dll呼出規約winapi

シグネチャ

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

HRESULT FilterClose(
    HFILTER hFilter
);

パラメーター

名前方向説明
hFilterHFILTERin閉じるフィルターハンドル。FilterCreateで取得したもの。

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

FilterClose = ctypes.windll.fltlib.FilterClose
FilterClose.restype = ctypes.c_int
FilterClose.argtypes = [
    ctypes.c_ssize_t,  # hFilter : HFILTER
]
require 'fiddle'
require 'fiddle/import'

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

var (
	fltlib = windows.NewLazySystemDLL("FLTLIB.dll")
	procFilterClose = fltlib.NewProc("FilterClose")
)

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

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

typedef FilterCloseNative = Int32 Function(IntPtr);
typedef FilterCloseDart = int Function(int);
final FilterClose = DynamicLibrary.open('FLTLIB.dll')
    .lookupFunction<FilterCloseNative, FilterCloseDart>('FilterClose');
// hFilter : HFILTER -> IntPtr
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function FilterClose(
  hFilter: NativeInt   // HFILTER
): Integer; stdcall;
  external 'FLTLIB.dll' name 'FilterClose';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "FilterClose"
  c_FilterClose :: CIntPtr -> IO Int32
-- hFilter : HFILTER -> CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let filterclose =
  foreign "FilterClose"
    (intptr_t @-> returning int32_t)
(* hFilter : HFILTER -> intptr_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library fltlib (t "FLTLIB.dll"))
(cffi:use-foreign-library fltlib)

(cffi:defcfun ("FilterClose" filter-close :convention :stdcall) :int32
  (h-filter :int64))   ; HFILTER
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $FilterClose = Win32::API::More->new('FLTLIB',
    'int FilterClose(LPARAM hFilter)');
# my $ret = $FilterClose->Call($hFilter);
# hFilter : HFILTER -> LPARAM
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。