阅读:1410回复:1
请教利用过滤驱动实现将缓存写入磁盘的方法
The CcFlushCache routine flushes all or a portion of a cached file to disk.
VOID CcFlushCache( IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN PLARGE_INTEGER FileOffset OPTIONAL, IN ULONG Length, OUT PIO_STATUS_BLOCK IoStatus OPTIONAL ); 在HelloDDKDeviceIOControl中实现CcFlushCache 函数调用 DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = HelloDDKDeviceIOControl; 外面通过deviceiocontrol调用执行,大家认为可行吗? 还有我怎么打开我的过滤驱动设备,我安装了微软的过滤驱动,为什么以下调用返回错误代码2 HANDLE hDevice = CreateFile(_T("\\\\.\\Sfilter"), GENERIC_READ | GENERIC_WRITE, 0, // share mode none NULL, // no security OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); // no template |
|
沙发#
发布于:2010-01-14 02:31
If I understand your question correct, I think you mis-understand the meaning of CcFlushCache(). This function is provided by CM to flush a particular file cache. It's not used to flush all system cache data. The SectionObject is a kernel structure which is not exposed to user mode. I don't think you can easily call CcFlushCache from IoControl.
As I remember, you need to make some changes, in MJ_CREATE I think, in SFilter before you can create an instance of it in user mode. There should be discussions in this forum before talking about it. Just search them. |
|