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

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

?? ezusbsys.c

?? cy7c68013usbdriver驅動程序,非常方便
?? C
?? 第 1 頁 / 共 5 頁
字號:
        } else {
            // Failed getting data buffer (configurationDescriptor) memory
            ntStatus = STATUS_NO_MEMORY;
            goto Exit_EzusbConfigureDevice;
        }//if-else

    } else {
        // failed getting urb memory
        ntStatus = STATUS_NO_MEMORY;
        goto Exit_EzusbConfigureDevice;
    }//if-else

    /*
    // We have the configuration descriptor for the configuration
    // we want.
    //
    // Now we issue the SelectConfiguration command to get
    // the  pipes associated with this configuration.
    */
    if (configurationDescriptor) {
        // Get our pipes
        ntStatus = Ezusb_SelectInterfaces(fdo,
                                           configurationDescriptor,
                                           NULL // Device not yet configured
                                           );
    } //if

Exit_EzusbConfigureDevice:

    // Clean up and exit this routine
    if (urb != NULL) {
        ExFreePool(urb);                    // Free urb memory
    }//if

    if (configurationDescriptor != NULL) {
        ExFreePool(configurationDescriptor);// Free data buffer
    }//if

    Ezusb_KdPrint (("exit Ezusb_ConfigureDevice (%x)\n", ntStatus));
    return ntStatus;
}//Ezusb_ConfigureDevice


NTSTATUS
Ezusb_SelectInterfaces(
    IN PDEVICE_OBJECT fdo,
    IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
    IN PUSBD_INTERFACE_INFORMATION Interface
    )
/*++

Routine Description:
    Initializes an Ezusb Device with multiple interfaces

Arguments:
    fdo            - pointer to the device object for this instance of the Ezusb Device
    ConfigurationDescriptor - pointer to the USB configuration descriptor containing the interface and endpoint
                              descriptors.
    Interface               - pointer to a USBD Interface Information Object
                            - If this is NULL, then this driver must choose its interface based on driver-specific
                              criteria, and the driver must also CONFIGURE the device.
                            - If it is NOT NULL, then the driver has already been given an interface and
                              the device has already been configured by the parent of this device driver.

Return Value:
    NT status code
--*/
{
   PDEVICE_EXTENSION pdx;
   NTSTATUS ntStatus;
   PURB urb;
   ULONG j;
   UCHAR alternateSetting, MyInterfaceNumber;
   PUSBD_INTERFACE_INFORMATION interfaceObject;
   USBD_INTERFACE_LIST_ENTRY interfaceList[2];

   Ezusb_KdPrint (("enter Ezusb_SelectInterfaces\n"));

   pdx = fdo->DeviceExtension;
   MyInterfaceNumber = SAMPLE_INTERFACE_NBR;

	// Search the configuration descriptor for the first interface/alternate setting

   interfaceList[0].InterfaceDescriptor =
   USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor,
                                       ConfigurationDescriptor,
                                       -1,         // Interface - don't care
                                       -1,         // Alternate Setting - don't care
                                       -1,         // Class - don't care
                                       -1,         // SubClass - don't care
                                       -1);        // Protocol - don't care

   ASSERT(interfaceList[0].InterfaceDescriptor != NULL);

   interfaceList[1].InterfaceDescriptor = NULL;
   interfaceList[1].Interface = NULL;

   urb = USBD_CreateConfigurationRequestEx(ConfigurationDescriptor,&interfaceList[0]);

   if (!urb)
   {
      Ezusb_KdPrint ((" USBD_CreateConfigurationRequestEx failed\n"));            
   }

   DumpBuffer(urb, urb->UrbHeader.Length);

   interfaceObject = (PUSBD_INTERFACE_INFORMATION) (&(urb->UrbSelectConfiguration.Interface));

   /*
   // We set up a default max transfer size for the endpoints.  Your driver will
   // need to change this to reflect the capabilities of your device's endpoints.
   */
   for (j=0; j<interfaceList[0].InterfaceDescriptor->bNumEndpoints; j++)
      interfaceObject->Pipes[j].MaximumTransferSize = (64 * 1024) - 1;


   ntStatus = Ezusb_CallUSBD(fdo, urb);

   DumpBuffer(urb, urb->UrbHeader.Length);

   if (NT_SUCCESS(ntStatus) && USBD_SUCCESS(urb->UrbHeader.Status))
   {

      // Save the configuration handle for this device
      pdx->ConfigurationHandle =
         urb->UrbSelectConfiguration.ConfigurationHandle;

      pdx->Interface = ExAllocatePool(NonPagedPool,
                                                interfaceObject->Length);

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

      // Dump the interfaceObject to the debugger
      Ezusb_KdPrint (("---------\n"));
      Ezusb_KdPrint (("NumberOfPipes 0x%x\n", pdx->Interface->NumberOfPipes));
      Ezusb_KdPrint (("Length 0x%x\n", pdx->Interface->Length));
      Ezusb_KdPrint (("Alt Setting 0x%x\n", pdx->Interface->AlternateSetting));
      Ezusb_KdPrint (("Interface Number 0x%x\n", pdx->Interface->InterfaceNumber));

      // Dump the pipe info
      for (j=0; j<interfaceObject->NumberOfPipes; j++)
      {
         PUSBD_PIPE_INFORMATION pipeInformation;

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

         Ezusb_KdPrint (("---------\n"));
         Ezusb_KdPrint (("PipeType 0x%x\n", pipeInformation->PipeType));
         Ezusb_KdPrint (("EndpointAddress 0x%x\n", pipeInformation->EndpointAddress));
         Ezusb_KdPrint (("MaxPacketSize 0x%x\n", pipeInformation->MaximumPacketSize));
         Ezusb_KdPrint (("Interval 0x%x\n", pipeInformation->Interval));
         Ezusb_KdPrint (("Handle 0x%x\n", pipeInformation->PipeHandle));
         Ezusb_KdPrint (("MaximumTransferSize 0x%x\n", pipeInformation->MaximumTransferSize));
      }

      Ezusb_KdPrint (("---------\n"));
   }


   Ezusb_KdPrint (("exit Ezusb_SelectInterfaces (%x)\n", ntStatus));

   return ntStatus;

}/* Ezusb_SelectInterfaces */


