阅读:1496回复:0
用HalGetBusData会死机
在DDK中HalGetBusData是个作废的函数,我只是想试验一下这个函数。但是一用就死机,请各位帮忙看看
#pragma PAGEDCODE NTSTATUS HelloWDMDispatchControlp(PDEVICE_OBJECT fdo, PIRP Irp) { PAGED_CODE(); KdPrint(("HelloWDMDispatchControlp()\n")); NTSTATUS status = STATUS_SUCCESS; PIO_STACK_LOCATION stack = IoGetCurrentIrpStackLocation(Irp); ULONG cbin = stack->Parameters.DeviceIoControl.InputBufferLength; ULONG cbout = stack->Parameters.DeviceIoControl.OutputBufferLength; ULONG code = stack->Parameters.DeviceIoControl.IoControlCode; ULONG info = 0; switch (code) { // process request case IOCTL_TEST: { KdPrint(("IOCTL_TEST\n")); PCI_COMMON_CONFIG pci_config={0}; ULONG BusNumber =2; PCI_SLOT_NUMBER pci_slot; pci_slot.u.bits.DeviceNumber=0; pci_slot.u.bits.FunctionNumber=0; //这句就死了 HalGetBusData(PCIConfiguration,BusNumber,pci_slot.u.AsULONG,&pci_config,sizeof(ULONG)); RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, &pci_config, cbout); info = 4; break; } } Irp->IoStatus.Status = status; Irp->IoStatus.Information = info; IoCompleteRequest(Irp, IO_NO_INCREMENT); return status; } |
|
|