阅读:1761回复:4
菜鸟对tooflat大大的透明加解密源码的疑问
本人是编程的菜鸟, 刚下载了tooflat大大的sfilter做研究, 通过和ddk的sfilter作比较. 发现两个sfilter的结构体SFILTER_DEVICE_EXTENSION的定义不一样, 但是都可以通过
PSFILTER_DEVICE_EXTENSION DevExt = (PSFILTER_DEVICE_EXTENSION) DeviceObject->DeviceExtension; 这样的语句来获取参数, 请问PDEVICE_OBJECT DeviceObject这个类型是怎样传递参数的? 小弟见识太浅, 请不吝解答。 DDK的sfilter typedef struct _SFILTER_DEVICE_EXTENSION { // // Pointer to the file system device object we are attached to // PDEVICE_OBJECT AttachedToDeviceObject; // // Pointer to the real (disk) device object that is associated with // the file system device object we are attached to // PDEVICE_OBJECT StorageStackDeviceObject; // // Name for this device. If attached to a Volume Device Object it is the // name of the physical disk drive. If attached to a Control Device // Object it is the name of the Control Device Object. // UNICODE_STRING DeviceName; // // Buffer used to hold the above unicode strings // WCHAR DeviceNameBuffer[MAX_DEVNAME_LENGTH]; } SFILTER_DEVICE_EXTENSION, *PSFILTER_DEVICE_EXTENSION; tooflat大大的sfilter typedef struct _SFILTER_DEVICE_EXTENSION { // // Pointer to the file system device object we are attached to // PDEVICE_OBJECT AttachedToDeviceObject; // // Pointer to the real (disk) device object that is associated with // the file system device object we are attached to // PDEVICE_OBJECT StorageStackDeviceObject; // // Name for this device. If attached to a Volume Device Object it is the // name of the physical disk drive. If attached to a Control Device // Object it is the name of the Control Device Object. // UNICODE_STRING DeviceName; // // Buffer used to hold the above unicode strings // WCHAR DeviceNameBuffer[MAX_DEVNAME_LENGTH]; WCHAR DriveLetter; RTL_GENERIC_TABLE FsCtxTable; FAST_MUTEX FsCtxTableMutex; } SFILTER_DEVICE_EXTENSION, *PSFILTER_DEVICE_EXTENSION; |
|
沙发#
发布于:2008-04-14 14:40
结构是你自己写的, 你可以随并定义结构拉.
|
|
|
板凳#
发布于:2008-04-14 15:05
多谢ls的, 但是PDEVICE_OBJECT好像是系统内部的结构体, 它要怎样和自定义的结构体建立对应关系呢? 主要是这两个自定义的结构体参数数量都不一样, 我不太理解.
|
|
地板#
发布于:2008-04-14 17:20
DEVICE_OBJECT中有一个成员为DeviceExtention
类型是 void*指针. 故你可以自己定义一个结构体,把它的指针指的值给 DeviceExtention就可以了. 这个操作在IoCreateDevice自动完成, 只要你设置好参数就可以了. NE:使用这个指针时一定得强制类型转换 |
|
|
地下室#
发布于:2008-04-15 09:56
多谢ls的jl2004大大, 我一直都想不通这点.
|
|