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.

1026 lines
34 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996-1997
  5. //
  6. // File:
  7. //
  8. // Contents: IDL source for Hydra License Server
  9. //
  10. //---------------------------------------------------------------------------
  11. [
  12. uuid(3d267954-eeb7-11d1-b94e-00c04fa3080d),
  13. version(1.0),
  14. pointer_default(unique)
  15. ]
  16. interface TermServLicensing
  17. {
  18. import "wtypes.idl";
  19. import "license.idl";
  20. import "tlsapi.idl";
  21. cpp_quote("#include <wincrypt.h>")
  22. #include "tlsdef.h"
  23. typedef [context_handle] void* PCONTEXT_HANDLE;
  24. typedef [ref] PCONTEXT_HANDLE* PPCONTEXT_HANDLE;
  25. typedef BYTE PERSISTENTBYTE;
  26. typedef PERSISTENTBYTE* PPERSISTENTBYTE;
  27. cpp_quote("#define TLSANNOUNCE_TYPE_STARTUP 1")
  28. cpp_quote("#define TLSANNOUNCE_TYPE_RESPONSE 2")
  29. //
  30. // Structure for replication
  31. //
  32. typedef struct __ReplVersion {
  33. DWORD dwVersion;
  34. [string] TCHAR szInstallId[LSERVER_MAX_STRING_SIZE+1];
  35. [size_is(cbDomainSid)] PBYTE pbDomainSid;
  36. DWORD cbDomainSid;
  37. } TLSReplVersion, *PTLSReplVersion, *LPTLSReplVersion;
  38. typedef struct __ReplLicensePack {
  39. UCHAR ucEntryStatus; // entry status, for backup.
  40. DWORD dwKeyPackId; // internal tracking number
  41. FILETIME ftLastModifyTime; // last modification time
  42. DWORD dwAttribute; // keypack attribute
  43. DWORD dwNextSerialNumber; // next keypack serial number
  44. DWORD dwActivateDate; // activation date
  45. DWORD dwExpirationDate;
  46. DWORD dwNumberOfLicenses; // number of license issued or used
  47. UCHAR ucKeyPackStatus; // keypack status.
  48. [size_is(cbDomainSid)] PBYTE pbDomainSid;
  49. DWORD cbDomainSid;
  50. [string] TCHAR szInstallId[LSERVER_MAX_STRING_SIZE+1];
  51. [string] TCHAR szDomainName[LSERVER_MAX_STRING_SIZE + 1];
  52. [string] TCHAR szTlsServerName[LSERVER_MAX_STRING_SIZE + 1];
  53. //
  54. // Standard KeyPack Property..
  55. //
  56. [string] TCHAR szKeyPackId[ LSERVER_MAX_STRING_SIZE + 1 ];
  57. UCHAR ucAgreementType;
  58. [string] TCHAR szCompanyName[ LSERVER_MAX_STRING_SIZE + 1 ];
  59. [string] TCHAR szProductId[ LSERVER_MAX_STRING_SIZE + 1 ];
  60. WORD wMajorVersion;
  61. WORD wMinorVersion;
  62. DWORD dwPlatformType;
  63. UCHAR ucLicenseType;
  64. UCHAR ucChannelOfPurchase;
  65. [string] TCHAR szBeginSerialNumber[ LSERVER_MAX_STRING_SIZE + 1 ];
  66. DWORD dwTotalLicenseInKeyPack;
  67. DWORD dwProductFlags;
  68. } TLSReplLicensePack, *PTLSReplLicensePack, *LPTLSReplLicensePack;
  69. typedef struct _ReplLicPackDesc {
  70. UCHAR ucEntryStatus;
  71. DWORD dwKeyPackId;
  72. DWORD dwLanguageId;
  73. FILETIME ftLastModifyTime;
  74. [string] TCHAR szCompanyName[ LSERVER_MAX_STRING_SIZE + 1 ];
  75. [string] TCHAR szProductName[ LSERVER_MAX_STRING_SIZE + 1 ];
  76. [string] TCHAR szProductDesc[ LSERVER_MAX_STRING_SIZE + 1 ];
  77. } TLSReplLicPackDesc, *LPTLSReplLicPackDesc, *PTLSReplLicPackDesc;
  78. typedef struct __ReplLicenseClient {
  79. UCHAR ucEntryStatus;
  80. DWORD dwLicenseId;
  81. DWORD dwKeyPackId;
  82. DWORD dwKeyPackLicenseId;
  83. FILETIME ftLastModifyTime;
  84. [string] TCHAR szMachineName[ MAXCOMPUTERNAMELENGTH ];
  85. [string] TCHAR szUserName[ MAXUSERNAMELENGTH ];
  86. DWORD ftIssueDate;
  87. DWORD ftExpireDate;
  88. UCHAR ucLicenseStatus;
  89. DWORD dwNumLicenses;
  90. LONG dwSystemBiosChkSum;
  91. LONG dwVideoBiosChkSum;
  92. LONG dwFloppyBiosChkSum;
  93. LONG dwHardDiskSize;
  94. LONG dwRamSize;
  95. double dbLowerBound;
  96. } TLSReplLicenseClient, *LPTLSReplLicenseClient, *PTLSReplLicenseClient;
  97. typedef struct __ReplWorkItem {
  98. DWORD dwScheduledTime;
  99. DWORD dwRestartTime;
  100. DWORD dwJobType;
  101. DWORD cbData;
  102. [size_is(cbData)] PBYTE pbData;
  103. } TLSReplWorkItem, *LPTLSReplWorkItem, *PTLSReplWorkItem;
  104. cpp_quote("#define UNION_TYPE_VERSION 1")
  105. cpp_quote("#define UNION_TYPE_LICENSEPACK 2")
  106. cpp_quote("#define UNION_TYPE_LICENSEPACKDESC 3")
  107. cpp_quote("#define UNION_TYPE_LICENSEDCLIENT 4")
  108. cpp_quote("#define UNION_TYPE_WORKITEM 5")
  109. cpp_quote("#define REPLICATIONCODE_SYNC 1")
  110. cpp_quote("#define REPLICATIONCODE_BACKUP 2")
  111. cpp_quote("#define REPLICATIONCODE_NEW 3")
  112. typedef [switch_type(DWORD)] union _TLSReplRecordUnion {
  113. [case(1)]
  114. TLSReplVersion ReplVersion;
  115. [case(2)]
  116. TLSReplLicensePack ReplLicPack;
  117. [case(3)]
  118. TLSReplLicPackDesc ReplLicPackDesc;
  119. [case(4)]
  120. TLSReplLicenseClient ReplLicClient;
  121. [case(5)]
  122. TLSReplWorkItem ReplWorkItem;
  123. } TLSReplRecordUnion;
  124. typedef struct _TLSReplRecord {
  125. [switch_is(dwUnionType)] TLSReplRecordUnion w;
  126. DWORD dwUnionType;
  127. DWORD dwReplCode;
  128. } TLSReplRecord, *PTLSReplRecord, *LPTLSReplRecord;
  129. //
  130. // Structure for license request
  131. //
  132. typedef struct _TLSProductInfo
  133. {
  134. DWORD dwVersion;
  135. DWORD cbCompanyName;
  136. [size_is(cbCompanyName)] PBYTE pbCompanyName;
  137. DWORD cbProductID;
  138. [size_is(cbProductID)] PBYTE pbProductID;
  139. } TLSPRODUCTINFO, *LPTLSPRODUCTINFO, *PTLSPRODUCTINFO;
  140. typedef struct _TLSLicenseRequest {
  141. DWORD cbEncryptedHwid;
  142. [size_is(cbEncryptedHwid)] PBYTE pbEncryptedHwid;
  143. DWORD dwLanguageID;
  144. DWORD dwPlatformID;
  145. TLSPRODUCTINFO ProductInfo;
  146. } TLSLICENSEREQUEST, *LPTLSLICENSEREQUEST, *PTLSLICENSEREQUEST;
  147. cpp_quote("#if 0")
  148. typedef struct _TLSBLOB {
  149. DWORD cbData;
  150. [size_is(cbData)] PPERSISTENTBYTE pbData;
  151. } TLSBLOB;
  152. typedef struct _TLSCRYPT_BIT_BLOB {
  153. DWORD cbData;
  154. [size_is(cbData)] PPERSISTENTBYTE pbData;
  155. DWORD cUnusedBits;
  156. } TLSCRYPT_BIT_BLOB, *PTLSCRYPT_BIT_BLOB, *LPTLSCRYPT_BIT_BLOB;
  157. typedef struct _TLSCRYPT_ALGORITHM_IDENTIFIER {
  158. [string] LPSTR pszObjId;
  159. TLSBLOB Parameters;
  160. } TLSCRYPT_ALGORITHM_IDENTIFIER, *PTLSCRYPT_ALGORITHM_IDENTIFIER, *LPTLSCRYPT_ALGORITHM_IDENTIFIER;
  161. typedef struct _TLSCERT_PUBLIC_KEY_INFO {
  162. TLSCRYPT_ALGORITHM_IDENTIFIER Algorithm;
  163. TLSCRYPT_BIT_BLOB PublicKey;
  164. } TLSCERT_PUBLIC_KEY_INFO, *PTLSCERT_PUBLIC_KEY_INFO, *LPTLSCERT_PUBLIC_KEY_INFO;
  165. typedef struct _TLSCertExtension {
  166. [string] LPSTR pszObjId;
  167. BOOL fCritical;
  168. TLSBLOB Value;
  169. } TLSCERT_EXTENSION, *PTLSCERT_EXTENSION, *LPTLSCERT_EXTENSION;
  170. typedef struct _TLSCertExtensions {
  171. DWORD cExtension;
  172. [size_is(cExtension)] PTLSCERT_EXTENSION rgExtension;
  173. } TLSCERT_EXTENSIONS, *PTLSCERT_EXTENSIONS, *LPTLSCERT_EXTENSIONS;
  174. cpp_quote("#else")
  175. cpp_quote("typedef CERT_EXTENSIONS TLSCERT_EXTENSIONS;")
  176. cpp_quote("typedef TLSCERT_EXTENSIONS* PTLSCERT_EXTENSIONS;")
  177. cpp_quote("typedef TLSCERT_EXTENSIONS* LPTLSCERT_EXTENSIONS;")
  178. cpp_quote("typedef CERT_EXTENSION TLSCERT_EXTENSION;")
  179. cpp_quote("typedef TLSCERT_EXTENSION* PTLSCERT_EXTENSION;")
  180. cpp_quote("typedef TLSCERT_EXTENSION* LPTLSCERT_EXTENSION;")
  181. cpp_quote("typedef CERT_PUBLIC_KEY_INFO TLSCERT_PUBLIC_KEY_INFO;")
  182. cpp_quote("typedef TLSCERT_PUBLIC_KEY_INFO* PTLSCERT_PUBLIC_KEY_INFO;")
  183. cpp_quote("typedef TLSCERT_PUBLIC_KEY_INFO* LPTLSCERT_PUBLIC_KEY_INFO;")
  184. cpp_quote("typedef CRYPT_ALGORITHM_IDENTIFIER TLSCRYPT_ALGORITHM_IDENTIFIER;")
  185. cpp_quote("typedef TLSCRYPT_ALGORITHM_IDENTIFIER* PTLSCRYPT_ALGORITHM_IDENTIFIER;")
  186. cpp_quote("typedef TLSCRYPT_ALGORITHM_IDENTIFIER* LPTLSCRYPT_ALGORITHM_IDENTIFIER;")
  187. cpp_quote("typedef CRYPT_BIT_BLOB TLSCRYPT_BIT_BLOB;")
  188. cpp_quote("typedef TLSCRYPT_BIT_BLOB* PTLSCRYPT_BIT_BLOB;")
  189. cpp_quote("typedef TLSCRYPT_BIT_BLOB* LPTLSCRYPT_BIT_BLOB;")
  190. cpp_quote("typedef DATA_BLOB TLSBLOB;")
  191. cpp_quote("typedef TLSBLOB* PTLSBLOB;")
  192. cpp_quote("typedef TLSBLOB* LPTLSBLOB;")
  193. cpp_quote("#endif")
  194. typedef struct _TLSHydraCertRequest {
  195. DWORD dwHydraVersion;
  196. DWORD cbEncryptedHwid;
  197. [size_is(cbEncryptedHwid)] PPERSISTENTBYTE pbEncryptedHwid;
  198. [string] LPTSTR szSubjectRdn;
  199. PTLSCERT_PUBLIC_KEY_INFO pSubjectPublicKeyInfo;
  200. DWORD dwNumCertExtension;
  201. [size_is(dwNumCertExtension)] PTLSCERT_EXTENSION pCertExtensions;
  202. } TLSHYDRACERTREQUEST, *LPTLSHYDRACERTREQUEST, *PTLSHYDRACERTREQUEST;
  203. typedef struct _TLSKeyPackAuditParm {
  204. [string] LPTSTR szCompanyName;
  205. [string] LPTSTR szProductId;
  206. DWORD dwMajorVersion;
  207. DWORD dwMinorVersion;
  208. } TLSKeyPackAuditParm, *LPTLSKeyPackAuditParm, *PTLSKeyPackAuditParm;
  209. typedef struct _TLSKeyPackAudit {
  210. DWORD dwTotalLicensesIssued;
  211. DWORD dwTotalRevoked; // force revoked by license server
  212. DWORD dwTotalReturned; // return by user
  213. } TLSKeyPackAudit, *LPTLSKeyPackAudit, *PTLSKeyPackAudit;
  214. typedef struct _TLSLicenseToBeReturn {
  215. DWORD dwQuantity;
  216. DWORD dwKeyPackId;
  217. DWORD dwLicenseId;
  218. DWORD cbEncryptedHwid;
  219. [size_is(cbEncryptedHwid)] PBYTE pbEncryptedHwid;
  220. DWORD dwProductVersion;
  221. [string] LPTSTR pszOrgProductId;
  222. [string] LPTSTR pszCompanyName;
  223. [string] LPTSTR pszProductId;
  224. [string] LPTSTR pszUserName;
  225. [string] LPTSTR pszMachineName;
  226. DWORD dwPlatformID;
  227. } TLSLicenseToBeReturn, *LPTLSLicenseToBeReturn, *PTLSLicenseToBeReturn;
  228. typedef struct _TLSInternetLicense {
  229. [string] TCHAR szServerId[LSERVER_MAX_STRING_SIZE + 1];
  230. [string] TCHAR szServerName[ MAXCOMPUTERNAMELENGTH + 1 ];
  231. ULARGE_INTEGER ulSerialNumber;
  232. DWORD dwQuantity;
  233. } TLSInternetLicense, *PTLSInternetLicense, *LPTLSInternetLicense;
  234. //-----------------------------------------------------------------
  235. //
  236. // General routine
  237. //
  238. error_status_t
  239. TLSRpcGetVersion (
  240. [in] PCONTEXT_HANDLE phContext,
  241. [in, out, ref] PDWORD pdwVersion
  242. );
  243. error_status_t
  244. TLSRpcConnect(
  245. [in] handle_t binding,
  246. [out] PCONTEXT_HANDLE *pphContext
  247. );
  248. error_status_t
  249. TLSRpcDisconnect(
  250. [in, out] PPCONTEXT_HANDLE pphContext
  251. );
  252. error_status_t
  253. TLSRpcSendServerCertificate(
  254. [in] PCONTEXT_HANDLE phContext,
  255. [in] DWORD cbCert,
  256. [in, size_is(cbCert)] PBYTE pbCert,
  257. [in, out, ref] PDWORD pdwErrCode
  258. );
  259. error_status_t
  260. TLSRpcGetServerName(
  261. [in] PCONTEXT_HANDLE phContext,
  262. [in, out, string, size_is(*cbSize)] LPTSTR szMachineName,
  263. [in, out, ref] PDWORD cbSize,
  264. [in, out, ref] PDWORD pdwErrCode
  265. );
  266. error_status_t
  267. TLSRpcGetServerScope(
  268. [in] PCONTEXT_HANDLE phContext,
  269. [in, out, string, size_is(*cbSize)] LPTSTR szScopeName,
  270. [in, out, ref] PDWORD cbSize,
  271. [in, out, ref] PDWORD pdwErrCode
  272. );
  273. error_status_t
  274. TLSRpcGetInfo(
  275. [in] PCONTEXT_HANDLE phContext,
  276. [in] DWORD cbHSCert,
  277. [in, size_is(cbHSCert)] PBYTE pHSCert,
  278. [out, ref] DWORD* pcbLSCert,
  279. [out, size_is(, *pcbLSCert)] BYTE **pLSCert,
  280. [out, ref] DWORD* pcbLSSecretKey,
  281. [out, size_is(, *pcbLSSecretKey)] BYTE **pLSSecretKey,
  282. [in, out, ref] PDWORD pdwErrCode
  283. );
  284. error_status_t
  285. TLSRpcIssuePlatformChallenge(
  286. [in] PCONTEXT_HANDLE phContext,
  287. [in] DWORD dwClientInfo,
  288. [out, ref] PCHALLENGE_CONTEXT pChallengeContext,
  289. [out] PDWORD pcbChallengeData,
  290. [out, size_is(, *pcbChallengeData)] BYTE **pChallengeData,
  291. [in, out, ref] PDWORD pdwErrCode
  292. );
  293. error_status_t
  294. TLSRpcRequestNewLicense(
  295. [in] PCONTEXT_HANDLE phContext,
  296. [in] const CHALLENGE_CONTEXT ChallengeContext,
  297. [in] PTLSLICENSEREQUEST pRequest,
  298. [in, string] LPTSTR pMachineName,
  299. [in, string] LPTSTR pUserName,
  300. [in] const DWORD cbChallengeResponse,
  301. [in, size_is(cbChallengeResponse)] const PBYTE cbChallenge,
  302. [in] BOOL bAcceptTemporaryLicense,
  303. [out] PDWORD pcbLicense,
  304. [out, size_is(, *pcbLicense)] BYTE **pLicense,
  305. [in, out, ref] PDWORD pdwErrCode
  306. );
  307. error_status_t
  308. TLSRpcUpgradeLicense(
  309. [in] PCONTEXT_HANDLE phContext,
  310. [in] PTLSLICENSEREQUEST pRequest,
  311. [in] const CHALLENGE_CONTEXT ChallengeContext,
  312. [in] const DWORD cbChallengeResponse,
  313. [in, size_is(cbChallengeResponse)] const PBYTE cbChallenge,
  314. [in] DWORD cbOldLicense,
  315. [in, size_is(cbOldLicense)] PBYTE pOldLicense,
  316. [out] PDWORD pcbNewLicense,
  317. [out, size_is(, *pcbNewLicense)] PBYTE *pNewLicense,
  318. [in, out, ref] PDWORD pdwErrCode
  319. );
  320. error_status_t
  321. TLSRpcAllocateConcurrentLicense(
  322. [in] PCONTEXT_HANDLE phContext,
  323. [in, string] LPTSTR szHydraServer,
  324. [in] PTLSLICENSEREQUEST pRequest,
  325. [in, out, ref] LONG* dwQuantity,
  326. [in, out, ref] PDWORD pdwErrCode
  327. );
  328. error_status_t
  329. TLSRpcGetLastError(
  330. [in] PCONTEXT_HANDLE phContext,
  331. [in, out, ref] PDWORD cbBufferSize,
  332. [in, out, string, size_is(*cbBufferSize)] LPTSTR szBuffer,
  333. [in, out, ref] PDWORD pdwErrCode
  334. );
  335. //----------------------------------------------------------------------------------
  336. // License Key Pack related function
  337. error_status_t
  338. TLSRpcKeyPackEnumBegin(
  339. [in] PCONTEXT_HANDLE phContext,
  340. [in] DWORD dwSearchParm,
  341. [in] BOOL bMatchAll,
  342. [in, ref] LPLSKeyPackSearchParm lpSearchParm,
  343. [in, out, ref] PDWORD pdwErrCode
  344. );
  345. error_status_t
  346. TLSRpcKeyPackEnumNext(
  347. [in] PCONTEXT_HANDLE phContext,
  348. [out, ref] LPLSKeyPack lpKeyPack,
  349. [in, out, ref] PDWORD pdwErrCode
  350. );
  351. error_status_t
  352. TLSRpcKeyPackEnumEnd(
  353. [in] PCONTEXT_HANDLE phContext,
  354. [in, out, ref] PDWORD pdwErrCode
  355. );
  356. error_status_t
  357. TLSRpcKeyPackAdd(
  358. [in] PCONTEXT_HANDLE phContext,
  359. [in, out, ref] LPLSKeyPack lpKeypack,
  360. [in, out, ref] PDWORD dwErrCode
  361. );
  362. error_status_t
  363. TLSRpcKeyPackSetStatus(
  364. [in] PCONTEXT_HANDLE phContext,
  365. [in] DWORD dwSetParm,
  366. [in, ref] LPLSKeyPack lpKeyPack,
  367. [in, out, ref] PDWORD pdwErrCode
  368. );
  369. //----------------------------------------------------------------------------------
  370. // Issued Licenses related function
  371. error_status_t
  372. TLSRpcLicenseEnumBegin(
  373. [in] PCONTEXT_HANDLE phContext,
  374. [in] DWORD dwSearchParm,
  375. [in] BOOL bMatchAll,
  376. [in, ref] LPLSLicenseSearchParm lpSearchParm,
  377. [in, out, ref] PDWORD pdwErrCode
  378. );
  379. error_status_t
  380. TLSRpcLicenseEnumNext(
  381. [in] PCONTEXT_HANDLE phContext,
  382. [out, ref] LPLSLicense lpLicense,
  383. [in, out, ref] PDWORD pdwErrCode
  384. );
  385. error_status_t
  386. TLSRpcLicenseEnumEnd(
  387. [in] PCONTEXT_HANDLE phContext,
  388. [in, out, ref] PDWORD pdwErrCode
  389. );
  390. error_status_t
  391. TLSRpcLicenseSetStatus(
  392. [in] PCONTEXT_HANDLE phContext,
  393. [in] DWORD dwSetParam,
  394. [in] LPLSLicense lpLicense,
  395. [in, out, ref] PDWORD pdwErrCode
  396. );
  397. //----------------------------------------------------------------
  398. // General routine
  399. error_status_t
  400. TLSRpcGetAvailableLicenses(
  401. [in] PCONTEXT_HANDLE phContext,
  402. [in] DWORD dwSearchParm,
  403. [in, ref] LPLSKeyPack lplsKeyPack,
  404. [out, ref] LPDWORD lpdwAvail,
  405. [in, out, ref] PDWORD pdwErrCode
  406. );
  407. //-----------------------------------------------------------------
  408. // Administrative routine
  409. //
  410. error_status_t
  411. TLSRpcGetRevokeKeyPackList(
  412. [in] PCONTEXT_HANDLE phContext,
  413. [in, out] PDWORD pcbNumberOfRange,
  414. [out, size_is(, *pcbNumberOfRange)] LPLSRange* ppRevokeRange,
  415. [in, out, ref] PDWORD pdwErrCode
  416. );
  417. error_status_t
  418. TLSRpcGetRevokeLicenseList(
  419. [in] PCONTEXT_HANDLE phContext,
  420. [in, out] PDWORD pcbNumberOfRange,
  421. [out, size_is(, *pcbNumberOfRange)] LPLSRange* ppRevokeRange,
  422. [in, out, ref] PDWORD pdwErrCode
  423. );
  424. error_status_t
  425. TLSRpcReturnKeyPack(
  426. [in] PCONTEXT_HANDLE phContext,
  427. [in] DWORD dwKeyPackId,
  428. [in] DWORD dwReturnReason,
  429. [in, out, ref] PDWORD pdwErrCode
  430. );
  431. error_status_t
  432. TLSRpcReturnLicense(
  433. [in] PCONTEXT_HANDLE phContext,
  434. [in] DWORD dwKeyPackId,
  435. [in] DWORD dwLicenseId,
  436. [in] DWORD dwRetrunReason,
  437. [in, out, ref] PDWORD pdwErrCode
  438. );
  439. error_status_t
  440. TLSRpcAuditLicenseKeyPack(
  441. [in] PCONTEXT_HANDLE phContext,
  442. [in] DWORD dwKeyPackId,
  443. [in] FILETIME ftStartTime,
  444. [in] FILETIME ftEndTime,
  445. [in] BOOL bResetCounter,
  446. [in, out, ref] LPTLSKeyPackAudit lplsAudit,
  447. [in, out, ref] PDWORD pdwErrCode
  448. );
  449. error_status_t
  450. TLSRpcInstallPolicyModule(
  451. [in] PCONTEXT_HANDLE phContext,
  452. [in, string] LPTSTR pszCompanyName,
  453. [in, string] LPTSTR pszProductId,
  454. [in, string] LPTSTR pszPolicyDllName,
  455. [in, out, ref] PDWORD pdwErrCode
  456. );
  457. //--------------------------------------------------------------------
  458. //
  459. // replication calls
  460. //
  461. error_status_t
  462. TLSRpcBeginReplication(
  463. [in] PCONTEXT_HANDLE phContext,
  464. [in, string] LPTSTR pszLsSetupId,
  465. [in, string] LPTSTR pszLsServerName,
  466. [in] DWORD cbDomainSid,
  467. [in, size_is(cbDomainSid)] PBYTE pbDomainSid,
  468. [in, out, ref] FILETIME* pftLastBackupTime,
  469. [in, out, ref] PDWORD pdwErrCode
  470. );
  471. error_status_t
  472. TLSRpcEndReplication(
  473. [in] PCONTEXT_HANDLE phContext
  474. );
  475. error_status_t
  476. TLSRpcReplicateRecord(
  477. [in] PCONTEXT_HANDLE phContext,
  478. [in, ref] PTLSReplRecord pReplRecord,
  479. [in, out, ref] PDWORD pdwErrCode
  480. );
  481. error_status_t
  482. TLSRpcTableEnumBegin(
  483. [in] PCONTEXT_HANDLE phContext,
  484. [in] DWORD dwSearchParam,
  485. [in, ref] PTLSReplRecord pRecord,
  486. [in, out, ref] PDWORD pdwErrCode
  487. );
  488. error_status_t
  489. TLSRpcTableEnumNext(
  490. [in] PCONTEXT_HANDLE phContext,
  491. [in, out, ref] PTLSReplRecord pRecord,
  492. [in, out, ref] PDWORD pdwErrCode
  493. );
  494. error_status_t
  495. TLSRpcTableEnumEnd(
  496. [in] PCONTEXT_HANDLE phContext
  497. );
  498. //---------------------------------------------------------------------------------
  499. error_status_t
  500. TLSRpcRequestTermServCert(
  501. [in] PCONTEXT_HANDLE phContext,
  502. [in] PTLSHYDRACERTREQUEST pbRequest,
  503. [in, out, ref] PDWORD cbChallengeData,
  504. [out, size_is(, *cbChallengeData)] PBYTE* pbChallengeData,
  505. [in, out, ref] PDWORD pdwErrCode
  506. );
  507. error_status_t
  508. TLSRpcRetrieveTermServCert(
  509. [in] PCONTEXT_HANDLE phContext,
  510. [in] DWORD cbResponseData,
  511. [in, size_is(cbResponseData)] PBYTE pbResponseData,
  512. [in, out, ref] PDWORD pbCert,
  513. [out, size_is(, *pbCert)] PBYTE* cbCert,
  514. [in, out, ref] PDWORD pdwErrCode
  515. );
  516. //---------------------------------------------------------------------------------
  517. //
  518. // Clearing House specific routine
  519. //
  520. error_status_t
  521. TLSRpcInstallCertificate(
  522. [in] PCONTEXT_HANDLE phContext,
  523. [in] DWORD dwCertType,
  524. [in] DWORD dwCertLevel,
  525. [in] DWORD cbSingnatureCert,
  526. [in, size_is(cbSingnatureCert)] PBYTE pbSingnatureCert,
  527. [in] DWORD cbExchangeCert,
  528. [in, size_is(cbExchangeCert)] PBYTE pbExchangeCert,
  529. [in, out, ref] PDWORD pdwErrCode
  530. );
  531. error_status_t
  532. TLSRpcGetServerCertificate(
  533. [in] PCONTEXT_HANDLE phContext,
  534. [in] BOOL bSignCert,
  535. [out, size_is(, *lpdwCertBlobLen)] PBYTE *ppCertBlob,
  536. [out, ref] LPDWORD lpdwCertBlobLen,
  537. [in, out, ref] PDWORD pdwErrCode
  538. );
  539. error_status_t
  540. TLSRpcRegisterLicenseKeyPack(
  541. [in] PCONTEXT_HANDLE phContext,
  542. [in, size_is(cbCHCertBlobSize)] PBYTE pbCHCertBlob,
  543. [in] DWORD cbCHCertBlobSize,
  544. [in, size_is(cbRootCertBlob)] PBYTE pbRootCertBlob,
  545. [in] DWORD cbRootCertBlob,
  546. [in, size_is(dwKeyPackBlobLen)] PBYTE lpKeyPackBlob,
  547. [in] DWORD dwKeyPackBlobLen,
  548. [in, out, ref] PDWORD pdwErrCode
  549. );
  550. error_status_t
  551. TLSRpcGetLSPKCS10CertRequest(
  552. [in] PCONTEXT_HANDLE phContext,
  553. [in] DWORD dwCertType,
  554. [in, out, ref] PDWORD pcbdata,
  555. [out, size_is(, *pcbdata)] PBYTE* ppbData,
  556. [in, out, ref] PDWORD pdwErrCode
  557. );
  558. //----------------------------------------------------------------------------------
  559. error_status_t
  560. TLSRpcAnnounceServer(
  561. [in] PCONTEXT_HANDLE phContext,
  562. [in] DWORD dwAnnounceType,
  563. [in] FILETIME* pLastShutdownTime,
  564. [in, string] LPTSTR pszSetupId,
  565. [in, string] LPTSTR pszDomainName,
  566. [in, string] LPTSTR pszLserverName,
  567. [in, out, ref] PDWORD pdwErrCode
  568. );
  569. //----------------------------------------------------------------------------------
  570. error_status_t
  571. TLSRpcLookupServer(
  572. [in] PCONTEXT_HANDLE phContext,
  573. [in, string] LPTSTR pszLookupSetupId,
  574. [in, out, string, size_is(*pcbSetupId)] LPTSTR pszLsSetupId,
  575. [in, out] PDWORD pcbSetupId,
  576. [in, out, string, size_is(*pcbDomainName)] LPTSTR pszDomainName,
  577. [in, out, ref] PDWORD pcbDomainName,
  578. [in, out, string, size_is(*pcbMachineName)] LPTSTR pszLsName,
  579. [in, out, ref] PDWORD pcbMachineName,
  580. [in, out, ref] PDWORD pdwErrCode
  581. );
  582. error_status_t
  583. TLSRpcAnnounceLicensePack(
  584. [in] PCONTEXT_HANDLE phContext,
  585. [in] PTLSReplRecord pReplRecord,
  586. [in, out, ref] PDWORD pdwErrCode
  587. );
  588. error_status_t
  589. TLSRpcReturnLicensedProduct(
  590. [in] PCONTEXT_HANDLE phContext,
  591. [in] PTLSLicenseToBeReturn pClientLicense,
  592. [in, out, ref] PDWORD pdwErrCode
  593. );
  594. //---------------------------------------------------------------------------------
  595. //
  596. // New API for registration - internal routine not exported in tlsapi.dll,
  597. // use by License Server and registration wizard,
  598. //
  599. cpp_quote("#define TLS_CURRENT_CHALLENGE_VERSION 0x00010000")
  600. cpp_quote("#define CLIENT_TYPE_TLSERVER 0x00000001")
  601. cpp_quote("#define CLIENT_TYPE_LRWIZ 0x00000002")
  602. cpp_quote("#define CLIENT_TYPE_TERMSRV 0x00000003")
  603. typedef struct _TLSChallengeData
  604. {
  605. DWORD dwVersion;
  606. DWORD dwRandom;
  607. DWORD cbChallengeData;
  608. [size_is(cbChallengeData)] PBYTE pbChallengeData;
  609. DWORD cbReservedData;
  610. [size_is(cbReservedData)] PBYTE pbReservedData;
  611. } TLSCHALLENGEDATA, *PTLSCHALLENGEDATA;
  612. typedef struct _TLSChallengeResponseData
  613. {
  614. DWORD dwVersion;
  615. DWORD cbResponseData;
  616. [size_is(cbResponseData)] PBYTE pbResponseData;
  617. DWORD cbReservedData;
  618. [size_is(cbReservedData)] PBYTE pbReservedData;
  619. } TLSCHALLENGERESPONSEDATA, *PTLSCHALLENGERESPONSEDATA;
  620. error_status_t
  621. TLSRpcChallengeServer(
  622. [in] PCONTEXT_HANDLE phContext,
  623. [in] DWORD dwClientType,
  624. [in, ref] PTLSCHALLENGEDATA pClientChallenge,
  625. [out] PTLSCHALLENGERESPONSEDATA* pServerResponse,
  626. [out] PTLSCHALLENGEDATA* pServerChallenge,
  627. [in, out, ref] PDWORD pdwErrCode
  628. );
  629. error_status_t
  630. TLSRpcResponseServerChallenge(
  631. [in] PCONTEXT_HANDLE phContext,
  632. [in, ref] PTLSCHALLENGERESPONSEDATA pClientResponse,
  633. [in, out, ref] PDWORD pdwErrCode
  634. );
  635. cpp_quote("#define TLS_PRIVATEDATA_UNIQUEID 0x00000001")
  636. cpp_quote("#define TLS_PRIVATEDATA_PID 0x00000002")
  637. cpp_quote("#define TLS_PRIVATEDATA_SPK 0x00000003")
  638. cpp_quote("#define TLS_PRIVATEDATA_INSTALLED_CERT 0x00000004")
  639. cpp_quote("#define TLS_PRIVATEDATA_SYSTEMLANGID 0x00000005")
  640. cpp_quote("#define TLS_PRIVATEDATA_MIN TLS_PRIVATEDATA_UNIQUEID")
  641. cpp_quote("#define TLS_PRIVATEDATA_MAX TLS_PRIVATEDATA_SYSTEMLANGID")
  642. typedef struct __TLSPrivateDataSPK {
  643. DWORD cbSPK;
  644. [size_is(cbSPK)] PBYTE pbSPK;
  645. PTLSCERT_EXTENSIONS pCertExtensions;
  646. } TLSPrivateDataSPK, *PTLSPrivateDataSPK;
  647. typedef struct __TLSPrivateDataBinary {
  648. DWORD cbData;
  649. [size_is(cbData)] PBYTE pbData;
  650. } TLSPrivateDataBinary, *PTLSPrivateDataBinary;
  651. typedef struct __TLSPrivateDataInstallCertificate {
  652. DWORD dwCertType;
  653. DWORD dwFindFlags;
  654. DWORD dwFindType;
  655. DWORD cbFindPara;
  656. [size_is(cbFindPara)] PBYTE pbFindPara;
  657. } TLSPrivateDataInstalledCertificate, *PTLSPrivateDataInstalledCertificate;
  658. typedef [switch_type(DWORD)] union {
  659. [case(5)]
  660. LANGID systemLangId;
  661. [case(4)]
  662. TLSPrivateDataInstalledCertificate InstalledCert;
  663. [case(3)]
  664. TLSPrivateDataSPK SPK;
  665. [default]
  666. TLSPrivateDataBinary BinaryData;
  667. } TLSPrivateDataUnion, *PTLSPrivateDataUnion;
  668. error_status_t
  669. TLSRpcGetTlsPrivateData(
  670. [in] PCONTEXT_HANDLE phContext,
  671. [in] DWORD dwPrivateDataType,
  672. [in, switch_is(dwPrivateDataType)] PTLSPrivateDataUnion pSearchData,
  673. [out, ref] PDWORD pdwRetType,
  674. [out, switch_is(*pdwRetType)] PTLSPrivateDataUnion* ppRetData,
  675. [out, ref] PDWORD pdwErrCode
  676. );
  677. error_status_t
  678. TLSRpcSetTlsPrivateData(
  679. [in] PCONTEXT_HANDLE phContext,
  680. [in] DWORD dwPrivateDataType,
  681. [in, switch_is(dwPrivateDataType)] PTLSPrivateDataUnion pPrivateData,
  682. [out, ref] PDWORD pdwErrCode
  683. );
  684. error_status_t
  685. TLSRpcTriggerReGenKey(
  686. [in] PCONTEXT_HANDLE phContext,
  687. [in] BOOL bKeepSPKAndExtension,
  688. [out, ref] PDWORD pdwErrCode
  689. );
  690. error_status_t
  691. TLSRpcTelephoneRegisterLKP(
  692. [in] PCONTEXT_HANDLE phContext,
  693. [in] DWORD dwData,
  694. [in, size_is(dwData)] PBYTE pbData,
  695. [out, ref] PDWORD pdwErrCode
  696. );
  697. //--------------------------------------------------------
  698. error_status_t
  699. TLSRpcAllocateInternetLicense(
  700. [in] PCONTEXT_HANDLE phContext,
  701. [in] const CHALLENGE_CONTEXT ChallengeContext,
  702. [in] const PTLSLICENSEREQUEST pRequest,
  703. [in, string] LPTSTR pMachineName,
  704. [in, string] LPTSTR pUserName,
  705. [in] const DWORD cbChallengeResponse,
  706. [in, size_is(cbChallengeResponse)] const PBYTE pbChallengeResponse,
  707. [out] PDWORD pcbLicense,
  708. [out, size_is(, *pcbLicense)] BYTE **pLicense,
  709. [in, out, ref] PDWORD pdwErrCode
  710. );
  711. error_status_t
  712. TLSRpcAllocateInternetLicenseEx(
  713. [in] PCONTEXT_HANDLE phContext,
  714. [in] const CHALLENGE_CONTEXT ChallengeContext,
  715. [in] const PTLSLICENSEREQUEST pRequest,
  716. [in, string] LPTSTR pMachineName,
  717. [in, string] LPTSTR pUserName,
  718. [in] const DWORD cbChallengeResponse,
  719. [in, size_is(cbChallengeResponse)] const PBYTE pbChallengeResponse,
  720. [out, ref] PTLSInternetLicense pInternetLicense,
  721. [out, ref] PDWORD pdwErrCode
  722. );
  723. error_status_t
  724. TLSRpcReturnInternetLicenseEx(
  725. [in] PCONTEXT_HANDLE phContext,
  726. [in] const PTLSLICENSEREQUEST pRequest,
  727. [in] const ULARGE_INTEGER* pulSerialNumber,
  728. [in] DWORD dwQuantity,
  729. [in, out, ref] PDWORD pdwErrCode
  730. );
  731. error_status_t
  732. TLSRpcReturnInternetLicense(
  733. [in] PCONTEXT_HANDLE phContext,
  734. [in] DWORD cbLicense,
  735. [in, size_is(cbLicense)] PBYTE pbLicense,
  736. [in, out, ref] PDWORD pdwErrCode
  737. );
  738. error_status_t
  739. TLSRpcRequestNewLicenseEx(
  740. [in] PCONTEXT_HANDLE phContext,
  741. [in, out] DWORD *pdwSupportFlags,
  742. [in] const CHALLENGE_CONTEXT ChallengeContext,
  743. [in] PTLSLICENSEREQUEST pRequest,
  744. [in, string] LPTSTR pMachineName,
  745. [in, string] LPTSTR pUserName,
  746. [in] const DWORD cbChallengeResponse,
  747. [in, size_is(cbChallengeResponse)] const PBYTE cbChallenge,
  748. [in] BOOL bAcceptTemporaryLicense,
  749. [in] DWORD dwQuantity,
  750. [out] PDWORD pcbLicense,
  751. [out, size_is(, *pcbLicense)] BYTE **pLicense,
  752. [in, out, ref] PDWORD pdwErrCode
  753. );
  754. error_status_t
  755. TLSRpcUpgradeLicenseEx(
  756. [in] PCONTEXT_HANDLE phContext,
  757. [in, out] DWORD *pdwSupportFlags,
  758. [in] PTLSLICENSEREQUEST pRequest,
  759. [in] const CHALLENGE_CONTEXT ChallengeContext,
  760. [in] const DWORD cbChallengeResponse,
  761. [in, size_is(cbChallengeResponse)] const PBYTE cbChallenge,
  762. [in] DWORD cbOldLicense,
  763. [in, size_is(cbOldLicense)] PBYTE pOldLicense,
  764. [in] DWORD dwQuantity,
  765. [out] PDWORD pcbNewLicense,
  766. [out, size_is(, *pcbNewLicense)] PBYTE *pNewLicense,
  767. [in, out, ref] PDWORD pdwErrCode
  768. );
  769. error_status_t
  770. TLSRpcMarkLicense(
  771. [in] PCONTEXT_HANDLE phContext,
  772. [in] const UCHAR ucMarkFlags,
  773. [in] const DWORD cbLicense,
  774. [in, size_is(cbLicense)] PBYTE pLicense,
  775. [in, out, ref] PDWORD pdwErrCode
  776. );
  777. error_status_t
  778. TLSRpcCheckLicenseMark(
  779. [in] PCONTEXT_HANDLE phContext,
  780. [in] const DWORD cbLicense,
  781. [in, size_is(cbLicense)] PBYTE pLicense,
  782. [out] UCHAR *pucMarkFlags,
  783. [in, out, ref] PDWORD pdwErrCode
  784. );
  785. error_status_t
  786. TLSRpcGetSupportFlags(
  787. [in] PCONTEXT_HANDLE phContext,
  788. [out, ref] DWORD *pdwSupportFlags
  789. );
  790. error_status_t
  791. TLSRpcRequestNewLicenseExEx(
  792. [in] PCONTEXT_HANDLE phContext,
  793. [in, out] DWORD *pdwSupportFlags,
  794. [in] const CHALLENGE_CONTEXT ChallengeContext,
  795. [in] PTLSLICENSEREQUEST pRequest,
  796. [in, string] LPTSTR pMachineName,
  797. [in, string] LPTSTR pUserName,
  798. [in] const DWORD cbChallengeResponse,
  799. [in, size_is(cbChallengeResponse)] const PBYTE cbChallenge,
  800. [in] BOOL bAcceptTemporaryLicense,
  801. [in] BOOL bAcceptFewerLicenses,
  802. [in, out] DWORD *pdwQuantity,
  803. [out] PDWORD pcbLicense,
  804. [out, size_is(, *pcbLicense)] BYTE **pLicense,
  805. [in, out, ref] PDWORD pdwErrCode
  806. );
  807. error_status_t
  808. TLSRpcGetServerNameEx(
  809. [in] PCONTEXT_HANDLE phContext,
  810. [in, out, string, size_is(*cbSize)] LPTSTR szMachineName,
  811. [in, out, ref] PDWORD cbSize,
  812. [in, out, ref] PDWORD pdwErrCode
  813. );
  814. error_status_t
  815. TLSRpcLicenseEnumNextEx(
  816. [in] PCONTEXT_HANDLE phContext,
  817. [out, ref] LPLSLicenseEx lpLicense,
  818. [in, out, ref] PDWORD pdwErrCode
  819. );
  820. //
  821. // Structures for cert signing request (needed for MIDL generation)
  822. //
  823. cpp_quote("#if 0")
  824. typedef struct _CERT_RDN_VALUE_BLOB
  825. {
  826. DWORD cbData;
  827. [size_is(cbData)] BYTE *pbData;
  828. } CERT_RDN_VALUE_BLOB;
  829. typedef struct _CERT_RDN_ATTR
  830. {
  831. [string] LPSTR lpszOID;
  832. DWORD dwValueType;
  833. CERT_RDN_VALUE_BLOB Value;
  834. } CERT_RDN_ATTR, *PCERT_RDN_ATTR;
  835. cpp_quote("#endif")
  836. error_status_t
  837. TLSRpcGenerateCustomerCert(
  838. [in] PCONTEXT_HANDLE phContext,
  839. [in] DWORD dwCertEncodingType,
  840. [in] DWORD dwNameAttrCount,
  841. [in, size_is(dwNameAttrCount)] CERT_RDN_ATTR rgNameAttr[],
  842. [out] DWORD *pcbCert,
  843. [out, size_is(,*pcbCert)] BYTE **ppbCert,
  844. [out] DWORD *pdwErrCode
  845. );
  846. //
  847. // New versions of API, without bad parameters
  848. //
  849. // A quick review on the dangers of variable-sized [in,out] parameters...
  850. //
  851. // Consider the following IDL:
  852. //
  853. // void Foo(handle_t hBinding,
  854. // [in,out,size_is(*pn)] SOMETYPE* pData,
  855. // [in,out] long* pn);
  856. //
  857. // If these were [out]-only params, the RPC proxy would allocate exactly
  858. // enough space (on the heap) for the data, and the client would later
  859. // free it -- very difficult to exploit that, directly! But for [in,out]
  860. // params, like those above, the RPC proxy will copy (*pn) elements, from
  861. // the wire, back into the client's original buffer -- which may not be
  862. // big enough, if the server increased the value of (*pn). Worse, the
  863. // buffer may even exist on the client's stack!
  864. //
  865. error_status_t
  866. TLSRpcGetServerNameFixed(
  867. [in] PCONTEXT_HANDLE phContext,
  868. [out, string] LPTSTR *pszMachineName,
  869. [in, out, ref] PDWORD pdwErrCode
  870. );
  871. error_status_t
  872. TLSRpcGetServerScopeFixed(
  873. [in] PCONTEXT_HANDLE phContext,
  874. [out, string] LPTSTR *pszScopeName,
  875. [in, out, ref] PDWORD pdwErrCode
  876. );
  877. error_status_t
  878. TLSRpcGetLastErrorFixed(
  879. [in] PCONTEXT_HANDLE phContext,
  880. [out, string] LPTSTR *pszBuffer,
  881. [in, out, ref] PDWORD pdwErrCode
  882. );
  883. error_status_t
  884. TLSRpcLookupServerFixed(
  885. [in] PCONTEXT_HANDLE phContext,
  886. [in, string] LPTSTR pszLookupSetupId,
  887. [out, string] LPTSTR *pszLsSetupId,
  888. [out, string] LPTSTR *pszDomainName,
  889. [out, string] LPTSTR *pszLsName,
  890. [in, out, ref] PDWORD pdwErrCode
  891. );
  892. }