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

FilterGetInformation

関数
指定したファイルシステムフィルターの情報を取得する。
DLLFLTLIB.dll呼出規約winapi

シグネチャ

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

HRESULT FilterGetInformation(
    HFILTER hFilter,
    FILTER_INFORMATION_CLASS dwInformationClass,
    void* lpBuffer,
    DWORD dwBufferSize,
    DWORD* lpBytesReturned
);

パラメーター

名前型方向説明
hFilterHFILTERin以前の FilterCreate 関数の呼び出しによって返されたハンドル。
dwInformationClassFILTER_INFORMATION_CLASSin

要求する情報の種類。このパラメーターは、次のいずれかの値である必要があります。

値 意味
FilterFullInformation ミニフィルターの FILTER_FULL_INFORMATION 構造体を返します。
FilterAggregateBasicInformation ミニフィルターの FILTER_AGGREGATE_BASIC_INFORMATION 構造体を返します。この dwInformationClass の値は、Microsoft Windows Server 2003 with SP1 および フィルターマネージャーのロールアップを適用した Microsoft Windows XP with SP2 以降で使用できます。Windows XP with SP2 用のフィルターマネージャーのロールアップパッケージの詳細については、Microsoft サポート技術情報の記事 914882「 The filter manager rollup package for Windows XP SP2」を参照してください。
FilterAggregateStandardInformation 各ミニフィルターの FILTER_AGGREGATE_STANDARD_INFORMATION 構造体を返します。この構造体の LegacyFilter 部分は使用されません。この dwInformationClass の値は、Windows Vista 以降で使用できます。
lpBuffervoid*out要求された情報を受け取る、呼び出し元が割り当てたバッファーへのポインター。バッファーに返される情報の型は、dwInformationClass パラメーターによって決まります。
dwBufferSizeDWORDinlpBuffer パラメーターが指すバッファーのサイズ (バイト単位)。呼び出し元は、指定する dwInformationClass に応じてこのパラメーターを設定する必要があります。
lpBytesReturnedDWORD*outFilterGetInformation の呼び出しが成功した場合に、lpBuffer が指すバッファーに返されたバイト数を受け取る、呼び出し元が割り当てた変数へのポインター。このパラメーターは必須であり、NULL にすることはできません。

戻り値の型: HRESULT

公式ドキュメント

FilterGetInformation 関数は、ミニフィルターに関するさまざまな種類の情報を返します。

戻り値

FilterGetInformation は、成功すると S_OK を返します。それ以外の場合は、次のような HRESULT エラー値を返します。

戻り値 説明
HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
lpBuffer が指すバッファーが、要求された情報を格納するのに十分な大きさではありません。この値が返された場合、lpBytesReturned には、指定した dwInformationClass の構造体に必要なバッファーのサイズ (バイト単位) が格納されます。
HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)
dwInformationClass パラメーターに無効な値が指定されました。たとえば、Windows Vista より前のオペレーティングシステムで FilterAggregateStandardInformation を指定した場合、FilterGetInformation はこの HRESULT 値を返します。

解説(Remarks)

FilterGetInformation は、FltGetFilterInformation の Win32 版に相当します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

