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

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

?? ioctl.c

?? s3c44b0的開發程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
    IN  PDEVICE_OBJECT DeviceObject,
    IN  PIRP Irp,
    IN  BOOLEAN  bWrite
    )
/*++
Routine Description:
    This function is called for IOCTLs to Read or Write.
    For WRITEs, the data is retrieved from the SystemBuffer and sent to the device.
    
Arguments:
    DeviceObject - pointer to the device object for this instance of the D12 device.
    Irp          - pointer to IRP
    Read         - if TRUE this is a Device-to-Host (Read from device) transfer
                   if FALSE this is a Host-to-Device (Write to device) transfer

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
    
--*/
{
    USBD_INTERFACE_INFORMATION *    pInterfaceInfo;
    PIO_STACK_LOCATION              irpStack;
    PDEVICE_EXTENSION               deviceExtension;     
    NTSTATUS                        ntStatus;
    PVOID                           ioBuffer;
    ULONG                           length;
    ULONG                           inputBufferLength;
    ULONG                           outputBufferLength;
    ULONG                           siz;
    PURB                            urb;
    USHORT							wValue, wIndex;
	PIO_BLOCK						ioBlock;
	
	D12_KdPrint(("D12TEST.SYS: enter D12_ReadWriteRegister\n"));

    irpStack = IoGetCurrentIrpStackLocation (Irp);
    ASSERT (irpStack != NULL);
    
    deviceExtension = DeviceObject->DeviceExtension;
    ASSERT (deviceExtension != NULL);

    ioBuffer			= Irp->AssociatedIrp.SystemBuffer;
	ioBlock				= (PIO_BLOCK) ioBuffer;
    inputBufferLength	= irpStack->Parameters.DeviceIoControl.InputBufferLength;
    outputBufferLength	= irpStack->Parameters.DeviceIoControl.OutputBufferLength;

    //DEBUG ONLY
    if ((ioBuffer == NULL) || (inputBufferLength == 0) ){
        D12_KdPrint (("D12TEST.SYS: ERROR! ioBuffer %X | inBufLen: %d | outBufLen %d\n",
                          ioBuffer, inputBufferLength, outputBufferLength));
        
        Irp->IoStatus.Information = 0;
        return (STATUS_NO_MEMORY);
        
    } //DEBUG ONLY
        
                          
    siz = sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST);

	// allocate urb
	urb = ExAllocatePool(NonPagedPool, siz);

    // By convention, the first byte of the buffer is reserved for the ReportID, so
    // skip over the first Byte when specifying the transferbuffer
	
	length = ioBlock->uLength;
	wValue = (USHORT)ioBlock->uOffset;
	wIndex = (USHORT)ioBlock->uIndex;

    D12_KdPrint (("D12TEST.SYS: ReadWriteRegister: ioBuffer = %p, wIndex = %x, wLength = %lx, wValue = %x.\n",
		ioBlock->pbyData, wIndex, length, wValue));

    if (bWrite) {
        // A WRITE operation implies that the data is gotten from the User's Input Data Buffer
   		UsbBuildVendorRequest(urb,				//ptr to urb
						URB_FUNCTION_VENDOR_DEVICE,
						(USHORT) siz,			//siz of urb
						0,					
						0x0,					//reservedbits=bmRequestType
						0x0C,					//request = USBSCAN IOCTL_WRITE_REGISTER
						wValue,					
						wIndex,				
						ioBlock->pbyData,			//TransferBuffer
						NULL,					//mdl (unused)
						length,					//bufferlength
					    NULL);					//link
    } else {
   		// A READ operation implies that the data is placed in the User's Output Data Buffer
		UsbBuildVendorRequest(urb,				//ptr to urb
						URB_FUNCTION_VENDOR_DEVICE,
						(USHORT) siz,			//siz of urb
						USBD_TRANSFER_DIRECTION_IN,
						0x0,					//reservedbits=bmRequestType
						0x0C,					//request = USBSCAN IOCTL_READ_REGISTER
						wValue,					
						wIndex,				
						ioBuffer,				//TransferBuffer
						NULL,					//mdl (unused)
						length,					//bufferlength
					    NULL);					//link
 }/* else */
	/*
    /*
	// Call the USB Stack. This call blocks until the device returns data.  Note that if the
	// device NAKs forever, this call will not return and this thread will hang.  To correct 
	// this, a timeout value can be specified and a Kernel-Mode timer used to wake 
	// up the driver and then cancel this transfer.  Future versions of this sample 
	// driver will demonstrate that capability, or consult the Windows NT DDK for 
	// further details on the Kernel Timer functionality as well as the 
	// IoCancelIrp functionality.
	*/
	ntStatus = D12_CallUSBD(DeviceObject, urb);

	// The Information field tells IOM how much to copy back into the
    // usermode buffer in the BUFFERED method
    if (NT_SUCCESS(ntStatus) && bWrite) {
        Irp->IoStatus.Information =length;	//sizeof (ULONG);
   
    }else if (NT_SUCCESS(ntStatus)) {

        D12_KdPrint (("D12TEST.SYS: Sucessfully Transferred %d Bytes\n", urb->UrbControlVendorClassRequest.TransferBufferLength));

        Irp->IoStatus.Information = (urb->UrbControlVendorClassRequest.TransferBufferLength);	// + sizeof(UCHAR));
   
    }
    
	Irp->IoStatus.Status = ntStatus;

	// free allocated urb
	ExFreePool(urb);

	D12_KdPrint(("D12TEST.SYS: exit D12_ReadWriteRegister\n"));

    return (ntStatus);
}


