Re: Problem with linked list

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Peter Schmitz (PeterSchmitz_at_discussions.microsoft.com)
Date: 08/13/04


Date: Fri, 13 Aug 2004 10:37:04 -0700

Thanks for both answers!

It's true that I forgot to include the LIST_ENTRY size (now I know what few
sleep and lots of coffee can cause....), but anyway, adding this
unfortunately doesn't solve the problem.
The buffer is filled the following way:
//this is an excerpt of the function that fills MYSTRUCT a with data

NdisAllocateMemoryWithTag(&a->buffer,numbertoread,'HASA');
UTILReadOnPacket(packet,a->buffer,numbertoread,0,&BytesRead);

The second function is one of pcausa (thanks, by the way) and can be found at
http://www.ndis.com/papers/ndispacket/ndispacket1.htm

numbertoread contains the complete size of the ethernet packet (14bytes for
the ethernet frame and the ip header length field).

Any ideas?

Peter

"Peter Wieland [MSFT]" wrote:

> probably because you have a bug that's causing pool corruption.
>
> what's in the [...] section of MYSTRUCT (which you don't appear to have
> accounted for in your calculation of the size?).
> have you considered adding enough memory to your allocation of MYLIST to
> include the LIST_ENTRY?
>
> perhaps (sizeof(MYLIST) + a.bufferlen) would be a more sensible way to
> determine the size of the buffer than adding up the individual structure
> elements.
>
> -p
>
>
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Peter Schmitz" <mosquitooth@gmx.net> wrote in message
> news:O9a21iUgEHA.3192@tk2msftngp13.phx.gbl...
> > Hi again,
> >
> > I implemented the following double linked list stuff:
> >
> > typedef struct __MYSTRUCT {
> > UINT t;
> > [...]
> > UINT bufferlen; //length of buffer
> > BYTE *buffer;
> > }MYSTRUCT;
> >
> > typedef struct __MYLIST{
> > MYSTRUCT mystr;
> > LIST_ENTRY linkfield;
> > }MYLIST, *PMYLIST;
> >
> > LIST_ENTRY DoubleHead;
> > -------------------------------------------------------
> > [...]
> > MYSTRUCT a; //filled with data
> >
> > /*The size of all the entries is dynamic, that's why the size of the
> > structure is allocated again every time*/
> > UINT structsize = sizeof(UINT) + sizeof(UINT) + sizeof(a.buffer) +
> > a.bufferlen;
> >
> > PMYLIST psElement = (PMYLIST)
> > ExAllocatePoolWithTag(PagedPool,structsize,'HASA'); //here we CRASH!!!
> >
> > if(psElement == NULL)
> > {
> > DBGPRINT(("Allocatepool failed!"));
> > }
> > else
> > {
> > psElement->mystr = a;
> >
> > NdisAcquireSpinLock(&GlobalLock);
> > if(numberofentries <= MAX_LIST_ENTRIES) //limit for #elements
> > {
> > InsertTailList(&DoubleHead,&psElement->linkfield);
> > numberofentries = numberofentries + 1;
> > }
> > NdisReleaseSpinLock(&GlobalLock);
> > }
> >
> > When I execute the code above, the computer crashes:
> > DRIVER_CORRUPTED_EXPOOL, with an error in the marked line above.
> >
> > Any ideas why?
> >
> > Thanks
> > Peter
>
>
>



Relevant Pages

  • Re: Patriot Game (Was: Re: Burn, baby, burn)
    ... > dislikes the Lite-On burner I have now in the 3510 EE. ... It sets the "buffer underrun" function properly as well. ... > common world of computers it is a boring slow antiquity, ... > Very friendly greetings from Peter in Germany ...
    (comp.sys.ibm.ps2.hardware)
  • Re: NIC card problems
    ... >Real DEC Tulip cards do this when running Tru64 as well. ... >it's a bug in the NIC. ... Peter, Warner, Stefan, et al.: ... "No buffer space available" error occurs. ...
    (freebsd-stable)
  • Re: MSComm32.ocx vs. Sax ActiveXComm
    ... > Hallo Peter, ... > Das Programm stürzt schon weiter oben bei MSComm1.Input ab ... Buffer$ = Buffer$ & MSComm1.Input ...
    (microsoft.public.de.vb)
  • Re: RfD: XCHAR wordset
    ... Peter Fälth wrote: ... XCS would be enough. ... and error handling for wrong buffer ends could be done with other means ... Bernd Paysan ...
    (comp.lang.forth)