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

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

?? sbulkpnp.c

?? S3C2410X平臺下的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一区二区三区免费野_久草精品视频
欧美电影影音先锋| www.亚洲激情.com| 国产精品水嫩水嫩| 欧美日韩亚洲综合一区二区三区| 国产乱一区二区| 一区二区三区欧美久久| 2019国产精品| 欧美久久久一区| 97久久超碰国产精品电影| 久久草av在线| 亚洲一本大道在线| 欧美激情艳妇裸体舞| 日韩一区二区三区在线观看| 欧洲国内综合视频| 91在线视频免费观看| 国产精品亚洲视频| 久久精品国产第一区二区三区| 一区二区激情视频| 中文字幕日本不卡| 国产午夜精品一区二区三区嫩草| 日韩一区二区在线观看| 欧美久久一二区| 欧美手机在线视频| 色婷婷激情综合| av成人动漫在线观看| 丁香网亚洲国际| 国产精品99久久久久久有的能看 | av毛片久久久久**hd| 韩国一区二区三区| 日本伊人色综合网| 日本女优在线视频一区二区| 三级在线观看一区二区| 亚洲高清免费视频| 天天综合色天天| 视频一区在线播放| 日韩精品成人一区二区三区| 亚洲444eee在线观看| 午夜国产不卡在线观看视频| 亚洲影视资源网| 丝袜亚洲另类欧美综合| 亚洲成人动漫精品| 日日摸夜夜添夜夜添国产精品| 午夜亚洲国产au精品一区二区| 亚洲影院理伦片| 日韩主播视频在线| 免费观看在线综合色| 精品一区二区在线免费观看| 国内久久婷婷综合| 东方aⅴ免费观看久久av| av在线播放成人| 色哟哟精品一区| 欧美色爱综合网| 91麻豆精品国产91久久久久久久久| 欧美电影一区二区| 欧美不卡一二三| 久久久久久电影| 国产精品久线观看视频| 亚洲美女在线国产| 五月天亚洲婷婷| 精品在线播放午夜| 成人精品一区二区三区中文字幕| 97久久精品人人做人人爽50路 | 欧美老人xxxx18| 欧美不卡在线视频| 国产精品理论在线观看| 一区二区高清在线| 麻豆国产一区二区| 成人h版在线观看| 在线观看av一区二区| 欧美大片在线观看一区二区| 欧美激情一区二区在线| 一区二区在线观看av| 美女一区二区三区在线观看| 成人小视频免费在线观看| 欧美中文字幕一二三区视频| 欧美电影免费提供在线观看| 亚洲欧洲精品天堂一级| 男男gaygay亚洲| 成人avav影音| 欧美一级二级在线观看| 国产性色一区二区| 亚洲国产精品自拍| 国产成人综合亚洲网站| 精品婷婷伊人一区三区三| 久久只精品国产| 亚洲一区二区影院| 国产69精品久久777的优势| 欧美日韩黄色影视| 国产精品五月天| 日韩高清不卡一区二区| av资源网一区| 日韩无一区二区| 一区二区三区欧美亚洲| 国产激情一区二区三区| 制服丝袜成人动漫| 国产精品国产三级国产aⅴ入口 | 欧美日韩二区三区| 欧美高清在线一区二区| 日韩成人免费电影| 91免费看片在线观看| 久久亚洲精华国产精华液| 亚洲高清不卡在线| 一本久久a久久精品亚洲| 精品国产一区二区精华| 亚洲成人一区在线| 色婷婷香蕉在线一区二区| 国产清纯美女被跳蛋高潮一区二区久久w| 亚洲成人自拍网| 日本韩国欧美三级| 亚洲欧洲精品一区二区三区| 国产精品一区在线观看你懂的| 欧美美女bb生活片| 亚洲三级理论片| 粉嫩av一区二区三区粉嫩| 欧美精品一区二区蜜臀亚洲| 日韩和的一区二区| 精品视频在线免费| 亚洲一区二区高清| 欧美在线免费播放| 亚洲欧美成aⅴ人在线观看| 国产麻豆视频精品| 日韩视频在线一区二区| 天天影视色香欲综合网老头| 欧美中文字幕不卡| 亚洲国产综合91精品麻豆| 一本久久a久久免费精品不卡| 中文字幕一区二区三区在线观看 | 欧美一区二区福利在线| 亚洲一区二区三区四区的| 在线精品视频一区二区| 亚洲免费在线观看| a4yy欧美一区二区三区| 国产精品五月天| av一区二区三区在线| 国产精品国产三级国产普通话99 | 亚洲国产成人高清精品| 精品婷婷伊人一区三区三| 亚洲地区一二三色| 欧美日韩国产在线观看| 性做久久久久久久久| 欧美色视频一区| 日韩精品一级二级| 欧美一区二区三区免费观看视频| 日本欧美在线看| 欧美成人性福生活免费看| 精品亚洲欧美一区| 国产调教视频一区| av亚洲产国偷v产偷v自拍| 亚洲精品高清在线| 欧美日韩成人综合天天影院| 男人操女人的视频在线观看欧美| 精品久久久三级丝袜| 国产999精品久久久久久绿帽| 国产精品久久午夜夜伦鲁鲁| 色香色香欲天天天影视综合网| 亚洲综合色自拍一区| 日韩亚洲电影在线| 国产精品夜夜嗨| 亚洲精品午夜久久久| 欧美区视频在线观看| 国产在线视频不卡二| 中文字幕制服丝袜一区二区三区| 色婷婷激情久久| 日本视频一区二区三区| 国产亚洲综合在线| 91蜜桃在线观看| 日韩av成人高清| 欧美国产成人在线| 欧美日韩成人综合| 风间由美性色一区二区三区| 亚洲精品中文字幕乱码三区| 日韩一区二区中文字幕| 成人国产视频在线观看| 午夜精品一区二区三区三上悠亚| 精品国产3级a| 色综合久久久久综合体| 久久国产生活片100| 国产精品福利一区二区| 3atv一区二区三区| 高清国产一区二区| 午夜欧美视频在线观看| 欧美激情一区二区在线| 7777精品伊人久久久大香线蕉超级流畅| 国产美女久久久久| 五月婷婷综合激情| 国产精品天干天干在观线| 6080午夜不卡| 99视频精品免费视频| 老司机免费视频一区二区三区| 亚洲乱码中文字幕| 久久新电视剧免费观看| 在线成人免费观看| av电影在线观看不卡| 黄色成人免费在线| 日韩国产在线观看| 一区二区三区在线看| 久久久美女毛片| 日韩欧美国产一二三区| 在线观看视频一区二区欧美日韩| 国产乱码字幕精品高清av|