Home › Forums › Discussions › General › DDK -> NDIS -> OID
- This topic has 1 reply, 2 voices, and was last updated 18 years, 10 months ago by Vadim Smirnov.
-
AuthorPosts
-
February 18, 2006 at 10:54 pm #4995
Ну вот беру самый стандартный вариант, из C:NTDDKsrcnetworkndispassthru
NDIS_STATUS
MPQueryInformation(
IN NDIS_HANDLE MiniportAdapterContext,
IN NDIS_OID Oid,
IN PVOID InformationBuffer,
IN ULONG InformationBufferLength,
OUT PULONG BytesWritten,
OUT PULONG BytesNeeded
)
/*++
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;
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;
DbgPrint("okn");
} else DbgPrint("Not okn");
//
// 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);
}А теперь вопрос, почему я никак не могу получить в отладчике “ok”.
У меня в результате выполнения процедурыNdisRequest(&Status, pAdapt->BindingHandle,&pAdapt->Request);
Status никогда не принимает значение NDIS_STATUS_SUCCESS
Может ли из за этого в буфере
pAdapt->Request.DATA.QUERY_INFORMATION.InformationBuffer = InformationBuffer;
содержаться всякий мусор, вместо нужной мне информации?
Как получить статистику:
- OID_802_3_RCV_ERROR_ALIGNMENT
The number of frames received with alignment errors.OID_802_3_XMIT_ONE_COLLISION
The number of frames successfully transmitted after exactly one collision.OID_802_3_XMIT_MORE_COLLISIONS
The number of frames successfully transmitted after more than one collision.OID_802_3_XMIT_DEFERRED
The number of frames successfully transmitted after the NIC defers transmission at least once.OID_802_3_XMIT_MAX_COLLISIONS
The number of frames not transmitted due to excessive collisions.OID_802_3_RCV_OVERRUN
The number of frames not received due to overrun errors on the NIC.OID_802_3_XMIT_UNDERRUN
The number of frames not transmitted due to underrun errors on the NIC.OID_802_3_XMIT_HEARTBEAT_FAILURE
The number of frames successfully transmitted without detection of the collision-detect heartbeat.OID_802_3_XMIT_TIMES_CRS_LOST
The number of times the CRS signal has been lost during packet transmission.OID_802_3_XMIT_LATE_COLLISIONS
The number of collisions detected after the normal window.February 19, 2006 at 8:33 am #5975Опять рекомендую обратить внимание на полученный NDIS_STATUS? Это вполне может быть NDIS_STATUS_NOT_SUPPORTED…
-
AuthorPosts
- You must be logged in to reply to this topic.