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.

201 lines
5.6 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: globals.c
  3. *
  4. * Copyright (c) 1995-1999 Microsoft Corporation
  5. *
  6. * This module contains all the global variables used in the graphics engine.
  7. * The extern declarations for all of these variables are in engine.h
  8. *
  9. * One should try to minimize the use of globals since most operations are
  10. * based of a PDEV, and different PDEVs have different characteristics.
  11. *
  12. * Globals should basically be limited to globals locks and other permanent
  13. * data structures that never change during the life of the system.
  14. *
  15. * Created: 20-Jun-1995
  16. * Author: Andre Vachon [andreva]
  17. *
  18. \**************************************************************************/
  19. #include "engine.h"
  20. /**************************************************************************\
  21. *
  22. * SEMAPHORES
  23. *
  24. \**************************************************************************/
  25. //
  26. // Define the Driver Management Semaphore. This semaphore must be held
  27. // whenever a reference count for an LDEV or PDEV is being modified. In
  28. // addition, it must be held whenever you don't know for sure that a
  29. // reference count of the LDEV or PDEV you are using is non-zero.
  30. //
  31. // The ghsemDriverMgmt semaphore is used to protect the list of drivers.
  32. // When traversing the list, ghsemDriverMgmt must be held, unless you
  33. // can guarentee that 1) no drivers will be removed and 2) new drivers are
  34. // always inserted at the head of the list. If these two conditions are met,
  35. // then other processes can grab (make a local copy of) the list head under
  36. // semaphore protection. This list can be parsed without regard to any new
  37. // drivers that may be pre-pended to the list. One way to ensure that no
  38. // drivers will be removed is to increment the reference count for each driver
  39. // in the list and then unreference the drivers as they are no longer needed.
  40. // An alternative method to safely parse the list and still allow dirvers to
  41. // be added or removed is as follows:
  42. // 1. grab ghsemDriverMgmt
  43. // 2. obtain pointer to first driver
  44. // 3. reference driver
  45. // 4. release ghsemDriverMgmt
  46. // 5. do some processing
  47. // 6. grab ghsemDriverMgmt
  48. // 7. obtain pointer to next driver
  49. // 8. unreference previous driver
  50. // 9. repeat 2 to 8 until reaching the end of the list
  51. // 10. release ghsemDriverMgmt
  52. //
  53. HSEMAPHORE ghsemDriverMgmt;
  54. HSEMAPHORE ghsemCLISERV;
  55. HSEMAPHORE ghsemRFONTList;
  56. HSEMAPHORE ghsemAtmfdInit;
  57. //
  58. // ghsemPalette synchronizes selecting a palette in and out of DC's and the
  59. // use of a palette without the protection of a exclusive DC lock.
  60. // ResizePalette forces us to protect ourselves because the pointer can
  61. // change under our feet. So we need to be able to synchronize use of
  62. // the ppal by ghsemPalette and exclusive lock of DC.
  63. //
  64. HSEMAPHORE ghsemPalette;
  65. //
  66. // Define the global PFT semaphore. This must be held to access any of the
  67. // physical font information.
  68. //
  69. HSEMAPHORE ghsemPublicPFT;
  70. //
  71. // Global semaphore used for spooling
  72. //
  73. HSEMAPHORE ghsemGdiSpool;
  74. // WNDOBJ operations semaphore
  75. HSEMAPHORE ghsemWndobj;
  76. // glyphset of PFE operations semaphore
  77. HSEMAPHORE ghsemGlyphSet;
  78. #if DBG_CORE
  79. HSEMAPHORE ghsemDEBUG;
  80. #endif
  81. //
  82. // shared devive lock semaphore
  83. //
  84. // ghsemShareDevLock may be acquired for shared access at any time
  85. //
  86. // A thread must be careful when acquiring exclusive accesss. It must not
  87. // hold exclusive access to dev lock otherwise it may cause deadlock to
  88. // occur.
  89. //
  90. HSEMAPHORE ghsemShareDevLock;
  91. //
  92. // The gAssociationListMutex is used to synchronize access to the
  93. // watchdog code's association list.
  94. //
  95. HFASTMUTEX gAssociationListMutex;
  96. /**************************************************************************\
  97. *
  98. * LIST POINTERS
  99. *
  100. \**************************************************************************/
  101. /**************************************************************************\
  102. *
  103. * Drawing stuff
  104. *
  105. \**************************************************************************/
  106. //
  107. // This is to convert BMF constants into # bits per pel
  108. //
  109. ULONG gaulConvert[7] =
  110. {
  111. 0,
  112. 1,
  113. 4,
  114. 8,
  115. 16,
  116. 24,
  117. 32
  118. };
  119. /**************************************************************************\
  120. *
  121. * Font stuff
  122. *
  123. \**************************************************************************/
  124. //
  125. // initialize to some value that's not equal to a Type1 Rasterizer ID
  126. //
  127. UNIVERSAL_FONT_ID gufiLocalType1Rasterizer = { A_VALID_ENGINE_CHECKSUM, 0 };
  128. //
  129. // System default language ID.
  130. //
  131. USHORT gusLanguageID;
  132. //
  133. // Is the system code page DBCS?
  134. //
  135. BOOL gbDBCSCodePage;
  136. //
  137. // Number of TrueType font files loaded.
  138. //
  139. ULONG gcTrueTypeFonts;
  140. //
  141. // The global font enumeration filter type. It can be set to:
  142. // FE_FILTER_NONE normal operation, no extra filtering applied
  143. // FE_FILTER_TRUETYPE only TrueType fonts are enumerated
  144. //
  145. ULONG gulFontInformation;
  146. // for system default charset
  147. BYTE gjCurCharset;
  148. DWORD gfsCurSignature;
  149. // gbGUISetup is set to TRUE during the system GUI setup
  150. // otherwise FALSE
  151. BOOL gbGUISetup = FALSE;
  152. // Globals used for GDI tracing
  153. #if DBG_TRACE
  154. GDITraceClassMask gGDITraceClassMask[GDITRACE_TOTAL_CLASS_MASKS] = { 0 };
  155. GDITraceKeyMask gGDITraceKeyMask[GDITRACE_TOTAL_KEY_MASKS] = { 0 };
  156. GDITraceKeyMask gGDITraceInternalMask[GDITRACE_TOTAL_KEY_MASKS] = { 0 };
  157. HANDLE gGDITraceHandle1 = NULL;
  158. HANDLE gGDITraceHandle2 = NULL;
  159. BOOL gGDITraceHandleBreak = FALSE;
  160. #endif