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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? power.cpp

?? 智能卡的讀寫(xiě)程序
?? CPP
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/* InitialState */			{TriageNewIrp,		InvalidAction,				InvalidAction},
/* SysPowerUpPending */		{InvalidAction,		SysPowerUpComplete,			InvalidAction},
/* SubPowerUpPending */		{InvalidAction,		InvalidAction,				SubPowerUpComplete},
/* SubPowerDownPending */	{InvalidAction,		InvalidAction,				SubPowerDownComplete},
/* SysPowerDownPending */	{InvalidAction,		SysPowerDownComplete,		InvalidAction},
/* DevPowerUpPending */		{InvalidAction,		DevPowerUpComplete,			InvalidAction},
/* DevPowerDownPending */	{InvalidAction,		CompleteMainIrp,			InvalidAction},
/* ContextSavePending */	{InvalidAction,		InvalidAction,				ContextSaveComplete},
/* ContextRestorePending */	{InvalidAction,		InvalidAction,				ContextRestoreComplete},
/* DevQueryUpPending */		{InvalidAction,		DevQueryUpComplete,			InvalidAction},
/* DevQueryDownPending */	{InvalidAction,		DevQueryDownComplete,		InvalidAction},
/* QueueStallPending */		{InvalidAction,		InvalidAction,				QueueStallComplete},
/* PassiveCompletePending */{InvalidAction,		InvalidAction,				CompleteMainIrp},
/* FinalState */			{InvalidAction,		InvalidAction,				InvalidAction},
		};

	// Determine the first action to take based on the current state of the FSM and the event that occurred.
	// Note that this isn't as complicated as the use of 2-D array might suggest: all states except
	// the initial state lead to a single action for the one-and-only event that's possible to get in
	// that state.

	enum POWACTION action = actiontable[ctx->state][event];

	// Structurally, the following code is a switch on "action" imbedded within an
	// infinite loop. A case that does a "break" from the switch executes a "break"
	// from the loop, whereupon we return whatever value is left in "status". A case
	// that does a "continue" from the switch repeats the loop -- this is how actions
	// can be strung together during one call to this routine. I coded it this way to
	// avoid return statements in the middle that make it harder to prove that the
	// routine behaves in a predictable way. Note that any "break" should be preceded
	// by a change to the state recorded in the context structure and to the initially
	// invalid valid of "status". There are ASSERTs at the end to check this.

	// Concerning the required change to "ctx->state": there are many cases where we
	// call PoRequestPowerIrp or PoCallDriver, whereupon the context structure gets
	// released before those routines return. We use a SETSTATE macro so we don't
	// have to dereference a possibly invalid "ctx" pointer at the end of the loop. Any
	// action that calls a routine that might result in completing the current IRP
	// should also take care not to touch "ctx" afterwards. (These are always cases that
	// "break" from the switch, so you can just verify that the break always immediately
	// follows the PoXxx call.)

	// Concerning the required change to "status": only TriageNewIrp
	// will arrange to return STATUS_PENDING. Many of the other initial actions are entered
	// from a standard I/O completion routine and will need to return STATUS_MORE_PROCESSING_REQUIRED
	// to hold off final completion. Any action for MainIrpComplete that goes out through
	// CompleteMainIrp will end up returning ctx->status, which gets set in MainCompletionRoutine
	// to whatever's in the IRP -- this allows the IRP to complete normally. Any action off of
	// AsyncNotify should be changing "status" explicitly (and they do -- I checked).

#if DBG
	enum POWSTATE originalstate = ctx->state;
	enum POWSTATE nextstate = originalstate;
	#define SETSTATE(s) ctx->state = nextstate = s
	LONG eventid = InterlockedIncrement(&ctx->eventcount);
	LONG ctxid = ctx->id;
#else
	#define SETSTATE(s) ctx->state = s
