阅读:1475回复:3
小弟初学,请教sfilter中不明白的地方!
看sfilter,在DriverEntry函数里,首先创建了一个DeviceObject,这个是做什么用的?另外我看Filemon的源码并没有创建类似的DeviceObject,很不明白。
|
|
沙发#
发布于:2012-05-10 17:11
RtlInitUnicodeString( &nameString, L"\\FileSystem\\Filters\\SFilter" );
status = IoCreateDevice( DriverObject, 0, //has no device extension &nameString, FILE_DEVICE_DISK_FILE_SYSTEM, FILE_DEVICE_SECURE_OPEN, FALSE, &gSFilterControlDeviceObject ); if (status == STATUS_OBJECT_PATH_NOT_FOUND) { // // This must be a version of the OS that doesn't have the Filters // path in its namespace. This was added in Windows XP. // // We will try just putting our control device object in the \FileSystem // portion of the object name space. // RtlInitUnicodeString( &nameString, L"\\FileSystem\\SFilterCDO" ); status = IoCreateDevice( DriverObject, 0, //has no device extension &nameString, FILE_DEVICE_DISK_FILE_SYSTEM, FILE_DEVICE_SECURE_OPEN, FALSE, &gSFilterControlDeviceObject ); if (!NT_SUCCESS( status )) { KdPrint(( "SFilter!DriverEntry: Error creating control device object \"%wZ\", status=%08x\n", &nameString, status )); return status; } } |
|
板凳#
发布于:2012-05-15 07:07
这是控制设备对象(CDO),用于你的驱动和应用程序通讯。
任何io都需要一个设备,你的这个设备对象,就是用于应用程序向驱动发送命令用。 |
|
|
地板#
发布于:2012-05-22 11:44
回 znsoft 的帖子
znsoft:这是控制设备对象(CDO),用于你的驱动和应用程序通讯。 哦,明白了,多谢前辈指点啊 |
|