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

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

?? ocrwiso.c

?? linux環境下USB驅動程序,適用三星ARM2410B
?? C
?? 第 1 頁 / 共 2 頁
字號:
    return ntStatus;
}


PISOUSB_PIPEINFO IsoUsb_PipeWithName( 
    IN PDEVICE_OBJECT DeviceObject,
    IN PUNICODE_STRING FileName
   )
/*++

Routine Description:

    Given a PUSBD_PIPE_INFORMATION, return our device extension pipe info struct
      that has this hanndle, else NULL

--*/
{
    PDEVICE_EXTENSION deviceExtension = DeviceObject->DeviceExtension; 
    PISOUSB_PIPEINFO pipeInfo = NULL;
    ULONG i, nameLen, ix, uval , umultiplier;

	nameLen = FileName->Length;

    if (nameLen != 0) {

		ISOUSB_KdPrint( DBGLVL_DEFAULT,("IsoUsb_PipeWithName FileName = %ws\n", FileName->Buffer ));

		// Get pipe# to open
		ix = nameLen -1;  // index last char of pipe name

		// if last char isn't digit, decrement till it is
		while( ( (FileName->Buffer[ ix ] < (WCHAR) '0') ||
				(FileName->Buffer[ ix ] > (WCHAR) '9') ) && ix )
				ix--;  

		if (  ix  )  {  //  filename better have had at least one ascii digit!    

			//
			// A name was specified, convert it to a pipe id.
			// Parse the ansi ascii decimal 0-based pipe number 
			//
			uval = 0;
			umultiplier = 1;
			// we're traversing least-to-most significant digits
			while( ( (FileName->Buffer[ ix ] >= (WCHAR) '0') &&
				(FileName->Buffer[ ix ] <= (WCHAR) '9') ) && ix ) {

				uval +=  (umultiplier *
					     (ULONG) (FileName->Buffer[ ix ] - (WCHAR) '0'));
				ix--;
				umultiplier *= 10; 
            }
		}
        pipeInfo = &deviceExtension->PipeInfo[ uval ];
    }

    ISOUSB_KdPrint ( DBGLVL_HIGH, ("Exit IsoUsb_PipeWithName() pipeInfo = 0x%x, ix = %d\n", pipeInfo, uval ));

    return pipeInfo;
}

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

Routine Description:

    This is the dispatch table routine for IRP_MJ_CLOSE.
    It handles user mode CloseHandle() calls for a pipe
    It closes the File Object for the pipe handle it represents.

Arguments:

    DeviceObject - pointer to our FDO (Functional Device Object )


Return Value:

    NT status code

--*/
{
    NTSTATUS ntStatus;
	NTSTATUS actStat;
    PFILE_OBJECT fileObject;
    PIO_STACK_LOCATION irpStack;
    PDEVICE_EXTENSION deviceExtension;
    PUSBD_PIPE_INFORMATION pipeHandle = NULL;
    PISOUSB_PIPEINFO pipeInfo = NULL;

    ISOUSB_KdPrint( DBGLVL_DEFAULT,("entering IsoUsb_Close\n"));

    
    IsoUsb_IncrementIoCount(DeviceObject);

    deviceExtension = DeviceObject->DeviceExtension;
    irpStack = IoGetCurrentIrpStackLocation (Irp);
    fileObject = irpStack->FileObject;

    if (fileObject->FsContext) {
        // closing pipe handle
        pipeHandle =  fileObject->FsContext;

        pipeInfo = IsoUsb_PipeWithName( DeviceObject, &fileObject->FileName );

        if ( NULL == pipeInfo )
            goto done;

		if ( pipeInfo->fPipeOpened ) { // set if opened
			// may have been aborted
			ISOUSB_KdPrint( DBGLVL_DEFAULT,("closing pipe %x\n", pipeHandle));
			deviceExtension->OpenPipeCount--;
			pipeInfo->fPipeOpened = FALSE;
		}
		else {
			// pipe was already closed; this can only be if we got a sudden REMOVE_DEVICE
			ISOUSB_ASSERT(  deviceExtension->DeviceRemoved );
			ISOUSB_KdPrint( DBGLVL_DEFAULT,("Pipe %x was already closed \n", pipeHandle));

		}
    }

done:
	IsoUsb_DecrementIoCount(DeviceObject);
    Irp->IoStatus.Status = STATUS_SUCCESS;
    Irp->IoStatus.Information = 0;

    ntStatus = Irp->IoStatus.Status;


    IoCompleteRequest (Irp,
                       IO_NO_INCREMENT
                       );
                       
	// try to power down device if this is the last pipe
	actStat = IsoUsb_SelfSuspendOrActivate( DeviceObject, TRUE );

    ISOUSB_KdPrint( DBGLVL_DEFAULT,("exit IsoUsb_Close OpenPipeCount = decimal %d, status %x\n",deviceExtension->OpenPipeCount, ntStatus));

    return ntStatus;
}


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

