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

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

?? ocrwiso.c

?? ARM2410的USB的源碼
?? 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一区二区三区免费野_久草精品视频
国产亚洲精久久久久久| 成人av网站大全| 欧美日韩国产综合一区二区| 国产精品久久久久桃色tv| 免费看精品久久片| 91行情网站电视在线观看高清版| 26uuu国产日韩综合| 亚洲成a人在线观看| 色综合天天天天做夜夜夜夜做| 久久久久久久精| 日韩电影一二三区| 欧美视频在线观看一区二区| 中文字幕一区三区| 欧美刺激脚交jootjob| 亚洲色图第一区| 91首页免费视频| 欧美欧美欧美欧美| 亚洲一区二区av在线| 91福利在线看| 亚洲精品乱码久久久久久| 91麻豆精品视频| 亚洲男同性视频| 在线一区二区三区四区五区| 有码一区二区三区| 欧美男生操女生| 美女久久久精品| 久久只精品国产| 成人午夜私人影院| 亚洲桃色在线一区| 欧美日韩激情一区| 大胆欧美人体老妇| 亚洲国产另类精品专区| 国产传媒欧美日韩成人| 欧美日韩国产首页| 亚洲成精国产精品女| 日韩一区二区高清| 精品一区免费av| 成人免费一区二区三区视频 | 国产精品久久久久久久久久久免费看 | 高清免费成人av| 亚洲欧美日韩小说| 欧美久久久久久蜜桃| 国产一区二区在线观看免费| 综合激情网...| 欧美一级午夜免费电影| 福利一区二区在线| 亚洲综合av网| 亚洲国产高清aⅴ视频| 欧美日韩精品欧美日韩精品 | 一区二区三区加勒比av| 精品嫩草影院久久| 欧美理论电影在线| 91浏览器在线视频| 国产在线一区观看| 亚洲激情在线激情| 日韩精品一区二区三区老鸭窝| 北条麻妃一区二区三区| 国产一区二区三区日韩| 捆绑变态av一区二区三区| 亚洲一区二区五区| 亚洲人一二三区| 亚洲欧洲成人自拍| 久久久综合精品| 欧美日韩成人激情| 波多野结衣亚洲| 久久国产婷婷国产香蕉| 亚洲国产中文字幕| 亚洲素人一区二区| 日本一区二区视频在线观看| 精品美女在线观看| 日韩欧美一级在线播放| 欧美日韩一区三区四区| 日本黄色一区二区| 欧洲一区二区三区在线| 在线免费观看不卡av| av亚洲精华国产精华精华 | 国产成+人+日韩+欧美+亚洲| 国产一区二区三区免费观看 | 色综合久久久久久久| 91国偷自产一区二区三区观看| 91一区在线观看| 99久久精品国产精品久久| 色老汉av一区二区三区| 欧美日本一区二区| 久久综合狠狠综合久久激情 | 美国三级日本三级久久99| 久久精品国产亚洲a| 大胆亚洲人体视频| 91免费视频观看| 一本大道久久a久久综合婷婷| 一本大道久久精品懂色aⅴ| 欧美亚洲国产一区二区三区va| 欧美区在线观看| www久久精品| 亚洲视频小说图片| 亚洲成人动漫在线观看| 精品一区二区三区av| 国产99一区视频免费| 欧美在线999| 精品国偷自产国产一区| 国产精品成人一区二区三区夜夜夜| 亚洲成人资源在线| 国产精品综合在线视频| 欧美日韩免费观看一区二区三区| 久久综合999| 亚洲综合区在线| 国产精品99久久久久久久女警 | 日日摸夜夜添夜夜添精品视频 | 国产精品污www在线观看| 亚洲国产综合91精品麻豆| 国产精品亚洲一区二区三区妖精| 欧美午夜宅男影院| 18欧美乱大交hd1984| 久久福利资源站| 91久久线看在观草草青青| 久久美女艺术照精彩视频福利播放 | 肉色丝袜一区二区| 成人a免费在线看| 精品久久久久久久久久久久久久久久久| 亚洲视频在线一区| 国产成人免费在线观看不卡| 欧美成人三级电影在线| 午夜精品一区二区三区电影天堂| 91在线国产福利| 国产精品灌醉下药二区| 国内偷窥港台综合视频在线播放| 欧美日高清视频| 亚洲高清久久久| 欧美色涩在线第一页| 亚洲日本韩国一区| 99re热视频这里只精品| 中文字幕一区二区三区av| 成人黄色片在线观看| 国产精品国产三级国产aⅴ中文 | 久久久三级国产网站| 裸体一区二区三区| 日韩午夜激情视频| 老司机午夜精品| 久久人人97超碰com| 国产·精品毛片| 国产日韩精品一区二区浪潮av| 成人av电影在线网| 亚洲手机成人高清视频| 欧美日韩二区三区| 久久精品国产秦先生| 久久久久9999亚洲精品| 成人黄页毛片网站| 亚洲精品成a人| 欧美日本在线视频| 国内精品写真在线观看| 亚洲视频一二区| 在线播放中文一区| 国产激情一区二区三区四区| 中文字幕不卡在线观看| 色婷婷综合在线| 天堂va蜜桃一区二区三区漫画版| 91精品麻豆日日躁夜夜躁| 国产**成人网毛片九色 | 国产高清久久久久| 无码av中文一区二区三区桃花岛| 日韩三级在线观看| 成人黄色777网| 日本在线观看不卡视频| 中文字幕日本不卡| 欧美一区二区三区不卡| 99精品视频在线免费观看| 久久精品999| 视频一区欧美精品| 国产精品国产自产拍在线| 欧美不卡在线视频| 在线视频欧美精品| 国产精品一品视频| 日韩中文字幕一区二区三区| 国产精品欧美久久久久无广告 | 国产一区二区免费在线| 亚洲国产日韩在线一区模特| 久久久欧美精品sm网站| 777午夜精品视频在线播放| 日本福利一区二区| 色综合久久天天综合网| 国产成人精品亚洲777人妖| 香蕉乱码成人久久天堂爱免费| 国产精品久久久久久久午夜片 | 91首页免费视频| 91理论电影在线观看| 99久久精品国产精品久久| 国产.精品.日韩.另类.中文.在线.播放| 日韩主播视频在线| 五月天精品一区二区三区| 三级成人在线视频| 午夜欧美一区二区三区在线播放| 亚洲视频小说图片| 一区av在线播放| 亚洲综合视频在线| 亚洲h在线观看| 精品制服美女久久| 国内精品国产三级国产a久久| 国产精品伊人色| 懂色一区二区三区免费观看| 国产传媒欧美日韩成人|