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

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

?? pnp.c

?? 微軟的point of sale的源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*++

Copyright (c) 1999  Microsoft Corporation

Module Name:

    pnp.c

Abstract: ESC/POS (serial) interface for USB Point-of-Sale devices

Author:

    ervinp

Environment:

    Kernel mode

Revision History:


--*/

#include <WDM.H>

#include <usbdi.h>
#include "usbdlib.h"
#include <usbioctl.h>

#include "escpos.h"
#include "debug.h"


#ifdef ALLOC_PRAGMA
        #pragma alloc_text(PAGE, FDO_PnP)
        #pragma alloc_text(PAGE, GetDeviceCapabilities)
#endif

            
NTSTATUS FDO_PnP(PARENTFDOEXT *parentFdoExt, PIRP irp)
/*++

Routine Description:

    Dispatch routine for PnP IRPs (MajorFunction == IRP_MJ_PNP)

Arguments:

    parentFdoExt - device extension for the targetted device object
    irp - IO Request Packet

Return Value:

    NT status code

--*/
{
    PIO_STACK_LOCATION irpSp;
    NTSTATUS status = STATUS_SUCCESS;
    BOOLEAN completeIrpHere = FALSE;
    BOOLEAN justReturnStatus = FALSE;
	ULONG minorFunction;
    enum deviceState prevState;

    PAGED_CODE();

    irpSp = IoGetCurrentIrpStackLocation(irp);

	/*
	 *  Get this field into a stack var so we can touch it after the IRP's completed.
	 */
	minorFunction = (ULONG)(irpSp->MinorFunction);

	DBG_LOG_PNP_IRP(irp, minorFunction, FALSE, FALSE, -1);

    switch (minorFunction){

        case IRP_MN_START_DEVICE:

            prevState = parentFdoExt->state;
            parentFdoExt->state = STATE_STARTING;

            /*
             *  First, send the START_DEVICE irp down the stack
             *  synchronously to start the lower stack.
             *  We cannot do anything with our device object
             *  before propagating the START_DEVICE this way.
             */
            IoCopyCurrentIrpStackLocationToNext(irp);
            status = CallNextDriverSync(parentFdoExt, irp);

            if (NT_SUCCESS(status) && (prevState != STATE_STOPPED)){
                /*
                 *  Now that the lower stack is started,
                 *  do any initialization required by this device object.
                 */
                status = GetDeviceCapabilities(parentFdoExt);
                if (NT_SUCCESS(status)){

                    status = InitUSB(parentFdoExt);
                    if (NT_SUCCESS(status)){
                        /*
                         *  Check whether any special feature needs to be implemented.
                         */
                        DBGVERBOSE(("FDO_PnP: Poking registry for posFlag..."));
                        status = QuerySpecialFeature(parentFdoExt);
                        
                        if (NT_SUCCESS(status)){
                            status = CreatePdoForEachEndpointPair(parentFdoExt);
                            if (NT_SUCCESS(status)){
	                            IoInvalidateDeviceRelations(parentFdoExt->physicalDevObj, BusRelations);
                            }
                        }
                    }
                }
            }

            if (NT_SUCCESS(status)){
                parentFdoExt->state = STATE_STARTED;
            }
            else {
                parentFdoExt->state = STATE_START_FAILED;
            }
            completeIrpHere = TRUE;
            break;

        case IRP_MN_QUERY_STOP_DEVICE:
            break;

        case IRP_MN_STOP_DEVICE:
            if (parentFdoExt->state == STATE_SUSPENDED){
                status = STATUS_DEVICE_POWER_FAILURE;
                completeIrpHere = TRUE;
            }
            else {
                /*
                 *  Only set state to STOPPED if the device was
                 *  previously started successfully.
                 */
                if (parentFdoExt->state == STATE_STARTED){
                    parentFdoExt->state = STATE_STOPPED;
                }
            }
            break;
      
        case IRP_MN_QUERY_REMOVE_DEVICE:
            /*
             *  We will pass this IRP down the driver stack.
             *  However, we need to change the default status
             *  from STATUS_NOT_SUPPORTED to STATUS_SUCCESS.
             */
            irp->IoStatus.Status = STATUS_SUCCESS;
            break;

        case IRP_MN_SURPRISE_REMOVAL:

            /*
             *  We will pass this IRP down the driver stack.
             *  However, we need to change the default status
             *  from STATUS_NOT_SUPPORTED to STATUS_SUCCESS.
             */
            irp->IoStatus.Status = STATUS_SUCCESS;

            /*
             *  For now just set the STATE_REMOVING state so that
             *  we don't do any more IO.  We are guaranteed to get
             *  IRP_MN_REMOVE_DEVICE soon; we'll do the rest of
             *  the remove processing there.
             */
            parentFdoExt->state = STATE_REMOVING;

            break;

        case IRP_MN_REMOVE_DEVICE:
            /*
             *  Check the current state to guard against multiple
             *  REMOVE_DEVICE IRPs.
             */
            parentFdoExt->state = STATE_REMOVED;


            /*
             *  Send the REMOVE IRP down the stack asynchronously.
             *  Do not synchronize sending down the REMOVE_DEVICE
             *  IRP, because the REMOVE_DEVICE IRP must be sent
             *  down and completed all the way back up to the sender
             *  before we continue.
             */
            IoCopyCurrentIrpStackLocationToNext(irp);
            status = IoCallDriver(parentFdoExt->physicalDevObj, irp);
            justReturnStatus = TRUE;

            DBGVERBOSE(("REMOVE_DEVICE - waiting for %d irps to complete...", parentFdoExt->pendingActionCount));  

            /*
             *  We must for all outstanding IO to complete before
             *  completing the REMOVE_DEVICE IRP.
             *
             *  First do an extra decrement on the pendingActionCount.
             *  This will cause pendingActionCount to eventually
             *  go to -1 once all asynchronous actions on this
             *  device object are complete.
             *  Then wait on the event that gets set when the
             *  pendingActionCount actually reaches -1.
             */
            DecrementPendingActionCount(parentFdoExt);
            KeWaitForSingleObject(  &parentFdoExt->removeEvent,
                                    Executive,      // wait reason
                                    KernelMode,
                                    FALSE,          // not alertable
                                    NULL );         // no timeout

            DBGVERBOSE(("REMOVE_DEVICE - ... DONE waiting. ")); 

            /*
             *  Detach our device object from the lower device object stack.
             */
            IoDetachDevice(parentFdoExt->topDevObj);

            /*
             *  Delete all child PDOs.
             */
			if (ISPTR(parentFdoExt->deviceRelations)){
                ULONG i;
				
                DBGVERBOSE(("Parent deleting %xh child PDOs on REMOVE_DEVICE", parentFdoExt->deviceRelations->Count));
                for (i = 0; i < parentFdoExt->deviceRelations->Count; i++){
                    PDEVICE_OBJECT childPdo = parentFdoExt->deviceRelations->Objects[i];
                    DEVEXT *devExt = childPdo->DeviceExtension;
                    POSPDOEXT *pdoExt;

                    ASSERT(devExt->signature == DEVICE_EXTENSION_SIGNATURE);
                    ASSERT(devExt->isPdo);
                    pdoExt = &devExt->pdoExt;
                    DeleteChildPdo(pdoExt);
                }
				FREEPOOL(parentFdoExt->deviceRelations);
                parentFdoExt->deviceRelations = BAD_POINTER;
			}

            if (ISPTR(parentFdoExt->interfaceInfo)){
                FREEPOOL(parentFdoExt->interfaceInfo);
            }

            if (ISPTR(parentFdoExt->configDesc)){
                FREEPOOL(parentFdoExt->configDesc);
            }

            /*
             *  Delete our device object.
             *  This will also delete the associated device extension.
             */
            IoDeleteDevice(parentFdoExt->functionDevObj);

            break;

        case IRP_MN_QUERY_DEVICE_RELATIONS:
		    if (irpSp->Parameters.QueryDeviceRelations.Type == BusRelations){
				status = QueryDeviceRelations(parentFdoExt, irp);
				if (NT_SUCCESS(status)){
					/*
					 *  Although we may have satisfied this IRP, 
					 *  we still pass it down the stack.
					 *  But change the default status to success.
					 */
					irp->IoStatus.Status = status;
				}
				else {
					completeIrpHere = TRUE;
				}
			}
			break;

        case IRP_MN_QUERY_CAPABILITIES:
            /*
             *  Return the USB PDO's capabilities, but add the SurpriseRemovalOK bit.
             */
            ASSERT(irpSp->Parameters.DeviceCapabilities.Capabilities);
            IoCopyCurrentIrpStackLocationToNext(irp);
            status = CallNextDriverSync(parentFdoExt, irp);
            if (NT_SUCCESS(status)){
	            irpSp->Parameters.DeviceCapabilities.Capabilities->SurpriseRemovalOK = TRUE;
            }
            completeIrpHere = TRUE;
            break;

        case IRP_MN_QUERY_PNP_DEVICE_STATE:
			break;

        default:
            break;

    }

    if (justReturnStatus){
        /*
         *  We've already sent this IRP down the stack asynchronously.
         */
    }
    else if (completeIrpHere){
		ASSERT(status != NO_STATUS);
        irp->IoStatus.Status = status;
        IoCompleteRequest(irp, IO_NO_INCREMENT);
    }
    else {
        IoCopyCurrentIrpStackLocationToNext(irp);
        status = IoCallDriver(parentFdoExt->physicalDevObj, irp);
    }

	DBG_LOG_PNP_IRP(irp, minorFunction, FALSE, TRUE, status);

    return status;
}





