chmode
驱动牛犊
驱动牛犊
  • 注册日期2001-08-06
  • 最后登录2001-12-26
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:2890回复:8

在 WIN2000 上用计算机管理中的磁盘管理程序进行分区操作,会向磁盘驱动程序、文件驱动程序发什么控制码?

楼主#
更多 发布于:2002-02-25 18:12
在 WIN2000 上用计算机管理中的磁盘管理程序进行分区操作,会向磁盘驱动程序、文件驱动程序发什么控制码呢?哪为大侠帮我解决这个问题,我一定赠送 50 分。
guardee
驱动巨牛
驱动巨牛
  • 注册日期2002-11-08
  • 最后登录2010-05-29
  • 粉丝2
  • 关注1
  • 积分2分
  • 威望34点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2002-02-25 19:08
IOCTL_DISK_SET_DRIVE_LAYOUT_EX
   Operation
   Repartitions a disk as specified. (Floppy drivers need
   not handle this request.)

   Input
   The buffer at Irp->AssociatedIrp.SystemBuffer contains
   the DRIVE_LAYOUT_INFORMATION_EX values to be set.  
   Parameters.DeviceIoControl.InputBufferLength in the
   I/O   stack location of the IRP indicates the size in
   bytes of the buffer, which must be >= sizeof
   (DRIVE_LAYOUT_INFORMATION_EX).

   Output
   Returns updated DRIVE_LAYOUT_INFORMATION_EX, possibly
   with modified partition numbers, to the buffer at Irp-  
   >AssociatedIrp.SystemBuffer.

   I/O Status Block
     The Information field is set to the size in bytes of
     the returned information. The Status field can be set
     to STATUS_SUCCESS, or possibly to
      STATUS_INVALID_PARAMETER,
      STATUS_INFO_LENGTH_MISMATCH,
      STATUS_INSUFFICIENT_RESOURCES, or
      STATUS_BUFFER_TOO_SMALL.

   Headers
     Defined in ntdddisk.h; Include ntdddisk.h.

IOCTL_DISK_SET_PARTITION_INFO_EX
Operation
     Changes the partition type of the specified disk
     partition. (Floppy drivers need not handle this
     request.)

Input
The buffer at Irp->AssociatedIrp.SystemBuffer contains the SET_PARTITION_INFORMATION_EX to be set. Parameters.DeviceIoControl.InputBufferLength in the I/O stack location of the IRP indicates the size of the buffer, which must be >= sizeof(SET_PARTITION_INFORMATION_EX).

Output
None

I/O Status Block
The Information field is set to zero. The Status field can be set to STATUS_SUCCESS, or possibly to STATUS_INVALID_PARAMETER, STATUS_INVALID_DEVICE_REQUEST, STATUS_UNSUCCESSFUL, STATUS_INFO_LENGTH_MISMATCH, STATUS_INSUFFICIENT_RESOURCES, or STATUS_BUFFER_TOO_SMALL.

Headers
Defined in ntdddisk.h; Include ntdddisk.h.

WindThruEars
驱动老牛
驱动老牛
  • 注册日期2002-11-17
  • 最后登录2004-07-10
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2002-02-26 01:21
The easiest way to achieve your question is install a filter driver over IFS/disk class driver. then you can know all IOCTLs and their sequence. I heard  that driver studio has such a tool but I don\'t know the detail because I never use DS.

Normally Windows storage driver includes 2 layers:
Disk class driver <=> atapi.sys(atapi itself is a miniport driver under Windows 2000) or scsi miniport driver. IFS is layered on top of disk class driver.

You can use common filter driver to filter disk class driver because it\'s IRP based. But if you want to monitor the scsi miniport driver, you should use special filter because scsi miniport driver is SRB based instead of IRP. You can download HtsScsiView from http://www.hollistech.com/Resources/ScsiView/HtsScsiView.htm to do that.

As to IFS, maybe you can use filemon from http://www.sysinternals.com, but I am not sure if you can be satisfied with that.

