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.

50 lines
1.3 KiB

  1. //***************************************************************************
  2. //
  3. // REG.H
  4. //
  5. // Utility registry classes.
  6. //
  7. // a-raymcc 30-May-96 Created.
  8. //
  9. //***************************************************************************
  10. #ifndef _NTREG_H_
  11. #define _NTREG_H_
  12. //#include "corepol.h"
  13. class CNTRegistry
  14. {
  15. HKEY m_hPrimaryKey;
  16. HKEY m_hSubkey;
  17. int m_nStatus;
  18. LONG m_nLastError;
  19. public:
  20. enum { no_error, failed, out_of_memory, no_more_items };
  21. CNTRegistry();
  22. ~CNTRegistry();
  23. int Open(HKEY hStart, WCHAR *pszStartKey);
  24. int MoveToSubkey(WCHAR *pszNewSubkey);
  25. int GetDWORD(WCHAR *pwszValueName, DWORD *pdwValue);
  26. int GetStr(WCHAR *pwszValueName, WCHAR **pwszValue);
  27. //Returns a pointer to a string buffer containing the null-terminated string.
  28. //The last entry is a double null terminator (i.e. the registry format for
  29. //a REG_MULTI_SZ). Caller has do "delete []" the returned pointer.
  30. //dwSize is the size of the buffer returned.
  31. int GetMultiStr(WCHAR *pwszValueName, WCHAR** pwszValue, DWORD &dwSize);
  32. // Allows key enumneration
  33. int Enum( DWORD dwIndex, WCHAR** pwszValue, DWORD& dwSize );
  34. int SetDWORD(WCHAR *pwszValueName, DWORD dwValue);
  35. int SetStr(WCHAR *pwszValueName, WCHAR *wszValue);
  36. LONG GetLastError() { return m_nLastError; }
  37. };
  38. #endif