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

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

?? buspdo.c

?? USB HASP key emulator, based on USB bus driver
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*++

Copyright (c) 2004 Chingachguk & Denger2k All Rights Reserved

Module Name:

    BusPdo.c

Abstract:

    This module handles plug & play calls for the child PDO.

Environment:

    kernel mode only

Notes:


Revision History:


--*/

#include <ntddk.h>
#include ".\Include\driver.h"
#include "vusb.h"
#include "stdio.h"
#include <wdmguid.h>

#define VENDORNAME  L"Aladdin "
#define MODEL       L"USB Key"

   
#ifdef ALLOC_PRAGMA
#pragma alloc_text (PAGE, Bus_PDO_PnP)
#pragma alloc_text (PAGE, Bus_PDO_QueryDeviceCaps)
#pragma alloc_text (PAGE, Bus_PDO_QueryDeviceId)
#pragma alloc_text (PAGE, Bus_PDO_QueryDeviceText)
#pragma alloc_text (PAGE, Bus_PDO_QueryResources)
#pragma alloc_text (PAGE, Bus_PDO_QueryResourceRequirements)
#pragma alloc_text (PAGE, Bus_PDO_QueryDeviceRelations)
#pragma alloc_text (PAGE, Bus_PDO_QueryBusInformation)
#pragma alloc_text (PAGE, Bus_GetDeviceCapabilities)
#pragma alloc_text (PAGE, Bus_LoadDumpsFromRegistry)
#endif

NTSTATUS
Bus_PDO_PnP (
    IN PDEVICE_OBJECT       DeviceObject,
    IN PIRP                 Irp,
    IN PIO_STACK_LOCATION   IrpStack,
    IN PPDO_DEVICE_DATA     DeviceData
    )
