Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. deviosup.c
  5. Abstract:
  6. This module implements the memory locking routines for MSFS.
  7. Author:
  8. Manny Weiser (mannyw) 05-Apr-1991
  9. Revision History:
  10. --*/
  11. #include "mailslot.h"
  12. //
  13. // Local debug trace level
  14. //
  15. #define Dbg (DEBUG_TRACE_DEVIOSUP)
  16. #ifdef ALLOC_PRAGMA
  17. #pragma alloc_text( PAGE, MsMapUserBuffer )
  18. #endif
  19. VOID
  20. MsMapUserBuffer (
  21. IN OUT PIRP Irp,
  22. IN KPROCESSOR_MODE AccessMode,
  23. OUT PVOID *UserBuffer
  24. )
  25. /*++
  26. Routine Description:
  27. This routine obtains a usable virtual address for the user buffer
  28. for the current I/O request in the specified mode.
  29. Arguments:
  30. Irp - Pointer to the Irp for the request.
  31. AccessMode - UserMode or KernelMode.
  32. UserBuffer - Returns pointer to mapped user buffer.
  33. Return Value:
  34. None.
  35. --*/
  36. {
  37. AccessMode;
  38. PAGED_CODE();
  39. //
  40. // If there is no Mdl, then we must be in the Fsd, and we can simply
  41. // return the UserBuffer field from the Irp.
  42. //
  43. if (Irp->MdlAddress == NULL) {
  44. *UserBuffer = Irp->UserBuffer;
  45. return;
  46. }
  47. //
  48. // Get a system virtual address for the buffer.
  49. //
  50. *UserBuffer = MmGetSystemAddressForMdl( Irp->MdlAddress );
  51. return;
  52. } // MsMapUserBuffer