leolhc
驱动牛犊
驱动牛犊
  • 注册日期2008-02-25
  • 最后登录2008-10-12
  • 粉丝0
  • 关注0
  • 积分3分
  • 威望27点
  • 贡献值0点
  • 好评度17点
  • 原创分0分
  • 专家分0分
阅读:1761回复:4

菜鸟对tooflat大大的透明加解密源码的疑问

楼主#
更多 发布于:2008-04-14 10:55
       本人是编程的菜鸟, 刚下载了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;
xiabl
驱动牛犊
驱动牛犊
  • 注册日期2005-10-24
  • 最后登录2010-05-20
  • 粉丝0
  • 关注0
  • 积分221分
  • 威望77点
  • 贡献值0点
  • 好评度71点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2008-04-14 14:40
结构是你自己写的,  你可以随并定义结构拉.
小桥流水人家
leolhc
驱动牛犊
驱动牛犊
  • 注册日期2008-02-25
  • 最后登录2008-10-12
  • 粉丝0
  • 关注0
  • 积分3分
  • 威望27点
  • 贡献值0点
  • 好评度17点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2008-04-14 15:05
多谢ls的, 但是PDEVICE_OBJECT好像是系统内部的结构体, 它要怎样和自定义的结构体建立对应关系呢? 主要是这两个自定义的结构体参数数量都不一样, 我不太理解.
jl2004
驱动小牛
驱动小牛
  • 注册日期2007-04-10
  • 最后登录2011-02-22
  • 粉丝0
  • 关注0
  • 积分21分
  • 威望276点
  • 贡献值0点
  • 好评度129点
  • 原创分0分
  • 专家分0分
地板#
发布于:2008-04-14 17:20
DEVICE_OBJECT中有一个成员为DeviceExtention
类型是 void*指针.
故你可以自己定义一个结构体,把它的指针指的值给
DeviceExtention就可以了.

这个操作在IoCreateDevice自动完成,
只要你设置好参数就可以了.

NE:使用这个指针时一定得强制类型转换
向前,向前,向前....
leolhc
驱动牛犊
驱动牛犊
  • 注册日期2008-02-25
  • 最后登录2008-10-12
  • 粉丝0
  • 关注0
  • 积分3分
  • 威望27点
  • 贡献值0点
  • 好评度17点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2008-04-15 09:56
多谢ls的jl2004大大, 我一直都想不通这点.
游客

返回顶部