From: Don Burn on

"Ben Voigt [C++ MVP]" <rbv(a)nospam.nospam> wrote in message
news:OcYDDLSsIHA.4848(a)TK2MSFTNGP05.phx.gbl...
> It should be possible to have zero-copy by mapping the buffer into
> usermode directly though. Probably need to create a kernel mapping object
> and have the usermode call VirtualAlloc(MEM_RESERVE) and MapViewOfFile.
> Just make sure you don't trust the content of memory that can be written
> from userspace.

Such an approach opens a ton of problems, first you have a lot of security
issues with this method. Second you have to write a ton of code to take
care of the application leaving (or crashing, etc). Third, you have to
come up with a synchronization mechanism and unless the buffer is very large
(multple megabytes) this is likely to eat up all the performance gains you
might get.

Bottom line, this can be done and I have worked on one project where it was
justified. I have also, been involved with ripping this out of over half a
dozen projects, which in the end produced a speed increase, significant code
size reduction, and reduced the bug count significantly.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply