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

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

?? ezusbsys.c

?? EZ Usb system driver written in C.. a useful USB driver..
?? C
?? 第 1 頁 / 共 5 頁
字號:
                //Error in getting configuration descriptor
                goto Exit_EzusbConfigureDevice;
            }//else

        } 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);

   // how can this happen?
   if (interfaceList[0].InterfaceDescriptor == NULL)
	return STATUS_UNSUCCESSFUL;   

   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 = (8192 * 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,
    

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品网站导航| 欧美亚洲国产bt| 日韩欧美国产精品一区| 亚洲国产裸拍裸体视频在线观看乱了| 国产aⅴ精品一区二区三区色成熟| 欧美一级一区二区| 99国产精品久| 亚洲柠檬福利资源导航| gogo大胆日本视频一区| 国产日韩亚洲欧美综合| av激情亚洲男人天堂| 中文字幕免费观看一区| 粉嫩一区二区三区性色av| 久久久欧美精品sm网站| 成人黄页毛片网站| 亚洲日本一区二区| 欧美性视频一区二区三区| 一区二区三区在线视频观看58| 精品视频全国免费看| 午夜影视日本亚洲欧洲精品| 欧美久久久久中文字幕| 日韩高清一级片| 国产三区在线成人av| 成人在线综合网站| ...av二区三区久久精品| 一本色道a无线码一区v| 午夜伦欧美伦电影理论片| 337p亚洲精品色噜噜| 黄色日韩网站视频| 中文字幕一区在线观看视频| 欧美性生活影院| 麻豆精品久久久| 2020国产精品久久精品美国| 成人黄动漫网站免费app| 日韩欧美中文字幕一区| 国产精品一区免费在线观看| 国产夜色精品一区二区av| av高清不卡在线| 亚洲欧洲精品天堂一级| 欧美一级高清片在线观看| 国产高清不卡一区| 亚洲在线观看免费视频| 51久久夜色精品国产麻豆| 国产不卡视频一区| 亚洲五月六月丁香激情| 欧美变态tickling挠脚心| 激情文学综合丁香| 亚洲一二三四在线| 2019国产精品| 欧美性一区二区| 午夜久久久久久久久| 中文字幕va一区二区三区| 在线精品视频一区二区| 国产一区免费电影| 一区2区3区在线看| 国产三区在线成人av| 欧美日韩电影在线| 波多野结衣精品在线| 日韩和的一区二区| 中文字幕日韩av资源站| 欧美第一区第二区| 在线视频欧美精品| 国产成人精品一区二区三区网站观看 | 日本高清成人免费播放| 精品无人码麻豆乱码1区2区 | 国产一区二区三区黄视频| 久久 天天综合| 亚洲午夜一区二区| 精品第一国产综合精品aⅴ| 欧美日韩国产电影| 成人精品免费网站| 国内精品伊人久久久久影院对白| 亚洲欧美怡红院| 国产精品网曝门| www激情久久| 日韩视频国产视频| 在线精品国精品国产尤物884a| 从欧美一区二区三区| 国产高清精品久久久久| 国内精品在线播放| 美女高潮久久久| 亚洲va欧美va国产va天堂影院| 一区二区免费在线| 亚洲三级在线免费| 欧美高清在线精品一区| 久久综合成人精品亚洲另类欧美| 亚洲精品一区二区三区四区高清| 7777精品伊人久久久大香线蕉经典版下载 | 欧美性受极品xxxx喷水| 色诱视频网站一区| 99久久综合99久久综合网站| 成人网页在线观看| 成人成人成人在线视频| 成人禁用看黄a在线| 成人aaaa免费全部观看| 99久久婷婷国产| 91丨porny丨国产| 91蜜桃免费观看视频| 91亚洲午夜精品久久久久久| 国产精品一区二区免费不卡| 国产成人午夜视频| 不卡的电影网站| 色综合久久久久综合体| 懂色av一区二区夜夜嗨| 97se亚洲国产综合自在线观| 色欧美片视频在线观看| 欧美日韩精品一区二区三区四区 | 色综合久久久久综合体| 91视频www| 宅男噜噜噜66一区二区66| 精品区一区二区| 国产精品美女久久久久久| 亚洲午夜久久久久久久久久久 | 国产69精品久久久久777| 欧美这里有精品| 91精品国产全国免费观看| 久久久精品黄色| 一区二区不卡在线播放 | 久久99精品国产.久久久久| 91亚洲大成网污www| 91精品国产免费| 中文字幕一区二区视频| 久久er99精品| 欧美在线观看视频在线| 国产亚洲一二三区| 午夜精品免费在线| youjizz国产精品| 日韩一区二区三区电影在线观看| 国产清纯白嫩初高生在线观看91| 亚洲一区二三区| 成人中文字幕合集| 日韩欧美卡一卡二| 亚洲图片欧美色图| 国产成人鲁色资源国产91色综| 欧美日韩色一区| 中文字幕在线一区免费| 国内精品视频666| 欧美精品在欧美一区二区少妇| 综合自拍亚洲综合图不卡区| 精品亚洲porn| 这里是久久伊人| 亚洲午夜久久久久久久久电影院| 99久久精品免费看| 久久精品亚洲国产奇米99| 日本成人中文字幕| 在线视频欧美区| 亚洲人精品午夜| 成人国产亚洲欧美成人综合网| 26uuu精品一区二区| 日本最新不卡在线| 欧美日韩在线观看一区二区| 亚洲色欲色欲www| 岛国av在线一区| 国产欧美一二三区| 国产精品一区二区三区乱码| 精品日韩在线一区| 免费观看久久久4p| 欧美猛男超大videosgay| 洋洋成人永久网站入口| 91麻豆国产在线观看| 亚洲四区在线观看| 成人深夜在线观看| 国产人久久人人人人爽| 国产一区二区三区免费播放| 精品国一区二区三区| 青青草国产成人99久久| 4438x成人网最大色成网站| 日韩电影在线观看网站| 欧美一区二区三区四区视频| 丝瓜av网站精品一区二区| 欧美日韩精品一区视频| 日本午夜一区二区| 日韩欧美一级在线播放| 激情欧美一区二区| 久久先锋影音av鲁色资源| 国产精品1024| 国产精品另类一区| 91美女福利视频| 亚洲国产精品久久人人爱蜜臀| 欧美日韩视频在线观看一区二区三区| 午夜视黄欧洲亚洲| 日韩欧美电影在线| 国产高清不卡二三区| 中文字幕中文在线不卡住| 91色.com| 日韩影院免费视频| 精品少妇一区二区三区免费观看| 国产a视频精品免费观看| 17c精品麻豆一区二区免费| 91高清在线观看| 美女视频网站黄色亚洲| 国产欧美一区二区三区沐欲| 91污片在线观看| 午夜在线电影亚洲一区| 亚洲精品一线二线三线| 9色porny自拍视频一区二区| 亚洲超碰精品一区二区| 日韩精品一区二区三区老鸭窝| 成人国产一区二区三区精品| 亚洲成人动漫一区|