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

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

?? intpnp.c

?? 在PC上通過USB與C8051通信
?? C
?? 第 1 頁 / 共 5 頁
字號:

        if(configurationDescriptor) {

            UsbBuildGetDescriptorRequest(
                    urb, 
                    (USHORT) sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST),
                    USB_CONFIGURATION_DESCRIPTOR_TYPE, 
                    0, 
                    0, 
                    configurationDescriptor,
                    NULL, 
                    sizeof(USB_CONFIGURATION_DESCRIPTOR), 
                    NULL);

            ntStatus = CallUSBD(DeviceObject, urb);

            if(!NT_SUCCESS(ntStatus)) {

                KdPrint( ("UsbBuildGetDescriptorRequest failed\n"));
                goto ConfigureDevice_Exit;
            }
        }
        else {

            KdPrint( ("Failed to allocate mem for config Descriptor\n"));

            ntStatus = STATUS_INSUFFICIENT_RESOURCES;
            goto ConfigureDevice_Exit;
        }

        siz = configurationDescriptor->wTotalLength;

        ExFreePool(configurationDescriptor);

        configurationDescriptor = ExAllocatePool(NonPagedPool, siz);

        if(configurationDescriptor) {

            UsbBuildGetDescriptorRequest(
                    urb, 
                    (USHORT)sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST),
                    USB_CONFIGURATION_DESCRIPTOR_TYPE,
                    0, 
                    0, 
                    configurationDescriptor, 
                    NULL, 
                    siz, 
                    NULL);

            ntStatus = CallUSBD(DeviceObject, urb);

            if(!NT_SUCCESS(ntStatus)) {

                KdPrint(("Failed to read configuration descriptor"));
                goto ConfigureDevice_Exit;
            }
        }
        else {

            KdPrint( ("Failed to alloc mem for config Descriptor\n"));
            ntStatus = STATUS_INSUFFICIENT_RESOURCES;
            goto ConfigureDevice_Exit;
        }
    }
    else {

        KdPrint( ("Failed to allocate memory for urb\n"));
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
        goto ConfigureDevice_Exit;
    }

    if(configurationDescriptor) {

        //
        // save a copy of configurationDescriptor in deviceExtension
        // remember to free it later.
        //
        deviceExtension->UsbConfigurationDescriptor = configurationDescriptor;

        if(configurationDescriptor->bmAttributes & REMOTE_WAKEUP_MASK)
        {
            //
            // this configuration supports remote wakeup
            //
            deviceExtension->WaitWakeEnable = 1;
        }
        else
        {
            deviceExtension->WaitWakeEnable = 0;
        }

        ntStatus = SelectInterfaces(DeviceObject, configurationDescriptor);
    }
    else {

        deviceExtension->UsbConfigurationDescriptor = NULL;
    }

ConfigureDevice_Exit:

    if(urb) {

        ExFreePool(urb);
    }

    return ntStatus;
}

NTSTATUS
SelectInterfaces(
    IN PDEVICE_OBJECT                DeviceObject,
    IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor
    )