NTSTATUS
Ezusb_Read_Write(
   IN  PDEVICE_OBJECT fdo,
   IN  PIRP Irp
   )
/*++
Routine Description:
    
Arguments:

Return Value:
    NT status code
        STATUS_SUCCESS:                 Read was done successfully
        STATUS_INVALID_PARAMETER_3:     The Endpoint Index does not specify an IN pipe 
        STATUS_NO_MEMORY:               Insufficient data memory was supplied to perform the READ

    This routine fills the status code into the Irp
    
--*/
{
   PDEVICE_EXTENSION          pdx = fdo->DeviceExtension;
   NTSTATUS                   ntStatus;
   PIO_STACK_LOCATION         irpStack = IoGetCurrentIrpStackLocation (Irp);
   PBULK_TRANSFER_CONTROL     bulkControl =
                              (PBULK_TRANSFER_CONTROL)Irp->AssociatedIrp.SystemBuffer;
   ULONG                      bufferLength =
                              irpStack->Parameters.DeviceIoControl.OutputBufferLength;
   PURB                       urb = NULL;
   ULONG                      urbSize = 0;
   ULONG                      transferFlags = 0;
   PUSBD_INTERFACE_INFORMATION interfaceInfo = NULL;
   PUSBD_PIPE_INFORMATION     pipeInfo = NULL;
   USBD_PIPE_HANDLE           pipeHandle = NULL;


   Ezusb_KdPrint(("enter Ezusb_Read_Write()\n"));
   
   //
   // verify that the selected pipe is valid, and get a handle to it. If anything
   // is wrong, return an error
   //
   interfaceInfo = pdx->Interface;

   if (!interfaceInfo)
   {
      Ezusb_KdPrint(("Ezusb_Read_Write() no interface info - Exiting\n"));
      return STATUS_UNSUCCESSFUL;
   }
   
   if (bulkControl->pipeNum > interfaceInfo->NumberOfPipes)
   {
      Ezusb_KdPrint(("Ezusb_Read_Write() invalid pipe - Exiting\n"));
      return STATUS_INVALID_PARAMETER;
   }

   pipeInfo = &(interfaceInfo->Pipes[bulkControl->pipeNum]);

   if (!((pipeInfo->PipeType == UsbdPipeTypeBulk) ||
         (pipeInfo->PipeType == UsbdPipeTypeInterrupt)))
   {
      Ezusb_KdPrint(("Ezusb_Read_Write() invalid pipe - Exiting\n"));
      return STATUS_INVALID_PARAMETER;
   }

   pipeHandle = pipeInfo->PipeHandle;

   if (!pipeHandle)
   {
      Ezusb_KdPrint(("Ezusb_Read_Write() invalid pipe - Exiting\n"));
      return STATUS_UNSUCCESSFUL;
   }

   if (bufferLength > pipeInfo->MaximumTransferSize)
   {
      Ezusb_KdPrint(("Ezusb_Read_Write() invalid transfer size - Exiting\n"));
      return STATUS_INVALID_PARAMETER;
   }

   //
   // allocate and fill in the Usb request (URB)
   //
   urbSize = sizeof(struct _URB_BULK_OR_INTERRUPT_TRANSFER);

   urb = ExAllocatePool(NonPagedPool,urbSize);

   if (!urb)
   {
      Ezusb_KdPrint(("Ezusb_Read_Write() unable to alloc URB - Exiting\n"));
      return STATUS_NO_MEMORY;
   }
   

   transferFlags = USBD_SHORT_TRANSFER_OK;

   //
   // get direction info from the endpoint address
   //
   if (USB_ENDPOINT_DIRECTION_IN(pipeInfo->EndpointAddress))
      transferFlags |= USBD_TRANSFER_DIRECTION_IN;

   UsbBuildInterruptOrBulkTransferRequest(urb,        //ptr to urb
                        (USHORT) urbSize,             //size of urb
							   pipeHandle,                   //usbd pipe handle
							   NULL,                         //TransferBuffer
							   Irp->MdlAddress,              //mdl
							   bufferLength,                 //bufferlength
							   transferFlags,                //flags
							   NULL);                        //link

   //
   // Call the USB Stack.
   //
	ntStatus = Ezusb_CallUSBD(fdo, urb);

   //
   // If the transfer was successful, report the length of the transfer to the
   // caller by setting IoStatus.Information
   //
   if (NT_SUCCESS(ntStatus))
   {
      Irp->IoStatus.Information = urb->UrbBulkOrInterruptTransfer.TransferBufferLength;
      Ezusb_KdPrint(("Successfully transfered 0x%x bytes\n",Irp->IoStatus.Information));
   }

   //
   // free the URB
   //
   ExFreePool(urb);

   return ntStatus;
}


