PtRequest complete blowup Was: RE: Getting network (MAC) address of network card in intermediate dr

Thanks Michal. I spent some intimate time with WindBg and found the
problem. It is actually in my PtRequestComplete function. (I don’t
know why PtRequestComplete gets called…). Anyway here is the code
where it blows up, with some snipping. This code is straight from the
passthru example in the DDK, I haven’t changed it:

VOID PtRequestComplete(…)
{
PADAPT pAdapt = (PADAPT)ProtocolBindingContext;

switch (NdisRequest->RequestType)
{
case NdisRequestQueryInformation:

*pAdapt->BytesReadOrWritten =
NdisRequest->DATA.QUERY_INFORMATION.BytesWritten;
*pAdapt->BytesNeeded =
NdisRequest->DATA.QUERY_INFORMATION.BytesNeeded;

It blows up when it tries to assign *pAdapt->BytesReadOrWritten because
BytesReadOrWritten is a pointer, current value = null. I know I
shouldn’t allocate space for BytesReadOrWritten because sometimes the
driver makes pointer assignments to it (memory leakage). I am thinking
I will make a couple of new members to my pAdapt structure and save them
off there. Is that a good idea? Why not?

Thanks,
John

-----Original Message-----
From: Vodicka, Michal [mailto:xxxxx@rkk.cz]
Sent: Wednesday, February 21, 2001 4:10 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Getting network (MAC) address of network card in
inte rmediate driver

I don’t see a fatal problem there but maybe I’m missing something. A
suggestion: try to check your real NDIS_REQUEST size, it is different
for
NDIS 4 and 5 (conditional compilation of ndis.h). If your driver claims
to
be NDIS 5 and uses NDIS 4 request, it can cause crash. Also, examine
IRQL_NOT_LESS_OR_EQUAL docs, from this bugcheck parameters should be
possible to find a memory address which caused crash.

BTW, there NdisRequest() can return pending status which isn’t
unsuccessful
request.

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


From: John Hirschi[SMTP:xxxxx@SonicWALL.com]
Reply To: NT Developers Interest List
Sent: Wednesday, February 21, 2001 10:05 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Getting network (MAC) address of network
card in
inte rmediate driver

Hi,

Here is the code I am using (in my MiniportInitialize function). I
get
a fatal error right after the debugger outputs the “request firing”
debug statement. The memory allocations are successful and the
OS_ASSERT passes. When it dies it says
“DRIVER_IRQL_NOT_LESS_OR_EQUAL”.
Suggestions?

PNDIS_REQUEST pRequest;

PNDIS_BUFFER pBuffer;

NDIS_PHYSICAL_ADDRESS noMaxAddr = NDIS_PHYSICAL_ADDRESS_CONST(-1,-1);

Status = NdisAllocateMemory(&pBuffer, 6, 0, noMaxAddr);

if (Status != NDIS_STATUS_SUCCESS)

DBG_PRINTF((“AdapterRequest - Not enough memory1”))

Status = NdisAllocateMemory(&pRequest, sizeof(NDIS_REQUEST), 0,
noMaxAddr);

if (Status != NDIS_STATUS_SUCCESS)

DBG_PRINTF((“AdapterRequest - Not enough memory2”))

NdisZeroMemory(pRequest, sizeof(NDIS_REQUEST));

pRequest->DATA.QUERY_INFORMATION.Oid = OID_802_3_CURRENT_ADDRESS;

pRequest->DATA.QUERY_INFORMATION.InformationBuffer = pBuffer;

pRequest->DATA.QUERY_INFORMATION.InformationBufferLength = 6;

pRequest->DATA.QUERY_INFORMATION.BytesWritten = 0;

pRequest->DATA.QUERY_INFORMATION.BytesNeeded = 6;

OS_ASSERT(pAdapt->BindingHandle);

DBG_PRINTF((“request firing”))

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

DBG_PRINTF((“checking status”))

if (Status == NDIS_STATUS_SUCCESS)

{

DBG_PRINTF((“successful request”))

}

else

{

DBG_PRINTF((“unsuccessful request”))

}

-----Original Message-----
From: Vodicka, Michal [mailto:xxxxx@rkk.cz]
Sent: Tuesday, February 20, 2001 4:02 PM
To: NT Developers Interest List
Subject: [ntdev] RE: Getting network (MAC) address of network card in
inte rmediate driver

I’m using OID_802_3_CURRENT_ADDRESS for this purpose but permanent one
should work as well. There is no problem, just fill NDIS_REQUEST
structure
with appropriatte values, call NdisRequest() with correct parameters
and
wait for completion if it returns pending status.
ProtocolRequestComplete()
is called when pending request is completed. Of course, 802_3 OIDs
work
for
ethernet adapters only.

BTW, if you have been unsuccessful, there should be some error code
which is
the most important information when solving such a problem.

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]

> ----------
> From: John Hirschi[SMTP:xxxxx@SonicWALL.com]
> Reply To: NT Developers Interest List
> Sent: Tuesday, February 20, 2001 11:42 PM
> To: NT Developers Interest List
> Subject: [ntdev] Getting network (MAC) address of network card in
> intermediate driver
>
> Hi,
>
> I am working on an intermediate driver for Win2k. In my
intermediate
> driver, I need to know the 6 byte MAC address of the network card
that
I
> am controlling. I have tried using the NdisReadNetworkAddress()
> function, but the call fails. I think it fails because the function
> expects the MAC address to be written in the registry under a
> NetworkAddress key that is not there. So after banging my head
against
> that problem for a while, I decided to look for a different way to
get
> the network address. I found this: OID_802_3_PERMANENT_ADDRESS .
It
> seems that I can call NdisRequest, pass it this OID, and get the
> information I need. However, I have been unsuccessful so far. Can
you
> please send me information, a link, a suggestion, cold compress,
etc?
>
> Thanks,
> John
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@rkk.cz
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@sonicwall.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@rkk.cz
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@sonicwall.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com