/*++
 
Routine Description:

    This helper routine selects the configuration

Arguments:

    DeviceObject - pointer to device object
    ConfigurationDescriptor - pointer to the configuration
    descriptor for the device

Return Value:

    NT status value

--*/
{
    LONG                        numberOfInterfaces, 
                                interfaceNumber, 
                                interfaceindex;
    ULONG                       i;
    PURB                        urb;
    PUCHAR                      pInf;
    NTSTATUS                    ntStatus;
    PDEVICE_EXTENSION           deviceExtension;
    PUSB_INTERFACE_DESCRIPTOR   interfaceDescriptor;
    PUSBD_INTERFACE_LIST_ENTRY  interfaceList, 
                                tmp;
    PUSBD_INTERFACE_INFORMATION Interface;

    //
    // initialize the variables
    //

    urb = NULL;
    Interface = NULL;
    interfaceDescriptor = NULL;
    deviceExtension = DeviceObject->DeviceExtension;
    numberOfInterfaces = ConfigurationDescriptor->bNumInterfaces;
    interfaceindex = interfaceNumber = 0;

    //
    // Parse the configuration descriptor for the interface;
    //

    tmp = interfaceList =
        ExAllocatePool(
               NonPagedPool, 
               sizeof(USBD_INTERFACE_LIST_ENTRY) * (numberOfInterfaces + 1));

    if(!tmp) {

        KdPrint( ("Failed to allocate mem for interfaceList\n"));
        return STATUS_INSUFFICIENT_RESOURCES;
    }


    while(interfaceNumber < numberOfInterfaces) {

        interfaceDescriptor = USBD_ParseConfigurationDescriptorEx(
                                            ConfigurationDescriptor, 
                                            ConfigurationDescriptor,
                                            interfaceindex,
                                            0, -1, -1, -1);

        if(interfaceDescriptor) {

            interfaceList->InterfaceDescriptor = interfaceDescriptor;
            interfaceList->Interface = NULL;
            interfaceList++;
            interfaceNumber++;
        }

        interfaceindex++;
    }

    interfaceList->InterfaceDescriptor = NULL;
    interfaceList->Interface = NULL;
    urb = USBD_CreateConfigurationRequestEx(ConfigurationDescriptor, tmp);

    if(urb) {

        Interface = &urb->UrbSelectConfiguration.Interface;

        for(i=0; i<Interface->NumberOfPipes; i++) {

            //
            // perform pipe initialization here
            // set the transfer size and any pipe flags we use
            // USBD sets the rest of the Interface struct members
            //

            Interface->Pipes[i].MaximumTransferSize = 
                                USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE;
        }

        ntStatus = CallUSBD(DeviceObject, urb);

        if(NT_SUCCESS(ntStatus)) {

            //
            // save a copy of interface information in the device extension.
            //
            deviceExtension->UsbInterface = ExAllocatePool(NonPagedPool,
                                                           Interface->Length);

            if(deviceExtension->UsbInterface) {
                
                RtlCopyMemory(deviceExtension->UsbInterface,
                              Interface,
                              Interface->Length);
            }
            else {

                ntStatus = STATUS_INSUFFICIENT_RESOURCES;
                KdPrint( ("memory alloc for UsbInterface failed\n"));
            }

            //
            // Dump the interface to the debugger
            //

            Interface = &urb->UrbSelectConfiguration.Interface;

            KdPrint( ("---------\n"));
            KdPrint( ("NumberOfPipes 0x%x\n", 
                                 Interface->NumberOfPipes));
            KdPrint( ("Length 0x%x\n", 
                                 Interface->Length));
            KdPrint( ("Alt Setting 0x%x\n", 
                                 Interface->AlternateSetting));
            KdPrint( ("Interface Number 0x%x\n", 
                                 Interface->InterfaceNumber));
            KdPrint( ("Class, subclass, protocol 0x%x 0x%x 0x%x\n",
                                 Interface->Class,
                                 Interface->SubClass,
                                 Interface->Protocol));
            //
            // Initialize the PipeContext
            // Dump the pipe info
            //

            deviceExtension->PipeContext = ExAllocatePool(
                                                NonPagedPool,
                                                Interface->NumberOfPipes *
                                                sizeof(INTUSB_PIPE_CONTEXT));

            if(deviceExtension->PipeContext) {
                
                for(i=0; i<Interface->NumberOfPipes; i++) {

                    deviceExtension->PipeContext[i].PipeOpen = FALSE;
                }
            }
            else {
                    
                ntStatus = STATUS_INSUFFICIENT_RESOURCES;
                KdPrint( ("memory alloc for UsbInterface failed\n"));
            }

            for(i=0; i<Interface->NumberOfPipes; i++) {

                KdPrint( ("---------\n"));
                KdPrint( ("PipeType 0x%x\n", 
                                     Interface->Pipes[i].PipeType));
                KdPrint( ("EndpointAddress 0x%x\n", 
                                     Interface->Pipes[i].EndpointAddress));
                KdPrint( ("MaxPacketSize 0x%x\n", 
                                    Interface->Pipes[i].MaximumPacketSize));
                KdPrint( ("Interval 0x%x\n", 
                                     Interface->Pipes[i].Interval));
                KdPrint( ("Handle 0x%x\n", 
                                     Interface->Pipes[i].PipeHandle));
                KdPrint( ("MaximumTransferSize 0x%x\n", 
                                    Interface->Pipes[i].MaximumTransferSize));
            }

            KdPrint( ("---------\n"));
        }
        else {

            KdPrint( ("Failed to select an interface\n"));
        }
    }
    else {
        
        KdPrint( ("USBD_CreateConfigurationRequestEx failed\n"));
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }

    if(tmp) {

        ExFreePool(tmp);
    }

    if(urb) {

        ExFreePool(urb);
    }

    return ntStatus;
}


NTSTATUS
DeconfigureDevice(
    IN PDEVICE_OBJECT DeviceObject
    )
/*++
 
Routine Description:

    This routine is invoked when the device is removed or stopped.
    This routine de-configures the usb device.

Arguments:

    DeviceObject - pointer to device object

Return Value:

    NT status value

--*/
{
    PURB     urb;
    ULONG    siz;
    NTSTATUS ntStatus;
    
    //
    // initialize variables
    //

    siz = sizeof(struct _URB_SELECT_CONFIGURATION);
    urb = ExAllocatePool(NonPagedPool, siz);

    if(urb) {

        UsbBuildSelectConfigurationRequest(urb, (USHORT)siz, NULL);

        ntStatus = CallUSBD(DeviceObject, urb);

        if(!NT_SUCCESS(ntStatus)) {

            KdPrint( ("Failed to deconfigure device\n"));
        }

        ExFreePool(urb);
    }
    else {

        KdPrint( ("Failed to allocate urb\n"));
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }

    return ntStatus;
}

