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

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

?? usblspwr.c

?? microsoft usb開發包,能夠給大家一個很好的參考.
?? C
?? 第 1 頁 / 共 3 頁
字號:
    not in a compatible device power state. In this case, a pointer to
    the IRP_MN_SET_POWER Irp is saved into the FDO device extension 
    (deviceExtension->PowerIrp), and then a call must be
    made to PoRequestPowerIrp() to put the device into a proper power state,
    and this routine is set as the completion routine.
    We decrement our pending io count and pass the saved IRP_MN_SET_POWER Irp
    on to the next driver

Arguments:

    DeviceObject - Pointer to the device object for the class device.
    Note that we must get our own device object from the Context

    Context - Driver defined context, in this case our own functional device object ( FDO )

Return Value:

    The function value is the final status from the operation.

--*/
{
    PIRP irp;
    PDEVICE_EXTENSION deviceExtension;
    PDEVICE_OBJECT deviceObject = Context;
    NTSTATUS ntStatus;

    deviceExtension = deviceObject->DeviceExtension;

    // Get the Irp we saved for later processing in USBLS120_ProcessPowerIrp()
    // when we decided to request the Power Irp that this routine 
    // is the completion routine for.
    irp = deviceExtension->PowerIrp;

    // We will return the status set by the PDO for the power request we're completing
    ntStatus = IoStatus->Status;

    USBLS120_KdPrint( DBGLVL_HIGH,("Enter USBLS120_PoRequestCompletion()\n"));

    // we should not be in the midst of handling a self-generated power irp
    USBLS120_ASSERT( !deviceExtension->SelfPowerIrp );

    // we must pass down to the next driver in the stack
    IoCopyCurrentIrpStackLocationToNext(irp);

    // Calling PoStartNextPowerIrp() indicates that the driver is finished
    // with the previous power IRP, if any, and is ready to handle the next power IRP.
    // It must be called for every power IRP.Although power IRPs are completed only once,
    // typically by the lowest-level driver for a device, PoStartNextPowerIrp must be called
    // for every stack location. Drivers must call PoStartNextPowerIrp while the current IRP
    // stack location points to the current driver. Therefore, this routine must be called
    // before IoCompleteRequest, IoSkipCurrentStackLocation, and PoCallDriver.

    PoStartNextPowerIrp(irp);

    // PoCallDriver is used to pass any power IRPs to the PDO instead of IoCallDriver.
    // When passing a power IRP down to a lower-level driver, the caller should use
    // IoSkipCurrentIrpStackLocation or IoCopyCurrentIrpStackLocationToNext to copy the IRP to
    // the next stack location, then call PoCallDriver. Use IoCopyCurrentIrpStackLocationToNext
    // if processing the IRP requires setting a completion routine, or IoSkipCurrentStackLocation
    // if no completion routine is needed.

    PoCallDriver(
        deviceExtension->TopOfStackDeviceObject,
        irp
        );

    USBLS120_DecrementIoCount(deviceObject);

    USBLS120_KdPrint( DBGLVL_MEDIUM,("USBLS120_PoRequestCompletion() Exit IRP_MN_SET_POWER\n"));

    deviceExtension->PowerIrp = NULL;

    return ntStatus;
}




NTSTATUS
USBLS120_PowerIrp_Complete(
    IN PDEVICE_OBJECT NullDeviceObject,
    IN PIRP Irp,
    IN PVOID Context
    )
