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.

234 lines
5.4 KiB

  1. #ifndef __DSKQUOTA_PRIVATE_H
  2. #define __DSKQUOTA_PRIVATE_H
  3. ///////////////////////////////////////////////////////////////////////////////
  4. /* File: private.h
  5. Description: Private stuff used in the quota management library.
  6. Revision History:
  7. Date Description Programmer
  8. -------- --------------------------------------------------- ----------
  9. 05/22/96 Initial creation. BrianAu
  10. */
  11. ///////////////////////////////////////////////////////////////////////////////
  12. #define USEQUICKSORT // Tell comctl32 to use QuickSort for sorting DPA's.
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #ifndef NT_INCLUDED
  17. # include <nt.h>
  18. #endif
  19. #ifndef _NTRTL_
  20. # include <ntrtl.h>
  21. #endif
  22. #ifndef _NTURTL_
  23. # include <nturtl.h>
  24. #endif
  25. #ifndef _NTSEAPI_
  26. # include <ntseapi.h>
  27. #endif
  28. #ifdef __cplusplus
  29. } // end of extern "C"
  30. #endif
  31. #ifndef _WINDOWS_
  32. # include <windows.h>
  33. #endif
  34. #ifndef _INC_WINDOWSX
  35. # include <windowsx.h>
  36. #endif
  37. #ifndef _OLE2_H_
  38. # include <ole2.h>
  39. #endif
  40. #ifndef _OLECTL_H_
  41. # include <olectl.h> // Standard OLE interfaces.
  42. #endif
  43. #ifndef _INC_SHELLAPI
  44. # include <shellapi.h>
  45. #endif
  46. #ifndef _SHLGUID_H_
  47. # include <shlguid.h>
  48. #endif
  49. #ifndef _INC_SHLWAPI
  50. # include <shlwapi.h>
  51. #endif
  52. #ifndef _SHLOBJ_H_
  53. # include <shlobj.h>
  54. #endif
  55. //
  56. // Disable warnings.
  57. //
  58. #pragma warning( disable : 4100 ) // Unreferenced formal parameter
  59. #pragma warning( disable : 4710 ) // Inline was not expanded
  60. //
  61. // Disable "inline" for DEBUG builds so we can set breakpoints
  62. // on inlined methods.
  63. //
  64. #if DBG
  65. # define INLINE inline
  66. #else
  67. # define INLINE
  68. #endif
  69. //
  70. // Define PROFILE to activate IceCAP profiler.
  71. //
  72. #ifdef PROFILE
  73. # include "icapexp.h"
  74. # define ICAP_START StartCAP()
  75. # define ICAP_START_ALL StartCAPAll()
  76. # define ICAP_STOP StopCAP()
  77. # define ICAP_STOP_ALL StopCAPAll()
  78. # define ICAP_SUSPEND SuspendCAP()
  79. # define ICAP_SUSPEND_ALL SuspendCAPAll()
  80. # define ICAP_RESUME ResumeCAP()
  81. # define ICAP_RESUME_ALL SuspendCAPAll()
  82. #else
  83. # define ICAP_START 0
  84. # define ICAP_START_ALL 0
  85. # define ICAP_STOP 0
  86. # define ICAP_STOP_ALL 0
  87. # define ICAP_SUSPEND 0
  88. # define ICAP_SUSPEND_ALL 0
  89. # define ICAP_RESUME 0
  90. # define ICAP_RESUME_ALL 0
  91. #endif
  92. typedef unsigned __int64 UINT64;
  93. typedef __int64 INT64;
  94. #ifndef _INC_DSKQUOTA_DEBUG_H
  95. # include "debug.h"
  96. #endif
  97. #ifndef _INC_DSKQUOTA_DEBUGP_H
  98. # include "debugp.h"
  99. #endif
  100. #ifndef _INC_DSKQUOTA_EXCEPT_H
  101. # include "except.h"
  102. #endif
  103. #ifndef _INC_DSKQUOTA_THDSYNC_H
  104. # include "thdsync.h"
  105. #endif
  106. #ifndef _INC_DSKQUOTA_AUTOPTR_H
  107. # include "autoptr.h"
  108. #endif
  109. #ifndef _INC_DSKQUOTA_CARRAY_H
  110. # include "carray.h"
  111. #endif
  112. #ifndef _INC_DSKQUOTA_ALLOC_H
  113. # include "alloc.h"
  114. #endif
  115. #ifndef _INC_DSKQUOTA_STRCLASS_H
  116. # include "strclass.h"
  117. #endif
  118. #ifndef _INC_DSKQUOTA_PATHSTR_H
  119. # include "pathstr.h"
  120. #endif
  121. #ifndef _INC_DSKQUOTA_UTILS_H
  122. # include "utils.h"
  123. #endif
  124. #ifndef _INC_DSKQUOTA_DBLNUL_H
  125. # include "dblnul.h"
  126. #endif
  127. #ifndef _INC_DSKQUOTA_XBYTES_H
  128. # include "xbytes.h"
  129. #endif
  130. #ifndef _INC_DSKQUOTA_REGSTR_H
  131. # include "regstr.h"
  132. #endif
  133. extern HINSTANCE g_hInstDll; // Global module instance handle.
  134. extern LONG g_cRefThisDll; // Global module reference count.
  135. //
  136. // Unlimited quota threshold and limit are indicated by a value of -1.
  137. // A limit of -2 marks a record for deletion.
  138. // This is the way NTFS wants it.
  139. //
  140. const LONGLONG NOLIMIT = (LONGLONG)-1;
  141. const LONGLONG MARK4DEL = (LONGLONG)-2;
  142. //
  143. // Convenience macro for calculating number of elements in an array.
  144. //
  145. #ifdef ARRAYSIZE
  146. #undef ARRAYSIZE
  147. #endif
  148. #define ARRAYSIZE(a) (sizeof(a)/sizeof((a)[0]))
  149. //
  150. // Per-volume quota information.
  151. //
  152. typedef struct DiskQuotaFSObjectInformation {
  153. LONGLONG DefaultQuotaThreshold;
  154. LONGLONG DefaultQuotaLimit;
  155. ULONG FileSystemControlFlags;
  156. } DISKQUOTA_FSOBJECT_INFORMATION, *PDISKQUOTA_FSOBJECT_INFORMATION;
  157. //
  158. // SIDLIST is a synonym for FILE_GET_QUOTA_INFORMATION.
  159. //
  160. #define SIDLIST FILE_GET_QUOTA_INFORMATION
  161. #define PSIDLIST PFILE_GET_QUOTA_INFORMATION
  162. //
  163. // Private stuff for twiddling bits in quota state DWORD.
  164. // Public clients don't need these.
  165. // Note that the LOG_VOLUME_XXXX flags are not included.
  166. // This feature is not exposed through the quota APIs.
  167. //
  168. #define DISKQUOTA_LOGFLAG_MASK 0x00000030
  169. #define DISKQUOTA_LOGFLAG_SHIFT 4
  170. #define DISKQUOTA_FLAGS_MASK 0x00000337
  171. #define DISKQUOTA_FILEFLAG_MASK 0x00000300
  172. //
  173. // Maximum length of a SID.
  174. //
  175. const UINT MAX_SID_LEN = (FIELD_OFFSET(SID, SubAuthority) +
  176. sizeof(ULONG) * SID_MAX_SUB_AUTHORITIES);
  177. //
  178. // SID is a variable length structure.
  179. // This defines how large the FILE_QUOTA_INFORMATION structure can be if the SID
  180. // is maxed out.
  181. //
  182. const UINT FILE_QUOTA_INFORMATION_MAX_LEN = sizeof(FILE_QUOTA_INFORMATION) -
  183. sizeof(SID) +
  184. MAX_SID_LEN;
  185. //
  186. // FEATURE: These may actually be shorter than MAX_PATH.
  187. // Need to find out what actual max is.
  188. //
  189. const UINT MAX_USERNAME = MAX_PATH; // i.e. BrianAu
  190. const UINT MAX_DOMAIN = MAX_PATH; // i.e. REDMOND
  191. const UINT MAX_FULL_USERNAME = MAX_PATH; // i.e. Brian Aust
  192. const UINT MAX_VOL_LABEL = 33; // Includes term NUL.
  193. const UINT MAX_GUIDSTR_LEN = 40;
  194. #endif // __DSKQUOTA_PRIVATE_H