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

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

?? miniport.c

?? 利用C++工具進行編程,NDIS的PASSTHRU層的驅動程序,是非常實用的程序.
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*++

Routine Description:

	Miniport QueryInfo handler.
	In the Power Management scenario, OID_PNP_QUERY_POWER is not sent to the underlying miniport.
	OID_PNP_CAPABILITES is passed as a request to the miniport below.
	If the result is a success then the InformationBuffer is filled in the MPQueryPNPCapabilites.

	LBFO - For present all queries are passed on to the miniports that they were requested on.

	PM- If the MP is not ON (DeviceState > D0) return immediately  (except for query power and set power)
         If MP is ON, but the PT is not at D0, then queue the queue the request for later processing

	Requests to miniports are always serialized

Arguments:

	MiniportAdapterContext	Pointer to the adapter structure
	Oid						Oid for this query
	InformationBuffer		Buffer for information
	InformationBufferLength	Size of this buffer
	BytesWritten			Specifies how much info is written
	BytesNeeded				In case the buffer is smaller than what we need, tell them how much is needed


Return Value:

	Return code from the NdisRequest below.

--*/
{
	PADAPT	pAdapt = (PADAPT)MiniportAdapterContext;
	NDIS_STATUS	Status = NDIS_STATUS_FAILURE;

	DbgPrint("QueryInformation");

	do
	{
		//
		// Return Success for this OID
		//
		if (Oid == OID_PNP_QUERY_POWER)
		{
			Status=NDIS_STATUS_SUCCESS;
			break;
		}

		//
		// All other queries are failed, if the miniport is not at D0
		//
		if (pAdapt->MPDeviceState > NdisDeviceStateD0 || pAdapt->StandingBy == TRUE)
		{
			Status = NDIS_STATUS_FAILURE;
			break;
		}
		//
		//	We are doing all sends on the secondary, so send all requests with Send OIDs to the Secondary
		//
		if (MPIsSendOID(Oid))
		{
			pAdapt = pAdapt->pSecondaryAdapt;
			//
			// Will point to itself, if there is no secondary (see initialization)
			//
		}

		pAdapt->Request.RequestType = NdisRequestQueryInformation;
		pAdapt->Request.DATA.QUERY_INFORMATION.Oid = Oid;
		pAdapt->Request.DATA.QUERY_INFORMATION.InformationBuffer = InformationBuffer;
		pAdapt->Request.DATA.QUERY_INFORMATION.InformationBufferLength = InformationBufferLength;
		pAdapt->BytesNeeded = BytesNeeded;
		pAdapt->BytesReadOrWritten = BytesWritten;
		pAdapt->OutstandingRequests = TRUE;

		//
		// if the Protocol device state is OFF, then the IM driver cannot send the request below and must pend it
		//
		if (pAdapt->PTDeviceState > NdisDeviceStateD0)
		{
			pAdapt->QueuedRequest = TRUE;
			Status = NDIS_STATUS_PENDING;
			break;
		}

		//
		// default case, most requests will be passed to the miniport below
		//
		NdisRequest(&Status,
					pAdapt->BindingHandle,
					&pAdapt->Request);


		//
		// If the Query was a success, pass the results back to the entity that made the request
		//
		if (Status == NDIS_STATUS_SUCCESS)
		{
			*BytesWritten = pAdapt->Request.DATA.QUERY_INFORMATION.BytesWritten;
			*BytesNeeded = pAdapt->Request.DATA.QUERY_INFORMATION.BytesNeeded;
		}

		//
		// Fill the buffer with the required values if Oid == OID_PNP_CAPABILITIES
		// and the query was successful
		//
		if (Oid  == OID_PNP_CAPABILITIES  && Status == NDIS_STATUS_SUCCESS)
		{
			MPQueryPNPCapbilities(pAdapt,&Status);
		}

		if (Status != NDIS_STATUS_PENDING)
		{
			pAdapt->OutstandingRequests = FALSE;
		}

	} while (FALSE);

	return(Status);

}


VOID
MPQueryPNPCapbilities(
	IN OUT	PADAPT			pAdapt,
	OUT		PNDIS_STATUS	pStatus
	)
