cscentry.h
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 2k
Category:

Windows Kernel

Development Platform:

Visual C++

  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.     
  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.     HKEY OpenKeyInternal(LPTSTR pszSubkey, REGSAM samDesired);
  52.     CSCEntry* CreateFromKey(LPTSTR pszSubkey);
  53.     HRESULT ReadRegKeys();              // fills m_hdpa
  54. };
  55. #endif