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

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

?? ocrwiso.c

?? softusb for atmel avr
?? 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一区二区三区免费野_久草精品视频
国产精品久久久久一区二区三区| 国产成人免费在线观看不卡| 日本道在线观看一区二区| 伊人色综合久久天天| 欧美视频完全免费看| 一区二区久久久| 欧美裸体bbwbbwbbw| 美脚の诱脚舐め脚责91| 久久五月婷婷丁香社区| 国产91精品露脸国语对白| 国产精品国产三级国产aⅴ中文 | 1区2区3区国产精品| 91国内精品野花午夜精品| 国产老妇另类xxxxx| 国产精品水嫩水嫩| 欧美日韩不卡在线| 麻豆国产一区二区| 亚洲色图视频免费播放| 91精品国产色综合久久久蜜香臀| 九九久久精品视频 | 欧美日韩中字一区| 日本免费新一区视频| 亚洲人成在线播放网站岛国| 91久久精品一区二区三| 国产主播一区二区三区| 亚洲一二三区视频在线观看| 久久久久久日产精品| 欧美日本在线视频| 99久久精品国产观看| 精一区二区三区| 午夜视频久久久久久| 国产精品色噜噜| 欧美精品一区二区三区蜜桃 | 亚洲大片精品永久免费| 久久久久99精品一区| 91超碰这里只有精品国产| 成人av网站大全| 国产精品亚洲一区二区三区妖精 | 欧美一二三在线| 欧美午夜理伦三级在线观看| 成人国产免费视频| 成人成人成人在线视频| 狠狠色狠狠色合久久伊人| 久久99日本精品| 国产一区在线不卡| 国产精品小仙女| av一区二区三区| 色噜噜狠狠色综合中国| 欧美亚洲另类激情小说| 欧美三级三级三级爽爽爽| 欧美色网一区二区| 欧美日韩午夜在线| 欧美日韩国产电影| 日韩精品一区二区三区四区视频 | 久久精品亚洲国产奇米99| 国产日产欧美一区二区三区| 国产无人区一区二区三区| 国产精品午夜春色av| 一区二区三区四区av| 青青草原综合久久大伊人精品优势 | 久久国产精品一区二区| 国产精品一区二区久久精品爱涩| 成人午夜看片网址| 色婷婷综合五月| 欧美一二三区在线观看| 久久久亚洲精品一区二区三区| 亚洲丝袜自拍清纯另类| 亚洲成av人片在线| 国产最新精品免费| 91国产免费观看| 精品欧美一区二区久久| 亚洲人吸女人奶水| 国产一区二区三区蝌蚪| 在线观看不卡一区| 国产欧美日韩麻豆91| 亚洲成av人片在www色猫咪| 国内精品久久久久影院薰衣草 | 欧美亚洲图片小说| 国产精品日产欧美久久久久| 日韩中文字幕91| 91免费观看国产| 国产亚洲短视频| 免费观看久久久4p| 色国产精品一区在线观看| 久久午夜电影网| 久久国产精品一区二区| 911精品国产一区二区在线| 亚洲精选免费视频| 色综合天天综合网天天看片| 国产色一区二区| 国产激情一区二区三区四区 | 亚洲国产精品高清| 成人av在线资源网站| 国产亚洲欧洲997久久综合| 日本欧美肥老太交大片| 欧美一区二区高清| 精品无人区卡一卡二卡三乱码免费卡 | 亚洲欧美在线视频| 91蝌蚪porny九色| 亚洲成av人片| 欧美一级在线视频| 久久99精品国产麻豆婷婷洗澡| 91精品麻豆日日躁夜夜躁| 日韩中文欧美在线| 精品88久久久久88久久久| 国产精品69毛片高清亚洲| 亚洲国产精品v| 在线看一区二区| 麻豆91在线播放| 久久久久国色av免费看影院| 成人黄色av电影| 午夜欧美在线一二页| 精品日韩在线观看| 成人短视频下载| 蜜桃av一区二区三区电影| 中文字幕av一区二区三区免费看| 91官网在线免费观看| 日韩国产欧美一区二区三区| 欧美激情一区在线| 91行情网站电视在线观看高清版| 亚洲高清免费观看高清完整版在线观看| 国产成人在线观看免费网站| 亚洲精品成人悠悠色影视| 欧美一级高清片| 91福利国产精品| 国产成人精品午夜视频免费 | 国产精品第13页| 亚洲精品一线二线三线| 7777女厕盗摄久久久| 99国产一区二区三精品乱码| 精品一区二区三区视频在线观看| 一区二区三区在线视频免费| 国产欧美一区二区精品仙草咪| 在线电影国产精品| 欧美性色欧美a在线播放| 成av人片一区二区| 成人午夜碰碰视频| 国产精品一区二区黑丝| 久久99九九99精品| 老司机一区二区| 美女国产一区二区| 老司机免费视频一区二区| 亚瑟在线精品视频| 午夜视频在线观看一区二区三区 | 亚洲欧美在线高清| 亚洲少妇30p| 亚洲免费观看视频| 亚洲综合网站在线观看| 午夜精品久久久久久久久| 婷婷中文字幕综合| 亚洲高清一区二区三区| 亚洲国产精品一区二区www在线| 日韩专区一卡二卡| 国产一区二区三区高清播放| 成人免费精品视频| 一本一道久久a久久精品| 欧美网站大全在线观看| 日韩一级大片在线观看| 国产三级精品三级| 一区二区三区在线视频观看58 | 欧美视频日韩视频在线观看| 91精品国产手机| 亚洲天天做日日做天天谢日日欢| 亚洲成人免费看| 国产精品911| 91 com成人网| 中文字幕在线不卡一区 | 久久精品一区八戒影视| 亚洲免费在线电影| 美腿丝袜亚洲色图| 在线免费av一区| 国产视频一区二区在线观看| 一区二区视频免费在线观看| 久久99精品网久久| 欧美日韩国产一区二区三区地区| 久久欧美一区二区| 香蕉av福利精品导航| 成人av电影在线| 久久久影院官网| 免费黄网站欧美| 欧美人体做爰大胆视频| **欧美大码日韩| 成人精品gif动图一区| 2021国产精品久久精品 | 中文字幕av一区 二区| 久久99精品久久久久久动态图 | 国产一区二区三区在线观看精品| 欧美日韩欧美一区二区| 亚洲欧美日韩国产综合| 色综合av在线| 亚洲图片欧美色图| 欧洲精品在线观看| 亚洲一区二区三区视频在线播放 | 亚洲在线视频网站| 成人午夜碰碰视频| 国产欧美视频在线观看| 久久97超碰国产精品超碰| 欧美日韩精品欧美日韩精品一 | 不卡一二三区首页| 国产精品每日更新|