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.

115 lines
2.2 KiB

  1. #include "stdinc.h"
  2. #include "componentpolicytable.h"
  3. BOOL
  4. CComponentPolicyTableHelper::HashKey(
  5. PCASSEMBLY_IDENTITY AssemblyIdentity,
  6. ULONG &rulPseudoKey
  7. )
  8. {
  9. BOOL fSuccess = FALSE;
  10. FN_TRACE_WIN32(fSuccess);
  11. PARAMETER_CHECK(AssemblyIdentity != NULL);
  12. IFW32FALSE_EXIT(::SxsHashAssemblyIdentity(0, AssemblyIdentity, &rulPseudoKey));
  13. fSuccess = TRUE;
  14. Exit:
  15. return fSuccess;
  16. }
  17. BOOL
  18. CComponentPolicyTableHelper::CompareKey(
  19. PCASSEMBLY_IDENTITY keyin,
  20. const PCASSEMBLY_IDENTITY &rkeystored,
  21. bool &rfMatch
  22. )
  23. {
  24. BOOL fSuccess = FALSE;
  25. FN_TRACE_WIN32(fSuccess);
  26. BOOL fEqual = FALSE;
  27. rfMatch = false;
  28. PARAMETER_CHECK(keyin != NULL);
  29. PARAMETER_CHECK(rkeystored != NULL);
  30. IFW32FALSE_EXIT(::SxsAreAssemblyIdentitiesEqual(0, keyin, rkeystored, &fEqual));
  31. if (fEqual)
  32. rfMatch = true;
  33. fSuccess = TRUE;
  34. Exit:
  35. return fSuccess;
  36. }
  37. BOOL
  38. CComponentPolicyTableHelper::InitializeKey(
  39. PCASSEMBLY_IDENTITY keyin,
  40. PCASSEMBLY_IDENTITY &rkeystored
  41. )
  42. {
  43. BOOL fSuccess = FALSE;
  44. FN_TRACE_WIN32(fSuccess);
  45. PASSEMBLY_IDENTITY AssemblyIdentity = NULL;
  46. rkeystored = NULL;
  47. PARAMETER_CHECK(keyin != NULL);
  48. IFW32FALSE_EXIT(
  49. ::SxsDuplicateAssemblyIdentity(
  50. SXS_DUPLICATE_ASSEMBLY_IDENTITY_FLAG_FREEZE,
  51. keyin,
  52. &AssemblyIdentity));
  53. rkeystored = AssemblyIdentity;
  54. AssemblyIdentity = NULL;
  55. fSuccess = TRUE;
  56. Exit:
  57. if (AssemblyIdentity != NULL)
  58. ::SxsDestroyAssemblyIdentity(AssemblyIdentity);
  59. return fSuccess;
  60. }
  61. BOOL
  62. CComponentPolicyTableHelper::InitializeValue(
  63. CPolicyStatement *vin,
  64. CPolicyStatement *&rvstored
  65. )
  66. {
  67. BOOL fSuccess = FALSE;
  68. FN_TRACE_WIN32(fSuccess);
  69. PARAMETER_CHECK(vin != NULL);
  70. INTERNAL_ERROR_CHECK(rvstored == NULL);
  71. rvstored = vin;
  72. fSuccess = TRUE;
  73. Exit:
  74. return fSuccess;
  75. }
  76. BOOL
  77. CComponentPolicyTableHelper::UpdateValue(
  78. CPolicyStatement *vin,
  79. CPolicyStatement *&rvstored
  80. )
  81. {
  82. BOOL fSuccess = FALSE;
  83. FN_TRACE_WIN32(fSuccess);
  84. if (rvstored != NULL)
  85. FUSION_DELETE_SINGLETON(rvstored);
  86. rvstored = vin;
  87. fSuccess = TRUE;
  88. return fSuccess;
  89. }