亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
成人av午夜影院| 精品嫩草影院久久| 久久婷婷久久一区二区三区| 亚洲欧美日韩在线不卡| 另类小说一区二区三区| 91福利视频久久久久| 久久精品欧美日韩| 日韩av午夜在线观看| 色婷婷激情久久| 国产精品久久久久久福利一牛影视| 免费久久99精品国产| 欧美在线播放高清精品| 一区在线播放视频| 岛国一区二区在线观看| 精品日韩一区二区| 蜜桃久久精品一区二区| 欧美日韩国产首页| 樱桃国产成人精品视频| 91亚洲精品一区二区乱码| 久久精品一区蜜桃臀影院| 老司机午夜精品| 精品久久久久久综合日本欧美 | 欧美日韩亚州综合| 国产精品久线在线观看| 国产一区二区不卡在线 | 美女www一区二区| 欧美丰满高潮xxxx喷水动漫| 亚洲综合久久久久| 欧美视频一区二区三区| 一区二区久久久| 欧美性做爰猛烈叫床潮| 亚洲高清视频中文字幕| 9191成人精品久久| 免费观看在线色综合| 日韩欧美一区在线观看| 看国产成人h片视频| 精品国产成人系列| 国产成人精品亚洲777人妖 | 91网站在线观看视频| 国产午夜精品一区二区三区嫩草| 国产资源在线一区| 国产日韩成人精品| 色综合天天综合给合国产| 亚洲欧美一区二区三区久本道91 | 欧美变态口味重另类| 国产一区二区三区免费播放| 久久精品免视看| 91伊人久久大香线蕉| 一区二区三区成人| 这里只有精品免费| 国产白丝网站精品污在线入口| 国产精品久久久久久久第一福利 | 国产精品久久久爽爽爽麻豆色哟哟 | 欧美在线啊v一区| 午夜欧美一区二区三区在线播放| 欧美一级片在线看| 国产精品自拍av| 亚洲欧美日本在线| 777精品伊人久久久久大香线蕉| 亚洲不卡一区二区三区| 亚洲国产一区视频| 欧美三级一区二区| 视频一区中文字幕国产| 欧美精品一区二区三区视频| av动漫一区二区| 婷婷中文字幕一区三区| 久久精品无码一区二区三区| 色综合咪咪久久| 久久99国产精品久久| 亚洲欧美激情视频在线观看一区二区三区 | 99视频一区二区| 美女爽到高潮91| 亚洲欧美日韩一区| 日韩欧美国产一区在线观看| 国产成人av一区二区三区在线观看| 亚洲综合色婷婷| 国产日韩欧美一区二区三区综合| 欧美性一级生活| 国产不卡视频在线播放| 免费精品99久久国产综合精品| 《视频一区视频二区| 精品美女在线播放| 欧美日韩一区二区三区不卡| 成人永久免费视频| 精品一区二区三区久久久| 亚洲伊人伊色伊影伊综合网| 日本一区二区三区在线观看| 91精品国产综合久久小美女| 91伊人久久大香线蕉| 国产成人精品一区二| 美女久久久精品| 丝袜美腿亚洲一区| 亚洲乱码国产乱码精品精小说 | 日韩精品专区在线影院观看| 欧美综合欧美视频| 91蜜桃视频在线| 国产成人aaa| 国产成人免费av在线| 麻豆精品一区二区av白丝在线| 亚洲福利一区二区| 一区二区成人在线| 伊人色综合久久天天人手人婷| 国产精品丝袜在线| 中文字幕欧美国产| 欧美激情一区二区三区| 精品国产91久久久久久久妲己| 欧美一区午夜精品| 欧美人xxxx| 777午夜精品视频在线播放| 欧洲一区二区三区免费视频| 91免费小视频| 色老汉一区二区三区| 色综合 综合色| 色一区在线观看| 色综合天天狠狠| 在线观看成人小视频| 欧美午夜精品久久久久久孕妇 | 日韩一区二区三区电影在线观看| 色婷婷综合久久久久中文| 91在线高清观看| 欧美午夜精品一区二区三区| 精品视频免费看| 日韩午夜激情视频| 久久综合九色综合97婷婷女人| www国产成人| 亚洲国产精品ⅴa在线观看| 国产精品人妖ts系列视频| 中文字幕中文乱码欧美一区二区 | 日韩国产欧美在线观看| 青椒成人免费视频| 麻豆一区二区99久久久久| 国产精品自拍网站| 97国产精品videossex| 欧美日韩中字一区| 2021中文字幕一区亚洲| 国产精品热久久久久夜色精品三区| 亚洲精品一二三区| 免费人成精品欧美精品| 丁香婷婷综合激情五月色| 色欧美片视频在线观看在线视频| 欧美精品久久99| 久久久美女毛片| 亚洲国产综合在线| 黄色成人免费在线| 色婷婷综合在线| 精品美女在线观看| 亚洲黄色av一区| 国产露脸91国语对白| 色综合激情久久| 久久久高清一区二区三区| 亚洲人午夜精品天堂一二香蕉| 丝袜美腿亚洲一区| 9色porny自拍视频一区二区| 欧美美女激情18p| 国产精品网站在线观看| 亚洲成a人v欧美综合天堂| 国产精品影视在线| 制服丝袜成人动漫| 亚洲色图一区二区| 国产一区二区三区电影在线观看| 99re视频精品| 久久亚洲免费视频| 亚洲chinese男男1069| 成人中文字幕电影| 91精品国产色综合久久ai换脸| 国产精品电影一区二区| 精品午夜一区二区三区在线观看| 91麻豆精品在线观看| 国产亚洲精品超碰| 免费av网站大全久久| 一本一道久久a久久精品综合蜜臀| 日韩一区二区三区电影在线观看| 亚洲黄色小说网站| 99久久99久久精品免费观看| 久久久久久一二三区| 丝袜美腿高跟呻吟高潮一区| 久久精品一区蜜桃臀影院| 蜜臀va亚洲va欧美va天堂| 一本大道av伊人久久综合| 国产精品久久久久aaaa| 国产最新精品精品你懂的| 欧美一二区视频| 日本在线播放一区二区三区| 色哦色哦哦色天天综合| 亚洲天堂av一区| www.av亚洲| 国产精品丝袜久久久久久app| 精品一区二区三区香蕉蜜桃| 日韩欧美一区二区不卡| 日本成人在线视频网站| 欧美肥胖老妇做爰| 亚洲444eee在线观看| 欧美日韩一级片在线观看| 一区二区三区四区高清精品免费观看| 成人综合在线观看| 欧美激情在线一区二区| 成人午夜伦理影院| 日韩一区在线看| 色狠狠色狠狠综合| 一区二区成人在线|