NTSTATUS
Ezusb_Create(
    IN PDEVICE_OBJECT fdo,
    IN PIRP Irp
    )
/*++
Routine Description:
     This is the Entry point for CreateFile calls from user mode apps (apps may open "\\.\Ezusb-x\yyzz"
     where yy is the interface number and zz is the endpoint address).

     Here is where you would add code to create symbolic links between endpoints
     (i.e., pipes in USB software terminology) and User Mode file names.  You are
     free to use any convention you wish to create these links, although the above
     convention offers a way to identify resources on a device by familiar file and
     directory structure nomenclature.

Arguments:
    fdo - pointer to the device object for this instance of the Ezusb device

Return Value:
    NT status code
--*/
{
   NTSTATUS ntStatus;
   PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION )fdo->DeviceExtension;

   Ezusb_KdPrint(("Enter Ezusb_Create()\n"));

   if (!pdx->Started)
   {
      return STATUS_UNSUCCESSFUL;
   }

   // increment the open handle counter
   pdx->OpenHandles++;

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

   // Create all the symbolic links here
   ntStatus = Irp->IoStatus.Status;

   IoCompleteRequest (Irp,
                    IO_NO_INCREMENT
                    );

   return ntStatus;

}//Ezusb_Create


NTSTATUS
Ezusb_Close(
    IN PDEVICE_OBJECT fdo,
    IN PIRP Irp
    )
