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.

211 lines
3.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1998, Microsoft Corporation.
  4. //
  5. // File: spcsup.h
  6. //
  7. // Contents: Declarations for DFS_SPECIAL_INFO hash table
  8. //
  9. // History: 11 Nov 1997 Jharper Created
  10. //
  11. //--------------------------------------------------------------------------
  12. #ifndef __SPCSUP_H_
  13. #define __SPCSUP_H_
  14. //
  15. // For names we associate a list of names
  16. //
  17. typedef struct _DFS_SPECIAL_INFO {
  18. //
  19. // Type and size of this record (must be DFS_NTC_SPECIAL_INFO)
  20. //
  21. NODE_TYPE_CODE NodeTypeCode;
  22. NODE_BYTE_SIZE NodeByteSize;
  23. //
  24. // A list entry for the hash table chain.
  25. //
  26. LIST_ENTRY HashChain;
  27. //
  28. // Use Count (for multi-threading)
  29. // Uses ExInterlockedIncrementLong()/ExInterlockedDecrementLong
  30. //
  31. ULONG UseCount;
  32. //
  33. // Flags
  34. //
  35. ULONG Flags;
  36. //
  37. // The special name
  38. //
  39. UNICODE_STRING SpecialName;
  40. //
  41. // The time this entry becomes invalid
  42. //
  43. LARGE_INTEGER ExpireTime;
  44. //
  45. // Flags representing type (PRIMARY/SECONDARY and DNS/NETBIOS)
  46. //
  47. ULONG TypeFlags;
  48. //
  49. // Trust information
  50. //
  51. ULONG TrustDirection;
  52. ULONG TrustType;
  53. //
  54. // Number of Names associated with this special name
  55. //
  56. LONG NameCount;
  57. //
  58. // The names themselves. There are actually N of these
  59. // where N is stored in NameCount
  60. //
  61. UNICODE_STRING Name[1];
  62. } DFS_SPECIAL_INFO, *PDFS_SPECIAL_INFO;
  63. #define SPECIAL_INFO_DELETE_PENDING 0x00000001 // DFS_SPECIAL_INFO should be freed
  64. #define SPECIAL_INFO_IS_LONG_NAME 0x00000002
  65. #define SPECIAL_INFO_NEEDS_REFRESH 0x00000004
  66. #define MAX_SPC_LONG_NAME_SIZE 2048
  67. //
  68. //
  69. // Declaration of the hash table. The hash table can be variably
  70. // sized, with the hash table size being a parameter of the hash
  71. // function.
  72. //
  73. typedef struct _SPECIAL_HASH_TABLE {
  74. //
  75. // The type and size of this record (must be DFS_NTC_SPECIAL_HASH)
  76. //
  77. NODE_TYPE_CODE NodeTypeCode;
  78. NODE_BYTE_SIZE NodeByteSize;
  79. //
  80. // The timeout (in sec) to give to clients who ask for a special referral
  81. //
  82. ULONG SpcTimeout;
  83. //
  84. // Mask value for the hash function. The hash table size is
  85. // assumed to be a power of two; the mask is the size - 1.
  86. //
  87. ULONG HashMask;
  88. //
  89. // A mutex to protect access to the hash bucket chains
  90. //
  91. FAST_MUTEX HashListMutex;
  92. //
  93. // An array of list heads for the hash table chains. There
  94. // are actually N of these where N is the hash table size.
  95. //
  96. LIST_ENTRY HashBuckets[1];
  97. } SPECIAL_HASH_TABLE, *PSPECIAL_HASH_TABLE;
  98. NTSTATUS
  99. DfsInitSpcHashTable(
  100. IN PSPECIAL_HASH_TABLE *ppHashTable,
  101. IN ULONG cHash
  102. );
  103. VOID
  104. DfsUninitSpcHashTable(
  105. IN PSPECIAL_HASH_TABLE pHashTable
  106. );
  107. PDFS_SPECIAL_INFO
  108. DfsLookupSpcInfo(
  109. IN PSPECIAL_HASH_TABLE pHashTable,
  110. IN PUNICODE_STRING SpecialName
  111. );
  112. VOID
  113. DfsReleaseSpcInfo(
  114. IN PSPECIAL_HASH_TABLE pHashTable,
  115. IN PDFS_SPECIAL_INFO SpcInfo
  116. );
  117. NTSTATUS
  118. DfsFsctrlCreateSpcInfo(
  119. IN PSPECIAL_HASH_TABLE pHashTable,
  120. IN PIRP Irp,
  121. IN PVOID InputBuffer,
  122. IN ULONG InputBufferLength
  123. );
  124. NTSTATUS
  125. DfsFsctrlDeleteSpcInfo(
  126. IN PSPECIAL_HASH_TABLE pHashTable,
  127. IN PIRP Irp,
  128. IN PVOID InputBuffer,
  129. IN ULONG InputBufferLength
  130. );
  131. VOID
  132. DfsSpcInfoFindOpen(
  133. IN PSPECIAL_HASH_TABLE pHashTable
  134. );
  135. PDFS_SPECIAL_INFO
  136. DfsSpcInfoFindFirst(
  137. IN PSPECIAL_HASH_TABLE pHashTable
  138. );
  139. PDFS_SPECIAL_INFO
  140. DfsSpcInfoFindNext(
  141. IN PSPECIAL_HASH_TABLE pHashTable,
  142. IN PDFS_SPECIAL_INFO pSpcInfo
  143. );
  144. VOID
  145. DfsSpcInfoFindClose(
  146. IN PSPECIAL_HASH_TABLE pHashTable
  147. );
  148. VOID
  149. DfsDeleteSpcInfo(
  150. IN PSPECIAL_HASH_TABLE pHashTable,
  151. IN PDFS_SPECIAL_INFO pSpcInfo
  152. );
  153. NTSTATUS
  154. DfsFsctrlGetDomainToRefresh(
  155. PIRP Irp,
  156. PVOID OutputBuffer,
  157. ULONG OutputBufferLength);
  158. #endif // __SPECIALSUP_H_