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

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

?? sspnp.c

?? WINDDK開發代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:

    return ntStatus;
}

NTSTATUS
HandleStopDevice(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP           Irp
    )
/*++

Routine Description:

    This routine services Irp of minor type IRP_MN_STOP_DEVICE

Arguments:

    DeviceObject - pointer to device object
    Irp - I/O request packet sent by the pnp manager.

Return Value:

    NT status value

--*/
{
    KIRQL             oldIrql;
    NTSTATUS          ntStatus;
    PDEVICE_EXTENSION deviceExtension;

    SSDbgPrint(3, ("HandleStopDevice - begins\n"));

    //
    // initialize variables
    //

    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

    if(WinXpOrBetter == deviceExtension->WdmVersion) {
    
        if(deviceExtension->SSEnable) {

            //
            // Cancel the timer so that the DPCs are no longer fired.
            // Thus, we are making judicious usage of our resources.
            // we do not need DPCs because the device is stopping.
            // The timers are re-initialized while handling the start
            // device irp.
            //
        
            SSDbgPrint(3, ("Cancelling the timer...\n"));
            KeCancelTimer(&deviceExtension->Timer);

            //
            // after the device is stopped, it can be surprise removed.
            // we set this to 0, so that we do not attempt to cancel
            // the timer while handling surprise remove or remove irps.
            // When we get the start device request, this flag will be
            // reinitialized.
            //
            deviceExtension->SSEnable = 0;

            //
            // make sure that if a DPC was fired before we called cancel timer,
            // then the DPC and work-time have run to their completion
            //
            KeWaitForSingleObject(&deviceExtension->NoDpcWorkItemPendingEvent, 
                                  Executive, 
                                  KernelMode, 
                                  FALSE, 
                                  NULL);

            //
            // make sure that the selective suspend request has been completed.
            //
            KeWaitForSingleObject(&deviceExtension->NoIdleReqPendEvent, 
                                  Executive, 
                                  KernelMode, 
                                  FALSE, 
                                  NULL);
        }
    }
    
    //
    // after the stop Irp is sent to the lower driver object, 
    // the driver must not send any more Irps down that touch 
    // the device until another Start has occurred.
    //

    if(deviceExtension->WaitWakeEnable) {
        
        CancelWaitWake(deviceExtension);
    }

    KeAcquireSpinLock(&deviceExtension->DevStateLock, &oldIrql);

    SET_NEW_PNP_STATE(deviceExtension, Stopped);
    
    KeReleaseSpinLock(&deviceExtension->DevStateLock, oldIrql);

    //
    // This is the right place to actually give up all the resources used
    // This might include calls to IoDisconnectInterrupt, MmUnmapIoSpace, 
    // etc.
    //
    ReleaseMemory(DeviceObject);
    
    ntStatus = DeconfigureDevice(DeviceObject);

    Irp->IoStatus.Status = ntStatus;
    Irp->IoStatus.Information = 0;
    
    IoSkipCurrentIrpStackLocation(Irp);
    ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject, Irp);

    SSDbgPrint(3, ("HandleStopDevice - ends\n"));
    
    return ntStatus;
}

NTSTATUS
HandleQueryRemoveDevice(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP           Irp
    )