NTSTATUS GetDeviceCapabilities(PARENTFDOEXT *parentFdoExt)
/*++

Routine Description:

    Function retrieves the DEVICE_CAPABILITIES descriptor from the device

Arguments:

    parentFdoExt - device extension for targetted device object

Return Value:

    NT status code

--*/
{
    NTSTATUS status;
    PIRP irp;

    PAGED_CODE();

    irp = IoAllocateIrp(parentFdoExt->physicalDevObj->StackSize, FALSE);
    if (irp){
        PIO_STACK_LOCATION nextSp = IoGetNextIrpStackLocation(irp);

        nextSp->MajorFunction = IRP_MJ_PNP;
        nextSp->MinorFunction = IRP_MN_QUERY_CAPABILITIES;
        RtlZeroMemory(  &parentFdoExt->deviceCapabilities, 
                        sizeof(DEVICE_CAPABILITIES));
        nextSp->Parameters.DeviceCapabilities.Capabilities = 
                        &parentFdoExt->deviceCapabilities;

        /*
         *  For any IRP you create, you must set the default status
         *  to STATUS_NOT_SUPPORTED before sending it.
         */
        irp->IoStatus.Status = STATUS_NOT_SUPPORTED;

        status = CallNextDriverSync(parentFdoExt, irp);

        IoFreeIrp(irp);
    }
    else {
        status = STATUS_INSUFFICIENT_RESOURCES;
    }

    ASSERT(NT_SUCCESS(status));
    return status;
}


