我用driverstudio的向导建立了一个PCI9030的驱动框架,并且未对这个驱动框架的代码做任何修改。但这个驱动出现一些异常的现象是:大部分主板可以安装设备,并且在windows xp下面能正常启动,并且在设备栏里能正确找到设备。但是奇怪的是,在某些板卡(如华硕的PQ5主板)的其中两个插槽上安装硬件卡和驱动的话,会出现一直重启计算机。我一直没有查出是具体是什么问题。但估计是在AddDevice(PDEVICE_OBJECT Pdo)函数里出现的问题。代码如下:
NTSTATUS One::AddDevice(PDEVICE_OBJECT Pdo)
{
t << "AddDevice called\n";
// Create the device object. Note that we used a form of "placement" new,
// that is a member operator of KDevice. This form will use storage
// allocated by the system in the device object's device to store our
// class instance.
OneDevice * pDevice = new (
static_cast
(KUnitizedName(L"OneDevice", m_Unit)),
FILE_DEVICE_UNKNOWN,
NULL,
0,
DO_BUFFERED_IO
| DO_POWER_PAGABLE
)
OneDevice(Pdo, m_Unit);
if (pDevice == NULL)
{
t << "Error creating device OneDevice"
<< (ULONG) m_Unit << EOL;
return STATUS_INSUFFICIENT_RESOURCES;
}
NTSTATUS status = pDevice->ConstructorStatus();
if ( !NT_SUCCESS(status) )
{
t << "Error constructing device OneDevice"
<< (ULONG) m_Unit << " status " << (ULONG) status << EOL;
delete pDevice;
}
else
{
m_Unit++;
pDevice->ReportNewDevicePowerState(PowerDeviceD0);
}
return status;
}
请指教。