我开始在 VS2012、Win8 中编写一个微型过滤器。创建新项目过滤器驱动程序:文件系统微型过滤器后,我收到 6 个错误。
7 IntelliSense:“void (*)(PCFLT_RELATED_OBJECTS FltObjects, PFLT_IO_PARAMETER_BLOCK ParameterSnapshot, NTSTATUS OperationStatus, PVOID RequesterContext)”类型的参数与“PFLT_GET_OPERATION_STATUS_CALLBACK”类型的参数不兼容
5 IntelliSense:“void (*)(PCFLT_RELATED_OBJECTS FltObjects, FLT_INSTANCE_TEARDOWN_FLAGS Flags)”类型的值不能用于初始化“PFLT_INSTANCE_TEARDOWN_CALLBACK”类型的实体
6 IntelliSense:“void (*)(PCFLT_RELATED_OBJECTS FltObjects, FLT_INSTANCE_TEARDOWN_FLAGS Flags)”类型的值不能用于初始化“PFLT_INSTANCE_TEARDOWN_CALLBACK”类型的实体
3 IntelliSense:“NTSTATUS (*)(PCFLT_RELATED_OBJECTS FltObjects, FLT_INSTANCE_SETUP_FLAGS Flags, ULONG VolumeDeviceType, FLT_FILESYSTEM_TYPE VolumeFilesystemType)”类型的值不能用于初始化“PFLT_INSTANCE_SETUP_CALLBACK”类型的实体
4 IntelliSense:“NTSTATUS (*)(PCFLT_RELATED_OBJECTS FltObjects, FLT_INSTANCE_QUERY_TEARDOWN_FLAGS Flags)”类型的值不能用于初始化“PFLT_INSTANCE_QUERY_TEARDOWN_CALLBACK”类型的实体
2 IntelliSense:“NTSTATUS (*)(FLT_FILTER_UNLOAD_FLAGS Flags)”类型的值不能用于初始化“PFLT_FILTER_UNLOAD_CALLBACK”类型的实体
大多数错误所在的主要功能
CONST FLT_REGISTRATION FilterRegistration = {
sizeof( FLT_REGISTRATION ), // Size
FLT_REGISTRATION_VERSION, // Version
0, // Flags
NULL, // Context
Callbacks, // Operation callbacks
FsFilter1testUnload, // MiniFilterUnload
FsFilter1testInstanceSetup, // InstanceSetup
FsFilter1testInstanceQueryTeardown, // InstanceQueryTeardown
FsFilter1testInstanceTeardownStart, // InstanceTeardownStart
FsFilter1testInstanceTeardownComplete, // InstanceTeardownComplete
NULL, // GenerateFileName
NULL, // GenerateDestinationFileName
NULL // NormalizeNameComponent
};
另一个功能
status = FltRequestOperationStatusCallback(Data,
FsFilter1testOperationStatusCallback,
(PVOID)(++OperationStatusCtx));
所有实体都以类似的方式声明
NTSTATUS
FsFilter1testInstanceSetup (
_In_ PCFLT_RELATED_OBJECTS FltObjects,
_In_ FLT_INSTANCE_SETUP_FLAGS Flags,
_In_ DEVICE_TYPE VolumeDeviceType,
_In_ FLT_FILESYSTEM_TYPE VolumeFilesystemType
)