小问题

zhouyu_75 2004-10-26 04:07:03
FileDispatch(PDEVICE_OBJECT Device_Object, IN PIRP Irp )
{
PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
.................
if(Device_Object->Characteristics == FILE_REMOVABLE_MEDIA)//这里我有疑问!!
...........
}
在if处,我不知道:Device_Object->Characteristics和currentIrpStack->DeviceObject->Characteristics 有什么不同?
请问我应该使用哪一个?
...全文
29 点赞 收藏 1
写回复
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
a1a212 2004-11-05
currentIrpStack是irp的Stack,你可以参考
DDK
typedef struct _IO_STACK_LOCATION {
UCHAR MajorFunction;
UCHAR MinorFunction;
UCHAR Flags;
UCHAR Control;
//
// The following parameters depend on the IRP_MJ_XXX that is set
// in MajorFunction. This declaration shows examples for IRP_MJ_READ,
// IRP_MJ_WRITE, and IRP_MJ_DEVICE_CONTROL or, possibly,
// IRP_MJ_INTERNAL_DEVICE_CONTROL requests, as well as for IRP_MJ_SCSI,
// which is equivalent to IRP_MJ_INTERNAL_DEVICE_CONTROL.
// For other IRP_MJ_XXX, see the structure definition.
//
union {
.
.
struct {
ULONG Length;
ULONG Key;
LARGE_INTEGER ByteOffset;
} Read;

struct {
ULONG Length;
ULONG Key;
LARGE_INTEGER ByteOffset;
} Write;
.
.
struct {
ULONG OutputBufferLength;
ULONG InputBufferLength;
ULONG IoControlCode; // IOCTL_XXX
PVOID Type3InputBuffer;
} DeviceIoControl;
.
.
struct {
struct _SCSI_REQUEST_BLOCK *Srb;
} Scsi;
.
.
} Parameters;
PDEVICE_OBJECT DeviceObject;
PFILE_OBJECT FileObject;
.
.
} IO_STACK_LOCATION, *PIO_STACK_LOCATION;
回复
发动态
发帖子
驱动开发/核心开发
创建于2007-09-28

2.1w+

社区成员

硬件/嵌入开发 驱动开发/核心开发
申请成为版主
社区公告
暂无公告