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.

125 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1997-2000 Microsoft Corporation
  3. Module Name:
  4. rndreg.h
  5. Abstract:
  6. Definitions for registry operation classes.
  7. --*/
  8. #ifndef __RENDEZVOUS_REGISTRY__
  9. #define __RENDEZVOUS_REGISTRY__
  10. #pragma once
  11. #include "rndcommc.h"
  12. const DWORD MAX_REG_WSTR_SIZE = 100;
  13. const DWORD MAX_BLOB_TEMPLATE_SIZE = 2000;
  14. const WCHAR REG_SERVER_NAME[] = L"ServerName";
  15. typedef struct
  16. {
  17. OBJECT_ATTRIBUTE Attribute;
  18. WCHAR * wstrValue;
  19. } REG_INFO;
  20. extern REG_INFO g_ConfInstInfoArray[];
  21. extern DWORD g_ContInstInfoArraySize;
  22. class KEY_WRAP
  23. {
  24. public:
  25. KEY_WRAP(IN HKEY Key) : m_Key(Key) {}
  26. ~KEY_WRAP() { if (m_Key) RegCloseKey(m_Key); m_Key = NULL; }
  27. protected:
  28. HKEY m_Key;
  29. };
  30. class CRegistry
  31. {
  32. public:
  33. static WCHAR ms_ServerName[MAX_REG_WSTR_SIZE];
  34. static WCHAR ms_ProtocolId[MAX_REG_WSTR_SIZE];
  35. static WCHAR ms_SubType[MAX_REG_WSTR_SIZE];
  36. static WCHAR ms_AdvertisingScope[MAX_REG_WSTR_SIZE];
  37. static WCHAR ms_IsEncrypted[MAX_REG_WSTR_SIZE];
  38. static DWORD ms_StartTimeOffset;
  39. static DWORD ms_StopTimeOffset;
  40. CRegistry();
  41. ~CRegistry() { if (m_RendezvousKey) RegCloseKey(m_RendezvousKey); }
  42. // inline CCriticalSection &GetCriticalSection();
  43. // inline CEvent &GetEvent();
  44. BOOL NotifyServerNameChange();
  45. static BOOL IsValid() { return (ERROR_SUCCESS == ms_ErrorCode); }
  46. static DWORD GetErrorCode() { return ms_ErrorCode; }
  47. static WCHAR * GetServerName() { return ms_ServerName; }
  48. static WCHAR * GetProtocolId() { return ms_ProtocolId; }
  49. static WCHAR * GetSubType() { return ms_SubType; }
  50. static WCHAR * GetAdvertizingScope() { return ms_AdvertisingScope; }
  51. static WCHAR * GetIsEncrypted() { return ms_IsEncrypted; }
  52. protected:
  53. static DWORD ms_ErrorCode;
  54. // the key is open throughout the lifetime of the CRegistry instance,
  55. // so that any modifications to values under the key may be monitored
  56. HKEY m_RendezvousKey;
  57. // the critical section and the event (in particular) have been declared
  58. // as instance members (rather than static) because the order of
  59. // initialization of static variables is undefined and the event is used
  60. // in the CRegistry constructor
  61. // CCriticalSection m_CriticalSection;
  62. // CEvent m_Event;
  63. static BOOL ReadConfInstValues(
  64. IN HKEY ConfInstKey
  65. );
  66. static BOOL ReadRegValue(
  67. IN HKEY Key,
  68. IN const WCHAR * pName,
  69. IN WCHAR * pValue
  70. );
  71. };
  72. /*
  73. inline CCriticalSection &
  74. CRegistry::GetCriticalSection(
  75. )
  76. {
  77. return m_CriticalSection;
  78. }
  79. inline CEvent &
  80. CRegistry::GetEvent(
  81. )
  82. {
  83. return m_Event;
  84. }
  85. */
  86. #endif // __RENDEZVOUS_REGISTRY__