Leaked source code of windows server 2003
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.

113 lines
3.1 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. fsctrl.c
  5. Abstract:
  6. This module contains the code to implement the NtFsControlFile system
  7. service for the NT I/O system.
  8. Author:
  9. Darryl E. Havens (darrylh) 16-Oct-1989
  10. Environment:
  11. Kernel mode only
  12. Revision History:
  13. --*/
  14. #include "iomgr.h"
  15. #ifdef ALLOC_PRAGMA
  16. #pragma alloc_text(PAGE, NtFsControlFile)
  17. #endif
  18. NTSTATUS
  19. NtFsControlFile(
  20. IN HANDLE FileHandle,
  21. IN HANDLE Event OPTIONAL,
  22. IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
  23. IN PVOID ApcContext OPTIONAL,
  24. OUT PIO_STATUS_BLOCK IoStatusBlock,
  25. IN ULONG IoControlCode,
  26. IN PVOID InputBuffer OPTIONAL,
  27. IN ULONG InputBufferLength,
  28. OUT PVOID OutputBuffer OPTIONAL,
  29. IN ULONG OutputBufferLength
  30. )
  31. /*++
  32. Routine Description:
  33. This service builds descriptors or MDLs for the supplied buffer(s) and
  34. passes the untyped data to the file system associated with the file
  35. handle. It is up to the file system to check the input data and function
  36. IoControlCode for validity, as well as to make the appropriate access
  37. checks.
  38. Arguments:
  39. FileHandle - Supplies a handle to the file on which the service is being
  40. performed.
  41. Event - Supplies an optional event to be set to the Signaled state when
  42. the service is complete.
  43. ApcRoutine - Supplies an optional APC routine to be executed when the
  44. service is complete.
  45. ApcContext - Supplies a context parameter to be passed to the ApcRoutine,
  46. if an ApcRoutine was specified.
  47. IoStatusBlock - Address of the caller's I/O status block.
  48. IoControlCode - Subfunction code to determine exactly what operation is
  49. being performed.
  50. InputBuffer - Optionally supplies an input buffer to be passed to the
  51. file system. Whether or not the buffer is actually optional is
  52. dependent on the IoControlCode.
  53. InputBufferLength - Length of the InputBuffer in bytes.
  54. OutputBuffer - Optionally supplies an output buffer to receive information
  55. from the file system. Whether or not the buffer is actually optional
  56. is dependent on the IoControlCode.
  57. OutputBufferLength - Length of the OutputBuffer in bytes.
  58. Return Value:
  59. The status returned is success if the control operation was properly
  60. queued to the I/O system. Once the operation completes, the status
  61. can be determined by examining the Status field of the I/O status block.
  62. --*/
  63. {
  64. //
  65. // Simply invoke the common routine that implements both device and file
  66. // system I/O controls.
  67. //
  68. return IopXxxControlFile( FileHandle,
  69. Event,
  70. ApcRoutine,
  71. ApcContext,
  72. IoStatusBlock,
  73. IoControlCode,
  74. InputBuffer,
  75. InputBufferLength,
  76. OutputBuffer,
  77. OutputBufferLength,
  78. FALSE );
  79. }