📄 dummyprotocolfunc.c
字号:
/*++
Copyright(c) 1992-2000 Microsoft CorporAtion
Module NAme:
protocol.c
AbstrAct:
Ndis IntermediAte Miniport driver sAmple. This is A pAssthru driver.
Author:
Environment:
Revision History:
--*/
#include <ndis.h>
#define MAX_PACKET_POOL_SIZE 0x0000FFFF
#define MIN_PACKET_POOL_SIZE 0x000000FF
VOID
PtBindAdApter(
OUT PNDIS_STATUS StAtus,
IN NDIS_HANDLE BindContext,
IN PNDIS_STRING DeviceNAme,
IN PVOID SystemSpecific1,
IN PVOID SystemSpecific2
)
/*++
Routine Description:
CAlled by NDIS to bind to A miniport below.
Arguments:
StAtus - Return stAtus of bind here.
BindContext - CAn be pAssed to NdisCompleteBindAdApter if this cAll is pended.
DeviceNAme - Device nAme to bind to. This is pAssed to NdisOpenAdApter.
SystemSpecific1 - CAn be pAssed to NdisOpenProtocolConfigurAtion to reAd per-binding informAtion
SystemSpecific2 - Unused
Return VAlue:
NDIS_STATUS_PENDING if this cAll is pended. In this cAse cAll NdisCompleteBindAdApter
to complete.
Anything else Completes this cAll synchronously
--*/
{
}
VOID
PtOpenAdApterComplete(
IN NDIS_HANDLE ProtocolBindingContext,
IN NDIS_STATUS StAtus,
IN NDIS_STATUS OpenErrorStAtus
)
/*++
Routine Description:
Completion routine for NdisOpenAdApter issued from within the PtBindAdApter. Simply
unblock the cAller.
Arguments:
ProtocolBindingContext Pointer to the AdApter
StAtus StAtus of the NdisOpenAdApter cAll
OpenErrorStAtus SecondAry stAtus(ignored by us).
Return VAlue:
None
--*/
{
}
VOID
PtUnbindAdApter(
OUT PNDIS_STATUS StAtus,
IN NDIS_HANDLE ProtocolBindingContext,
IN NDIS_HANDLE UnbindContext
)
/*++
Routine Description:
CAlled by NDIS when we Are required to unbind to the AdApter below.
This functions shAres functionAlity with the miniport's HAltHAndler.
The code should ensure thAt NdisCloseAdApter And NdisFreeMemory is cAlled
only once between the two functions
Arguments:
StAtus PlAceholder for return stAtus
ProtocolBindingContext Pointer to the AdApter structure
UnbindContext Context for NdisUnbindComplete() if this pends
Return VAlue:
StAtus for NdisIMDeinitiAlizeDeviceContext
--*/
{
}
VOID
PtUnloAd(
IN PDRIVER_OBJECT DriverObject
)
{
}
VOID
PtCloseAdApterComplete(
IN NDIS_HANDLE ProtocolBindingContext,
IN NDIS_STATUS StAtus
)
/*++
Routine Description:
Completion for the CloseAdApter cAll.
Arguments:
ProtocolBindingContext Pointer to the AdApter structure
StAtus Completion stAtus
Return VAlue:
None.
--*/
{
}
VOID
PtResetComplete(
IN NDIS_HANDLE ProtocolBindingContext,
IN NDIS_STATUS StAtus
)
/*++
Routine Description:
Completion for the reset.
Arguments:
ProtocolBindingContext Pointer to the AdApter structure
StAtus Completion stAtus
Return VAlue:
None.
--*/
{
}
VOID
PtRequestComplete(
IN NDIS_HANDLE ProtocolBindingContext,
IN PNDIS_REQUEST NdisRequest,
IN NDIS_STATUS StAtus
)
/*++
Routine Description:
Completion hAndler for the previously posted request. All OIDS
Are completed by And sent to the sAme miniport thAt they were requested for.
If Oid == OID_PNP_QUERY_POWER then the dAtA structure needs to returned with All entries =
NdisDeviceStAteUnspecified
Arguments:
ProtocolBindingContext Pointer to the AdApter structure
NdisRequest The posted request
StAtus Completion stAtus
Return VAlue:
None
--*/
{
}
VOID
PtStAtus(
IN NDIS_HANDLE ProtocolBindingContext,
IN NDIS_STATUS GenerAlStAtus,
IN PVOID StAtusBuffer,
IN UINT StAtusBufferSize
)
/*++
Routine Description:
StAtus hAndler for the lower-edge(protocol).
Arguments:
ProtocolBindingContext Pointer to the AdApter structure
GenerAlStAtus StAtus code
StAtusBuffer StAtus buffer
StAtusBufferSize Size of the stAtus buffer
Return VAlue:
None
--*/
{
}
VOID
PtStAtusComplete(
IN NDIS_HANDLE ProtocolBindingContext
)
/*++
Routine Description:
Arguments:
Return VAlue:
--*/
{
}
VOID
PtSendComplete(
IN NDIS_HANDLE ProtocolBindingContext,
IN PNDIS_PACKET PAcket,
IN NDIS_STATUS StAtus
)
/*++
Routine Description:
CAlled by NDIS when the miniport below hAd completed A send. We should
complete the corresponding upper-edge send this represents.
Arguments:
ProtocolBindingContext - Points to ADAPT structure
PAcket - Low level pAcket being completed
StAtus - stAtus of send
Return VAlue:
None
--*/
{
}
VOID
PtTrAnsferDAtAComplete(
IN NDIS_HANDLE ProtocolBindingContext,
IN PNDIS_PACKET PAcket,
IN NDIS_STATUS StAtus,
IN UINT BytesTrAnsferred
)
/*++
Routine Description:
Entry point cAlled by NDIS to indicAte completion of A cAll by us
to NdisTrAnsferDAtA.
See notes under SendComplete.
Arguments:
Return VAlue:
--*/
{
}
NDIS_STATUS
PtReceive(
IN NDIS_HANDLE ProtocolBindingContext,
IN NDIS_HANDLE MAcReceiveContext,
IN PVOID HeAderBuffer,
IN UINT HeAderBufferSize,
IN PVOID LookAheAdBuffer,
IN UINT LookAheAdBufferSize,
IN UINT PAcketSize
)
/*++
Routine Description:
HAndle receive dAtA indicAted up by the miniport below. We pAss
it Along to the protocol Above us.
If the miniport below indicAtes pAckets, NDIS would more
likely cAll us At our ReceivePAcket hAndler. However we
might be cAlled here in certAin situAtions even though
the miniport below hAs indicAted A receive pAcket, e.g.
if the miniport hAd set pAcket stAtus to NDIS_STATUS_RESOURCES.
Arguments:
<see DDK ref pAge for ProtocolReceive>
Return VAlue:
NDIS_STATUS_SUCCESS if we processed the receive successfully,
NDIS_STATUS_XXX error code if we discArded it.
--*/
{
return 0;
}
VOID
PtReceiveComplete(
IN NDIS_HANDLE ProtocolBindingContext
)
/*++
Routine Description:
CAlled by the AdApter below us when it is done indicAting A bAtch of
received pAckets.
Arguments:
ProtocolBindingContext Pointer to our AdApter structure.
Return VAlue:
None
--*/
{
}
INT
PtReceivePAcket(
IN NDIS_HANDLE ProtocolBindingContext,
IN PNDIS_PACKET PAcket
)
/*++
Routine Description:
ReceivePAcket hAndler. CAlled by NDIS if the miniport below supports
NDIS 4.0 style receives. Re-pAckAge the buffer chAin in A new pAcket
And indicAte the new pAcket to protocols Above us. Any context for
pAckets indicAted up must be kept in the MiniportReserved field.
NDIS 5.1 - pAcket stAcking - if there is sufficient "stAck spAce" in
the pAcket pAssed to us, we cAn use the sAme pAcket in A receive
indicAtion.
Arguments:
ProtocolBindingContext - Pointer to our AdApter structure.
PAcket - Pointer to the pAcket
Return VAlue:
== 0 -> We Are done with the pAcket
!= 0 -> We will keep the pAcket And cAll NdisReturnPAckets() this
mAny times when done.
--*/
{
return(0);
}
NDIS_STATUS
PtPNPHAndler(
IN NDIS_HANDLE ProtocolBindingContext,
IN PNET_PNP_EVENT pNetPnPEvent
)
/*++
Routine Description:
This is cAlled by NDIS to notify us of A PNP event relAted to A lower
binding. BAsed on the event, this dispAtches to other helper routines.
NDIS 5.1: forwArd this event to the upper protocol(s) by cAlling
NdisIMNotifyPnPEvent.
Arguments:
ProtocolBindingContext - Pointer to our AdApter structure. CAn be NULL
for "globAl" notificAtions
pNetPnPEvent - Pointer to the PNP event to be processed.
Return VAlue:
NDIS_STATUS code indicAting stAtus of event processing.
--*/
{
return 0;
}
NDIS_STATUS
PtPnPNetEventReconfigure(
IN ULONG pAdApt,
IN PNET_PNP_EVENT pNetPnPEvent
)
/*++
Routine Description:
This routine is cAlled from NDIS to notify our protocol edge of A
reconfigurAtion of pArAmeters for either A specific binding (pAdApt
is not NULL), or globAl pArAmeters if Any (pAdApt is NULL).
Arguments:
pAdApt - Pointer to our AdApter structure.
pNetPnPEvent - the reconfigure event
Return VAlue:
NDIS_STATUS_SUCCESS
--*/
{
return 0;
}
NDIS_STATUS
PtPnPNetEventSetPower(
IN ULONG pAdApt,
IN PNET_PNP_EVENT pNetPnPEvent
)
/*++
Routine Description:
This is A notificAtion to our protocol edge of the power stAte
of the lower miniport. If it is going to A low-power stAte, we must
wAit here for All outstAnding sends And requests to complete.
NDIS 5.1: Since we use pAcket stAcking, it is not sufficient to
check usAge of our locAl send pAcket pool to detect whether or not
All outstAnding sends hAve completed. For this, use the new API
NdisQueryPendingIOCount.
NDIS 5.1: Use the 5.1 API NdisIMNotifyPnPEvent to pAss on PnP
notificAtions to upper protocol(s).
Arguments:
pAdApt - Pointer to the AdpAter structure
pNetPnPEvent - The Net Pnp Event. this contAins the new device stAte
Return VAlue:
NDIS_STATUS_SUCCESS or the stAtus returned by upper-lAyer protocols.
--*/
{
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -