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

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

?? usblspnp.c

?? 來自微軟的usb2.0開發包,加速USB驅動開發
?? C
?? 第 1 頁 / 共 3 頁
字號:
NTSTATUS
USBLS120_IrpCompletionRoutine(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP Irp,
    IN PVOID Context
    )
/*++

Routine Description:

    Used as a  general purpose completion routine so it can signal an event,
    passed as the Context, when the next lower driver is done with the input Irp.
    This routine is used by both PnP and Power Management logic.

    Even though this routine does nothing but set an event, it must be defined and
    prototyped as a completetion routine for use as such


Arguments:

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

    Irp - Irp completed.

    Context - Driver defined context, in this case a pointer to an event.

Return Value:

    The function value is the final status from the operation.

--*/
{
    PKEVENT event = Context;

    // Set the input event
    KeSetEvent(
        event,
        1,       // Priority increment  for waiting thread.
        FALSE);  // Flag this call is not immediately followed by wait.

    // This routine must return STATUS_MORE_PROCESSING_REQUIRED because we have not yet called
    // IoFreeIrp() on this IRP.
    return STATUS_MORE_PROCESSING_REQUIRED;

}


NTSTATUS
USBLS120_FdoDeviceQuery(
    IN PDEVICE_OBJECT pDeviceObject,
    IN PIRP pIrp)
/*++

Routine Description:

    Handler for IRP_MN_QUERY_DEVICE_RELATIONS.
    Enumerates our child PDO.

Arguments:

    DeviceObject - pointer to our child PDO

    Irp          - pointer to an I/O Request Packet

Return Value:

    NT status code

--*/
{
    NTSTATUS ntStatus;
    PIO_STACK_LOCATION irpStack;
    PDEVICE_RELATIONS DeviceRelations;
    PDEVICE_EXTENSION DeviceExtension;
    PDEVICE_EXTENSION PdoExtension;
    UNICODE_STRING PdoUniName;
    static UCHAR PdoCount=0;

    //NOTE: This name be unique to each hardware vendor
    //      to avoid name collision between different
    //      drivers based on this code
    WCHAR PdoName[] = CHILD_PDO_NAME;

    irpStack = IoGetCurrentIrpStackLocation(pIrp);
    DeviceExtension = pDeviceObject->DeviceExtension;

    switch (irpStack->Parameters.QueryDeviceRelations.Type)
    {
        case BusRelations:
 
            // Allocate space for 1 child PDO
            DeviceRelations = ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS));

            // If we can't allocate DeviceRelations structure, bail
            if (!DeviceRelations) {
                ntStatus = STATUS_INSUFFICIENT_RESOURCES;
                pIrp->IoStatus.Status = STATUS_UNSUCCESSFUL;
            }
            else {
                DeviceRelations->Count = 0;
			
                if ((!DeviceExtension->ChildPdo) && (PdoCount<9)) {
                    RtlInitUnicodeString (&PdoUniName, PdoName);
                    PdoName [((sizeof(PdoName)/sizeof(WCHAR)) - 2)] = L'0' + PdoCount++;

                    ntStatus = IoCreateDevice(
                        USBLS120DriverObject,
                        sizeof(DEVICE_EXTENSION),
                        &PdoUniName,
                        FILE_DEVICE_MASS_STORAGE,
                        0,
                        FALSE,
                        &DeviceExtension->ChildPdo
                        );

                    if(NT_SUCCESS(ntStatus))
                    {
                        PdoExtension = DeviceExtension->ChildPdo->DeviceExtension;

                        // Mark the device object as our child PDO
                        PdoExtension->DeviceObjectType = DO_PDO;

                        DeviceExtension->ChildPdo->Flags &= ~DO_DEVICE_INITIALIZING;
		
                        DeviceRelations->Objects[DeviceRelations->Count++] = DeviceExtension->ChildPdo;
                        ObReferenceObject(DeviceExtension->ChildPdo);
                    }
                }
                else {
                    // Child PDO already exists, just return it
                    DeviceRelations->Objects[DeviceRelations->Count++] = DeviceExtension->ChildPdo;
                    ObReferenceObject(DeviceExtension->ChildPdo);
                }
		
                pIrp->IoStatus.Information = (ULONG)DeviceRelations;
                ntStatus = pIrp->IoStatus.Status = STATUS_SUCCESS;
            }
		
            break;

	default:
            // We pass on any non-BusRelations IRP
            IoSkipCurrentIrpStackLocation (pIrp);
            ntStatus = IoCallDriver (DeviceExtension->TopOfStackDeviceObject, pIrp);

    }

    return ntStatus;
}
		


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

