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.

170 lines
5.1 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. actctxctb.cpp
  5. Abstract:
  6. Code to manage the list of activation context contributors in sxs.dll.
  7. Author:
  8. Michael J. Grier (MGrier) 23-Feb-2000
  9. Revision History:
  10. --*/
  11. #include "stdinc.h"
  12. CCriticalSectionNoConstructor g_ActCtxCtbListCritSec;
  13. PACTCTXCTB g_ActCtxCtbListHead;
  14. ULONG g_ActCtxCtbListCount;
  15. BOOL
  16. SxspAddBuiltinActCtxContributor(
  17. ACTCTXCTB_CALLBACK_FUNCTION CallbackFunction,
  18. const GUID *ExtensionGuid,
  19. ULONG SectionId,
  20. ULONG Format,
  21. PCWSTR ContributorName
  22. )
  23. {
  24. CSmartPtr<ACTCTXCTB> Contrib;
  25. BOOL fSuccess = FALSE;
  26. FN_TRACE_WIN32(fSuccess);
  27. PARAMETER_CHECK(
  28. (Format == ACTIVATION_CONTEXT_SECTION_FORMAT_STRING_TABLE) ||
  29. (Format == ACTIVATION_CONTEXT_SECTION_FORMAT_GUID_TABLE) ||
  30. (Format == 0));
  31. PARAMETER_CHECK(CallbackFunction != NULL);
  32. PARAMETER_CHECK(ContributorName != NULL);
  33. IFW32FALSE_EXIT(Contrib.Win32Allocate(__FILE__, __LINE__));
  34. Contrib->m_BuiltinContributor = true;
  35. Contrib->m_CallbackFunction = CallbackFunction;
  36. if (ExtensionGuid != NULL)
  37. {
  38. Contrib->m_ExtensionGuid = *ExtensionGuid;
  39. Contrib->m_IsExtendedSection = ((Contrib->m_ExtensionGuid != GUID_NULL) != FALSE);
  40. }
  41. else
  42. {
  43. Contrib->m_ExtensionGuid = GUID_NULL;
  44. Contrib->m_IsExtendedSection = false;
  45. }
  46. IFW32FALSE_EXIT(Contrib->m_ContributorNameBuffer.Win32Assign(ContributorName, ::wcslen(ContributorName)));
  47. Contrib->m_SectionId = SectionId;
  48. Contrib->m_Format = Format;
  49. Contrib->m_RefCount = 1;
  50. {
  51. CSxsLockCriticalSection lock(g_ActCtxCtbListCritSec);
  52. IFW32FALSE_EXIT(lock.Lock());
  53. Contrib->m_Next = g_ActCtxCtbListHead;
  54. g_ActCtxCtbListHead = Contrib.Detach();
  55. g_ActCtxCtbListCount++;
  56. }
  57. fSuccess = TRUE;
  58. Exit:
  59. return fSuccess;
  60. }
  61. BOOL
  62. SxspInitActCtxContributors(
  63. )
  64. {
  65. FN_PROLOG_WIN32
  66. IFW32FALSE_EXIT(g_ActCtxCtbListCritSec.Initialize());
  67. ASSERT(g_ActCtxCtbListHead == NULL);
  68. ASSERT(g_ActCtxCtbListCount == 0);
  69. IFW32FALSE_EXIT(::SxspAddBuiltinActCtxContributor(
  70. &SxspAssemblyMetadataContributorCallback,
  71. NULL,
  72. ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION,
  73. ACTIVATION_CONTEXT_SECTION_FORMAT_STRING_TABLE,
  74. L"Builtin Assembly Metadata Contributor"));
  75. IFW32FALSE_EXIT(::SxspAddBuiltinActCtxContributor(
  76. &SxspDllRedirectionContributorCallback,
  77. NULL,
  78. ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
  79. ACTIVATION_CONTEXT_SECTION_FORMAT_STRING_TABLE,
  80. L"Builtin DLL Redirection contributor"));
  81. IFW32FALSE_EXIT(::SxspAddBuiltinActCtxContributor(
  82. &SxspWindowClassRedirectionContributorCallback,
  83. NULL,
  84. ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION,
  85. ACTIVATION_CONTEXT_SECTION_FORMAT_STRING_TABLE,
  86. L"Builtin Window Class Redirection contributor"));
  87. IFW32FALSE_EXIT(::SxspAddBuiltinActCtxContributor(
  88. &SxspComClassRedirectionContributorCallback,
  89. NULL,
  90. ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION,
  91. ACTIVATION_CONTEXT_SECTION_FORMAT_GUID_TABLE,
  92. L"Builtin COM Server Redirection contributor"));
  93. IFW32FALSE_EXIT(::SxspAddBuiltinActCtxContributor(
  94. &SxspComProgIdRedirectionContributorCallback,
  95. NULL,
  96. ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION,
  97. ACTIVATION_CONTEXT_SECTION_FORMAT_STRING_TABLE,
  98. L"Builtin COM ProgId redirection contributor"));
  99. IFW32FALSE_EXIT(::SxspAddBuiltinActCtxContributor(
  100. &SxspComTypeLibRedirectionContributorCallback,
  101. NULL,
  102. ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION,
  103. ACTIVATION_CONTEXT_SECTION_FORMAT_GUID_TABLE,
  104. L"Builtin COM Type Library redirection contributor"));
  105. IFW32FALSE_EXIT(::SxspAddBuiltinActCtxContributor(
  106. &SxspComInterfaceRedirectionContributorCallback,
  107. NULL,
  108. ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION,
  109. ACTIVATION_CONTEXT_SECTION_FORMAT_GUID_TABLE,
  110. L"Builtin COM interface redirection contributor"));
  111. IFW32FALSE_EXIT(::SxspAddBuiltinActCtxContributor(
  112. &SxspClrInteropContributorCallback,
  113. NULL,
  114. ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES,
  115. ACTIVATION_CONTEXT_SECTION_FORMAT_GUID_TABLE,
  116. L"Builtin NDP surrogate data contributor"));
  117. FN_EPILOG
  118. }
  119. VOID
  120. SxspUninitActCtxContributors(
  121. VOID
  122. )
  123. {
  124. FN_TRACE();
  125. PACTCTXCTB pCtb;
  126. g_ActCtxCtbListCritSec.Destruct();
  127. pCtb = g_ActCtxCtbListHead;
  128. while (pCtb != NULL)
  129. {
  130. PACTCTXCTB pNext = pCtb->m_Next;
  131. pCtb->Release();
  132. pCtb = pNext;
  133. }
  134. }