亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bulkpnp.c

?? 這是ARM9開發板上自帶的USB驅動程序
?? C
?? 第 1 頁 / 共 3 頁
字號:
            BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPnPIrp() IRP_MN_CANCEL_REMOVE_DEVICE when device not started\n"));
            IoSkipCurrentIrpStackLocation (Irp);
            ntStatus = IoCallDriver (deviceExtension->TopOfStackDeviceObject, Irp);
            BulkUsb_DecrementIoCount(DeviceObject);
            return ntStatus;
        }

                // Reset this flag so new IOCTL and IO Irp processing will be re-enabled
        deviceExtension->RemoveDeviceRequested = FALSE;
        Irp->IoStatus.Status = STATUS_SUCCESS;

        break; // end, case IRP_MN_CANCEL_REMOVE_DEVICE

    case IRP_MN_SURPRISE_REMOVAL:
        BULKUSB_KdPrint( DBGLVL_MEDIUM,("BulkUsb_ProcessPnPIrp() IRP_MN_SURPRISE_REMOVAL\n"));

        // For a surprise-style device removal ( i.e. sudden cord yank ),
        // the physical device has already been removed so the PnP Manager sends
        // the remove IRP without a prior query-remove. A device can be in any state
        // when it receives a remove IRP as a result of a surprise-style removal.

        // match the inc at the begining of the dispatch routine
        BulkUsb_DecrementIoCount(DeviceObject);

        //
        // Once DeviceRemoved is set no new IOCTL or read/write irps will be passed
        // down the stack to lower drivers; all will be quickly failed
        //
        deviceExtension->DeviceRemoved = TRUE;

        // Cancel any pending io requests; we may not have gotten a query first!
        BulkUsb_CancelPendingIo( DeviceObject );

        // If any pipes are still open, call USBD with URB_FUNCTION_ABORT_PIPE
        // This call will also close the pipes; if any user close calls get through,
        // they will be noops
        BulkUsb_AbortPipes( DeviceObject );

        //
        // Mark this handled
        //
        Irp->IoStatus.Status = STATUS_SUCCESS;

        // We don't explicitly wait for the below driver to complete, but just make
        // the call and go on, finishing cleanup
        IoCopyCurrentIrpStackLocationToNext(Irp);

        ntStatus = IoCallDriver(stackDeviceObject,
                                Irp);

        return ntStatus;

    case IRP_MN_REMOVE_DEVICE:

        // The PnP Manager uses this IRP to direct drivers to remove a device.
        // For a "polite" device removal, the PnP Manager sends an
        // IRP_MN_QUERY_REMOVE_DEVICE prior to the remove IRP. In this case,
        // the device is in the remove-pending state when the remove IRP arrives.
        // For a surprise-style device removal ( i.e. sudden cord yank ),
        // the physical device has already been removed and the PnP Manager may not
        //  have sent IRP_MN_SURPRISE_REMOVAL. A device can be in any state
        // when it receives a remove IRP as a result of a surprise-style removal.

        // match the inc at the begining of the dispatch routine
        BulkUsb_DecrementIoCount(DeviceObject);

        //
        // Once DeviceRemoved is set no new IOCTL or read/write irps will be passed
        // down the stack to lower drivers; all will be quickly failed
        //
        deviceExtension->DeviceRemoved = TRUE;

        // Cancel any pending io requests; we may not have gotten a query first!
        BulkUsb_CancelPendingIo( DeviceObject );

        // If any pipes are still open, call USBD with URB_FUNCTION_ABORT_PIPE
        // This call will also close the pipes; if any user close calls get through,
        // they will be noops
        BulkUsb_AbortPipes( DeviceObject );

        // We don't explicitly wait for the below driver to complete, but just make
        // the call and go on, finishing cleanup
        IoCopyCurrentIrpStackLocationToNext(Irp);

        ntStatus = IoCallDriver(stackDeviceObject,
                                Irp);
        //
        // The final decrement to device extension PendingIoCount == 0
                // will set deviceExtension->RemoveEvent, enabling device removal.
                // If there is no pending IO at this point, the below decrement will be it.
        //
        BulkUsb_DecrementIoCount(DeviceObject);


        // wait for any io request pending in our driver to
        // complete for finishing the remove

        KeWaitForSingleObject(
                    &deviceExtension->RemoveEvent,
                    Suspended,
                    KernelMode,
                    FALSE,
                    NULL);

        //
        // Delete the link and FDO we created
        //
        BulkUsb_RemoveDevice(DeviceObject);


        BULKUSB_KdPrint( DBGLVL_DEFAULT,("BulkUsb_ProcessPnPIrp() Detaching from %08X\n",
                         deviceExtension->TopOfStackDeviceObject));

        IoDetachDevice(deviceExtension->TopOfStackDeviceObject);

        BULKUSB_KdPrint( DBGLVL_DEFAULT,("BulkUsb_ProcessPnPIrp() Deleting %08X\n",
                         DeviceObject));

        IoDeleteDevice (DeviceObject);

        return ntStatus; // end, case IRP_MN_REMOVE_DEVICE


    default:

        //
        // In this case we must not touch the status. As ntstatus is
        // STATUS_SUCCESS, we will skip the failure case and pass down the IRP
        // untouched.
        //
        BULKUSB_KdPrint( DBGLVL_MAXIMUM,("BulkUsb_ProcessPnPIrp() Minor PnP IOCTL not handled\n"));
    } /* case MinorFunction  */


    if (!NT_SUCCESS(ntStatus)) {

        // if anything went wrong, return failure  without passing Irp down
        Irp->IoStatus.Status = ntStatus;
        IoCompleteRequest (Irp,
                                           IO_NO_INCREMENT
                                           );

        BulkUsb_DecrementIoCount(DeviceObject);

        BULKUSB_KdPrint( DBGLVL_MAXIMUM,("BulkUsb_ProcessPnPIrp() Exit BulkUsb_ProcessPnPIrp FAILURE %x\n", ntStatus));
        return ntStatus;
    }

    IoCopyCurrentIrpStackLocationToNext(Irp);

    //
    // All PNP_POWER messages get passed to the TopOfStackDeviceObject
    // we were given in PnPAddDevice
    //

    BULKUSB_KdPrint( DBGLVL_MAXIMUM,("BulkUsb_ProcessPnPIrp() Passing PnP Irp down, status = %x\n", ntStatus));

    ntStatus = IoCallDriver(stackDeviceObject,
                            Irp);

    BulkUsb_DecrementIoCount(DeviceObject);

    BULKUSB_KdPrint( DBGLVL_MAXIMUM,("BulkUsb_ProcessPnPIrp() Exit BulkUsb_ProcessPnPIrp %x\n", ntStatus));

    return ntStatus;
}