/*++

Routine Description:

    This routine is called when An IRP_MN_SET_POWER of type 'DevicePowerState'
    has been received by USBLS120_ProcessPowerIrp(), and that routine has  determined
        1) the request is for full powerup ( to PowerDeviceD0 ), and
        2) We are not already in that state
    A call is then made to PoRequestPowerIrp() with this routine set as the completion routine.


Arguments:

    DeviceObject - Pointer to the device object for the class device.

    Irp - Irp completed.

    Context - Driver defined context.

Return Value:

    The function value is the final status from the operation.

--*/
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PDEVICE_OBJECT deviceObject;
    PIO_STACK_LOCATION irpStack;
    PDEVICE_EXTENSION deviceExtension;

    USBLS120_KdPrint( DBGLVL_HIGH,("enter USBLS120_PowerIrp_Complete\n"));

    deviceObject = (PDEVICE_OBJECT) Context;

    deviceExtension = (PDEVICE_EXTENSION) deviceObject->DeviceExtension;

    //  If the lower driver returned PENDING, mark our stack location as pending also.
    if (Irp->PendingReturned) {
        IoMarkIrpPending(Irp);
    }

    irpStack = IoGetCurrentIrpStackLocation (Irp);

    // We can assert that we're a  device powerup-to D0 request,
    // because that was the only type of request we set a completion routine
    // for in the first place
    USBLS120_ASSERT(irpStack->MajorFunction == IRP_MJ_POWER);
    USBLS120_ASSERT(irpStack->MinorFunction == IRP_MN_SET_POWER);
    USBLS120_ASSERT(irpStack->Parameters.Power.Type==DevicePowerState);
    USBLS120_ASSERT(irpStack->Parameters.Power.State.DeviceState==PowerDeviceD0);

    // Now that we know we've let the lower drivers do what was needed to power up,
    //  we can set our device extension flags accordingly
    deviceExtension->CurrentDevicePowerState = PowerDeviceD0;

    Irp->IoStatus.Status = ntStatus;

    USBLS120_DecrementIoCount(deviceObject);

    USBLS120_KdPrint( DBGLVL_MEDIUM,("exit USBLS120_PowerIrp_Complete Exit IRP_MN_SET_POWER D0 complete\n"));
    return ntStatus;
}



NTSTATUS
USBLS120_SelfSuspendOrActivate(
    IN PDEVICE_OBJECT DeviceObject,
    IN BOOLEAN fSuspend
    )
/*++

Routine Description:

        Called on USBLS120_PnPAddDevice() to power down until needed (i.e., till a pipe is actually opened).
        Called on USBLS120_Create() to power up device to D0 before opening 1st pipe.
        Called on USBLS120_Close() to power down device if this is the last pipe.

Arguments:

    DeviceObject - Pointer to the device object

    fSuspend; TRUE to Suspend, FALSE to acivate.


Return Value:

    If the operation is not attemtped, SUCCESS is returned.
    If the operation is attemtped, the value is the final status from the operation.

--*/
{
    NTSTATUS ntStatus = STATUS_SUCCESS;

    POWER_STATE PowerState;
    PDEVICE_EXTENSION deviceExtension;


    deviceExtension = DeviceObject->DeviceExtension;
    USBLS120_KdPrint( DBGLVL_MAXIMUM,("Enter USBLS120_SelfSuspendOrActivate(),fSuspend = %d\n", fSuspend));


    // Can't accept request if:
    //  1) device is removed, 
    //  2) has never been started, 
    //  3) is stopped,
    //  4) has a remove request pending,
    //  5) has a stop device pending
    if ( !USBLS120_CanAcceptIoRequests( DeviceObject ) ) {
        ntStatus = STATUS_DELETE_PENDING;
        
        USBLS120_KdPrint( DBGLVL_MEDIUM,("ABORTING USBLS120_SelfSuspendOrActivate()\n"));
        return ntStatus;
    }
  

    // don't do anything if any System-generated Device Pnp irps are pending
    if ( NULL != deviceExtension->PowerIrp ) {
        USBLS120_KdPrint( DBGLVL_MAXIMUM,("Exit USBLS120_SelfSuspendOrActivate(),refusing on pending deviceExtension->PowerIrp 0x%x\n", deviceExtension->PowerIrp));
        return ntStatus;
    }

    // don't do anything if any self-generated Device Pnp irps are pending
    if ( deviceExtension->SelfPowerIrp ) {
        USBLS120_KdPrint( DBGLVL_MAXIMUM,("Exit USBLS120_SelfSuspendOrActivate(),refusing on pending deviceExtension->SelfPowerIrp\n" ));
        return ntStatus;
    }

    // don't auto-suspend if any pipes are open
    if ( fSuspend && ( 0 != deviceExtension->OpenPipeCount ) ) {
        USBLS120_KdPrint( DBGLVL_MAXIMUM,("Exit USBLS120_SelfSuspendOrActivate(),refusing to self-suspend on OpenPipeCount %d\n", deviceExtension->OpenPipeCount));
        return ntStatus;
    }

    // don't auto-activate if no pipes are open
    if ( !fSuspend && ( 0 == deviceExtension->OpenPipeCount ) ) {
        USBLS120_KdPrint( DBGLVL_MAXIMUM,("Exit USBLS120_SelfSuspendOrActivate(),refusing to self-activate, no pipes open\n"));
        return ntStatus;
    }

    // dont do anything if registry CurrentControlSet\Services\BulkUsb\Parameters\PowerDownLevel
    //  has been set to  zero, PowerDeviceD0 ( 1 ), or a bogus high value
    if ( ( deviceExtension->PowerDownLevel == PowerDeviceD0 ) || 
         ( deviceExtension->PowerDownLevel == PowerDeviceUnspecified)  ||
         ( deviceExtension->PowerDownLevel >= PowerDeviceMaximum ) ) {
        USBLS120_KdPrint( DBGLVL_MAXIMUM,("Exit USBLS120_SelfSuspendOrActivate(), refusing on deviceExtension->PowerDownLevel == %d\n", deviceExtension->PowerDownLevel));
        return ntStatus;
    }

    if ( fSuspend )
        PowerState.DeviceState = deviceExtension->PowerDownLevel;
    else
        PowerState.DeviceState = PowerDeviceD0;  // power up all the way; we're probably just about to do some IO

    ntStatus = USBLS120_SelfRequestPowerIrp( DeviceObject, PowerState );

    USBLS120_KdPrint( DBGLVL_MAXIMUM,("USBLS120_SelfSuspendOrActivate() status 0x%x on setting dev state %s\n", ntStatus, USBLS120_StringForDevState(PowerState.DeviceState ) ));

    return ntStatus;

}