/*++
 
Routine Description:

    This routine services Irp of minor type IRP_MN_QUERY_REMOVE_DEVICE

Arguments:

    DeviceObject - pointer to device object
    Irp - I/O request packet sent by the pnp manager.

Return Value:

    NT status value

--*/
{
    KIRQL             oldIrql;
    NTSTATUS          ntStatus;
    PDEVICE_EXTENSION deviceExtension;

    SSDbgPrint(3, ("HandleQueryRemoveDevice - begins\n"));

    //
    // initialize variables
    //
    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

    //
    // If we can allow removal of the device, we should set the QueueState
    // to HoldRequests so further requests will be queued. This is required
    // so that we can process queued up requests in cancel-remove just in 
    // case somebody else in the stack fails the query-remove. 
    // 

    KeAcquireSpinLock(&deviceExtension->DevStateLock, &oldIrql);

    deviceExtension->QueueState = HoldRequests;
    SET_NEW_PNP_STATE(deviceExtension, PendingRemove);

    KeReleaseSpinLock(&deviceExtension->DevStateLock, oldIrql);

    SSDbgPrint(3, ("HandleQueryRemoveDevice::"));
    SSIoDecrement(deviceExtension);

    //
    // wait for all the requests to be completed
    //

    KeWaitForSingleObject(&deviceExtension->StopEvent, 
                          Executive,
                          KernelMode, 
                          FALSE, 
                          NULL);

    Irp->IoStatus.Status = STATUS_SUCCESS;
    Irp->IoStatus.Information = 0;

    IoSkipCurrentIrpStackLocation(Irp);
    ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject, Irp);

    SSDbgPrint(3, ("HandleQueryRemoveDevice - ends\n"));

    return ntStatus;
}

NTSTATUS
HandleCancelRemoveDevice(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP           Irp
    )
/*++
 
Routine Description:

    This routine services Irp of minor type IRP_MN_CANCEL_REMOVE_DEVICE

Arguments:

    DeviceObject - pointer to device object
    Irp - I/O request packet sent by the pnp manager.

Return Value:

    NT status value

--*/
{
    KIRQL             oldIrql;
    KEVENT            event;
    NTSTATUS          ntStatus;
    PDEVICE_EXTENSION deviceExtension;

    SSDbgPrint(3, ("HandleCancelRemoveDevice - begins\n"));

    //
    // initialize variables
    //

    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

    //
    // We need to reset the QueueState flag to ProcessRequest, 
    // since the device resume its normal activities.
    //

    //
    // First check to see whether you have received cancel-remove
    // without first receiving a query-remove. This could happen if 
    // someone above us fails a query-remove and passes down the 
    // subsequent cancel-remove.
    //

    if(PendingRemove == deviceExtension->DeviceState) {

        KeInitializeEvent(&event, NotificationEvent, FALSE);

        IoCopyCurrentIrpStackLocationToNext(Irp);
        IoSetCompletionRoutine(Irp, 
                               (PIO_COMPLETION_ROUTINE)IrpCompletionRoutine, 
                               (PVOID)&event, 
                               TRUE, 
                               TRUE, 
                               TRUE);
        ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject, Irp);

        if(ntStatus == STATUS_PENDING) {

            KeWaitForSingleObject(&event, 
                                  Executive, 
                                  KernelMode, 
                                  FALSE, 
                                  NULL);

            ntStatus = Irp->IoStatus.Status;
        }

        if(NT_SUCCESS(ntStatus)) {

            KeAcquireSpinLock(&deviceExtension->DevStateLock, &oldIrql);

            deviceExtension->QueueState = AllowRequests;
            RESTORE_PREVIOUS_PNP_STATE(deviceExtension);

            KeReleaseSpinLock(&deviceExtension->DevStateLock, oldIrql);
            //
            // process the queued requests that arrive between 
            // QUERY_REMOVE and CANCEL_REMOVE
            //
            
            ProcessQueuedRequests(deviceExtension);
            
        }
    }
    else {

        // 
        // spurious cancel-remove
        //
        ntStatus = STATUS_SUCCESS;
    }

    SSDbgPrint(3, ("HandleCancelRemoveDevice - ends\n"));

    return ntStatus;
}

NTSTATUS
HandleSurpriseRemoval(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP           Irp
    )
