Leaked source code of windows server 2003

119 lines
3.3 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: rothint.hxx
  7. //
  8. // Contents: Base class for ROT hint table used in NT
  9. //
  10. // History: 24-Jan-95 Ricksa Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #ifndef __ROTHINT_HXX__
  14. #define __ROTHINT_HXX__
  15. // Size of the hint table and size of the SCM's hash table for the ROT.
  16. #define SCM_HASH_SIZE 251
  17. // Name of hint table for non-NT1X
  18. #define ROTHINT_NAME L"Global\\RotHintTable"
  19. //+-------------------------------------------------------------------------
  20. //
  21. // Class: CRotHintTable (rht)
  22. //
  23. // Purpose: Base class for hint table shared between SCM and OLE32.
  24. // It is designed to abstract what is fundamental an array
  25. // of on/off switches.
  26. //
  27. // Interface: SetIndicator - set indicator byte
  28. // ClearIndicator - clear indicator byte
  29. // GetIndicator - get indicator byte.
  30. //
  31. // History: 24-Jan-93 Ricksa Created
  32. //
  33. // Notes:
  34. //
  35. //--------------------------------------------------------------------------
  36. class CRotHintTable
  37. {
  38. public:
  39. CRotHintTable(void);
  40. void SetIndicator(DWORD dwOffset);
  41. void ClearIndicator(DWORD dwOffset);
  42. BOOL GetIndicator(DWORD dwOffset);
  43. protected:
  44. // This memory is allocated by the derived class.
  45. // The SCM actually creates the memory while the
  46. // client just opens the memory.
  47. BYTE * _pbHintArray;
  48. };
  49. //+-------------------------------------------------------------------------
  50. //
  51. // Member: CRotHintTable::CRotHintTable
  52. //
  53. // Synopsis: Initialize object
  54. //
  55. // History: 24-Jan-95 Ricksa Created
  56. //
  57. //--------------------------------------------------------------------------
  58. inline CRotHintTable::CRotHintTable(void) : _pbHintArray(NULL)
  59. {
  60. // Header does all the work
  61. }
  62. //+-------------------------------------------------------------------------
  63. //
  64. // Member: CRotHintTable::SetIndicator
  65. //
  66. // Synopsis: Turn switch on
  67. //
  68. // History: 24-Jan-95 Ricksa Created
  69. //
  70. //--------------------------------------------------------------------------
  71. inline void CRotHintTable::SetIndicator(DWORD dwOffset)
  72. {
  73. _pbHintArray[dwOffset] = TRUE;
  74. }
  75. //+-------------------------------------------------------------------------
  76. //
  77. // Member: CRotHintTable::ClearIndicator
  78. //
  79. // Synopsis: Turn switch off
  80. //
  81. // History: 24-Jan-95 Ricksa Created
  82. //
  83. //--------------------------------------------------------------------------
  84. inline void CRotHintTable::ClearIndicator(DWORD dwOffset)
  85. {
  86. _pbHintArray[dwOffset] = FALSE;
  87. }
  88. //+-------------------------------------------------------------------------
  89. //
  90. // Member: CRotHintTable::GetIndicator
  91. //
  92. // Synopsis: Get the state of the switch
  93. //
  94. // History: 24-Jan-95 Ricksa Created
  95. //
  96. //--------------------------------------------------------------------------
  97. inline BOOL CRotHintTable::GetIndicator(DWORD dwOffset)
  98. {
  99. return _pbHintArray[dwOffset];
  100. }
  101. #endif // __ROTHINT_HXX__