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.

436 lines
11 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. spapip.h
  5. Abstract:
  6. Header file for routines exported from setupapi.dll that are NOT
  7. part of the setup API, and are thus intended for private/internal use.
  8. Author:
  9. Ted Miller (tedm) Mar-31-1995
  10. Revision History:
  11. Jamie Hunter (jamiehun) May-25-2000
  12. General cleanup. All private exported SetupAPI functions now begin pSetup...
  13. --*/
  14. //
  15. // these are also exported in setupapi.dll
  16. //
  17. #include <sputils.h>
  18. VOID
  19. pSetupOutOfMemory(
  20. IN HWND Owner OPTIONAL
  21. );
  22. //
  23. // Global flags / overrides
  24. //
  25. VOID
  26. pSetupSetGlobalFlags(
  27. IN DWORD Value
  28. );
  29. DWORD
  30. pSetupGetGlobalFlags(
  31. VOID
  32. );
  33. VOID pSetupModifyGlobalFlags(
  34. IN DWORD Flags,
  35. IN DWORD Value
  36. );
  37. #define PSPGF_NO_RUNONCE 0x00000001 // set to inhibit runonce calls
  38. #define PSPGF_NO_BACKUP 0x00000002 // set to inhibit automatic backup
  39. #define PSPGF_NONINTERACTIVE 0x00000004 // set to inhibit all UI
  40. #define PSPGF_SERVER_SIDE_RUNONCE 0x00000008 // batch RunOnce entries for server-side processing
  41. #define PSPGF_NO_VERIFY_INF 0x00000010 // set to inhibit verification (digital signature) of INFs
  42. #define PSPGF_UNATTENDED_SETUP 0x00000020 // set during full unattended setup
  43. #define PSPGF_MINIMAL_EMBEDDED 0x00000040 // minimize footprint for embedded scenarios
  44. #define PSPGF_NO_SCE_EMBEDDED 0x00000080 // don't call SCE for embedded scenarios
  45. #define PSPGF_AUTOFAIL_VERIFIES 0x00000100 // fail all file verification attempts (w/o calling crypto)
  46. //
  47. // to allow syssetup.dll to signal all setupapi.dll's that we require headless mode
  48. // returns TRUE on success. Only works during syssetup
  49. //
  50. BOOL
  51. pSetupSetNoDriverPrompts(
  52. BOOL Flag
  53. );
  54. //
  55. // Server-side (non-interactive mode) RunOnce processing support
  56. //
  57. typedef struct _PSP_RUNONCE_NODE {
  58. struct _PSP_RUNONCE_NODE *Next;
  59. PCWSTR DllFullPath;
  60. PCSTR DllEntryPointName;
  61. PCWSTR DllParams;
  62. } PSP_RUNONCE_NODE, *PPSP_RUNONCE_NODE;
  63. PPSP_RUNONCE_NODE
  64. pSetupAccessRunOnceNodeList(
  65. VOID
  66. );
  67. VOID
  68. pSetupDestroyRunOnceNodeList(
  69. VOID
  70. );
  71. //
  72. // per queue overrides
  73. //
  74. BOOL
  75. pSetupSetQueueFlags(
  76. IN HSPFILEQ QueueHandle,
  77. IN DWORD flags
  78. );
  79. DWORD
  80. pSetupGetQueueFlags(
  81. IN HSPFILEQ QueueHandle
  82. );
  83. //
  84. // Queue flags.
  85. //
  86. #define FQF_TRY_SIS_COPY 0x00000001 // try SIS copy first
  87. #define FQF_BACKUP_AWARE 0x00010000 // allow callbacks
  88. #define FQF_DID_CATALOGS_OK 0x00020000 // catalog/inf verification has run
  89. #define FQF_DID_CATALOGS_FAILED 0x00040000 // catalog/inf verification has run
  90. #define FQF_DIGSIG_ERRORS_NOUI 0x00080000 // prompt user on failed signature
  91. // verification
  92. #define FQF_DEVICE_INSTALL 0x00100000 // file queue is for device install
  93. #define FQF_USE_ALT_PLATFORM 0x00200000 // use AltPlatformInfo for digital
  94. // signature verification
  95. #define FQF_QUEUE_ALREADY_COMMITTED 0x00400000 // file queue has already been committed
  96. #define FQF_DEVICE_BACKUP 0x00800000 // device backup
  97. #define FQF_QUEUE_FORCE_BLOCK_POLICY 0x01000000 // force policy to block so we never
  98. // install unsigned files
  99. #define FQF_KEEP_INF_AND_CAT_ORIGINAL_NAMES 0x02000000 // install INF/CAT from 3rd-party location
  100. // using original names (for exception INFs)
  101. #define FQF_BACKUP_INCOMPLETE 0x04000000 // set if we were not successful backing up
  102. // all intended files
  103. #define FQF_ABORT_IF_UNSIGNED 0x08000000 // set if we're supposed to bail
  104. // out of unsigned queue committals
  105. // so that the caller can set a system
  106. // restore point.
  107. #define FQF_FILES_MODIFIED 0x10000000 // set if any files are overwritten.
  108. //
  109. // File functions in fileutil.c
  110. //
  111. BOOL
  112. pSetupGetVersionInfoFromImage(
  113. IN PCTSTR FileName,
  114. OUT PULARGE_INTEGER Version,
  115. OUT LANGID *Language
  116. );
  117. //
  118. // Private INF routines
  119. //
  120. PCTSTR
  121. pSetupGetField(
  122. IN PINFCONTEXT Context,
  123. IN DWORD FieldIndex
  124. );
  125. //
  126. // Registry interface routines
  127. //
  128. DWORD
  129. pSetupQueryMultiSzValueToArray(
  130. IN HKEY Root,
  131. IN PCTSTR Subkey,
  132. IN PCTSTR ValueName,
  133. OUT PTSTR **Array,
  134. OUT PUINT StringCount,
  135. IN BOOL FailIfDoesntExist
  136. );
  137. DWORD
  138. pSetupSetArrayToMultiSzValue(
  139. IN HKEY Root,
  140. IN PCTSTR Subkey,
  141. IN PCTSTR ValueName,
  142. IN PTSTR *Array,
  143. IN UINT StringCount
  144. );
  145. VOID
  146. pSetupFreeStringArray(
  147. IN PTSTR *Array,
  148. IN UINT StringCount
  149. );
  150. DWORD
  151. pSetupAppendStringToMultiSz(
  152. IN HKEY Key,
  153. IN PCTSTR SubKeyName, OPTIONAL
  154. IN DWORD DevInst, OPTIONAL
  155. IN PCTSTR ValueName, OPTIONAL
  156. IN PCTSTR String,
  157. IN BOOL AllowDuplicates
  158. );
  159. //
  160. // Service controller helper functions
  161. //
  162. DWORD
  163. pSetupRetrieveServiceConfig(
  164. IN SC_HANDLE ServiceHandle,
  165. OUT LPQUERY_SERVICE_CONFIG *ServiceConfig
  166. );
  167. DWORD
  168. pSetupAddTagToGroupOrderListEntry(
  169. IN PCTSTR LoadOrderGroup,
  170. IN DWORD TagId,
  171. IN BOOL MoveToFront
  172. );
  173. DWORD
  174. pSetupAcquireSCMLock(
  175. IN SC_HANDLE SCMHandle,
  176. OUT SC_LOCK *pSCMLock
  177. );
  178. //
  179. // Miscellaneous utility functions
  180. //
  181. BOOL
  182. pSetupInfIsFromOemLocation(
  183. IN PCTSTR InfFileName,
  184. IN BOOL InfDirectoryOnly
  185. );
  186. DWORD
  187. pSetupGetOsLoaderDriveAndPath(
  188. IN BOOL RootOnly,
  189. OUT PTSTR CallerBuffer,
  190. IN DWORD CallerBufferSize,
  191. OUT PDWORD RequiredSize OPTIONAL
  192. );
  193. BOOL
  194. pSetupSetSystemSourcePath(
  195. IN PCTSTR NewSourcePath,
  196. IN PCTSTR NewSvcPackSourcePath
  197. );
  198. BOOL
  199. pSetupShouldDeviceBeExcluded(
  200. IN PCTSTR DeviceId,
  201. IN HINF hInf,
  202. OUT PBOOL ArchitectureSpecificExclude OPTIONAL
  203. );
  204. BOOL
  205. pSetupDiSetDeviceInfoContext(
  206. IN HDEVINFO DeviceInfoSet,
  207. IN PSP_DEVINFO_DATA DeviceInfoData,
  208. IN DWORD Context
  209. );
  210. BOOL
  211. pSetupDiGetDeviceInfoContext(
  212. IN HDEVINFO DeviceInfoSet,
  213. IN PSP_DEVINFO_DATA DeviceInfoData,
  214. OUT PDWORD Context
  215. );
  216. #define SETUP_HAS_OPEN_DIALOG_EVENT TEXT("MS_SETUPAPI_DIALOG")
  217. #define SETUP_NODRIVERPROMPTS_MODE TEXT("MS_SETUPAPI_NODRIVERPROMPTS")
  218. INT
  219. pSetupAddMiniIconToList(
  220. IN HBITMAP hbmImage,
  221. IN HBITMAP hbmMask
  222. );
  223. PCTSTR
  224. pSetupDirectoryIdToPath(
  225. IN PCTSTR DirectoryId, OPTIONAL
  226. IN OUT PUINT DirectoryIdInt, OPTIONAL
  227. IN PCTSTR SubDirectory, OPTIONAL
  228. IN PCTSTR InfSourcePath, OPTIONAL
  229. IN OUT PCTSTR *OsLoaderPath OPTIONAL
  230. );
  231. //
  232. // Routine used by optional components code in syssetup to setup runonce/grpconv.
  233. //
  234. DWORD
  235. pSetupInstallStopEx(
  236. IN BOOL DoRunOnce,
  237. IN DWORD Flags,
  238. IN PVOID Reserved
  239. );
  240. #define INSTALLSTOP_NO_UI 0x00000001 // InstallStop should do no UI
  241. #define INSTALLSTOP_NO_GRPCONV 0x00000002 // Don't do GrpConv
  242. //
  243. // Section access for INF file
  244. //
  245. BOOL
  246. pSetupGetInfSections (
  247. IN HINF InfHandle,
  248. OUT PTSTR Buffer, OPTIONAL
  249. IN UINT Size, OPTIONAL
  250. OUT UINT *SizeNeeded OPTIONAL
  251. );
  252. //
  253. // GUID handling routines
  254. // these may be eventually removed
  255. //
  256. DWORD
  257. pSetupGuidFromString(
  258. IN PCTSTR GuidString,
  259. OUT LPGUID Guid
  260. );
  261. DWORD
  262. pSetupStringFromGuid(
  263. IN CONST GUID *Guid,
  264. OUT PTSTR GuidString,
  265. IN DWORD GuidStringSize
  266. );
  267. BOOL
  268. pSetupIsGuidNull(
  269. IN CONST GUID *Guid
  270. );
  271. //
  272. // pSetupInfCacheBuild function
  273. // called to rebuild the cache(s)
  274. //
  275. BOOL
  276. WINAPI
  277. pSetupInfCacheBuild(
  278. IN DWORD Action
  279. );
  280. //
  281. // action (more may be added)
  282. //
  283. #define INFCACHEBUILD_UPDATE 0x00000000 // update caches
  284. #define INFCACHEBUILD_REBUILD 0x00000001 // delete and update caches
  285. //
  286. // Digital signature verification routines
  287. //
  288. typedef enum {
  289. SetupapiVerifyNoProblem,
  290. SetupapiVerifyCatalogProblem, // catalog file couldn't be verified
  291. SetupapiVerifyInfProblem, // inf file couldn't be installed/verified
  292. SetupapiVerifyFileNotSigned, // file is not signed, no verification attempted
  293. SetupapiVerifyFileProblem, // file may be signed, but couldn't be verified
  294. SetupapiVerifyClassInstProblem, // class installer is unsigned
  295. SetupapiVerifyCoInstProblem, // co-installer is unsigned
  296. SetupapiVerifyCatalogInstallProblem, // catalog install failed (not due to verification failure)
  297. SetupapiVerifyRegSvrFileProblem, // file to be registered/unregistered is unsigned
  298. SetupapiVerifyIncorrectlyCopiedInf, // invalid attempt to directly copy INF into %windir%\Inf
  299. SetupapiVerifyAutoFailProblem , // PSPGF_AUTOFAIL_VERIFIES flag is set
  300. SetupapiVerifyDriverBlocked // driver is in the bad driver database.
  301. } SetupapiVerifyProblem;
  302. DWORD
  303. pSetupVerifyQueuedCatalogs(
  304. IN HSPFILEQ FileQueue
  305. );
  306. DWORD
  307. pSetupVerifyCatalogFile(
  308. IN LPCTSTR CatalogFullPath
  309. );
  310. DWORD
  311. pSetupVerifyFile(
  312. IN LPVOID LogContext,
  313. IN LPCTSTR Catalog, OPTIONAL
  314. IN PVOID CatalogBaseAddress, OPTIONAL
  315. IN DWORD CatalogImageSize,
  316. IN LPCTSTR Key,
  317. IN LPCTSTR FileFullPath,
  318. OUT SetupapiVerifyProblem *Problem, OPTIONAL
  319. OUT LPTSTR ProblemFile, OPTIONAL
  320. IN BOOL CatalogAlreadyVerified,
  321. IN PSP_ALTPLATFORM_INFO_V2 AltPlatformInfo, OPTIONAL
  322. OUT LPTSTR CatalogFileUsed, OPTIONAL
  323. OUT PDWORD NumCatalogsConsidered OPTIONAL
  324. );
  325. DWORD
  326. pSetupInstallCatalog(
  327. IN LPCTSTR CatalogFullPath,
  328. IN LPCTSTR NewBaseName, OPTIONAL
  329. OUT LPTSTR NewCatalogFullPath
  330. );
  331. BOOL
  332. pSetupHandleFailedVerification(
  333. IN HWND Owner,
  334. IN SetupapiVerifyProblem Problem,
  335. IN LPCTSTR ProblemFile,
  336. IN LPCTSTR DeviceDesc, OPTIONAL
  337. IN DWORD DriverSigningPolicy,
  338. IN BOOL NoUI,
  339. IN DWORD Error,
  340. IN PVOID LogContext, OPTIONAL
  341. OUT PDWORD Flags, OPTIONAL
  342. IN LPCTSTR TargetName OPTIONAL
  343. );
  344. DWORD
  345. pSetupGetCurrentDriverSigningPolicy(
  346. IN BOOL IsDeviceInstallation
  347. );
  348. //
  349. // private SetupDiCallClassInstaller defines/structures
  350. //
  351. //
  352. // DI_FUNCTION codes
  353. //
  354. #define DIF_INTERFACE_TO_DEVICE 0x00000030 // aka DIF_RESERVED2
  355. //
  356. // Structure corresponding to the DIF_INTERFACE_TO_DEVICE install function
  357. // note that this is always Unicode
  358. // always use SetupDiSetClassInstallParamsW
  359. //
  360. typedef struct _SP_INTERFACE_TO_DEVICE_PARAMS_W {
  361. SP_CLASSINSTALL_HEADER ClassInstallHeader;
  362. PCWSTR Interface; // IN (must remain valid)
  363. WCHAR DeviceId[200]; // OUT MAX_DEVICE_ID_LEN
  364. } SP_INTERFACE_TO_DEVICE_PARAMS_W, *PSP_INTERFACE_TO_DEVICE_PARAMS_W;