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.

96 lines
2.0 KiB

  1. #if 0
  2. //
  3. // LICENSING code
  4. //
  5. //
  6. // globals.cxx
  7. //
  8. //
  9. // The number of licenses allowed concurrently
  10. //
  11. DWORD g_cMaxLicenses = 0xffffffff;
  12. //
  13. // Get the license from the registry
  14. //
  15. err = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
  16. W3_LICENSE_KEY,
  17. 0,
  18. KEY_ALL_ACCESS,
  19. &hkey );
  20. if ( !err )
  21. {
  22. BOOL fConcurrentMode;
  23. //
  24. // Per-Seat mode requires client side licenses so the server is
  25. // unlimited. For concurrent mode, check the concurrent limit.
  26. //
  27. fConcurrentMode = ReadRegistryDword( hkey,
  28. "Mode",
  29. FALSE );
  30. if ( fConcurrentMode )
  31. {
  32. g_cMaxLicenses = ReadRegistryDword( hkey,
  33. "ConcurrentLimit",
  34. 0xffffffff );
  35. }
  36. TCP_REQUIRE( !RegCloseKey( hkey ));
  37. //
  38. // If a license limit is specified, multiply it by four to account
  39. // for the simultaneous connections most browsers use
  40. //
  41. if ( g_cMaxLicenses != 0xffffffff )
  42. {
  43. g_cMaxLicenses *= 4;
  44. }
  45. }
  46. //
  47. // connect.cxx
  48. //
  49. inline
  50. VOID
  51. LogLicenseExceededWarning(
  52. VOID
  53. )
  54. {
  55. //
  56. // Make sure we only log one event in the event log
  57. //
  58. if ( !InterlockedExchange( &fLicenseExceededWarning, TRUE ))
  59. {
  60. g_pInetSvc->LogEvent( W3_EVENT_LICENSES_EXCEEDED,
  61. 0,
  62. (WCHAR **) NULL,
  63. NO_ERROR );
  64. }
  65. }
  66. //
  67. // make sure we don't exceed license
  68. //
  69. else if ( cConnectedUsers >= g_cMaxLicenses )
  70. {
  71. LogLicenseExceededWarning();
  72. SendError( sNew, IDS_OUT_OF_LICENSES );
  73. goto error_exit;
  74. }
  75. #endif