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.

121 lines
2.4 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. registry.c
  5. Abstract:
  6. This module contains the code that manipulates the registry
  7. Author:
  8. Neil Sandlin (neilsa) Jan 1 2002
  9. Environment:
  10. Kernel mode
  11. Revision History :
  12. --*/
  13. #include "pch.h"
  14. //
  15. //
  16. // Registry related definitions
  17. //
  18. #define SDBUS_REGISTRY_PARAMETERS_KEY L"Sdbus\\Parameters"
  19. #ifdef ALLOC_PRAGMA
  20. #pragma alloc_text(INIT,SdbusLoadGlobalRegistryValues)
  21. #endif
  22. NTSTATUS
  23. SdbusLoadGlobalRegistryValues(
  24. VOID
  25. )
  26. /*++
  27. Routine Description:
  28. This routine is called at driver init time to load in various global
  29. options from the registry.
  30. These are read in from SYSTEM\CurrentControlSet\Services\Sdbus\Parameters.
  31. Arguments:
  32. none
  33. Return value:
  34. none
  35. --*/
  36. {
  37. PRTL_QUERY_REGISTRY_TABLE parms;
  38. NTSTATUS status;
  39. ULONG parmsSize;
  40. ULONG i;
  41. //
  42. // Needs a null entry to terminate the list
  43. //
  44. parmsSize = sizeof(RTL_QUERY_REGISTRY_TABLE) * (GlobalInfoCount+1);
  45. parms = ExAllocatePool(PagedPool, parmsSize);
  46. if (!parms) {
  47. return STATUS_INSUFFICIENT_RESOURCES;
  48. }
  49. RtlZeroMemory(parms, parmsSize);
  50. //
  51. // Fill in the query table from our table
  52. //
  53. for (i = 0; i < GlobalInfoCount; i++) {
  54. parms[i].Flags = RTL_QUERY_REGISTRY_DIRECT;
  55. parms[i].Name = GlobalRegistryInfo[i].Name;
  56. parms[i].EntryContext = GlobalRegistryInfo[i].pValue;
  57. parms[i].DefaultType = REG_DWORD;
  58. parms[i].DefaultData = &GlobalRegistryInfo[i].Default;
  59. parms[i].DefaultLength = sizeof(ULONG);
  60. }
  61. //
  62. // Perform the query
  63. //
  64. status = RtlQueryRegistryValues(RTL_REGISTRY_SERVICES | RTL_REGISTRY_OPTIONAL,
  65. SDBUS_REGISTRY_PARAMETERS_KEY,
  66. parms,
  67. NULL,
  68. NULL);
  69. if (!NT_SUCCESS(status)) {
  70. //
  71. // This is possible during text mode setup
  72. //
  73. for (i = 0; i < GlobalInfoCount; i++) {
  74. *GlobalRegistryInfo[i].pValue = GlobalRegistryInfo[i].Default;
  75. }
  76. }
  77. ExFreePool(parms);
  78. return STATUS_SUCCESS;
  79. }