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.

1551 lines
38 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996-1998
  5. //
  6. // File: LicPack.cpp
  7. //
  8. // Contents: LicensedPack Table
  9. //
  10. // History:
  11. //
  12. //---------------------------------------------------------------------------
  13. #include "LicPack.h"
  14. LPCTSTR __LicensedPackIdxOnInternalKpId::pszIndexName = LICENSEDPACK_INDEX_INTERNALKEYPACKID_INDEXNAME;
  15. LPCTSTR __LicensedPackIdxOnInternalKpId::pszIndexKey = LICENSEDPACK_INDEX_INTERNALKEYPACKID_INDEXKEY;
  16. LPCTSTR __LicensedPackIdxOnModifyTime::pszIndexName = LICENSEDPACK_INDEX_LASTMODIFYTIME_INDEXNAME;
  17. LPCTSTR __LicensedPackIdxOnModifyTime::pszIndexKey = LICENSEDPACK_INDEX_LASTMODIFYTIME_INDEXKEY;
  18. LPCTSTR __LicensedPackIdxOnCompanyName::pszIndexName = LICENSEDPACK_INDEX_COMPANYNAME_INDEXNAME;
  19. LPCTSTR __LicensedPackIdxOnCompanyName::pszIndexKey = LICENSEDPACK_INDEX_COMPANYNAME_INDEXKEY;
  20. LPCTSTR __LicensedPackIdxOnProductId::pszIndexName = LICENSEDPACK_INDEX_PRODUCTID_INDEXNAME;
  21. LPCTSTR __LicensedPackIdxOnProductId::pszIndexKey = LICENSEDPACK_INDEX_PRODUCTID_INDEXKEY;
  22. LPCTSTR __LicensedPackIdxOnKeyPackId::pszIndexName = LICENSEDPACK_INDEX_KEYPACKID_INDEXNAME;
  23. LPCTSTR __LicensedPackIdxOnKeyPackId::pszIndexKey = LICENSEDPACK_INDEX_KEYPACKID_INDEXKEY;
  24. LPCTSTR __LicensedPackIdxOnInstalledProduct::pszIndexName = LICENSEDPACK_INDEX_INSTALLEDPRODUCT_INDEXNAME;
  25. LPCTSTR __LicensedPackIdxOnInstalledProduct::pszIndexKey = LICENSEDPACK_INDEX_INSTALLEDPRODUCT_INDEXKEY;
  26. LPCTSTR __LicensedPackIdxOnAllocLicense::pszIndexName = LICENSEDPACK_INDEX_ALLOCATELICENSE_INDEXNAME;
  27. LPCTSTR __LicensedPackIdxOnAllocLicense::pszIndexKey = LICENSEDPACK_INDEX_ALLOCATELICENSE_INDEXKEY;
  28. //----------------------------------------------------
  29. CCriticalSection LicPackTable::g_TableLock;
  30. LPCTSTR LicPackTable::pszTableName = LICENSEDPACK_TABLE_NAME;
  31. //////////////////////////////////////////////////////////////////////////
  32. //
  33. // Index definition for KeyPack table
  34. //
  35. TLSJBIndex
  36. LicPackTable::g_TableIndex[] =
  37. {
  38. {
  39. LICENSEDPACK_INDEX_INTERNALKEYPACKID_INDEXNAME,
  40. LICENSEDPACK_INDEX_INTERNALKEYPACKID_INDEXKEY,
  41. -1,
  42. JET_bitIndexPrimary,
  43. TLSTABLE_INDEX_DEFAULT_DENSITY
  44. },
  45. {
  46. LICENSEDPACK_INDEX_LASTMODIFYTIME_INDEXNAME,
  47. LICENSEDPACK_INDEX_LASTMODIFYTIME_INDEXKEY,
  48. -1,
  49. JET_bitIndexIgnoreNull,
  50. TLSTABLE_INDEX_DEFAULT_DENSITY
  51. },
  52. {
  53. LICENSEDPACK_INDEX_COMPANYNAME_INDEXNAME,
  54. LICENSEDPACK_INDEX_COMPANYNAME_INDEXKEY,
  55. -1,
  56. JET_bitIndexIgnoreNull,
  57. TLSTABLE_INDEX_DEFAULT_DENSITY
  58. },
  59. {
  60. LICENSEDPACK_INDEX_PRODUCTID_INDEXNAME,
  61. LICENSEDPACK_INDEX_PRODUCTID_INDEXKEY,
  62. -1,
  63. JET_bitIndexIgnoreNull,
  64. TLSTABLE_INDEX_DEFAULT_DENSITY
  65. },
  66. {
  67. LICENSEDPACK_INDEX_KEYPACKID_INDEXNAME,
  68. LICENSEDPACK_INDEX_KEYPACKID_INDEXKEY,
  69. -1,
  70. JET_bitIndexIgnoreNull,
  71. TLSTABLE_INDEX_DEFAULT_DENSITY
  72. },
  73. {
  74. LICENSEDPACK_INDEX_INSTALLEDPRODUCT_INDEXNAME,
  75. LICENSEDPACK_INDEX_INSTALLEDPRODUCT_INDEXKEY,
  76. -1,
  77. JET_bitIndexIgnoreNull,
  78. TLSTABLE_INDEX_DEFAULT_DENSITY
  79. },
  80. {
  81. LICENSEDPACK_INDEX_ALLOCATELICENSE_INDEXNAME,
  82. LICENSEDPACK_INDEX_ALLOCATELICENSE_INDEXKEY,
  83. -1,
  84. JET_bitIndexIgnoreNull,
  85. TLSTABLE_INDEX_DEFAULT_DENSITY
  86. }
  87. };
  88. int
  89. LicPackTable::g_NumTableIndex = sizeof(LicPackTable::g_TableIndex) / sizeof(LicPackTable::g_TableIndex[0]);
  90. //////////////////////////////////////////////////////////////////////////
  91. //
  92. // Column Definition for KeyPack table
  93. //
  94. TLSJBColumn
  95. LicPackTable::g_Columns[] =
  96. {
  97. {
  98. LICENSEDPACK_COLUMN_ENTRYSTATUS,
  99. JET_coltypUnsignedByte,
  100. 0,
  101. JET_bitColumnFixed,
  102. NULL,
  103. 0,
  104. TLS_JETBLUE_COLUMN_CODE_PAGE,
  105. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  106. TLS_JETBLUE_COLUMN_LANGID
  107. },
  108. //
  109. // Internal tracking KeyPackID
  110. {
  111. LICENSEDPACK_COLUMN_KEYPACKID,
  112. JET_coltypLong,
  113. 0,
  114. JET_bitColumnFixed | JET_bitColumnNotNULL,
  115. NULL,
  116. 0,
  117. TLS_JETBLUE_COLUMN_CODE_PAGE,
  118. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  119. TLS_JETBLUE_COLUMN_LANGID
  120. },
  121. //
  122. // Last Modify Time
  123. {
  124. LICENSEDPACK_COLUMN_LASTMODIFYTIME,
  125. JET_coltypBinary,
  126. sizeof(FILETIME),
  127. JET_bitColumnNotNULL,
  128. NULL,
  129. 0,
  130. TLS_JETBLUE_COLUMN_CODE_PAGE,
  131. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  132. TLS_JETBLUE_COLUMN_LANGID
  133. },
  134. //
  135. // LICENSEDPACK_COLUMN_ATTRIBUTE
  136. {
  137. LICENSEDPACK_COLUMN_ATTRIBUTE,
  138. JET_coltypLong,
  139. 0,
  140. JET_bitColumnFixed,
  141. NULL,
  142. 0,
  143. TLS_JETBLUE_COLUMN_CODE_PAGE,
  144. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  145. TLS_JETBLUE_COLUMN_LANGID
  146. },
  147. //
  148. // LICENSEDPACK_COLUMN_KEYPACKSTATUS
  149. {
  150. LICENSEDPACK_COLUMN_KEYPACKSTATUS,
  151. JET_coltypUnsignedByte,
  152. 0,
  153. JET_bitColumnFixed | JET_bitColumnNotNULL,
  154. NULL,
  155. 0,
  156. TLS_JETBLUE_COLUMN_CODE_PAGE,
  157. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  158. TLS_JETBLUE_COLUMN_LANGID
  159. },
  160. //
  161. // LICENSEDPACK_COLUMN_AVAILABLE
  162. {
  163. LICENSEDPACK_COLUMN_AVAILABLE,
  164. JET_coltypLong,
  165. 0,
  166. JET_bitColumnFixed | JET_bitColumnNotNULL,
  167. NULL,
  168. 0,
  169. TLS_JETBLUE_COLUMN_CODE_PAGE,
  170. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  171. TLS_JETBLUE_COLUMN_LANGID
  172. },
  173. //
  174. // LICENSEDPACK_COLUMN_NEXTSERIALNUMBER
  175. {
  176. LICENSEDPACK_COLUMN_NEXTSERIALNUMBER,
  177. JET_coltypLong,
  178. 0,
  179. JET_bitColumnFixed | JET_bitColumnNotNULL,
  180. NULL,
  181. 0,
  182. TLS_JETBLUE_COLUMN_CODE_PAGE,
  183. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  184. TLS_JETBLUE_COLUMN_LANGID
  185. },
  186. //
  187. // LICENSEDPACK_COLUMN_ACTIVATEDATE
  188. {
  189. LICENSEDPACK_COLUMN_ACTIVATEDATE,
  190. JET_coltypLong,
  191. 0,
  192. JET_bitColumnFixed | JET_bitColumnNotNULL,
  193. NULL,
  194. 0,
  195. TLS_JETBLUE_COLUMN_CODE_PAGE,
  196. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  197. TLS_JETBLUE_COLUMN_LANGID
  198. },
  199. //
  200. // LICENSEDPACK_COLUMN_EXPIREDATE
  201. {
  202. LICENSEDPACK_COLUMN_EXPIREDATE,
  203. JET_coltypLong,
  204. 0,
  205. JET_bitColumnFixed | JET_bitColumnNotNULL,
  206. NULL,
  207. 0,
  208. TLS_JETBLUE_COLUMN_CODE_PAGE,
  209. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  210. TLS_JETBLUE_COLUMN_LANGID
  211. },
  212. //
  213. // LICENSEDPACK_COLUMN_DOMAINSETUPID
  214. {
  215. LICENSEDPACK_COLUMN_DOMAINSETUPID,
  216. JET_coltypLongBinary,
  217. TLSTABLE_MAX_BINARY_LENGTH,
  218. 0,
  219. NULL,
  220. 0,
  221. TLS_JETBLUE_COLUMN_CODE_PAGE,
  222. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  223. TLS_JETBLUE_COLUMN_LANGID
  224. },
  225. //
  226. // LICENSEDPACK_COLUMN_LSSETUPID
  227. {
  228. LICENSEDPACK_COLUMN_LSSETUPID,
  229. JB_COLTYPE_TEXT,
  230. (MAX_JETBLUE_TEXT_LENGTH + 1)*sizeof(TCHAR),
  231. 0,
  232. NULL,
  233. 0,
  234. TLS_JETBLUE_COLUMN_CODE_PAGE,
  235. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  236. TLS_JETBLUE_COLUMN_LANGID
  237. },
  238. //
  239. // LICENSEDPACK_COLUMN_DOMAINNAME
  240. {
  241. LICENSEDPACK_COLUMN_DOMAINNAME,
  242. JB_COLTYPE_TEXT,
  243. (MAX_JETBLUE_TEXT_LENGTH + 1)*sizeof(TCHAR),
  244. 0,
  245. NULL,
  246. 0,
  247. TLS_JETBLUE_COLUMN_CODE_PAGE,
  248. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  249. TLS_JETBLUE_COLUMN_LANGID
  250. },
  251. //
  252. // LICENSEDPACK_COLUMN_LSERVERNAME
  253. {
  254. LICENSEDPACK_COLUMN_LSERVERNAME,
  255. JB_COLTYPE_TEXT,
  256. (MAX_JETBLUE_TEXT_LENGTH + 1)*sizeof(TCHAR),
  257. 0,
  258. NULL,
  259. 0,
  260. TLS_JETBLUE_COLUMN_CODE_PAGE,
  261. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  262. TLS_JETBLUE_COLUMN_LANGID
  263. },
  264. //
  265. // Standard License Pack Property.
  266. //
  267. //
  268. // License Pack ID
  269. {
  270. LICENSEDPACK_COLUMN_LPID,
  271. JB_COLTYPE_TEXT,
  272. (MAX_JETBLUE_TEXT_LENGTH + 1)*sizeof(TCHAR),
  273. 0,
  274. JBSTRING_NULL,
  275. _tcslen(JBSTRING_NULL),
  276. TLS_JETBLUE_COLUMN_CODE_PAGE,
  277. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  278. TLS_JETBLUE_COLUMN_LANGID
  279. },
  280. //
  281. // KeyPack type
  282. {
  283. LICENSEDPACK_COLUMN_AGREEMENTTYPE,
  284. JET_coltypUnsignedByte,
  285. 0,
  286. JET_bitColumnFixed | JET_bitColumnNotNULL,
  287. NULL,
  288. 0,
  289. TLS_JETBLUE_COLUMN_CODE_PAGE,
  290. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  291. TLS_JETBLUE_COLUMN_LANGID
  292. },
  293. //
  294. // CompanyName
  295. {
  296. LICENSEDPACK_COLUMN_COMPANYNAME,
  297. // JET_coltypLongText,
  298. JB_COLTYPE_TEXT,
  299. (MAX_JETBLUE_TEXT_LENGTH + 1)*sizeof(TCHAR),
  300. 0,
  301. JBSTRING_NULL,
  302. _tcslen(JBSTRING_NULL),
  303. TLS_JETBLUE_COLUMN_CODE_PAGE,
  304. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  305. TLS_JETBLUE_COLUMN_LANGID
  306. },
  307. //
  308. // Product ID
  309. {
  310. LICENSEDPACK_COLUMN_PRODUCTID,
  311. //JET_coltypLongText,
  312. JB_COLTYPE_TEXT,
  313. (MAX_JETBLUE_TEXT_LENGTH + 1)*sizeof(TCHAR),
  314. 0,
  315. JBSTRING_NULL,
  316. _tcslen(JBSTRING_NULL),
  317. TLS_JETBLUE_COLUMN_CODE_PAGE,
  318. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  319. TLS_JETBLUE_COLUMN_LANGID
  320. },
  321. //
  322. // Major Version
  323. {
  324. LICENSEDPACK_COLUMN_MAJORVERSION,
  325. JET_coltypShort,
  326. 0,
  327. JET_bitColumnFixed | JET_bitColumnNotNULL,
  328. NULL,
  329. 0,
  330. TLS_JETBLUE_COLUMN_CODE_PAGE,
  331. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  332. TLS_JETBLUE_COLUMN_LANGID
  333. },
  334. //
  335. // Minor Version
  336. {
  337. LICENSEDPACK_COLUMN_MINORVERSION,
  338. JET_coltypShort,
  339. 0,
  340. JET_bitColumnFixed | JET_bitColumnNotNULL,
  341. NULL,
  342. 0,
  343. TLS_JETBLUE_COLUMN_CODE_PAGE,
  344. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  345. TLS_JETBLUE_COLUMN_LANGID
  346. },
  347. //
  348. // Platform Type
  349. {
  350. LICENSEDPACK_COLUMN_PLATFORMTYPE,
  351. JET_coltypLong,
  352. 0,
  353. JET_bitColumnFixed | JET_bitColumnNotNULL,
  354. NULL,
  355. 0,
  356. TLS_JETBLUE_COLUMN_CODE_PAGE,
  357. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  358. TLS_JETBLUE_COLUMN_LANGID
  359. },
  360. //
  361. // License Type
  362. {
  363. LICENSEDPACK_COLUMN_LICENSETYPE,
  364. JET_coltypUnsignedByte,
  365. 0,
  366. JET_bitColumnFixed | JET_bitColumnNotNULL,
  367. NULL,
  368. 0,
  369. TLS_JETBLUE_COLUMN_CODE_PAGE,
  370. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  371. TLS_JETBLUE_COLUMN_LANGID
  372. },
  373. //
  374. // ChannelOfPurchase
  375. {
  376. LICENSEDPACK_COLUMN_COP,
  377. JET_coltypUnsignedByte,
  378. 0,
  379. JET_bitColumnFixed | JET_bitColumnNotNULL,
  380. NULL,
  381. 0,
  382. TLS_JETBLUE_COLUMN_CODE_PAGE,
  383. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  384. TLS_JETBLUE_COLUMN_LANGID
  385. },
  386. //
  387. // Begin Serial Number
  388. {
  389. LICENSEDPACK_COLUMN_BSERIALNUMBER,
  390. //JET_coltypLongText,
  391. JB_COLTYPE_TEXT,
  392. (MAX_JETBLUE_TEXT_LENGTH + 1)*sizeof(TCHAR),
  393. 0,
  394. JBSTRING_NULL,
  395. _tcslen(JBSTRING_NULL),
  396. TLS_JETBLUE_COLUMN_CODE_PAGE,
  397. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  398. TLS_JETBLUE_COLUMN_LANGID
  399. },
  400. //
  401. // Total license in License Pack
  402. {
  403. LICENSEDPACK_COLUMN_TOTALLICENSES,
  404. JET_coltypLong,
  405. 0,
  406. JET_bitColumnFixed | JET_bitColumnNotNULL,
  407. NULL,
  408. 0,
  409. TLS_JETBLUE_COLUMN_CODE_PAGE,
  410. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  411. TLS_JETBLUE_COLUMN_LANGID
  412. },
  413. //
  414. // Product specific Flag
  415. {
  416. LICENSEDPACK_COLUMN_PRODUCTFLAGS,
  417. JET_coltypLong,
  418. 0,
  419. JET_bitColumnFixed | JET_bitColumnNotNULL,
  420. NULL,
  421. 0,
  422. TLS_JETBLUE_COLUMN_CODE_PAGE,
  423. TLS_JETBLUE_COLUMN_COUNTRY_CODE,
  424. TLS_JETBLUE_COLUMN_LANGID
  425. }
  426. };
  427. int
  428. LicPackTable::g_NumColumns = sizeof(LicPackTable::g_Columns) / sizeof(LicPackTable::g_Columns[0]);
  429. //-----------------------------------------------------
  430. BOOL
  431. LicPackTable::ResolveToTableColumn()
  432. /*
  433. */
  434. {
  435. m_JetErr = ucEntryStatus.AttachToTable(
  436. *this,
  437. LICENSEDPACK_COLUMN_ENTRYSTATUS
  438. );
  439. if(IsSuccess() == FALSE)
  440. goto cleanup;
  441. m_JetErr = dwKeyPackId.AttachToTable(
  442. *this,
  443. LICENSEDPACK_COLUMN_KEYPACKID
  444. );
  445. if(IsSuccess() == FALSE)
  446. goto cleanup;
  447. m_JetErr = ftLastModifyTime.AttachToTable(
  448. *this,
  449. LICENSEDPACK_COLUMN_LASTMODIFYTIME
  450. );
  451. if(IsSuccess() == FALSE)
  452. goto cleanup;
  453. m_JetErr = dwAttribute.AttachToTable(
  454. *this,
  455. LICENSEDPACK_COLUMN_ATTRIBUTE
  456. );
  457. if(IsSuccess() == FALSE)
  458. goto cleanup;
  459. m_JetErr = ucKeyPackStatus.AttachToTable(
  460. *this,
  461. LICENSEDPACK_COLUMN_KEYPACKSTATUS
  462. );
  463. if(IsSuccess() == FALSE)
  464. goto cleanup;
  465. m_JetErr = dwNumberOfLicenses.AttachToTable(
  466. *this,
  467. LICENSEDPACK_COLUMN_AVAILABLE
  468. );
  469. if(IsSuccess() == FALSE)
  470. goto cleanup;
  471. m_JetErr = dwNextSerialNumber.AttachToTable(
  472. *this,
  473. LICENSEDPACK_COLUMN_NEXTSERIALNUMBER
  474. );
  475. if(IsSuccess() == FALSE)
  476. goto cleanup;
  477. m_JetErr = dwActivateDate.AttachToTable(
  478. *this,
  479. LICENSEDPACK_COLUMN_ACTIVATEDATE
  480. );
  481. if(IsSuccess() == FALSE)
  482. goto cleanup;
  483. m_JetErr = dwExpirationDate.AttachToTable(
  484. *this,
  485. LICENSEDPACK_COLUMN_EXPIREDATE
  486. );
  487. if(IsSuccess() == FALSE)
  488. goto cleanup;
  489. m_JetErr = pbDomainSid.AttachToTable(
  490. *this,
  491. LICENSEDPACK_COLUMN_DOMAINSETUPID
  492. );
  493. if(IsSuccess() == FALSE)
  494. goto cleanup;
  495. m_JetErr = szInstallId.AttachToTable(
  496. *this,
  497. LICENSEDPACK_COLUMN_LSSETUPID
  498. );
  499. if(IsSuccess() == FALSE)
  500. goto cleanup;
  501. m_JetErr = szDomainName.AttachToTable(
  502. *this,
  503. LICENSEDPACK_COLUMN_DOMAINNAME
  504. );
  505. if(IsSuccess() == FALSE)
  506. goto cleanup;
  507. m_JetErr = szTlsServerName.AttachToTable(
  508. *this,
  509. LICENSEDPACK_COLUMN_LSERVERNAME
  510. );
  511. if(IsSuccess() == FALSE)
  512. goto cleanup;
  513. //----------------------------------------------------
  514. m_JetErr = szKeyPackId.AttachToTable(
  515. *this,
  516. LICENSEDPACK_COLUMN_LPID
  517. );
  518. if(IsSuccess() == FALSE)
  519. goto cleanup;
  520. m_JetErr = ucAgreementType.AttachToTable(
  521. *this,
  522. LICENSEDPACK_COLUMN_AGREEMENTTYPE
  523. );
  524. if(IsSuccess() == FALSE)
  525. goto cleanup;
  526. m_JetErr = szCompanyName.AttachToTable(
  527. *this,
  528. LICENSEDPACK_COLUMN_COMPANYNAME
  529. );
  530. if(IsSuccess() == FALSE)
  531. goto cleanup;
  532. m_JetErr = szProductId.AttachToTable(
  533. *this,
  534. LICENSEDPACK_COLUMN_PRODUCTID
  535. );
  536. if(IsSuccess() == FALSE)
  537. goto cleanup;
  538. m_JetErr = wMajorVersion.AttachToTable(
  539. *this,
  540. LICENSEDPACK_COLUMN_MAJORVERSION
  541. );
  542. if(IsSuccess() == FALSE)
  543. goto cleanup;
  544. m_JetErr = wMinorVersion.AttachToTable(
  545. *this,
  546. LICENSEDPACK_COLUMN_MINORVERSION
  547. );
  548. if(IsSuccess() == FALSE)
  549. goto cleanup;
  550. m_JetErr = dwPlatformType.AttachToTable(
  551. *this,
  552. LICENSEDPACK_COLUMN_PLATFORMTYPE
  553. );
  554. if(IsSuccess() == FALSE)
  555. goto cleanup;
  556. m_JetErr = ucLicenseType.AttachToTable(
  557. *this,
  558. LICENSEDPACK_COLUMN_LICENSETYPE
  559. );
  560. if(IsSuccess() == FALSE)
  561. goto cleanup;
  562. m_JetErr = ucChannelOfPurchase.AttachToTable(
  563. *this,
  564. LICENSEDPACK_COLUMN_COP
  565. );
  566. if(IsSuccess() == FALSE)
  567. goto cleanup;
  568. m_JetErr = szBeginSerialNumber.AttachToTable(
  569. *this,
  570. LICENSEDPACK_COLUMN_BSERIALNUMBER
  571. );
  572. if(IsSuccess() == FALSE)
  573. goto cleanup;
  574. m_JetErr = dwTotalLicenseInKeyPack.AttachToTable(
  575. *this,
  576. LICENSEDPACK_COLUMN_TOTALLICENSES
  577. );
  578. if(IsSuccess() == FALSE)
  579. goto cleanup;
  580. m_JetErr = dwProductFlags.AttachToTable(
  581. *this,
  582. LICENSEDPACK_COLUMN_PRODUCTFLAGS
  583. );
  584. cleanup:
  585. return IsSuccess();
  586. }
  587. //------------------------------------------------------------
  588. CLASS_PRIVATE BOOL
  589. LicPackTable::ProcessSingleColumn(
  590. IN BOOL bFetch,
  591. IN TLSColumnBase& column,
  592. IN DWORD offset,
  593. IN PVOID pbData,
  594. IN DWORD cbData,
  595. IN PDWORD pcbDataReturn,
  596. IN LPCTSTR szColumnName
  597. )
  598. /*
  599. Abstract:
  600. Fetch/Insert/Update a particular column.
  601. Parameter:
  602. bFetch - TRUE if fetch, FALSE if update/insert.
  603. column - Intended column for operation, reference pointer to TLSColumn
  604. szColumnName - name of the column, for debugging print purpose only
  605. Returns:
  606. TRUE if successful, FALSE otherwise.
  607. */
  608. {
  609. if(bFetch)
  610. {
  611. m_JetErr = column.FetchColumnValue(
  612. pbData,
  613. cbData,
  614. offset,
  615. pcbDataReturn
  616. );
  617. }
  618. else
  619. {
  620. m_JetErr = column.InsertColumnValue(
  621. pbData,
  622. cbData,
  623. offset
  624. );
  625. }
  626. REPORTPROCESSFAILED(
  627. bFetch,
  628. GetTableName(),
  629. szColumnName,
  630. m_JetErr
  631. );
  632. return IsSuccess();
  633. }
  634. //--------------------------------------------------------------
  635. CLASS_PRIVATE BOOL
  636. LicPackTable::ProcessRecord(
  637. LICENSEPACK* kp,
  638. BOOL bFetch,
  639. DWORD dwParam,
  640. BOOL bUpdate
  641. )
  642. /*++
  643. See comment on TLSTable<> template class
  644. ++*/
  645. {
  646. DWORD dwSize;
  647. JB_ASSERT(kp != NULL);
  648. if(kp == NULL)
  649. {
  650. SetLastJetError(JET_errInvalidParameter);
  651. return FALSE;
  652. }
  653. if(bFetch == FALSE)
  654. {
  655. BeginUpdate(bUpdate);
  656. //
  657. // any update will require update on lastmodifytime column
  658. if(!(dwParam & LICENSEDPACK_PROCESS_MODIFYTIME))
  659. {
  660. #if DBG
  661. //
  662. // This is for self-checking only, TLSColumnFileTime
  663. // will automatically update the time.
  664. //
  665. JB_ASSERT(FALSE);
  666. #endif
  667. dwParam |= LICENSEDPACK_PROCESS_MODIFYTIME;
  668. }
  669. }
  670. else
  671. {
  672. SetLastJetError(JET_errSuccess);
  673. }
  674. if(IsSuccess() == FALSE)
  675. {
  676. JB_ASSERT(FALSE);
  677. goto cleanup;
  678. }
  679. //
  680. //
  681. if(dwParam & LICENSEDPACK_PROCESS_SZKEYPACKID)
  682. {
  683. ProcessSingleColumn(
  684. bFetch,
  685. szKeyPackId,
  686. 0,
  687. kp->szKeyPackId,
  688. sizeof(kp->szKeyPackId),
  689. &dwSize,
  690. LICENSEDPACK_COLUMN_LPID
  691. );
  692. }
  693. if(IsSuccess() == FALSE)
  694. goto cleanup;
  695. //
  696. //
  697. if(dwParam & LICENSEDPACK_PROCESS_AGREEMENTTYPE)
  698. {
  699. ProcessSingleColumn(
  700. bFetch,
  701. ucAgreementType,
  702. 0,
  703. &(kp->ucAgreementType),
  704. sizeof(kp->ucAgreementType),
  705. &dwSize,
  706. LICENSEDPACK_COLUMN_AGREEMENTTYPE
  707. );
  708. }
  709. if(IsSuccess() == FALSE)
  710. goto cleanup;
  711. //
  712. //
  713. if(dwParam & LICENSEDPACK_PROCESS_PRODUCTID)
  714. {
  715. ProcessSingleColumn(
  716. bFetch,
  717. szProductId,
  718. 0,
  719. kp->szProductId,
  720. sizeof(kp->szProductId),
  721. &dwSize,
  722. LICENSEDPACK_COLUMN_PRODUCTID
  723. );
  724. }
  725. if(IsSuccess() == FALSE)
  726. goto cleanup;
  727. //
  728. //
  729. if(dwParam & LICENSEDPACK_PROCESS_MAJORVERSION)
  730. {
  731. ProcessSingleColumn(
  732. bFetch,
  733. wMajorVersion,
  734. 0,
  735. &(kp->wMajorVersion),
  736. sizeof(kp->wMajorVersion),
  737. &dwSize,
  738. LICENSEDPACK_COLUMN_MAJORVERSION
  739. );
  740. }
  741. if(IsSuccess() == FALSE)
  742. goto cleanup;
  743. //
  744. //
  745. if(dwParam & LICENSEDPACK_PROCESS_MINORVERSION)
  746. {
  747. ProcessSingleColumn(
  748. bFetch,
  749. wMinorVersion,
  750. 0,
  751. &(kp->wMinorVersion),
  752. sizeof(kp->wMinorVersion),
  753. &dwSize,
  754. LICENSEDPACK_COLUMN_MINORVERSION
  755. );
  756. }
  757. if(IsSuccess() == FALSE)
  758. goto cleanup;
  759. //
  760. //
  761. if(dwParam & LICENSEDPACK_PROCESS_PLATFORMTYPE)
  762. {
  763. ProcessSingleColumn(
  764. bFetch,
  765. dwPlatformType,
  766. 0,
  767. &(kp->dwPlatformType),
  768. sizeof(kp->dwPlatformType),
  769. &dwSize,
  770. LICENSEDPACK_COLUMN_PLATFORMTYPE
  771. );
  772. }
  773. if(IsSuccess() == FALSE)
  774. goto cleanup;
  775. //
  776. //
  777. if(dwParam & LICENSEDPACK_PROCESS_LICENSETYPE)
  778. {
  779. ProcessSingleColumn(
  780. bFetch,
  781. ucLicenseType,
  782. 0,
  783. &(kp->ucLicenseType),
  784. sizeof(kp->ucLicenseType),
  785. &dwSize,
  786. LICENSEDPACK_COLUMN_LICENSETYPE
  787. );
  788. }
  789. if(IsSuccess() == FALSE)
  790. goto cleanup;
  791. //
  792. //
  793. if(dwParam & LICENSEDPACK_PROCESS_COP)
  794. {
  795. ProcessSingleColumn(
  796. bFetch,
  797. ucChannelOfPurchase,
  798. 0,
  799. &(kp->ucChannelOfPurchase),
  800. sizeof(kp->ucChannelOfPurchase),
  801. &dwSize,
  802. LICENSEDPACK_COLUMN_COP
  803. );
  804. }
  805. if(IsSuccess() == FALSE)
  806. goto cleanup;
  807. //
  808. //
  809. if(dwParam & LICENSEDPACK_PROCESS_BSERIALNUMBER)
  810. {
  811. ProcessSingleColumn(
  812. bFetch,
  813. szBeginSerialNumber,
  814. 0,
  815. kp->szBeginSerialNumber,
  816. sizeof(kp->szBeginSerialNumber),
  817. &dwSize,
  818. LICENSEDPACK_COLUMN_BSERIALNUMBER
  819. );
  820. }
  821. if(IsSuccess() == FALSE)
  822. goto cleanup;
  823. //
  824. //
  825. if(dwParam & LICENSEDPACK_PROCESS_TOTALLICENSES)
  826. {
  827. ProcessSingleColumn(
  828. bFetch,
  829. dwTotalLicenseInKeyPack,
  830. 0,
  831. &(kp->dwTotalLicenseInKeyPack),
  832. sizeof(kp->dwTotalLicenseInKeyPack),
  833. &dwSize,
  834. LICENSEDPACK_COLUMN_TOTALLICENSES
  835. );
  836. }
  837. if(IsSuccess() == FALSE)
  838. goto cleanup;
  839. //
  840. //
  841. if(dwParam & LICENSEDPACK_PROCESS_PRODUCTFLAGS)
  842. {
  843. ProcessSingleColumn(
  844. bFetch,
  845. dwProductFlags,
  846. 0,
  847. &(kp->dwProductFlags),
  848. sizeof(kp->dwProductFlags),
  849. &dwSize,
  850. LICENSEDPACK_COLUMN_PRODUCTFLAGS
  851. );
  852. }
  853. if(IsSuccess() == FALSE)
  854. goto cleanup;
  855. //
  856. //
  857. if(dwParam & LICENSEDPACK_PROCESS_COMPANYNAME)
  858. {
  859. ProcessSingleColumn(
  860. bFetch,
  861. szCompanyName,
  862. 0,
  863. kp->szCompanyName,
  864. sizeof(kp->szCompanyName),
  865. &dwSize,
  866. LICENSEDPACK_COLUMN_COMPANYNAME
  867. );
  868. }
  869. if(IsSuccess() == FALSE)
  870. goto cleanup;
  871. //
  872. //
  873. if(dwParam & LICENSEDPACK_PROCESS_DWINTERNAL)
  874. {
  875. // this is the primary index, can't be changed
  876. if(bUpdate == FALSE)
  877. {
  878. ProcessSingleColumn(
  879. bFetch,
  880. dwKeyPackId,
  881. 0,
  882. &(kp->dwKeyPackId),
  883. sizeof(kp->dwKeyPackId),
  884. &dwSize,
  885. LICENSEDPACK_COLUMN_KEYPACKID
  886. );
  887. }
  888. }
  889. if(IsSuccess() == FALSE)
  890. goto cleanup;
  891. if(dwParam & LICENSEDPACK_PROCESS_MODIFYTIME)
  892. {
  893. ProcessSingleColumn(
  894. bFetch,
  895. ftLastModifyTime,
  896. 0,
  897. &(kp->ftLastModifyTime),
  898. sizeof(kp->ftLastModifyTime),
  899. &dwSize,
  900. LICENSEDPACK_COLUMN_LASTMODIFYTIME
  901. );
  902. }
  903. if(IsSuccess() == FALSE)
  904. goto cleanup;
  905. if(dwParam & LICENSEDPACK_PROCESS_ATTRIBUTE)
  906. {
  907. ProcessSingleColumn(
  908. bFetch,
  909. dwAttribute,
  910. 0,
  911. &(kp->dwAttribute),
  912. sizeof(kp->dwAttribute),
  913. &dwSize,
  914. LICENSEDPACK_COLUMN_ATTRIBUTE
  915. );
  916. }
  917. if(IsSuccess() == FALSE)
  918. goto cleanup;
  919. //
  920. //
  921. if(dwParam & LICENSEDPACK_PROCESS_KEYPACKSTATUS)
  922. {
  923. ProcessSingleColumn(
  924. bFetch,
  925. ucKeyPackStatus,
  926. 0,
  927. &(kp->ucKeyPackStatus),
  928. sizeof(kp->ucKeyPackStatus),
  929. &dwSize,
  930. LICENSEDPACK_COLUMN_KEYPACKSTATUS
  931. );
  932. }
  933. if(IsSuccess() == FALSE)
  934. goto cleanup;
  935. //
  936. //
  937. if(dwParam & LICENSEDPACK_PROCESS_AVAILABLE)
  938. {
  939. ProcessSingleColumn(
  940. bFetch,
  941. dwNumberOfLicenses,
  942. 0,
  943. &(kp->dwNumberOfLicenses),
  944. sizeof(kp->dwNumberOfLicenses),
  945. &dwSize,
  946. LICENSEDPACK_COLUMN_AVAILABLE
  947. );
  948. }
  949. if(IsSuccess() == FALSE)
  950. goto cleanup;
  951. //
  952. //
  953. if(dwParam & LICENSEDPACK_PROCESS_ACTIVATEDATE)
  954. {
  955. ProcessSingleColumn(
  956. bFetch,
  957. dwActivateDate,
  958. 0,
  959. &(kp->dwActivateDate),
  960. sizeof(kp->dwActivateDate),
  961. &dwSize,
  962. LICENSEDPACK_COLUMN_ACTIVATEDATE
  963. );
  964. }
  965. if(IsSuccess() == FALSE)
  966. goto cleanup;
  967. //
  968. //
  969. if(dwParam & LICENSEDPACK_PROCESS_EXPIREDATE)
  970. {
  971. ProcessSingleColumn(
  972. bFetch,
  973. dwExpirationDate,
  974. 0,
  975. &(kp->dwExpirationDate),
  976. sizeof(kp->dwExpirationDate),
  977. &dwSize,
  978. LICENSEDPACK_COLUMN_EXPIREDATE
  979. );
  980. }
  981. if(IsSuccess() == FALSE)
  982. goto cleanup;
  983. #if 0
  984. // no more domain sid.
  985. if(dwParam & LICENSEDPACK_PROCESS_DOMAINSID)
  986. {
  987. if(bFetch == TRUE)
  988. {
  989. DWORD size;
  990. m_JetErr = pbDomainSid.FetchColumnValue(
  991. NULL,
  992. 0,
  993. 0,
  994. &size
  995. );
  996. if(IsSuccess() == FALSE)
  997. goto cleanup;
  998. if(size > kp->cbDomainSid || kp->pbDomainSid == NULL)
  999. {
  1000. FreeMemory(kp->pbDomainSid);
  1001. kp->pbDomainSid = (PBYTE)AllocateMemory(kp->cbDomainSid = size);
  1002. if(kp->pbDomainSid == NULL)
  1003. {
  1004. SetLastJetError(JET_errOutOfMemory);
  1005. goto cleanup;
  1006. }
  1007. }
  1008. m_JetErr = pbDomainSid.FetchColumnValue(
  1009. kp->pbDomainSid,
  1010. kp->cbDomainSid,
  1011. 0,
  1012. &kp->cbDomainSid
  1013. );
  1014. }
  1015. else
  1016. {
  1017. ProcessSingleColumn(
  1018. bFetch,
  1019. pbDomainSid,
  1020. 0,
  1021. kp->pbDomainSid,
  1022. kp->cbDomainSid,
  1023. &dwSize,
  1024. LICENSEDPACK_COLUMN_DOMAINSETUPID
  1025. );
  1026. }
  1027. }
  1028. if(IsSuccess() == FALSE)
  1029. goto cleanup;
  1030. #endif
  1031. if(dwParam & LICENSEDPACK_PROCESS_LSSETUPID)
  1032. {
  1033. ProcessSingleColumn(
  1034. bFetch,
  1035. szInstallId,
  1036. 0,
  1037. kp->szInstallId,
  1038. sizeof(kp->szInstallId),
  1039. &dwSize,
  1040. LICENSEDPACK_COLUMN_LSSETUPID
  1041. );
  1042. }
  1043. if(IsSuccess() == FALSE)
  1044. goto cleanup;
  1045. if(dwParam & LICENSEDPACK_PROCESS_DOMAINNAME)
  1046. {
  1047. ProcessSingleColumn(
  1048. bFetch,
  1049. szDomainName,
  1050. 0,
  1051. kp->szDomainName,
  1052. sizeof(kp->szDomainName),
  1053. &dwSize,
  1054. LICENSEDPACK_COLUMN_DOMAINNAME
  1055. );
  1056. }
  1057. if(IsSuccess() == FALSE)
  1058. goto cleanup;
  1059. if(dwParam & LICENSEDPACK_PROCESS_SERVERNAME)
  1060. {
  1061. ProcessSingleColumn(
  1062. bFetch,
  1063. szTlsServerName,
  1064. 0,
  1065. &kp->szTlsServerName,
  1066. sizeof(kp->szTlsServerName),
  1067. &dwSize,
  1068. LICENSEDPACK_COLUMN_LSERVERNAME
  1069. );
  1070. }
  1071. if(IsSuccess() == FALSE)
  1072. goto cleanup;
  1073. if(dwParam & LICENSEDPACK_PROCESS_NEXTSERIALNUMBER)
  1074. {
  1075. ProcessSingleColumn(
  1076. bFetch,
  1077. dwNextSerialNumber,
  1078. 0,
  1079. &(kp->dwNextSerialNumber),
  1080. sizeof(kp->dwNextSerialNumber),
  1081. &dwSize,
  1082. LICENSEDPACK_COLUMN_NEXTSERIALNUMBER
  1083. );
  1084. }
  1085. if(IsSuccess() == FALSE)
  1086. goto cleanup;
  1087. if(dwParam & LICENSEDPACK_PROCESS_ENTRYSTATUS)
  1088. {
  1089. ProcessSingleColumn(
  1090. bFetch,
  1091. ucEntryStatus,
  1092. 0,
  1093. &(kp->ucEntryStatus),
  1094. sizeof(kp->ucEntryStatus),
  1095. &dwSize,
  1096. LICENSEDPACK_COLUMN_ENTRYSTATUS
  1097. );
  1098. }
  1099. cleanup:
  1100. //
  1101. // For inserting/updating record
  1102. if(bFetch == FALSE)
  1103. {
  1104. JET_ERR jetErr;
  1105. jetErr = GetLastJetError();
  1106. //
  1107. // End update will reset the error code
  1108. //
  1109. EndUpdate(IsSuccess() == FALSE);
  1110. if(jetErr != JET_errSuccess && IsSuccess() == FALSE)
  1111. SetLastJetError(jetErr);
  1112. }
  1113. return IsSuccess();
  1114. }
  1115. //-------------------------------------------------------
  1116. JBKeyBase*
  1117. LicPackTable::EnumerationIndex(
  1118. IN BOOL bMatchAll,
  1119. IN DWORD dwParam,
  1120. IN LICENSEPACK* kp,
  1121. IN OUT BOOL* pbCompareKey
  1122. )
  1123. /*
  1124. */
  1125. {
  1126. BOOL bRetCode;
  1127. JBKeyBase* index=NULL;
  1128. //
  1129. // if matching all value in field, set to compare key
  1130. //
  1131. *pbCompareKey = bMatchAll;
  1132. if(dwParam == LICENSEDPACK_FIND_PRODUCT)
  1133. {
  1134. index = new TLSLicensedPackIdxInstalledProduct(kp);
  1135. }
  1136. else if(dwParam == LICENSEDPACK_FIND_LICENSEPACK)
  1137. {
  1138. index = new TLSLicensedPackIdxAllocateLicense(kp);
  1139. }
  1140. else if(dwParam & LICENSEDPACK_PROCESS_SZKEYPACKID)
  1141. {
  1142. index = new TLSLicensedPackIdxKeyPackId(kp);
  1143. }
  1144. else if(dwParam & LICENSEDPACK_PROCESS_COMPANYNAME)
  1145. {
  1146. index = new TLSLicensedPackIdxCompany(kp);
  1147. }
  1148. else if(dwParam & LICENSEDPACK_PROCESS_PRODUCTID)
  1149. {
  1150. index = new TLSLicensedPackIdxProductId(kp);
  1151. }
  1152. else if(dwParam & LICENSEDPACK_PROCESS_MODIFYTIME)
  1153. {
  1154. index = new TLSLicensedPackIdxLastModifyTime(kp);
  1155. }
  1156. else
  1157. {
  1158. index = new TLSLicensedPackIdxInternalKpId(kp);
  1159. //
  1160. // default index, can't compare key even if
  1161. // bmatchall is set to true
  1162. //
  1163. *pbCompareKey = (bMatchAll && (dwParam & LICENSEDPACK_PROCESS_DWINTERNAL));
  1164. }
  1165. return index;
  1166. }
  1167. //-------------------------------------------------------
  1168. BOOL
  1169. LicPackTable::EqualValue(
  1170. IN LICENSEPACK& s1, // values to be compared
  1171. IN LICENSEPACK& s2,
  1172. IN BOOL bMatchAll, // match all specified fields in structure
  1173. IN DWORD dwParam // which fields in KEYPACK to be compared
  1174. )
  1175. /*
  1176. Compare fields in two KEYPACK structure
  1177. s1 : first value
  1178. s2 : second value
  1179. bMatchAll : TRUE if match all field specified in dwParam, FALSE otherwise
  1180. dwParam : fields that will be in comparision
  1181. */
  1182. {
  1183. BOOL bRetCode = TRUE;
  1184. if(dwParam & LICENSEDPACK_PROCESS_ENTRYSTATUS)
  1185. {
  1186. bRetCode = (s1.ucEntryStatus == s2.ucEntryStatus);
  1187. if(bMatchAll != bRetCode)
  1188. goto cleanup;
  1189. }
  1190. if(dwParam & LICENSEDPACK_PROCESS_SZKEYPACKID)
  1191. {
  1192. bRetCode = (_tcscmp(s1.szKeyPackId, s2.szKeyPackId) == 0);
  1193. //
  1194. // bMatchAll == TRUE and bRetCode == FALSE -> return FALSE
  1195. // bMatchAll == FALSE and bRetCode == TRUE -> return TRUE
  1196. if(bMatchAll != bRetCode)
  1197. goto cleanup;
  1198. }
  1199. if(dwParam & LICENSEDPACK_PROCESS_AGREEMENTTYPE)
  1200. {
  1201. bRetCode = (s1.ucAgreementType == s2.ucAgreementType);
  1202. if(bMatchAll != bRetCode)
  1203. goto cleanup;
  1204. }
  1205. if(dwParam & LICENSEDPACK_PROCESS_PRODUCTID)
  1206. {
  1207. bRetCode = (_tcscmp(s1.szProductId, s2.szProductId) == 0);
  1208. if(bMatchAll != bRetCode)
  1209. goto cleanup;
  1210. }
  1211. if(dwParam & LICENSEDPACK_PROCESS_MAJORVERSION)
  1212. {
  1213. bRetCode = (s1.wMajorVersion == s2.wMajorVersion);
  1214. if(bMatchAll != bRetCode)
  1215. goto cleanup;
  1216. }
  1217. if(dwParam & LICENSEDPACK_PROCESS_MINORVERSION)
  1218. {
  1219. bRetCode = (s1.wMinorVersion == s2.wMinorVersion);
  1220. if(bMatchAll != bRetCode)
  1221. goto cleanup;
  1222. }
  1223. if(dwParam & LICENSEDPACK_PROCESS_PLATFORMTYPE)
  1224. {
  1225. bRetCode = (s1.dwPlatformType == s2.dwPlatformType);
  1226. if(bMatchAll != bRetCode)
  1227. goto cleanup;
  1228. }
  1229. if(dwParam & LICENSEDPACK_PROCESS_LICENSETYPE)
  1230. {
  1231. bRetCode = (s1.ucLicenseType == s2.ucLicenseType);
  1232. if(bMatchAll != bRetCode)
  1233. goto cleanup;
  1234. }
  1235. if(dwParam & LICENSEDPACK_PROCESS_COP)
  1236. {
  1237. bRetCode = (s1.ucChannelOfPurchase == s2.ucChannelOfPurchase);
  1238. if(bMatchAll != bRetCode)
  1239. goto cleanup;
  1240. }
  1241. if(dwParam & LICENSEDPACK_PROCESS_BSERIALNUMBER)
  1242. {
  1243. bRetCode = (_tcscmp(s1.szBeginSerialNumber, s2.szBeginSerialNumber) == 0);
  1244. if(bMatchAll != bRetCode)
  1245. goto cleanup;
  1246. }
  1247. if(dwParam & LICENSEDPACK_PROCESS_TOTALLICENSES)
  1248. {
  1249. bRetCode = (s1.dwTotalLicenseInKeyPack == s2.dwTotalLicenseInKeyPack);
  1250. if(bMatchAll != bRetCode)
  1251. goto cleanup;
  1252. }
  1253. if(dwParam & LICENSEDPACK_PROCESS_PRODUCTFLAGS)
  1254. {
  1255. bRetCode = (s1.dwProductFlags == s2.dwProductFlags);
  1256. if(bMatchAll != bRetCode)
  1257. goto cleanup;
  1258. }
  1259. if(dwParam & LICENSEDPACK_PROCESS_COMPANYNAME)
  1260. {
  1261. bRetCode = (_tcscmp(s1.szCompanyName, s2.szCompanyName) == 0);
  1262. if(bMatchAll != bRetCode)
  1263. goto cleanup;
  1264. }
  1265. if(dwParam & LICENSEDPACK_PROCESS_DWINTERNAL)
  1266. {
  1267. bRetCode = (s1.dwKeyPackId == s2.dwKeyPackId);
  1268. if(bMatchAll != bRetCode)
  1269. goto cleanup;
  1270. }
  1271. if(dwParam & LICENSEDPACK_PROCESS_MODIFYTIME)
  1272. {
  1273. bRetCode = (CompareFileTime(&s1.ftLastModifyTime, &s2.ftLastModifyTime) == 0);
  1274. if(bMatchAll != bRetCode)
  1275. goto cleanup;
  1276. }
  1277. if(dwParam & LICENSEDPACK_PROCESS_ATTRIBUTE)
  1278. {
  1279. bRetCode = (s1.dwAttribute == s2.dwAttribute);
  1280. if(bMatchAll != bRetCode)
  1281. goto cleanup;
  1282. }
  1283. if(dwParam & LICENSEDPACK_PROCESS_KEYPACKSTATUS)
  1284. {
  1285. bRetCode = (s1.ucKeyPackStatus == s2.ucKeyPackStatus);
  1286. if(bMatchAll != bRetCode)
  1287. goto cleanup;
  1288. }
  1289. if(dwParam & LICENSEDPACK_PROCESS_AVAILABLE)
  1290. {
  1291. bRetCode = (s1.dwNumberOfLicenses == s2.dwNumberOfLicenses);
  1292. if(bMatchAll != bRetCode)
  1293. goto cleanup;
  1294. }
  1295. if(dwParam & LICENSEDPACK_PROCESS_ACTIVATEDATE)
  1296. {
  1297. bRetCode = (s1.dwActivateDate == s2.dwActivateDate);
  1298. if(bMatchAll != bRetCode)
  1299. goto cleanup;
  1300. }
  1301. if(dwParam & LICENSEDPACK_PROCESS_EXPIREDATE)
  1302. {
  1303. bRetCode = (s1.dwExpirationDate == s2.dwExpirationDate);
  1304. if(bMatchAll != bRetCode)
  1305. goto cleanup;
  1306. }
  1307. //if(dwParam & LICENSEDPACK_PROCESS_DOMAINSID)
  1308. //{
  1309. // bRetCode = EqualSid(s1.pbDomainSid, s2.pbDomainSid);
  1310. // if(bMatchAll != bRetCode)
  1311. // goto cleanup;
  1312. //}
  1313. if(dwParam & LICENSEDPACK_PROCESS_LSSETUPID)
  1314. {
  1315. bRetCode = (_tcsicmp(s1.szInstallId, s2.szInstallId) == 0);
  1316. if(bMatchAll != bRetCode)
  1317. goto cleanup;
  1318. }
  1319. if(dwParam & LICENSEDPACK_PROCESS_DOMAINNAME)
  1320. {
  1321. bRetCode = (_tcsicmp(s1.szDomainName, s2.szDomainName) == 0);
  1322. if(bMatchAll != bRetCode)
  1323. goto cleanup;
  1324. }
  1325. if(dwParam & LICENSEDPACK_PROCESS_SERVERNAME)
  1326. {
  1327. bRetCode = (_tcsicmp(s1.szTlsServerName, s2.szTlsServerName) == 0);
  1328. if(bMatchAll != bRetCode)
  1329. goto cleanup;
  1330. }
  1331. if(dwParam & LICENSEDPACK_PROCESS_NEXTSERIALNUMBER)
  1332. {
  1333. bRetCode = (s1.dwNextSerialNumber == s2.dwNextSerialNumber);
  1334. }
  1335. cleanup:
  1336. return bRetCode;
  1337. }