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.

59 lines
2.1 KiB

  1. #ifndef __REGINS_H_
  2. #define __REGINS_H_
  3. #define RH_HKCR TEXT("HKCR\\")
  4. #define RH_HKCU TEXT("HKCU\\")
  5. #define RH_HKLM TEXT("HKLM\\")
  6. #define RH_HKU TEXT("HKU\\")
  7. struct CRegInsMap {
  8. // Operations
  9. public:
  10. HRESULT PerformAction(HKEY *phk = NULL);
  11. HRESULT RegToIns(HKEY *phk = NULL, BOOL fClear = FALSE);
  12. HRESULT InsToReg(HKEY *phk = NULL, BOOL fClear = FALSE);
  13. HRESULT RegToInsArray(CRegInsMap *prg, UINT cEntries, BOOL fClear = FALSE);
  14. HRESULT InsToRegArray(CRegInsMap *prg, UINT cEntries, BOOL fClear = FALSE);
  15. // Properties
  16. public:
  17. LPCTSTR m_pszRegKey;
  18. LPCTSTR m_pszRegValue;
  19. DWORD m_dwFlags;
  20. static LPCTSTR s_pszIns;
  21. LPCTSTR m_pszInsSection;
  22. LPCTSTR m_pszInsKey;
  23. // Implementation
  24. public:
  25. // implementation helper routines
  26. void openRegKey(HKEY *phk);
  27. #define GH_LOOKUPONLY 0x0001
  28. #define GH_DEFAULT 0x0000
  29. HRESULT getHive(HKEY *phk, LPCTSTR *ppszRegKey, WORD wFlags = GH_DEFAULT);
  30. // REVIEW: (andrewgu)
  31. // 1. add support for removing values not just moving;
  32. // 2. add support for reusing the reg key (perf) also if hk is provided and so is reg key,
  33. // open the key still but base it on hk;
  34. // 3. (shortcoming) in a run through array there'll be calls to getHive for every item, the
  35. // hive information will be lost from m_pszRegKey. this means that only one run is possible.
  36. // in order to perform another run, the array needs to be reinitialized. in order to fix this
  37. // problem, HKEY member variable is needed in CRegInsMap;
  38. // 4. (ideas for the next round of work) remove m_var, replace it with m_dwFlags. the benifits
  39. // are numerious:
  40. // - saves memory;
  41. // - m_var doesn't handle everthing; support is required for things like File, YesToBool,
  42. // BoolToYes, String, Number, Bool;
  43. // - the same m_dwFlags can hold the fClear flag;
  44. // - one usefull thing to add would be Action flags, like RegToIns or InsToReg, it can be ORed
  45. // with fClear and stored in the samae m_dwFlags;
  46. // 5. set of macros to mask the complexity of building the static array of map entries;
  47. };
  48. #endif