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.

248 lines
5.0 KiB

  1. /*++
  2. Intel Corporation Proprietary Information
  3. Copyright (c) 1995 Intel Corporation
  4. This listing is supplied under the terms of a license agreement with
  5. Intel Corporation and may not be used, copied, nor disclosed except in
  6. accordance with the terms of that agreeement.
  7. Module Name:
  8. nscatalo.h
  9. Abstract:
  10. This module contains the interface to the catalog of name space providers
  11. for the winsock2 DLL.
  12. Author:
  13. Dirk Brandewie dirk@mink.intel.com 9-NOV-1995
  14. Notes:
  15. $Revision: 1.7 $
  16. $Modtime: 14 Feb 1996 14:13:32 $
  17. Revision History:
  18. 09-NOV-1995 dirk@mink.intel.com
  19. Initial revision.
  20. --*/
  21. #ifndef _NSCATALO_
  22. #define _NSCATALO_
  23. #include "winsock2.h"
  24. #include <windows.h>
  25. typedef
  26. BOOL
  27. (* NSCATALOGITERATION) (
  28. IN PVOID PassBack,
  29. IN PNSCATALOGENTRY CatalogEntry
  30. );
  31. /*++
  32. Routine Description:
  33. CATALOGITERATION is a place-holder for a function supplied by the client.
  34. The function is called once for each NSPROTO_CATALOG_ITEM structure in
  35. the catalog while enumerating the catalog. The client can stop the
  36. enumeration early by returning FALSE from the function.
  37. Arguments:
  38. PassBack - Supplies to the client an uninterpreted, unmodified value
  39. that was specified by the client in the original function
  40. that requested the enumeration. The client can use this
  41. value to carry context between the requesting site and the
  42. enumeration function.
  43. CatalogEntry - Supplies to the client a reference to a NSCATALOGENTRY
  44. structure with values for this item of the enumeration.
  45. Return Value:
  46. TRUE - The enumeration should continue with more iterations if there are
  47. more structures to enumerate.
  48. FALSE - The enumeration should stop with this as the last iteration even if
  49. there are more structures to enumerate.
  50. --*/
  51. PNSCATALOG
  52. OpenInitializedNameSpaceCatalog();
  53. /*++
  54. Routine Description:
  55. Creates and returns catalog object that represents current reqistry state
  56. Arguments:
  57. None
  58. Return Value:
  59. Catalog object or NULL if allocation or registry IO fails
  60. --*/
  61. class NSCATALOG
  62. {
  63. public:
  64. NSCATALOG();
  65. INT
  66. InitializeFromRegistry(
  67. IN HKEY ParentKey,
  68. IN HANDLE CatalogChangeEvent OPTIONAL
  69. );
  70. #ifdef _WIN64
  71. INT
  72. InitializeFromRegistry32(
  73. IN HKEY ParentKey
  74. );
  75. #endif
  76. INT
  77. RefreshFromRegistry (
  78. IN HANDLE CatalogChangeEvent OPTIONAL
  79. );
  80. INT
  81. WriteToRegistry(
  82. );
  83. ~NSCATALOG();
  84. VOID
  85. EnumerateCatalogItems(
  86. IN NSCATALOGITERATION Iteration,
  87. IN PVOID PassBack
  88. );
  89. INT
  90. GetCountedCatalogItemFromProviderId(
  91. IN LPGUID ProviderId,
  92. OUT PNSCATALOGENTRY FAR * CatalogItem
  93. );
  94. INT
  95. GetCountedCatalogItemFromNameSpaceId(
  96. IN DWORD NameSpaceId,
  97. OUT PNSCATALOGENTRY FAR * CatalogItem
  98. );
  99. VOID
  100. AppendCatalogItem(
  101. IN PNSCATALOGENTRY CatalogItem
  102. );
  103. VOID
  104. RemoveCatalogItem(
  105. IN PNSCATALOGENTRY CatalogItem
  106. );
  107. INT WSAAPI
  108. GetServiceClassInfo(
  109. IN OUT LPDWORD lpdwBufSize,
  110. IN OUT LPWSASERVICECLASSINFOW lpServiceClassInfo
  111. );
  112. INT
  113. LoadProvider(
  114. IN PNSCATALOGENTRY CatalogEntry
  115. );
  116. static
  117. LPSTR
  118. GetCurrentCatalogName(
  119. VOID
  120. );
  121. private:
  122. BOOL
  123. OpenCatalog(
  124. IN HKEY ParentKey
  125. );
  126. VOID
  127. AcquireCatalogLock(
  128. VOID
  129. );
  130. VOID
  131. ReleaseCatalogLock(
  132. VOID
  133. );
  134. VOID
  135. UpdateNamespaceList (
  136. PLIST_ENTRY new_list
  137. );
  138. PNSPROVIDER
  139. GetClassInfoProvider(
  140. IN DWORD BufSize,
  141. IN LPWSASERVICECLASSINFOW lpServiceClassInfo
  142. );
  143. LIST_ENTRY m_namespace_list;
  144. // The head of the list of protocol catalog items
  145. ULONG m_num_items;
  146. // Number of items in this catalog.
  147. ULONG m_serial_num;
  148. // The serial number of the catalog (changes every time catalog
  149. // is changed in the registry)
  150. HKEY m_reg_key;
  151. // Handle of the registry key under which catalog resides.
  152. // We keep it open so we can get notified whenever catalog
  153. // changes.
  154. PNSPROVIDER m_classinfo_provider;
  155. #ifdef _WIN64
  156. BOOLEAN m_entries32;
  157. #endif
  158. CRITICAL_SECTION m_nscatalog_lock;
  159. }; // class dcatalog
  160. inline
  161. VOID
  162. NSCATALOG::AcquireCatalogLock(
  163. VOID
  164. )
  165. {
  166. EnterCriticalSection( &m_nscatalog_lock );
  167. }
  168. inline
  169. VOID
  170. NSCATALOG::ReleaseCatalogLock(
  171. VOID
  172. )
  173. {
  174. LeaveCriticalSection( &m_nscatalog_lock );
  175. }
  176. #endif // _NSCATALO_