KeSyncrhonizeExecution vs NdisMSynchronizeWithInterrupt

Hi,
I wouldn’t imagine there’s a great deal of difference between these two. I
was using KeSynchronizeExecution but now I have to use the NdisXXX routines
for interrupt handling etc. Problem is, I get a BSOD when I try to use
NdisMSynchronizeWithInterrupt. Ironically, it’s BSODing in
KeSyncrhonizeExecution. If I use KeSyncrhonizeExecution I have no problems.
Here’s what I see:

fc8d6e94 804e9f74 ntoskrnl!KiTrap0E+0x2ad
fc8d6f48 fb0a6a97 ntoskrnl!KeSynchronizeExecution+0x5
fc8d6f64 fb0c834e mydrv!_int_sync+0x55

I don’t know why NdisMSynchronizeWithInterrupt isn’t appearing on the stack
but I’m definitely calling it. Looking at the disassembly of
NdisMSynchronizeWithInterrupt, it just seems to pass the parameters straight
on to KeSyncrhonizeExecution. Why do I need to call
NdisMSynchronizeWithInterrupt? Don’t ask me, ask MS.

Any ideas what might be going wrong? All I have done to my code is exchange
KeSyncrhonizeExecution for NdisMSynchronizeWithInterrupt and now I’m seeing
blue screens.

Any ideas?

This is going to sound stupid, but sometimes we miss the obvious.

Are you passing a PKINTERRUPT or a PNDIS_MINIPORT_INTERRUPT?
Have you called NdisMRegisterInterrupt?

I had a similar situation at one point. It turned out that some code I was
calling from MiniportInitialize
was calling NdisMSynchronizeWithInterrupt before I’d registered the
interrupt. KeSynchronizeExecution
(using a PKINTERRUPT handed over from a buddy driver – long story) worked
fine. I had to sit down
with the inherited code for a while before the blazingly obvious hit me.

“Lee Rhodes” wrote in message news:xxxxx@ntdev…
>
> Hi,
> I wouldn’t imagine there’s a great deal of difference between these two. I
> was using KeSynchronizeExecution but now I have to use the NdisXXX
routines
> for interrupt handling etc. Problem is, I get a BSOD when I try to use
> NdisMSynchronizeWithInterrupt. Ironically, it’s BSODing in
> KeSyncrhonizeExecution. If I use KeSyncrhonizeExecution I have no
problems.
> Here’s what I see:
>
> fc8d6e94 804e9f74 ntoskrnl!KiTrap0E+0x2ad
> fc8d6f48 fb0a6a97 ntoskrnl!KeSynchronizeExecution+0x5
> fc8d6f64 fb0c834e mydrv!_int_sync+0x55
>
> I don’t know why NdisMSynchronizeWithInterrupt isn’t appearing on the
stack
> but I’m definitely calling it. Looking at the disassembly of
> NdisMSynchronizeWithInterrupt, it just seems to pass the parameters
straight
> on to KeSyncrhonizeExecution. Why do I need to call
> NdisMSynchronizeWithInterrupt? Don’t ask me, ask MS.
>
> Any ideas what might be going wrong? All I have done to my code is
exchange
> KeSyncrhonizeExecution for NdisMSynchronizeWithInterrupt and now I’m
seeing
> blue screens.
>
> Any ideas?

Hi Scott,

Are you passing a PKINTERRUPT or a PNDIS_MINIPORT_INTERRUPT?
On close inspection it seems that this is where the mix up was. I hadn’t
redefined my legacy InterruptObject as an NDIS_MINIPORT_INTERRUPT. That’s
obviously where the blue screen was coming from. When NdisMSync was calling
KeSync, it was derefercing an invalid pointer. The reason KeSync was working
with the NDIS handle was due to the fact that the first field in the
NDIS_MINIPORT_INTERRUPT structure is a PKINTERRUPT.

I have now redefined my InterruptObject and it seems to be working ok :slight_smile:

Thanks for pointing out the obvious!

Glad to help. Sometimes it’s the little things.

“Lee Rhodes” wrote in message news:xxxxx@ntdev…
>
> Hi Scott,
> > Are you passing a PKINTERRUPT or a PNDIS_MINIPORT_INTERRUPT?
> On close inspection it seems that this is where the mix up was. I hadn’t
> redefined my legacy InterruptObject as an NDIS_MINIPORT_INTERRUPT. That’s
> obviously where the blue screen was coming from. When NdisMSync was
calling
> KeSync, it was derefercing an invalid pointer. The reason KeSync was
working
> with the NDIS handle was due to the fact that the first field in the
> NDIS_MINIPORT_INTERRUPT structure is a PKINTERRUPT.
>
> I have now redefined my InterruptObject and it seems to be working ok :slight_smile:
>
> Thanks for pointing out the obvious!
>
>

Hi all again,
I’m not usually one to flog a dead horse but I’d still be interested in knowing what the difference is between KeSynchronizeExecution and NdisMSynchronizeWithInterrupt. Looking at a disassembled NdisMSynchronizeWithInterrupt, all I can see it doing it calling KeSynchronizeExecution so I’m wondering why I have to use the NDIS routine instead of the Ke routine?

Just idle curiosity at this stage.

Thanks

Almost all of the NDIS routines map to normal WDM, or kernel routines. Where they don’t they are often screwed up, like what they did with NDIS spinlocks and such on 98. You have to use NDIS routines ‘just because’ really. In fact it would be better if you didn’t use NDIS routines sometimes, like for work items, as the accepted kernel routines are safer/better. But, you are required to use the NDIS routines by the miniport model.