/*++
 
Routine Description:

    This routine services Irp of minor type IRP_MN_SURPRISE_REMOVAL

Arguments:

    DeviceObject - pointer to device object
    Irp - I/O request packet sent by the pnp manager.

Return Value:

    NT status value

--*/
{
    KIRQL             oldIrql;
    NTSTATUS          ntStatus;
    PDEVICE_EXTENSION deviceExtension;

    SSDbgPrint(3, ("HandleSurpriseRemoval - begins\n"));

    //
    // initialize variables
    //

    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

    //
    // 1. fail pending requests
    // 2. return device and memory resources
    // 3. disable interfaces
    //

    if(deviceExtension->WaitWakeEnable) {
    
        CancelWaitWake(deviceExtension);
    }

    if(WinXpOrBetter == deviceExtension->WdmVersion) {
        
        if(deviceExtension->SSEnable) {

            //
            // Cancel the timer so that the DPCs are no longer fired.
            // we do not need DPCs because the device has been surprise
            // removed
            //

            SSDbgPrint(3, ("Cancelling the timer...\n"));
            KeCancelTimer(&deviceExtension->Timer);

            deviceExtension->SSEnable = 0;

            //
            // make sure that if a DPC was fired before we called cancel timer,
            // then the DPC and work-time have run to their completion
            //
            KeWaitForSingleObject(&deviceExtension->NoDpcWorkItemPendingEvent, 
                                  Executive, 
                                  KernelMode, 
                                  FALSE, 
                                  NULL);

            //
            // make sure that the selective suspend request has been completed.
            //
            KeWaitForSingleObject(&deviceExtension->NoIdleReqPendEvent, 
                                  Executive, 
                                  KernelMode, 
                                  FALSE, 
                                  NULL);
        }
    }

    KeAcquireSpinLock(&deviceExtension->DevStateLock, &oldIrql);

    deviceExtension->QueueState = FailRequests;
    SET_NEW_PNP_STATE(deviceExtension, SurpriseRemoved);

    KeReleaseSpinLock(&deviceExtension->DevStateLock, oldIrql);

    ProcessQueuedRequests(deviceExtension);

    ntStatus = IoSetDeviceInterfaceState(&deviceExtension->InterfaceName, 
                                         FALSE);

    if(!NT_SUCCESS(ntStatus)) {

        SSDbgPrint(1, ("IoSetDeviceInterfaceState::disable:failed\n"));
    }

    Irp->IoStatus.Status = STATUS_SUCCESS;
    Irp->IoStatus.Information = 0;

    IoSkipCurrentIrpStackLocation(Irp);
    ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject, Irp);

    SSDbgPrint(3, ("HandleSurpriseRemoval - ends\n"));

    return ntStatus;
}

NTSTATUS
HandleRemoveDevice(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP           Irp
    )