Routine Description:

    This is the dispatch table routine for IRP_MJ_CREATE.
    It's the entry point for CreateFile() calls
    user mode apps may open "<name genned fron GUID>.\yy"
    where yy is the internal pipe id

Arguments:

    DeviceObject - pointer to our FDO ( Functional Device Object )


Return Value:

    NT status code

--*/
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PFILE_OBJECT fileObject;
    PIO_STACK_LOCATION irpStack;
    PDEVICE_EXTENSION deviceExtension;
    ULONG i, ix;
	NTSTATUS actStat;
    PUSBD_INTERFACE_INFORMATION interface;
	PUSBD_PIPE_INFORMATION PipeInfo;
    PISOUSB_PIPEINFO ourPipeInfo = NULL;


    deviceExtension = DeviceObject->DeviceExtension;
    interface = deviceExtension->UsbInterface;

    ISOUSB_KdPrint( DBGLVL_DEFAULT,("entering IsoUsb_Create\n"));

    IsoUsb_IncrementIoCount(DeviceObject);

    // Can't accept a new io request if:
    //  1) device is removed, 
    //  2) has never been started, 
    //  3) is stopped,
    //  4) has a remove request pending,
    //  5) has a stop device pending
    if ( !IsoUsb_CanAcceptIoRequests( DeviceObject ) ) {
        ntStatus = STATUS_DELETE_PENDING;

		ISOUSB_KdPrint( DBGLVL_DEFAULT,("ABORTING IsoUsb_Create\n"));
        goto done;
    }
    
    irpStack = IoGetCurrentIrpStackLocation (Irp);
    fileObject = irpStack->FileObject;

    // fscontext is null for device
    fileObject->FsContext = NULL;

    if ( 0 == fileObject->FileName.Length ) // this is the case if opening device as opposed to pipe
        goto done;      // nothing more to do

    ourPipeInfo = IsoUsb_PipeWithName( DeviceObject, &fileObject->FileName );

    if ( !ourPipeInfo ) {

        ntStatus = STATUS_INVALID_PARAMETER;
        goto done;

    }

	// init status to bad; will set good in below loop on success
	ntStatus = STATUS_INSUFFICIENT_RESOURCES;

	for (i=0; i<interface->NumberOfPipes; i++) {

		PipeInfo =  &interface->Pipes[i]; // PUSBD_PIPE_INFORMATION  PipeInfo;

        if ( ourPipeInfo == &deviceExtension->PipeInfo[i] ) {

    		//
			// found a match
			//
			ISOUSB_KdPrint( DBGLVL_DEFAULT,("open pipe %d\n", i));
			fileObject->FsContext = PipeInfo;
			ourPipeInfo->fPipeOpened = TRUE; // set flag for opened
			ntStatus = STATUS_SUCCESS;

			deviceExtension->OpenPipeCount++;

			// try to power up device if its not in D0
			actStat = IsoUsb_SelfSuspendOrActivate( DeviceObject, FALSE );
			break;
		}
	}

done:
    Irp->IoStatus.Status = ntStatus;
    Irp->IoStatus.Information = 0;


    IoCompleteRequest (Irp,
                       IO_NO_INCREMENT
                       );

    IsoUsb_DecrementIoCount(DeviceObject);                               

    ISOUSB_KdPrint( DBGLVL_DEFAULT,("exit IsoUsb_Create %x\n", ntStatus));


    return ntStatus;
}





