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.

126 lines
3.0 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. fusionregenumvalues.h
  5. Abstract:
  6. ported from vsee\lib\reg\cenumvalues.h
  7. Author:
  8. Jay Krell (JayKrell) August 2001
  9. Revision History:
  10. --*/
  11. #if !defined(FUSION_INC_REG_CENUMVALUES_H_INCLUDED_) // {
  12. #define FUSION_INC_REG_CENUMVALUES_H_INCLUDED_
  13. #include "windows.h"
  14. #include "fusionbuffer.h"
  15. #include "fusionarray.h"
  16. #include "lhport.h"
  17. namespace F
  18. {
  19. /*-----------------------------------------------------------------------------
  20. Name: CRegEnumValues
  21. @class
  22. This class wraps RegEnumValue (and optimizes by calling RegQueryInfoKey once).
  23. for
  24. (
  25. F::CRegEnumValues ev(hKey);
  26. ev;
  27. ++ev
  28. )
  29. {
  30. DWORD dwType = ev.GetType();
  31. const F::CBaseStringBuffer& strName = ev.GetValueName();
  32. const BYTE* pbData = ev.GetValueData();
  33. DWORD cbData = ev.GetValueDataSize();
  34. }
  35. @hung ev
  36. @owner
  37. -----------------------------------------------------------------------------*/
  38. class CRegEnumValues
  39. {
  40. public:
  41. // @cmember Constructor
  42. CRegEnumValues(HKEY) throw(CErr);
  43. // @cmember are we done yet?
  44. __declspec(nothrow) operator bool() const /*throw()*/;
  45. // @cmember move to the next value
  46. VOID operator++() throw(CErr);
  47. // @cmember move to the next value
  48. VOID operator++(int) throw(CErr);
  49. // @cmember Returns the number of values
  50. __declspec(nothrow) DWORD GetValuesCount() const /*throw()*/;
  51. // @cmember get type
  52. DWORD GetType() const /*throw()*/;
  53. // @cmember get value name
  54. __declspec(nothrow) const F::CBaseStringBuffer& GetValueName() const /*throw()*/;
  55. // @cmember get value data
  56. __declspec(nothrow) const BYTE* GetValueData() const /*throw()*/;
  57. // @cmember get value data size
  58. __declspec(nothrow) DWORD GetValueDataSize() const /*throw()*/;
  59. protected:
  60. // order down here is arbitrary
  61. // @cmember the key being enumerated
  62. HKEY m_hKey;
  63. // @cmember the current index we are into the key's subkeys
  64. DWORD m_dwIndex;
  65. // @cmember the name of the current value
  66. F::CStringBuffer m_strValueName;
  67. // @cmember the data of the current value
  68. CFusionArray<BYTE> m_rgbValueData;
  69. // @cmember the number of values
  70. DWORD m_cValues;
  71. // @cmember the maximum length of the values' names
  72. DWORD m_cchMaxValueNameLength;
  73. // @cmember the maximum length of the values' data
  74. DWORD m_cbMaxValueDataLength;
  75. // @cmember the length of the current value's data
  76. DWORD m_cbCurrentValueDataLength;
  77. // @cmember REG_SZ, REG_DWORD, etc.
  78. DWORD m_dwType;
  79. // @cmember get the current subkey name, called by operator++ and constructor
  80. VOID ThrGet() throw(CErr);
  81. // @cmember get the next subkey name, called by operator++
  82. VOID ThrNext() throw(CErr);
  83. private:
  84. CRegEnumValues(const CRegEnumValues&); // deliberately not impelemented
  85. void operator=(const CRegEnumValues&); // deliberately not impelemented
  86. };
  87. } // namespace
  88. #endif // }