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.

649 lines
18 KiB

  1. #include "stdinc.h"
  2. #include <windows.h>
  3. #include "sxsp.h"
  4. #include "actctxgenctxctb.h"
  5. #include "sxsexceptionhandling.h"
  6. #include "actctxgenctx.h"
  7. #define ENSURE_LAST_ERROR_SET() \
  8. do \
  9. { \
  10. ASSERT(::FusionpGetLastWin32Error() != ERROR_SUCCESS); \
  11. if (::FusionpGetLastWin32Error() == ERROR_SUCCESS) \
  12. ::FusionpSetLastWin32Error(ERROR_INTERNAL_ERROR); \
  13. } while (0)
  14. /*-----------------------------------------------------------------------------
  15. ACTivation ConTeXt GENneration ConTeXt ConTriButor
  16. -----------------------------------------------------------------------------*/
  17. int
  18. CActivationContextGenerationContextContributor::Compare(
  19. const void *pelem1,
  20. const void *pelem2
  21. )
  22. {
  23. const CActivationContextGenerationContextContributor *Ctb1 = reinterpret_cast<const CActivationContextGenerationContextContributor *>(pelem1);
  24. const CActivationContextGenerationContextContributor *Ctb2 = reinterpret_cast<const CActivationContextGenerationContextContributor *>(pelem2);
  25. if (Ctb1->IsExtendedSection())
  26. {
  27. if (!Ctb2->IsExtendedSection())
  28. return -1;
  29. // otherwise they're both extended...
  30. int i = memcmp(Ctb1->m_ActCtxCtb->GetExtensionGuidPtr(), Ctb2->m_ActCtxCtb->GetExtensionGuidPtr(), sizeof(GUID));
  31. if (i != 0)
  32. return i;
  33. }
  34. else
  35. {
  36. if (Ctb2->IsExtendedSection())
  37. return +1;
  38. }
  39. // comparison of unsigned numbers by subtraction does not work,
  40. // you can cast them to signed first, but this seems cleaner
  41. const ULONG sectionId1 = Ctb1->m_ActCtxCtb->m_SectionId;
  42. const ULONG sectionId2 = Ctb2->m_ActCtxCtb->m_SectionId;
  43. if (sectionId1 < sectionId2)
  44. return -1;
  45. if (sectionId1 > sectionId2)
  46. return +1;
  47. return 0;
  48. }
  49. CActivationContextGenerationContextContributor::~CActivationContextGenerationContextContributor()
  50. {
  51. FN_TRACE();
  52. if (m_ActCtxCtb != NULL)
  53. {
  54. CSxsPreserveLastError ple;
  55. m_ActCtxCtb->Release();
  56. ple.Restore();
  57. }
  58. }
  59. VOID
  60. CActivationContextGenerationContextContributor::PopulateCallbackHeader(
  61. ACTCTXCTB_CBHEADER &Header,
  62. ULONG Reason,
  63. PACTCTXGENCTX pActCtxGenCtx
  64. )
  65. {
  66. FN_TRACE();
  67. Header.Reason = Reason;
  68. Header.Flags = pActCtxGenCtx->m_Flags;
  69. Header.ManifestOperation = pActCtxGenCtx->m_ManifestOperation;
  70. Header.ManifestOperationFlags = pActCtxGenCtx->m_ManifestOperationFlags;
  71. Header.InstallationContext = &pActCtxGenCtx->m_InstallationContext;
  72. Header.ClsidMappingContext = &pActCtxGenCtx->m_ClsidMappingContext;
  73. Header.ExtensionGuid = m_ActCtxCtb->GetExtensionGuidPtr();
  74. Header.SectionId = m_ActCtxCtb->m_SectionId;
  75. Header.ContributorContext = m_ActCtxCtb->m_ContributorContext;
  76. Header.pOriginalActCtxGenCtx = pActCtxGenCtx;
  77. if (m_ManifestParseContextValid)
  78. Header.ManifestParseContext = m_ManifestParseContext;
  79. else
  80. Header.ManifestParseContext = NULL;
  81. Header.ActCtxGenContext = m_ActCtxGenContext;
  82. }
  83. BOOL
  84. CActivationContextGenerationContextContributor::Initialize(
  85. PACTCTXCTB ActCtxCtb,
  86. PVOID ActCtxGenContext
  87. )
  88. {
  89. BOOL fSuccess = FALSE;
  90. FN_TRACE_WIN32(fSuccess);
  91. INTERNAL_ERROR_CHECK(m_ActCtxCtb == NULL);
  92. INTERNAL_ERROR_CHECK(m_ActCtxGenContext == NULL);
  93. PARAMETER_CHECK(ActCtxCtb != NULL);
  94. ActCtxCtb->AddRef();
  95. m_ActCtxCtb = ActCtxCtb;
  96. m_ActCtxGenContext = ActCtxGenContext;
  97. m_IsExtendedSection = ActCtxCtb->m_IsExtendedSection;
  98. fSuccess = TRUE;
  99. Exit:
  100. return fSuccess;
  101. }
  102. PCWSTR
  103. CActivationContextGenerationContextContributor::Name() const
  104. {
  105. return m_ActCtxCtb->m_ContributorNameBuffer;
  106. }
  107. const GUID &
  108. CActivationContextGenerationContextContributor::ExtensionGuid() const
  109. {
  110. return m_ActCtxCtb->m_ExtensionGuid;
  111. }
  112. ULONG
  113. CActivationContextGenerationContextContributor::SectionId() const
  114. {
  115. return m_ActCtxCtb->m_SectionId;
  116. }
  117. ULONG
  118. CActivationContextGenerationContextContributor::SectionFormat() const
  119. {
  120. return m_ActCtxCtb->m_Format;
  121. }
  122. BOOL
  123. CActivationContextGenerationContextContributor::Fire_AllParsingDone(
  124. PACTCTXGENCTX pActCtxGenCtx
  125. )
  126. {
  127. BOOL fSuccess = FALSE;
  128. FN_TRACE_WIN32(fSuccess);
  129. ACTCTXCTB_CBALLPARSINGDONE CBData;
  130. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_ALLPARSINGDONE, pActCtxGenCtx);
  131. CBData.Success = TRUE;
  132. ::FusionpSetLastWin32Error(ERROR_SUCCESS);
  133. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  134. if (!CBData.Success)
  135. {
  136. ENSURE_LAST_ERROR_SET();
  137. pActCtxGenCtx->m_ManifestOperationFlags |= MANIFEST_OPERATION_INSTALL_FLAG_ABORT;
  138. goto Exit;
  139. }
  140. fSuccess = TRUE;
  141. Exit:
  142. return fSuccess;
  143. }
  144. BOOL
  145. CActivationContextGenerationContextContributor::Fire_GetSectionSize(
  146. PACTCTXGENCTX pActCtxGenCtx
  147. )
  148. {
  149. BOOL fSuccess = FALSE;
  150. FN_TRACE_WIN32(fSuccess);
  151. ACTCTXCTB_CBGETSECTIONSIZE CBData;
  152. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_GETSECTIONSIZE, pActCtxGenCtx);
  153. CBData.SectionSize = 0;
  154. CBData.Success = TRUE;
  155. ::FusionpSetLastWin32Error(ERROR_SUCCESS);
  156. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  157. if (!CBData.Success)
  158. {
  159. ENSURE_LAST_ERROR_SET();
  160. pActCtxGenCtx->m_ManifestOperationFlags |= MANIFEST_OPERATION_INSTALL_FLAG_ABORT;
  161. goto Exit;
  162. }
  163. m_SectionSize = CBData.SectionSize;
  164. fSuccess = TRUE;
  165. Exit:
  166. return fSuccess;
  167. }
  168. BOOL
  169. CActivationContextGenerationContextContributor::Fire_GetSectionData(
  170. PACTCTXGENCTX pActCtxGenCtx,
  171. PVOID Buffer
  172. )
  173. {
  174. BOOL fSuccess = TRUE;
  175. FN_TRACE_WIN32(fSuccess);
  176. ACTCTXCTB_CBGETSECTIONDATA CBData;
  177. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_GETSECTIONDATA, pActCtxGenCtx);
  178. CBData.SectionSize = m_SectionSize;
  179. CBData.SectionDataStart = Buffer;
  180. CBData.Success = TRUE;
  181. ::FusionpSetLastWin32Error(ERROR_SUCCESS);
  182. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  183. if (!CBData.Success)
  184. {
  185. ENSURE_LAST_ERROR_SET();
  186. pActCtxGenCtx->m_ManifestOperationFlags |= MANIFEST_OPERATION_INSTALL_FLAG_ABORT;
  187. goto Exit;
  188. }
  189. fSuccess = TRUE;
  190. Exit:
  191. return fSuccess;
  192. }
  193. BOOL
  194. CActivationContextGenerationContextContributor::Fire_ParseEnding(
  195. PACTCTXGENCTX pActCtxGenCtx,
  196. PCACTCTXCTB_ASSEMBLY_CONTEXT AssemblyContext
  197. )
  198. {
  199. BOOL fSuccess = FALSE;
  200. FN_TRACE_WIN32(fSuccess);
  201. if ((m_ActCtxCtb != NULL) &&
  202. (m_ManifestParseContextValid) &&
  203. (!m_NoMoreCallbacksThisFile))
  204. {
  205. if (m_ManifestParseContextValid)
  206. {
  207. ACTCTXCTB_CBPARSEENDING CBData;
  208. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_PARSEENDING, pActCtxGenCtx);
  209. CBData.AssemblyContext = AssemblyContext;
  210. CBData.Success = TRUE;
  211. ::FusionpSetLastWin32Error(ERROR_SUCCESS);
  212. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  213. if (!CBData.Success)
  214. {
  215. ENSURE_LAST_ERROR_SET();
  216. pActCtxGenCtx->m_ManifestOperationFlags |= MANIFEST_OPERATION_INSTALL_FLAG_ABORT;
  217. goto Exit;
  218. }
  219. }
  220. }
  221. fSuccess = TRUE;
  222. Exit:
  223. return fSuccess;
  224. }
  225. VOID
  226. CActivationContextGenerationContextContributor::Fire_ParseEnded(
  227. PACTCTXGENCTX pActCtxGenCtx,
  228. PCACTCTXCTB_ASSEMBLY_CONTEXT AssemblyContext
  229. )
  230. {
  231. FN_TRACE();
  232. if ((m_ActCtxCtb != NULL) &&
  233. (m_ManifestParseContextValid) &&
  234. (!m_NoMoreCallbacksThisFile))
  235. {
  236. if (m_ManifestParseContextValid)
  237. {
  238. CSxsPreserveLastError ple;
  239. ACTCTXCTB_CBPARSEENDED CBData;
  240. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_PARSEENDED, pActCtxGenCtx);
  241. CBData.AssemblyContext = AssemblyContext;
  242. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  243. m_ManifestParseContextValid = FALSE;
  244. m_ManifestParseContext = NULL;
  245. ple.Restore();
  246. }
  247. }
  248. }
  249. BOOL
  250. CActivationContextGenerationContextContributor::Fire_ActCtxGenEnding(
  251. PACTCTXGENCTX pActCtxGenCtx
  252. )
  253. {
  254. BOOL fSuccess = FALSE;
  255. FN_TRACE_WIN32(fSuccess);
  256. if (m_ActCtxCtb != NULL)
  257. {
  258. ACTCTXCTB_CBACTCTXGENENDING CBData;
  259. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_ACTCTXGENENDING, pActCtxGenCtx);
  260. CBData.Success = TRUE;
  261. ::FusionpSetLastWin32Error(ERROR_SUCCESS);
  262. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  263. if (!CBData.Success)
  264. {
  265. ENSURE_LAST_ERROR_SET();
  266. pActCtxGenCtx->m_ManifestOperationFlags |= MANIFEST_OPERATION_INSTALL_FLAG_ABORT;
  267. goto Exit;
  268. }
  269. }
  270. fSuccess = TRUE;
  271. Exit:
  272. return fSuccess;
  273. }
  274. VOID
  275. CActivationContextGenerationContextContributor::Fire_ActCtxGenEnded(
  276. PACTCTXGENCTX pActCtxGenCtx
  277. )
  278. {
  279. FN_TRACE();
  280. if (m_ActCtxCtb != NULL)
  281. {
  282. CSxsPreserveLastError ple;
  283. ACTCTXCTB_CBACTCTXGENENDED CBData;
  284. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_ACTCTXGENENDED, pActCtxGenCtx);
  285. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  286. m_ActCtxGenContext = NULL;
  287. ple.Restore();
  288. }
  289. }
  290. BOOL
  291. CActivationContextGenerationContextContributor::Fire_BeginChildren(
  292. PACTCTXGENCTX pActCtxGenCtx,
  293. PCACTCTXCTB_ASSEMBLY_CONTEXT AssemblyContext,
  294. PCACTCTXCTB_PARSE_CONTEXT ParseContext,
  295. PCSXS_NODE_INFO NodeInfo
  296. )
  297. {
  298. BOOL fSuccess = FALSE;
  299. FN_TRACE_WIN32(fSuccess);
  300. if (!m_NoMoreCallbacksThisFile)
  301. {
  302. ACTCTXCTB_CBBEGINCHILDREN CBData;
  303. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_BEGINCHILDREN, pActCtxGenCtx);
  304. CBData.AssemblyContext = AssemblyContext;
  305. CBData.ParseContext = ParseContext;
  306. CBData.NodeInfo = NodeInfo;
  307. CBData.Success = TRUE;
  308. ::FusionpSetLastWin32Error(ERROR_SUCCESS);
  309. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  310. if (!CBData.Success)
  311. {
  312. ENSURE_LAST_ERROR_SET();
  313. pActCtxGenCtx->m_ManifestOperationFlags |= MANIFEST_OPERATION_INSTALL_FLAG_ABORT;
  314. goto Exit;
  315. }
  316. }
  317. fSuccess = TRUE;
  318. Exit:
  319. return fSuccess;
  320. }
  321. BOOL
  322. CActivationContextGenerationContextContributor::Fire_EndChildren(
  323. PACTCTXGENCTX pActCtxGenCtx,
  324. PCACTCTXCTB_ASSEMBLY_CONTEXT AssemblyContext,
  325. PCACTCTXCTB_PARSE_CONTEXT ParseContext,
  326. BOOL Empty,
  327. PCSXS_NODE_INFO NodeInfo
  328. )
  329. {
  330. BOOL fSuccess = FALSE;
  331. FN_TRACE_WIN32(fSuccess);
  332. if (!m_NoMoreCallbacksThisFile)
  333. {
  334. ACTCTXCTB_CBENDCHILDREN CBData;
  335. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_ENDCHILDREN, pActCtxGenCtx);
  336. CBData.Empty = Empty;
  337. CBData.NodeInfo = NodeInfo;
  338. CBData.ParseContext = ParseContext;
  339. CBData.AssemblyContext = AssemblyContext;
  340. CBData.Success = TRUE;
  341. ::FusionpSetLastWin32Error(ERROR_SUCCESS);
  342. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  343. if (!CBData.Success)
  344. {
  345. ENSURE_LAST_ERROR_SET();
  346. pActCtxGenCtx->m_ManifestOperationFlags |= MANIFEST_OPERATION_INSTALL_FLAG_ABORT;
  347. goto Exit;
  348. }
  349. }
  350. fSuccess = TRUE;
  351. Exit:
  352. return fSuccess;
  353. }
  354. BOOL
  355. CActivationContextGenerationContextContributor::Fire_ElementParsed(
  356. PACTCTXGENCTX pActCtxGenCtx,
  357. PCACTCTXCTB_ASSEMBLY_CONTEXT AssemblyContext,
  358. PCACTCTXCTB_PARSE_CONTEXT ParseContext,
  359. USHORT NodeCount,
  360. PCSXS_NODE_INFO NodeInfo
  361. )
  362. {
  363. BOOL fSuccess = FALSE;
  364. FN_TRACE_WIN32(fSuccess);
  365. if (!m_NoMoreCallbacksThisFile)
  366. {
  367. ACTCTXCTB_CBELEMENTPARSED CBData;
  368. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_ELEMENTPARSED, pActCtxGenCtx);
  369. CBData.NodeCount = NodeCount;
  370. CBData.NodeInfo = NodeInfo;
  371. CBData.ParseContext = ParseContext;
  372. CBData.AssemblyContext = AssemblyContext;
  373. CBData.Success = TRUE;
  374. ::FusionpSetLastWin32Error(ERROR_SUCCESS);
  375. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  376. if (!CBData.Success)
  377. {
  378. ENSURE_LAST_ERROR_SET();
  379. pActCtxGenCtx->m_ManifestOperationFlags |= MANIFEST_OPERATION_INSTALL_FLAG_ABORT;
  380. goto Exit;
  381. }
  382. }
  383. fSuccess = TRUE;
  384. Exit:
  385. return fSuccess;
  386. }
  387. BOOL
  388. CActivationContextGenerationContextContributor::Fire_PCDATAParsed(
  389. PACTCTXGENCTX pActCtxGenCtx,
  390. PCACTCTXCTB_ASSEMBLY_CONTEXT AssemblyContext,
  391. PCACTCTXCTB_PARSE_CONTEXT ParseContext,
  392. const WCHAR *String,
  393. ULONG Cch
  394. )
  395. {
  396. BOOL fSuccess = FALSE;
  397. FN_TRACE_WIN32(fSuccess);
  398. if (!m_NoMoreCallbacksThisFile)
  399. {
  400. ACTCTXCTB_CBPCDATAPARSED CBData;
  401. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_PCDATAPARSED, pActCtxGenCtx);
  402. CBData.ParseContext = ParseContext;
  403. CBData.AssemblyContext = AssemblyContext;
  404. CBData.Text = String;
  405. CBData.TextCch = Cch;
  406. CBData.Success = TRUE;
  407. ::FusionpSetLastWin32Error(ERROR_SUCCESS);
  408. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  409. if (!CBData.Success)
  410. {
  411. ENSURE_LAST_ERROR_SET();
  412. pActCtxGenCtx->m_ManifestOperationFlags |= MANIFEST_OPERATION_INSTALL_FLAG_ABORT;
  413. goto Exit;
  414. }
  415. }
  416. fSuccess = TRUE;
  417. Exit:
  418. return fSuccess;
  419. }
  420. BOOL
  421. CActivationContextGenerationContextContributor::Fire_CDATAParsed(
  422. PACTCTXGENCTX pActCtxGenCtx,
  423. PCACTCTXCTB_ASSEMBLY_CONTEXT AssemblyContext,
  424. PCACTCTXCTB_PARSE_CONTEXT ParseContext,
  425. const WCHAR *String,
  426. ULONG Cch
  427. )
  428. {
  429. BOOL fSuccess = FALSE;
  430. FN_TRACE_WIN32(fSuccess);
  431. if (!m_NoMoreCallbacksThisFile)
  432. {
  433. ACTCTXCTB_CBCDATAPARSED CBData;
  434. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_CDATAPARSED, pActCtxGenCtx);
  435. CBData.ParseContext = ParseContext;
  436. CBData.AssemblyContext = AssemblyContext;
  437. CBData.Text = String;
  438. CBData.TextCch = Cch;
  439. CBData.Success = TRUE;
  440. ::FusionpSetLastWin32Error(ERROR_SUCCESS);
  441. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  442. if (!CBData.Success)
  443. {
  444. ENSURE_LAST_ERROR_SET();
  445. pActCtxGenCtx->m_ManifestOperationFlags |= MANIFEST_OPERATION_INSTALL_FLAG_ABORT;
  446. goto Exit;
  447. }
  448. }
  449. fSuccess = TRUE;
  450. Exit:
  451. return fSuccess;
  452. }
  453. BOOL
  454. CActivationContextGenerationContextContributor::Fire_IdentityDetermined(
  455. PACTCTXGENCTX pActCtxGenCtx,
  456. PCACTCTXCTB_ASSEMBLY_CONTEXT AssemblyContext,
  457. PCACTCTXCTB_PARSE_CONTEXT ParseContext,
  458. PCASSEMBLY_IDENTITY AssemblyIdentity
  459. )
  460. {
  461. BOOL fSuccess = FALSE;
  462. FN_TRACE_WIN32(fSuccess);
  463. if (!m_NoMoreCallbacksThisFile)
  464. {
  465. ACTCTXCTB_CBIDENTITYDETERMINED CBData;
  466. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_IDENTITYDETERMINED, pActCtxGenCtx);
  467. CBData.AssemblyIdentity = AssemblyIdentity;
  468. CBData.ParseContext = ParseContext;
  469. CBData.AssemblyContext = AssemblyContext;
  470. CBData.Success = TRUE;
  471. ::FusionpSetLastWin32Error(ERROR_SUCCESS);
  472. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  473. if (!CBData.Success)
  474. {
  475. ENSURE_LAST_ERROR_SET();
  476. pActCtxGenCtx->m_ManifestOperationFlags |= MANIFEST_OPERATION_INSTALL_FLAG_ABORT;
  477. goto Exit;
  478. }
  479. }
  480. fSuccess = TRUE;
  481. Exit:
  482. return fSuccess;
  483. }
  484. BOOL
  485. CActivationContextGenerationContextContributor::Fire_ParseBeginning(
  486. PACTCTXGENCTX pActCtxGenCtx,
  487. PCACTCTXCTB_ASSEMBLY_CONTEXT AssemblyContext,
  488. DWORD FileFlags,
  489. ULONG ParseType,
  490. ULONG FilePathType,
  491. PCWSTR FilePath,
  492. SIZE_T FilePathCch,
  493. const FILETIME &FileLastWriteTime,
  494. ULONG FileFormatVersionMajor,
  495. ULONG FileFormatVersionMinor,
  496. ULONG MetadataSatelliteRosterIndex
  497. )
  498. {
  499. BOOL fSuccess = FALSE;
  500. FN_TRACE_WIN32(fSuccess);
  501. ACTCTXCTB_CBPARSEBEGINNING CBData;
  502. PARAMETER_CHECK(FilePathType == ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE);
  503. INTERNAL_ERROR_CHECK(!m_ManifestParseContextValid);
  504. this->PopulateCallbackHeader(CBData.Header, ACTCTXCTB_CBREASON_PARSEBEGINNING, pActCtxGenCtx);
  505. CBData.FileFlags = FileFlags;
  506. CBData.ParseType = ParseType;
  507. CBData.AssemblyContext = AssemblyContext;
  508. CBData.FilePath = FilePath;
  509. CBData.FilePathCch = FilePathCch;
  510. CBData.FilePathType = FilePathType;
  511. CBData.FileLastWriteTime = FileLastWriteTime;
  512. CBData.FileFormatVersionMajor = FileFormatVersionMajor;
  513. CBData.FileFormatVersionMinor = FileFormatVersionMinor;
  514. CBData.MetadataSatelliteRosterIndex = MetadataSatelliteRosterIndex;
  515. CBData.NoMoreCallbacksThisFile = FALSE;
  516. CBData.Success = TRUE;
  517. (*(m_ActCtxCtb->m_CallbackFunction))((PACTCTXCTB_CALLBACK_DATA) &CBData.Header);
  518. if (!CBData.Success)
  519. {
  520. ENSURE_LAST_ERROR_SET();
  521. pActCtxGenCtx->m_ManifestOperationFlags |= MANIFEST_OPERATION_INSTALL_FLAG_ABORT;
  522. goto Exit;
  523. }
  524. m_NoMoreCallbacksThisFile = CBData.NoMoreCallbacksThisFile;
  525. if (!m_NoMoreCallbacksThisFile)
  526. {
  527. // If they set the no more callbacks flag, we don't track the parse context.
  528. m_ManifestParseContext = CBData.Header.ManifestParseContext;
  529. m_ManifestParseContextValid = TRUE;
  530. }
  531. else
  532. {
  533. m_ManifestParseContext = NULL;
  534. m_ManifestParseContextValid = FALSE;
  535. // You can't pass back a per-file parsing context if you don't want any more callbacks for this
  536. // file.
  537. ASSERT(CBData.Header.ManifestParseContext == NULL);
  538. }
  539. fSuccess = TRUE;
  540. Exit:
  541. return fSuccess;
  542. }