NTSTATUS
IsoUsb_AbortPipes(
    IN PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

	Called as part of sudden device removal handling.
    Cancels any pending transfers for all open pipes. 
	If any pipes are still open, call USBD with URB_FUNCTION_ABORT_PIPE
	Also marks the pipe 'closed' in our saved  configuration info.

Arguments:

    Ptrs to our FDO

Return Value:

    NT status code

--*/
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    PURB urb;
    PDEVICE_EXTENSION deviceExtension;
	ULONG i;

    PUSBD_INTERFACE_INFORMATION interface;
	PISOUSB_PIPEINFO PipeInfo;

    deviceExtension = DeviceObject->DeviceExtension;
    interface = deviceExtension->UsbInterface;

    for (i=0; i<interface->NumberOfPipes; i++) {

        PipeInfo =  &deviceExtension->PipeInfo[i]; // PISOUSB_PIPEINFO  PipeInfo;

		if ( PipeInfo->fPipeOpened ) { // we set this if open, clear if closed

			ISOUSB_KdPrint( DBGLVL_HIGH,("IsoUsb_AbortPipes() Aborting open  Pipe %d\n", i));

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

			if (urb) {

				urb->UrbHeader.Length = (USHORT) sizeof (struct _URB_PIPE_REQUEST);
				urb->UrbHeader.Function = URB_FUNCTION_ABORT_PIPE;
				urb->UrbPipeRequest.PipeHandle =
					interface->Pipes[i].PipeHandle;

				ntStatus = IsoUsb_CallUSBD(DeviceObject, urb);

				ExFreePool(urb);

			} else {
				ntStatus = STATUS_INSUFFICIENT_RESOURCES;
				ISOUSB_KdPrint( DBGLVL_HIGH,("IsoUsb_AbortPipes() FAILED urb alloc\n" ));
				break;
			}


			if (!(NT_SUCCESS(ntStatus))) {
				// if we failed, dump out
#if DBG
				if ( gpDbg )
					gpDbg->PipeErrorCount++;
#endif
				break;
			}
			else {
				PipeInfo->fPipeOpened = FALSE; // mark the pipe 'closed'

				deviceExtension->OpenPipeCount--;
#if DBG
				if ( gpDbg )
					gpDbg->AbortPipeCount++;
#endif


			}

		} // end, if pipe open
	} // end, for all pipes


    return ntStatus;
}



BOOLEAN
IsoUsb_CanAcceptIoRequests(
    IN PDEVICE_OBJECT DeviceObject
    )
/*++

Routine Description:

  Check device extension status flags; 

     Can't accept a new io request if device:
      1) is removed, 
      2) has never been started, 
      3) is stopped,
      4) has a remove request pending, or
      5) has a stop device pending


Arguments:

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


Return Value:

    return TRUE if can accept new io requests, else FALSE

--*/
{
    PDEVICE_EXTENSION deviceExtension;
	BOOLEAN fCan = FALSE;

    deviceExtension = DeviceObject->DeviceExtension;

	//flag set when processing IRP_MN_REMOVE_DEVICE
    if ( !deviceExtension->DeviceRemoved &&
		 // device must be started( enabled )
		 deviceExtension->DeviceStarted &&
 		 // flag set when driver has answered success to IRP_MN_QUERY_REMOVE_DEVICE
		 !deviceExtension->RemoveDeviceRequested &&
		 // flag set when driver has answered success to IRP_MN_QUERY_STOP_DEVICE
		 !deviceExtension->StopDeviceRequested ){
			fCan = TRUE;
	}

    ISOUSB_KdPrintCond( DBGLVL_MAXIMUM, !fCan, ("**** FALSE return from IsoUsb_CanAcceptIoRequests()!\n"));

	return fCan;
}



//******************************************************************************
//
// IsoUsb_CompletionStop()
//
// IO Completion Routine which just stops further completion of the Irp
//
//******************************************************************************


NTSTATUS
IsoUsb_CompletionStop (
    IN PDEVICE_OBJECT   DeviceObject,
    IN PIRP             Irp,
    IN PVOID            Context
    )

{
    return STATUS_MORE_PROCESSING_REQUIRED;
}

//******************************************************************************
//
// IsoUsb_GetCurrentFrame()
//
//******************************************************************************

