RE: PsCreateSystemThread in WDM Lower edge Ndis Drive- r

Thanx Mark! After using this approach to terminate threads the pagefault
doesn’t occur.

Regards
Anandhi

-----Original Message-----
From: Mark Roddy [mailto:xxxxx@hollistech.com]
Sent: Friday, December 28, 2001 9:27 PM
To: NT Developers Interest List
Subject: [ntdev] RE: PsCreateSystemThread in WDM Lower edge
Ndis Driver

Use ObReferenceObjectByHandle to obtain a referenced pointer to the
thread object. Use KeWaitForSingleObject to wait for the thread object
to be signaled. This is the only safe way to terminate
threads prior to
unload.

You must of course guarantee that your thread will not terminate prior
to the call to ObReferenceObjectByHandle. You must also use
ObDereferenceObject after the call to KeWaitForSingleObject
or else the
thread object will be lost forever.

=====================
Mark Roddy
WIndows XP/2000/NT Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
xxxxx@hollistech.com
For Windows Device Driver Training: see www.azius.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Anandhi
Dhanabalan

  • CTD, Chennai.
    Sent: Friday, December 28, 2001 10:23 AM
    To: NT Developers Interest List
    Subject: [ntdev] PsCreateSystemThread in WDM Lower edge Ndis Driver

Hi Devs,

I am working on a Ndis Miniport Driver with WDM LowerEdge for Virtual
NIC .

Now Staright to the problem…
I spawn a thread using PsCreateSystemThread in my driver.
When my Driver Unloads a pagefault occurs. From the Debug msgs i could
see
that control goes out of my Unload Routine.
I viewed the stack in softice which lists ExReleaseResourceForThread.

So my conclusion is that the Pagefault is b’coz the thread doesn’t
terminate
before my driver unloads. But i how do i ensure that the thread is
terminated ?

I tried using Event that will get set before i call
PsTerminateSystemThread
it didn’t help.
I also had a look at the NdisUsb code of Elliyas Yakub and tried using
KeSetPriorityThread but it didn’t help (Infact this changes
the priority
from 8 to 16, i wonder if this will help in anyway)

Can any one give any suggetions ?

Thanx in advance
Anandhi


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


You are currently subscribed to ntdev as: xxxxx@ctd.hcltech.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