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.

140 lines
3.1 KiB

  1. ]//+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: w95.cxx
  7. //
  8. // Contents: Win9x specific routines.
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. //
  15. //
  16. // History: 17-Mar-93 BillMo Created.
  17. //
  18. // Notes:
  19. //
  20. // Codework:
  21. //
  22. //--------------------------------------------------------------------------
  23. #include "act.hxx"
  24. extern CSmMutex * gpWIPmxs;
  25. CWIPTable * gpWIPTbl = NULL;
  26. extern HRESULT (*DfCreateSharedAllocator)( IMalloc **ppm );
  27. IMalloc * g_pStgAlloc;
  28. //+-------------------------------------------------------------------
  29. //
  30. // Function: ScmMemAlloc for Chicago
  31. //
  32. // Synopsis: Allocate some shared memory from the storage heap.
  33. //
  34. // Notes: Temporary until we have our own shared heap.
  35. //
  36. //--------------------------------------------------------------------
  37. void *ScmMemAlloc(size_t size)
  38. {
  39. return g_pStgAlloc->Alloc(size);
  40. }
  41. //+-------------------------------------------------------------------
  42. //
  43. // Function: ScmMemFree
  44. //
  45. // Synopsis: Free shared memory from the storage heap.
  46. //
  47. // Notes: Temporary until we have our own shared heap.
  48. //
  49. //--------------------------------------------------------------------
  50. void ScmMemFree(void * pv)
  51. {
  52. g_pStgAlloc->Free(pv);
  53. }
  54. //+-------------------------------------------------------------------
  55. //
  56. // Function: InitSharedLists
  57. //
  58. // Synopsis: If need be, create class cache list, handler list,
  59. // inproc list, local server list
  60. //
  61. // Returns: TRUE if successful, FALSE otherwise.
  62. //
  63. //--------------------------------------------------------------------
  64. BOOL InitSharedLists()
  65. {
  66. HRESULT hr = S_OK;
  67. LONG Status;
  68. if (FAILED(hr = DfCreateSharedAllocator(&g_pStgAlloc)))
  69. {
  70. CairoleDebugOut((DEB_ERROR,
  71. "DfCreateSharedAllocator failed %08x\n", hr));
  72. return(FALSE);
  73. }
  74. if (g_post->gpClassTable == NULL)
  75. {
  76. gpClassTable = g_post->gpClassTable = new CClassTable(Status);
  77. }
  78. else
  79. {
  80. gpClassTable = g_post->gpClassTable;
  81. }
  82. if (g_post->gpSurrogateList == NULL)
  83. {
  84. gpSurrogateList = g_post->gpSurrogateList = new CSurrogateList();
  85. }
  86. else
  87. {
  88. gpSurrogateList = g_post->gpSurrogateList;
  89. }
  90. if (g_post->pscmrot == NULL)
  91. {
  92. gpscmrot = g_post->pscmrot = new CScmRot(hr, NULL);
  93. }
  94. else
  95. {
  96. gpscmrot = g_post->pscmrot;
  97. }
  98. if (g_post->gpWIPTbl == NULL)
  99. {
  100. gpWIPTbl = g_post->gpWIPTbl = new CWIPTable();
  101. }
  102. else
  103. {
  104. gpWIPTbl = g_post->gpWIPTbl;
  105. }
  106. if (gpClassTable == NULL ||
  107. gpscmrot == NULL ||
  108. gpWIPTbl == NULL ||
  109. FAILED(hr))
  110. {
  111. CairoleDebugOut((DEB_ERROR, "InitSharedLists failed.\n"));
  112. delete gpClassTable;
  113. delete gpscmrot;
  114. delete gpWIPTbl;
  115. g_post->gpClassTable = gpClassTable = NULL;
  116. g_post->pscmrot = gpscmrot = NULL;
  117. g_post->gpWIPTbl = gpWIPTbl = NULL;
  118. return(FALSE);
  119. }
  120. gpWIPmxs->Init(TEXT("ScmWIPMutex"), FALSE);
  121. return(TRUE);
  122. }