HRESULT FilterGetInformation(
    HFILTER hFilter,
    FILTER_INFORMATION_CLASS dwInformationClass,
    void* lpBuffer,
    DWORD dwBufferSize,
    DWORD* lpBytesReturned
);
[DllImport("FLTLIB.dll", ExactSpelling = true)]
static extern int FilterGetInformation(
    IntPtr hFilter,   // HFILTER
    int dwInformationClass,   // FILTER_INFORMATION_CLASS
    IntPtr lpBuffer,   // void* out
    uint dwBufferSize,   // DWORD
    out uint lpBytesReturned   // DWORD* out
);
<DllImport("FLTLIB.dll", ExactSpelling:=True)>
Public Shared Function FilterGetInformation(
    hFilter As IntPtr,   ' HFILTER
    dwInformationClass As Integer,   ' FILTER_INFORMATION_CLASS
    lpBuffer As IntPtr,   ' void* out
    dwBufferSize As UInteger,   ' DWORD
    <Out> ByRef lpBytesReturned As UInteger   ' DWORD* out
) As Integer
End Function
' hFilter : HFILTER
' dwInformationClass : FILTER_INFORMATION_CLASS
' lpBuffer : void* out
' dwBufferSize : DWORD
' lpBytesReturned : DWORD* out
Declare PtrSafe Function FilterGetInformation Lib "fltlib" ( _
    ByVal hFilter As LongPtr, _
    ByVal dwInformationClass As Long, _
    ByVal lpBuffer As LongPtr, _
    ByVal dwBufferSize As Long, _
    ByRef lpBytesReturned As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

FilterGetInformation = ctypes.windll.fltlib.FilterGetInformation
FilterGetInformation.restype = ctypes.c_int
FilterGetInformation.argtypes = [
    ctypes.c_ssize_t,  # hFilter : HFILTER
    ctypes.c_int,  # dwInformationClass : FILTER_INFORMATION_CLASS
    ctypes.POINTER(None),  # lpBuffer : void* out
    wintypes.DWORD,  # dwBufferSize : DWORD
    ctypes.POINTER(wintypes.DWORD),  # lpBytesReturned : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('FLTLIB.dll')
FilterGetInformation = Fiddle::Function.new(
  lib['FilterGetInformation'],
  [
    Fiddle::TYPE_INTPTR_T,  # hFilter : HFILTER
    Fiddle::TYPE_INT,  # dwInformationClass : FILTER_INFORMATION_CLASS
    Fiddle::TYPE_VOIDP,  # lpBuffer : void* out
    -Fiddle::TYPE_INT,  # dwBufferSize : DWORD
    Fiddle::TYPE_VOIDP,  # lpBytesReturned : DWORD* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "fltlib")]
extern "system" {
    fn FilterGetInformation(
        hFilter: isize,  // HFILTER
        dwInformationClass: i32,  // FILTER_INFORMATION_CLASS
        lpBuffer: *mut (),  // void* out
        dwBufferSize: u32,  // DWORD
        lpBytesReturned: *mut u32  // DWORD* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("FLTLIB.dll")]
public static extern int FilterGetInformation(IntPtr hFilter, int dwInformationClass, IntPtr lpBuffer, uint dwBufferSize, out uint lpBytesReturned);
"@
$api = Add-Type -MemberDefinition $sig -Name 'FLTLIB_FilterGetInformation' -Namespace Win32 -PassThru
# $api::FilterGetInformation(hFilter, dwInformationClass, lpBuffer, dwBufferSize, lpBytesReturned)
#uselib "FLTLIB.dll"
#func global FilterGetInformation "FilterGetInformation" sptr, sptr, sptr, sptr, sptr
; FilterGetInformation hFilter, dwInformationClass, lpBuffer, dwBufferSize, varptr(lpBytesReturned)   ; 戻り値は stat
; hFilter : HFILTER -> "sptr"
; dwInformationClass : FILTER_INFORMATION_CLASS -> "sptr"
; lpBuffer : void* out -> "sptr"
; dwBufferSize : DWORD -> "sptr"
; lpBytesReturned : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "FLTLIB.dll"
#cfunc global FilterGetInformation "FilterGetInformation" sptr, int, sptr, int, var
; res = FilterGetInformation(hFilter, dwInformationClass, lpBuffer, dwBufferSize, lpBytesReturned)
; hFilter : HFILTER -> "sptr"
; dwInformationClass : FILTER_INFORMATION_CLASS -> "int"
; lpBuffer : void* out -> "sptr"
; dwBufferSize : DWORD -> "int"
; lpBytesReturned : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT FilterGetInformation(HFILTER hFilter, FILTER_INFORMATION_CLASS dwInformationClass, void* lpBuffer, DWORD dwBufferSize, DWORD* lpBytesReturned)
#uselib "FLTLIB.dll"
#cfunc global FilterGetInformation "FilterGetInformation" intptr, int, intptr, int, var
; res = FilterGetInformation(hFilter, dwInformationClass, lpBuffer, dwBufferSize, lpBytesReturned)
; hFilter : HFILTER -> "intptr"
; dwInformationClass : FILTER_INFORMATION_CLASS -> "int"
; lpBuffer : void* out -> "intptr"
; dwBufferSize : DWORD -> "int"
; lpBytesReturned : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	fltlib = windows.NewLazySystemDLL("FLTLIB.dll")
	procFilterGetInformation = fltlib.NewProc("FilterGetInformation")
)

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

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

typedef FilterGetInformationNative = Int32 Function(IntPtr, Int32, Pointer<Void>, Uint32, Pointer<Uint32>);
typedef FilterGetInformationDart = int Function(int, int, Pointer<Void>, int, Pointer<Uint32>);
final FilterGetInformation = DynamicLibrary.open('FLTLIB.dll')
    .lookupFunction<FilterGetInformationNative, FilterGetInformationDart>('FilterGetInformation');
// hFilter : HFILTER -> IntPtr
// dwInformationClass : FILTER_INFORMATION_CLASS -> Int32
// lpBuffer : void* out -> Pointer<Void>
// dwBufferSize : DWORD -> Uint32
// lpBytesReturned : DWORD* out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function FilterGetInformation(
  hFilter: NativeInt;   // HFILTER
  dwInformationClass: Integer;   // FILTER_INFORMATION_CLASS
  lpBuffer: Pointer;   // void* out
  dwBufferSize: DWORD;   // DWORD
  lpBytesReturned: Pointer   // DWORD* out
): Integer; stdcall;
  external 'FLTLIB.dll' name 'FilterGetInformation';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "FilterGetInformation"
  c_FilterGetInformation :: CIntPtr -> Int32 -> Ptr () -> Word32 -> Ptr Word32 -> IO Int32
-- hFilter : HFILTER -> CIntPtr
-- dwInformationClass : FILTER_INFORMATION_CLASS -> Int32
-- lpBuffer : void* out -> Ptr ()
-- dwBufferSize : DWORD -> Word32
-- lpBytesReturned : DWORD* out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let filtergetinformation =
  foreign "FilterGetInformation"
    (intptr_t @-> int32_t @-> (ptr void) @-> uint32_t @-> (ptr uint32_t) @-> returning int32_t)
(* hFilter : HFILTER -> intptr_t *)
(* dwInformationClass : FILTER_INFORMATION_CLASS -> int32_t *)
(* lpBuffer : void* out -> (ptr void) *)
(* dwBufferSize : DWORD -> uint32_t *)
(* lpBytesReturned : DWORD* out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library fltlib (t "FLTLIB.dll"))
(cffi:use-foreign-library fltlib)

(cffi:defcfun ("FilterGetInformation" filter-get-information :convention :stdcall) :int32
  (h-filter :int64)   ; HFILTER
  (dw-information-class :int32)   ; FILTER_INFORMATION_CLASS
  (lp-buffer :pointer)   ; void* out
  (dw-buffer-size :uint32)   ; DWORD
  (lp-bytes-returned :pointer))   ; DWORD* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $FilterGetInformation = Win32::API::More->new('FLTLIB',
    'int FilterGetInformation(LPARAM hFilter, int dwInformationClass, LPVOID lpBuffer, DWORD dwBufferSize, LPVOID lpBytesReturned)');
# my $ret = $FilterGetInformation->Call($hFilter, $dwInformationClass, $lpBuffer, $dwBufferSize, $lpBytesReturned);
# hFilter : HFILTER -> LPARAM
# dwInformationClass : FILTER_INFORMATION_CLASS -> int
# lpBuffer : void* out -> LPVOID
# dwBufferSize : DWORD -> DWORD
# lpBytesReturned : DWORD* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

公式の関連項目
使用する型