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.

116 lines
3.2 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. Registry.h
  5. Abstract:
  6. Class definition for the registry
  7. API wrapper class.
  8. Notes:
  9. Unicode only.
  10. History:
  11. 01/29/2001 rparsons Created
  12. 03/02/2001 rparsons Major overhaul
  13. --*/
  14. #include <windows.h>
  15. #define REG_FORCE_RESTORE (0x00000008L)
  16. class CRegistry {
  17. public:
  18. HKEY CreateKey(IN HKEY hKey,
  19. IN LPCWSTR lpwSubKey,
  20. IN REGSAM samDesired);
  21. BOOL CloseKey(IN HKEY hKey);
  22. LPWSTR GetString(IN HKEY hKey,
  23. IN LPCWSTR lpwSubKey,
  24. IN LPCWSTR lpwValueName,
  25. IN BOOL fPredefined);
  26. BOOL GetDword(IN HKEY hKey,
  27. IN LPCWSTR lpwSubKey,
  28. IN LPCWSTR lpwValueName,
  29. IN LPDWORD lpdwData,
  30. IN BOOL fPredefined);
  31. BOOL SetString(IN HKEY hKey,
  32. IN LPCWSTR lpwSubKey,
  33. IN LPCWSTR lpwValueName,
  34. IN LPWSTR lpwData,
  35. IN BOOL fPredefined);
  36. BOOL SetDword(IN HKEY hKey,
  37. IN LPCWSTR lpwSubKey,
  38. IN LPCWSTR lpwValueName,
  39. IN DWORD dwData,
  40. IN BOOL fPredefined);
  41. BOOL DeleteRegistryString(IN HKEY hKey,
  42. IN LPCWSTR lpwSubKey,
  43. IN LPCWSTR lpwValueName,
  44. IN BOOL fPredefined);
  45. BOOL DeleteRegistryKey(IN HKEY hKey,
  46. IN LPCWSTR lpwKey,
  47. IN LPCWSTR lpwSubKeyName,
  48. IN BOOL fPredefined,
  49. IN BOOL fFlush);
  50. BOOL IsRegistryKeyPresent(IN HKEY hKey,
  51. IN LPCWSTR lpwSubKey);
  52. void Free(IN LPVOID lpMem);
  53. BOOL AddStringToMultiSz(IN HKEY hKey,
  54. IN LPCWSTR lpwSubKey,
  55. IN LPCWSTR lpwValueName,
  56. IN LPCWSTR lpwEntry,
  57. IN BOOL fPredefined);
  58. BOOL RemoveStringFromMultiSz(IN HKEY hKey,
  59. IN LPCWSTR lpwSubKey,
  60. IN LPCWSTR lpwValueName,
  61. IN LPCWSTR lpwEntry,
  62. IN BOOL fPredefined);
  63. BOOL RestoreKey(IN HKEY hKey,
  64. IN LPCWSTR lpwSubKey,
  65. IN LPCWSTR lpwFileName,
  66. IN BOOL fGrantPrivs);
  67. BOOL BackupRegistryKey(IN HKEY hKey,
  68. IN LPCWSTR lpwSubKey,
  69. IN LPCWSTR lpwFileName,
  70. IN BOOL fGrantPrivs);
  71. private:
  72. DWORD GetStringSize(IN HKEY hKey,
  73. IN LPCWSTR lpwValueName,
  74. OUT LPDWORD lpType OPTIONAL);
  75. LPVOID Malloc(IN SIZE_T dwBytes);
  76. HKEY OpenKey(IN HKEY hKey,
  77. IN LPCWSTR lpwSubKey,
  78. IN REGSAM samDesired);
  79. int ListStoreLen(IN LPWSTR lpwList);
  80. BOOL ModifyTokenPrivilege(IN LPCWSTR lpwPrivilege,
  81. IN BOOL fEnable);
  82. };