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.

159 lines
5.3 KiB

  1. //=--------------------------------------------------------------------------=
  2. // Globals.H
  3. //=--------------------------------------------------------------------------=
  4. // Copyright 1995 Microsoft Corporation. All Rights Reserved.
  5. //
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  7. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  8. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  9. // PARTICULAR PURPOSE.
  10. //=--------------------------------------------------------------------------=
  11. //
  12. // contains externs and stuff for Global variables, etc ..
  13. //
  14. #ifndef _GLOBALS_H_
  15. // the library that we are
  16. //
  17. extern const CLSID *g_pLibid;
  18. //=--------------------------------------------------------------------------=
  19. // support for licensing
  20. //
  21. extern BOOL g_fMachineHasLicense;
  22. extern BOOL g_fCheckedForLicense;
  23. extern const BOOL g_fUseRuntimeLicInCompositeCtl;
  24. //=--------------------------------------------------------------------------=
  25. // does our server have a type library?
  26. //
  27. extern BOOL g_fServerHasTypeLibrary;
  28. //=--------------------------------------------------------------------------=
  29. // our instance handle, and various pieces of information interesting to
  30. // localization
  31. //
  32. extern HINSTANCE g_hInstance;
  33. extern const VARIANT_BOOL g_fSatelliteLocalization;
  34. #ifdef MDAC_BUILD
  35. extern VARIANT_BOOL g_fSatelliteLangExtension;
  36. #endif
  37. extern VARIANT_BOOL g_fHaveLocale;
  38. extern LCID g_lcidLocale;
  39. //=--------------------------------------------------------------------------=
  40. // apartment threading support.
  41. //
  42. extern CRITICAL_SECTION g_CriticalSection;
  43. //=--------------------------------------------------------------------------=
  44. // critical section for our heap memory leak detection
  45. //
  46. extern CRITICAL_SECTION g_csHeap;
  47. extern BOOL g_fInitCrit;
  48. extern BOOL g_flagConstructorAlloc;
  49. //=--------------------------------------------------------------------------=
  50. // our global memory allocator and global memory pool
  51. //
  52. extern HANDLE g_hHeap;
  53. //=--------------------------------------------------------------------------=
  54. // global parking window for parenting various things.
  55. //
  56. extern HWND g_hwndParking;
  57. //=--------------------------------------------------------------------------=
  58. // system information
  59. //
  60. extern BOOL g_fSysWin95; // we're under Win95 system, not just NT SUR
  61. extern BOOL g_fSysWinNT; // we're under some form of Windows NT
  62. extern BOOL g_fSysWin95Shell; // we're under Win95 or Windows NT SUR { > 3/51)
  63. extern BOOL g_fDBCSEnabled; // system is DBCS enabled
  64. //Vegas 21279 - joejo
  65. //=--------------------------------------------------------------------------=
  66. // OleAut Library Handle
  67. //
  68. #ifdef MDAC_BUILD
  69. extern HINSTANCE g_hOleAutHandle;
  70. #else
  71. extern HANDLE g_hOleAutHandle;
  72. #endif
  73. //Vegas 21279 - joejo
  74. //=-------------------------------------------------------------------------------
  75. // Control Debug Switch implementation
  76. //=-------------------------------------------------------------------------------
  77. //---------------------------------------------------------------------------
  78. // The following macros allow you declare global BOOL variables that are only
  79. // included in the debug build (they map to FALSE in the retail build).
  80. // These boolean switches are automatically persisted (in %WINDIR%\ctlswtch.ini)
  81. // and a console app (ctlswtch.exe) is used to turn on/off the switches.
  82. // All switches must be initialized. This can be done in the InitializeLibrary()
  83. // routine of each control. All switches are initialized to FALSE using the
  84. // INIT_SWITCH macro, and to TRUE using the INIT_SWITCH_TRUE macro.
  85. //
  86. //
  87. // To declare a switch (global scope), define and intialize the switch e.g.
  88. //
  89. //
  90. // DEFINE_SWITCH(fContainer);
  91. //
  92. // AND,
  93. //
  94. // INIT_SWITCH(fContainer);
  95. //
  96. //
  97. // To test whether a switch is currently set (TRUE), use FSWITCH, e.g.
  98. //
  99. // if (FSWITCH(fContainer))
  100. // *ppv = (IOleContainer*)this;
  101. //
  102. //
  103. // To reference a switch declared in another file, use EXTERN_SWITCH, e.g.
  104. //
  105. // EXTERN_SWITCH(fContainer);
  106. //
  107. // AND
  108. //
  109. // INIT_SWITCH(fContainer);
  110. //---------------------------------------------------------------------------
  111. #if DEBUG
  112. // private implementation; use SWITCH macros below to declare and use
  113. class CtlSwitch {
  114. public:
  115. void InitSwitch(char * pszName);
  116. BOOL m_fSet; // TRUE if switch is enabled
  117. char * m_pszName; // name of the switch
  118. CtlSwitch* m_pctlswNext; // next switch in global list
  119. static CtlSwitch* g_pctlswFirst; // head of global list
  120. };
  121. #define DEFINE_SWITCH(NAME) CtlSwitch g_Switch_ ## NAME;
  122. #define INIT_SWITCH(NAME) g_Switch_ ## NAME . InitSwitch(#NAME);
  123. #define EXTERN_SWITCH(NAME) extern CtlSwitch g_Switch_ ## NAME;
  124. #define INIT_SWITCH_TRUE(NAME) g_Switch_ ## NAME . InitSwitch(#NAME); g_Switch_ ## NAME . m_fSet = TRUE;
  125. #define FSWITCH(NAME) (g_Switch_ ## NAME . m_fSet)
  126. #else //DEBUG
  127. #define DEFINE_SWITCH(NAME)
  128. #define INIT_SWITCH(NAME)
  129. #define EXTERN_SWITCH(NAME)
  130. #define INIT_SWITCH_TRUE(NAME)
  131. #define FSWITCH(NAME) FALSE
  132. #endif //DEBUG
  133. #define _GLOBALS_H_
  134. #endif // _GLOBALS_H_