Hey,

I just experienced a bugcheck in my NDIS driver in my MiniportInitialize()
function. I had been inspired by the netvmini sample's use of the two macros
MP_INC_REF() and MP_DEC_REF(). The latter calls NdisSetEvent() whenever the
reference count has reached zero.

However, this results in a problem in the MiniportInitialize() function. In
the sample, one of the last things done in the function is to call
NdisInitializeEvent(). But if initialization fails at an earlier point,
NdisInitializeEvent() is never executed and when MP_DEC_REF() is called to
clean-up memory a bugcheck occurs (as the event hasn't been initialized).

What's up with that?

RE: netvmini sample bug? by pavel_a

pavel_a
Tue Feb 07 10:38:14 CST 2006

Yes this is a bug :(
--PA

"Søren Dreijer" wrote:
> Hey,
>
> I just experienced a bugcheck in my NDIS driver in my MiniportInitialize()
> function. I had been inspired by the netvmini sample's use of the two macros
> MP_INC_REF() and MP_DEC_REF(). The latter calls NdisSetEvent() whenever the
> reference count has reached zero.
>
> However, this results in a problem in the MiniportInitialize() function. In
> the sample, one of the last things done in the function is to call
> NdisInitializeEvent(). But if initialization fails at an earlier point,
> NdisInitializeEvent() is never executed and when MP_DEC_REF() is called to
> clean-up memory a bugcheck occurs (as the event hasn't been initialized).
>
> What's up with that?
>
>
>

Re: netvmini sample bug? by Eliyas

Eliyas
Tue Feb 07 12:40:27 CST 2006

The call to initialize the RemoveEvent should be done immediately after the
adapter context structure is created. I will fix this bug. Thanks.

--
-Eliyas
This posting is provided "AS IS" with no warranties, and confers no rights.
http://www.microsoft.com/whdc/driver/kernel/KB-drv.mspx



Re: netvmini sample bug? by Søren

Søren
Sat Feb 11 07:42:53 CST 2006

You're welcome. I just appreciate the wonderful samples you've made!

So, thank YOU :]

--Søren

"Eliyas Yakub [MSFT]" <eliyasy@online.microsoft.com> wrote in message
news:eR2P4XBLGHA.648@TK2MSFTNGP14.phx.gbl...
> The call to initialize the RemoveEvent should be done immediately after
the
> adapter context structure is created. I will fix this bug. Thanks.
>
> --
> -Eliyas
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> http://www.microsoft.com/whdc/driver/kernel/KB-drv.mspx
>
>