Routine Description:

    Dispatch table routine for IRP_MJ_PNP.
    Process the Plug and Play IRPs sent to our PDO.

Arguments:

    DeviceObject - pointer to our child PDO

    Irp          - pointer to an I/O Request Packet

Return Value:

    NT status code

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

    //
    // Get a pointer to the current location in the Irp. This is where
    //     the function codes and parameters are located.
    //
    
    USBLS120_KdPrint( DBGLVL_MEDIUM, ( "enter USBLS120_PdoProcessPnPIrp()\n"));

    irpStack = IoGetCurrentIrpStackLocation (Irp);

    //
    // Get a pointer to the device extension
    //

    deviceExtension = DeviceObject->DeviceExtension;
    stackDeviceObject = deviceExtension->TopOfStackDeviceObject;

    USBLS120_KdPrint( DBGLVL_MEDIUM, ( "enter USBLS120_ProcessPnPIrp() IRP_MJ_PNP, minor %s\n",
    USBLS120_StringForPnpMnFunc( irpStack->MinorFunction ) ));

    // inc the FDO device extension's pending IO count for this Irp
    //USBLS120_IncrementIoCount(DeviceObject);

    USBLS120_ASSERT( IRP_MJ_PNP == irpStack->MajorFunction );

    switch (irpStack->MinorFunction)
    {
        case IRP_MN_QUERY_DEVICE_RELATIONS:
            ntStatus = USBLS120_PdoDeviceQuery(DeviceObject, Irp);
            break;


	case IRP_MN_QUERY_ID:
            ntStatus = USBLS120_PdoQueryID(DeviceObject, Irp);
            break;


	case IRP_MN_REMOVE_DEVICE:
            IoDeleteDevice(DeviceObject);
            break;


	case IRP_MN_QUERY_BUS_INFORMATION:
            ntStatus = USBLS120_QueryBusInfo(DeviceObject, Irp);
            break;
    }

    return (ntStatus);
}


NTSTATUS
USBLS120_QueryBusInfo(
    IN PDEVICE_OBJECT pDeviceObject,
    IN PIRP pIrp
    )
{
    NTSTATUS ntStatus;
    PIO_STACK_LOCATION irpStack;
    PPNP_BUS_INFORMATION BusInfo;
        	
    USBLS120_KdPrint( DBGLVL_MEDIUM, ( "enter USBLS120_QueryBusInfo()\n"));

    irpStack = IoGetCurrentIrpStackLocation(pIrp);

    BusInfo = ExAllocatePool(PagedPool, sizeof(PNP_BUS_INFORMATION));

    // If we can't allocate BusInfo structure, bail
    if (!BusInfo) {
        pIrp->IoStatus.Status = STATUS_UNSUCCESSFUL;
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }
    else {
        BusInfo->BusTypeGuid = GUID_BUS_USBLS120;
        BusInfo->LegacyBusType = PNPBus;
        BusInfo->BusNumber = 0;
			
        pIrp->IoStatus.Information = (ULONG)BusInfo;
        ntStatus = pIrp->IoStatus.Status = STATUS_SUCCESS;
    }

    return ntStatus;
}										