NTSTATUS
USBLS120_SelfRequestPowerIrp(
    IN PDEVICE_OBJECT DeviceObject,
    IN POWER_STATE PowerState
    )
/*++

Routine Description:

    This routine is called by USBLS120_SelfSuspendOrActivate() to
    actually make the system request for a powerdown/up to PowerState.
    It first checks to see if we are already in Powerstate and immediately
    returns  SUCCESS with no further processing if so


Arguments:

    DeviceObject - Pointer to the device object

    PowerState. power state requested, e.g PowerDeviceD0.


Return Value:

    The function value is the final status from the operation.

--*/
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PDEVICE_EXTENSION deviceExtension;
    PIRP pIrp = NULL;

    deviceExtension =  DeviceObject->DeviceExtension;

    // This should have been reset in completion routine
    USBLS120_ASSERT( !deviceExtension->SelfPowerIrp );

    if (  deviceExtension->CurrentDevicePowerState ==  PowerState.DeviceState )
        return STATUS_SUCCESS;  // nothing to do

    USBLS120_KdPrint( DBGLVL_HIGH,("Enter USBLS120_SelfRequestPowerIrp() will request power irp to state %s\n",
        USBLS120_StringForDevState( PowerState.DeviceState )));

    USBLS120_IncrementIoCount(DeviceObject);

    // flag we're handling a self-generated power irp
    deviceExtension->SelfPowerIrp = TRUE;

    // actually request the Irp
    ntStatus = PoRequestPowerIrp(
                   deviceExtension->PhysicalDeviceObject,
                   IRP_MN_SET_POWER,
                   PowerState,
                   USBLS120_PoSelfRequestCompletion,
                   DeviceObject,
                   NULL
                   );


    if  ( ntStatus == STATUS_PENDING ) { 
        // status pending is the return code we wanted

        // We only need to wait for completion if we're powering up
        if ( (ULONG) PowerState.DeviceState < deviceExtension->PowerDownLevel ) {

            NTSTATUS waitStatus;

            waitStatus = KeWaitForSingleObject(
                             &deviceExtension->SelfRequestedPowerIrpEvent,
                             Suspended,
                             KernelMode,
                             FALSE,
                             NULL
                             );

        }

        ntStatus = STATUS_SUCCESS;

        deviceExtension->SelfPowerIrp = FALSE;

        USBLS120_KdPrint( DBGLVL_HIGH, ("USBLS120_SelfRequestPowerIrp() SUCCESS\n    IRP 0x%x to state %s\n",
            pIrp, USBLS120_StringForDevState(PowerState.DeviceState) ));


    }
    else {
        // The return status was not STATUS_PENDING; any other codes must be considered in error here;
        //  i.e., it is not possible to get a STATUS_SUCCESS  or any other non-error return from this call;
        USBLS120_KdPrint( DBGLVL_HIGH, ("USBLS120_SelfRequestPowerIrp() to state %s FAILED, status = 0x%x\n",
            USBLS120_StringForDevState( PowerState.DeviceState ),ntStatus));
    }

    return ntStatus;
}



