Source code of Windows XP (NT5)
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.

66 lines
1.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: cscentry.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef __cscentry_h
  11. #define __cscentry_h
  12. #include <comctrlp.h> // DPA
  13. #include "util.h" // LocalAllocString, LocalFreeString
  14. ///////////////////////////////////////////////////////////////////
  15. // CSCEntry
  16. //
  17. //
  18. class CSCEntry
  19. {
  20. public:
  21. CSCEntry(LPCTSTR pszName, REFGUID rguid)
  22. : m_pszName(NULL), m_Guid(rguid) { LocalAllocString(&m_pszName, pszName); }
  23. ~CSCEntry() { LocalFreeString(&m_pszName); }
  24. LPCTSTR Name() const { return m_pszName; }
  25. REFGUID Guid() const { return m_Guid; }
  26. private:
  27. LPTSTR m_pszName; // E.g. full pathname or sharename
  28. GUID m_Guid; // GUID used to identify this entry
  29. };
  30. ///////////////////////////////////////////////////////////////////
  31. // CSCEntryLog
  32. //
  33. //
  34. class CSCEntryLog
  35. {
  36. public:
  37. CSCEntryLog(HKEY hkRoot, LPCTSTR pszSubkey);
  38. ~CSCEntryLog();
  39. // Access entries
  40. CSCEntry* Get(LPCTSTR pszName);
  41. CSCEntry* Get(REFGUID rguid);
  42. // Add Entries
  43. CSCEntry* Add(LPCTSTR pszName); // Returns existing entry or creates new entry
  44. // Access Registry
  45. HKEY OpenKey(LPCTSTR pszSubkey, REGSAM samDesired);
  46. private:
  47. HKEY m_hkRoot; // KEY_ENUMERATE_SUB_KEYS | KEY_CREATE_SUB_KEY
  48. HDPA m_hdpa; // Holds the entry log in memory
  49. CRITICAL_SECTION m_csDPA; // Protect access to m_hdpa
  50. HKEY OpenKeyInternal(LPTSTR pszSubkey, REGSAM samDesired);
  51. CSCEntry* CreateFromKey(LPTSTR pszSubkey);
  52. HRESULT ReadRegKeys(); // fills m_hdpa
  53. };
  54. #endif