VirtuaAllocCopyEx crashing after the first time

I am working on a graphics driver on WINCE 6.0. I am having the following

I boot up my target and run the driver and a demo. The demo runs fine. I
close the demo and it exits "fine." When I try to run the demo again (any
demo so it's not particular to this one graphics demo) the driver crashes at
a particular place where
it's mapping a buffer using VirtuaAllocCopyEx .

I have traced this behaviour and during the first run (when everything runs
and exits "normally" or so it seems) the buffer is mapped fine, and then when
the demo exits the same buffer is unmapped with VirtualFree.

When I run the demo the second time and it's time to map the buffer again
with VirtuaAllocCopyEx, the driver crashes inside physmem.c in DupPhysPage().

Any ideas what might make VirtuaAllocCopyEx crash like that?

If I need to provide more information please let me know.

Relevant Pages

  • [PATCH 1/1] hv: Added new hv_utils driver with shutdown as first functionality - NO OUTLOOK
    ... Addition of new driver for Hyper-V called hv_utils. ... * VmbusChannelSendPacket- Send the specified buffer on the given channel ... struct vmbus_channel *channel; ...
  • Re: Real World Significant Sources of (what we usually call) Latency
    ... CPU is twice as fast, you can reduce your buffer size to half." ... the buffer adjustment for the driver or DAW program would go down to zero. ... nothing that can distract it from processing audio. ...
  • Re: Difference between synchronous and asynchronous operation/calls (NDISPROT)
    ... The main problem with synchronous operation/calls seems to be the lack of buffers for the driver to store data into. ... Each "read call" supplies the driver with a buffer and optionally a completion routine so that the driver can inform the application when the requested operation is/was done. ... However it seems the current windows/driver design does some copies as well? ...
  • Re: Degradation of TCP connection
    ... Gigabit ethernet. ... D card's data buffer can only hold about 64K samples worth of data ... link you posted is for an older version of VxWorks that used a BSD- ... but a bug in the ethernet driver. ...
  • Re: PCI bus-master and large contiguous memory buffers
    ... As soon as device reaches the end of the buffer ... Sure, I am developing both PCI adapter and device driver, so, it is ... not afford reinitializing DMA on my device after every transfer. ... x86 CPU memory management structures I never tried to dig into Windows ...