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.

458 lines
7.2 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. umpnpi.h
  5. Abstract:
  6. This module contains the internal structure definitions and APIs used by
  7. the user-mode Plug and Play Manager.
  8. Author:
  9. Jim Cavalaris (jamesca) 03-01-2001
  10. Environment:
  11. User-mode only.
  12. Revision History:
  13. 01-March-2001 jamesca
  14. Creation and initial implementation.
  15. --*/
  16. #ifndef _UMPNPI_H_
  17. #define _UMPNPI_H_
  18. //
  19. // global data
  20. //
  21. extern HANDLE ghPnPHeap;
  22. //
  23. // definitions
  24. //
  25. #define GUID_STRING_LEN 39 // size in chars, including terminating NULL
  26. //
  27. // flags for IsValidDeviceID
  28. //
  29. #define PNP_NOT_MOVED 0x00000001
  30. #define PNP_NOT_PHANTOM 0x00000002
  31. #define PNP_PRESENT 0x00000004
  32. #define PNP_NOT_REMOVED 0x00000008
  33. #define PNP_STRICT 0xFFFFFFFF
  34. //
  35. // Define the Plug and Play driver types. (from ntos\io\pnpmgr\pnpi.h)
  36. //
  37. typedef enum _PLUGPLAY_SERVICE_TYPE {
  38. PlugPlayServiceBusExtender,
  39. PlugPlayServiceAdapter,
  40. PlugPlayServicePeripheral,
  41. PlugPlayServiceSoftware,
  42. MaxPlugPlayServiceType
  43. } PLUGPLAY_SERVICE_TYPE, *PPLUGPLAY_SERVICE_TYPE;
  44. //
  45. // rdevnode.c
  46. //
  47. CONFIGRET
  48. EnableDevInst(
  49. IN PCWSTR pszDeviceID,
  50. IN BOOL UseDisableCount
  51. );
  52. CONFIGRET
  53. DisableDevInst(
  54. IN PCWSTR pszDeviceID,
  55. OUT PPNP_VETO_TYPE pVetoType,
  56. OUT LPWSTR pszVetoName,
  57. IN ULONG ulNameLength,
  58. IN BOOL UseDisableCount
  59. );
  60. CONFIGRET
  61. UninstallRealDevice(
  62. IN LPCWSTR pszDeviceID
  63. );
  64. CONFIGRET
  65. UninstallPhantomDevice(
  66. IN LPCWSTR pszDeviceID
  67. );
  68. BOOL
  69. IsDeviceRootEnumerated(
  70. IN LPCWSTR pszDeviceID
  71. );
  72. CONFIGRET
  73. QueryAndRemoveSubTree(
  74. IN PCWSTR pszDeviceID,
  75. OUT PPNP_VETO_TYPE pVetoType,
  76. OUT LPWSTR pszVetoName,
  77. IN ULONG ulNameLength,
  78. IN ULONG ulFlags
  79. );
  80. CONFIGRET
  81. ReenumerateDevInst(
  82. IN PCWSTR pszDeviceID,
  83. IN BOOL EnumSubTree,
  84. IN ULONG ulFlags
  85. );
  86. typedef enum {
  87. EA_CONTINUE,
  88. EA_SKIP_SUBTREE,
  89. EA_STOP_ENUMERATION
  90. } ENUM_ACTION;
  91. typedef ENUM_ACTION (*PFN_ENUMTREE)(
  92. IN LPCWSTR DevInst,
  93. IN OUT PVOID Context
  94. );
  95. CONFIGRET
  96. EnumerateSubTreeTopDownBreadthFirst(
  97. IN handle_t BindingHandle,
  98. IN LPCWSTR DevInst,
  99. IN PFN_ENUMTREE CallbackFunction,
  100. IN OUT PVOID Context
  101. );
  102. //
  103. // revent.c
  104. //
  105. BOOL
  106. InitNotification(
  107. VOID
  108. );
  109. DWORD
  110. InitializePnPManager(
  111. IN LPDWORD lpParam
  112. );
  113. DWORD
  114. SessionNotificationHandler(
  115. IN DWORD EventType,
  116. IN PWTSSESSION_NOTIFICATION SessionNotification
  117. );
  118. ENUM_ACTION
  119. QueueInstallationCallback(
  120. IN LPCWSTR DevInst,
  121. IN OUT PVOID Context
  122. );
  123. typedef struct {
  124. BOOL HeadNodeSeen;
  125. BOOL SingleLevelEnumOnly;
  126. CONFIGRET Status;
  127. } QI_CONTEXT, *PQI_CONTEXT;
  128. //
  129. // rtravers.c
  130. //
  131. CONFIGRET
  132. GetServiceDeviceListSize(
  133. IN LPCWSTR pszService,
  134. OUT PULONG pulLength
  135. );
  136. CONFIGRET
  137. GetServiceDeviceList(
  138. IN LPCWSTR pszService,
  139. OUT LPWSTR pBuffer,
  140. IN OUT PULONG pulLength,
  141. IN ULONG ulFlags
  142. );
  143. //
  144. // rutil.c
  145. //
  146. BOOL
  147. MultiSzAppendW(
  148. IN OUT LPWSTR pszMultiSz,
  149. IN OUT PULONG pulSize,
  150. IN LPCWSTR pszString
  151. );
  152. BOOL
  153. MultiSzDeleteStringW(
  154. IN OUT LPWSTR pString,
  155. IN LPCWSTR pSubString
  156. );
  157. LPWSTR
  158. MultiSzFindNextStringW(
  159. IN LPWSTR pMultiSz
  160. );
  161. BOOL
  162. MultiSzSearchStringW(
  163. IN LPCWSTR pString,
  164. IN LPCWSTR pSubString
  165. );
  166. ULONG
  167. MultiSzSizeW(
  168. IN LPCWSTR pString
  169. );
  170. BOOL
  171. IsValidGuid(
  172. IN LPWSTR pszGuid
  173. );
  174. BOOL
  175. GuidEqual(
  176. CONST GUID UNALIGNED *Guid1,
  177. CONST GUID UNALIGNED *Guid2
  178. );
  179. DWORD
  180. GuidFromString(
  181. IN PCWSTR GuidString,
  182. OUT LPGUID Guid
  183. );
  184. DWORD
  185. StringFromGuid(
  186. IN CONST GUID *Guid,
  187. OUT PWSTR GuidString,
  188. IN DWORD GuidStringSize
  189. );
  190. BOOL
  191. IsValidDeviceID(
  192. IN LPCWSTR pszDeviceID,
  193. IN HKEY hKey,
  194. IN ULONG ulFlags
  195. );
  196. BOOL
  197. IsRootDeviceID(
  198. IN LPCWSTR pDeviceID
  199. );
  200. BOOL
  201. IsDeviceIdPresent(
  202. IN LPCWSTR pszDeviceID
  203. );
  204. BOOL
  205. IsDevicePhantom(
  206. IN LPWSTR pszDeviceID
  207. );
  208. BOOL
  209. IsDeviceMoved(
  210. IN LPCWSTR pszDeviceID,
  211. IN HKEY hKey
  212. );
  213. ULONG
  214. GetDeviceConfigFlags(
  215. IN LPCWSTR pszDeviceID,
  216. IN HKEY hKey
  217. );
  218. CONFIGRET
  219. GetDeviceStatus(
  220. IN LPCWSTR pszDeviceID,
  221. OUT PULONG pulStatus,
  222. OUT PULONG pulProblem
  223. );
  224. CONFIGRET
  225. SetDeviceStatus(
  226. IN LPCWSTR pszDeviceID,
  227. IN ULONG ulStatus,
  228. IN ULONG ulProblem
  229. );
  230. CONFIGRET
  231. ClearDeviceStatus(
  232. IN LPCWSTR pszDeviceID,
  233. IN ULONG ulStatus,
  234. IN ULONG ulProblem
  235. );
  236. BOOL
  237. GetActiveService(
  238. IN PCWSTR pszDevice,
  239. OUT PWSTR pszService
  240. );
  241. BOOL
  242. PathToString(
  243. IN LPWSTR pszString,
  244. IN LPCWSTR pszPath,
  245. IN ULONG ulLength
  246. );
  247. CONFIGRET
  248. CopyRegistryTree(
  249. IN HKEY hSrcKey,
  250. IN HKEY hDestKey,
  251. IN ULONG ulOption
  252. );
  253. CONFIGRET
  254. MakeKeyVolatile(
  255. IN LPCWSTR pszParentKey,
  256. IN LPCWSTR pszChildKey
  257. );
  258. CONFIGRET
  259. MakeKeyNonVolatile(
  260. IN LPCWSTR pszParentKey,
  261. IN LPCWSTR pszChildKey
  262. );
  263. CONFIGRET
  264. OpenLogConfKey(
  265. IN LPCWSTR pszDeviceID,
  266. IN ULONG LogConfType,
  267. OUT PHKEY phKey
  268. );
  269. BOOL
  270. CreateDeviceIDRegKey(
  271. IN HKEY hParentKey,
  272. IN LPCWSTR pDeviceID
  273. );
  274. VOID
  275. PNP_ENTER_SYNCHRONOUS_CALL(
  276. VOID
  277. );
  278. VOID
  279. PNP_LEAVE_SYNCHRONOUS_CALL(
  280. VOID
  281. );
  282. ULONG
  283. MapNtStatusToCmError(
  284. IN ULONG NtStatus
  285. );
  286. ULONG
  287. GetActiveConsoleSessionId(
  288. VOID
  289. );
  290. //
  291. // secutil.c
  292. //
  293. PSID
  294. GetUserSid(
  295. IN HANDLE hUserToken
  296. );
  297. PSID
  298. GetInteractiveSid(
  299. VOID
  300. );
  301. BOOL
  302. IsClientUsingLocalConsole(
  303. IN handle_t hBinding
  304. );
  305. BOOL
  306. IsClientLocal(
  307. IN handle_t hBinding
  308. );
  309. BOOL
  310. IsClientInteractive(
  311. IN handle_t hBinding
  312. );
  313. BOOL
  314. VerifyClientPrivilege(
  315. IN handle_t hBinding,
  316. IN ULONG Privilege,
  317. IN LPCWSTR ServiceName
  318. );
  319. BOOL
  320. VerifyClientAccess(
  321. IN handle_t hBinding,
  322. IN ACCESS_MASK DesiredAccess
  323. );
  324. BOOL
  325. VerifyKernelInitiatedEjectPermissions(
  326. IN HANDLE UserToken OPTIONAL,
  327. IN BOOL DockDevice
  328. );
  329. //
  330. // pnpsec.c
  331. //
  332. #include "pnpsec.h"
  333. BOOL
  334. CreatePlugPlaySecurityObject(
  335. VOID
  336. );
  337. VOID
  338. DestroyPlugPlaySecurityObject(
  339. VOID
  340. );
  341. //
  342. // osver.c
  343. //
  344. BOOL
  345. IsEmbeddedNT(
  346. VOID
  347. );
  348. BOOL
  349. IsTerminalServer(
  350. VOID
  351. );
  352. BOOL
  353. IsFastUserSwitchingEnabled(
  354. VOID
  355. );
  356. #endif // _UMPNPI_H_