#endif

	POWTRACE((DRIVERNAME " - %d.%d is %s in state %s\n", ctxid, eventid, eventnames[event], powstatenames[originalstate]));

	while (TRUE)
		{						// handle this event
		POWTRACE((DRIVERNAME " -  %d.%d %s\n", ctxid, eventid, actionnames[action]));
		switch (action)
			{					// perform next action

		///////////////////////////////////////////////////////////////////////
		// TriageNewIrp is the first action for a newly receive query or set IRP

		case TriageNewIrp:
			{					// TriageNewIrp
			ASSERT(stack->MajorFunction == IRP_MJ_POWER);
			ASSERT(stack->MinorFunction == IRP_MN_QUERY_POWER || stack->MinorFunction == IRP_MN_SET_POWER);
			ASSERT(ctx->state == InitialState);

			// We want the power dispatch routine to return STATUS_PENDING unless
			// something goes wrong right away. If we do return STATUS_PENDING, we
			// need to be sure we mark the IRP pending, 

			status = STATUS_PENDING;
			IoMarkIrpPending(Irp);

			// Acquire remove lock an extra time. We'll release it when we eventually
			// complete this IRP.

			IoAcquireRemoveLock(&pdx->RemoveLock, Irp);

			// For a system IRP, we'll request the corresponding device IRP. If system power is
			// being restored, we wait until the lower level drivers finish the system IRP. If
			// system power is being removed, we do it now and forward the system IRP when the
			// device IRP finishes.

			if (stack->Parameters.Power.Type == SystemPowerState)
				{				// system IRP
				if (stack->Parameters.Power.State.SystemState < pdx->syspower)
					{
					action = ForwardMainIrp;
					SETSTATE(SysPowerUpPending);
					}
				else
					{
					action = SelectDState;
					SETSTATE(SubPowerDownPending);
					}
				}				// system IRP

			// For a device set-power IRP, we have a variety of tasks to carry out. If device
			// power is being restored, we do those tasks when the lower level drivers complete
			// the IRP. If device power is being removed or staying the same, we do those tasks
			// before passing this IRP down. In either case, we ensure that the device isn't busy
			// with any substantive IRPs first.

			else
				{				// device IRP
				SETSTATE(QueueStallPending);

				action = QueueStallComplete;
				}				// device IRP

			continue;
			}					// TriageNewIrp
			
		///////////////////////////////////////////////////////////////////////
		// QueueStallComplete is the action for an AsyncNotify event in the
		// QueueStallPending state. It's reached when StartNextPacket calls
		// GenericSaveRestoreComplete, which we specified as the current-irp
		// complete notification routine in our earlier call to StallRequestsAndNotify.
		// This action can also be reached directly from TriageNewIrp if the
		// device was idle to begin with or if we were already in a low-power
		// state (so that the queue should have been stalled)

		case QueueStallComplete:
			{					// QueueStallComplete
			if (stack->MinorFunction == IRP_MN_SET_POWER)
				{				// device set-power IRP
				if (stack->Parameters.Power.State.DeviceState < pdx->devpower)
					{
					action = ForwardMainIrp;
					SETSTATE(DevPowerUpPending);
					}
				else
					action = SaveContext;
				}				// device set-power IRP
			else
				{				// device query-power IRP
				if (stack->Parameters.Power.State.DeviceState < pdx->devpower)
					{
					action = ForwardMainIrp;
					SETSTATE(DevQueryUpPending);
					}
				else
					action = DevQueryDown;
				}				// device query-power IRP
			continue;
			}					// QueueStallComplete
			
		///////////////////////////////////////////////////////////////////////
		// ForwardMainIrp sends the current power IRP to the next driver in the
		// stack. We regain control in MainCompletionRoutine.

		case ForwardMainIrp:
			{					// ForwardMainIrp
			IoCopyCurrentIrpStackLocationToNext(Irp);
			IoSetCompletionRoutine(Irp, (PIO_COMPLETION_ROUTINE) MainCompletionRoutine, (PVOID) ctx, TRUE, TRUE, TRUE);
			SafePoCallDriver(pdx->LowerDeviceObject, Irp); // avoid Win98 problem later on
			break;
			}					// ForwardMainIrp

		///////////////////////////////////////////////////////////////////////
		// SysPowerUpComplete is the action for a MainIrpComplete event in the
		// SysPowerUpPending state. If the IRP succeeded, request the corresponding
		// D-state IRP. When the subsidiary IRP finishes, we'll complete this
		// S-state IRP as well.
		//
		// The DDK doesn't explicitly say you need to send a D-state query when you
		// get an S-state query. It simplifies our own logic a good deal to do this,
		// however.

		case SysPowerUpComplete:
			{					// SysPowerUpComplete
			ASSERT(event == MainIrpComplete);

			if (!NT_SUCCESS(ctx->status))
				action = CompleteMainIrp;
			else
				{				// S-irp succeeded
				action = SelectDState;
				SETSTATE(SubPowerUpPending);
				status = STATUS_MORE_PROCESSING_REQUIRED;	// defer completion of S-IRP

				if (stack->MinorFunction == IRP_MN_SET_POWER)
					{			// S-set
					pdx->syspower = stack->Parameters.Power.State.SystemState;
					
					// Except in 98/Me, complete an S0 IRP right away to allow
					// faster restart after suspend.

					if (pdx->syspower == PowerSystemWorking && !win98)
						{		// S0
						ASSERT(Irp);
						PoStartNextPowerIrp(Irp);
						status = STATUS_SUCCESS;	// allows S-IRP to complete
						IoReleaseRemoveLock(&pdx->RemoveLock, Irp);
						ctx->irp = NULL;				// flag for eventual CompleteMainIrp step
						}		// S0
					}			// S-set
				}				// S-irp succeeded

			continue;
			}					// SysPowerUpComplete

		///////////////////////////////////////////////////////////////////////
		// SysPowerDownComplete is the action for a MainIrpComplete event in the
		// SysPowerDownPending state.

		case SysPowerDownComplete:
			{					// SysPowerDownComplete
			if (stack->MinorFunction == IRP_MN_SET_POWER)
				pdx->syspower = stack->Parameters.Power.State.SystemState;

			action = CompleteMainIrp;
			continue;
			}					// SysPowerDownComplete

		///////////////////////////////////////////////////////////////////////
		// SelectDState is used to establish the power state and minor function
		// code for a D-state IRP that corresponds to the S-state IRP we're
		// processing. After doing that, we do the SendDeviceIrp action.

		case SelectDState:
			{					// SelectDState
			SYSTEM_POWER_STATE sysstate = stack->Parameters.Power.State.SystemState;

			ctx->devstate = GetLowestDevicePowerState(pdx, sysstate);
			ctx->MinorFunction = stack->MinorFunction;
			action = SendDeviceIrp;
			continue;
			}					// SelectDState

		///////////////////////////////////////////////////////////////////////
		// SendDeviceIrp requests a device set- or query-power IRP using the power
		// state and minor function code currently in the context block. SelectDState
		// put them there.

		case SendDeviceIrp:
			{					// SendDeviceIrp

			// If we want the device in the same state it's already in, bypass sending
			// the D-state IRP. This is necessary in Win98 due to a bug that causes
			// PoRequestPowerIrp to report success in a situation where CONFIGMG won't
			// generate the configuration event. This has also turned out to be necessary
			// when bringing Win2K/Xp out of standby or hibernate, although I don't
			// exactly understand why.

			if (ctx->devstate == pdx->devpower)
				{				// pretend success
				POWTRACE((DRIVERNAME " -  %d.%d pretending to succeed D-state IRP for Win98\n", ctxid, eventid));
				ctx->status = STATUS_SUCCESS;
				action = actiontable[ctx->state][AsyncNotify];
				continue;
				}				// pretend success

			// Ask the power manager to send us an IRP. In Win98, we need to supply the
			// PDO as the device object address because NTKERN needs to go directly from
			// there to the devnode address.

			POWER_STATE powstate;
			powstate.DeviceState = ctx->devstate;

			NTSTATUS postatus = PoRequestPowerIrp(pdx->Pdo, ctx->MinorFunction, powstate,
				(PREQUEST_POWER_COMPLETE) PoCompletionRoutine, ctx, NULL);

			// If PoRequestPowerIrp fails, it never actually sent an IRP down the stack,
			// so we can certain that PoCompletionRoutine never ran

			if (NT_SUCCESS(postatus))
				break;			// started device IRP okay

			KdPrint((DRIVERNAME " - PoRequestPowerIrp failed - %X\n", postatus));
			action = CompleteMainIrp;
			ctx->status = postatus;
			continue;
			}					// SendDeviceIrp

		///////////////////////////////////////////////////////////////////////
		// CompleteMainIrp is the penultimate action of the finite state machine.
		// This is where we actually complete the power IRP we've been handling.

		case CompleteMainIrp:
			{					// CompleteMainIrp

			// In Win98, we must not complete a power IRP at DISPATCH_LEVEL, so
			// queue a work item in that case.

			if (win98 && KeGetCurrentIrql() > PASSIVE_LEVEL)
				{				// defer completion to passive level
				#pragma warning(disable:4995)
				#pragma warning(disable:4996)
				C_ASSERT(sizeof(Irp->Tail.Overlay.DriverContext) >= sizeof(WORK_QUEUE_ITEM));

				ASSERT(Irp);

				PWORK_QUEUE_ITEM item = (PWORK_QUEUE_ITEM) Irp->Tail.Overlay.DriverContext;
				ExInitializeWorkItem(item, (PWORKER_THREAD_ROUTINE) PassivePowerComplete, (PVOID) ctx);
				ExQueueWorkItem(item, CriticalWorkQueue);

				#pragma warning(default:4995)
				#pragma warning(default:4996)

				if (event == MainIrpComplete)
					status = STATUS_MORE_PROCESSING_REQUIRED;
				SETSTATE(PassiveCompletePending);
				break;
				}				// defer completion to passive level

			// Skip completion processing if we've already completed an S0 SET_POWER.
			// Otherwise, complete (or allow to complete) the main IRP

			if (Irp)
				{				// not previously completed

				// Tell the power manager to release the next IRP of the same flavor
				// as we're currently processing.

				PoStartNextPowerIrp(Irp);

				// If called from MainCompletionRoutine, just allow the completion process
				// to take its course. Otherwise, explicitly complete the main IRP.

				if (event == MainIrpComplete)
					status = ctx->status;	// might have been STATUS_MORE_PROCESSING_REQUIRED until now
				else
					{

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人在线观看免费网站| 欧美精品自拍偷拍| 国产日韩综合av| 国产在线国偷精品免费看| 精品国产sm最大网站免费看| 国内欧美视频一区二区| 久久久精品免费观看| 国产成人亚洲综合色影视| 国产精品免费久久| 在线一区二区三区四区| 三级影片在线观看欧美日韩一区二区| 717成人午夜免费福利电影| 激情亚洲综合在线| 国产精品乱码人人做人人爱| 在线观看不卡一区| 日本成人超碰在线观看| 久久久久久久久伊人| 99久久精品国产精品久久| 亚洲大片在线观看| 精品欧美乱码久久久久久1区2区| 国产电影一区在线| 夜夜嗨av一区二区三区网页 | 欧美久久久久久久久久| 日本亚洲欧美天堂免费| 国产日韩欧美精品电影三级在线| 91在线免费播放| 日韩成人精品在线| 国产日韩欧美麻豆| 欧美区视频在线观看| 国产成人综合在线观看| 亚洲精品乱码久久久久久日本蜜臀| 在线不卡欧美精品一区二区三区| 国产精品资源在线看| 亚洲永久精品国产| 亚洲精品在线免费观看视频| 懂色中文一区二区在线播放| 亚洲一区av在线| 国产亚洲va综合人人澡精品 | 成人深夜在线观看| 香蕉成人啪国产精品视频综合网 | 高清在线观看日韩| 性欧美疯狂xxxxbbbb| 久久久国产精华| 精品视频在线免费看| 成人毛片在线观看| 午夜久久久影院| 亚洲日穴在线视频| 国产视频一区二区在线| 制服丝袜日韩国产| 色国产综合视频| 国产成人精品亚洲777人妖| 偷拍一区二区三区四区| 亚洲免费视频成人| 中文字幕免费不卡在线| 欧美日韩一级二级| 国产成人免费视频网站| 奇米888四色在线精品| 亚洲靠逼com| 国产精品国产a| 国产午夜精品福利| 日韩欧美一二区| 3d成人动漫网站| 欧美色网站导航| 色域天天综合网| 成人黄页毛片网站| 国产aⅴ精品一区二区三区色成熟| 日日夜夜免费精品| 亚洲aaa精品| 午夜久久久影院| 无码av免费一区二区三区试看| 亚洲男同性恋视频| 亚洲欧美在线aaa| 中文字幕一区二区视频| 国产日产欧美精品一区二区三区| 久久一二三国产| 精品国产乱码久久久久久夜甘婷婷 | 91蜜桃免费观看视频| 国产一区二区调教| 黄色资源网久久资源365| 久久er精品视频| 久久99久久久久久久久久久| 免费xxxx性欧美18vr| 蜜臀91精品一区二区三区| 日韩成人一级片| 麻豆成人在线观看| 韩国精品主播一区二区在线观看| 麻豆91在线看| 国产激情一区二区三区| 成人免费看黄yyy456| 波多野结衣在线aⅴ中文字幕不卡| 成人网在线播放| 91蜜桃在线免费视频| 在线中文字幕一区二区| 欧美精品粉嫩高潮一区二区| 日韩一区二区免费在线观看| 亚洲精品在线电影| 国产精品久久三区| 亚洲一区中文在线| 天堂va蜜桃一区二区三区漫画版| 美美哒免费高清在线观看视频一区二区 | 99久久精品国产麻豆演员表| 不卡av在线免费观看| 97久久超碰精品国产| 在线看日本不卡| 91精品国产美女浴室洗澡无遮挡| 精品国产91乱码一区二区三区 | av一区二区三区四区| 91亚洲午夜精品久久久久久| 欧美日韩一级黄| 久久免费国产精品| 亚洲精选在线视频| 麻豆成人av在线| 97久久久精品综合88久久| 欧美精品日日鲁夜夜添| 久久久精品国产免大香伊| 尤物av一区二区| 久久99热狠狠色一区二区| 91丨九色丨黑人外教| 9191成人精品久久| 国产精品的网站| 日韩精品亚洲专区| 本田岬高潮一区二区三区| 欧美丝袜自拍制服另类| 国产亚洲成年网址在线观看| 亚洲成人三级小说| 成人av网站免费观看| 欧美一区二区日韩| 亚洲欧美另类小说| 激情文学综合插| 欧美午夜视频网站| 国产欧美日韩另类视频免费观看 | 日韩欧美精品三级| 亚洲人123区| 国产盗摄一区二区三区| 欧美精品tushy高清| 自拍偷拍欧美激情| 狠狠色丁香久久婷婷综合丁香| 欧美亚洲动漫精品| 国产精品福利影院| 韩国女主播成人在线观看| 欧美伊人久久大香线蕉综合69| 国产欧美视频一区二区| 久久精品久久综合| 欧美喷潮久久久xxxxx| 日韩美女视频一区| 国产风韵犹存在线视精品| 日韩精品一区在线观看| 亚洲二区在线观看| 日本福利一区二区| 国产精品国产三级国产普通话蜜臀| 麻豆国产一区二区| 91精品一区二区三区久久久久久| 一区二区国产视频| 色综合色综合色综合 | 亚洲欧美日韩国产中文在线| 国产精品一区二区久久精品爱涩| 91精品婷婷国产综合久久竹菊| 亚洲精品视频在线看| 成人福利视频网站| 国产片一区二区三区| 国产一区不卡精品| 欧美精品一区视频| 狠狠色狠狠色综合系列| 精品av久久707| 激情综合色综合久久综合| 欧美一区二区三区啪啪| 日本欧美大码aⅴ在线播放| 欧美三级视频在线播放| 亚洲午夜羞羞片| 欧美日韩一区国产| 视频一区视频二区中文| 51精品国自产在线| 日韩一区精品视频| 欧美一级理论性理论a| 美国三级日本三级久久99| 欧美tickling网站挠脚心| 激情文学综合丁香| 日本一区免费视频| 911精品产国品一二三产区| 午夜久久福利影院| 91精品国产品国语在线不卡| 美女脱光内衣内裤视频久久影院| 欧美精品一区二区三区视频| 国产激情视频一区二区在线观看| 日本一区二区免费在线观看视频| 不卡的av电影| 亚洲成人免费在线| 精品久久久久久久久久久久久久久 | 91视视频在线直接观看在线看网页在线看| 中文字幕在线一区免费| 色天天综合久久久久综合片| 五月激情六月综合| 欧美精品一区二区三区蜜桃| 国产v日产∨综合v精品视频| 亚洲人成网站色在线观看| 欧美日韩在线电影| 国产资源在线一区| 亚洲欧美一区二区三区极速播放 | 精品福利视频一区二区三区| 国产精品亚洲专一区二区三区|