/*++
Routine Description:
    Entry point for CloseHandle calls from user mode apps to close handles they have opened

Arguments:
    fdo - pointer to the device object for this instance of the Ezusb device
    Irp          - pointer to an irp

Return Value:
    NT status code

--*/
{
   NTSTATUS ntStatus;
   PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION )fdo->DeviceExtension;

   Ezusb_KdPrint(("Enter Ezusb_Close()\n"));

   // decrement the open handle counter
   pdx->OpenHandles--;

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

   ntStatus = Irp->IoStatus.Status;

   IoCompleteRequest (Irp,
                    IO_NO_INCREMENT
                    );

   return ntStatus;

}//Ezusb_Close


NTSTATUS
Ezusb_ProcessIOCTL(
    IN PDEVICE_OBJECT fdo,
    IN PIRP Irp
    )
/*++

Routine Description:
   This where all the DeviceIoControl codes are handled.  You can add mor

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
奇米影视7777精品一区二区| 欧美另类久久久品| 懂色av一区二区三区免费看| 精品一区二区av| 欧美一区二区久久久| 欧美精品aⅴ在线视频| 91精品国产福利| 精品免费视频.| 久久久蜜桃精品| 国产欧美日本一区二区三区| 中文字幕在线视频一区| 国产精品久久久久婷婷| 亚洲视频免费看| 亚洲最快最全在线视频| 午夜伦理一区二区| 久久激情综合网| 风间由美一区二区三区在线观看 | 国产一区二区视频在线播放| 国产一区不卡精品| www.亚洲免费av| 91黄视频在线| 7777精品伊人久久久大香线蕉完整版 | 欧美色图天堂网| 欧美人动与zoxxxx乱| 91精品国产福利| 久久久综合视频| 亚洲欧洲日韩女同| 亚洲自拍偷拍麻豆| 久久国内精品视频| a级精品国产片在线观看| 在线欧美日韩国产| 欧美一区二区三区四区高清| 久久久久国产一区二区三区四区| 国产精品久久久久久久浪潮网站| 亚洲五码中文字幕| 精品一区二区三区免费毛片爱 | 亚洲精品一区二区三区在线观看| 久久嫩草精品久久久精品| 中文字幕制服丝袜一区二区三区| 亚洲综合久久av| 国产一区二区视频在线| 91蝌蚪porny成人天涯| 欧美一区二区三区播放老司机| 久久精品男人天堂av| 亚洲影院理伦片| 国产一区二区三区四区在线观看| 97久久精品人人做人人爽| 91精品在线观看入口| 国产亚洲短视频| 午夜视频一区二区| 国产69精品久久久久777| 欧美三级视频在线| 国产夜色精品一区二区av| 午夜精品在线视频一区| 成人午夜精品在线| 日韩视频在线你懂得| 成人欧美一区二区三区1314| 欧美一区二区精品久久911| 中文在线资源观看网站视频免费不卡 | 国产精品嫩草影院com| 日韩成人dvd| 91色视频在线| 日本一区二区视频在线观看| 首页国产欧美久久| 91视视频在线观看入口直接观看www| 日韩免费高清av| 亚洲成在人线在线播放| 成人免费va视频| 精品国产一区二区三区忘忧草| 亚洲一区二区三区不卡国产欧美| 成人黄色大片在线观看| 欧美mv和日韩mv的网站| 婷婷中文字幕综合| 91国产成人在线| 亚洲人成精品久久久久| 国产真实精品久久二三区| 91超碰这里只有精品国产| 一区二区三区中文字幕电影| 成人自拍视频在线| 久久色在线视频| 麻豆91在线观看| 69久久夜色精品国产69蝌蚪网| 亚洲男人的天堂一区二区| 成人激情小说乱人伦| 国产亚洲欧洲997久久综合 | 岛国一区二区三区| 国产在线麻豆精品观看| 欧美日韩综合不卡| 一区二区三区免费在线观看| 99久久免费视频.com| 国产精品欧美久久久久无广告| 国产在线视频一区二区| 欧美大片在线观看一区| 蜜桃久久精品一区二区| 欧美一区二区久久久| 日本中文字幕一区| 欧美一区二区高清| 美女视频黄频大全不卡视频在线播放 | 欧美怡红院视频| 成人欧美一区二区三区视频网页| 成人晚上爱看视频| 国产欧美日韩在线看| 国产精品888| 国产欧美精品在线观看| 丁香啪啪综合成人亚洲小说 | 婷婷中文字幕综合| 欧美剧情片在线观看| 日韩电影在线免费观看| 4438x亚洲最大成人网| 日韩av成人高清| 欧美成人免费网站| 国产一区二区三区香蕉| 国产婷婷色一区二区三区在线| 国产成人免费视频精品含羞草妖精| 久久这里只有精品6| 大胆亚洲人体视频| 最近中文字幕一区二区三区| 91麻豆国产精品久久| 亚洲最色的网站| 欧美一级视频精品观看| 国精品**一区二区三区在线蜜桃| 久久精品亚洲一区二区三区浴池 | 欧美最猛性xxxxx直播| 亚洲第一精品在线| 日韩一区二区三区精品视频| 国产综合色在线| 一区二区中文视频| 欧美日韩中文字幕一区| 欧美浪妇xxxx高跟鞋交| 韩国精品一区二区| 综合网在线视频| 欧美日韩mp4| 国产乱人伦偷精品视频免下载 | 国产成人免费高清| 亚洲美女免费视频| 欧美一区二区三区在线观看| 国产精品99久久久久久久vr| 综合久久久久久| 欧美群妇大交群中文字幕| 国产一区欧美一区| 国产精品美女久久福利网站| 欧美视频三区在线播放| 国产一区二区美女| 亚洲女同ⅹxx女同tv| 欧美一区二区三区在线观看| 成人h版在线观看| 日韩国产欧美在线播放| 欧美激情在线看| 欧美日韩成人激情| 国产91丝袜在线18| 天天色图综合网| 一区免费观看视频| 精品日韩欧美一区二区| 色综合天天综合| 久久精品久久精品| 亚洲精品成人精品456| 精品久久一区二区三区| 欧美主播一区二区三区美女| 国产一二精品视频| 亚洲成人一区在线| 日本一区二区免费在线| 欧美日韩国产色站一区二区三区| 国产精品一区一区三区| 亚洲3atv精品一区二区三区| 国产精品日韩成人| 日韩女同互慰一区二区| 日本黄色一区二区| 丁香婷婷深情五月亚洲| 毛片av一区二区三区| 亚洲宅男天堂在线观看无病毒| 2020国产成人综合网| 4438x成人网最大色成网站| 99久久精品国产麻豆演员表| 国产综合久久久久影院| 婷婷中文字幕一区三区| 亚洲精品乱码久久久久久黑人| 久久伊99综合婷婷久久伊| 欧美日韩一区二区在线观看视频| av中文字幕亚洲| 日本一区二区三区视频视频| 91精品婷婷国产综合久久性色 | 国产精品资源在线观看| 亚洲成人福利片| 亚洲色图色小说| 国产人妖乱国产精品人妖| 欧美一级黄色录像| 欧美日韩免费高清一区色橹橹| 99久久伊人网影院| 成人免费视频播放| 国产精品一线二线三线精华| 蜜芽一区二区三区| 天天综合网天天综合色| 亚洲午夜久久久久久久久电影网| 国产精品电影一区二区| 国产精品视频看| 欧美国产日韩精品免费观看| 久久九九全国免费| 久久久久久电影| 国产欧美一区二区三区网站 | 一区二区成人在线|