卸载ramdisk驱动程序时,MountMgrMountedDeviceRemoval()中的BSOD [英] BSOD in MountMgrMountedDeviceRemoval() when uninstalling a ramdisk driver
问题描述
大家好,
我正在开发一个ramdisk驱动程序。
I'm developing a ramdisk driver.
目标操作系统是Windows 7 x64。
The target OS is windows 7 x64.
我想使用mount manager来挂载/卸载它...
I'd like to use mount manager to mount/unmount it...
这里是初始化我的驱动程序的代码,并在它之间创建一个接口mount manager。
Here is the code to initial my driver, and create an interface between mount manager.
DECLARE_CONST_UNICODE_STRING(ntDeviceName, L"\\Device\\Ramdisk");
status = WdfDeviceInitAssignName(DeviceInit, &ntDeviceName);
if (!NT_SUCCESS(status)) {
return status;
}
...
status = WdfDeviceCreateDeviceInterface(device, &MOUNTDEV_MOUNTED_DEVICE_GUID, NULL);
这是我的代码块处理由安装管理器发送的IOCTL代码。 / p>
Here's my code block handling IOCTL codes sent by mount manager.
case IOCTL_MOUNTDEV_QUERY_DEVICE_NAME:
{
PMOUNTDEV_NAME mountName;
if (OutputBufferLength < sizeof(MOUNTDEV_NAME))
{
Status = STATUS_BUFFER_OVERFLOW;
information = 0;
}
else
{
Status = WdfRequestRetrieveOutputBuffer(Request, sizeof(MOUNTDEV_NAME), &mountName, &bufSize);
if(NT_SUCCESS(Status) ) {
WCHAR NameBuffer[80];
RtlStringCbPrintfW(NameBuffer, sizeof(NameBuffer), L"\\Device\\Ramdisk");
mountName->NameLength = 15 * sizeof(WCHAR);
if (OutputBufferLength < FIELD_OFFSET(MOUNTDEV_NAME, Name) + mountName->NameLength)
{
information = sizeof(MOUNTDEV_NAME);
Status = STATUS_BUFFER_OVERFLOW;
}
else
{
RtlCopyMemory(mountName->Name, NameBuffer, mountName->NameLength);
information = FIELD_OFFSET(MOUNTDEV_NAME, Name) + mountName->NameLength;
Status = STATUS_SUCCESS;
}
}
}
break;
}
case IOCTL_MOUNTDEV_QUERY_UNIQUE_ID:
{
WCHAR NameBuffer[80];
PMOUNTDEV_UNIQUE_ID mountUID;
if (OutputBufferLength < sizeof(MOUNTDEV_NAME))
{
Status = STATUS_BUFFER_OVERFLOW;
information = 0;
}
else
{
Status = WdfRequestRetrieveOutputBuffer(Request, sizeof(MOUNTDEV_UNIQUE_ID), &mountUID, &bufSize);
if(NT_SUCCESS(Status) ) {
RtlStringCbPrintfW(NameBuffer, sizeof(NameBuffer), L"\\Device\\Ramdisk");
mountUID->UniqueIdLength = 15 * sizeof(WCHAR);
if (OutputBufferLength < FIELD_OFFSET(MOUNTDEV_UNIQUE_ID, UniqueId) + mountUID->UniqueIdLength)
{
information = sizeof(MOUNTDEV_UNIQUE_ID);
Status = STATUS_BUFFER_OVERFLOW;
}
else
{
RtlCopyMemory(mountUID->UniqueId, NameBuffer, mountUID->UniqueIdLength);
information = FIELD_OFFSET(MOUNTDEV_UNIQUE_ID, UniqueId) + mountUID->UniqueIdLength;
Status = STATUS_SUCCESS;
}
}
}
break;
}
case IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME :
{
Status = STATUS_SUCCESS;
information = 0;
break;
}
问题是,我可以获得符号链接名称(E :)并正确链接。另外,我们可以正常格式化这个ramdisk。
The problem is, I can get symbolic link name (E:) and link it correctly. Also, we can format this ramdisk normally.
然而,当我卸载这个drvier时,我遇到了BSOD崩溃!但它在Windows 8 x64 cutomer预览中工作正常。
However, when I was uninstalling this drvier, I got a BSOD crash! But it works fine on windows 8 x64 cutomer preview.
这是我在内核调试器中的错误检查。
And here's my bugcheck log in kernel debugger.
看来问题出在MountMgrMountedDeviceRemoval中。 ..
It seems the problem is in MountMgrMountedDeviceRemoval...
有没有人有想法?
非常感谢!!
**** ************************************************** *************************
* &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
*
* &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;检测错误分析&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
*
* &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
*
************************************* ******************************************
*******************************************************************************
*
*
* Bugcheck Analysis
*
*
*
*******************************************************************************
使用!analyze -v获取详细的调试信息。
Use !analyze -v to get detailed debugging information.
BugCheck 19,{22,0,0,0}
BugCheck 19, {22, 0, 0, 0}
TRIAGER:无法打开分类文件:c:\program files(x86)\windows kits \8.0\debuggers \ x64 \triage \ modclass.ini,错误2
可能由:mountmgr.sys(mountmgr!MountMgrMountedDeviceRemoval + 158)
TRIAGER: Could not open triage file : c:\program files (x86)\windows kits\8.0\debuggers\x64\triage\modclass.ini, error 2
Probably caused by : mountmgr.sys ( mountmgr!MountMgrMountedDeviceRemoval+158 )
推荐答案
你需要修复你的符号并给我们完整的喷射!分析,但你有一个内存腐败问题。
Well you need to fix your symbols and give us the complete spew from !analyze but you have a memory corruption problem.
这篇关于卸载ramdisk驱动程序时,MountMgrMountedDeviceRemoval()中的BSOD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!