Macro for copying data from the user mode to the Kernel PlugIn.
Remarks
The COPY_TO_USER_OR_KERNEL() and COPY_FROM_USER_OR_KERNEL() are macros used for copying data (when necessary) to/from user-mode memory addresses (respectively), when accessing such addresses from within the Kernel PlugIn. Copying the data ensures that the user-mode address can be used correctly, even if the context of the user-mode process changes in the midst of the I/O operation. This is particularly relevant for long operations, during which the context of the user-mode process may change. The use of macros to perform the copy provides a generic solution for all supported operating systems. Note that if you wish to access the user-mode data from within the Kernel PlugIn interrupt handler functions, you should first copy the data into some variable in the Kernel PlugIn before the execution of the kernel-mode interrupt handler routines. To safely share a data buffer between the user-mode and Kernel PlugIn routines (e.g., KP_IntAtIrql() and KP_IntAtDpc()), consider using the technique outlined in the technical document titled "How do I
share a memory buffer between Kernel PlugIn and user-mode projects for DMA
or other purposes?" found under the "Kernel PlugIn" technical documents section of the "Support" section.