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.

244 lines
7.2 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1998-2002 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: Locals.cpp
  6. * Content: Global variables for the DNWsock service provider
  7. *
  8. *
  9. * History:
  10. * Date By Reason
  11. * ==== == ======
  12. * 11/25/98 jtk Created
  13. ***************************************************************************/
  14. #include "dnwsocki.h"
  15. //**********************************************************************
  16. // Constant definitions
  17. //**********************************************************************
  18. //**********************************************************************
  19. // Macro definitions
  20. //**********************************************************************
  21. //**********************************************************************
  22. // Structure definitions
  23. //**********************************************************************
  24. //**********************************************************************
  25. // Variable definitions
  26. //**********************************************************************
  27. #if ((! defined(WINCE)) && (! defined(_XBOX)))
  28. //
  29. // DLL instance
  30. //
  31. HINSTANCE g_hDLLInstance = NULL;
  32. #endif // ! WINCE and ! _XBOX
  33. #ifdef _XBOX
  34. BOOL g_fStartedXNet = FALSE;
  35. #endif // _XBOX
  36. #ifndef DPNBUILD_LIBINTERFACE
  37. //
  38. // count of outstanding COM interfaces
  39. //
  40. volatile LONG g_lOutstandingInterfaceCount = 0;
  41. #endif // ! DPNBUILD_LIBINTERFACE
  42. #ifndef DPNBUILD_ONLYONETHREAD
  43. //
  44. // thread count
  45. //
  46. LONG g_iThreadCount = 0;
  47. #endif // ! DPNBUILD_ONLYONETHREAD
  48. #ifndef DPNBUILD_NOREGISTRY
  49. #if ((! defined(DPNBUILD_NOWINSOCK2)) && (! defined(DPNBUILD_ONLYWINSOCK2)))
  50. DWORD g_dwWinsockVersion = 0;
  51. #endif // ! DPNBUILD_NOWINSOCK2 and ! DPNBUILD_ONLYWINSOCK2
  52. #endif // ! DPNBUILD_NOREGISTRY
  53. //
  54. // Winsock receive buffer size
  55. //
  56. BOOL g_fWinsockReceiveBufferSizeOverridden = FALSE;
  57. INT g_iWinsockReceiveBufferSize = 0;
  58. #ifndef DPNBUILD_NONATHELP
  59. //
  60. // global NAT/firewall traversal information
  61. //
  62. #ifndef DPNBUILD_NOREGISTRY
  63. BOOL g_fDisableDPNHGatewaySupport = FALSE;
  64. BOOL g_fDisableDPNHFirewallSupport = FALSE;
  65. DWORD g_dwDefaultTraversalMode = DPNA_TRAVERSALMODE_PORTREQUIRED;
  66. #endif // ! DPNBUILD_NOREGISTRY
  67. IDirectPlayNATHelp ** g_papNATHelpObjects = NULL;
  68. #ifndef DPNBUILD_NOLOCALNAT
  69. BOOL g_fLocalNATDetectedAtStartup = FALSE;
  70. #endif // ! DPNBUILD_NOLOCALNAT
  71. #endif // ! DPNBUILD_NONATHELP
  72. #ifndef DPNBUILD_NOREGISTRY
  73. #if ((defined(WINNT)) && (! defined(DPNBUILD_NOMULTICAST)))
  74. BOOL g_fDisableMadcapSupport = FALSE;
  75. MCAST_CLIENT_UID g_mcClientUid;
  76. #endif // WINNT and not DPNBUILD_NOMULTICAST
  77. //
  78. // ignore enums performance option
  79. //
  80. BOOL g_fIgnoreEnums = FALSE;
  81. //
  82. // disconnect upon reception of ICMP port not reachable option
  83. //
  84. BOOL g_fDisconnectOnICMP = FALSE;
  85. #ifndef DPNBUILD_NOIPV6
  86. //
  87. // IPv4 only/IPv6 only/hybrid setting
  88. //
  89. int g_iIPAddressFamily = PF_INET;
  90. #endif // ! DPNBUILD_NOIPV6
  91. //
  92. // IP banning globals
  93. //
  94. CHashTable * g_pHashBannedIPv4Addresses = NULL;
  95. DWORD g_dwBannedIPv4Masks = 0;
  96. //
  97. // proxy support options
  98. //
  99. #ifndef DPNBUILD_NOWINSOCK2
  100. BOOL g_fDontAutoDetectProxyLSP = FALSE;
  101. #endif // ! DPNBUILD_NOWINSOCK2
  102. BOOL g_fTreatAllResponsesAsProxied = FALSE;
  103. //
  104. // settings for overriding MTU
  105. //
  106. DWORD g_dwMaxUserDataSize = DEFAULT_MAX_USER_DATA_SIZE;
  107. DWORD g_dwMaxEnumDataSize = DEFAULT_MAX_ENUM_DATA_SIZE;
  108. //
  109. // default port range
  110. //
  111. WORD g_wBaseDPlayPort = BASE_DPLAY8_PORT;
  112. WORD g_wMaxDPlayPort = MAX_DPLAY8_PORT;
  113. #endif // ! DPNBUILD_NOREGISTRY
  114. //
  115. // ID of most recent endpoint generated
  116. //
  117. DWORD g_dwCurrentEndpointID = 0;
  118. #ifdef DBG
  119. //
  120. // Bilink for tracking DPNWSock critical sections
  121. //
  122. CBilink g_blDPNWSockCritSecsHeld;
  123. #endif // DBG
  124. #ifdef DPNBUILD_WINSOCKSTATISTICS
  125. //
  126. // Winsock debugging/tuning stats
  127. //
  128. DWORD g_dwWinsockStatNumSends = 0;
  129. DWORD g_dwWinsockStatSendCallTime = 0;
  130. #endif // DPNBUILD_WINSOCKSTATISTICS
  131. #ifndef DPNBUILD_NOREGISTRY
  132. //
  133. // registry strings
  134. //
  135. const WCHAR g_RegistryBase[] = L"SOFTWARE\\Microsoft\\DirectPlay8";
  136. const WCHAR g_RegistryKeyReceiveBufferSize[] = L"WinsockReceiveBufferSize";
  137. #ifndef DPNBUILD_ONLYONETHREAD
  138. const WCHAR g_RegistryKeyThreadCount[] = L"ThreadCount";
  139. #endif // ! DPNBUILD_ONLYONETHREAD
  140. #if ((! defined(DPNBUILD_NOWINSOCK2)) && (! defined(DPNBUILD_ONLYWINSOCK2)))
  141. const WCHAR g_RegistryKeyWinsockVersion[] = L"WinsockVersion";
  142. #endif // ! DPNBUILD_NOWINSOCK2 and ! DPNBUILD_ONLYWINSOCK2
  143. #ifndef DPNBUILD_NONATHELP
  144. const WCHAR g_RegistryKeyDisableDPNHGatewaySupport[] = L"DisableDPNHGatewaySupport";
  145. const WCHAR g_RegistryKeyDisableDPNHFirewallSupport[] = L"DisableDPNHFirewallSupport";
  146. const WCHAR g_RegistryKeyTraversalModeSettings[] = L"TraversalModeSettings";
  147. const WCHAR g_RegistryKeyDefaultTraversalMode[] = L"DefaultTraversalMode";
  148. #endif // !DPNBUILD_NONATHELP
  149. const WCHAR g_RegistryKeyAppsToIgnoreEnums[] = L"AppsToIgnoreEnums";
  150. const WCHAR g_RegistryKeyAppsToDisconnectOnICMP[] = L"AppsToDisconnectOnICMP";
  151. #ifndef DPNBUILD_NOIPV6
  152. const WCHAR g_RegistryKeyIPAddressFamilySettings[] = L"IPAddressFamilySettings";
  153. const WCHAR g_RegistryKeyDefaultIPAddressFamily[]= L"DefaultIPAddressFamily";
  154. #endif // ! DPNBUILD_NOIPV6
  155. #ifndef DPNBUILD_NOWINSOCK2
  156. const WCHAR g_RegistryKeyDontAutoDetectProxyLSP[] = L"DontAutoDetectProxyLSP";
  157. #endif // ! DPNBUILD_NOWINSOCK2
  158. const WCHAR g_RegistryKeyTreatAllResponsesAsProxied[] = L"TreatAllResponsesAsProxied";
  159. #if ((defined(WINNT)) && (! defined(DPNBUILD_NOMULTICAST)))
  160. const WCHAR g_RegistryKeyDisableMadcapSupport[] = L"DisableMadcapSupport";
  161. #endif // WINNT and not DPNBUILD_NOMULTICAST
  162. const WCHAR g_RegistryKeyBannedIPv4Addresses[] = L"BannedIPv4Addresses";
  163. const WCHAR g_RegistryKeyMaxUserDataSize[] = L"MaxUserDataSize";
  164. const WCHAR g_RegistryKeyMaxEnumDataSize[] = L"MaxEnumDataSize";
  165. const WCHAR g_RegistryKeyBaseDPlayPort[] = L"BaseDPlayPort";
  166. const WCHAR g_RegistryKeyMaxDPlayPort[] = L"MaxDPlayPort";
  167. #endif // ! DPNBUILD_NOREGISTRY
  168. //
  169. // GUIDs for munging device and scope IDs
  170. //
  171. // {4CE725F4-7B00-4397-BA6F-11F965BC4299}
  172. GUID g_IPSPEncryptionGuid = { 0x4ce725f4, 0x7b00, 0x4397, { 0xba, 0x6f, 0x11, 0xf9, 0x65, 0xbc, 0x42, 0x99 } };
  173. #ifndef DPNBUILD_NOIPX
  174. // {CA734945-3FC1-42ea-BF49-84AFCD4764AA}
  175. GUID g_IPXSPEncryptionGuid = { 0xca734945, 0x3fc1, 0x42ea, { 0xbf, 0x49, 0x84, 0xaf, 0xcd, 0x47, 0x64, 0xaa } };
  176. #endif // ! DPNBUILD_NOIPX
  177. #ifndef DPNBUILD_NOIPV6
  178. //
  179. // IPv6 link-local multicast address for enumerating DirectPlay sessions
  180. //
  181. #pragma TODO(vanceo, "\"Standardize\" enum multicast address?")
  182. const IN6_ADDR c_in6addrEnumMulticast = {0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0x01,0x30};
  183. #endif // ! DPNBUILD_NOIPV6
  184. //**********************************************************************
  185. // Function prototypes
  186. //**********************************************************************
  187. //**********************************************************************
  188. // Function definitions
  189. //**********************************************************************