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.

214 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_ALWAYSFRENCH 0x00000002
  50. #define LICENSE_KEYPACK_ENCRYPT_NONE 0x00000003
  51. #define LICENSE_KEYPACK_ENCRYPT_PRIVATE 0x00000004
  52. #define LICENSE_KEYPACK_ENCRYPT_MIN LICENSE_KEYPACK_ENCRYPT_CRYPTO
  53. #define LICENSE_KEYPACK_ENCRYPT_MAX LICENSE_KEYPACK_ENCRYPT_PRIVATE
  54. typedef struct __LicensePackEncodeParm {
  55. DWORD dwEncodeType;
  56. HCRYPTPROV hCryptProv;
  57. PBYTE pbEncryptParm; // depends on dwEncodeType
  58. DWORD cbEncryptParm;
  59. } LicensePackEncodeParm, *PLicensePackEncodeParm;
  60. typedef struct __LicensePackDecodeParm {
  61. HCRYPTPROV hCryptProv;
  62. //
  63. // Private binaries to generate encryption key to decrypt
  64. // license key pack blob.
  65. //
  66. // Private binaries to generate encryption key, this field is
  67. // ignore if key pack blob is encrypted using certificates.
  68. //
  69. PBYTE pbDecryptParm;
  70. DWORD cbDecryptParm;
  71. //
  72. // Certificate to generate encryption key, these fields are
  73. // require even data is encryped using private binaries.
  74. //
  75. DWORD cbClearingHouseCert;
  76. PBYTE pbClearingHouseCert;
  77. DWORD cbRootCertificate;
  78. PBYTE pbRootCertificate;
  79. } LicensePackDecodeParm, *PLicensePackDecodeParm;
  80. ///////////////////////////////////////////////////////////////////////////////
  81. // Content of license keypack
  82. //
  83. typedef struct _License_KeyPack_
  84. {
  85. DWORD dwVersion; // version of this structure
  86. DWORD dwKeypackType; // Select, MOLP, Retail
  87. DWORD dwDistChannel; // Distribution channel: OEM/Retail
  88. GUID KeypackSerialNum; // CH assigned serial number for this key pack
  89. FILETIME IssueDate; // Keypack issue date
  90. FILETIME ActiveDate; // License active date
  91. FILETIME ExpireDate; // License expiration date
  92. DWORD dwBeginSerialNum; // beginning serial number for the licenses in the keypack
  93. DWORD dwQuantity; // Number of licenses in the key pack
  94. DWORD cbProductId; // product ID
  95. PBYTE pbProductId; // product ID
  96. DWORD dwProductVersion; // product version
  97. DWORD dwPlatformId; // platform ID: Windows, Mac, UNIX etc...
  98. DWORD dwLicenseType; // new, upgrade, competitive upgrade etc...
  99. DWORD dwDescriptionCount; // The number of human language descriptions
  100. PKeyPack_Description pDescription; // pointer to an array of keypack description
  101. DWORD cbManufacturer; // The number of bytes in the manufacturer string
  102. PBYTE pbManufacturer; // The manufacturer string
  103. DWORD cbManufacturerData; // The number of bytes in the manufacturer-specific data
  104. PBYTE pbManufacturerData; // Points to the manufacturer specific data
  105. } License_KeyPack, * PLicense_KeyPack;
  106. #define LICENSEPACKENCODE_VERSION LICENSE_KEYPACK_VERSION_1_0
  107. #define LICENSEPACKENCODE_CURRENTVERSION LICENSEPACKENCODE_VERSION
  108. #define LICENSEPACKENCODE_SIGNATURE 0xF0F0F0F0
  109. typedef struct __EncodedLicenseKeyPack {
  110. DWORD dwSignature; // old encoding puts size of encryption key.
  111. DWORD dwStructVersion;
  112. DWORD dwEncodeType;
  113. DWORD cbData;
  114. BYTE pbData[1];
  115. } EncodedLicenseKeyPack, *PEncodedLicenseKeyPack;
  116. #ifdef __cplusplus
  117. extern "C" {
  118. #endif
  119. ///////////////////////////////////////////////////////////////////////////////
  120. //
  121. // Exported functions
  122. //
  123. DWORD WINAPI
  124. DecodeLicenseKeyPack(
  125. PLicense_KeyPack pLicenseKeyPack,
  126. HCRYPTPROV hCryptProv,
  127. DWORD cbClearingHouseCert,
  128. PBYTE pbClearingHouseCert,
  129. DWORD cbRootCertificate,
  130. PBYTE pbRootCertificate,
  131. DWORD cbKeyPackBlob,
  132. PBYTE pbKeyPackBlob );
  133. DWORD WINAPI
  134. DecodeLicenseKeyPackEx(
  135. OUT PLicense_KeyPack pLicenseKeyPack,
  136. IN PLicensePackDecodeParm pDecodeParm,
  137. IN DWORD cbKeyPackBlob,
  138. IN PBYTE pbKeyPackBlob
  139. );
  140. #ifdef __cplusplus
  141. }
  142. #endif
  143. #endif