/*++

Routine Description:

	Miniport QueryInfo OID_PNP_CAPAIBILITIES:
	If the Oid == Oid_PNP_CAPABILITIES, InformationBuffer is returned with all the fields
	assigned NdisDeviceStateUnspecified in the NDIS_PM_WAKE_UP_CAPABILITIES structure

	OID_QUERY_POWER_STATE is returned with NDIS_STATUS_SUCCESS and should never be passed below.

Arguments:

	MiniportAdapterContext	Pointer to the adapter structure
	Oid						Oid for this query
	InformationBuffer		Buffer for information
	InformationBufferLength	Size of this buffer
	BytesWritten			Specifies how much info is written
	BytesNeeded				In case the buffer is smaller than what we need, tell them how much is needed

Return Value:

	Return code from the NdisRequest below.

--*/

{
	PNDIS_PNP_CAPABILITIES			pPNPCapabilities;
	PNDIS_PM_WAKE_UP_CAPABILITIES	pPMstruct;
	
	DbgPrint("Mp Query Information\n");


	if (pAdapt->Request.DATA.QUERY_INFORMATION.InformationBufferLength >= sizeof(NDIS_PNP_CAPABILITIES))
	{
		pPNPCapabilities = (PNDIS_PNP_CAPABILITIES)(pAdapt->Request.DATA.QUERY_INFORMATION.InformationBuffer);

		//
		// Setting up the buffer to be returned to the Protocol above the Passthru miniport
		//
		pPMstruct= & pPNPCapabilities->WakeUpCapabilities;
		pPMstruct->MinMagicPacketWakeUp = NdisDeviceStateUnspecified;
		pPMstruct->MinPatternWakeUp = NdisDeviceStateUnspecified;
		pPMstruct->MinLinkChangeWakeUp = NdisDeviceStateUnspecified;
		*pAdapt->BytesReadOrWritten = sizeof(NDIS_PNP_CAPABILITIES);
		*pAdapt->BytesNeeded = 0;


		//
		// Setting our internal flags
		// Default, device is ON
		//
		pAdapt->MPDeviceState = NdisDeviceStateD0;
		pAdapt->PTDeviceState = NdisDeviceStateD0;

		*pStatus = NDIS_STATUS_SUCCESS;
	}
	else
	{
		*pAdapt->BytesNeeded= sizeof(NDIS_PNP_CAPABILITIES);
		*pStatus = NDIS_STATUS_RESOURCES;
	}
}


NDIS_STATUS
MPSetInformation(
	IN	NDIS_HANDLE				MiniportAdapterContext,
	IN	NDIS_OID				Oid,
	IN	PVOID					InformationBuffer,
	IN	ULONG					InformationBufferLength,
	OUT PULONG					BytesRead,
	OUT PULONG					BytesNeeded
	)
/*++

Routine Description:

	Miniport SetInfo handler.

	In the case of OID_PNP_SET_POWER, record the power state and return the OID.	
	Do not pass below
	If the device is suspended, do not block the SET_POWER_OID 
	as it is used to reactivate the Passthru miniport

	
	PM- If the MP is not ON (DeviceState > D0) return immediately  (except for 'query power' and 'set power')
         If MP is ON, but the PT is not at D0, then queue the queue the request for later processing

	Requests to miniports are always serialized


Arguments:

	MiniportAdapterContext	Pointer to the adapter structure
	Oid						Oid for this query
	InformationBuffer		Buffer for information
	InformationBufferLength	Size of this buffer
	BytesRead				Specifies how much info is read
	BytesNeeded				In case the buffer is smaller than what we need, tell them how much is needed

Return Value:

	Return code from the NdisRequest below.

--*/
{
	PADAPT		pAdapt = (PADAPT)MiniportAdapterContext;
	NDIS_STATUS	Status;

	DbgPrint("MP Set Information\n");

	Status = NDIS_STATUS_FAILURE;

	do
	{
		//
		// The Set Power should not be sent to the miniport below the Passthru, but is handled internally
		//
		if (Oid == OID_PNP_SET_POWER)
		{
			MPProcessSetPowerOid( &Status, 
			                       pAdapt, 
			                       InformationBuffer, 
			                       InformationBufferLength, 
			                       BytesRead, 
			                       BytesNeeded);
			break;

		}

		//
		// All other Set Information requests are failed, if the miniport is not at D0 or is transitioning to
		// a device state greater than D0
		//
		if (pAdapt->MPDeviceState > NdisDeviceStateD0 || pAdapt->StandingBy == TRUE)
		{
			Status = NDIS_STATUS_FAILURE;
			break;
		}


		// Set up the Request and return the result
		pAdapt->Request.RequestType = NdisRequestSetInformation;
		pAdapt->Request.DATA.SET_INFORMATION.Oid = Oid;
		pAdapt->Request.DATA.SET_INFORMATION.InformationBuffer = InformationBuffer;
		pAdapt->Request.DATA.SET_INFORMATION.InformationBufferLength = InformationBufferLength;
		pAdapt->BytesNeeded = BytesNeeded;
		pAdapt->BytesReadOrWritten = BytesRead;
		pAdapt->OutstandingRequests = TRUE;


		//
		// if the Protocol device state is OFF, then the IM driver cannot send the request below and must pend it
		//
		if ( pAdapt->PTDeviceState > NdisDeviceStateD0)
		{
			pAdapt->QueuedRequest = TRUE;
			Status = NDIS_STATUS_PENDING;
			break;
		}

		NdisRequest(&Status,
					pAdapt->BindingHandle,
					&pAdapt->Request);


		if (Status == NDIS_STATUS_SUCCESS)
		{
			*BytesRead = pAdapt->Request.DATA.SET_INFORMATION.BytesRead;
			*BytesNeeded = pAdapt->Request.DATA.SET_INFORMATION.BytesNeeded;
		}


		if (Status != NDIS_STATUS_PENDING)
		{
			pAdapt->OutstandingRequests = FALSE;
		}

	} while (FALSE);

	return(Status);
}


