-
-
[旧帖] [求助]磁盘过滤驱动开发的问题 0.00雪花
-
发表于: 2013-5-22 14:22 1605
-
本人本科在读,因为个人兴趣接触了windows内核开发,最近在做磁盘过滤驱动时遇到个问题,望各位大神帮助:
KeInitializeEvent(&WaitEvent1,NotificationEvent,FALSE);
NewIrp1 = IoBuildDeviceIoControlRequest(FSCTL_LOCK_VOLUME,
DevExt->FltDevObj,
NULL,
0,
NULL,
0,
FALSE,
&WaitEvent1,
&IoStatus);
if (NULL == NewIrp1) // can't create new irp
{
KdPrint(("xxxdiskg::xLoginOut2 %#x\n",status));
return status;
}
status = IoCallDriver(DevExt->FltDevObj, NewIrp1);
if (status == STATUS_PENDING)
{
status = KeWaitForSingleObject(&WaitEvent1, Executive, KernelMode, FALSE, NULL);
status = IoStatus.Status;
}
if (!NT_SUCCESS(status))
{
KdPrint(("xxxdiskg::xLoginOut3 %#x\n",status));
return status;
}
代码如上,想要实现的是在内核层对磁盘进行lock,上面的代码执行后status返回都是参数错误,前前后后已经纠结了2个月了,查了无数资料,毫无头绪望各位大神指点
KeInitializeEvent(&WaitEvent1,NotificationEvent,FALSE);
NewIrp1 = IoBuildDeviceIoControlRequest(FSCTL_LOCK_VOLUME,
DevExt->FltDevObj,
NULL,
0,
NULL,
0,
FALSE,
&WaitEvent1,
&IoStatus);
if (NULL == NewIrp1) // can't create new irp
{
KdPrint(("xxxdiskg::xLoginOut2 %#x\n",status));
return status;
}
status = IoCallDriver(DevExt->FltDevObj, NewIrp1);
if (status == STATUS_PENDING)
{
status = KeWaitForSingleObject(&WaitEvent1, Executive, KernelMode, FALSE, NULL);
status = IoStatus.Status;
}
if (!NT_SUCCESS(status))
{
KdPrint(("xxxdiskg::xLoginOut3 %#x\n",status));
return status;
}
代码如上,想要实现的是在内核层对磁盘进行lock,上面的代码执行后status返回都是参数错误,前前后后已经纠结了2个月了,查了无数资料,毫无头绪望各位大神指点
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)
赞赏
他的文章
看原图
赞赏
雪币:
留言: