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.

197 lines
5.2 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. picddb.h
  5. Abstract:
  6. This header contains private information to implement the Plug and Play
  7. Critical Device Database (CDDB). This file is meant to be included only by
  8. ppcddb.c.
  9. Author:
  10. James G. Cavalaris (jamesca) 01-Nov-2001
  11. Environment:
  12. Kernel mode.
  13. Revision History:
  14. 29-Jul-1997 Jim Cavalaris (t-jcaval)
  15. Creation and initial implementation.
  16. 01-Nov-2001 Jim Cavalaris (jamesca)
  17. Added routines for device pre-installation setup.
  18. --*/
  19. //
  20. // Current PNP_LOCATION_INTERFACE version.
  21. //
  22. #define PNP_LOCATION_INTERFACE_VERSION 0x1
  23. //
  24. // Optional CDDB device location path separator string
  25. //
  26. // i.e. TEXT("#") --> PCIROOT(0)#PCI(1100)
  27. // TEXT("") --> PCIROOT(0)PCI(1100)
  28. // TEXT("FOO") --> PCIROOT(0)FOOPCI(1100)
  29. //
  30. // NOTE: The resulting path will be used as a single registry key, so NEVER use
  31. // the NT path separator string RtlNtPathSeperatorString (L"\\"), or any string
  32. // that contains a path separator character (verify with RtlIsNtPathSeparator).
  33. //
  34. #define _CRITICAL_DEVICE_LOCATION_PATH_SEPARATOR_STRING TEXT("#")
  35. //
  36. // Default device pre-install database root registry key path
  37. //
  38. #define _REGSTR_PATH_DEFAULT_PREINSTALL_DATABASE_ROOT TEXT("System\\CurrentControlSet\\Control\\CriticalPreInstallDatabase")
  39. //
  40. // Location to device path entries, relative to pre-install database root.
  41. //
  42. // i.e. <PreInstallDatabaseRoot>\\<DevicePaths>
  43. //
  44. #define _REGSTR_KEY_DEVICEPATHS TEXT("DevicePaths")
  45. //
  46. // Location of the hardware and software settings that are to be applied to a
  47. // device. These locations are relative to the entry in the pre-install
  48. // database matching the device's location path.
  49. //
  50. // i.e. <PreInstallDatabaseRoot>\\<DevicePaths>\\<MatchingDevicePath>\\<HardwareKey>
  51. // <PreInstallDatabaseRoot>\\<DevicePaths>\\<MatchingDevicePath>\\<SoftwareKey>
  52. //
  53. #define _REGSTR_KEY_PREINSTALL_HARDWARE TEXT("HardwareKey")
  54. #define _REGSTR_KEY_PREINSTALL_SOFTWARE TEXT("SoftwareKey")
  55. //
  56. // If present, the following value in the root of a critical device database
  57. // entry key, or in the root of a device path entry key should be copied to the
  58. // corresponding device instance key for devices that we have successfully set a
  59. // service for.
  60. //
  61. // i.e. <CriticalDeviceDatabase>\\<MungedDeviceId>\\
  62. // PreservePreInstall : REG_DWORD : 0x1
  63. //
  64. // <CriticalDeviceDatabase>\\<MungedDeviceId>\\<DevicePaths>\\<MatchingDevicePath>\\
  65. // PreservePreInstall : REG_DWORD : 0x1
  66. //
  67. // When the user-mode plug and play manager has been directed to preserve
  68. // pre-install settings, this value causes it to clear the
  69. // CONFIGFLAG_FINISH_INSTALL ConfigFlag on any such device, and consider
  70. // installation complete (i.e. not attempt re-installation).
  71. //
  72. //
  73. // REGSTR_VAL_PRESERVE_PREINSTALL from \NT\public\internal\base\inc\pnpmgr.h
  74. //
  75. //
  76. // Prototype verification callback routine for PiCriticalOpenFirstMatchingSubKey
  77. //
  78. typedef
  79. BOOLEAN
  80. (*PCRITICAL_MATCH_CALLBACK)(
  81. IN HANDLE MatchingKeyHandle
  82. );
  83. //
  84. // Internal Critical Device Database function prototypes
  85. //
  86. NTSTATUS
  87. PiCriticalOpenCriticalDeviceKey(
  88. IN PDEVICE_NODE DeviceNode,
  89. IN HANDLE CriticalDeviceDatabaseRootHandle OPTIONAL,
  90. OUT PHANDLE CriticalDeviceEntryHandle
  91. );
  92. NTSTATUS
  93. PiCriticalCopyCriticalDeviceProperties(
  94. IN HANDLE DeviceInstanceHandle,
  95. IN HANDLE CriticalDeviceEntryHandle
  96. );
  97. NTSTATUS
  98. PiCriticalOpenFirstMatchingSubKey(
  99. IN PWCHAR MultiSzList,
  100. IN HANDLE RootHandle,
  101. IN ACCESS_MASK DesiredAccess,
  102. IN PCRITICAL_MATCH_CALLBACK MatchingSubkeyCallback OPTIONAL,
  103. OUT PHANDLE MatchingKeyHandle
  104. );
  105. BOOLEAN
  106. PiCriticalCallbackVerifyCriticalEntry(
  107. IN HANDLE CriticalDeviceEntryHandle
  108. );
  109. //
  110. // Internal Pre-installation function prototypes
  111. //
  112. NTSTATUS
  113. PiCriticalPreInstallDevice(
  114. IN PDEVICE_NODE DeviceNode,
  115. IN HANDLE PreInstallDatabaseRootHandle OPTIONAL
  116. );
  117. NTSTATUS
  118. PiCriticalOpenDevicePreInstallKey(
  119. IN PDEVICE_NODE DeviceNode,
  120. IN HANDLE PreInstallRootHandle OPTIONAL,
  121. OUT PHANDLE PreInstallHandle
  122. );
  123. //
  124. // General utility routines
  125. //
  126. NTSTATUS
  127. PiQueryInterface(
  128. IN PDEVICE_OBJECT DeviceObject,
  129. IN CONST GUID * InterfaceGuid,
  130. IN USHORT InterfaceVersion,
  131. IN USHORT InterfaceSize,
  132. OUT PINTERFACE Interface
  133. );
  134. NTSTATUS
  135. PiCopyKeyRecursive(
  136. IN HANDLE SourceKeyRootHandle,
  137. IN HANDLE TargetKeyRootHandle,
  138. IN PWSTR SourceKeyPath OPTIONAL,
  139. IN PWSTR TargetKeyPath OPTIONAL,
  140. IN BOOLEAN CopyAlways,
  141. IN BOOLEAN ApplyACLsAlways
  142. );
  143. NTSTATUS
  144. PiCriticalQueryRegistryValueCallback(
  145. IN PWSTR ValueName,
  146. IN ULONG ValueType,
  147. IN PVOID ValueData,
  148. IN ULONG ValueLength,
  149. IN PVOID Context,
  150. IN PVOID EntryContext
  151. );