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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? d12xp.c

?? 該軟件代碼示范了如何用WINDOWS DDK 及VC++開發(fā)環(huán)境 進(jìn)行windows USB 驅(qū)動程序編寫
?? C
?? 第 1 頁 / 共 5 頁
字號:
    ntStatus = BulkUsb_SymbolicLink( PhysicalDeviceObject, &deviceLinkUnicodeString );


    if (NT_SUCCESS(ntStatus)) {

        ntStatus = IoCreateDevice (DriverObject,
                           sizeof (DEVICE_EXTENSION),
                           NULL,
                           FILE_DEVICE_UNKNOWN,
                           FILE_AUTOGENERATED_DEVICE_NAME,
                           FALSE,
                           DeviceObject);

 
        if (!NT_SUCCESS(ntStatus))  {
             return ntStatus;
        }


        // Name buffer for our named Functional device object link
        // The name is generated based on the driver's class GUID
        deviceExtension = (PDEVICE_EXTENSION) ((*DeviceObject)->DeviceExtension);

        RtlCopyMemory(deviceExtension->DeviceLinkNameBuffer,
                      deviceLinkUnicodeString.Buffer,
                      deviceLinkUnicodeString.Length);
        deviceExtension->DeviceDescriptor = NULL;
        deviceExtension->Interface = NULL;
        deviceExtension->ConfigurationHandle = NULL;
        deviceExtension->AcceptingRequests = TRUE;
        deviceExtension->PendingIoCount = 0;
        deviceExtension->UserEvent = NULL;

        KeInitializeEvent(&deviceExtension->RemoveEvent, NotificationEvent, FALSE);

        for (i=0; i<D12_MAX_PIPES; i++) {
            deviceExtension->PipeList[i].PipeInfo = NULL;
        }

		RtlFreeUnicodeString( &deviceLinkUnicodeString );
    }


    return ntStatus;
}



NTSTATUS
D12_CallUSBD(
    IN PDEVICE_OBJECT DeviceObject,
    IN PURB Urb
    )