/*++
Routine Description:
    Handle requests from the Plug & Play system for the devices on the BUS

--*/
{
    NTSTATUS                status;

    PAGED_CODE ();


    //
    // NB: Because we are a bus enumerator, we have no one to whom we could
    // defer these irps.  Therefore we do not pass them down but merely
    // return them.
    //

    switch (IrpStack->MinorFunction) {

    case IRP_MN_START_DEVICE:
    
        //            
        // Here we do what ever initialization and ``turning on'' that is
        // required to allow others to access this device.
        // Power up the device.
        //
        DeviceData->DevicePowerState = PowerDeviceD0;
        SET_NEW_PNP_STATE(DeviceData, Started);
        status = STATUS_SUCCESS;
        break;

    case IRP_MN_STOP_DEVICE:
    
        //
        // Here we shut down the device and give up and unmap any resources
        // we acquired for the device.
        //
        
        SET_NEW_PNP_STATE(DeviceData, Stopped);
        status = STATUS_SUCCESS;
        break;


    case IRP_MN_QUERY_STOP_DEVICE:

        //
        // No reason here why we can't stop the device.
        // If there were a reason we should speak now, because answering success
        // here may result in a stop device irp.
        //

        SET_NEW_PNP_STATE(DeviceData, StopPending);
        status = STATUS_SUCCESS;
        break;

    case IRP_MN_CANCEL_STOP_DEVICE:

        //
        // The stop was canceled.  Whatever state we set, or resources we put
        // on hold in anticipation of the forthcoming STOP device IRP should be
        // put back to normal.  Someone, in the long list of concerned parties,
        // has failed the stop device query.
        //

        //
        // First check to see whether you have received cancel-stop
        // without first receiving a query-stop. This could happen if someone
        // above us fails a query-stop and passes down the subsequent
        // cancel-stop.
        //
        
        if(StopPending == DeviceData->DevicePnPState)
        {
            //
            // We did receive a query-stop, so restore.
            //             
            RESTORE_PREVIOUS_PNP_STATE(DeviceData);
        }
        status = STATUS_SUCCESS;// We must not fail this IRP.
        break;

    case IRP_MN_QUERY_REMOVE_DEVICE:
    
        //
        // Check to see whether the device can be removed safely.
        // If not fail this request. This is the last opportunity
        // to do so.
        //
        if(DeviceData->VUsbInterfaceRefCount){
            //
            // Somebody is still using our interface. 
            // We must fail remove.
            //
            status = STATUS_UNSUCCESSFUL;
            break;
        }

        SET_NEW_PNP_STATE(DeviceData, RemovePending);
        status = STATUS_SUCCESS;
        break;

    case IRP_MN_CANCEL_REMOVE_DEVICE:
        
        //
        // Clean up a remove that did not go through.
        //
        
        //
        // 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(RemovePending == DeviceData->DevicePnPState)
        {
            //
            // We did receive a query-remove, so restore.
            //             
            RESTORE_PREVIOUS_PNP_STATE(DeviceData);
        }
        status = STATUS_SUCCESS; // We must not fail this IRP.
        break;
        
    case IRP_MN_SURPRISE_REMOVAL:

        //
        // We should stop all access to the device and relinquish all the
        // resources. Let's just mark that it happened and we will do 
        // the cleanup later in IRP_MN_REMOVE_DEVICE.
        //

        SET_NEW_PNP_STATE(DeviceData, SurpriseRemovePending);
        status = STATUS_SUCCESS;
        break;

    case IRP_MN_REMOVE_DEVICE:

        //
        // Present is set to true when the pdo is exposed via PlugIn IOCTL.
        // It is set to FALSE when a UnPlug IOCTL is received. 
        // We will delete the PDO only after we have reported to the 
        // Plug and Play manager that it's missing.
        //
        
        if (DeviceData->ReportedMissing) {
            PFDO_DEVICE_DATA fdoData;

            SET_NEW_PNP_STATE(DeviceData, Deleted);
            
            //
            // Remove the PDO from the list and decrement the count of PDO.
            // Don't forget to synchronize access to the FDO data.
            // If the parent FDO is deleted before child PDOs, the ParentFdo
            // pointer will be NULL. This could happen if the child PDO
            // is in a SurpriseRemovePending state when the parent FDO
            // is removed.
            //
            
            if(DeviceData->ParentFdo) {           
                fdoData = FDO_FROM_PDO(DeviceData);
                ExAcquireFastMutex (&fdoData->Mutex);
                RemoveEntryList (&DeviceData->Link);
                fdoData->NumPDOs--;
                ExReleaseFastMutex (&fdoData->Mutex);
            }
            //
            // Free up resources associated with PDO and delete it.
            //
            status = Bus_DestroyPdo(DeviceObject, DeviceData);
            break;

        }
        if (DeviceData->Present) {
            //
            // When the device is disabled, the PDO transitions from 
            // RemovePending to NotStarted. We shouldn't delete
            // the PDO because a) the device is still present on the bus,
            // b) we haven't reported missing to the PnP manager.
            //
            
            SET_NEW_PNP_STATE(DeviceData, NotStarted);
            status = STATUS_SUCCESS;
        } else {
            ASSERT(DeviceData->Present);
            status = STATUS_SUCCESS;
        }
        break;

    case IRP_MN_QUERY_CAPABILITIES:

        //
        // Return the capabilities of a device, such as whether the device 
        // can be locked or ejected..etc
        //

        status = Bus_PDO_QueryDeviceCaps(DeviceData, Irp);
        
        break;

    case IRP_MN_QUERY_ID:

        // Query the IDs of the device

        Bus_KdPrint_Cont (DeviceData, BUS_DBG_PNP_TRACE,
                ("\tQueryId Type: %s\n",
                DbgDeviceIDString(IrpStack->Parameters.QueryId.IdType)));

        status = Bus_PDO_QueryDeviceId(DeviceData, Irp);

        break;

    case IRP_MN_QUERY_DEVICE_RELATIONS:

        Bus_KdPrint_Cont (DeviceData, BUS_DBG_PNP_TRACE, 
            ("\tQueryDeviceRelation Type: %s\n",DbgDeviceRelationString(\
                    IrpStack->Parameters.QueryDeviceRelations.Type)));

        status = Bus_PDO_QueryDeviceRelations(DeviceData, Irp);
        
        break;
        
    case IRP_MN_QUERY_DEVICE_TEXT:
               
        status = Bus_PDO_QueryDeviceText(DeviceData, Irp);

        break;

    case IRP_MN_QUERY_RESOURCES:
           
        status = Bus_PDO_QueryResources(DeviceData, Irp);
        
        break;
        
    case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
               
        status = Bus_PDO_QueryResourceRequirements(DeviceData, Irp);

        break;

    case IRP_MN_QUERY_BUS_INFORMATION:
               
        status = Bus_PDO_QueryBusInformation(DeviceData, Irp);

        break;

    case IRP_MN_DEVICE_USAGE_NOTIFICATION:

        //
        // OPTIONAL for bus drivers.
        // This bus drivers any of the bus's descendants 
        // (child device, child of a child device, etc.) do not 
        // contain a memory file namely paging file, dump file, 
        // or hibernation file. So we  fail this Irp.
        //
        
        status = STATUS_UNSUCCESSFUL;
        break;
        
    case IRP_MN_EJECT:
    
        //
        // For the device to be ejected, the device must be in the D3 
        // device power state (off) and must be unlocked 
        // (if the device supports locking). Any driver that returns success 
        // for this IRP must wait until the device has been ejected before 
        // completing the IRP.
        //
        DeviceData->Present = FALSE;
        
        status = STATUS_SUCCESS;
        break;
        
    case IRP_MN_QUERY_INTERFACE: 
        // 
        // This request enables a driver to export a direct-call 
        // interface to other drivers. A bus driver that exports 
        // an interface must handle this request for its child 
        // devices (child PDOs).
        //
        status = Bus_PDO_QueryInterface(DeviceData, Irp);
        break;
        
    case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:

        //
        // OPTIONAL for bus drivers.
        // The PnP Manager sends this IRP to a device 
        // stack so filter and function drivers can adjust the 
        // resources required by the device, if appropriate.
        //
        
        //break;
        
    //case IRP_MN_QUERY_PNP_DEVICE_STATE:
    
        //
        // OPTIONAL for bus drivers.
        // The PnP Manager sends this IRP after the drivers for 
        // a device return success from the IRP_MN_START_DEVICE 
        // request. The PnP Manager also sends this IRP when a 
        // driver for the device calls IoInvalidateDeviceState.
        //
        
        // break;
                
    //case IRP_MN_READ_CONFIG:
    //case IRP_MN_WRITE_CONFIG:

        //
        // Bus drivers for buses with configuration space must handle 
        // this request for their child devices. Our devices don't
        // have a config space.
        //

        // break;
       
    //case IRP_MN_SET_LOCK:

        // 
        // Our device is not a lockable device
        // so we don't support this Irp.
        //

        // break;

    default:

        //
        //Bus_KdPrint_Cont (DeviceData, BUS_DBG_PNP_TRACE,("\t Not handled\n"));
        // For PnP requests to the PDO that we do not understand we should
        // return the IRP WITHOUT setting the status or information fields.
        // These fields may have already been set by a filter (eg acpi).
        status = Irp->IoStatus.Status;

        break;
    }

    Irp->IoStatus.Status = status;
    IoCompleteRequest (Irp, IO_NO_INCREMENT);

    return status;
}