Essentially what they intended with the miniport models was to limit what you could do, so as to limit complexity, and limit possible failure paths. In reality what has happened, is NDIS is IMHO no less error prone, certainly no less complex thanks to certain unknowns like context requirements not always being documented, and the fact that the ‘specification’ can change radically between revs. NDIS has severely tied the hands of developers in some areas as well. Some of this has gotten better as hardware manufacturers have complained, and really the main limitations now are lack of true cross-platform compatibility and artificial limitations imposed by WHQL. Of course these WHQL limitations are undocumented by and large. So, just because you get something working perfectly, doesn’t mean you will pass WHQL. I am a HUGE advocate of never going down the miniport path again, but I am perhaps in the minority. I would much prefer a way to plug into the network stack writing a WDM driver, but alas, I don’t believe this will happen. I am also a huge advocate of documenting requirements if they are to be requirements.

BTW, there is an NDIS_WDM switch that causes ndis.h to include wdm.h such that you can make kernel calls directly in miniports that talk to hardware which requires IRPs, such as USB hardware. However, WHQL limits the types of drivers which can use this switch, so you can’t just revert to kernel calls where you want.


Bill McKenzie

“Lee Rhodes” wrote in message news:xxxxx@ntdev…
Hi all again,
I’m not usually one to flog a dead horse but I’d still be interested in knowing what the difference is between KeSynchronizeExecution and NdisMSynchronizeWithInterrupt. Looking at a disassembled NdisMSynchronizeWithInterrupt, all I can see it doing it calling KeSynchronizeExecution so I’m wondering why I have to use the NDIS routine instead of the Ke routine?

Just idle curiosity at this stage.

Thanks

For compatibility with smaller (and now obsolete) Windows.
----- Original Message -----
From: Lee Rhodes
To: NT Developers Interest List
Sent: Tuesday, May 21, 2002 11:59 AM
Subject: [ntdev] Re: KeSyncrhonizeExecution vs NdisMSynchronizeWithInterrupt

Hi all again,
I’m not usually one to flog a dead horse but I’d still be interested in knowing what the difference is between KeSynchronizeExecution and NdisMSynchronizeWithInterrupt. Looking at a disassembled NdisMSynchronizeWithInterrupt, all I can see it doing it calling KeSynchronizeExecution so I’m wondering why I have to use the NDIS routine instead of the Ke routine?

Just idle curiosity at this stage.

Thanks

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%

KeSynchronizeExecution is available on 98/Me.


Bill McKenzie

“Maxim S. Shatskih” wrote in message news:xxxxx@ntdev…
For compatibility with smaller (and now obsolete) Windows.
----- Original Message -----
From: Lee Rhodes
To: NT Developers Interest List
Sent: Tuesday, May 21, 2002 11:59 AM
Subject: [ntdev] Re: KeSyncrhonizeExecution vs NdisMSynchronizeWithInterrupt

Hi all again,
I’m not usually one to flog a dead horse but I’d still be interested in knowing what the difference is between KeSynchronizeExecution and NdisMSynchronizeWithInterrupt. Looking at a disassembled NdisMSynchronizeWithInterrupt, all I can see it doing it calling KeSynchronizeExecution so I’m wondering why I have to use the NDIS routine instead of the Ke routine?

Just idle curiosity at this stage.

Thanks

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%

But binary-compatible miniports cannot call Kexxx functions, only Ndisxxx.
“Bill McKenzie” wrote in message news:LYRIS-542-53782-2002.05.23-14.13.52–maxim#xxxxx@lists.osr.com…
KeSynchronizeExecution is available on 98/Me.


Bill McKenzie

“Maxim S. Shatskih” wrote in message news:xxxxx@ntdev…
For compatibility with smaller (and now obsolete) Windows.
----- Original Message -----
From: Lee Rhodes
To: NT Developers Interest List
Sent: Tuesday, May 21, 2002 11:59 AM
Subject: [ntdev] Re: KeSyncrhonizeExecution vs NdisMSynchronizeWithInterrupt

Hi all again,
I’m not usually one to flog a dead horse but I’d still be interested in knowing what the difference is between KeSynchronizeExecution and NdisMSynchronizeWithInterrupt. Looking at a disassembled NdisMSynchronizeWithInterrupt, all I can see it doing it calling KeSynchronizeExecution so I’m wondering why I have to use the NDIS routine instead of the Ke routine?

Just idle curiosity at this stage.

Thanks

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%

Miniports can’t call KeXxx functions anyway. And this is not true with the NDIS_WDM flag, unless there is a new WHQL rule I am not aware of.


Bill McKenzie

“Maxim S. Shatskih” wrote in message news:xxxxx@ntdev…
But binary-compatible miniports cannot call Kexxx functions, only Ndisxxx.
“Bill McKenzie” wrote in message news:LYRIS-542-53782-2002.05.23-14.13.52–maxim#xxxxx@lists.osr.com…
KeSynchronizeExecution is available on 98/Me.


Bill McKenzie

“Maxim S. Shatskih” wrote in message news:xxxxx@ntdev…
For compatibility with smaller (and now obsolete) Windows.
----- Original Message -----
From: Lee Rhodes
To: NT Developers Interest List
Sent: Tuesday, May 21, 2002 11:59 AM
Subject: [ntdev] Re: KeSyncrhonizeExecution vs NdisMSynchronizeWithInterrupt

Hi all again,
I’m not usually one to flog a dead horse but I’d still be interested in knowing what the difference is between KeSynchronizeExecution and NdisMSynchronizeWithInterrupt. Looking at a disassembled NdisMSynchronizeWithInterrupt, all I can see it doing it calling KeSynchronizeExecution so I’m wondering why I have to use the NDIS routine instead of the Ke routine?

Just idle curiosity at this stage.

Thanks

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%