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.

109 lines
3.5 KiB

  1. //Copyright (c) 1998 - 1999 Microsoft Corporation
  2. /*--------------------------------------------------------------------------------------------------------
  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. #define ASSERT(x) NULL
  26. #define VERIFY(x) NULL
  27. class CRegistry
  28. {
  29. private:
  30. LPBYTE m_pMemBlock;
  31. HKEY m_hKey;
  32. int m_iEnumIndex;
  33. int m_iEnumValueIndex;
  34. DWORD ReadReg (LPCTSTR lpValue, LPBYTE *lppbyte, DWORD *pdw, DWORD dwDatatype);
  35. void * Allocate (DWORD dwSize);
  36. //
  37. // This class is not designed to allow copy constructors, = assignments,
  38. // therefore we should ensure that copy ctor, assignment operator are not
  39. // generated by compiler. we do that by declaring these functions private
  40. // and not implementing them. This will ensure that these functions are
  41. // not generated by compilers, and caller will get error if he tries to
  42. // use them.
  43. //
  44. CRegistry (const CRegistry &reg); // copy ctor
  45. CRegistry & operator= (const CRegistry &reg); // = oprerator
  46. #ifdef DBG
  47. DWORD m_dwSizeDebugOnly;
  48. #endif
  49. public:
  50. CRegistry ();
  51. virtual ~CRegistry ();
  52. void Release ();
  53. operator HKEY () {return m_hKey;}
  54. DWORD OpenKey (HKEY hKey, LPCTSTR lpSubKey, REGSAM access = KEY_ALL_ACCESS);
  55. DWORD CreateKey (HKEY hKey, LPCTSTR lpSubKey, REGSAM access = KEY_ALL_ACCESS, DWORD *pDisposition = NULL, LPSECURITY_ATTRIBUTES lpSecAttr = NULL );
  56. DWORD DeleteValue (LPCTSTR lpValue);
  57. DWORD RecurseDeleteKey (LPCTSTR lpSubKey);
  58. DWORD ReadRegString (LPCTSTR lpValue, LPTSTR *lppStr, DWORD *pdw);
  59. DWORD ReadRegDWord (LPCTSTR lpValue, DWORD *pdw);
  60. DWORD ReadRegMultiString (LPCTSTR lpValue, LPTSTR *lppStr, DWORD *pdw);
  61. DWORD ReadRegBinary (LPCTSTR lpValue, LPBYTE *lppByte, DWORD *pdw);
  62. DWORD WriteRegString (LPCTSTR lpValueName, LPCTSTR lpStr);
  63. DWORD WriteRegDWord (LPCTSTR lpValueName, DWORD dwValue);
  64. DWORD WriteRegMultiString (LPCTSTR lpValueName, LPCTSTR lpStr, DWORD dwSize);
  65. DWORD GetFirstSubKey (LPTSTR *lppStr, DWORD *pdw);
  66. DWORD GetNextSubKey (LPTSTR *lppStr, DWORD *pdw);
  67. /*
  68. DWORD GetFirstValue (LPTSTR *lppStr, DWORD *pdw, DWORD *pDataType);
  69. DWORD GetNextValue (LPTSTR *lppStr, DWORD *pdw, DWORD *pDataType);
  70. */
  71. DWORD GetSecurity (PSECURITY_DESCRIPTOR *ppSec, SECURITY_INFORMATION SecurityInformation, DWORD *pdwSize);
  72. DWORD SetSecurity (PSECURITY_DESCRIPTOR pSec, SECURITY_INFORMATION SecurityInformation);
  73. };
  74. #endif // !defined(AFX_REGISTRY_H__AA7047C5_B519_11D1_B05F_00C04FA35813__INCLUDED_)
  75. //EOF