/*++
 
Routine Description:

    This routine services Irp of minor type IRP_MN_REMOVE_DEVICE

Arguments:

    DeviceObject - pointer to device object
    Irp - I/O request packet sent by the pnp manager.

Return Value:

    NT status value

--*/
{
    KIRQL             oldIrql;
    KEVENT            event;
    ULONG             requestCount;
    NTSTATUS          ntStatus;
    PDEVICE_EXTENSION deviceExtension;

    SSDbgPrint(3, ("HandleRemoveDevice - begins\n"));

    //
    // initialize variables
    //

    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

    //
    // The Plug & Play system has dictated the removal of this device.  We
    // have no choice but to detach and delete the device object.
    // (If we wanted to express an interest in preventing this removal,
    // we should have failed the query remove IRP).
    //

    if(SurpriseRemoved != deviceExtension->DeviceState) {

        //
        // we are here after QUERY_REMOVE
        //

        KeAcquireSpinLock(&deviceExtension->DevStateLock, &oldIrql);

        deviceExtension->QueueState = FailRequests;
        
        KeReleaseSpinLock(&deviceExtension->DevStateLock, oldIrql);

        if(deviceExtension->WaitWakeEnable) {
        
            CancelWaitWake(deviceExtension);
        }

        if(WinXpOrBetter == deviceExtension->WdmVersion) {

            if(deviceExtension->SSEnable) {

                //
                // Cancel the timer so that the DPCs are no longer fired.
                // we do not need DPCs because the device has been removed
                //

                SSDbgPrint(3, ("Cancelling the timer...\n"));
                KeCancelTimer(&deviceExtension->Timer);

                deviceExtension->SSEnable = 0;

                //
                // make sure that if a DPC was fired before we called cancel timer,
                // then the DPC and work-time have run to their completion
                //
                KeWaitForSingleObject(&deviceExtension->NoDpcWorkItemPendingEvent, 
                                      Executive, 
                                      KernelMode, 
                                      FALSE, 
                                      NULL);

                //
                // make sure that the selective suspend request has been completed.
                //
                KeWaitForSingleObject(&deviceExtension->NoIdleReqPendEvent, 
                                      Executive, 
                                      KernelMode, 
                                      FALSE, 
                                      NULL);
            }
        }

        ProcessQueuedRequests(deviceExtension);

        ntStatus = IoSetDeviceInterfaceState(&deviceExtension->InterfaceName, 
                                             FALSE);

        if(!NT_SUCCESS(ntStatus)) {

            SSDbgPrint(1, ("IoSetDeviceInterfaceState::disable:failed\n"));
        }
    }

    KeAcquireSpinLock(&deviceExtension->DevStateLock, &oldIrql);

    SET_NEW_PNP_STATE(deviceExtension, Removed);
    
    KeReleaseSpinLock(&deviceExtension->DevStateLock, oldIrql);
    
    SSWmiDeRegistration(deviceExtension);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线观看区一区二| 成人免费视频视频| 老鸭窝一区二区久久精品| 亚洲午夜久久久久久久久久久 | 久久99精品国产.久久久久| 国产福利精品一区| 色久优优欧美色久优优| 依依成人精品视频| 99久久99久久精品免费看蜜桃| 欧美一区二区三区不卡| 国产精品成人免费精品自在线观看| 午夜激情综合网| 福利一区二区在线| 2020国产成人综合网| 丝袜美腿成人在线| 欧美特级限制片免费在线观看| 国产精品免费免费| 久久黄色级2电影| 91麻豆成人久久精品二区三区| 欧美一区二区黄| 久久九九影视网| 久久精品国产**网站演员| 欧美一区二区三区婷婷月色| 亚洲国产视频在线| 国产成人精品三级| 国产午夜久久久久| 99久久777色| 亚洲男同1069视频| 欧美三电影在线| 久久精品国产一区二区三 | 国产一区二区三区av电影 | 欧美一级一区二区| 最新国产の精品合集bt伙计| 男女男精品视频网| 美国精品在线观看| 日韩欧美一区二区在线视频| 91美女片黄在线| 中文字幕亚洲不卡| 国产精品美女久久久久aⅴ| 精品99999| 久久久久国产精品麻豆ai换脸| 精品噜噜噜噜久久久久久久久试看| 91精品国产全国免费观看| 欧美乱熟臀69xxxxxx| 91麻豆精品国产综合久久久久久| 欧美午夜一区二区三区| 欧美日韩的一区二区| 日韩一区二区高清| 精品少妇一区二区三区视频免付费 | 欧美一区二区三区性视频| 欧美一区二区美女| 精品三级av在线| 欧美精品一区二区精品网| 精品av综合导航| 国产午夜精品一区二区三区嫩草| 欧美激情在线看| 亚洲色图一区二区| 亚洲国产精品人人做人人爽| 日韩精品福利网| 韩国欧美一区二区| 国v精品久久久网| 色综合咪咪久久| 欧美日韩高清一区二区| 精品国产一区二区在线观看| 欧美激情综合网| 一区二区视频在线| 日本女优在线视频一区二区| 国产中文字幕一区| 91视频91自| 91精品国产综合久久福利软件| 亚洲精品在线观看视频| 久久久久久久网| 亚洲欧美激情小说另类| 日韩成人一级片| 成人永久aaa| 欧美视频你懂的| 久久免费国产精品| 亚洲激情网站免费观看| 天天色图综合网| 国产成人免费视频一区| 欧洲精品一区二区| 亚洲精品一区二区在线观看| 亚洲欧洲av在线| 免费成人av资源网| 91亚洲午夜精品久久久久久| 欧美一三区三区四区免费在线看 | 免费在线视频一区| 成人综合在线观看| 久久综合色婷婷| 悠悠色在线精品| 国产一区日韩二区欧美三区| 色婷婷综合久久久中文字幕| 精品久久久影院| 一区二区久久久久久| 精品一区二区精品| 欧美性猛交xxxxxxxx| 国产亲近乱来精品视频| 日韩精品免费专区| 97精品国产97久久久久久久久久久久| 欧美一级高清片在线观看| 中文欧美字幕免费| 免费高清不卡av| 欧美色图第一页| 亚洲欧美综合色| 国产一区二区三区在线观看精品| 欧美在线视频全部完| 国产精品国产成人国产三级| 美女看a上一区| 欧美猛男超大videosgay| 亚洲欧洲日产国码二区| 国产乱色国产精品免费视频| 在线成人av影院| 亚洲精品国产第一综合99久久| 国产精品资源网| 亚洲精品在线三区| 精品一区二区三区久久| 9191国产精品| 亚洲不卡在线观看| 一本大道综合伊人精品热热 | 亚洲乱码国产乱码精品精小说| 国产一区中文字幕| 亚洲精品在线观看网站| 六月丁香婷婷色狠狠久久| 在线播放国产精品二区一二区四区| 亚洲男人天堂av网| 99re在线视频这里只有精品| 日本一区二区久久| 成人一道本在线| 国产欧美一区二区精品久导航| 精品无码三级在线观看视频| 制服丝袜亚洲网站| 天天综合色天天综合| 在线不卡的av| 日韩av网站免费在线| 欧美久久久久免费| 日韩av午夜在线观看| 日韩欧美一级二级三级| 国产在线看一区| 久久亚洲精品国产精品紫薇| 国产在线精品一区二区三区不卡| 精品少妇一区二区三区在线视频| 韩国毛片一区二区三区| 久久日一线二线三线suv| 国产精品一品视频| 欧美国产精品一区| 成人免费毛片app| 亚洲丝袜精品丝袜在线| 91久久精品一区二区二区| 亚洲在线视频免费观看| 欧美一区二区三区在线视频| 日韩中文字幕区一区有砖一区| 日韩一区二区三| 国产**成人网毛片九色 | 国产精品18久久久久久vr| 国产午夜精品久久久久久免费视| 国产91色综合久久免费分享| 中文字幕一区二区三| 欧美在线一区二区| 乱中年女人伦av一区二区| 国产婷婷精品av在线| 不卡的看片网站| 一级特黄大欧美久久久| 91精品国产一区二区三区 | 国产酒店精品激情| 国产精品久久久久aaaa樱花| 欧美性感一区二区三区| 看电视剧不卡顿的网站| 亚洲国产精品精华液ab| 欧美性猛交xxxx乱大交退制版| 美脚の诱脚舐め脚责91| 一色屋精品亚洲香蕉网站| 911精品国产一区二区在线| 国产精一区二区三区| 亚洲女女做受ⅹxx高潮| 日韩一区二区三区免费看 | 欧美一区二区三区小说| 国产jizzjizz一区二区| 亚洲一线二线三线视频| 久久久三级国产网站| 一本一本大道香蕉久在线精品 | 国产乱码精品1区2区3区| 一区二区在线观看免费视频播放| 日韩精品影音先锋| 97se亚洲国产综合自在线不卡| 日韩精品一二区| 中文字幕一区二区三中文字幕| 欧美一级日韩一级| 不卡的电影网站| 狠狠狠色丁香婷婷综合久久五月| 亚洲欧美日韩国产中文在线| 欧美成人精品高清在线播放| 色狠狠综合天天综合综合| 国精产品一区一区三区mba视频| 亚洲美女在线国产| 久久众筹精品私拍模特| 欧美日韩国产乱码电影| eeuss鲁片一区二区三区在线看| 麻豆精品精品国产自在97香蕉| 一区二区三区四区精品在线视频| 精品女同一区二区|