NTSTATUS
USBLS120_PoSelfRequestCompletion(
    IN PDEVICE_OBJECT       DeviceObject,
    IN UCHAR                MinorFunction,
    IN POWER_STATE          PowerState,
    IN PVOID                Context,
    IN PIO_STATUS_BLOCK     IoStatus
    )
/*++

Routine Description:

    This routine is called when the driver completes a self-originated power IRP 
    that was generated by a call to USBLS120_SelfSuspendOrActivate().
    We power down whenever the last pipe is closed and power up when the first pipe is opened.

    For power-up , we set an event in our FDO extension to signal this IRP done
    so the power request can be treated as a synchronous call.
    We need to know the device is powered up before opening the first pipe, for example.
    For power-down, we do not set the event, as no caller waits for powerdown complete.

Arguments:

    DeviceObject - Pointer to the device object for the class device. ( Physical Device Object )

    Context - Driver defined context, in this case our FDO ( functional device object )

Return Value:

    The function value is the final status from the operation.

--*/
{
    PDEVICE_OBJECT deviceObject = Context;
    PDEVICE_EXTENSION deviceExtension = deviceObject->DeviceExtension;
    NTSTATUS ntStatus = IoStatus->Status;

    // we should not be in the midst of handling a system-generated power irp
    USBLS120_ASSERT( NULL == deviceExtension->PowerIrp );

    // We only need to set the event if we're powering up;
    // No caller waits on power down complete
    if ( (ULONG) PowerState.DeviceState < deviceExtension->PowerDownLevel ) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美群妇大交群中文字幕| 曰韩精品一区二区| 久久久亚洲国产美女国产盗摄 | 亚洲精品中文在线影院| 九九久久精品视频| 欧美日韩国产欧美日美国产精品| 国产亚洲欧美激情| 六月婷婷色综合| 欧美一区二区视频观看视频| 亚洲欧美国产77777| 国产+成+人+亚洲欧洲自线| 日韩一级片网址| 日韩精品一二三区| 欧美日韩国产中文| 亚洲第一在线综合网站| 色综合色狠狠天天综合色| 国产农村妇女精品| 懂色一区二区三区免费观看| 日本一区二区综合亚洲| 国产999精品久久| 国产欧美一区二区三区在线老狼| 精彩视频一区二区三区| 精品日韩在线一区| 久久成人久久爱| 精品国产乱码久久久久久影片| 麻豆精品在线视频| 欧美成人精品二区三区99精品| 蜜臀av在线播放一区二区三区| 欧美精品久久一区| 日韩电影在线观看网站| 91精品国产综合久久福利| 日韩激情一区二区| 日韩欧美在线123| 精品中文字幕一区二区| 久久久亚洲欧洲日产国码αv| 国内精品国产三级国产a久久| 久久夜色精品国产欧美乱极品| 国产麻豆午夜三级精品| 精品av综合导航| 福利一区二区在线观看| 中文字幕一区二区三区四区不卡| 91免费看片在线观看| 一区二区三区日韩| 欧美剧情片在线观看| 久久99精品久久只有精品| 国产拍揄自揄精品视频麻豆| 不卡一区二区三区四区| 亚洲高清三级视频| 精品久久久久久综合日本欧美| 国产成人啪午夜精品网站男同| 中文字幕一区二区三区精华液| 欧美伊人久久久久久午夜久久久久| 日韩福利电影在线观看| 国产亚洲人成网站| 欧洲亚洲精品在线| 国产在线视频一区二区三区| 日韩av不卡一区二区| 久久嫩草精品久久久久| 91在线无精精品入口| 日本在线观看不卡视频| 国产精品久久久久久一区二区三区 | 日本美女视频一区二区| 久久久亚洲综合| 欧美日精品一区视频| 国产精品自在在线| 亚洲综合视频在线观看| 久久综合久久综合九色| 在线看国产日韩| 国产剧情在线观看一区二区| 亚洲线精品一区二区三区| 久久蜜臀精品av| 欧美日韩不卡在线| 成人精品视频.| 日本欧美肥老太交大片| 亚洲三级电影网站| 久久伊人蜜桃av一区二区| 欧美日韩一区二区在线观看视频| 国产成人自拍在线| 麻豆专区一区二区三区四区五区| 日韩毛片精品高清免费| 欧美精品一区二区三区蜜桃 | 欧美亚州韩日在线看免费版国语版| 捆绑调教一区二区三区| 亚洲一二三四区不卡| 国产无一区二区| 欧美电影精品一区二区| 欧美日韩中文精品| 色综合久久久网| 国产91综合一区在线观看| 久久疯狂做爰流白浆xx| 日日夜夜精品视频天天综合网| 亚洲精品中文字幕乱码三区| 国产日产欧美一区二区三区| 欧美一级午夜免费电影| 91 com成人网| 欧美三级视频在线观看| 91啪亚洲精品| 91一区二区三区在线观看| 成人性生交大片免费看视频在线 | 制服丝袜亚洲色图| 欧美亚洲国产一区在线观看网站| 99久久精品国产一区| caoporn国产一区二区| 国产成人亚洲综合a∨猫咪| 国产一区二区三区香蕉 | 欧美日韩和欧美的一区二区| 色狠狠桃花综合| 91在线高清观看| 91影视在线播放| 91国偷自产一区二区开放时间| 91视频免费播放| 91在线丨porny丨国产| 色屁屁一区二区| 欧美日韩一区在线| 这里只有精品电影| 91麻豆精品国产91久久久更新时间| 欧美日韩免费一区二区三区| 欧美精品第一页| 日韩视频一区在线观看| 久久亚洲一区二区三区四区| 久久久精品国产免大香伊| 国产欧美日韩在线| 中文字幕欧美一区| 一区二区三区电影在线播| 亚洲地区一二三色| 日本aⅴ免费视频一区二区三区| 欧美96一区二区免费视频| 久久精品72免费观看| 国产精品一区二区你懂的| 99久久精品国产毛片| 欧美日韩你懂的| 精品va天堂亚洲国产| 亚洲视频一二区| 日韩精品欧美成人高清一区二区| 久久精品国产999大香线蕉| 成人黄色在线视频| 欧美日韩国产免费一区二区| 久久蜜臀中文字幕| 一区二区三区在线观看动漫| 日本一区中文字幕| 国产91在线观看丝袜| 欧美日韩1234| 国产日韩欧美一区二区三区乱码| 国产精品久久久久久亚洲毛片| 亚洲国产精品尤物yw在线观看| 精品午夜一区二区三区在线观看| 972aa.com艺术欧美| 日韩午夜电影在线观看| 亚洲欧洲日韩综合一区二区| 日韩成人一级大片| 成人国产亚洲欧美成人综合网| 欧美精品18+| 中文字幕在线一区| 麻豆成人久久精品二区三区小说| 成人免费毛片片v| 欧美一区三区四区| 亚洲精品高清在线观看| 国产一区视频导航| 欧美久久高跟鞋激| 国产精品久久久久久久久晋中 | 99精品国产热久久91蜜凸| 欧美一区二区三区播放老司机| 亚洲欧美中日韩| 精品一区二区在线播放| 欧美午夜精品一区二区三区| 国产日韩欧美精品综合| 美女视频黄 久久| 欧美日韩中文字幕一区| 亚洲日本va午夜在线影院| 国产高清精品网站| 精品免费国产二区三区| 婷婷六月综合网| 在线观看三级视频欧美| 国产精品热久久久久夜色精品三区| 欧美96一区二区免费视频| 欧美视频一区二区三区四区 | 欧美综合一区二区三区| 国产精品毛片a∨一区二区三区| 蜜臀av性久久久久蜜臀aⅴ流畅 | 欧美日韩精品一区二区| 一区二区成人在线视频 | 香蕉影视欧美成人| 欧美无砖专区一中文字| 欧美激情一区二区三区四区| 另类小说色综合网站| 日韩一级二级三级精品视频| 香蕉影视欧美成人| 欧美丰满一区二区免费视频| 亚洲国产成人高清精品| 欧美色视频一区| 洋洋成人永久网站入口| 色视频成人在线观看免| 亚洲精品水蜜桃| 色香蕉久久蜜桃| 一区二区三区在线观看欧美| 欧美中文字幕久久| 亚洲精品精品亚洲| 欧美性高清videossexo| 天天做天天摸天天爽国产一区| 欧美精品三级在线观看|