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.

107 lines
2.3 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. fusionregenumkeys.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_CENUMKEYS_H_INCLUDED_) // {
  12. #define FUSION_INC_REG_CENUMKEYS_H_INCLUDED_
  13. #pragma once
  14. #include "windows.h"
  15. #include "fusionbuffer.h"
  16. #include "fusionregkey2.h"
  17. #include "lhport.h"
  18. namespace F
  19. {
  20. /*-----------------------------------------------------------------------------
  21. Name: CRegEnumKeys
  22. @class
  23. This class wraps RegEnumKeyEx (and optimizes by calling RegQueryInfoKey once).
  24. for
  25. (
  26. F::CRegEnumKeys ek(hKey);
  27. ek;
  28. ++ek
  29. )
  30. {
  31. const F::CBaseStringBuffer& strKey = ek;
  32. CKey hKeyChild;
  33. hKeyChild.Open(hKey, strKey);
  34. }
  35. class and lastWriteTime are not exposed, but they easily could be
  36. REVIEW should this be called CEnumSubKeys, @hung esk ?
  37. @hung ek
  38. @owner
  39. -----------------------------------------------------------------------------*/
  40. class CRegEnumKeys
  41. {
  42. public:
  43. // @cmember constructor
  44. CRegEnumKeys(HKEY) throw(CErr);
  45. // @cmember are we done yet?
  46. __declspec(nothrow) operator bool() const /*throw()*/;
  47. // @cmember move to the next subkey
  48. VOID operator++() throw(CErr);
  49. // @cmember move to the next subkey
  50. VOID operator++(int) throw(CErr);
  51. // @cmember get the name of the current subkey
  52. __declspec(nothrow) operator const F::CBaseStringBuffer&() const /*throw()*/;
  53. // @cmember get the name of the current subkey
  54. __declspec(nothrow) operator PCWSTR() const /*throw()*/;
  55. protected:
  56. // @cmember the key being enumerated
  57. HKEY m_hKey;
  58. // @cmember the current index we are into the key's subkeys
  59. DWORD m_dwIndex;
  60. // @cmember the name of a subkey
  61. F::CTinyStringBuffer m_strSubKeyName;
  62. // @cmember the number of subkeys
  63. DWORD m_cSubKeys;
  64. // @cmember the maximum length of the subkeys' names
  65. DWORD m_cchMaxSubKeyNameLength;
  66. // @cmember get the current subkey name, called by operator++ and constructor
  67. VOID ThrGet() throw(CErr);
  68. // @cmember get the next subkey name, called by operator++
  69. VOID ThrNext() throw(CErr);
  70. private:
  71. CRegEnumKeys(const CRegEnumKeys&); // deliberately not impelemented
  72. void operator=(const CRegEnumKeys&); // deliberately not impelemented
  73. };
  74. } // namespace
  75. #endif // }