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.

70 lines
2.1 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(REFGUID rguid) : m_pszName(NULL), m_Guid(rguid) {}
  22. ~CSCEntry() { LocalFreeString(&m_pszName); }
  23. BOOL Initialize(LPCTSTR pszName) { return LocalAllocString(&m_pszName, 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() : m_hdpa(NULL), m_hkRoot(NULL), m_bCSInited(FALSE) {}
  38. ~CSCEntryLog();
  39. HRESULT Initialize(HKEY hkRoot, LPCTSTR pszSubkey);
  40. // Access entries
  41. CSCEntry* Get(LPCTSTR pszName);
  42. CSCEntry* Get(REFGUID rguid);
  43. // Add Entries
  44. CSCEntry* Add(LPCTSTR pszName); // Returns existing entry or creates new entry
  45. // Access Registry
  46. HKEY OpenKey(LPCTSTR pszSubkey, REGSAM samDesired);
  47. private:
  48. HKEY m_hkRoot; // KEY_ENUMERATE_SUB_KEYS | KEY_CREATE_SUB_KEY
  49. HDPA m_hdpa; // Holds the entry log in memory
  50. CRITICAL_SECTION m_csDPA; // Protect access to m_hdpa
  51. BOOL m_bCSInited;
  52. HKEY OpenKeyInternal(LPTSTR pszSubkey, REGSAM samDesired);
  53. CSCEntry* CreateFromKey(LPTSTR pszSubkey);
  54. HRESULT ReadRegKeys(); // fills m_hdpa
  55. };
  56. #endif