ULONG
IsoUsb_GetCurrentFrame (
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP           Irp
    )
{
    PDEVICE_EXTENSION           deviceExtension;
    PIO_STACK_LOCATION          nextStack;
    NTSTATUS                    ntStatus;
    struct _URB_GET_CURRENT_FRAME_NUMBER urb;

    deviceExtension   = DeviceObject->DeviceExtension;

    // Initialize the URB
    //
    urb.Hdr.Function = URB_FUNCTION_GET_CURRENT_FRAME_NUMBER;
    urb.Hdr.Length   = sizeof(urb);
    urb.FrameNumber = (ULONG)-1;

    // Set the IRP parameters to pass the URB down the stack
    //
    nextStack = IoGetNextIrpStackLocation(Irp);

    nextStack->Parameters.Others.Argument1 = &urb;

    nextStack->Parameters.DeviceIoControl.IoControlCode = 
        IOCTL_INTERNAL_USB_SUBMIT_URB;                    

    nextStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;

    // Since this Irp is borrowed for URB_FUNCTION_GET_CURRENT_FRAME_NUMBER
    // before it is passed down later for the real URB request after this
    // routine returns, set a completion routine which stop further completion
    // of the Irp.
    //
    IoSetCompletionRoutine(
        Irp,
        IsoUsb_CompletionStop, // this routine does nothing but return STATUS_MORE_PROCESSING_REQUIRED
        NULL,   // Context
        TRUE,   // InvokeOnSuccess
        TRUE,   // InvokeOnError
        TRUE    // InvokeOnCancel
        );

    // Now pass the Irp down the stack
    //
    ntStatus = IoCallDriver(
                   deviceExtension->TopOfStackDeviceObject, 
                   Irp
                   );

    // Don't need to wait for completion because 
    // URB_FUNCTION_GET_CURRENT_FRAME_NUMBER will never return STATUS_PENDING

   ISOUSB_KdPrint (  DBGLVL_MEDIUM, (" IsoUsb_GetCurrentFrame() offset = 0x%08X, decimal %d\n",
                     urb.FrameNumber,
                     urb.FrameNumber));

   return urb.FrameNumber;
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美日韩另类一区| 在线播放视频一区| 日韩理论片在线| 91亚洲精品久久久蜜桃| 亚洲欧美日韩中文字幕一区二区三区| 91丝袜国产在线播放| 一区二区三区四区蜜桃| 欧美日韩精品一区二区天天拍小说| 日韩激情视频在线观看| 精品精品国产高清一毛片一天堂| 国产一区二区福利视频| 中文字幕一区视频| 欧美日韩你懂得| 极品少妇一区二区| 日韩一区中文字幕| 欧美美女喷水视频| 国产一区欧美二区| 亚洲欧美乱综合| 欧美日韩亚洲综合| 国产成人精品综合在线观看| 国产精品久久久久久一区二区三区| 91精品办公室少妇高潮对白| 久久精品国产99| 最近中文字幕一区二区三区| 6080日韩午夜伦伦午夜伦| 精品无人码麻豆乱码1区2区 | 国产精品伦一区| 欧美综合久久久| 国内国产精品久久| 一区二区三区成人| 久久综合狠狠综合久久综合88| 一本到不卡精品视频在线观看| 免费不卡在线观看| 亚洲在线视频网站| 久久精品亚洲国产奇米99| 国产精品免费视频一区| 欧美日本视频在线| 另类小说综合欧美亚洲| 久久久99精品免费观看不卡| 欧美在线免费视屏| 日本亚洲三级在线| 国产欧美日韩综合| 制服丝袜日韩国产| 色综合久久综合网欧美综合网 | 日韩午夜三级在线| 91精品国产一区二区| 欧美老女人第四色| 91精品免费在线| 日韩精品一区二区三区老鸭窝 | 日韩精品中文字幕一区二区三区 | 久久久99精品免费观看不卡| 国产欧美综合在线| 国产精品成人在线观看| 一区二区三区免费网站| 日日摸夜夜添夜夜添国产精品 | 免费日本视频一区| 精品一区二区国语对白| 国产99精品国产| 91视频国产资源| 欧美精品在线视频| 日韩欧美色综合| 国产欧美一区二区精品性| 亚洲欧洲综合另类在线| 午夜欧美2019年伦理| 久久国产精品色婷婷| 成人av先锋影音| 精品视频在线视频| 精品国产亚洲在线| 亚洲视频狠狠干| 日日夜夜一区二区| 国产福利精品导航| 欧美亚洲动漫另类| 欧美tickling网站挠脚心| 国产视频一区二区在线| 一区二区三区四区高清精品免费观看| 日韩电影在线看| 丁香一区二区三区| 欧美精品精品一区| 欧美激情中文不卡| 日韩精品福利网| 成人亚洲一区二区一| 欧美日韩国产大片| 国产清纯白嫩初高生在线观看91 | 这里只有精品电影| 久久久www成人免费毛片麻豆| 亚洲精品视频一区| 久久精品国产久精国产爱| caoporen国产精品视频| 91精品国产综合久久久久久| 中文字幕精品在线不卡| 婷婷成人综合网| av电影在线不卡| 日韩欧美一级在线播放| 亚洲欧洲国产专区| 韩国欧美国产一区| 欧美三日本三级三级在线播放| 国产亚洲精品中文字幕| 日韩在线观看一区二区| 高清免费成人av| 日韩午夜精品电影| 亚洲一二三区在线观看| 国产大陆亚洲精品国产| 欧美另类变人与禽xxxxx| 国产精品久久久爽爽爽麻豆色哟哟 | 成人h动漫精品一区二| 日韩亚洲欧美在线观看| 亚洲欧美一区二区三区极速播放| 国产美女在线精品| 91精品国产91久久久久久一区二区 | 精品久久一区二区| 亚洲午夜精品17c| 99综合电影在线视频| 精品国产三级电影在线观看| 午夜欧美在线一二页| 99精品国产视频| 国产清纯美女被跳蛋高潮一区二区久久w| 日本欧美韩国一区三区| 色噜噜偷拍精品综合在线| 亚洲国产精品精华液2区45| 精品一区二区免费在线观看| 欧美顶级少妇做爰| 亚洲最新视频在线播放| 91视频观看视频| 国产精品人人做人人爽人人添| 久久69国产一区二区蜜臀| 欧美理论电影在线| 亚洲成年人影院| 欧美视频在线一区二区三区| 亚洲综合视频网| 91免费观看视频在线| 中文字幕在线观看一区二区| 成人国产免费视频| 国产精品国产自产拍在线| 成人一区二区三区在线观看| 久久久久国色av免费看影院| 国产一区二区三区最好精华液| 日韩欧美在线一区二区三区| 免费成人在线观看| 日韩视频在线你懂得| 精品一区二区三区的国产在线播放| 精品久久一区二区| 国产福利一区在线| 中文字幕的久久| 92精品国产成人观看免费| 亚洲欧美日韩在线不卡| 欧美天天综合网| 亚洲chinese男男1069| 884aa四虎影成人精品一区| 首页亚洲欧美制服丝腿| 欧美丰满嫩嫩电影| 美腿丝袜在线亚洲一区| 精品福利一二区| 国产99一区视频免费| 亚洲视频一二区| 欧美日韩国产精品成人| 精品无人码麻豆乱码1区2区 | 99在线精品视频| 亚洲激情av在线| 欧美日韩高清影院| 日产国产高清一区二区三区 | 日韩在线卡一卡二| 精品久久国产老人久久综合| 成人app下载| 亚洲一区二区偷拍精品| 精品毛片乱码1区2区3区| 高清国产一区二区三区| 一区二区三区小说| 日韩一区二区三| 国产白丝网站精品污在线入口| 亚洲猫色日本管| 91精品欧美福利在线观看| 国产suv精品一区二区6| 一区二区三区不卡视频在线观看| 日韩欧美国产电影| 成人午夜免费av| 天堂成人国产精品一区| 久久亚洲二区三区| 91国模大尺度私拍在线视频| 蜜臀久久99精品久久久久久9| 国产精品福利一区二区| 8x8x8国产精品| 91麻豆自制传媒国产之光| 男人操女人的视频在线观看欧美| 国产农村妇女精品| 欧美老人xxxx18| av影院午夜一区| 美女被吸乳得到大胸91| 日韩一区中文字幕| 精品国产乱码久久久久久久久| 色综合色狠狠综合色| 国产一区不卡视频| 日韩国产欧美视频| 天堂蜜桃一区二区三区| 中文字幕亚洲不卡| 日韩精品中文字幕一区二区三区 | 国产一区二区三区免费在线观看| 亚洲色图在线看| 国产日韩欧美高清| 日韩欧美中文字幕精品| 欧美在线免费观看亚洲|