NTSTATUS
D12_ProcessIOCTL(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP Irp
    )
/*++

Routine Description:

Arguments:

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


Return Value:

    NT status code

--*/
{
    PIO_STACK_LOCATION irpStack;
    PVOID ioBuffer;
    ULONG inputBufferLength;
    ULONG outputBufferLength;
    PDEVICE_EXTENSION deviceExtension;
    ULONG ioControlCode;
    NTSTATUS ntStatus;
    ULONG length;
    PUCHAR pch;
    PUSB_CONFIGURATION_DESCRIPTOR configurationDescriptor;
    PUSB_DEVICE_DESCRIPTOR deviceDescriptor;

    D12_KdPrint (("D12TEST.SYS: IRP_MJ_DEVICE_CONTROL\n"));

    D12_IncrementIoCount(DeviceObject);

    //
    // Get a pointer to the current location in the Irp. This is where
    //     the function codes and parameters are located.
    //

    deviceExtension = DeviceObject->DeviceExtension;
    
    if (deviceExtension->AcceptingRequests == FALSE) {
        ntStatus = STATUS_DEVICE_DATA_ERROR;
        Irp->IoStatus.Status = ntStatus;
        Irp->IoStatus.Information = 0;

        IoCompleteRequest (Irp,
                           IO_NO_INCREMENT
                          );

        D12_DecrementIoCount(DeviceObject);                          
        return ntStatus;
    }

    irpStack = IoGetCurrentIrpStackLocation (Irp);

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

    ioBuffer           = Irp->AssociatedIrp.SystemBuffer;
    inputBufferLength  = irpStack->Parameters.DeviceIoControl.InputBufferLength;
    outputBufferLength = irpStack->Parameters.DeviceIoControl.OutputBufferLength;

    ioControlCode = irpStack->Parameters.DeviceIoControl.IoControlCode;

    //
    // Handle Ioctls from User mode
    //

    switch (ioControlCode) {

    case IOCTL_D12_RESET_PIPE:
        {
        PD12_PIPE pipe;
	    PFILE_OBJECT fileObject;

		// get our context and see if it is a pipe
	    fileObject = irpStack->FileObject;

		pipe = (PD12_PIPE) fileObject->FsContext;    

		if(pipe == NULL) {
			// error, this is not a pipe
	        ntStatus =
		        Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
		} else {            
            D12_ResetPipe(DeviceObject, pipe, TRUE);
            
            ntStatus = Irp->IoStatus.Status = STATUS_SUCCESS;
        }
        }
        break;


     case IOCTL_D12_GET_CONFIG_DESCRIPTOR:

        //
        // This api returns a copy of the configuration descriptor
        // and all endpoint/interface descriptors.
        //

        //
        // inputs  - none
        // outputs - configuration descriptor plus interface
        //          and endpoint descriptors
        //

        pch = (PUCHAR) ioBuffer;

        configurationDescriptor =
            D12_GetConfigDescriptor(DeviceObject);

        if (configurationDescriptor) {
            
            length = configurationDescriptor->wTotalLength;

            RtlCopyMemory(pch,
                          (PUCHAR) configurationDescriptor,
                          length);

            ExFreePool(configurationDescriptor);

            Irp->IoStatus.Information = length;

            ntStatus = Irp->IoStatus.Status = STATUS_SUCCESS;
        }
        else {

            Irp->IoStatus.Information = 0;

            ntStatus = Irp->IoStatus.Status = STATUS_DEVICE_DATA_ERROR;
        }

        break;


     case IOCTL_D12_RESET_DEVICE:
        
        {
        NTSTATUS ntStatus;
        ULONG portStatus;

        D12_KdPrint (("D12TEST.SYS: Reset Device Test\n"));
        
        TRAP(); // test this
        //
        // Check the port state, if it is disabled we will need 
        // to re-enable it
        //
        ntStatus = D12_GetPortStatus(DeviceObject, &portStatus);

        if (NT_SUCCESS(ntStatus) && !(portStatus & USBD_PORT_ENABLED) &&
            portStatus & USBD_PORT_CONNECTED) {
            //
            // port is disabled, attempt reset
            //
            //D12_EnableParentPort(DeviceObject);
            D12_ResetParentPort(DeviceObject);
        }

        }
        break;               

     case IOCTL_D12_GET_DEVICE_DESCRIPTOR:


        pch = (PUCHAR) ioBuffer;

        deviceDescriptor =
            deviceExtension->DeviceDescriptor;

        if (deviceDescriptor) {
            
            length = deviceDescriptor->bLength;

            RtlCopyMemory(pch,
                          (PUCHAR) deviceDescriptor,
                          length);

            Irp->IoStatus.Information = length;

            ntStatus = Irp->IoStatus.Status = STATUS_SUCCESS;
        }
        else {

            Irp->IoStatus.Information = 0;

            ntStatus = Irp->IoStatus.Status = STATUS_DEVICE_DATA_ERROR;
        }

        break;
	
	case IOCTL_READ_REGISTERS:
		D12_ReadWriteRegister(DeviceObject, Irp, FALSE);
		ntStatus = Irp->IoStatus.Status;

		break;

	case IOCTL_WRITE_REGISTERS:
		D12_ReadWriteRegister(DeviceObject, Irp, TRUE);
		ntStatus = Irp->IoStatus.Status;

		break;

	default:

        ntStatus =
            Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
    }

    IoCompleteRequest (Irp,
                       IO_NO_INCREMENT
                       );

    D12_DecrementIoCount(DeviceObject);                       

    return ntStatus;

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美腿丝袜亚洲综合| 国产精品久久久久aaaa樱花| 欧美一区二区三区四区在线观看| 日韩一区二区精品| 成a人片国产精品| 日本高清不卡视频| 日韩一级黄色大片| 国产精品久久影院| 日韩中文字幕区一区有砖一区 | 免费成人性网站| 久久99久久久欧美国产| 成人av网址在线| 欧美日韩在线播| 欧美v日韩v国产v| 成人免费在线视频观看| 亚洲成va人在线观看| 亚洲人亚洲人成电影网站色| 日韩va欧美va亚洲va久久| 高清视频一区二区| 欧美少妇性性性| 久久久电影一区二区三区| 亚洲一区二区三区在线看| 国产剧情在线观看一区二区| 欧美中文字幕一区二区三区亚洲| 久久综合999| 亚洲成年人影院| 99精品国产91久久久久久| 7777精品伊人久久久大香线蕉最新版 | 91精品国产乱| 亚洲视频一二区| 国内精品国产三级国产a久久| 在线免费观看一区| 精品国产乱码久久久久久浪潮| 亚洲精品国产无天堂网2021| 国产一区二区在线电影| 欧美色窝79yyyycom| 国产精品视频yy9299一区| 蜜臀av在线播放一区二区三区| 成人精品在线视频观看| 欧美大度的电影原声| 亚洲一区二区三区中文字幕| 不卡av在线免费观看| 亚洲精品在线观| 日韩国产在线观看一区| 91福利视频在线| 国产精品三级久久久久三级| 蜜臀久久99精品久久久画质超高清| 91精品91久久久中77777| www欧美成人18+| 午夜欧美电影在线观看| 91蜜桃免费观看视频| 国产亚洲欧美一区在线观看| 美国三级日本三级久久99| 欧美日韩一区二区三区免费看| 亚洲三级久久久| 国产成人aaa| 欧美精品一区二区三区久久久| 日韩av成人高清| 欧美性色黄大片| 亚洲少妇30p| 成人国产亚洲欧美成人综合网| 欧美精品一区二区在线观看| 看国产成人h片视频| 91精品国产综合久久精品图片| 亚洲国产aⅴ成人精品无吗| 99国产精品久久久久久久久久| 国产精品丝袜黑色高跟| 成人午夜在线视频| 日本一区二区动态图| 国产精品久久99| 国产69精品久久777的优势| 国产肉丝袜一区二区| 国产精一品亚洲二区在线视频| 精品嫩草影院久久| 精品写真视频在线观看| 精品国产乱子伦一区| 国产在线精品视频| 久久日韩粉嫩一区二区三区| 国产精品一区二区免费不卡| 久久久久久免费| 国产成人欧美日韩在线电影| 久久久国际精品| 国产99久久精品| 国产精品伦理一区二区| 777亚洲妇女| 久久精品视频在线看| 三级影片在线观看欧美日韩一区二区| 欧美高清www午色夜在线视频| 天堂av在线一区| 欧美大片一区二区三区| 国产精品中文字幕欧美| 国产日韩成人精品| 福利一区二区在线观看| 中文在线一区二区| 91在线一区二区三区| 亚洲图片欧美色图| 欧美一区二区三区日韩| 精品亚洲aⅴ乱码一区二区三区| 欧美国产乱子伦| 色素色在线综合| 天堂久久一区二区三区| 欧美精品一区二| 不卡av电影在线播放| 亚洲成在线观看| 欧美一区二区久久| 国产精品66部| 曰韩精品一区二区| 色视频欧美一区二区三区| 亚洲综合一二区| 欧美精品精品一区| 久久精品国产一区二区三| 国产精品免费视频网站| 色一情一乱一乱一91av| 日韩av中文在线观看| 欧美国产亚洲另类动漫| 欧美亚洲动漫另类| 久久精品国产亚洲a| 国产精品区一区二区三| 色伊人久久综合中文字幕| 久久精品国内一区二区三区| 国产精品电影院| 欧美一区二区播放| 成人av小说网| 日本亚洲天堂网| 国产精品成人一区二区三区夜夜夜| 在线欧美日韩国产| 国产成人免费视频一区| 亚洲影院理伦片| 日韩精品亚洲专区| 色欧美88888久久久久久影院| 欧美aaaaa成人免费观看视频| 中文成人综合网| 91精品国产综合久久小美女| 99久久免费精品| 久久99久久99精品免视看婷婷 | 极品尤物av久久免费看| 亚洲欧美激情视频在线观看一区二区三区 | 欧美大片日本大片免费观看| 国产成人精品一区二区三区四区 | 欧美日韩国产免费| 国产很黄免费观看久久| 性做久久久久久免费观看| 亚洲国产精品成人综合色在线婷婷| 在线视频欧美精品| 成人晚上爱看视频| 免费的成人av| 亚洲妇女屁股眼交7| 中文字幕一区二区三区四区不卡 | 国产在线一区二区综合免费视频| 日韩毛片视频在线看| 久久亚洲免费视频| 久久免费偷拍视频| 欧美无砖专区一中文字| 国产成人精品三级| 久久精品国产亚洲5555| 亚洲一级在线观看| 中文字幕一区二区在线播放| 久久免费视频一区| 精品美女被调教视频大全网站| 欧美视频一区二区| 91免费视频大全| 成+人+亚洲+综合天堂| 国产精品资源网| 久久精品国产色蜜蜜麻豆| 蜜桃视频第一区免费观看| 亚洲高清免费视频| 亚洲精品国产第一综合99久久| 国产精品电影院| 国产精品久久久爽爽爽麻豆色哟哟| 久久久久9999亚洲精品| 精品国产乱码久久久久久久久| 日韩视频中午一区| 91精品国产91久久久久久一区二区 | 2017欧美狠狠色| 99久久综合狠狠综合久久| 国产成人在线免费| 国产精品一二二区| 国产精品影音先锋| 国产乱理伦片在线观看夜一区| 裸体歌舞表演一区二区| 首页亚洲欧美制服丝腿| 亚洲超丰满肉感bbw| 亚洲成人免费看| 亚洲h在线观看| 天天射综合影视| 日欧美一区二区| 日韩av在线播放中文字幕| 日本色综合中文字幕| 日本一道高清亚洲日美韩| 老司机午夜精品99久久| 黑人巨大精品欧美一区| 国产一级精品在线| 丁香亚洲综合激情啪啪综合| 成人av免费在线观看| 92国产精品观看| 精品污污网站免费看| 91精品在线观看入口| 日韩久久久精品| 国产日韩综合av| 亚洲日本在线天堂|