Unplug the usb power cause a system crash in winxp+sp2
- From: WilliamX <fantast_xue@xxxxxxxxxxxxxxxxxxx>
- Date: Mon, 08 Aug 2005 10:58:11 +0800
I made a bda driver for our usb box. It seems working well until I
unplug the power wire when it running in winxp+sp2.(it saids that it
did not crash in win2k or winxp+sp1, so strange.)
In the read data routine, I insert the irp to a list and in the
complete routine I remove it from the list. Like this:
(I simply use the global variables.)
Insert:
--8<---------------cut here---------------start------------->8---
KeAcquireSpinLock(&g_ks_pl, &g_old_pk_irql);
InsertTailList(&g_irp_list, &p_irp->Tail.Overlay.ListEntry);
KeReleaseSpinLock(&g_ks_pl, g_old_pk_irql);
status = IoCallDriver(p_devobj, p_irp);
--8<---------------cut here---------------end--------------->8---
Removal:
--8<---------------cut here---------------start------------->8---
KeAcquireSpinLock(&g_ks_pl, &old_irql);
if (IsListEmpty(&g_irp_list))
{
KeReleaseSpinLock(&g_ks_pl, old_irql);
return FALSE;
}
RemoveHeadList(&g_irp_list);
KeReleaseSpinLock(&g_ks_pl, old_irql);
--8<---------------cut here---------------end--------------->8---
After I unplug the power of the usb, winxp+sp2 would crash in
usbport.sys. I commented out these codes, then unplug the power, no
crash.
I did not test the status of the irp, because I thought it was
useless. I simply insert the irp to the queue and remove it after it
completed.
Could some one tell me what's wrong with my code?
Advance thanks!
.
- Follow-Ups:
- Re: Unplug the usb power cause a system crash in winxp+sp2
- From: cristalink
- Re: Unplug the usb power cause a system crash in winxp+sp2
- Prev by Date: Re: Whats wrong with my Old driver?
- Next by Date: Re: Unplug the usb power cause a system crash in winxp+sp2
- Previous by thread: Printer language monitor gets an error durring driver installation
- Next by thread: Re: Unplug the usb power cause a system crash in winxp+sp2
- Index(es):
Relevant Pages
|