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.

157 lines
4.0 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. CmRegUtil.h
  5. Abstract:
  6. This header exposes various utility routines for accessing the registry.
  7. Author:
  8. Adrian J. Oney - April 21, 2002
  9. Revision History:
  10. --*/
  11. //
  12. // A handy macro for converting regstr.h paths into full kernel HKLM paths
  13. //
  14. #define CM_REGISTRY_MACHINE(x) L"\\Registry\\Machine\\"##x
  15. //
  16. // This macro returns the pointer to the beginning of the data area of
  17. // KEY_VALUE_FULL_INFORMATION structure. In the macro, k is a pointer to
  18. // KEY_VALUE_FULL_INFORMATION structure.
  19. //
  20. #define KEY_VALUE_DATA(k) ((PCHAR)(k) + (k)->DataOffset)
  21. //
  22. // Unicode primitives - these are the best functions to use.
  23. //
  24. NTSTATUS
  25. CmRegUtilOpenExistingUcKey(
  26. IN HANDLE BaseHandle OPTIONAL,
  27. IN PUNICODE_STRING KeyName,
  28. IN ACCESS_MASK DesiredAccess,
  29. OUT HANDLE *Handle
  30. );
  31. NTSTATUS
  32. CmRegUtilCreateUcKey(
  33. IN HANDLE BaseHandle,
  34. IN PUNICODE_STRING KeyName,
  35. IN ACCESS_MASK DesiredAccess,
  36. IN ULONG CreateOptions,
  37. IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL,
  38. OUT ULONG *Disposition OPTIONAL,
  39. OUT HANDLE *Handle
  40. );
  41. NTSTATUS
  42. CmRegUtilUcValueGetDword(
  43. IN HANDLE KeyHandle,
  44. IN PUNICODE_STRING ValueName,
  45. IN ULONG DefaultValue,
  46. OUT ULONG *Value
  47. );
  48. NTSTATUS
  49. CmRegUtilUcValueGetFullBuffer(
  50. IN HANDLE KeyHandle,
  51. IN PUNICODE_STRING ValueName,
  52. IN ULONG DataType OPTIONAL,
  53. IN ULONG LikelyDataLength OPTIONAL,
  54. OUT PKEY_VALUE_FULL_INFORMATION *Information
  55. );
  56. NTSTATUS
  57. CmRegUtilUcValueSetFullBuffer(
  58. IN HANDLE KeyHandle,
  59. IN PUNICODE_STRING ValueName,
  60. IN ULONG DataType,
  61. IN PVOID Buffer,
  62. IN ULONG BufferSize
  63. );
  64. NTSTATUS
  65. CmRegUtilUcValueSetUcString(
  66. IN HANDLE KeyHandle,
  67. IN PUNICODE_STRING ValueName,
  68. IN PUNICODE_STRING ValueData
  69. );
  70. //
  71. // WSTR and mixed primitives
  72. //
  73. NTSTATUS
  74. CmRegUtilOpenExistingWstrKey(
  75. IN HANDLE BaseHandle OPTIONAL,
  76. IN PWSTR KeyName,
  77. IN ACCESS_MASK DesiredAccess,
  78. OUT HANDLE *Handle
  79. );
  80. NTSTATUS
  81. CmRegUtilCreateWstrKey(
  82. IN HANDLE BaseHandle,
  83. IN PWSTR KeyName,
  84. IN ACCESS_MASK DesiredAccess,
  85. IN ULONG CreateOptions,
  86. IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL,
  87. OUT ULONG *Disposition OPTIONAL,
  88. OUT HANDLE *Handle
  89. );
  90. NTSTATUS
  91. CmRegUtilWstrValueGetDword(
  92. IN HANDLE KeyHandle,
  93. IN PWSTR ValueName,
  94. IN ULONG DefaultValue,
  95. OUT ULONG *Value
  96. );
  97. NTSTATUS
  98. CmRegUtilWstrValueGetFullBuffer(
  99. IN HANDLE KeyHandle,
  100. IN PWSTR ValueName,
  101. IN ULONG DataType OPTIONAL,
  102. IN ULONG LikelyDataLength OPTIONAL,
  103. OUT PKEY_VALUE_FULL_INFORMATION *Information
  104. );
  105. NTSTATUS
  106. CmRegUtilWstrValueSetFullBuffer(
  107. IN HANDLE KeyHandle,
  108. IN PWSTR ValueName,
  109. IN ULONG DataType,
  110. IN PVOID Buffer,
  111. IN ULONG BufferSize
  112. );
  113. NTSTATUS
  114. CmRegUtilWstrValueSetUcString(
  115. IN HANDLE KeyHandle,
  116. IN PWSTR ValueName,
  117. IN PUNICODE_STRING ValueData
  118. );
  119. NTSTATUS
  120. CmRegUtilUcValueSetWstrString(
  121. IN HANDLE KeyHandle,
  122. IN PUNICODE_STRING ValueName,
  123. IN PWSTR ValueData
  124. );
  125. NTSTATUS
  126. CmRegUtilWstrValueSetWstrString(
  127. IN HANDLE KeyHandle,
  128. IN PWSTR ValueName,
  129. IN PWSTR ValueData
  130. );