9.3. Buffer sharing between multiple processes
This section describes how to share a contiguous DMA buffer or a kernel buffer
between multiple processes.
The buffer sharing mechanism can be used to improve the work of multiple
processes by allowing the developer avoiding unnecessary buffer copying.
Coupled with the WinDriver IPC mechanism it might also be used as a way for two
processes to convey large messages/data.
Currently WinDriver supports sharing DMA contiguous buffer (See
WDC_DMAContigBufLock() [B.3.40]) and Kernel buffer (See
In order to share a buffer the developer must first pass its global handle to
the other process(es). See Macros
WDC_DMAGetGlobalHandle() [B.3.45] for getting a buffer's global
Than, the handle should be passed to the other process(es). E.g. by WinDriver IPC
After a process gets the global buffer handle, it should use
WDC_DMABufGet() [B.3.44] or
WDS_SharedBufferGet() [B.6.3] to retrieve
the buffer. WinDriver will re-map the buffer to the new process virtual memory (I.e.
user-space) and will fill all the necessary information as though the buffer was
allocated from the calling process.
Once the process no longer needs the shared buffer it should use the regular
unlock/free calls -
WDS_SharedBufferFree() [B.6.2] appropriately.
WinDriver manages all system resources, hence the call to
WDS_SharedBufferFree() [B.6.2] will not
remove system resources until all processes no longer use the buffer.