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.

167 lines
2.4 KiB

  1. /*
  2. * Concurrent.h
  3. *
  4. * Author: RobLeit
  5. *
  6. * The Concurrent licensing policy.
  7. */
  8. #ifndef __LC_Concurrent_H__
  9. #define __LC_Concurrent_H__
  10. /*
  11. * Includes
  12. */
  13. #include "policy.h"
  14. /*
  15. * Constants
  16. */
  17. #define LC_POLICY_CONCURRENT_EXPIRATION_LEEWAY (1000*60*60*24*7)
  18. /*
  19. * Class Definition
  20. */
  21. class CConcurrentPolicy : public CPolicy
  22. {
  23. public:
  24. /*
  25. * Creation Functions
  26. */
  27. CConcurrentPolicy(
  28. );
  29. ~CConcurrentPolicy(
  30. );
  31. /*
  32. * Administrative Functions
  33. */
  34. ULONG
  35. GetFlags(
  36. );
  37. ULONG
  38. GetId(
  39. );
  40. NTSTATUS
  41. GetInformation(
  42. LPLCPOLICYINFOGENERIC lpPolicyInfo
  43. );
  44. /*
  45. * Loading and Activation Functions
  46. */
  47. NTSTATUS
  48. Load(
  49. );
  50. NTSTATUS
  51. Unload(
  52. );
  53. NTSTATUS
  54. Activate(
  55. BOOL fStartup,
  56. ULONG *pulAlternatePolicy
  57. );
  58. NTSTATUS
  59. Deactivate(
  60. BOOL fShutdown
  61. );
  62. /*
  63. * Licensing Functions
  64. */
  65. NTSTATUS
  66. Logon(
  67. CSession& Session
  68. );
  69. NTSTATUS
  70. Reconnect(
  71. CSession& Session,
  72. CSession& TemporarySession
  73. );
  74. NTSTATUS
  75. Logoff(
  76. CSession& Session
  77. );
  78. /*
  79. * Private License Functions
  80. */
  81. private:
  82. NTSTATUS
  83. LicenseClient(
  84. CSession& Session
  85. );
  86. NTSTATUS
  87. CheckExpiration(
  88. );
  89. LONG
  90. CheckInstalledLicenses(
  91. DWORD dwWanted
  92. );
  93. VOID
  94. ReadLicensingParameters(
  95. );
  96. /*
  97. * Global Static Functions for checking license expiration.
  98. */
  99. static DWORD
  100. TimeToSoftExpiration(
  101. );
  102. static DWORD
  103. TimeToHardExpiration(
  104. );
  105. static NTSTATUS
  106. GetLicenseFromLS(
  107. LONG nNum,
  108. BOOL fIgnoreCurrentCount,
  109. BOOL *pfRetrievedAll
  110. );
  111. static DWORD
  112. GenerateHwidFromComputerName(
  113. HWID *hwid
  114. );
  115. static VOID
  116. TryToAddLicenses(
  117. DWORD dwTotalWanted
  118. );
  119. static VOID
  120. TryToReturnLicenses(
  121. DWORD dwWanted
  122. );
  123. };
  124. #endif