阅读:906回复:0
很简单的问题:取并口端口号(40分)
case IOCTL_TEST:
KdPrint( ("Test\n") ); RtlInitUnicodeString(&objn,L"\\Device\\ParallelPort0"); ntStatus=IoGetDeviceObjectPointer( &objn, FILE_ALL_ACCESS, &FileObject, &bdo ); if( !NT_SUCCESS(ntStatus) ){ KdPrint( ("Fail1\n") ); } KdPrint( ("IoGetDeviceObjectPointer OK\n") ); KeInitializeEvent( &event, NotificationEvent, FALSE ); if(bdo!=NULL) { irp=IoBuildDeviceIoControlRequest( IOCTL_INTERNAL_GET_PARALLEL_PORT_INFO, bdo, NULL, 0, &pInf, sizeof(PARALLEL_PORT_INFORMATION), TRUE, &event, &pStatus ); KdPrint( ("IoBuildDeviceIoControlRequest OK\n") ); li = pInf.OriginalController; } status=IoCallDriver(bdo,irp); if (!NT_SUCCESS(status)) { return status; } status = KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL); if (!NT_SUCCESS(status)) { return status; } // IoFreeIrp(irp); <---------------- 1 KdPrint( ("%x\n", li) ); <---------------- 2 break; 在2处显示的东西不是端口号啊,还有,如果我把1加上,就兰屏,不解的说 :( |
|