NTSTATUS
USBLS120_PdoDeviceQuery(
    IN PDEVICE_OBJECT pDeviceObject,
    IN PIRP pIrp
    )
{
    NTSTATUS ntStatus;
    PIO_STACK_LOCATION irpStack;
    PDEVICE_RELATIONS DeviceRelations;
    PDEVICE_EXTENSION DeviceExtension;
        	
    USBLS120_KdPrint( DBGLVL_DEFAULT, ( "enter USBLS120_PdoDeviceQuery()\n"));

    irpStack = IoGetCurrentIrpStackLocation(pIrp);
    DeviceExtension = pDeviceObject->DeviceExtension;

    switch (irpStack->Parameters.QueryDeviceRelations.Type)
    {
	case TargetDeviceRelation:

            // Allocate space for 1 child device
            DeviceRelations = ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS));

            // If we can't allocate DeviceRelations structure, bail
            if (!DeviceRelations) {
                pIrp->IoStatus.Status = STATUS_UNSUCCESSFUL;
                ntStatus = STATUS_INSUFFICIENT_RESOURCES;
            }
            else {
                ObReferenceObject(pDeviceObject);
			
                DeviceRelations->Count = 1;
                DeviceRelations->Objects[0] = pDeviceObject;
			
                pIrp->IoStatus.Information = (ULONG)DeviceRelations;
                ntStatus = pIrp->IoStatus.Status = STATUS_SUCCESS;
            }
		
            break;

	default:
            ntStatus = pIrp->IoStatus.Status;
    }

	return ntStatus;
}										



NTSTATUS
USBLS120_PdoQueryID(
    IN PDEVICE_OBJECT pDeviceObject,
    IN PIRP pIrp)
{
    PIO_STACK_LOCATION ioStack;
    PWCHAR buffer;
    WCHAR IDString[] = CHILD_DEVICE_ID;
    WCHAR InstanceIDString[] = L"0000";
    ULONG length;

    USBLS120_KdPrint( DBGLVL_MEDIUM, ( "enter USBLS120_PdoQueryID()\n"));

    ioStack = IoGetCurrentIrpStackLocation(pIrp);

    switch (ioStack->Parameters.QueryId.IdType)
    {
        case BusQueryHardwareIDs:
            // return a multi WCHAR (null terminated) string (null terminated)
            // array for use in matching hardare ids in inf files;


        case BusQueryDeviceID:
            // return a WCHAR (null terminated) string describing the device
            // For symplicity we make it exactly the same as the Hardware ID.
       
            length = sizeof (IDString) * sizeof(WCHAR);
            buffer = ExAllocatePool (PagedPool, length);

            if (buffer) {
                RtlCopyMemory (buffer, IDString, length);
            }

            pIrp->IoStatus.Information = (ULONG) buffer;
            break;


        case BusQueryInstanceID:
            length = sizeof (InstanceIDString) * sizeof(WCHAR);
            buffer = ExAllocatePool (PagedPool, length);

            if (buffer) {
                RtlCopyMemory (buffer, InstanceIDString, length);
            }

            pIrp->IoStatus.Information = (ULONG) buffer;
            break;
    }
    return STATUS_SUCCESS;
}