/*++

Routine Description:

    Passes a URB to the USBD class driver

Arguments:

    DeviceObject - pointer to the device object for this instance of an 82930

    Urb - pointer to Urb request block

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise

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

    D12_KdPrint (("D12TEST.SYS: enter D12_CallUSBD\n"));

    deviceExtension = DeviceObject->DeviceExtension;

    //
    // issue a synchronous request
    //

    KeInitializeEvent(&event, NotificationEvent, FALSE);

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

    //
    // Call the class driver to perform the operation.  If the returned status
    // is PENDING, wait for the request to complete.
    //

    nextStack = IoGetNextIrpStackLocation(irp);
    ASSERT(nextStack != NULL);

    //
    // pass the URB to the USB driver stack
    //
    nextStack->Parameters.Others.Argument1 = Urb;


    D12_KdPrint (("D12TEST.SYS: calling USBD\n"));

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

    D12_KdPrint (("D12TEST.SYS: return from IoCallDriver USBD %x\n", ntStatus));

    if (ntStatus == STATUS_PENDING) {
        D12_KdPrint (("D12TEST.SYS: Wait for single object\n"));

        status = KeWaitForSingleObject(
                       &event,
                       Suspended,
                       KernelMode,
                       FALSE,
                       NULL);

        D12_KdPrint (("D12TEST.SYS: Wait for single object, returned %x\n", status));

    } else {
        ioStatus.Status = ntStatus;
    }

    D12_KdPrint (("D12TEST.SYS: URB status = %x status = %x irp status %x\n",
        Urb->UrbHeader.Status, status, ioStatus.Status));

    //
    // USBD maps the error code for us
    //
    ntStatus = ioStatus.Status;

    D12_KdPrint (("D12TEST.SYS: exit D12_CallUSBD (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
D12_ConfigureDevice(
    IN  PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

    Initializes a given instance of the device on the USB and selects the
    configuration.

Arguments:

    DeviceObject - pointer to the device object for this instance of the 82930
                    devcice.


Return Value:

    NT status code

--*/
{
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS ntStatus;
    PURB urb;
    ULONG siz;
    PUSB_CONFIGURATION_DESCRIPTOR configurationDescriptor = NULL;

    D12_KdPrint (("D12TEST.SYS: enter D12_ConfigureDevice\n"));

    deviceExtension = DeviceObject->DeviceExtension;

    //
    // first configure the device
    //

    urb = ExAllocatePool(NonPagedPool,
                         sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST));

    if (urb) {

        // BUGBUG 82930 chokes if on the next command if you don't get
        // the entire descriptor on the first try

        siz = sizeof(USB_CONFIGURATION_DESCRIPTOR)+256;

get_config_descriptor_retry:

        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 = D12_CallUSBD(DeviceObject, urb);

            D12_KdPrint (("D12TEST.SYS: Configuration Descriptor = %x, len %x\n",
                            configurationDescriptor,
                            urb->UrbControlDescriptorRequest.TransferBufferLength));
        } else {
            ntStatus = STATUS_INSUFFICIENT_RESOURCES;
        }

        //
        // if we got some data see if it was enough.
        //
        // NOTE: we may get an error in URB because of buffer overrun
        if (urb->UrbControlDescriptorRequest.TransferBufferLength>0 &&
                configurationDescriptor->wTotalLength > siz) {

            siz = configurationDescriptor->wTotalLength;
            ExFreePool(configurationDescriptor);
            configurationDescriptor = NULL;
            goto get_config_descriptor_retry;
        }

        ExFreePool(urb);

    } else {
        ntStatus = STATUS_INSUFFICIENT_RESOURCES;
    }

    if (configurationDescriptor) {

        //
        // We have the configuration descriptor for the configuration
        // we want.
        //
        // Now we issue the select configuration command to get
        // the  pipes associated with this configuration.
        //

        ntStatus = D12_SelectInterface(DeviceObject,
            configurationDescriptor, NULL);

        ExFreePool(configurationDescriptor);

    }



    D12_KdPrint (("D12TEST.SYS: exit D12_ConfigureDevice (%x)\n", ntStatus));

    return ntStatus;
}


NTSTATUS
D12_SelectInterface(
    IN PDEVICE_OBJECT DeviceObject,
    IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
    PUSBD_INTERFACE_INFORMATION Interface
    )
