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.

118 lines
2.3 KiB

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