Anyway, have fun!
我是假耳朵
chmode
驱动牛犊
驱动牛犊
  • 注册日期2001-08-06
  • 最后登录2001-12-26
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2002-02-26 10:21
guardee 老大,您所说的 IOCTL_DISK_SET_DRIVE_LAYOUT_EX 恐怕是不对的,我写了一个磁盘过滤驱动程序,安装运行后,无法过滤到 IOCTL_DISK_SET_DRIVE_LAYOUT_EX 这个控制码;

kanghai 老大,您所说的办法我已尝试过,而且我还写了一个磁盘过滤驱动程序。我用 SoftIce 跟踪删除分区的操作,在磁盘过滤驱动程序中,共截获 56 次控制码,实际就是  IOCTL_DISK_GET_DRIVE_GEOMETRY、IOCTL_DISK_GET_PARTITION_INFO、
IOCTL_DISK_SET_PARTITION_INFO、IOCTL_DISK_GET_DRIVE_LAYOUT、IOCTL_DISK_SET_DRIVE_LAYOUT、IOCTL_DISK_IS_WRITABLE、IOCTL_DISK_MEDIA_REMOVAL、IOCTL_DISK_EJECT_MEDIA 等控制码,我当时还以为是 IOCTL_DISK_MEDIA_REMOVAL,但发现分区都被删除了,这个控制码才发出来。

各位老大再帮一帮忙!!!
WindThruEars
驱动老牛
驱动老牛
  • 注册日期2002-11-17
  • 最后登录2004-07-10
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2002-02-26 12:38
I dont know what you are asking.

The paritition was deleted by IOCTL_DISK_SET_DRIVE_LAYOUT.

[编辑 -  2/26/02 作者: kanghai]
我是假耳朵
chmode
驱动牛犊
驱动牛犊
  • 注册日期2001-08-06
  • 最后登录2001-12-26
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2002-02-26 14:02
kanghai 老大,感谢您的鼎立相助。
我实际上是想让我的过滤驱动程序能够终止分区操作,IOCTL_DISK_GET_DRIVE_GEOMETRY、IOCTL_DISK_GET_PARTITION_INFO、IOCTL_DISK_SET_PARTITION_INFO、IOCTL_DISK_GET_DRIVE_LAYOUT、IOCTL_DISK_SET_DRIVE_LAYOUT、IOCTL_DISK_IS_WRITABLE、IOCTL_DISK_MEDIA_REMOVAL、IOCTL_DISK_EJECT_MEDIA 等控制码我截获后即终止它,不转发到下一层驱动程序处理,可是分区操作仍然完成了。我现在就想找到一个控制码,只有这个控制码被发给磁盘驱动程序处理后,分区操作才可以完成。可是我没找到,所以,向各位老大求助。
guardee
驱动巨牛
驱动巨牛
  • 注册日期2002-11-08
  • 最后登录2010-05-29
  • 粉丝2
  • 关注1
  • 积分2分
  • 威望34点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2002-02-26 20:48
啊!望了,在NT和2中是IOCTL_DISK_SET_DRIVE_LAYOUT
而在XP中才是IOCTL_DISK_SET_DRIVE_LAYOUT_EX

guardee
驱动巨牛
驱动巨牛
  • 注册日期2002-11-08
  • 最后登录2010-05-29
  • 粉丝2
  • 关注1
  • 积分2分
  • 威望34点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
7楼#
发布于:2002-02-26 20:52
你的意思是想通过一个特定的途径才可以分区了,那么你可以使用应用程序通知你的驱动程序,在应用程序通知驱动之后,驱动程序才放过这个分区请求啊!
WindThruEars
驱动老牛
驱动老牛
  • 注册日期2002-11-17
  • 最后登录2004-07-10
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
8楼#
发布于:2002-02-26 23:52
It\'s little strange indeed, According the source code of disk class driver, it won\'t write the partition table until it get the IOCTL_DISK_SET_DRIVE_LAYOUT request.

I suspect where your filter is. Is it exactly layered on top of disk.sys instead of partmgr.sys?
我是假耳朵
游客

返回顶部