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.

286 lines
8.7 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996-1998
  5. //
  6. // File: tlspol.h
  7. //
  8. // Contents:
  9. //
  10. // History: 08-26-98 HueiWang Created
  11. //
  12. //---------------------------------------------------------------------------
  13. #ifndef __TLSPOLICY_H__
  14. #define __TLSPOLICY_H__
  15. #include "tlsapi.h"
  16. #ifndef WINAPI
  17. #define WINAPI __stdcall
  18. #endif
  19. //
  20. // Return Code from Policy Module
  21. //
  22. typedef enum {
  23. POLICY_SUCCESS = 0, // Success in processing request.
  24. POLICY_ERROR, // Fail to process request.
  25. POLICY_NOT_SUPPORTED, // Unsupported function.
  26. POLICY_CRITICAL_ERROR // Critical error.
  27. } POLICYSTATUS;
  28. typedef HANDLE PMHANDLE;
  29. //
  30. // Request progress type
  31. //
  32. #define REQUEST_UPGRADE 1
  33. #define REQUEST_NEW 2
  34. #define REQUEST_KEYPACKTYPE 3
  35. #define REQUEST_TEMPORARY 4
  36. #define REQUEST_KEYPACKDESC 5
  37. #define REQUEST_GENLICENSE 6
  38. #define REQUEST_COMPLETE 7
  39. //
  40. // License Return Code
  41. //
  42. #define LICENSE_RETURN_ERROR 0 // Can't decide what to do
  43. #define LICENSE_RETURN_DELETE 1 // delete the old license and return license to license pack
  44. #define LICENSE_RETURN_KEEP 2 // keep the old license.
  45. //
  46. // Client request license type.
  47. //
  48. #define LICENSETYPE_LICENSE 1 // normal license type
  49. #define LICENSETYPE_CONCURRENT 2 // concurrent license
  50. //
  51. // Keypack Registration.
  52. //
  53. #define REGISTER_PROGRESS_NEW 1
  54. #define REGISTER_PROGRESS_END 2
  55. typedef struct __PMREGISTERLKPDESC {
  56. LCID Locale; // Description locale
  57. TCHAR szProductName[LSERVER_MAX_STRING_SIZE+1]; // Product Name
  58. TCHAR szProductDesc[LSERVER_MAX_STRING_SIZE+1]; // Product Desc.
  59. } PMREGISTERLKPDESC, *PPMREGISTERLKPDESC, *LPPMREGISTERLKPDESC;
  60. typedef enum {
  61. REGISTER_SOURCE_INTERNET = 1, // Internet registration
  62. REGISTER_SOURCE_PHONE, // Phone registration
  63. REGISTER_SOURCE_DISK // Disk registration
  64. } LICENSEPACKREGISTERSOURCE_TYPE;
  65. typedef struct __PMREGISTERLICENSEPACK {
  66. LICENSEPACKREGISTERSOURCE_TYPE SourceType; // type of registration source
  67. DWORD dwKeyPackType; // Type of keypack
  68. DWORD dwDistChannel; // distribution channel
  69. FILETIME IssueDate; // Issue Date
  70. FILETIME ActiveDate; // Active Date
  71. FILETIME ExpireDate; // Expiration Date
  72. DWORD dwBeginSerialNum; // Begin license serial number
  73. DWORD dwQuantity; // Quantity of Licenses in KeyPack
  74. TCHAR szProductId[LSERVER_MAX_STRING_SIZE+1]; // Product Code
  75. TCHAR szCompanyName[LSERVER_MAX_STRING_SIZE+1]; // Company Name
  76. DWORD dwProductVersion; // Product Version
  77. DWORD dwPlatformId; // Platform ID
  78. DWORD dwLicenseType; // License Type
  79. DWORD dwDescriptionCount; // Number of Product Description
  80. PPMREGISTERLKPDESC pDescription; // Array of product description
  81. // KeyPackSerialNum is set only on internet
  82. GUID KeypackSerialNum; // KeyPack serial number
  83. // pbLKP is only set on PHONE
  84. PBYTE pbLKP;
  85. DWORD cbLKP;
  86. } PMREGISTERLICENSEPACK, *PPMREGISTERLICENSEPACK, *LPPMREGISTERLICENSEPACK;
  87. typedef struct __PMLSKEYPACK {
  88. FILETIME IssueDate;
  89. FILETIME ActiveDate;
  90. FILETIME ExpireDate;
  91. LSKeyPack keypack;
  92. DWORD dwDescriptionCount;
  93. PPMREGISTERLKPDESC pDescription;
  94. } PMLSKEYPACK, *PPMLSKEYPACK, *LPPMLSKEYPACK;
  95. typedef struct __PMLICENSEREQUEST {
  96. DWORD dwLicenseType; // License Type defined in tlsdef.h
  97. DWORD dwProductVersion; // request product version.
  98. LPTSTR pszProductId; // product product id.
  99. LPTSTR pszCompanyName; // product company name.
  100. DWORD dwLanguageId; // unused.
  101. DWORD dwPlatformId; // request platform type.
  102. LPTSTR pszMachineName; // client machine name.
  103. LPTSTR pszUserName; // client user name.
  104. BOOL fTemporary; // Whether the issued license must be temporary (can't be permanent)
  105. DWORD dwSupportFlags; // Which new features are supported by TS
  106. } PMLICENSEREQUEST, *PPMLICENSEREQUEST, *LPPMLICENSEREQUEST;
  107. typedef struct __PMGENERATELICENSE {
  108. PPMLICENSEREQUEST pLicenseRequest; // return from REQUEST_NEW
  109. DWORD dwKeyPackType; // License Pack Type
  110. DWORD dwKeyPackId; // License Pack Id that license is allocated from
  111. DWORD dwKeyPackLicenseId; // License ID in the keypack.
  112. ULARGE_INTEGER ClientLicenseSerialNumber; // License Serial Number.
  113. FILETIME ftNotBefore;
  114. FILETIME ftNotAfter;
  115. } PMGENERATELICENSE, *PPMGENERATELICENSE, *LPPMGENERATELICENSE;
  116. typedef struct __PMCERTEXTENSION {
  117. DWORD cbData; // policy specific extension data
  118. PBYTE pbData; // size of extension data
  119. FILETIME ftNotBefore; // license validity period
  120. FILETIME ftNotAfter;
  121. } PMCERTEXTENSION, *PPMCERTEXTENSION, *LPPMCERTEXTENSION;
  122. typedef struct __PMLICENSEDPRODUCT {
  123. PMLICENSEREQUEST LicensedProduct; // licensed product
  124. PBYTE pbData; // policy specific extension data
  125. DWORD cbData; // size of extension data
  126. BOOL bTemporary; // temporary license
  127. UCHAR ucMarked; // mark flags, including whether user was authenticated
  128. } PMLICENSEDPRODUCT, *PPMLICENSEDPRODUCT, *LPPMLICENSEDPRODUCT;
  129. typedef struct __PMUPGRADEREQUEST {
  130. PBYTE pbOldLicense;
  131. DWORD cbOldLicense;
  132. DWORD dwNumProduct; // number of licensed product
  133. // contained in the client license
  134. PPMLICENSEDPRODUCT pProduct; // array of licensed product in the client license
  135. PPMLICENSEREQUEST pUpgradeRequest; // new license upgrade request
  136. } PMUPGRADEREQUEST, *PPMUPGRADEREQUEST, *LPPMUPGRADEREQUEST;
  137. typedef struct __PMKEYPACKDESCREQ {
  138. LPTSTR pszProductId;
  139. DWORD dwLangId;
  140. DWORD dwVersion;
  141. } PMKEYPACKDESCREQ, *PPMKEYPACKDESCREQ, *LPPMKEYPACKDESCREQ;
  142. typedef struct __PMKEYPACKDESC {
  143. TCHAR szCompanyName[LSERVER_MAX_STRING_SIZE+1];
  144. TCHAR szProductName[LSERVER_MAX_STRING_SIZE+1];
  145. TCHAR szProductDesc[LSERVER_MAX_STRING_SIZE+1];
  146. } PMKEYPACKDESC, *PPMKEYPACKDESC, *LPPMKEYPACKDESC;
  147. typedef struct __PMSupportedProduct {
  148. TCHAR szCHSetupCode[LSERVER_MAX_STRING_SIZE+1];
  149. TCHAR szTLSProductCode[LSERVER_MAX_STRING_SIZE+1];
  150. } PMSUPPORTEDPRODUCT, *PPMSUPPORTEDPRODUCT, *LPPMSUPPORTEDPRODUCT;
  151. typedef struct __PMLICENSETOBERETURN {
  152. DWORD dwQuantity;
  153. DWORD dwProductVersion;
  154. LPTSTR pszOrgProductId;
  155. LPTSTR pszCompanyName;
  156. LPTSTR pszProductId;
  157. LPTSTR pszUserName;
  158. LPTSTR pszMachineName;
  159. DWORD dwPlatformID;
  160. BOOL bTemp;
  161. } PMLICENSETOBERETURN, *PPMLICENSETOBERETURN, *LPPMLICENSETOBERETURN;
  162. #ifdef __cplusplus
  163. class SE_Exception
  164. {
  165. private:
  166. unsigned int nSE;
  167. public:
  168. SE_Exception() {}
  169. SE_Exception(unsigned int n) : nSE(n) {}
  170. ~SE_Exception() {}
  171. //-------------------------------
  172. unsigned int
  173. getSeNumber()
  174. {
  175. return nSE;
  176. }
  177. };
  178. #endif
  179. #ifdef __cplusplus
  180. extern "C" {
  181. #endif
  182. //
  183. // Following API must be exported by policy module
  184. //
  185. POLICYSTATUS WINAPI
  186. PMReturnLicense(
  187. PMHANDLE hClient,
  188. ULARGE_INTEGER* pLicenseSerialNumber,
  189. PPMLICENSETOBERETURN pLicenseTobeReturn,
  190. PDWORD pdwLicenseStatus,
  191. PDWORD pdwPolicyErrCode
  192. );
  193. POLICYSTATUS WINAPI
  194. PMLicenseUpgrade(
  195. PMHANDLE hClient,
  196. DWORD dwProgressCode,
  197. PVOID pbProgressData,
  198. PVOID *ppbReturnData,
  199. PDWORD pdwPolicyErrCode
  200. );
  201. POLICYSTATUS WINAPI
  202. PMLicenseRequest(
  203. PMHANDLE client,
  204. DWORD dwProgressCode,
  205. PVOID pbProgressData,
  206. PVOID* pbNewProgressData,
  207. PDWORD pdwPolicyErrCode
  208. );
  209. void WINAPI
  210. PMTerminate();
  211. POLICYSTATUS WINAPI
  212. PMInitialize(
  213. DWORD dwLicenseServerVersion, // HIWORD is major, LOWORD is minor
  214. LPCTSTR pszCompanyName,
  215. LPCTSTR pszProductFamilyCode,
  216. PDWORD pdwNumProduct,
  217. PMSUPPORTEDPRODUCT** ppszSupportedProduct,
  218. PDWORD pdwPolicyErrCode
  219. );
  220. POLICYSTATUS WINAPI
  221. PMInitializeProduct(
  222. LPCTSTR pszCompanyName,
  223. LPCTSTR pszCHProductCode,
  224. LPCTSTR pszTLSProductCode,
  225. PDWORD pdwPolicyErrCode
  226. );
  227. POLICYSTATUS WINAPI
  228. PMUnloadProduct(
  229. LPCTSTR pszCompanyName,
  230. LPCTSTR pszCHProductCode,
  231. LPCTSTR pszTLSProductCode,
  232. PDWORD pdwPolicyErrCode
  233. );
  234. POLICYSTATUS WINAPI
  235. PMRegisterLicensePack(
  236. PMHANDLE client,
  237. DWORD dwProgressCode,
  238. PVOID pbProgressData,
  239. PVOID pbNewProgressData,
  240. PDWORD pdwPolicyErrCode
  241. );
  242. #ifdef __cplusplus
  243. }
  244. #endif
  245. #endif