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.

182 lines
4.1 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. event.h
  5. Abstract:
  6. contains prototypes for functions in event.c
  7. Author:
  8. Paul McDaniel (paulmcd) 01-March-2000
  9. Revision History:
  10. --*/
  11. #ifndef _FILENAMES_H_
  12. #define _FILENAMES_H_
  13. #if DBG
  14. VOID
  15. VALIDATE_FILENAME(
  16. IN PUNICODE_STRING pName
  17. );
  18. #else
  19. #define VALIDATE_FILENAME(_fileName) ((VOID)0)
  20. #endif
  21. NTSTATUS
  22. SrpGetFileName(
  23. IN PSR_DEVICE_EXTENSION pExtension,
  24. IN PFILE_OBJECT pFileObject,
  25. IN OUT PSRP_NAME_CONTROL pNameCtrl
  26. );
  27. NTSTATUS
  28. SrpGetFileNameFromFileObject (
  29. IN PSR_DEVICE_EXTENSION pExtension,
  30. IN PFILE_OBJECT pFileObject,
  31. IN OUT PSRP_NAME_CONTROL pNameCtrl,
  32. OUT PBOOLEAN pReasonableErrorForUnOpenedName
  33. );
  34. NTSTATUS
  35. SrpGetFileNameOpenById (
  36. IN PSR_DEVICE_EXTENSION pExtension,
  37. IN PFILE_OBJECT pFileObject,
  38. IN OUT PSRP_NAME_CONTROL pNameCtrl,
  39. OUT PBOOLEAN pReasonableErrorForUnOpenedName
  40. );
  41. VOID
  42. SrpRemoveStreamName(
  43. IN OUT PSRP_NAME_CONTROL pNameCtrl
  44. );
  45. NTSTATUS
  46. SrpExpandDestPath (
  47. IN PSR_DEVICE_EXTENSION pExtension,
  48. IN HANDLE RootDirectory,
  49. IN ULONG FileNameLength,
  50. IN PWSTR pFileName,
  51. IN PSR_STREAM_CONTEXT pOriginalFileContext,
  52. IN PFILE_OBJECT pOriginalFileObject,
  53. OUT PUNICODE_STRING *ppNewName,
  54. OUT PUSHORT pNewNameStreamLength,
  55. OUT PBOOLEAN pReasonableErrorForUnOpenedName
  56. );
  57. VOID
  58. SrpInitNameControl(
  59. IN PSRP_NAME_CONTROL pNameCtrl
  60. );
  61. VOID
  62. SrpCleanupNameControl(
  63. IN PSRP_NAME_CONTROL pNameCtrl
  64. );
  65. NTSTATUS
  66. SrpReallocNameControl(
  67. IN PSRP_NAME_CONTROL pNameCtrl,
  68. ULONG newSize,
  69. PWCHAR *retOriginalBuffer OPTIONAL
  70. );
  71. NTSTATUS
  72. SrpExpandFileName (
  73. IN PSR_DEVICE_EXTENSION pExtension,
  74. IN PFILE_OBJECT pFileObject,
  75. IN SR_EVENT_TYPE EventFlags,
  76. IN OUT PSRP_NAME_CONTROL pNameCtrl,
  77. OUT PBOOLEAN pReasonableErrorForUnOpenedName
  78. );
  79. NTSTATUS
  80. SrIsFileEligible (
  81. IN PSR_DEVICE_EXTENSION pExtension,
  82. IN PFILE_OBJECT pFileObject,
  83. IN BOOLEAN IsDirectory,
  84. IN SR_EVENT_TYPE EventFlags,
  85. IN OUT PSRP_NAME_CONTROL pNameCtrl,
  86. OUT PBOOLEAN pIsInteresting,
  87. OUT PBOOLEAN pReasonableErrorForUnOpenedName
  88. );
  89. BOOLEAN
  90. SrFileNameContainsStream (
  91. IN PSR_DEVICE_EXTENSION pExtension,
  92. IN PFILE_OBJECT pFileObject,
  93. IN PSR_STREAM_CONTEXT pFileContext OPTIONAL
  94. );
  95. BOOLEAN
  96. SrFileAlreadyExists (
  97. IN PSR_DEVICE_EXTENSION pExtension,
  98. IN PFILE_OBJECT pFileObject,
  99. IN PSR_STREAM_CONTEXT pFileContext OPTIONAL
  100. );
  101. NTSTATUS
  102. SrIsFileStream (
  103. PSR_DEVICE_EXTENSION pExtension,
  104. PSRP_NAME_CONTROL pNameCtrl,
  105. PBOOLEAN pIsFileStream,
  106. PBOOLEAN pReasonableErrorForUnOpenedName
  107. );
  108. NTSTATUS
  109. SrCheckForNameTunneling (
  110. IN PSR_DEVICE_EXTENSION pExtension,
  111. IN OUT PSR_STREAM_CONTEXT *ppFileContext
  112. );
  113. //
  114. // If it is determined that we need to allocate a buffer anyway we might as
  115. // well make it big enough to hold most expanded short names. Allocate this
  116. // much extra to handle this.
  117. //
  118. #define SHORT_NAME_EXPANSION_SPACE 512
  119. //
  120. // This macro will check to see if we need to grow the name control buffer
  121. //
  122. #define SrpNameCtrlBufferCheck( nctrl, len ) \
  123. (((len) > ((nctrl)->BufferSize - sizeof(WCHAR))) ? \
  124. SrpReallocNameControl( (nctrl), \
  125. (len) + \
  126. SHORT_NAME_EXPANSION_SPACE + \
  127. sizeof(WCHAR), \
  128. NULL ) : \
  129. STATUS_SUCCESS)
  130. //
  131. // This macro will check to see if we need to grow the name control buffer.
  132. // This will also return the old allocated buffer if there was one.
  133. //
  134. #define SrpNameCtrlBufferCheckKeepOldBuffer( nctrl, len, retBuf ) \
  135. (((len) > ((nctrl)->BufferSize - sizeof(WCHAR))) ? \
  136. SrpReallocNameControl( (nctrl), \
  137. (len) + \
  138. SHORT_NAME_EXPANSION_SPACE + \
  139. sizeof(WCHAR), \
  140. (retBuf) ) : \
  141. (*(retBuf) = NULL, STATUS_SUCCESS)) /*make sure buffer is NULLED*/
  142. #endif // _FILENAMES_H_