NTSTATUS
Bus_PDO_QueryDeviceCaps(
    IN PPDO_DEVICE_DATA     DeviceData,
    IN  PIRP   Irp )
/*++

Routine Description:

    When a device is enumerated, but before the function and 
    filter drivers are loaded for the device, the PnP Manager 
    sends an IRP_MN_QUERY_CAPABILITIES request to the parent 
    bus driver for the device. The bus driver must set any 
    relevant values in the DEVICE_CAPABILITIES structure and 
    return it to the PnP Manager. 
    
Arguments:

    DeviceData - Pointer to the PDO's device extension.
    Irp          - Pointer to the irp.

Return Value:

    NT STATUS

--*/
{

    PIO_STACK_LOCATION      stack;
    PDEVICE_CAPABILITIES    deviceCapabilities;
    DEVICE_CAPABILITIES     parentCapabilities;
    NTSTATUS                status;
    
    PAGED_CODE ();

    stack = IoGetCurrentIrpStackLocation (Irp);

    //
    // Get the packet.
    //
    deviceCapabilities=stack->Parameters.DeviceCapabilities.Capabilities;

    //
    // Set the capabilities.
    //

    if(deviceCapabilities->Version != 1 || 
            deviceCapabilities->Size < sizeof(DEVICE_CAPABILITIES))
    {
       return STATUS_UNSUCCESSFUL; 
    }
    
    //
    // Get the device capabilities of the parent
    //
    status = Bus_GetDeviceCapabilities(
        FDO_FROM_PDO(DeviceData)->NextLowerDriver, &parentCapabilities);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人妖精视频yjsp地址| 99久久国产免费看| 欧美一级高清片在线观看| 美女一区二区久久| 亚洲精品一区二区三区福利| 亚洲午夜激情av| 欧美一级二级三级乱码| 国产乱码字幕精品高清av | 国产成人在线观看| 亚洲精品国久久99热| 91精品国产日韩91久久久久久| 国产综合色产在线精品| 亚洲欧美另类久久久精品2019| 在线一区二区视频| 97se亚洲国产综合自在线不卡| 精品视频在线免费看| 久久99最新地址| 中文字幕人成不卡一区| 在线亚洲一区二区| 国产在线不卡一区| 这里是久久伊人| 亚洲香蕉伊在人在线观| 99久久综合狠狠综合久久| 久久久精品日韩欧美| 蜜臀久久久99精品久久久久久| 欧美无砖砖区免费| 亚洲综合一区二区精品导航| 91在线观看一区二区| 国产精品入口麻豆九色| 成人性生交大片免费看在线播放| 久久品道一品道久久精品| 精品一区二区三区在线观看国产| 日韩一区二区免费在线电影| 视频一区欧美精品| 欧美丰满嫩嫩电影| 视频一区二区中文字幕| 欧美一区二区观看视频| 日本中文一区二区三区| 欧美一级黄色片| 国模冰冰炮一区二区| 国产日韩欧美精品在线| 不卡一区二区在线| 亚洲柠檬福利资源导航| 欧美视频日韩视频在线观看| 婷婷开心久久网| 日韩一区二区三区视频在线观看| 美女精品一区二区| 久久久久久久久久久久电影| 成年人国产精品| 亚洲高清视频中文字幕| 日韩欧美一区在线观看| 成人午夜av电影| 亚洲嫩草精品久久| 日韩美一区二区三区| 成人亚洲精品久久久久软件| 一二三四区精品视频| 777xxx欧美| 国产成人av一区二区三区在线| 国产精品电影院| 欧美日韩你懂得| 国产精品一二三四| 亚洲欧洲av另类| 欧美裸体bbwbbwbbw| 国产在线国偷精品免费看| 亚洲日本护士毛茸茸| 欧美一区二区三区爱爱| 国产99精品国产| 亚洲成人自拍网| 中文字幕精品三区| 91精品国产高清一区二区三区| 国产精品小仙女| 亚洲成人一区在线| 日韩精品最新网址| 在线欧美日韩国产| 国产精品一区二区三区网站| 一区二区国产视频| 久久网这里都是精品| 欧美伊人久久久久久久久影院| 国产一区二区在线电影| 亚洲国产精品一区二区www在线| 久久先锋影音av| 日韩欧美三级在线| 欧美自拍偷拍午夜视频| 国产suv精品一区二区6| 天堂成人免费av电影一区| 国产精品乱码人人做人人爱 | 精品国产一区久久| 欧美怡红院视频| heyzo一本久久综合| 久久er99热精品一区二区| 午夜影院在线观看欧美| 亚洲另类春色国产| **网站欧美大片在线观看| 久久久不卡影院| 日韩精品一区二区三区视频在线观看 | 喷水一区二区三区| 一级日本不卡的影视| 欧美国产一区视频在线观看| 精品成人免费观看| 91精品国产综合久久蜜臀| 欧洲另类一二三四区| 99国产麻豆精品| 99免费精品视频| av资源网一区| 91老师片黄在线观看| 成人av免费观看| 国产成人免费高清| 国产成人在线影院| 国产精品一区在线观看乱码| 国产精品自拍在线| 国产麻豆精品视频| 国产精品自拍av| 国产一区二区三区精品欧美日韩一区二区三区| 丝袜脚交一区二区| 午夜精品成人在线视频| 婷婷六月综合网| 秋霞午夜av一区二区三区| 日韩vs国产vs欧美| 精品一区二区在线看| 国产一区二区三区久久久| 激情小说欧美图片| 处破女av一区二区| 99久久精品国产毛片| 色哟哟在线观看一区二区三区| 色婷婷国产精品综合在线观看| 在线中文字幕一区二区| 欧美日韩亚洲综合在线 | 日韩精品中文字幕在线一区| 欧美成人bangbros| 国产婷婷色一区二区三区四区 | av成人免费在线观看| 91在线高清观看| 欧美日韩久久久一区| 日韩手机在线导航| 日本一区二区成人在线| 尤物在线观看一区| 美国精品在线观看| 成人福利在线看| 色婷婷久久久久swag精品| 欧美人与禽zozo性伦| 久久综合狠狠综合| 亚洲日本va在线观看| 男男视频亚洲欧美| av午夜精品一区二区三区| 欧美剧情片在线观看| xf在线a精品一区二区视频网站| 国产精品久久久久婷婷| 亚瑟在线精品视频| 国产凹凸在线观看一区二区| 91激情五月电影| wwwwww.欧美系列| 悠悠色在线精品| 国产经典欧美精品| 欧美日韩小视频| 国产精品久久久久久久第一福利 | 亚洲尤物视频在线| 丁香天五香天堂综合| 欧美日韩成人综合在线一区二区| 26uuu亚洲综合色欧美| 一区二区三区av电影| 国产高清不卡二三区| 欧美日韩国产a| 中文字幕一区三区| 精品一区二区在线播放| 欧美日韩精品免费| 亚洲免费高清视频在线| 国产精品91一区二区| 日韩视频在线观看一区二区| 樱桃视频在线观看一区| 懂色av一区二区三区蜜臀 | 一本色道综合亚洲| 久久精品视频免费观看| 日本免费在线视频不卡一不卡二| 91女厕偷拍女厕偷拍高清| 精品国产百合女同互慰| 婷婷综合久久一区二区三区| 91国偷自产一区二区使用方法| 久久久久97国产精华液好用吗| 日韩国产一区二| 精品视频在线看| 亚洲精品免费播放| 成人免费精品视频| 国产日韩欧美一区二区三区综合| 另类小说色综合网站| 在线电影国产精品| 亚洲va韩国va欧美va| 91久久国产综合久久| 亚洲女同女同女同女同女同69| 成人av免费观看| 日本一区免费视频| 国产成人av影院| 亚洲国产精华液网站w| 岛国一区二区三区| 日本一区二区三区电影| 国产精品一卡二| 国产精品福利一区二区| av在线不卡电影| 亚洲九九爱视频| 在线观看亚洲一区| 午夜激情久久久|