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.

211 lines
5.9 KiB

  1. /*++
  2. Copyright (c) 1998-99 Microsoft Corporation
  3. Module Name:
  4. licekpak.h
  5. Abstract:
  6. Author:
  7. Fred Chong (FredCh) 7/1/1998
  8. Environment:
  9. Notes:
  10. --*/
  11. #ifndef _LICE_KEYPACK_H_
  12. #define _LICE_KEYPACK_H_
  13. #include <windows.h>
  14. #include <wincrypt.h>
  15. ///////////////////////////////////////////////////////////////////////////////
  16. // keypack description
  17. //
  18. typedef struct _KeyPack_Description
  19. {
  20. LCID Locale; // Locale ID
  21. DWORD cbProductName; // product name
  22. PBYTE pbProductName; // product name
  23. DWORD cbDescription; // Number of bytes in the description string
  24. PBYTE pDescription; // Pointer to the description string
  25. } KeyPack_Description, * PKeyPack_Description;
  26. ///////////////////////////////////////////////////////////////////////////////
  27. // License keypack content
  28. ///////////////////////////////////////////////////////////////////////////////
  29. //
  30. // License keypack version
  31. //
  32. #define LICENSE_KEYPACK_VERSION_1_0 0x00010000
  33. //
  34. // License keypack type
  35. //
  36. #define LICENSE_KEYPACK_TYPE_SELECT 0x00000001
  37. #define LICENSE_KEYPACK_TYPE_MOLP 0x00000002
  38. #define LICENSE_KEYPACK_TYPE_RETAIL 0x00000003
  39. //
  40. // License keypack distribution channel identifiers
  41. //
  42. #define LICENSE_DISTRIBUTION_CHANNEL_OEM 0x00000001
  43. #define LICENSE_DISTRIBUTION_CHANNEL_RETAIL 0x00000002
  44. //
  45. // License Keypack encryption information.
  46. //
  47. #define LICENSE_KEYPACK_ENCRYPT_CRYPTO 0x00000000
  48. #define LICENSE_KEYPACK_ENCRYPT_ALWAYSCRYPTO 0x00000001
  49. #define LICENSE_KEYPACK_ENCRYPT_MIN LICENSE_KEYPACK_ENCRYPT_CRYPTO
  50. #define LICENSE_KEYPACK_ENCRYPT_MAX LICENSE_KEYPACK_ENCRYPT_ALWAYSCRYPTO
  51. typedef struct __LicensePackEncodeParm {
  52. DWORD dwEncodeType;
  53. HCRYPTPROV hCryptProv;
  54. PBYTE pbEncryptParm; // depends on dwEncodeType
  55. DWORD cbEncryptParm;
  56. } LicensePackEncodeParm, *PLicensePackEncodeParm;
  57. typedef struct __LicensePackDecodeParm {
  58. HCRYPTPROV hCryptProv;
  59. //
  60. // Private binaries to generate encryption key to decrypt
  61. // license key pack blob.
  62. //
  63. // Private binaries to generate encryption key, this field is
  64. // ignore if key pack blob is encrypted using certificates.
  65. //
  66. PBYTE pbDecryptParm;
  67. DWORD cbDecryptParm;
  68. //
  69. // Certificate to generate encryption key, these fields are
  70. // require even data is encryped using private binaries.
  71. //
  72. DWORD cbClearingHouseCert;
  73. PBYTE pbClearingHouseCert;
  74. DWORD cbRootCertificate;
  75. PBYTE pbRootCertificate;
  76. } LicensePackDecodeParm, *PLicensePackDecodeParm;
  77. ///////////////////////////////////////////////////////////////////////////////
  78. // Content of license keypack
  79. //
  80. typedef struct _License_KeyPack_
  81. {
  82. DWORD dwVersion; // version of this structure
  83. DWORD dwKeypackType; // Select, MOLP, Retail
  84. DWORD dwDistChannel; // Distribution channel: OEM/Retail
  85. GUID KeypackSerialNum; // CH assigned serial number for this key pack
  86. FILETIME IssueDate; // Keypack issue date
  87. FILETIME ActiveDate; // License active date
  88. FILETIME ExpireDate; // License expiration date
  89. DWORD dwBeginSerialNum; // beginning serial number for the licenses in the keypack
  90. DWORD dwQuantity; // Number of licenses in the key pack
  91. DWORD cbProductId; // product ID
  92. PBYTE pbProductId; // product ID
  93. DWORD dwProductVersion; // product version
  94. DWORD dwPlatformId; // platform ID: Windows, Mac, UNIX etc...
  95. DWORD dwLicenseType; // new, upgrade, competitive upgrade etc...
  96. DWORD dwDescriptionCount; // The number of human language descriptions
  97. PKeyPack_Description pDescription; // pointer to an array of keypack description
  98. DWORD cbManufacturer; // The number of bytes in the manufacturer string
  99. PBYTE pbManufacturer; // The manufacturer string
  100. DWORD cbManufacturerData; // The number of bytes in the manufacturer-specific data
  101. PBYTE pbManufacturerData; // Points to the manufacturer specific data
  102. } License_KeyPack, * PLicense_KeyPack;
  103. #define LICENSEPACKENCODE_VERSION LICENSE_KEYPACK_VERSION_1_0
  104. #define LICENSEPACKENCODE_CURRENTVERSION LICENSEPACKENCODE_VERSION
  105. #define LICENSEPACKENCODE_SIGNATURE 0xF0F0F0F0
  106. typedef struct __EncodedLicenseKeyPack {
  107. DWORD dwSignature; // old encoding puts size of encryption key.
  108. DWORD dwStructVersion;
  109. DWORD dwEncodeType;
  110. DWORD cbData;
  111. BYTE pbData[1];
  112. } EncodedLicenseKeyPack, *PEncodedLicenseKeyPack;
  113. #ifdef __cplusplus
  114. extern "C" {
  115. #endif
  116. ///////////////////////////////////////////////////////////////////////////////
  117. //
  118. // Exported functions
  119. //
  120. DWORD WINAPI
  121. DecodeLicenseKeyPack(
  122. PLicense_KeyPack pLicenseKeyPack,
  123. HCRYPTPROV hCryptProv,
  124. DWORD cbClearingHouseCert,
  125. PBYTE pbClearingHouseCert,
  126. DWORD cbRootCertificate,
  127. PBYTE pbRootCertificate,
  128. DWORD cbKeyPackBlob,
  129. PBYTE pbKeyPackBlob );
  130. DWORD WINAPI
  131. DecodeLicenseKeyPackEx(
  132. OUT PLicense_KeyPack pLicenseKeyPack,
  133. IN PLicensePackDecodeParm pDecodeParm,
  134. IN DWORD cbKeyPackBlob,
  135. IN PBYTE pbKeyPackBlob
  136. );
  137. #ifdef __cplusplus
  138. }
  139. #endif
  140. #endif