VOID
MPProcessSetPowerOid(
	IN OUT PNDIS_STATUS      pNdisStatus,
	IN  PADAPT					pAdapt,
	IN	PVOID					InformationBuffer,
	IN	ULONG					InformationBufferLength,
	OUT PULONG					BytesRead,
	OUT PULONG					BytesNeeded
    )
/*++

Routine Description:
	This routine does all the procssing for a request with a SetPower Oid
    The SampleIM miniport shoud accept  the Set Power and transition to the new state

    The Set Power should not be passed to the miniport below

    If the IM miniport is going into a low power state, then there is no guarantee if it will ever
    be asked go back to D0, before getting halted. No requests should be pended or queued.

	
Arguments:
	IN OUT PNDIS_STATUS      *pNdisStatus - Status of the operation
	IN  PADAPT					pAdapt,   - The Adapter structure
	IN	PVOID					InformationBuffer, - The New DeviceState
	IN	ULONG					InformationBufferLength,
	OUT PULONG					BytesRead, - No of bytes read
	OUT PULONG					BytesNeeded -  No of bytes needed


Return Value:
    Status  - NDIS_STATUS_SUCCESS if all the wait events succeed.
    

--*/

{

	
	NDIS_DEVICE_POWER_STATE NewDeviceState;

	//DBGPRINT ("==>MPProcessSetPowerOid"); 
	ASSERT (InformationBuffer != NULL);

	NewDeviceState = (*(PNDIS_DEVICE_POWER_STATE)InformationBuffer);

	*pNdisStatus = NDIS_STATUS_FAILURE;

	do 
	{
		//
		// Check for invalid length
		//
		if (InformationBufferLength < sizeof(NDIS_DEVICE_POWER_STATE))
		{
			*pNdisStatus = NDIS_STATUS_INVALID_LENGTH;
			break;
		}

		//
		// Check for invalid device state
		//
		if ((pAdapt->MPDeviceState > NdisDeviceStateD0) && (NewDeviceState != NdisDeviceStateD0))
		{
			//
			// If the miniport is in a non-D0 state, the miniport can only receive a Set Power to D0
			//
			ASSERT (!(pAdapt->MPDeviceState > NdisDeviceStateD0) && (NewDeviceState != NdisDeviceStateD0));

			*pNdisStatus = NDIS_STATUS_FAILURE;
			break;
		}	

		//
		// Is the miniport transitioning from an On (D0) state to an Low Power State (>D0)
		// If so, then set the StandingBy Flag - (Block all incoming requests)
		//
		if (pAdapt->MPDeviceState == NdisDeviceStateD0 && NewDeviceState > NdisDeviceStateD0)
		{
			pAdapt->StandingBy = TRUE;
		}

		//
		// If the miniport is transitioning from a low power state to ON (D0), then clear the StandingBy flag
		// All incoming requests will be pended until the physical miniport turns ON.
		//
		if (pAdapt->MPDeviceState > NdisDeviceStateD0 &&  NewDeviceState == NdisDeviceStateD0)
		{
			pAdapt->StandingBy = FALSE;
		}
		
		//
		// Now update the state in the pAdapt structure;
		//
		pAdapt->MPDeviceState = NewDeviceState;
		
		*pNdisStatus = NDIS_STATUS_SUCCESS;
	

	} while (FALSE);	
		
	if (*pNdisStatus == NDIS_STATUS_SUCCESS)
	{
		*BytesRead = sizeof(NDIS_DEVICE_POWER_STATE);
		*BytesNeeded = 0;
	}
	else
	{
		*BytesRead = 0;
		*BytesNeeded = sizeof (NDIS_DEVICE_POWER_STATE);
	}

//	DBGPRINT ("<==MPProcessSetPowerOid"); 
}







