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.

161 lines
4.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1997.
  5. //
  6. // File: context.c
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 12-12-97 v-sbhatt Created
  15. // 12-18-97 v-sbhatt Modified
  16. //
  17. //----------------------------------------------------------------------------
  18. #ifndef _STORE_H_
  19. #define _STORE_H_
  20. #ifdef CALL_TYPE
  21. #undef CALL_TYPE
  22. #endif //CALL_TYPE
  23. #ifndef OS_WINCE
  24. #define CALL_TYPE _stdcall
  25. #else
  26. #define CALL_TYPE
  27. #endif
  28. #ifndef OUT
  29. #define OUT
  30. #endif //OUT
  31. #ifndef IN
  32. #define IN
  33. #endif //IN
  34. typedef DWORD LS_STATUS;
  35. #define LSSTAT_SUCCESS 0x00
  36. #define LSSTAT_ERROR 0x01
  37. #define LSSTAT_INSUFFICIENT_BUFFER 0x02
  38. #define LSSTAT_LICENSE_NOT_FOUND 0x03
  39. #define LSSTAT_OUT_OF_MEMORY 0x04
  40. #define LSSTAT_INVALID_HANDLE 0x05
  41. #define LSSTAT_LICENSE_EXISTS 0x06
  42. //Adding or replacing flags, to be used in LSAddLicenseToStore
  43. #define LS_REPLACE_LICENSE_OK 0x00000001
  44. #define LS_REPLACE_LICENSE_ERR 0x00000000
  45. //This is the License Store index structure. Licenses are queried against this index
  46. typedef struct tagLSINDEX
  47. {
  48. DWORD dwVersion; //Uper two bytes major version and lower two bytes Minor version
  49. DWORD cbScope;
  50. BYTE FAR *pbScope; //Scope for the license
  51. DWORD cbCompany;
  52. BYTE FAR *pbCompany; //Manufacturer
  53. DWORD cbProductID;
  54. BYTE FAR *pbProductID;//Product ID of the product for which the License is intended to be
  55. }LSINDEX, FAR * PLSINDEX;
  56. #ifdef OS_WIN32
  57. //Might not be necessay at all!!!!
  58. typedef LS_STATUS (*PLSENUMPROC)(
  59. IN HANDLE hLicense,
  60. IN PLSINDEX plsiName, //License Index Name
  61. IN DWORD dwUIParam //User Parameter
  62. );
  63. #endif //OS_WIN32
  64. //Open a specified store. If the szStoreName is NULL, it will open default store
  65. //Otherwise it will open the store specified by szStoreName parameter
  66. LS_STATUS
  67. CALL_TYPE
  68. LSOpenLicenseStore(
  69. OUT HANDLE *hStore, //The handle of the store
  70. IN LPCTSTR szStoreName, //Optional store Name
  71. IN BOOL fReadOnly //whether to open read-only
  72. );
  73. //Closes an open store
  74. LS_STATUS
  75. CALL_TYPE
  76. LSCloseLicenseStore(
  77. IN HANDLE hStore //Handle of the store to be closed!
  78. );
  79. //Add or updates/replaces license against a given LSINDEX in an open store
  80. //pointed by hStore
  81. LS_STATUS
  82. CALL_TYPE
  83. LSAddLicenseToStore(
  84. IN HANDLE hStore, //Handle of a open store
  85. IN DWORD dwFlags,//Flags either add or replace
  86. IN PLSINDEX plsiName, //Index against which License is added
  87. IN BYTE FAR *pbLicenseInfo, //License info to be added
  88. IN DWORD cbLicenseInfo // size of the License info blob
  89. );
  90. //Deletes a license from the store refered by hStore and against the given LSINDEX
  91. LS_STATUS
  92. CALL_TYPE
  93. LSDeleteLicenseFromStore(
  94. IN HANDLE hStore, //Handle of a open store
  95. IN PLSINDEX plsiName //Index of the license to be deleted
  96. );
  97. //Finds a license in an open store against a particular store Index
  98. LS_STATUS
  99. CALL_TYPE
  100. LSFindLicenseInStore(
  101. IN HANDLE hStore, //Handle of a open store
  102. IN PLSINDEX plsiName, //LSIndex against which store is searched
  103. IN OUT DWORD FAR *pdwLicenseInfoLen, //Size of the license found
  104. OUT BYTE FAR *pbLicenseInfo //License Data
  105. );
  106. LS_STATUS
  107. CALL_TYPE
  108. LSEnumLicenses(
  109. IN HANDLE hStore, //Handle of a open store
  110. IN DWORD dwIndex, //numeric Index of the license to query
  111. OUT PLSINDEX plsindex //The LSIndex structure corresponding to dwIndex
  112. );
  113. LS_STATUS
  114. CALL_TYPE
  115. LSQueryInfoLicense(
  116. IN HANDLE hStore, //Handle of a open store
  117. OUT DWORD FAR *pdwLicenses, //Total no. of licenses available
  118. OUT DWORD FAR *pdwMaxCompanyNameLen, //Maximum length of the company length
  119. OUT DWORD FAR *pdwMaxScopeLen, //Maximum length of the company length
  120. OUT DWORD FAR *pdwMaxProductIdLen //Maximum length of the company length
  121. );
  122. LS_STATUS
  123. CALL_TYPE
  124. LSOpenLicenseHandle(
  125. IN HANDLE hStore, //Handle of a open store
  126. IN BOOL fReadOnly,
  127. IN PLSINDEX plsiName,
  128. OUT HANDLE *phStore //Handle of a open store
  129. );
  130. LS_STATUS
  131. CALL_TYPE
  132. LSCloseLicenseHandle(
  133. IN HANDLE hStore, //Handle of a open store
  134. IN DWORD dwFlags //For future Use
  135. );
  136. #endif //_STORE_H_