NTSTATUS
BulkUsb_PnPAddDevice(
    IN PDRIVER_OBJECT DriverObject,
    IN PDEVICE_OBJECT PhysicalDeviceObject
    )
/*++

Routine Description:

    This routine is called to create and initialize our Functional Device Object (FDO).
    For monolithic drivers, this is done in DriverEntry(), but Plug and Play devices
    wait for a PnP event

Arguments:

    DriverObject - pointer to the driver object for this instance of BulkUsb

    PhysicalDeviceObject - pointer to a device object created by the bus

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

--*/
{
    NTSTATUS                ntStatus = STATUS_SUCCESS;
    PDEVICE_OBJECT          deviceObject = NULL;
    PDEVICE_EXTENSION       deviceExtension;
    USBD_VERSION_INFORMATION versionInformation;
    ULONG i;



    BULKUSB_KdPrint( DBGLVL_DEFAULT,("enter BulkUsb_PnPAddDevice()\n"));

    //
    // create our funtional device object (FDO)
    //

    ntStatus =
        BulkUsb_CreateDeviceObject(DriverObject, PhysicalDeviceObject, &deviceObject);

    if (NT_SUCCESS(ntStatus)) {
        deviceExtension = deviceObject->DeviceExtension;

        //
        // we support direct io for read/write
        //
        deviceObject->Flags |= DO_DIRECT_IO;


        //Set this flag causes the driver to not receive a IRP_MN_STOP_DEVICE
        //during suspend and also not get an IRP_MN_START_DEVICE during resume.
        //This is neccesary because during the start device call,
        // the GetDescriptors() call  will be failed by the USB stack.
        deviceObject->Flags |= DO_POWER_PAGABLE;

        // initialize our device extension
        //
        // remember the Physical device Object
        //
        deviceExtension->PhysicalDeviceObject=PhysicalDeviceObject;

        //
        // Attach to the PDO
        //

        deviceExtension->TopOfStackDeviceObject =
            IoAttachDeviceToDeviceStack(deviceObject, PhysicalDeviceObject);

        // Get a copy of the physical device's capabilities into a
        // DEVICE_CAPABILITIES struct in our device extension;
        // We are most interested in learning which system power states
        // are to be mapped to which device power states for handling
        // IRP_MJ_SET_POWER Irps.
        BulkUsb_QueryCapabilities(deviceExtension->TopOfStackDeviceObject,
                                 &deviceExtension->DeviceCapabilities);


                // We want to determine what level to auto-powerdown to; This is the lowest
                //  sleeping level that is LESS than D3;
                // If all are set to D3, auto powerdown/powerup will be disabled.

        deviceExtension->PowerDownLevel = PowerDeviceUnspecified; // init to disabled
        for (i=PowerSystemSleeping1; i<= PowerSystemSleeping3; i++) {

                        if ( deviceExtension->DeviceCapabilities.DeviceState[i] < PowerDeviceD3 )
                                deviceExtension->PowerDownLevel = deviceExtension->DeviceCapabilities.DeviceState[i];
        }

#if DBG

        // May want override auto power-down level from registry;
        // ( CurrentControlSet\Services\BulkUsb\Parameters )
                // Setting to 0 or 1 in registry disables auto power-down
        BulkUsb_GetRegistryDword( BULKUSB_REGISTRY_PARAMETERS_PATH,
                                         L"PowerDownLevel",
                                         &(deviceExtension->PowerDownLevel) );



        //
        // display the device  caps
        //

        BULKUSB_KdPrint( DBGLVL_MEDIUM,(" >>>>>> DeviceCaps\n"));
        BULKUSB_KdPrint( DBGLVL_MEDIUM,(" SystemWake = %s\n",
            BULKUSB_StringForSysState( deviceExtension->DeviceCapabilities.SystemWake ) ));
        BULKUSB_KdPrint( DBGLVL_MEDIUM,(" DeviceWake = %s\n",
            BULKUSB_StringForDevState( deviceExtension->DeviceCapabilities.DeviceWake) ));

        for (i=PowerSystemUnspecified; i< PowerSystemMaximum; i++) {

            BULKUSB_KdPrint( DBGLVL_MEDIUM,(" Device State Map: sysstate %s = devstate %s\n",
                 BULKUSB_StringForSysState( i ),
                 BULKUSB_StringForDevState( deviceExtension->DeviceCapabilities.DeviceState[i] ) ));
        }
        BULKUSB_KdPrint( DBGLVL_MEDIUM,(" <<<<<<<<DeviceCaps\n"));
#endif
        // We keep a pending IO count ( extension->PendingIoCount )  in the device extension.
        // The first increment of this count is done on adding the device.
        // Subsequently, the count is incremented for each new IRP received and
        // decremented when each IRP is completed or passed on.

        // Transition to 'one' therefore indicates no IO is pending and signals
        // deviceExtension->NoPendingIoEvent. This is needed for processing
        // IRP_MN_QUERY_REMOVE_DEVICE

        // Transition to 'zero' signals an event ( deviceExtension->RemoveEvent )
        // to enable device removal. This is used in processing for IRP_MN_REMOVE_DEVICE
        //
        BulkUsb_IncrementIoCount(deviceObject);

    }

    USBD_GetUSBDIVersion(&versionInformation);



    if( NT_SUCCESS( ntStatus ) )
    {
        NTSTATUS actStat;
        // try to power down device until IO actually requested
        actStat = BulkUsb_SelfSuspendOrActivate( deviceObject, TRUE );

        deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
    }


    BULKUSB_KdPrint( DBGLVL_DEFAULT,("exit BulkUsb_PnPAddDevice() (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品欧美久久久久久动漫| 日本一区二区高清| 日本不卡视频在线| 在线成人高清不卡| 日本午夜精品视频在线观看| 精品日韩欧美一区二区| 国产精品一区三区| 亚洲国产电影在线观看| 99精品视频一区二区三区| 亚洲与欧洲av电影| 制服丝袜亚洲色图| 国产一区二区三区在线观看免费 | 国产精品灌醉下药二区| 成人动漫在线一区| 一区二区不卡在线视频 午夜欧美不卡在 | 韩国成人在线视频| 国产日产精品一区| 在线亚洲欧美专区二区| 奇米四色…亚洲| 国产亚洲精品bt天堂精选| 91婷婷韩国欧美一区二区| 亚洲一区二区三区精品在线| 在线观看91av| a级精品国产片在线观看| 亚洲成人久久影院| 亚洲精品在线观看视频| av网站免费线看精品| 亚洲v精品v日韩v欧美v专区| 久久毛片高清国产| 久久这里只有精品6| 欧美精品一区二区三区蜜桃视频| 国产福利一区二区三区视频在线| 欧美日韩国产经典色站一区二区三区| 亚洲国产精品激情在线观看| 日本黄色一区二区| 狠狠色综合日日| 亚洲一区二区精品视频| 2023国产一二三区日本精品2022| 99re热这里只有精品视频| 日本人妖一区二区| 亚洲蜜臀av乱码久久精品| 日韩视频国产视频| 91久久精品日日躁夜夜躁欧美| 精品一区二区综合| 亚洲成人1区2区| 国产精品国产三级国产aⅴ原创 | 一区二区三区四区高清精品免费观看| 日韩视频国产视频| 欧美日韩在线播放| 99国产精品久久| 国产不卡高清在线观看视频| 热久久一区二区| 亚洲一二三四久久| 中文字幕电影一区| 久久久久青草大香线综合精品| 欧美在线|欧美| av在线播放一区二区三区| 国产剧情一区在线| 日本一不卡视频| 亚洲一区二区三区四区的| 国产精品久久久一本精品| 久久久久国产精品麻豆ai换脸 | 亚洲精品一区二区三区精华液 | 在线观看亚洲专区| 波多野结衣精品在线| 国模少妇一区二区三区| 日韩av中文在线观看| 亚洲一区二区三区四区的 | 午夜国产精品一区| 一本一道久久a久久精品 | 一区二区三区小说| 99精品国产热久久91蜜凸| 午夜影院久久久| 久久九九影视网| 天天综合色天天| 成人性生交大片免费看视频在线| 日韩av午夜在线观看| 亚洲成av人在线观看| 亚洲另类在线视频| 一区二区三区中文字幕精品精品 | 国产麻豆午夜三级精品| 美女久久久精品| 精品制服美女久久| 麻豆一区二区在线| 国内不卡的二区三区中文字幕| 国产在线视频一区二区| 国产成人精品亚洲777人妖| 国产成人精品在线看| 成人网在线免费视频| 99久久免费视频.com| 一本久久精品一区二区| 色一情一伦一子一伦一区| 色88888久久久久久影院野外| 日本高清成人免费播放| 欧美日韩国产大片| 欧美成va人片在线观看| 国产亚洲一二三区| 成人免费小视频| 亚洲第一狼人社区| 日本不卡1234视频| 风流少妇一区二区| 91成人国产精品| 欧美电影精品一区二区| 国产欧美精品一区| 亚洲最快最全在线视频| 日韩电影免费在线看| 国产盗摄一区二区三区| 93久久精品日日躁夜夜躁欧美| 欧美在线观看视频一区二区| 日韩免费一区二区| 中文字幕一区二区三区不卡| 亚洲国产日韩精品| 国产精品亚洲专一区二区三区| 99久久久久久99| 日韩一区二区三区在线视频| 久久久99精品久久| 亚洲电影视频在线| 国产a久久麻豆| 制服.丝袜.亚洲.中文.综合| 国产色91在线| 亚洲风情在线资源站| 国产成人亚洲综合色影视| 欧美视频在线观看一区二区| 久久久久久久一区| 午夜av一区二区三区| 99re视频精品| 久久亚洲精精品中文字幕早川悠里 | 国产亚洲短视频| 丁香五精品蜜臀久久久久99网站 | 亚洲午夜久久久久久久久电影网 | 中文字幕一区二区三区蜜月| 日本va欧美va欧美va精品| 99久久国产综合色|国产精品| 欧美日韩国产精品成人| 综合欧美一区二区三区| 免费看欧美女人艹b| 91黄色激情网站| 国产精品毛片无遮挡高清| 日韩中文字幕麻豆| 色哦色哦哦色天天综合| 国产校园另类小说区| 日韩国产在线一| 日本高清免费不卡视频| 国产精品久久久久久久岛一牛影视| 麻豆国产精品视频| 777午夜精品免费视频| 亚洲影院久久精品| 91在线国产福利| **网站欧美大片在线观看| 国产剧情一区在线| 精品粉嫩aⅴ一区二区三区四区| 亚洲一区二区三区在线看| 91视频在线观看免费| 国产精品欧美一区喷水| 国产精品主播直播| 精品国精品自拍自在线| 日韩av电影天堂| 91精品麻豆日日躁夜夜躁| 亚洲一区二区高清| 在线区一区二视频| 一区二区三区.www| 色素色在线综合| 亚洲免费观看在线观看| 97se亚洲国产综合自在线观| 日韩美女视频一区二区 | 经典三级在线一区| 日韩亚洲欧美一区二区三区| 日本在线不卡视频| 欧美一级高清片| 精品午夜久久福利影院| 精品国产91亚洲一区二区三区婷婷| 美女视频黄 久久| 亚洲精品在线一区二区| 国产综合色视频| 国产日产精品一区| 97se亚洲国产综合自在线不卡| 亚洲欧美色一区| 在线看国产日韩| 青青草91视频| 久久亚洲精华国产精华液| 国产在线不卡一卡二卡三卡四卡| 亚洲精品一线二线三线无人区| 国产精品18久久久久| 国产精品高潮呻吟| 欧美日韩中文精品| 美女www一区二区| 久久久综合视频| av高清不卡在线| 亚洲成a人片在线不卡一二三区| 91精品国产综合久久精品app| 日本不卡视频一二三区| 久久女同互慰一区二区三区| 成人a免费在线看| 一区二区三区四区激情| 日韩欧美一区二区视频| 国产成人久久精品77777最新版本| 亚洲欧美另类综合偷拍| 91精品久久久久久久99蜜桃| 国产精品综合视频| 亚洲精品v日韩精品|