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.

284 lines
7.9 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. global.h
  5. Abstract:
  6. This module contains definitions for global server data.
  7. Author:
  8. Colin Watson (colinw) 14-Apr-1997
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. --*/
  13. #ifndef GLOBAL_DATA_ALLOCATED
  14. #ifdef GLOBAL_DATA_ALLOCATE
  15. #undef GLOBAL_DATA
  16. #endif
  17. #endif
  18. #ifndef GLOBAL_DATA
  19. #define GLOBAL_DATA
  20. //
  21. // main.c will #include this file with GLOBAL_DATA_ALLOCATE defined.
  22. // That will cause each of these variables to be allocated.
  23. //
  24. #ifdef GLOBAL_DATA_ALLOCATE
  25. #undef EXTERN
  26. #define EXTERN
  27. #define GLOBAL_DATA_ALLOCATED
  28. #undef INIT_GLOBAL
  29. #define INIT_GLOBAL(v) =v
  30. #else
  31. #define EXTERN extern
  32. #define INIT_GLOBAL(v)
  33. #endif
  34. //
  35. // process global data passed to this service from tcpsvcs.exe
  36. //
  37. EXTERN PTCPSVCS_GLOBAL_DATA TcpsvcsGlobalData;
  38. //
  39. // Service variables
  40. //
  41. EXTERN SERVICE_STATUS BinlGlobalServiceStatus;
  42. EXTERN SERVICE_STATUS_HANDLE BinlGlobalServiceStatusHandle;
  43. //
  44. // Process data.
  45. //
  46. #define BINL_STOPPED 0
  47. #define BINL_STARTED 1
  48. EXTERN DWORD BinlCurrentState INIT_GLOBAL(BINL_STOPPED);
  49. EXTERN HANDLE BinlGlobalProcessTerminationEvent INIT_GLOBAL(NULL);
  50. EXTERN HANDLE BinlGlobalProcessorHandle;
  51. EXTERN HANDLE BinlGlobalMessageHandle;
  52. EXTERN LIST_ENTRY BinlGlobalFreeRecvList;
  53. EXTERN LIST_ENTRY BinlGlobalActiveRecvList;
  54. EXTERN CRITICAL_SECTION BinlGlobalRecvListCritSect;
  55. EXTERN HANDLE BinlGlobalRecvEvent INIT_GLOBAL(NULL);
  56. EXTERN int DHCPState INIT_GLOBAL(DHCP_STOPPED);
  57. EXTERN BOOL BinlGlobalSystemShuttingDown;
  58. // Temporary defaults until GPT lookup available
  59. EXTERN PWCHAR BinlGlobalDefaultContainer INIT_GLOBAL(NULL);
  60. EXTERN PWCHAR DefaultDomain INIT_GLOBAL(NULL);
  61. #define DEFAULT_MAXIMUM_DEBUGFILE_SIZE 20000000
  62. EXTERN DWORD BinlGlobalDebugFlag;
  63. EXTERN CRITICAL_SECTION BinlGlobalDebugFileCritSect;
  64. EXTERN HANDLE BinlGlobalDebugFileHandle;
  65. EXTERN DWORD BinlGlobalDebugFileMaxSize;
  66. EXTERN LPWSTR BinlGlobalDebugSharePath;
  67. EXTERN DWORD BinlLdapOptReferrals INIT_GLOBAL(0);
  68. //
  69. // misc
  70. //
  71. //
  72. // We don't wait forever for the DS to come back with a reply.
  73. //
  74. #define BINL_LDAP_SEARCH_TIMEOUT_SECONDS 30
  75. #define BINL_LDAP_SEARCH_MIN_TIMEOUT_MSECS 500
  76. EXTERN struct l_timeval BinlLdapSearchTimeout;
  77. EXTERN DWORD BinlGlobalIgnoreBroadcastFlag; // whether to ignore the broadcast
  78. // bit in the client requests or not
  79. EXTERN HANDLE g_hevtProcessMessageComplete;
  80. EXTERN DWORD g_cMaxProcessingThreads;
  81. EXTERN DWORD g_cProcessMessageThreads;
  82. EXTERN CRITICAL_SECTION g_ProcessMessageCritSect;
  83. EXTERN CRITICAL_SECTION gcsDHCPBINL;
  84. EXTERN CRITICAL_SECTION gcsParameters;
  85. EXTERN LPENDPOINT BinlGlobalEndpointList INIT_GLOBAL(NULL);
  86. EXTERN DWORD BinlGlobalNumberOfNets;
  87. EXTERN DWORD g_Port;
  88. EXTERN BOOL AllowNewClients INIT_GLOBAL(TRUE);
  89. EXTERN BOOL LimitClients INIT_GLOBAL(FALSE);
  90. EXTERN BOOL AssignNewClientsToServer INIT_GLOBAL(FALSE);
  91. //
  92. // As part of rogue detection, the default for servers should be to not answer
  93. // for new clients. We'll get the ability to answer clients out of
  94. // the directory.
  95. //
  96. EXTERN BOOL AnswerRequests INIT_GLOBAL(TRUE);
  97. EXTERN BOOL AnswerOnlyValidClients INIT_GLOBAL(TRUE);
  98. EXTERN WCHAR NewMachineNamingPolicyDefault[] INIT_GLOBAL(L"%Username%#");
  99. EXTERN PWCHAR NewMachineNamingPolicy INIT_GLOBAL(NULL);
  100. EXTERN DWORD CurrentClientCount INIT_GLOBAL(0);
  101. EXTERN DWORD BinlMaxClients INIT_GLOBAL(0);
  102. EXTERN DWORD BinlClientTimeout INIT_GLOBAL(0);
  103. EXTERN DWORD BinlUpdateFromDSTimeout INIT_GLOBAL(4*60*60*1000); // milliseconds (4 hours)
  104. EXTERN DWORD BinlHyperUpdateCount INIT_GLOBAL(0);
  105. EXTERN BOOL BinlHyperUpdateSatisfied INIT_GLOBAL(FALSE);
  106. EXTERN BOOL BinlParametersRead INIT_GLOBAL(FALSE);
  107. EXTERN PWCHAR BinlGlobalSCPPath INIT_GLOBAL(NULL);
  108. EXTERN PWCHAR BinlGlobalServerDN INIT_GLOBAL(NULL);
  109. EXTERN PWCHAR BinlGlobalGroupDN INIT_GLOBAL(NULL);
  110. EXTERN CRITICAL_SECTION ClientsCriticalSection;
  111. EXTERN LIST_ENTRY ClientsQueue;
  112. EXTERN CRITICAL_SECTION HackWorkaroundCriticalSection;
  113. //
  114. // By default, we cache DS responses for 25 seconds. It's relatively short
  115. // because we have no way of cheeply getting notified of DS changes.
  116. //
  117. #define BINL_CACHE_EXPIRE_DEFAULT (25*1000)
  118. //
  119. // We maintain a list of BINL_CACHE_ENTRY structures for short term caching.
  120. // The root of the list is in BinlCacheList and the lock that protects the
  121. // list is BinlCacheListLock. We expire these cache entries after a given
  122. // time period has expired (BinlCacheExpireMilliseconds holds it).
  123. //
  124. EXTERN LIST_ENTRY BinlCacheList;
  125. EXTERN CRITICAL_SECTION BinlCacheListLock;
  126. EXTERN ULONG BinlCacheExpireMilliseconds;
  127. //
  128. // When waiting for the threads to be done with the cache, we wait on the
  129. // BinlCloseCacheEvent event.
  130. //
  131. EXTERN HANDLE BinlCloseCacheEvent INIT_GLOBAL(NULL);
  132. //
  133. // default for max number to cache is 250. This seems reasonable number to
  134. // cache for at most BinlCacheExpireMilliseconds.
  135. //
  136. #define BINL_CACHE_COUNT_LIMIT_DEFAULT 250
  137. EXTERN ULONG BinlGlobalCacheCountLimit;
  138. EXTERN DWORD BinlGlobalScavengerSleep; // in milliseconds
  139. #if DBG
  140. EXTERN BOOL BinlGlobalRunningAsProcess;
  141. #endif
  142. EXTERN ULONG BinlMinDelayResponseForNewClients;
  143. //
  144. // Remote boot path - as in "D:\RemoteInstall" with no trailing slash
  145. //
  146. EXTERN WCHAR IntelliMirrorPathW[ MAX_PATH ];
  147. EXTERN CHAR IntelliMirrorPathA[ MAX_PATH ];
  148. //
  149. // Default language to look for oschooser screens/setups in.
  150. //
  151. EXTERN PWCHAR BinlGlobalDefaultLanguage INIT_GLOBAL(NULL);
  152. EXTERN DHCP_ROGUE_STATE_INFO DhcpRogueInfo;
  153. EXTERN BOOL BinlGlobalHaveCalledRogueInit INIT_GLOBAL(FALSE);
  154. EXTERN BOOL BinlGlobalAuthorized INIT_GLOBAL(FALSE);
  155. EXTERN BOOL BinlRogueLoggedState INIT_GLOBAL(FALSE);
  156. EXTERN HANDLE BinlRogueTerminateEventHandle INIT_GLOBAL(NULL);
  157. EXTERN HANDLE RogueUnauthorizedHandle INIT_GLOBAL(NULL);
  158. EXTERN HANDLE BinlRogueThread INIT_GLOBAL(NULL);
  159. //
  160. // PNP globals.
  161. //
  162. EXTERN PIP_ADAPTER_INFO BinlIpAddressInfo INIT_GLOBAL(NULL);
  163. EXTERN ULONG BinlIpAddressInfoCount INIT_GLOBAL(0);
  164. EXTERN BOOL BinlIsMultihomed INIT_GLOBAL(FALSE);
  165. EXTERN DHCP_IP_ADDRESS BinlGlobalMyIpAddress INIT_GLOBAL(0);
  166. EXTERN SOCKET BinlPnpSocket INIT_GLOBAL(INVALID_SOCKET);
  167. EXTERN WSAOVERLAPPED BinlPnpOverlapped;
  168. EXTERN HANDLE BinlGlobalPnpEvent INIT_GLOBAL(NULL);
  169. //
  170. // The four strings below are protected by the gcsParameters critical section.
  171. //
  172. EXTERN PWCHAR BinlGlobalOurDnsName INIT_GLOBAL(NULL); // our dns name
  173. EXTERN PWCHAR BinlGlobalOurDomainName INIT_GLOBAL(NULL);// our netbios domain name
  174. EXTERN PWCHAR BinlGlobalOurServerName INIT_GLOBAL(NULL);// our netbios server name
  175. EXTERN PWCHAR BinlGlobalOurFQDNName INIT_GLOBAL(NULL); // our distinguished name
  176. EXTERN HANDLE BinlGlobalLsaDnsNameNotifyEvent INIT_GLOBAL(NULL);
  177. EXTERN BOOL BinlGlobalHaveOutstandingLsaNotify INIT_GLOBAL(FALSE);
  178. //
  179. // Default organization to use in .sifs.
  180. //
  181. EXTERN PWCHAR BinlGlobalDefaultOrgname INIT_GLOBAL(NULL);
  182. //
  183. // Default timezone index to use in .sifs
  184. //
  185. EXTERN PWCHAR BinlGlobalDefaultTimezone INIT_GLOBAL(NULL);
  186. //
  187. // Default DS servers
  188. //
  189. EXTERN PWCHAR BinlGlobalDefaultDS INIT_GLOBAL(NULL);
  190. EXTERN PWCHAR BinlGlobalDefaultGC INIT_GLOBAL(NULL);
  191. //
  192. // default for NTLMV2 style authentication
  193. //
  194. #define BINL_NTLMV2_AUTHENTICATE_DEFAULT 1
  195. EXTERN DWORD BinlGlobalUseNTLMV2 INIT_GLOBAL(1);
  196. //
  197. // The number of times we'll retry before giving up on the DS.
  198. //
  199. #define LDAP_SERVER_DOWN_LIMIT 4 // number of times to retry
  200. #define LDAP_BUSY_LIMIT 15 // number of times to retry
  201. #define LDAP_BUSY_DELAY 250 // milliseconds to wait
  202. EXTERN ULONG BinlGlobalLdapErrorCount INIT_GLOBAL(0);
  203. EXTERN ULONG BinlGlobalMaxLdapErrorsLogged INIT_GLOBAL(0);
  204. EXTERN ULONG BinlGlobalLdapErrorScavenger INIT_GLOBAL(0);
  205. //
  206. // Used to crack names
  207. //
  208. EXTERN HANDLE BinlOscClientDSHandle INIT_GLOBAL(NULL);
  209. #endif // GLOBAL_DATA*