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.

86 lines
2.0 KiB

  1. /**************************************************************************
  2. THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  3. ANY KIND, EITHER EXPRESSED OR TFPLIED, INCLUDING BUT NOT LIMITED TO
  4. THE TFPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  5. PARTICULAR PURPOSE.
  6. Copyright 1997 Microsoft Corporation. All Rights Reserved.
  7. **************************************************************************/
  8. /**************************************************************************
  9. File: Globals.h
  10. **************************************************************************/
  11. /**************************************************************************
  12. global variables
  13. **************************************************************************/
  14. #ifndef GLOBALS_H
  15. #define GLOBALS_H
  16. #include "immxutil.h"
  17. extern HINSTANCE g_hInst;
  18. extern UINT g_DllRefCount;
  19. extern BOOL g_fRunningOnNT;
  20. extern BOOL g_fRunningOnNT5;
  21. extern BOOL g_fRunningOn98;
  22. extern BOOL g_fRunningOn95;
  23. extern BOOL g_fRunningOnFE;
  24. extern UINT g_uACP;
  25. extern LIBTHREAD g_libTLS;
  26. #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
  27. STDAPI SetRegisterLangBand(BOOL bSetReg);
  28. //////////////////////////////////////////////////////////////////////////////
  29. //
  30. // CTipbarCoInitialize
  31. //
  32. //////////////////////////////////////////////////////////////////////////////
  33. class CTipbarCoInitialize
  34. {
  35. public:
  36. CTipbarCoInitialize()
  37. {
  38. _fInitialized = FALSE;
  39. }
  40. ~CTipbarCoInitialize()
  41. {
  42. Assert(!_fInitialized);
  43. }
  44. HRESULT EnsureCoInit()
  45. {
  46. HRESULT hr;
  47. if (_fInitialized)
  48. return S_OK;
  49. hr = CoInitialize(NULL);
  50. if (SUCCEEDED(hr))
  51. _fInitialized = TRUE;
  52. return hr;
  53. }
  54. void CoUninit()
  55. {
  56. if (_fInitialized)
  57. {
  58. CoUninitialize();
  59. _fInitialized = FALSE;
  60. }
  61. }
  62. private:
  63. BOOL _fInitialized;
  64. };
  65. #endif // GLOBALS_H