阅读:971回复:0
请为我的驱动开发源代码加上头文件啊!
USB驱动程序入口详解:
NTSTATUS DriverEntry ( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING UniRegistryPath ) { NTSTATUS ntStatus; PUNICODE_STRING registryPath; RegistryPath = &Globals.BulkUsb_RegistryPath; registryPath->MaximumLength = UniRegistryPath->Length+sizeof(UNICODE_NULL); registryPath->Length = UniRegistryPath->Length; registryPath->Buffer = ExAllocatePool (PagedPool, registryPath->MaxmumLength); if (!registryPath->Buffer) { ntStatus = STATUS_INSUFFICIENT_RESOURCES; goto DriverEntry_Exit; } RtlZeroMemory (registryPath-> Buffer, registryPath->MaxmumLength); RtlMoveMemory (registryPath―>Buffer, UniRegistryPath->Buffer, UniRegistryPath->Length); NtStatus = STATUS_SUCCESS; DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL]=BulkUsb_DispatchDevCtrl; DriverObject->MajorFunction[IRP_MJ_POWER] =BulkUsb_DispatchPower; DriverObject->MajorFunction[IRP_MJ_PNP] =BulkUsb_DispatchPnP; DriverObject->MajorFunction[IRP_MJ_CREATE] =BulkUsb_DispatchCreate; DriverObject->MajorFunction[IRP_MJ_CLOSE] =BulkUsb_DispatchClose; DriverObject->MajorFunction[IRP_MJ_CLEANUP] =BulkUsb_DispatchClean; DriverObject->MajorFunction[IRP_MJ_READ] = DriverObject->MajorFunction[IRP_MJ_WRITE] =BulkUsb_DispatchReadWrite; DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] =BulkUsb_DispatchSysCtrl; DriverObject->DriverUnload =BulkUsb_DriverUnload; DriverObject->DriverExtension->AddDevice = ( PDRIVER_ADD_DEVICE) BulkUsb_AddDevice; DriverEntry_Exit; return ntStatus; } 更多源代码在附件里 |
|
|