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.

248 lines
7.9 KiB

  1. /*++
  2. Copyright (c) 1989-1999 Microsoft Corporation
  3. Module Name:
  4. ntfsprop.h
  5. Abstract:
  6. This module contains the structure definitions for nt property Fsctl calls.
  7. Author:
  8. Mark Zbikowski (MarkZ) 23-April-1996
  9. --*/
  10. #ifndef _NTFSPROP_
  11. #define _NTFSPROP_
  12. #if _MSC_VER > 1000
  13. #pragma once
  14. #endif
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. //
  19. // WARNING! This file requires OBJIDL.H.
  20. //
  21. //
  22. // VARIABLE_STRUCTURE_SIZE returns the size of a structure S that contains
  23. // an array of C structures V
  24. //
  25. #define VARIABLE_STRUCTURE_SIZE(S,V,C) ((int)sizeof( S ) + ((C) - 1) * (int)sizeof( V ))
  26. //
  27. // COUNTED_STRING is length-preceded unicode string. This does NOT include
  28. // a trailing L'\0'
  29. //
  30. typedef struct _COUNTED_STRING
  31. {
  32. USHORT Length;
  33. WCHAR Text[1];
  34. } COUNTED_STRING, *PCOUNTED_STRING;
  35. #define COUNTED_STRING_SIZE(l) \
  36. (sizeof( COUNTED_STRING ) - sizeof ( WCHAR ) + (l))
  37. #define COUNTED_STRING_LENGTH(c) \
  38. ((c)->Length)
  39. #define COUNTED_STRING_TEXT(c) \
  40. (&(c)->Text[0])
  41. //
  42. // PROPERTY_SPECIFIER is a serialized form of a PROPSPEC. Instead of
  43. // a LPWSTR, there is an offset from the beginning of the
  44. // PROPERTY_SPECIFICATIONS to a COUNTED_STRING
  45. //
  46. // #define PRSPEC_LPWSTR ( 0 )
  47. // #define PRSPEC_PROPID ( 1 )
  48. typedef struct _PROPERTY_SPECIFIER
  49. {
  50. ULONG Variant; // Distinguish the type
  51. union { // Switch on Variant
  52. PROPID Id; // Property ID
  53. ULONG NameOffset; // Offset to COUNTED_STRING
  54. };
  55. } PROPERTY_SPECIFIER, *PPROPERTY_SPECIFIER;
  56. //
  57. // PROPERTY_SPECIFICATIONS is a serialized form of an array PROPERTY_SPECIFIERs.
  58. // Immediately following PROPERTY_SPECIFICATIONS on a USHORT boundary are
  59. // of the name strings. Each name string is a COUNTED_STRING
  60. //
  61. typedef struct _PROPERTY_SPECIFICATIONS {
  62. ULONG Length; // Length in bytes of structure and name strings
  63. ULONG Count; // Count of PROPERTY_SPECIFIERS
  64. PROPERTY_SPECIFIER Specifiers[1]; // Array of actual specifiers, length Count
  65. } PROPERTY_SPECIFICATIONS, *PPROPERTY_SPECIFICATIONS;
  66. #define PROPERTY_SPECIFICATIONS_SIZE(c) \
  67. (VARIABLE_STRUCTURE_SIZE( PROPERTY_SPECIFICATIONS, PROPERTY_SPECIFIER, (c) ))
  68. #define PROPERTY_SPECIFIER_ID(PS,I) \
  69. ((PS)->Specifiers[(I)].Id)
  70. #define PROPERTY_SPECIFIER_COUNTED_STRING(PS,I) \
  71. ((PCOUNTED_STRING)Add2Ptr( (PS), (PS)->Specifiers[(I)].NameOffset))
  72. #define PROPERTY_SPECIFIER_NAME(PS,I) \
  73. (&PROPERTY_SPECIFIER_COUNTED_STRING( PS, I )->Text[0])
  74. #define PROPERTY_SPECIFIER_NAME_LENGTH(PS,I) \
  75. (PROPERTY_SPECIFIER_COUNTED_STRING( PS, I )->Length)
  76. //
  77. // PROPERTY_VALUES is a serialized form of an array of SERIALIZEDPROPERTYVALUES.
  78. // Immediately following the structure are the values, each of which is on a DWORD
  79. // boundary. The last PropertyValue (count+1) is used only to help determine the
  80. // size of the last property value. The offsets to the values are relative
  81. // to the address of the PROPERTY_VALUES structure itself.
  82. //
  83. typedef struct _PROPERTY_VALUES {
  84. ULONG Length; // Length in bytes of structure and values
  85. ULONG Count; // Count of SERIALIZEDPROPERTYVALUES
  86. ULONG PropertyValueOffset[1]; // Array of offsets to actual values, length count + 1
  87. } PROPERTY_VALUES, *PPROPERTY_VALUES;
  88. #define PROPERTY_VALUES_SIZE(c) \
  89. (VARIABLE_STRUCTURE_SIZE( PROPERTY_VALUES, ULONG, (c) + 1 ))
  90. #define PROPERTY_VALUE_LENGTH(v,i) \
  91. ((v)->PropertyValueOffset[(i) + 1] - (v)->PropertyValueOffset[(i)])
  92. #define PROPERTY_VALUE(v,i) \
  93. ((SERIALIZEDPROPERTYVALUE *) Add2Ptr( (v), (v)->PropertyValueOffset[(i)]))
  94. //
  95. // PROPERTY_IDS is a serialized form of an array of PROPIDs
  96. //
  97. typedef struct _PROPERTY_IDS {
  98. ULONG Count; // Count of the number of propids
  99. PROPID PropertyIds[1]; // Array of propids, length Count
  100. } PROPERTY_IDS, *PPROPERTY_IDS;
  101. #define PROPERTY_IDS_SIZE(c) \
  102. (VARIABLE_STRUCTURE_SIZE( PROPERTY_IDS, PROPID, (c) ))
  103. #define PROPERTY_ID(p,i) \
  104. ((p)->PropertyIds[i])
  105. //
  106. // PROPERTY_NAMES is a serialized array of strings's. Following the structure
  107. // are the individual strings, each of which is on a WCHAR boundary. The
  108. // offsets to the property names are relative to the beginning of the
  109. // PROPERTY_NAMES structure. There are count+1 offsets allowing the length
  110. // of each to be calculated.
  111. //
  112. typedef struct _PROPERTY_NAMES {
  113. ULONG Length; // Length in bytes of structure and values
  114. ULONG Count; // Count of strings
  115. ULONG PropertyNameOffset[1]; // Array of offsets to property names.
  116. } PROPERTY_NAMES, *PPROPERTY_NAMES;
  117. #define PROPERTY_NAMES_SIZE(c) \
  118. (VARIABLE_STRUCTURE_SIZE( PROPERTY_NAMES, ULONG, (c) + 1 ))
  119. #define PROPERTY_NAME_LENGTH(v,i) \
  120. ((v)->PropertyNameOffset[(i) + 1] - (v)->PropertyNameOffset[(i)])
  121. #define PROPERTY_NAME(v,i) \
  122. ((PWCHAR) Add2Ptr( (v), (v)->PropertyNameOffset[(i)]))
  123. //
  124. // All property output buffers are preceded by PROPERTY_OUTPUT_HEADER
  125. // which contains the amount of data returned. If STATUS_BUFFER_OVERFLOW
  126. // is returned, the Length field contains the length required to satisfy
  127. // the request.
  128. //
  129. typedef struct _PROPERTY_OUTPUT_HEADER {
  130. ULONG Length; // Total length in bytes of output buffer
  131. } PROPERTY_OUTPUT_HEADER, *PPROPERTY_OUTPUT_HEADER;
  132. //
  133. // PROPERTY_READ_CONTROL is the structure used to control all property read
  134. // operations. Following the structure on a DWORD boundary is either
  135. // an instaence of PROPERTY_IDS or PROPERTY_SPECIFICATIONS, depending on
  136. // the operation code.
  137. //
  138. // On successful output, the data buffer will contain, on DWORD boundaries,
  139. // in order PROPERTY_VALUES, PROPERTY_IDS, and PROPERTY_NAMES. Each structure
  140. // may be absent depending on the setting of the operation code:
  141. //
  142. // PRC_READ_PROP: PROPERTY_SPECIFICATIONS => PROPERTY_OUTPUT_HEADER
  143. // PROPERTY_VALUES
  144. //
  145. // PRC_READ_NAME: PROPERTY_IDS => PROPERTY_OUTPUT_HEADER
  146. // PROPERTY_NAMES
  147. //
  148. // / PROPERTY_OUTPUT_HEADER
  149. // PRC_READ_ALL: <empty> => PROPERTY_IDS
  150. // \ PROPERTY_NAMES
  151. // PROPERTY_VALUES
  152. //
  153. typedef enum _READ_CONTROL_OPERATION {
  154. PRC_READ_PROP = 0,
  155. PRC_READ_NAME = 1,
  156. PRC_READ_ALL = 2,
  157. } READ_CONTROL_OPERATION;
  158. typedef struct _PROPERTY_READ_CONTROL {
  159. READ_CONTROL_OPERATION Op;
  160. } PROPERTY_READ_CONTROL, *PPROPERTY_READ_CONTROL;
  161. //
  162. // PROPERTY_WRITE_CONTROL is the structure used to control all property write
  163. // operations. Following the structure on a DWORD boundary is either an instance
  164. // of PROPERTY_IDS or PROPERTY_SPECIFICATIONS (used to control which properties are
  165. // being changed) and followed by PROPERTY_VALUES and PROPERTY_NAMES. The
  166. // presence of these are dependent on the operation code.
  167. //
  168. // On successful outputs, the data buffer will contain, on DWORD boundaries,
  169. // in order PROPERTY_IDS. Each structure may be absent
  170. // depending on the setting of the operation code:
  171. //
  172. // PWC_WRITE_PROP: PROPERTY_SPECIFICATIONS \__/ PROPERTY_OUTPUT_HEADER
  173. // PROPERTY_VALUES / \ PROPERTY_IDS
  174. //
  175. // PWC_DELETE_PROP: PROPERTY_SPECIFICATIONS => <empty>
  176. //
  177. // PWC_WRITE_NAME: PROPERTY_IDS \__ <empty>
  178. // PROPERTY_NAMES /
  179. //
  180. // PWC_DELETE_NAME: PROPERTY_IDS => <empty>
  181. //
  182. // PROPERTY_IDS \
  183. // PWC_WRITE_ALL: PROPERTY_NAMES => <empty>
  184. // PROPERTY_VALUES /
  185. typedef enum _WRITE_CONTROL_OPERATION {
  186. PWC_WRITE_PROP = 0,
  187. PWC_DELETE_PROP = 1,
  188. PWC_WRITE_NAME = 2,
  189. PWC_DELETE_NAME = 3,
  190. PWC_WRITE_ALL = 4,
  191. } WRITE_CONTROL_OPERATION;
  192. typedef struct _PROPERTY_WRITE_CONTROL {
  193. WRITE_CONTROL_OPERATION Op;
  194. PROPID NextPropertyId;
  195. } PROPERTY_WRITE_CONTROL, *PPROPERTY_WRITE_CONTROL;
  196. #ifdef __cplusplus
  197. }
  198. #endif
  199. #endif // _NTFSPROP_