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.

445 lines
12 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 (this also
  99. // disallows Authenticode-signed files)
  100. #define FQF_KEEP_INF_AND_CAT_ORIGINAL_NAMES 0x02000000 // install INF/CAT from 3rd-party location
  101. // using original names (for exception INFs)
  102. #define FQF_BACKUP_INCOMPLETE 0x04000000 // set if we were not successful backing up
  103. // all intended files
  104. #define FQF_ABORT_IF_UNSIGNED 0x08000000 // set if we're supposed to bail
  105. // out of unsigned queue committals
  106. // so that the caller can set a system
  107. // restore point.
  108. #define FQF_FILES_MODIFIED 0x10000000 // set if any files are overwritten.
  109. #define FQF_DID_CATALOGS_PROMPT_FOR_TRUST 0x20000000 // catalog/inf verification has run,
  110. // couldn't show UI, so user has yet
  111. // to confirm trust of Authenticode
  112. // publisher
  113. //
  114. // File functions in fileutil.c
  115. //
  116. BOOL
  117. pSetupGetVersionInfoFromImage(
  118. IN PCTSTR FileName,
  119. OUT PULARGE_INTEGER Version,
  120. OUT LANGID *Language
  121. );
  122. //
  123. // Private INF routines
  124. //
  125. PCTSTR
  126. pSetupGetField(
  127. IN PINFCONTEXT Context,
  128. IN DWORD FieldIndex
  129. );
  130. //
  131. // Registry interface routines
  132. //
  133. DWORD
  134. pSetupQueryMultiSzValueToArray(
  135. IN HKEY Root,
  136. IN PCTSTR Subkey,
  137. IN PCTSTR ValueName,
  138. OUT PTSTR **Array,
  139. OUT PUINT StringCount,
  140. IN BOOL FailIfDoesntExist
  141. );
  142. DWORD
  143. pSetupSetArrayToMultiSzValue(
  144. IN HKEY Root,
  145. IN PCTSTR Subkey,
  146. IN PCTSTR ValueName,
  147. IN PTSTR *Array,
  148. IN UINT StringCount
  149. );
  150. VOID
  151. pSetupFreeStringArray(
  152. IN PTSTR *Array,
  153. IN UINT StringCount
  154. );
  155. DWORD
  156. pSetupAppendStringToMultiSz(
  157. IN HKEY Key,
  158. IN PCTSTR SubKeyName, OPTIONAL
  159. IN DWORD DevInst, OPTIONAL
  160. IN PCTSTR ValueName, OPTIONAL
  161. IN PCTSTR String,
  162. IN BOOL AllowDuplicates
  163. );
  164. //
  165. // Service controller helper functions
  166. //
  167. DWORD
  168. pSetupRetrieveServiceConfig(
  169. IN SC_HANDLE ServiceHandle,
  170. OUT LPQUERY_SERVICE_CONFIG *ServiceConfig
  171. );
  172. DWORD
  173. pSetupAddTagToGroupOrderListEntry(
  174. IN PCTSTR LoadOrderGroup,
  175. IN DWORD TagId,
  176. IN BOOL MoveToFront
  177. );
  178. DWORD
  179. pSetupAcquireSCMLock(
  180. IN SC_HANDLE SCMHandle,
  181. OUT SC_LOCK *pSCMLock
  182. );
  183. //
  184. // Miscellaneous utility functions
  185. //
  186. BOOL
  187. pSetupInfIsFromOemLocation(
  188. IN PCTSTR InfFileName,
  189. IN BOOL InfDirectoryOnly
  190. );
  191. DWORD
  192. pSetupGetOsLoaderDriveAndPath(
  193. IN BOOL RootOnly,
  194. OUT PTSTR CallerBuffer,
  195. IN DWORD CallerBufferSize,
  196. OUT PDWORD RequiredSize OPTIONAL
  197. );
  198. BOOL
  199. pSetupSetSystemSourcePath(
  200. IN PCTSTR NewSourcePath,
  201. IN PCTSTR NewSvcPackSourcePath
  202. );
  203. BOOL
  204. pSetupShouldDeviceBeExcluded(
  205. IN PCTSTR DeviceId,
  206. IN HINF hInf,
  207. OUT PBOOL ArchitectureSpecificExclude OPTIONAL
  208. );
  209. BOOL
  210. pSetupDiSetDeviceInfoContext(
  211. IN HDEVINFO DeviceInfoSet,
  212. IN PSP_DEVINFO_DATA DeviceInfoData,
  213. IN DWORD Context
  214. );
  215. BOOL
  216. pSetupDiGetDeviceInfoContext(
  217. IN HDEVINFO DeviceInfoSet,
  218. IN PSP_DEVINFO_DATA DeviceInfoData,
  219. OUT PDWORD Context
  220. );
  221. #define SETUP_HAS_OPEN_DIALOG_EVENT TEXT("MS_SETUPAPI_DIALOG")
  222. #define SETUP_NODRIVERPROMPTS_MODE TEXT("MS_SETUPAPI_NODRIVERPROMPTS")
  223. INT
  224. pSetupAddMiniIconToList(
  225. IN HBITMAP hbmImage,
  226. IN HBITMAP hbmMask
  227. );
  228. PCTSTR
  229. pSetupDirectoryIdToPath(
  230. IN PCTSTR DirectoryId, OPTIONAL
  231. IN OUT PUINT DirectoryIdInt, OPTIONAL
  232. IN PCTSTR SubDirectory, OPTIONAL
  233. IN PCTSTR InfSourcePath, OPTIONAL
  234. IN OUT PCTSTR *OsLoaderPath OPTIONAL
  235. );
  236. //
  237. // Routine used by optional components code in syssetup to setup runonce/grpconv.
  238. //
  239. DWORD
  240. pSetupInstallStopEx(
  241. IN BOOL DoRunOnce,
  242. IN DWORD Flags,
  243. IN PVOID Reserved
  244. );
  245. #define INSTALLSTOP_NO_UI 0x00000001 // InstallStop should do no UI
  246. #define INSTALLSTOP_NO_GRPCONV 0x00000002 // Don't do GrpConv
  247. //
  248. // Section access for INF file
  249. //
  250. BOOL
  251. pSetupGetInfSections (
  252. IN HINF InfHandle,
  253. OUT PTSTR Buffer, OPTIONAL
  254. IN UINT Size, OPTIONAL
  255. OUT UINT *SizeNeeded OPTIONAL
  256. );
  257. //
  258. // GUID handling routines
  259. // these may be eventually removed
  260. //
  261. DWORD
  262. pSetupGuidFromString(
  263. IN PCTSTR GuidString,
  264. OUT LPGUID Guid
  265. );
  266. DWORD
  267. pSetupStringFromGuid(
  268. IN CONST GUID *Guid,
  269. OUT PTSTR GuidString,
  270. IN DWORD GuidStringSize
  271. );
  272. BOOL
  273. pSetupIsGuidNull(
  274. IN CONST GUID *Guid
  275. );
  276. //
  277. // pSetupInfCacheBuild function
  278. // called to rebuild the cache(s)
  279. //
  280. BOOL
  281. WINAPI
  282. pSetupInfCacheBuild(
  283. IN DWORD Action
  284. );
  285. //
  286. // action (more may be added)
  287. //
  288. #define INFCACHEBUILD_UPDATE 0x00000000 // update caches
  289. #define INFCACHEBUILD_REBUILD 0x00000001 // delete and update caches
  290. //
  291. // Digital signature verification routines
  292. //
  293. typedef enum {
  294. SetupapiVerifyNoProblem,
  295. SetupapiVerifyCatalogProblem, // catalog file couldn't be verified
  296. SetupapiVerifyInfProblem, // inf file couldn't be installed/verified
  297. SetupapiVerifyFileNotSigned, // file is not signed, no verification attempted
  298. SetupapiVerifyFileProblem, // file may be signed, but couldn't be verified
  299. SetupapiVerifyClassInstProblem, // class installer is unsigned
  300. SetupapiVerifyCoInstProblem, // co-installer is unsigned
  301. SetupapiVerifyCatalogInstallProblem, // catalog install failed (not due to verification failure)
  302. SetupapiVerifyRegSvrFileProblem, // file to be registered/unregistered is unsigned
  303. SetupapiVerifyIncorrectlyCopiedInf, // invalid attempt to directly copy INF into %windir%\Inf
  304. SetupapiVerifyAutoFailProblem , // PSPGF_AUTOFAIL_VERIFIES flag is set
  305. SetupapiVerifyDriverBlocked // driver is in the bad driver database.
  306. } SetupapiVerifyProblem;
  307. DWORD
  308. pSetupVerifyQueuedCatalogs(
  309. IN HSPFILEQ FileQueue
  310. );
  311. DWORD
  312. pSetupVerifyCatalogFile(
  313. IN LPCTSTR CatalogFullPath
  314. );
  315. DWORD
  316. pSetupVerifyFile(
  317. IN LPVOID LogContext,
  318. IN LPCTSTR Catalog, OPTIONAL
  319. IN PVOID CatalogBaseAddress, OPTIONAL
  320. IN DWORD CatalogImageSize,
  321. IN LPCTSTR Key,
  322. IN LPCTSTR FileFullPath,
  323. OUT SetupapiVerifyProblem *Problem, OPTIONAL
  324. OUT LPTSTR ProblemFile, OPTIONAL
  325. IN BOOL CatalogAlreadyVerified,
  326. IN PSP_ALTPLATFORM_INFO_V2 AltPlatformInfo, OPTIONAL
  327. OUT LPTSTR CatalogFileUsed, OPTIONAL
  328. OUT PDWORD NumCatalogsConsidered OPTIONAL
  329. );
  330. DWORD
  331. pSetupInstallCatalog(
  332. IN LPCTSTR CatalogFullPath,
  333. IN LPCTSTR NewBaseName, OPTIONAL
  334. OUT LPTSTR NewCatalogFullPath
  335. );
  336. BOOL
  337. pSetupHandleFailedVerification(
  338. IN HWND Owner,
  339. IN SetupapiVerifyProblem Problem,
  340. IN LPCTSTR ProblemFile,
  341. IN LPCTSTR DeviceDesc, OPTIONAL
  342. IN DWORD DriverSigningPolicy,
  343. IN BOOL NoUI,
  344. IN DWORD Error,
  345. IN PVOID LogContext, OPTIONAL
  346. OUT PDWORD Flags, OPTIONAL
  347. IN LPCTSTR TargetName OPTIONAL
  348. );
  349. DWORD
  350. pSetupGetCurrentDriverSigningPolicy(
  351. IN BOOL IsDeviceInstallation
  352. );
  353. //
  354. // private SetupDiCallClassInstaller defines/structures
  355. //
  356. //
  357. // DI_FUNCTION codes
  358. //
  359. #define DIF_INTERFACE_TO_DEVICE 0x00000030 // aka DIF_RESERVED2
  360. //
  361. // Structure corresponding to the DIF_INTERFACE_TO_DEVICE install function
  362. // note that this is always Unicode
  363. // always use SetupDiSetClassInstallParamsW
  364. //
  365. typedef struct _SP_INTERFACE_TO_DEVICE_PARAMS_W {
  366. SP_CLASSINSTALL_HEADER ClassInstallHeader;
  367. PCWSTR Interface; // IN (must remain valid)
  368. WCHAR DeviceId[200]; // OUT MAX_DEVICE_ID_LEN
  369. } SP_INTERFACE_TO_DEVICE_PARAMS_W, *PSP_INTERFACE_TO_DEVICE_PARAMS_W;
  370. //
  371. // semi-private flag for SetupQueueCopyIndirect
  372. //
  373. #define PSP_COPY_USE_SPCACHE 0x20000000