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.

112 lines
2.7 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1996-2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // RegistryValueName.h
  7. //
  8. // Implementation File:
  9. // RegistryValueName.cpp
  10. //
  11. // Description:
  12. // Definition of the CRegistryValueName class.
  13. //
  14. // Maintained by:
  15. // George Potts (GPotts) 22-APR-2002
  16. // Vijayendra Vasu (vvasu) 05-FEB-1999
  17. //
  18. // Revision History:
  19. // None.
  20. //
  21. /////////////////////////////////////////////////////////////////////////////
  22. #pragma once
  23. /////////////////////////////////////////////////////////////////////////////
  24. //++
  25. //
  26. // Class CRegistryValueName
  27. //
  28. // When initialized, this class takes as input the Name and KeyName
  29. // fields of a property table item. It then initializes its member
  30. // variables m_pszName and m_pszKeyName as follows.
  31. //
  32. // m_pszName contains all the characters of Name after the last backslash
  33. // character.
  34. // To m_pszKeyName is appended all the characters of Name upto (but not
  35. // including) the last backslash character.
  36. //
  37. // For example: If Name is "Groups\AdminExtensions" and KeyName is NULL,
  38. // m_pszKeyName will be "Groups" and m_pszName will be "AdminExtensions"
  39. //
  40. // The allocated memory is automatically freed during the destruction of
  41. // the CRegistryValueName object.
  42. //
  43. //--
  44. /////////////////////////////////////////////////////////////////////////////
  45. class CRegistryValueName
  46. {
  47. private:
  48. LPWSTR m_pszName;
  49. LPWSTR m_pszKeyName;
  50. size_t m_cchName;
  51. size_t m_cchKeyName;
  52. // Disallow copying.
  53. const CRegistryValueName & operator =( const CRegistryValueName & rhs );
  54. CRegistryValueName( const CRegistryValueName & source );
  55. DWORD ScAssignName( LPCWSTR pszNewNameIn );
  56. DWORD ScAssignKeyName( LPCWSTR pszNewNameIn );
  57. public:
  58. //
  59. // Construction.
  60. //
  61. // Default constructor
  62. CRegistryValueName( void )
  63. : m_pszName( NULL )
  64. , m_pszKeyName( NULL )
  65. , m_cchName( 0 )
  66. , m_cchKeyName( 0 )
  67. {
  68. } //*** CRegistryValueName
  69. // Destructor
  70. ~CRegistryValueName( void )
  71. {
  72. FreeBuffers();
  73. } //*** ~CRegistryValueName
  74. //
  75. // Initialization and deinitialization routines.
  76. //
  77. // Initialize the object
  78. DWORD ScInit( LPCWSTR pszNameIn, LPCWSTR pszKeyNameIn );
  79. // Deallocate buffers
  80. void FreeBuffers( void );
  81. public:
  82. //
  83. // Access methods.
  84. //
  85. LPCWSTR PszName( void ) const
  86. {
  87. return m_pszName;
  88. } //*** PszName
  89. LPCWSTR PszKeyName( void ) const
  90. {
  91. return m_pszKeyName;
  92. } //*** PszKeyName
  93. }; //*** class CRegistryValueName