NTSTATUS
USBLS120_AbortPipes(
    IN PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

    Called as part of sudden device removal handling.
    Cancels any pending transfers for all open pipes. 
    If any pipes are still open, call USBD with URB_FUNCTION_ABORT_PIPE
    Also marks the pipe 'closed' in our saved  configuration info.

Arguments:

    Ptrs to our FDO

Return Value:

    NT status code

--*/
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PURB urb;
    PDEVICE_EXTENSION deviceExtension;
    ULONG i;

    PUSBD_INTERFACE_INFORMATION interface;
    PUSBD_PIPE_INFORMATION PipeInfo;

    deviceExtension = DeviceObject->DeviceExtension;
    interface = deviceExtension->UsbInterface;

    for (i=0; i<interface->NumberOfPipes; i++) {
        PipeInfo =  &interface->Pipes[i]; // PUSBD_PIPE_INFORMATION  PipeInfo;

        if ( PipeInfo->PipeFlags ) {
            USBLS120_KdPrint( DBGLVL_HIGH,("USBLS120_AbortPipes() Aborting open  Pipe %d\n", i));

            urb = USBLS120_ExAllocatePool(NonPagedPool, sizeof(struct _URB_PIPE_REQUEST));

            if (urb) {
                urb->UrbHeader.Length = (USHORT) sizeof (struct _URB_PIPE_REQUEST);
                urb->UrbHeader.Function = URB_FUNCTION_ABORT_PIPE;
                urb->UrbPipeRequest.PipeHandle = PipeInfo->PipeHandle;

                ntStatus = USBLS120_CallUSBD(DeviceObject, urb);

                USBLS120_ExFreePool(urb);

            }
            else {
                ntStatus = STATUS_INSUFFICIENT_RESOURCES;
                USBLS120_KdPrint( DBGLVL_HIGH,("USBLS120_AbortPipes() FAILED urb alloc\n" ));
                break;
            }


            if (!(NT_SUCCESS(ntStatus))) {
                // if we failed, dump out
#if DBG
                if ( gpDbg )
                    gpDbg->PipeErrorCount++;
#endif
                break;
            }
            else {
                PipeInfo->PipeFlags = FALSE; // mark the pipe 'closed'
                deviceExtension->OpenPipeCount--;
#if DBG
                if ( gpDbg )
                    gpDbg->AbortPipeCount++;
#endif
            }

        } // end, if pipe open
    } // end, for all pipes

    return ntStatus;
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
视频在线观看一区| 麻豆精品精品国产自在97香蕉| 欧美成人aa大片| 欧美一卡在线观看| 91精品一区二区三区久久久久久| 欧美美女一区二区在线观看| 欧美在线观看你懂的| 色香蕉久久蜜桃| 欧美日韩在线免费视频| 欧美美女黄视频| 日韩一区二区高清| 国产三级欧美三级| 中文字幕一区二区三区四区不卡 | 欧美日韩精品一区二区| 在线观看视频91| 91精品国产色综合久久ai换脸| 欧美一区在线视频| 国产婷婷一区二区| 亚洲三级免费电影| 日韩中文字幕区一区有砖一区| 麻豆成人91精品二区三区| 麻豆视频观看网址久久| 欧美激情综合五月色丁香小说| 亚洲在线中文字幕| 91精品国产免费久久综合| 亚洲国产精品精华液网站| 日本一区二区视频在线| 国产精品人成在线观看免费 | 在线观看国产91| 欧美三级蜜桃2在线观看| 91麻豆精品91久久久久久清纯 | 不卡欧美aaaaa| 91丝袜国产在线播放| 在线电影国产精品| 亚洲精品成人悠悠色影视| 亚洲成a人片综合在线| 亚洲一二三四区| 国产一区欧美一区| 欧美色男人天堂| 国产日产欧美一区二区三区| 亚洲一二三区不卡| 丁香婷婷深情五月亚洲| 欧美精品在线一区二区| 亚洲视频网在线直播| 蜜臀a∨国产成人精品| 97成人超碰视| 国产亚洲欧美色| 日韩av在线发布| 91美女在线视频| 国产女同性恋一区二区| 日本一不卡视频| 91福利区一区二区三区| 欧美国产精品一区| 国产一区激情在线| 在线不卡a资源高清| 亚洲精选视频在线| 大白屁股一区二区视频| 日韩欧美国产电影| 亚洲成人一区在线| 在线看不卡av| 自拍av一区二区三区| 懂色av一区二区夜夜嗨| 欧美mv日韩mv| 蜜桃视频在线观看一区二区| 欧美丝袜丝交足nylons图片| 亚洲日本欧美天堂| 99国产精品久久久久久久久久久 | 国模冰冰炮一区二区| 4438亚洲最大| 午夜精品aaa| 欧美日韩一区二区三区四区五区| 亚洲色图欧美激情| 成人激情动漫在线观看| 国产视频一区在线观看| 国产精品一级片| 日本一区二区三区久久久久久久久不 | 中文字幕中文字幕一区| 懂色av一区二区三区免费观看| 精品国产伦理网| 精品系列免费在线观看| 欧美v国产在线一区二区三区| 日韩精品视频网站| 欧美va天堂va视频va在线| 国产一区二区三区久久久 | 欧洲av一区二区嗯嗯嗯啊| 国产精品久久久久天堂| 色域天天综合网| 亚洲综合在线免费观看| 欧美日韩国产片| 久久国产视频网| 久久精品人人做| 色婷婷综合视频在线观看| 五月天久久比比资源色| 欧美一级免费观看| 国产九色sp调教91| 中文字幕一区二区三中文字幕| 91官网在线观看| 日韩av电影天堂| 国产网站一区二区| 在线观看亚洲精品视频| 六月婷婷色综合| 国产精品你懂的在线欣赏| 91视频国产资源| 奇米影视一区二区三区小说| 国产婷婷一区二区| 欧美中文一区二区三区| 蜜桃av一区二区在线观看| 国产精品免费人成网站| 欧美精品在线一区二区| 风间由美性色一区二区三区| 一区二区三区**美女毛片| 亚洲精品一区二区精华| 99麻豆久久久国产精品免费 | 国产精品日韩成人| 欧美日韩免费不卡视频一区二区三区| 日本va欧美va瓶| 亚洲视频中文字幕| 欧美成人在线直播| 在线欧美一区二区| 国产成人综合在线观看| 日韩电影在线观看一区| 亚洲欧美中日韩| 久久久午夜电影| 欧美视频精品在线| 不卡一区二区中文字幕| 日韩高清不卡一区二区| 亚洲免费色视频| 中文字幕免费不卡在线| 欧美一二三区在线观看| 在线免费观看视频一区| 国产+成+人+亚洲欧洲自线| 日韩va亚洲va欧美va久久| 亚洲免费观看在线观看| 欧美国产日产图区| 久久久久一区二区三区四区| 欧美高清视频不卡网| 色噜噜偷拍精品综合在线| 成人一级片在线观看| 国产大陆亚洲精品国产| 国产一区欧美日韩| 久久成人免费日本黄色| 日韩精品久久理论片| 亚洲成人自拍一区| 亚洲第一激情av| 一区二区三区色| 亚洲精品欧美激情| 亚洲特级片在线| 国产精品电影一区二区三区| 国产精品素人视频| 国产日韩亚洲欧美综合| 中文字幕第一区二区| 国产精品女上位| 中文字幕一区av| 亚洲欧美日韩系列| 亚洲在线观看免费视频| 亚洲国产日韩a在线播放性色| 亚洲一区二区在线播放相泽 | 欧美一级生活片| 日韩欧美久久久| 久久久久久久综合狠狠综合| 久久久久国产精品厨房| 中文字幕欧美日韩一区| 中文字幕亚洲综合久久菠萝蜜| 18成人在线观看| 亚洲一区在线观看视频| 五月婷婷色综合| 日韩成人午夜精品| 国产一区二区三区久久悠悠色av| 国产精品中文欧美| 99视频精品全部免费在线| 在线看国产一区二区| 91精品在线观看入口| 久久精品在线免费观看| 亚洲欧洲日韩在线| 婷婷综合另类小说色区| 精品一区二区久久久| av爱爱亚洲一区| 欧美日韩国产一区| 久久亚洲免费视频| 亚洲精品成人悠悠色影视| 麻豆免费精品视频| 波波电影院一区二区三区| 欧美吞精做爰啪啪高潮| 亚洲精品在线网站| 亚洲男人的天堂av| 精品亚洲成a人在线观看 | 亚洲成人av电影在线| 国产裸体歌舞团一区二区| 在线一区二区观看| 久久精品夜夜夜夜久久| 亚洲国产视频a| 成人免费福利片| 欧美一区二区视频在线观看2020| 久久综合色一综合色88| 一区二区三区加勒比av| 国产精品自拍一区| 精品欧美久久久| 国产.欧美.日韩| 亚洲一区二区三区四区的 | 欧美一区二区三区不卡|