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.

112 lines
3.8 KiB

  1. //
  2. // This contains declarations from ntddk.h that we need. Unfortunately,
  3. // we can't easily include ntddk.h since it conflicts with other
  4. // header files. So, we'll include the needed support here. Hopefully,
  5. // we'll find a better solution soon.
  6. //
  7. typedef LONG NTSTATUS;
  8. typedef struct _UNICODE_STRING {
  9. USHORT Length;
  10. USHORT MaximumLength;
  11. PWSTR Buffer;
  12. } UNICODE_STRING;
  13. typedef UNICODE_STRING *PUNICODE_STRING;
  14. //
  15. // Subroutines for dealing with the Registry
  16. //
  17. typedef NTSTATUS (*PRTL_QUERY_REGISTRY_ROUTINE)(
  18. IN PWSTR ValueName,
  19. IN ULONG ValueType,
  20. IN PVOID ValueData,
  21. IN ULONG ValueLength,
  22. IN PVOID Context,
  23. IN PVOID EntryContext
  24. );
  25. typedef struct _RTL_QUERY_REGISTRY_TABLE {
  26. PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine;
  27. ULONG Flags;
  28. PWSTR Name;
  29. PVOID EntryContext;
  30. ULONG DefaultType;
  31. PVOID DefaultData;
  32. ULONG DefaultLength;
  33. } RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
  34. //
  35. // The following flags specify how the Name field of a RTL_QUERY_REGISTRY_TABLE
  36. // entry is interpreted. A NULL name indicates the end of the table.
  37. //
  38. #define RTL_QUERY_REGISTRY_SUBKEY 0x00000001 // Name is a subkey and remainder of
  39. // table or until next subkey are value
  40. // names for that subkey to look at.
  41. #define RTL_QUERY_REGISTRY_TOPKEY 0x00000002 // Reset current key to original key for
  42. // this and all following table entries.
  43. #define RTL_QUERY_REGISTRY_REQUIRED 0x00000004 // Fail if no match found for this table
  44. // entry.
  45. #define RTL_QUERY_REGISTRY_NOVALUE 0x00000008 // Used to mark a table entry that has no
  46. // value name, just wants a call out, not
  47. // an enumeration of all values.
  48. #define RTL_QUERY_REGISTRY_NOEXPAND 0x00000010 // Used to suppress the expansion of
  49. // REG_MULTI_SZ into multiple callouts or
  50. // to prevent the expansion of environment
  51. // variable values in REG_EXPAND_SZ
  52. #define RTL_QUERY_REGISTRY_DIRECT 0x00000020 // QueryRoutine field ignored. EntryContext
  53. // field points to location to store value.
  54. // For null terminated strings, EntryContext
  55. // points to UNICODE_STRING structure that
  56. // that describes maximum size of buffer.
  57. // If .Buffer field is NULL then a buffer is
  58. // allocated.
  59. //
  60. #define RTL_QUERY_REGISTRY_DELETE 0x00000040 // Used to delete value keys after they
  61. // are queried.
  62. #define REG_DWORD ( 4 ) // 32-bit number
  63. #define RTL_REGISTRY_ABSOLUTE 0 // Path is a full path
  64. #define RTL_REGISTRY_OPTIONAL 0x80000000 // Indicates the key node is optional
  65. //
  66. // Generic test for success on any status value (non-negative numbers
  67. // indicate success).
  68. //
  69. #define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
  70. __declspec(dllimport)
  71. NTSTATUS
  72. __stdcall
  73. RtlQueryRegistryValues(
  74. ULONG RelativeTo,
  75. PWSTR Path,
  76. PRTL_QUERY_REGISTRY_TABLE QueryTable,
  77. PVOID Context,
  78. PVOID Environment
  79. );
  80. __declspec(dllimport)
  81. NTSTATUS
  82. __stdcall
  83. RtlWriteRegistryValue(
  84. ULONG RelativeTo,
  85. PWSTR Path,
  86. PWSTR ValueName,
  87. ULONG ValueType,
  88. PVOID ValueData,
  89. ULONG ValueLength
  90. );