VOID
MPReturnPacket(
	IN	NDIS_HANDLE				MiniportAdapterContext,
	IN	PNDIS_PACKET			Packet
	)
/*++

Routine Description:


Arguments:


Return Value:


--*/
{
	PADAPT			pAdapt = (PADAPT)MiniportAdapterContext;
	PNDIS_PACKET	MyPacket;
	PRSVD			Resvd;

//	DbgPrint("Mp Return Packet\n");
	

	Resvd = (PRSVD)(Packet->MiniportReserved);
	MyPacket = Resvd->OriginalPkt;

	NdisFreePacket(Packet);
	NdisReturnPackets(&MyPacket, 1);
}


NDIS_STATUS
MPTransferData(
	OUT PNDIS_PACKET			Packet,
	OUT PUINT					BytesTransferred,
	IN	NDIS_HANDLE				MiniportAdapterContext,
	IN	NDIS_HANDLE				MiniportReceiveContext,
	IN	UINT					ByteOffset,
	IN	UINT					BytesToTransfer
	)
/*++

Routine Description:

	Miniport's transfer data handler.

Arguments:

	Packet					Destination packet
	BytesTransferred		Place-holder for how much data was copied
	MiniportAdapterContext	Pointer to the adapter structure

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91高清在线观看| 成人欧美一区二区三区小说| 26uuu精品一区二区三区四区在线| 亚洲特级片在线| 精品在线一区二区| 欧美日韩一卡二卡| 国产精品免费久久久久| 男女激情视频一区| 在线观看av一区| 欧美高清在线精品一区| 蜜臀精品久久久久久蜜臀 | 日韩精品一区二区三区老鸭窝 | 欧美美女一区二区| 最新中文字幕一区二区三区| 国内精品伊人久久久久av影院| 在线观看国产一区二区| 国产精品国产精品国产专区不蜜| 国内欧美视频一区二区| 欧美精品v国产精品v日韩精品| 亚洲日本成人在线观看| 成人av资源网站| 久久久久久久久久久电影| 蜜桃久久久久久久| 欧美丰满嫩嫩电影| 天天影视色香欲综合网老头| 欧洲一区二区三区在线| 日韩一区欧美小说| 91年精品国产| 亚洲视频在线一区观看| 97se狠狠狠综合亚洲狠狠| 日本一区二区三区视频视频| 国产精品性做久久久久久| 久久影院视频免费| 国产成人精品网址| 国产调教视频一区| 国产福利一区二区三区在线视频| 精品成人私密视频| 国产精品99久久不卡二区| 久久精品亚洲一区二区三区浴池| 国产综合色精品一区二区三区| 日韩欧美国产一区二区三区| 美女任你摸久久| 欧美tk—视频vk| 国产精品18久久久久久久久| 欧美精彩视频一区二区三区| 成人激情动漫在线观看| 亚洲精品免费在线观看| 欧美日韩一二三区| 人人精品人人爱| 亚洲精品在线电影| 丰满放荡岳乱妇91ww| 最新中文字幕一区二区三区 | 国产成人精品亚洲日本在线桃色 | 精品久久久久久亚洲综合网 | 欧美大片拔萝卜| 国产久卡久卡久卡久卡视频精品| 日本一区二区三区高清不卡| 99麻豆久久久国产精品免费| 亚洲精品国产a| 欧美一区2区视频在线观看| 韩国精品在线观看| 亚洲视频一区在线| 日韩一区二区三区在线视频| 国产激情一区二区三区四区| 亚洲人成网站影音先锋播放| 91精品国产全国免费观看| 精品一区二区久久久| 中文字幕在线不卡视频| 7799精品视频| 成人激情黄色小说| 午夜久久久久久| 国产欧美一区在线| 欧美日精品一区视频| 精品亚洲欧美一区| 亚洲天堂免费在线观看视频| 日韩一级片在线观看| 成人动漫在线一区| 日本亚洲三级在线| 国产精品进线69影院| 在线电影院国产精品| 国产+成+人+亚洲欧洲自线| 香蕉av福利精品导航| 国产欧美综合在线| 欧美成人欧美edvon| 91麻豆国产福利在线观看| 国产一区二区三区四| 亚洲一区二区三区三| 国产三级欧美三级日产三级99 | 3d动漫精品啪啪| 97se亚洲国产综合自在线观| 激情久久五月天| 日韩精品电影一区亚洲| 自拍av一区二区三区| 久久免费精品国产久精品久久久久 | 久久久久久97三级| 欧美一区二区三区小说| 欧美私人免费视频| 色综合天天做天天爱| 国产a视频精品免费观看| 亚洲va天堂va国产va久| 亚洲视频一区二区免费在线观看 | 卡一卡二国产精品| 亚洲高清视频在线| 亚洲一区自拍偷拍| 国产精品九色蝌蚪自拍| 国产欧美一区二区三区在线看蜜臀 | 在线免费观看成人短视频| 成人免费视频一区二区| 国产真实乱偷精品视频免| 日本人妖一区二区| 亚欧色一区w666天堂| 亚洲大片免费看| 亚洲福利视频导航| 亚洲成人精品一区| 亚洲一区二区在线免费看| 一区二区三区成人| 一区二区高清在线| 亚洲一区二区精品视频| 一区二区三区欧美| 亚洲国产成人porn| 午夜激情一区二区| 日韩av在线播放中文字幕| 日韩精品亚洲一区二区三区免费| 午夜精品久久久久久久99水蜜桃| 亚洲国产精品久久一线不卡| 午夜一区二区三区视频| 午夜成人在线视频| 美女久久久精品| 国产精品一区2区| thepron国产精品| 色婷婷综合五月| 91麻豆精品国产91久久久久久久久| 7777女厕盗摄久久久| 日韩欧美高清一区| 久久久99久久精品欧美| 国产精品福利电影一区二区三区四区| 国产精品久久久久三级| 一区二区三区高清不卡| 三级久久三级久久久| 国产在线精品一区二区夜色| 国产成a人亚洲精| 在线观看亚洲一区| 欧美一级黄色大片| 欧美国产精品一区二区三区| 亚洲欧美国产三级| 麻豆精品国产91久久久久久| 国产精品123| 欧美在线播放高清精品| 欧美一区二视频| 国产精品乱码妇女bbbb| 亚洲国产精品久久人人爱蜜臀| 国产精品99久久久| 99久久国产免费看| 欧美一区二区在线观看| 国产精品久久久久久亚洲毛片| 亚洲综合网站在线观看| 麻豆一区二区三| 色婷婷久久一区二区三区麻豆| 日韩一级二级三级| 亚洲久草在线视频| 激情深爱一区二区| 欧美日韩专区在线| 久久精品免费在线观看| 亚洲国产精品影院| 丁香一区二区三区| 日韩一级高清毛片| 一区二区三区在线不卡| 国产一区二区美女| 在线电影院国产精品| 综合欧美一区二区三区| 国内成人自拍视频| 欧美亚洲一区二区在线观看| 欧美激情一区二区三区在线| 免费在线成人网| 色av一区二区| 国产欧美日韩另类视频免费观看| 亚瑟在线精品视频| 97国产一区二区| 国产精品热久久久久夜色精品三区| 婷婷久久综合九色综合绿巨人| 成人av片在线观看| 精品国产乱码久久久久久久久| 亚洲电影中文字幕在线观看| 99久久精品国产导航| 国产日韩精品一区二区三区| 久久草av在线| 日韩一区二区三免费高清| 亚洲高清久久久| 色婷婷国产精品| 亚洲免费观看高清完整版在线观看熊| 国产麻豆精品在线观看| 日韩精品一区二| 轻轻草成人在线| 9191成人精品久久| 亚洲18女电影在线观看| 在线视频中文字幕一区二区| 亚洲欧洲av在线| av在线不卡网| 国产精品国产三级国产aⅴ中文| 国产999精品久久久久久绿帽|