阅读:817回复:0
第一次写driver,碰到了怪问题!救救我!
驱动程序被装载后,我用windbg监视,能显示调试语句\"Load sys Ok!\"
,但紧跟着出现\"unload driver\"!不知为何? 我用driverstudio2.5 winddk 2000 vc6.0 开发pci 9052驱动! 源码如下: NTSTATUS DriverEntry( PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pRegistryPath ) { NTSTATUS status; PDEVICE_OBJECT fdo; REGISTRY_INFORMATION RegistryInfo; status = STATUS_SUCCESS; if (IoIsWdmVersionAvailable(0x01, 0x10) == FALSE) { if (IoIsWdmVersionAvailable(0x01, 0x00) == TRUE) { KdPrint((DBG_NAME \"OS supports WDM 1.0 (Windows 98)\\n\")); IsOsWinNT = FALSE; } else KdPrint((DBG_NAME \"WARNING - OS does not support WDM 1.0\\n\")); } else KdPrint((\"OS supports WDM 1.10 (Windows 2000 or above)\\n\")); KdPrint((DBG_NAME \"Device Registry path = \\\"%ws\\\"\\n\", pRegistryPath->Buffer)); // Get configuration information from registry PlxRegistryInformationGet( pRegistryPath, &RegistryInfo ); // Fill in the appropriate dispatch handlers pDriverObject->DriverUnload = DriverUnload; pDriverObject->MajorFunction[IRP_MJ_CREATE] = DispatchCreate; pDriverObject->MajorFunction[IRP_MJ_CLOSE] = DispatchClose; pDriverObject->MajorFunction[IRP_MJ_READ] = DispatchRead; pDriverObject->MajorFunction[IRP_MJ_WRITE] = DispatchWrite; pDriverObject->MajorFunction[IRP_MJ_CLEANUP] = DispatchCleanup; pDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DispatchIoControl; pDriverObject->MajorFunction[IRP_MJ_PNP] = DispatchPnp; // pDriverObject->MajorFunction[IRP_MJ_POWER] = DispatchPower; pDriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = DispatchSystemControl; pDriverObject->DriverExtension->AddDevice = AddDevice; mgCommonBuffer.pMdl = NULL; mgCommonBuffer.pKernelVa = NULL; mgCommonBuffer.PciMem.PhysicalAddr = (U32)-1; mgCommonBuffer.PciMem.UserAddr = (U32)-1; mgCommonBuffer.PciMem.Size = 0; KdPrint((DBG_NAME \"Load Sys Ok! \") return STATUS_SUCCESS; } |
|