/*++

Routine Description:

    Initializes an 82930 with multiple interfaces

Arguments:

    DeviceObject - pointer to the device object for this instance of the 82930
                    devcice.

    ConfigurationDescriptor - pointer to the USB configuration
                    descriptor containing the interface and endpoint
                    descriptors.

Return Value:

    NT status code

--*/
{
    PDEVICE_EXTENSION deviceExtension;
    NTSTATUS ntStatus;
    PURB urb = NULL;
    ULONG i;
    UCHAR alternateSetting, interfaceNumber;
    PUSB_INTERFACE_DESCRIPTOR interfaceDescriptor = NULL;
    USHORT siz;

    D12_KdPrint (("D12TEST.SYS: enter D12_SelectInterface\n"));

    deviceExtension = DeviceObject->DeviceExtension;

    if (Interface == NULL) {

        //
        // D12 driver only supports one interface, we must search
        // the configuration descriptor for the interface we want
        // and remember the pipes.
        //

        urb = USBD_CreateConfigurationRequest(ConfigurationDescriptor, &siz);

        if (urb) {

            //
            // search thru all the interfaces
            // and find any we are interested in
            //

            interfaceNumber = 0;
            alternateSetting = 0;
//            alternateSetting = 3;

/*            interfaceDescriptor =
                USBD_ParseConfigurationDescriptor(ConfigurationDescriptor,
                                                  interfaceNumber,
                                                  alternateSetting);
*/
			interfaceDescriptor =
            USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor,
								  ConfigurationDescriptor, //search from start of config  descriptro
								  -1,	// interface number not a criteria; we only support one interface
								  -1,   // not interested in alternate setting here either
								  -1,   // interface class not a criteria
								  -1,   // interface subclass not a criteria
								  -1    // interface protocol not a criteria
								  );

            Interface = &urb->UrbSelectConfiguration.Interface;
            
            for (i=0; i< Interface->NumberOfPipes; i++) {
                //
                // perform any pipe initialization here
                //
                Interface->Pipes[i].MaximumTransferSize = 64*1024-1;
            }

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

//            Interface->AlternateSetting = 3;
            
            ntStatus = D12_CallUSBD(DeviceObject, urb);

            deviceExtension->ConfigurationHandle =
                urb->UrbSelectConfiguration.ConfigurationHandle;

        } else {
            ntStatus = STATUS_INSUFFICIENT_RESOURCES;
        }

    } else {
        //
        // we were give an interface already set up
        //
        // do a selectinterface here if we want to change any of the
        // pipe parameters.
        //

        TRAP();

    }

    ASSERT(Interface != NULL);

    if (NT_SUCCESS(ntStatus)) {

        //
        // Save the configuration handle for this device
        //

        deviceExtension->ConfigurationHandle =
            urb->UrbSelectConfiguration.ConfigurationHandle;

        deviceExtension->Interface = ExAllocatePool(NonPagedPool,
                                                    Interface->Length);

        if (deviceExtension->Interface) {
            ULONG j;

            //
            // save a copy of the interface information returned
            //
            RtlCopyMemory(deviceExtension->Interface, Interface, Interface->Length);

            //
            // Dump the interface to the debugger
            //
            D12_KdPrint (("D12TEST.SYS: ---------\n"));
            D12_KdPrint (("D12TEST.SYS: NumberOfPipes 0x%x\n", deviceExtension->Interface->NumberOfPipes));
            D12_KdPrint (("D12TEST.SYS: Length 0x%x\n", deviceExtension->Interface->Length));
            D12_KdPrint (("D12TEST.SYS: Alt Setting 0x%x\n", deviceExtension->Interface->AlternateSetting));
            D12_KdPrint (("D12TEST.SYS: Interface Number 0x%x\n", deviceExtension->Interface->InterfaceNumber));
            D12_KdPrint (("D12TEST.SYS: Class, subclass, protocol 0x%x 0x%x 0x%x\n",
                deviceExtension->Interface->Class,
                deviceExtension->Interface->SubClass,
                deviceExtension->Interface->Protocol));

            // Dump the pipe info

            for (j=0; j<Interface->NumberOfPipes; j++) {
                PUSBD_PIPE_INFORMATION pipeInformation;

                pipeInformation = &deviceExtension->Interface->Pipes[j];

                D12_KdPrint (("D12TEST.SYS: ---------\n"));
                D12_KdPrint (("D12TEST.SYS: PipeType 0x%x\n", pipeInformation->PipeType));
                D12_KdPrint (("D12TEST.SYS: EndpointAddress 0x%x\n", pipeInformation->EndpointAddress));
                D12_KdPrint (("D12TEST.SYS: MaxPacketSize 0x%x\n", pipeInformation->MaximumPacketSize));
                D12_KdPrint (("D12TEST.SYS: Interval 0x%x\n", pipeInformation->Interval));
                D12_KdPrint (("D12TEST.SYS: Handle 0x%x\n", pipeInformation->PipeHandle));
                D12_KdPrint (("D12TEST.SYS: MaximumTransferSize 0x%x\n", pipeInformation->MaximumTransferSize));
            }

            D12_KdPrint (("D12TEST.SYS: ---------\n"));
        }
    }

    if (urb) {
        ExFreePool(urb);
        urb = NULL;
    }

    // Retrieve the selected Configuration and Interface setting from the
    // device.  (The only purpose of doing this here is to exercise the
    // URB_FUNCTION_GET_CONFIGURATION and URB_FUNCTION_GET_INTERFACE
    // requests).
    //
    if (NT_SUCCESS(ntStatus)) {

        urb = ExAllocatePool(
                  NonPagedPool,
                  sizeof(struct _URB_CONTROL_GET_CONFIGURATION_REQUEST) + 1);

        if (urb)
        {
            PUCHAR configuration;

            configuration = (PUCHAR)urb + sizeof(struct _URB_CONTROL_GET_CONFIGURATION_REQUEST);
            *configuration = 0xFF;

            urb->UrbHeader.Function = URB_FUNCTION_GET_CONFIGURATION;
            urb->UrbHeader.Length = sizeof(struct _URB_CONTROL_GET_CONFIGURATION_REQUEST);
            urb->UrbControlGetConfigurationRequest.TransferBufferLength = 1;
            urb->UrbControlGetConfigurationRequest.TransferBuffer = configuration;
            urb->UrbControlGetConfigurationRequest.TransferBufferMDL = NULL;
            urb->UrbControlGetConfigurationRequest.UrbLink = NULL;

            ntStatus = D12_CallUSBD(DeviceObject, urb);

            D12_KdPrint (("D12TEST.SYS: Configuration %d (%x)\n",

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲色图色小说| 亚洲成人资源在线| 欧美日韩高清影院| 粉嫩av一区二区三区粉嫩| 一区二区三区加勒比av| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 国产成人99久久亚洲综合精品| 亚洲欧美另类小说| 久久看人人爽人人| 777xxx欧美| 91亚洲精品一区二区乱码| 国产九色sp调教91| 日韩av在线播放中文字幕| 亚洲精品国久久99热| 国产亚洲一区二区三区四区| 日韩三区在线观看| 欧美三级中文字幕在线观看| 99国产麻豆精品| 成人黄色av网站在线| 激情欧美一区二区三区在线观看| 日韩电影一二三区| 亚洲伊人色欲综合网| 亚洲精品亚洲人成人网| 1024成人网| 中文字幕国产一区| 中文字幕不卡一区| 中文av字幕一区| 国产日韩欧美不卡| 国产欧美一区视频| 日本一区二区久久| 国产精品久久久久久久岛一牛影视| 久久久精品蜜桃| 久久精品日产第一区二区三区高清版 | 国产精品久久久久久亚洲毛片 | 久久久久久一二三区| 日韩欧美一区二区不卡| 欧美精品日韩精品| 在线观看91精品国产麻豆| 欧美三级电影在线观看| 欧美浪妇xxxx高跟鞋交| 欧美精品乱人伦久久久久久| 欧美精品 国产精品| 欧美一区二区三区思思人| 91精品久久久久久久99蜜桃 | 亚洲精品国产一区二区精华液| ...xxx性欧美| 亚洲精品第一国产综合野| 亚洲香蕉伊在人在线观| 日韩激情一二三区| 精品在线播放免费| 国产精品996| 99re热视频这里只精品| 在线观看视频欧美| 欧美剧情片在线观看| 欧美一卡二卡在线观看| 久久久国产午夜精品| 国产精品久99| 天天av天天翘天天综合网 | 国产成人免费在线观看| 国产成人免费在线| 日本黄色一区二区| 欧美一级一级性生活免费录像| 精品国产乱码久久久久久夜甘婷婷| 国产拍欧美日韩视频二区| 亚洲精品乱码久久久久| 日韩电影在线一区| 不卡高清视频专区| 欧美日韩综合在线| 亚洲精品在线一区二区| 亚洲色图在线看| 免费xxxx性欧美18vr| 国产不卡在线一区| 欧美日韩免费视频| 久久综合狠狠综合久久综合88| 亚洲男人电影天堂| 另类小说图片综合网| 色婷婷亚洲综合| 久久婷婷综合激情| 夜夜嗨av一区二区三区网页| 美日韩一级片在线观看| 99热精品一区二区| 91精品婷婷国产综合久久性色| 中文字幕中文字幕一区二区| 男人的j进女人的j一区| 色悠久久久久综合欧美99| 欧美mv日韩mv| 亚洲v中文字幕| 国产精品羞羞答答xxdd| 欧美另类变人与禽xxxxx| 国产欧美精品一区| 久久99精品国产.久久久久| 色婷婷综合久久久| 中文字幕第一区二区| 蜜臀av性久久久久蜜臀aⅴ流畅| 91偷拍与自偷拍精品| 26uuuu精品一区二区| 亚洲成av人影院在线观看网| 99v久久综合狠狠综合久久| 欧美成人女星排行榜| 午夜一区二区三区视频| www.日本不卡| 久久日韩粉嫩一区二区三区| 日韩国产精品大片| 欧美三级电影在线看| 国产精品欧美久久久久无广告| 久久99国产乱子伦精品免费| 欧美日韩一区成人| 亚洲欧美日韩国产综合| 成人免费毛片a| 久久久久久电影| 蜜桃久久久久久久| 欧美一区二区成人| 亚洲第一会所有码转帖| 色综合久久99| 亚洲图片欧美激情| 蜜臀av性久久久久蜜臀aⅴ流畅| 粉嫩欧美一区二区三区高清影视| 欧美一区二区福利在线| 亚洲国产综合91精品麻豆| 91视频免费看| 国产精品美女久久久久久久| 国产精品自在在线| 精品日产卡一卡二卡麻豆| 亚洲大片精品永久免费| 欧美亚洲日本一区| 亚洲欧美另类小说| 色偷偷久久一区二区三区| 亚洲欧美综合色| 懂色一区二区三区免费观看 | 午夜国产精品一区| 欧美色精品在线视频| 亚洲成人在线免费| 精品视频1区2区| 午夜欧美视频在线观看| 欧美日本在线视频| 日本亚洲三级在线| 日韩免费高清视频| 国产精品综合二区| 国产精品久久777777| 91社区在线播放| 亚洲综合免费观看高清完整版| 在线观看国产一区二区| 亚洲国产欧美在线| 91精品久久久久久蜜臀| 精品一区二区在线看| 欧美激情一区二区| 色老综合老女人久久久| 亚洲观看高清完整版在线观看| 欧美巨大另类极品videosbest | 韩国毛片一区二区三区| 国产亚洲精品资源在线26u| 岛国精品在线观看| 亚洲精品精品亚洲| 宅男在线国产精品| 国产美女视频一区| 亚洲欧美综合网| 欧美精品在线一区二区三区| 免费看黄色91| 国产无人区一区二区三区| 97精品电影院| 日本成人在线网站| 国产精品无遮挡| 91福利视频网站| 麻豆国产精品777777在线| 国产精品美女久久久久久久久| 欧美羞羞免费网站| 国产麻豆视频精品| 亚洲精品你懂的| 精品国产电影一区二区 | 日韩欧美国产电影| 9久草视频在线视频精品| 亚洲国产美女搞黄色| 久久午夜色播影院免费高清| 99久久99久久免费精品蜜臀| 午夜视频一区二区三区| 国产日韩亚洲欧美综合| 欧美日韩国产中文| 国产精品99久久久久久宅男| 一区二区三区产品免费精品久久75| 日韩欧美在线影院| 91污在线观看| 极品少妇xxxx偷拍精品少妇| 亚洲精品成人在线| 国产婷婷一区二区| 欧美肥妇free| 色噜噜狠狠成人中文综合| 国产乱色国产精品免费视频| 亚洲国产中文字幕| 欧美国产日韩亚洲一区| 日韩欧美高清dvd碟片| 日本二三区不卡| 成人av在线影院| 久久成人免费电影| 亚洲一级二级在线| 国产精品免费看片| 亚洲精品一区二区三区精华液 | 亚洲一级二级三级| 国产人成亚洲第一网站在线播放| 91精品在线一区二区| 在线一区二区三区四区五区 |