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.

78 lines
2.4 KiB

  1. /*--------------------------------------------------------------------------------------------------------
  2. * Copyright (c) 1998 Microsoft Corporation
  3. *
  4. * Module Name:
  5. *
  6. * Registry.h
  7. *
  8. * Abstract:
  9. *
  10. * declaration of a simple registry class CRegistry.
  11. *
  12. *
  13. *
  14. * Author:
  15. *
  16. * Makarand Patwardhan - April 9, 1997
  17. *
  18. * -------------------------------------------------------------------------------------------------------*/
  19. #if !defined(AFX_REGISTRY_H__AA7047C5_B519_11D1_B05F_00C04FA35813__INCLUDED_)
  20. #define AFX_REGISTRY_H__AA7047C5_B519_11D1_B05F_00C04FA35813__INCLUDED_
  21. #if _MSC_VER >= 1000
  22. #pragma once
  23. #endif // _MSC_VER >= 1000
  24. #include <winreg.h>
  25. class CRegistry
  26. {
  27. private:
  28. LPBYTE m_pMemBlock;
  29. HKEY m_hKey;
  30. int m_iEnumIndex;
  31. int m_iEnumValueIndex;
  32. DWORD ReadReg (LPCTSTR lpValue, LPBYTE *lppbyte, DWORD *pdw, DWORD dwDatatype);
  33. void * Allocate (DWORD dwSize);
  34. #ifdef DBG
  35. DWORD m_dwSizeDebugOnly;
  36. #endif
  37. public:
  38. CRegistry ();
  39. virtual ~CRegistry ();
  40. void Release ();
  41. operator HKEY () {return m_hKey;}
  42. DWORD OpenKey (HKEY hKey, LPCTSTR lpSubKey, REGSAM access = KEY_ALL_ACCESS);
  43. DWORD CreateKey (HKEY hKey, LPCTSTR lpSubKey, REGSAM access = KEY_ALL_ACCESS, DWORD *pDisposition = NULL);
  44. DWORD DeleteValue (LPCTSTR lpValue);
  45. DWORD RecurseDeleteKey (LPCTSTR lpSubKey);
  46. DWORD ReadRegString (LPCTSTR lpValue, LPTSTR *lppStr, DWORD *pdw);
  47. DWORD ReadRegDWord (LPCTSTR lpValue, DWORD *pdw);
  48. DWORD ReadRegMultiString (LPCTSTR lpValue, LPTSTR *lppStr, DWORD *pdw);
  49. DWORD ReadRegBinary (LPCTSTR lpValue, LPBYTE *lppByte, DWORD *pdw);
  50. DWORD WriteRegString (LPCTSTR lpValueName, LPCTSTR lpStr);
  51. DWORD WriteRegMultiString (LPCTSTR lpValueName, LPCTSTR lpStr, DWORD dwSize);
  52. DWORD GetFirstSubKey (LPTSTR *lppStr, DWORD *pdw);
  53. DWORD GetNextSubKey (LPTSTR *lppStr, DWORD *pdw);
  54. DWORD GetFirstValue (LPTSTR *lppStr, DWORD *pdw, DWORD *pDataType);
  55. DWORD GetNextValue (LPTSTR *lppStr, DWORD *pdw, DWORD *pDataType);
  56. };
  57. #endif // !defined(AFX_REGISTRY_H__AA7047C5_B519_11D1_B05F_00C04FA35813__INCLUDED_)
  58. //EOF