NTSTATUS QueryDeviceRelations(PARENTFDOEXT *parentFdoExt, PIRP irp)
{
    PIO_STACK_LOCATION irpSp;
    NTSTATUS status;

    PAGED_CODE();

    irpSp = IoGetCurrentIrpStackLocation(irp);

    if (irpSp->Parameters.QueryDeviceRelations.Type == BusRelations){
		DBGVERBOSE(("QueryDeviceRelations(BusRelations) for parent"));

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
偷拍亚洲欧洲综合| 一区二区视频免费在线观看| 国内精品国产成人| 自拍偷拍国产精品| 色综合天天天天做夜夜夜夜做| 热久久一区二区| 欧美极品美女视频| 亚洲大片免费看| 国产很黄免费观看久久| 亚洲精品写真福利| 久久综合999| 成人av动漫在线| 亚洲一区二区在线观看视频 | 亚洲高清视频中文字幕| 久久一区二区三区四区| 久久婷婷久久一区二区三区| 欧美顶级少妇做爰| 欧美猛男男办公室激情| 91久久线看在观草草青青| 91女人视频在线观看| 免费视频一区二区| 日韩毛片视频在线看| 日本不卡中文字幕| 日韩影院在线观看| 日韩成人伦理电影在线观看| 日韩av在线播放中文字幕| 日本欧美一区二区三区乱码 | 美国毛片一区二区三区| 亚洲一区二区在线免费看| 最新日韩在线视频| 艳妇臀荡乳欲伦亚洲一区| 自拍偷拍亚洲欧美日韩| 久久亚洲影视婷婷| 精品88久久久久88久久久| 亚洲精品一区二区三区香蕉| www欧美成人18+| 天天影视涩香欲综合网| 蜜臀久久99精品久久久久宅男| 色综合天天综合网天天狠天天| 国产精选一区二区三区| 不卡一区二区三区四区| 欧美日韩国产中文| 亚洲欧洲一区二区在线播放| 亚洲一级二级三级| 亚洲激情网站免费观看| 国产福利不卡视频| 欧美色手机在线观看| 久久久久久久久久久久久女国产乱| 中文字幕永久在线不卡| 国产在线不卡一区| 欧美性大战xxxxx久久久| 久久久久久黄色| 蜜桃精品视频在线| 欧美三级一区二区| 国产精品久久久久久久久免费桃花| 午夜av电影一区| 欧美中文字幕一二三区视频| 国产精品区一区二区三区 | 亚洲伊人色欲综合网| 欧美精品丝袜中出| 国产精品久久久久婷婷| 国产成人精品三级| 久久久精品国产免费观看同学| 香蕉影视欧美成人| 一本久道久久综合中文字幕| 国产精品对白交换视频| 国产sm精品调教视频网站| 日韩亚洲国产中文字幕欧美| 日韩av一二三| 欧美国产97人人爽人人喊| 日本视频中文字幕一区二区三区| 中文一区在线播放| 国产精品一区二区久久精品爱涩| 日韩欧美在线网站| 蜜桃av一区二区在线观看| 欧美精品电影在线播放| 日本不卡在线视频| 久久精品视频在线免费观看| 久久不见久久见中文字幕免费| 欧美大片国产精品| 成人一区在线观看| 亚洲天堂精品视频| 亚洲一区二区四区蜜桃| 成人免费一区二区三区视频| 成人av在线播放网址| 亚洲日本中文字幕区| 色综合天天综合网天天狠天天| 亚洲国产婷婷综合在线精品| 91精品国产色综合久久不卡电影| 韩国午夜理伦三级不卡影院| 亚洲欧洲99久久| 欧美va亚洲va国产综合| 国产99一区视频免费| 成人av在线资源网| 亚洲一区自拍偷拍| 久久精品一区二区三区四区| 在线视频你懂得一区二区三区| 91丨porny丨首页| 日韩精品乱码免费| 亚洲欧洲av色图| 中文字幕不卡在线| 26uuu国产日韩综合| 欧美少妇xxx| 日本高清不卡在线观看| 成熟亚洲日本毛茸茸凸凹| 国产一区二区三区在线看麻豆| 亚洲高清久久久| 亚洲成人一区二区| 亚洲成人综合网站| 亚洲1区2区3区4区| 亚洲成人激情综合网| 五月激情综合色| 肉肉av福利一精品导航| 天天综合天天做天天综合| 日韩成人午夜电影| 黄一区二区三区| 国产a级毛片一区| 91在线免费播放| 欧美日韩中文字幕精品| 日韩美女一区二区三区| 欧美日韩中文精品| 激情五月激情综合网| 国产成人av电影在线| 91丨porny丨户外露出| 欧美日本韩国一区| 久久亚洲综合av| 亚洲一区二区3| 国产一区二区三区免费观看| 成人性生交大片免费看在线播放| 97久久久精品综合88久久| 欧美成人精品1314www| 自拍av一区二区三区| 久久国产精品99精品国产| 91在线视频观看| 欧美精品一区二区在线播放| 亚洲一二三四区| 成人免费的视频| 精品久久久久久久久久久久包黑料| 国产精品久久网站| www.亚洲人| 91精品麻豆日日躁夜夜躁| 亚洲欧美日韩国产手机在线 | 国产久卡久卡久卡久卡视频精品| 色综合久久综合中文综合网| 亚洲一区二区三区精品在线| 中文字幕亚洲视频| 日本亚洲免费观看| 一本到不卡精品视频在线观看 | 久久99最新地址| 日韩一区二区三区电影在线观看 | 亚洲视频香蕉人妖| 成人av网站在线观看免费| 久久噜噜亚洲综合| 精品伊人久久久久7777人| 欧美综合欧美视频| 国产精品天干天干在观线| 成人ar影院免费观看视频| 中文字幕第一区第二区| 99久久婷婷国产综合精品电影| 国产日韩欧美a| 色视频一区二区| 午夜av电影一区| 欧美精品一区二区久久久| 国产成人免费av在线| 中文字幕一区免费在线观看| 色综合咪咪久久| 久久国产精品区| 亚洲欧美成aⅴ人在线观看| proumb性欧美在线观看| 亚洲一区二区三区自拍| 7777精品伊人久久久大香线蕉 | 亚洲一区二区欧美激情| 欧美精品tushy高清| 国产中文一区二区三区| 一区二区三区四区精品在线视频| 欧美视频在线一区二区三区| 国产精品亚洲一区二区三区妖精| 国产精品视频你懂的| 在线不卡中文字幕| 91麻豆视频网站| 国产美女精品人人做人人爽| 一级中文字幕一区二区| 国产精品美女www爽爽爽| 波多野结衣精品在线| 毛片av中文字幕一区二区| 国产精品一区久久久久| 国产成人综合网站| 国产成人高清视频| 成人av手机在线观看| 成人综合婷婷国产精品久久| 精品中文字幕一区二区小辣椒| 蜜臀a∨国产成人精品| 日本美女视频一区二区| 麻豆91在线看| 国产成人免费视频| 欧美日韩亚洲综合一区| 26uuuu精品一区二区| 亚洲无人区一区| 国产精品456| 欧美人xxxx|