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.

45 lines
947 B

  1. #ifndef _TESTCONTROL_HPP
  2. #define _TESTCONTROL_HPP
  3. namespace Globals
  4. {
  5. extern BOOL ForceBilinear;
  6. extern BOOL NoICM;
  7. };
  8. // an instance of this class should be constructed in all Text+ calls
  9. // to protect our global structures and cache
  10. class GlobalTextLock
  11. {
  12. public:
  13. GlobalTextLock()
  14. {
  15. ::EnterCriticalSection(&Globals::TextCriticalSection);
  16. }
  17. ~GlobalTextLock()
  18. {
  19. ::LeaveCriticalSection(&Globals::TextCriticalSection);
  20. }
  21. }; // GlobalTextLock
  22. class GlobalTextLockConditional
  23. {
  24. public:
  25. GlobalTextLockConditional(bool bDoLock)
  26. {
  27. _bDoLock = bDoLock;
  28. if (_bDoLock)
  29. ::EnterCriticalSection(&Globals::TextCriticalSection);
  30. }
  31. ~GlobalTextLockConditional()
  32. {
  33. if (_bDoLock)
  34. ::LeaveCriticalSection(&Globals::TextCriticalSection);
  35. }
  36. private:
  37. bool _bDoLock;
  38. }; // GlobalTextLockConditional
  39. #endif