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.

165 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. registry.h
  5. Abstract:
  6. SIS Groveler registry interface headers
  7. Authors:
  8. John Douceur, 1998
  9. Environment:
  10. User Mode
  11. Revision History:
  12. --*/
  13. #ifndef _INC_REGISTRY
  14. #define _INC_REGISTRY
  15. #ifndef _DEF_ENTRY_INFO
  16. #define _DEF_ENTRY_INFO
  17. enum EntryType
  18. {
  19. entry_bool,
  20. entry_char,
  21. entry_int,
  22. entry_int64,
  23. entry_double
  24. };
  25. struct EntrySpec
  26. {
  27. const _TCHAR *identifier;
  28. EntryType type;
  29. const _TCHAR *default_value;
  30. void *pointer;
  31. };
  32. #endif /* _DEF_ENTRY_INFO */
  33. class Registry
  34. {
  35. public:
  36. static bool read(
  37. HKEY base_key,
  38. const _TCHAR *path,
  39. int num_entries,
  40. EntrySpec *entries);
  41. static bool write(
  42. HKEY base_key,
  43. const _TCHAR *path,
  44. int num_entries,
  45. EntrySpec *entries);
  46. static bool overwrite(
  47. HKEY base_key,
  48. const _TCHAR *path,
  49. int num_entries,
  50. EntrySpec *entries);
  51. static bool write_defaults(
  52. HKEY base_key,
  53. const _TCHAR *path,
  54. int num_entries,
  55. EntrySpec *entries);
  56. static bool overwrite_defaults(
  57. HKEY base_key,
  58. const _TCHAR *path,
  59. int num_entries,
  60. EntrySpec *entries);
  61. static bool read_string_set(
  62. HKEY base_key,
  63. const _TCHAR *path,
  64. int *num_strings,
  65. _TCHAR ***strings,
  66. BYTE **buffer);
  67. static bool write_string_set(
  68. HKEY base_key,
  69. const _TCHAR *path,
  70. int num_strings,
  71. _TCHAR **strings,
  72. _TCHAR **identifiers);
  73. static bool overwrite_string_set(
  74. HKEY base_key,
  75. const _TCHAR *path,
  76. int num_strings,
  77. _TCHAR **strings,
  78. _TCHAR **identifiers);
  79. static void create_key_ex(
  80. HKEY hKey,
  81. LPCTSTR lpSubKey,
  82. DWORD Reserved,
  83. LPTSTR lpClass,
  84. DWORD dwOptions,
  85. REGSAM samDesired,
  86. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  87. PHKEY phkResult,
  88. LPDWORD lpdwDisposition);
  89. static void open_key_ex(
  90. HKEY hKey,
  91. LPCTSTR lpSubKey,
  92. DWORD ulOptions,
  93. REGSAM samDesired,
  94. PHKEY phkResult);
  95. static void close_key(
  96. HKEY hKey);
  97. static void query_value_ex(
  98. HKEY hKey,
  99. LPCTSTR lpValueName,
  100. LPDWORD lpReserved,
  101. LPDWORD lpType,
  102. LPBYTE lpData,
  103. LPDWORD lpcbData);
  104. static void set_value_ex(
  105. HKEY hKey,
  106. LPCTSTR lpValueName,
  107. DWORD Reserved,
  108. DWORD dwType,
  109. CONST BYTE *lpData,
  110. DWORD cbData);
  111. private:
  112. enum {id_buffer_length = 256};
  113. static void load_string_into_value(
  114. EntryType type,
  115. const _TCHAR *string,
  116. void *value);
  117. static void store_value_in_string(
  118. EntryType type,
  119. void *value,
  120. _TCHAR *string);
  121. Registry() {}
  122. ~Registry() {}
  123. static _TCHAR id_buffer[id_buffer_length];
  124. };
  125. #endif /* _INC_REGISTRY */