NTSTATUS
CallUSBD(
    IN PDEVICE_OBJECT DeviceObject,
    IN PURB           Urb
    )
/*++
 
Routine Description:

    This routine synchronously submits an urb down the stack.

Arguments:

    DeviceObject - pointer to device object
    Urb - USB request block

Return Value:

--*/
{
    PIRP               irp;
    KEVENT             event;
    NTSTATUS           ntStatus;
    IO_STATUS_BLOCK    ioStatus;
    PIO_STACK_LOCATION nextStack;
    PDEVICE_EXTENSION  deviceExtension;

    //
    // initialize the variables
    //

    irp = NULL;
    deviceExtension = DeviceObject->DeviceExtension;
    
    KeInitializeEvent(&event, NotificationEvent, FALSE);

    irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_SUBMIT_URB, 
                                        deviceExtension->TopOfStackDeviceObject,
                                        NULL, 
                                        0, 
                                        NULL, 
                                        0, 
                                        TRUE, 
                                        &event, 
                                        &ioStatus);

    if(!irp) {

        KdPrint( ("IoBuildDeviceIoControlRequest failed\n"));
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    nextStack = IoGetNextIrpStackLocation(irp);
    ASSERT(nextStack != NULL);
    nextStack->Parameters.Others.Argument1 = Urb;

    KdPrint( ("CallUSBD::"));
    IntUsb_IoIncrement(deviceExtension);

    ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject, irp);

    if(ntStatus == STATUS_PENDING) {

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

        ntStatus = ioStatus.Status;
    }
    
    KdPrint( ("CallUSBD::"));
    IntUsb_IoDecrement(deviceExtension);
    return ntStatus;
}

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

    This routine services the Irps of minor type IRP_MN_QUERY_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;

    KdPrint( ("HandleQueryStopDevice - begins\n"));

    //
    // initialize variables
    //

    deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

    //
    // If we can stop the device, we need to set the QueueState to 
    // HoldRequests so further requests will be queued.
    //

    KeAcquireSpinLock(&deviceExtension->DevStateLock, &oldIrql);
    
    SET_NEW_PNP_STATE(deviceExtension, PendingStop);
    deviceExtension->QueueState = HoldRequests;
    
    KeReleaseSpinLock(&deviceExtension->DevStateLock, oldIrql);

    //
    // wait for the existing ones to be finished.
    // first, decrement this operation
    //

    KdPrint( ("HandleQueryStopDevice::"));
    IntUsb_IoDecrement(deviceExtension);

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

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲裸体xxx| 欧美国产乱子伦| 欧美国产激情二区三区| 亚洲图片欧美综合| 成人国产电影网| 欧美变态凌虐bdsm| 一区二区三区产品免费精品久久75| 免费成人在线播放| 91香蕉视频mp4| 26uuu国产一区二区三区| 亚洲va国产天堂va久久en| 粉嫩嫩av羞羞动漫久久久| 欧美一区二区三区成人| 亚洲一区二区三区免费视频| 国产乱码一区二区三区| 欧美成人在线直播| 亚洲成人精品一区| 色呦呦国产精品| 国产精品国产精品国产专区不蜜 | 国产精品麻豆久久久| 天堂成人国产精品一区| 色哟哟一区二区三区| 国产欧美日韩卡一| 国产一区二区三区香蕉| 精品入口麻豆88视频| 五月综合激情婷婷六月色窝| 色婷婷综合久久| 国产精品久久久久久户外露出| 麻豆一区二区99久久久久| 欧美日韩成人一区二区| 亚洲成av人**亚洲成av**| av日韩在线网站| 国产精品大尺度| 成人av网址在线| 精品国精品国产| 久久精品国产精品亚洲红杏| 日韩视频在线你懂得| 久久99久久久久| 精品国产免费人成电影在线观看四季 | 亚洲超碰97人人做人人爱| 欧美午夜不卡在线观看免费| 亚洲一区二区三区小说| 91蜜桃在线免费视频| 亚洲欧美色图小说| 欧美日韩精品电影| 日韩二区在线观看| 欧美一区二区三级| 国产一区二区三区观看| 日韩欧美国产一区二区三区| 美女在线视频一区| 国产欧美精品区一区二区三区 | 亚洲成a人v欧美综合天堂下载| 不卡区在线中文字幕| 亚洲黄色性网站| 3d动漫精品啪啪一区二区竹菊| 夜夜爽夜夜爽精品视频| 欧美日韩一区成人| 久久99国产精品久久| 国产成人aaaa| 欧美激情一区二区在线| 成人app网站| 视频在线观看一区| 精品99一区二区三区| 成人免费黄色大片| 亚洲欧洲在线观看av| 色婷婷综合久久| 亚洲韩国精品一区| 欧美一级精品在线| 国产精品中文字幕欧美| 一区免费观看视频| 7777精品伊人久久久大香线蕉| 美女视频黄频大全不卡视频在线播放 | 欧美无砖砖区免费| 国产在线视频一区二区| 亚洲主播在线播放| 日韩欧美二区三区| 91日韩在线专区| 五月婷婷久久丁香| 久久久久久久一区| 欧美另类变人与禽xxxxx| 国产经典欧美精品| 中文字幕一区二区三| 日韩精品自拍偷拍| 欧美亚洲自拍偷拍| av一二三不卡影片| 黄色日韩网站视频| 午夜电影一区二区| 亚洲免费av高清| 久久久777精品电影网影网 | 不卡高清视频专区| 美女视频一区二区三区| 亚洲国产视频一区二区| 国产婷婷色一区二区三区四区 | 国产亚洲自拍一区| 精品婷婷伊人一区三区三| 国产成人在线视频网站| 日韩精品国产精品| 亚洲老妇xxxxxx| 中文字幕日韩av资源站| 欧美大胆一级视频| 欧美亚洲国产怡红院影院| 丁香婷婷深情五月亚洲| 亚洲电影在线播放| 一区二区三区产品免费精品久久75 | 中文字幕va一区二区三区| 日韩欧美一二三区| 欧美日韩日本视频| 在线观看日韩电影| 色诱亚洲精品久久久久久| k8久久久一区二区三区| 国产高清不卡一区| 成人av网站大全| 成人激情免费网站| 99精品黄色片免费大全| 99久久99久久精品免费看蜜桃| 99re这里都是精品| 91在线观看成人| 欧美在线三级电影| 精品视频免费在线| 在线观看91av| 欧美一区二区三区不卡| 精品免费99久久| 久久综合色播五月| 国产亚洲一区二区三区| 中文字幕av一区 二区| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 国产免费久久精品| 国产精品灌醉下药二区| 一区二区三区不卡在线观看| 亚洲国产欧美在线| 琪琪久久久久日韩精品| 国产在线精品一区二区不卡了| 日韩电影网1区2区| 免费成人美女在线观看.| 国产九九视频一区二区三区| 国产寡妇亲子伦一区二区| 成人91在线观看| 欧美色图12p| 91精品国产91久久综合桃花 | 中文字幕在线不卡一区二区三区| 亚洲品质自拍视频| 日韩激情视频在线观看| 国产精品亚洲第一| 91免费在线看| 欧美电视剧在线观看完整版| 一色桃子久久精品亚洲| 日本少妇一区二区| 成人动漫一区二区| 欧美一级专区免费大片| 欧美国产日产图区| 午夜久久久久久| 不卡高清视频专区| 日韩午夜在线观看视频| 亚洲精品亚洲人成人网在线播放| 蜜桃一区二区三区在线观看| 99国产精品国产精品毛片| 日韩亚洲欧美一区二区三区| 亚洲视频免费观看| 经典三级视频一区| 欧美三级韩国三级日本三斤| 国产亚洲精品精华液| 日韩在线播放一区二区| 97se亚洲国产综合自在线| 精品国产成人在线影院 | 亚洲激情五月婷婷| 精品一区二区三区久久| 色综合天天综合给合国产| 精品盗摄一区二区三区| 亚洲综合成人在线视频| 成人在线一区二区三区| 精品免费视频一区二区| 亚洲sss视频在线视频| 99久久婷婷国产精品综合| 337p粉嫩大胆噜噜噜噜噜91av | 亚洲欧美另类久久久精品| 国内精品久久久久影院色| 欧美性受极品xxxx喷水| 国产精品人妖ts系列视频| 免费成人av在线播放| 7777精品伊人久久久大香线蕉完整版| 中文字幕制服丝袜一区二区三区| 久久草av在线| 日韩欧美资源站| 午夜精品福利一区二区三区av| 99精品黄色片免费大全| 国产精品午夜在线| 国产毛片精品国产一区二区三区| 欧美日韩中字一区| 一二三四社区欧美黄| 不卡av在线免费观看| 国产精品久久久久毛片软件| 国产91精品露脸国语对白| 久久精品一区八戒影视| 国产一区二区调教| 久久久久久电影| 国产精品1区2区| 国产人久久人人人人爽| 国产激情视频一区二区三区欧美 | 日韩欧美激情四射| 九色综合狠狠综合久久|