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.

73 lines
1.7 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 2000.
  5. //
  6. // File: RegAcc.hxx
  7. //
  8. // Contents: 'Simple' registry access
  9. //
  10. // History: 21-Dec-93 KyleP Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #pragma once
  14. //+-------------------------------------------------------------------------
  15. //
  16. // Class: CWin32RegAccess
  17. //
  18. // Purpose: 'Simple' registry access
  19. //
  20. // History: 21-Dec-93 KyleP Created
  21. //
  22. //--------------------------------------------------------------------------
  23. class CWin32RegAccess
  24. {
  25. public:
  26. CWin32RegAccess( HKEY keyRelative, WCHAR const * pwcsRegPath );
  27. ~CWin32RegAccess();
  28. BOOL Ok()
  29. {
  30. //
  31. // Errors in RegOpenKey can still set _hKey to zero...
  32. //
  33. return (0 != _hKey) && ((HKEY)~0 != _hKey);
  34. }
  35. HKEY GetHKey(void) { return _hKey; }
  36. BOOL Enum(WCHAR * pwszName, DWORD cbName );
  37. BOOL Get( WCHAR const * pwcsKey, WCHAR * wcsVal, unsigned cc, BOOL fExpandEnviromentStrings = TRUE );
  38. BOOL Get( WCHAR const * pwcsValueName, DWORD & dwVal );
  39. BOOL Set( WCHAR const * pwcsValueName, DWORD dwVal );
  40. BOOL Set( WCHAR const * pwcsValueName, WCHAR const * wcsVal );
  41. BOOL SetMultiSZ( WCHAR const * pwcsValueName, WCHAR const * wcsVal, DWORD cb );
  42. BOOL Remove( WCHAR const * pwcsValue );
  43. BOOL CreateKey( WCHAR const * pwcsKey, BOOL & fExisted );
  44. BOOL RemoveKey( WCHAR const * pwcsKey );
  45. DWORD GetLastError() { return _dwLastError; }
  46. private:
  47. HKEY _hKey;
  48. DWORD _iSubKey;
  49. WCHAR _wcsPathBuf[100];
  50. WCHAR * _wcsPath;
  51. DWORD _dwLastError;
  52. };