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