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.

1508 lines
37 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. setupntp.h
  5. Abstract:
  6. Private top-level header file for Windows NT Setup
  7. services Dll.
  8. Author:
  9. Ted Miller (tedm) 11-Jan-1995
  10. Revision History:
  11. Jamie Hunter (jamiehun) 27-Jan-2000 Added infcache.h
  12. Jim Schmidt (jimschm) 16-Dec-1998 Log api init
  13. Jim Schmidt (jimschm) 28-Apr-1997 Added stub.h
  14. Jamie Hunter (jamiehun) 13-Jan-1997 Added backup.h
  15. --*/
  16. #if !defined(UNICODE) || !defined(_UNICODE) || defined(ANSI_SETUPAPI)
  17. #error "Ansi SetupAPI no longer supported"
  18. #endif
  19. //
  20. // System header files
  21. //
  22. #if DBG
  23. #ifndef MEM_DBG
  24. #define MEM_DBG 1
  25. #endif
  26. #else
  27. #ifndef MEM_DBG
  28. #define MEM_DBG 0
  29. #endif
  30. #endif
  31. //
  32. // NT Header Files
  33. //
  34. #include <nt.h>
  35. #include <ntrtl.h>
  36. #include <nturtl.h>
  37. //
  38. // Make sure we always use version 2 of SP_ALTPLATFORM_INFO structure...
  39. //
  40. #define USE_SP_ALTPLATFORM_INFO_V1 0
  41. //
  42. // CRT header files
  43. //
  44. #include <process.h>
  45. #include <malloc.h>
  46. #include <wchar.h>
  47. #include <stddef.h>
  48. #include <stdio.h>
  49. #include <fcntl.h>
  50. #include <tchar.h>
  51. #include <mbstring.h>
  52. //
  53. // Windows header files
  54. //
  55. #include <windows.h>
  56. #include <windowsx.h>
  57. #include <commctrl.h>
  58. #include <commdlg.h>
  59. #include <prsht.h>
  60. #include <spfusion.h>
  61. #include <imagehlp.h>
  62. #include <diamondd.h>
  63. #include <lzexpand.h>
  64. #include <dlgs.h>
  65. #include <regstr.h>
  66. #include <infstr.h>
  67. #include <objbase.h>
  68. #include <wincrypt.h>
  69. #include <mscat.h>
  70. #include <softpub.h>
  71. #include <wintrust.h>
  72. #include <cryptui.h>
  73. #include <shlobj.h>
  74. #include <shlwapi.h>
  75. #include <shellapi.h>
  76. #include <userenv.h>
  77. #include <userenvp.h>
  78. #include <secedit.h>
  79. #include <scesetup.h>
  80. #include <sfcapip.h>
  81. #include <wow64reg.h>
  82. #include <dbt.h>
  83. #include <shimdb.h>
  84. #include <setupapi.h>
  85. #include <cfgmgr32.h>
  86. #include <spapip.h>
  87. #include <devguid.h>
  88. #include <cdm.h>
  89. //
  90. // safe strings
  91. //
  92. #define STRSAFE_NO_DEPRECATE // we're using both safe and 'unsafe' routines right now
  93. #include <strsafe.h>
  94. //
  95. // these definitions may be used by private header files
  96. //
  97. #ifndef ARRAYSIZE
  98. #define ARRAYSIZE(x) (sizeof((x))/sizeof((x)[0]))
  99. #endif
  100. #define SIZECHARS(x) ARRAYSIZE(x)
  101. #define CSTRLEN(x) (SIZECHARS(x)-1)
  102. typedef struct _STRING_TO_DATA {
  103. PCTSTR String;
  104. UINT_PTR Data;
  105. } STRING_TO_DATA, *PSTRING_TO_DATA;
  106. //
  107. // Define structure to house various verification context handles (cached on a
  108. // per-file-queue basis for performance).
  109. //
  110. typedef struct _VERIFY_CONTEXT {
  111. //
  112. // crypto context handle acquired during digital signature verification
  113. // (starts out as NULL, if non-NULL when freeing queue, must release via
  114. // CryptCATAdminReleaseContext)
  115. //
  116. HCATADMIN hCatAdmin;
  117. //
  118. // handle to bad driver database acquired during check for blocked driver
  119. // (starts out as NULL, if non-NULL when freeing queue, must release via
  120. // SdbReleaseDatabase)
  121. //
  122. HSDB hSDBDrvMain;
  123. //
  124. // handle to trusted publisher certificate store. Used when checking to
  125. // see if the publisher of an Authenticode-signed catalog should be
  126. // implicitly trusted (i.e., without prompting the user). (starts out as
  127. // NULL, if non-NULL when freing queue, must release via CertCloseStore)
  128. //
  129. HCERTSTORE hStoreTrustedPublisher;
  130. } VERIFY_CONTEXT, *PVERIFY_CONTEXT;
  131. //
  132. // Private header files
  133. //
  134. #include "sputils/locking.h"
  135. #include "sputils/strtab.h"
  136. #include "memory.h"
  137. #include "cntxtlog.h"
  138. #include "inf.h"
  139. #include "infcache.h"
  140. #include "backup.h"
  141. #include "fileq.h"
  142. #include "debug.h"
  143. #include "devinst.h"
  144. #include "devres.h"
  145. #include "rc_ids.h"
  146. #include "msg.h"
  147. #include "stub.h"
  148. #include "helpids.h"
  149. #ifdef CHILDREGISTRATION
  150. #include "childreg.h"
  151. #ifndef _WIN64
  152. #include <wow64t.h>
  153. #endif // _WIN64
  154. #endif // CHILDREGISTRATION
  155. //
  156. // NTRAID#489682-2001/11/02-JamieHun These need to move into public headers
  157. //
  158. #define SP_COPY_ALREADYDECOMP 0x0400000 // similar to SP_COPY_NODECOMP
  159. //
  160. // Private DNF_ flags (start at 0x10000000)
  161. //
  162. #define PDNF_MASK 0xF0000000 // Mask for private PDNF_xxx flags
  163. #define PDNF_CLEANUP_SOURCE_PATH 0x10000000 // Delete the source path when we destroy the driver node
  164. // used when drivers are downloaded from the Internet
  165. //
  166. // Thread Local Storage Index
  167. //
  168. extern DWORD TlsIndex;
  169. //
  170. // Module handle for this DLL. Filled in at process attach.
  171. //
  172. extern HANDLE MyDllModuleHandle;
  173. //
  174. // Module handle for security DLL. Initialized to NULL in at process attach. Filled in when SCE APIs have to be called
  175. //
  176. extern HINSTANCE SecurityDllHandle;
  177. //
  178. // OS Version Information structure filled in at process attach.
  179. //
  180. extern OSVERSIONINFOEX OSVersionInfo;
  181. //
  182. // Static strings we retreive once, at process attach.
  183. //
  184. extern PCTSTR WindowsDirectory,InfDirectory,SystemDirectory,ConfigDirectory,DriversDirectory,System16Directory;
  185. extern PCTSTR SystemSourcePath,ServicePackSourcePath,DriverCacheSourcePath,ServicePackCachePath;
  186. extern PCTSTR OsLoaderRelativePath; // may be NULL
  187. extern PCTSTR OsSystemPartitionRoot; // \\?\GLOBALROOT\Device\Volume
  188. extern PCTSTR WindowsBackupDirectory; // Directory to write uninstall backups to
  189. extern PCTSTR ProcessFileName; // Filename of app calling setupapi
  190. extern PCTSTR LastGoodDirectory; // %windir%\LastGood
  191. //
  192. // are we inside gui setup? determined at process attach
  193. //
  194. extern BOOL GuiSetupInProgress;
  195. //
  196. // various other global flags
  197. //
  198. extern DWORD GlobalSetupFlags;
  199. //
  200. // global window message for cancelling autoplay.
  201. //
  202. extern UINT g_uQueryCancelAutoPlay;
  203. //
  204. // Static multi-sz list of directories to be searched for INFs.
  205. //
  206. extern PCTSTR InfSearchPaths;
  207. //
  208. // Determine at runtime if we're running under WOW64
  209. //
  210. #ifndef _WIN64
  211. extern BOOL IsWow64;
  212. #endif
  213. #ifdef UNICODE
  214. extern DWORD Seed;
  215. #endif
  216. //
  217. // ImageHlp isn't multi-thread safe, so needs a mutex
  218. //
  219. extern CRITICAL_SECTION InitMutex; // for one-time initializations
  220. extern CRITICAL_SECTION ImageHlpMutex; // for dealing with IMAGEHLP library
  221. extern CRITICAL_SECTION PlatformPathOverrideCritSect;
  222. extern CRITICAL_SECTION LogUseCountCs;
  223. extern CRITICAL_SECTION MruCritSect;
  224. extern CRITICAL_SECTION NetConnectionListCritSect;
  225. //
  226. // Debug memory functions and wrappers to track allocations
  227. //
  228. DWORD
  229. QueryRegistryValue(
  230. IN HKEY KeyHandle,
  231. IN PCTSTR ValueName,
  232. OUT PTSTR *Value,
  233. OUT PDWORD DataType,
  234. OUT PDWORD DataSizeBytes
  235. );
  236. DWORD
  237. QueryDeviceRegistryProperty(
  238. IN HDEVINFO DeviceInfoSet,
  239. IN PSP_DEVINFO_DATA DeviceInfoData,
  240. IN DWORD Property,
  241. OUT PTSTR *Value,
  242. OUT PDWORD DataType,
  243. OUT PDWORD DataSizeBytes
  244. );
  245. DWORD
  246. QueryRegistryDwordValue(
  247. IN HKEY KeyHandle,
  248. IN PCTSTR ValueName,
  249. OUT PDWORD Value
  250. );
  251. BOOL
  252. MemoryInitializeEx(
  253. IN BOOL Attach
  254. );
  255. #if MEM_DBG
  256. //
  257. // Macros and wrappers are needed for externally exposed functions
  258. //
  259. PVOID MyDebugMalloc(
  260. IN DWORD Size,
  261. IN PCSTR Filename,
  262. IN DWORD Line,
  263. IN DWORD Tag
  264. );
  265. #define MyMalloc(sz) MyDebugMalloc(sz,__FILE__,__LINE__,0)
  266. #define MyTaggedMalloc(sz,tag) MyDebugMalloc(sz,__FILE__,__LINE__,tag)
  267. #define MyTaggedRealloc(ptr,sz,tag) pSetupReallocWithTag(ptr,sz,tag)
  268. #define MyTaggedFree(ptr,tag) pSetupFreeWithTag(ptr,tag)
  269. DWORD
  270. TrackedQueryRegistryValue(
  271. IN TRACK_ARG_DECLARE,
  272. IN HKEY KeyHandle,
  273. IN PCTSTR ValueName,
  274. OUT PTSTR *Value,
  275. OUT PDWORD DataType,
  276. OUT PDWORD DataSizeBytes
  277. );
  278. #define QueryRegistryValue(a,b,c,d,e) TrackedQueryRegistryValue(TRACK_ARG_CALL,a,b,c,d,e)
  279. DWORD
  280. TrackedQueryDeviceRegistryProperty(
  281. IN TRACK_ARG_DECLARE TRACK_ARG_COMMA
  282. IN HDEVINFO DeviceInfoSet,
  283. IN PSP_DEVINFO_DATA DeviceInfoData,
  284. IN DWORD Property,
  285. OUT PTSTR *Value,
  286. OUT PDWORD DataType,
  287. OUT PDWORD DataSizeBytes
  288. );
  289. #define QueryDeviceRegistryProperty(a,b,c,d,e,f) TrackedQueryDeviceRegistryProperty(TRACK_ARG_CALL,a,b,c,d,e,f)
  290. PTSTR
  291. TrackedDuplicateString(
  292. IN TRACK_ARG_DECLARE,
  293. IN PCTSTR String
  294. );
  295. #define DuplicateString(x) TrackedDuplicateString(TRACK_ARG_CALL,x)
  296. #else
  297. #define DuplicateString pSetupDuplicateString
  298. #define MyMalloc(sz) pSetupMalloc(sz)
  299. #define MyTaggedMalloc(sz,tag) pSetupMalloc(sz)
  300. #define MyTaggedRealloc(ptr,sz,tag) pSetupRealloc(ptr,sz)
  301. #define MyTaggedFree(ptr,tag) pSetupFree(ptr)
  302. #endif
  303. #define MyFree(ptr) pSetupFree(ptr)
  304. #define MyRealloc(ptr,sz) pSetupRealloc(ptr,sz)
  305. //
  306. // memory tags grouped here for easy reference
  307. // see also common.h in sputils
  308. //
  309. //
  310. // Log Context tags
  311. //
  312. #define MEMTAG_LOGCONTEXT (0x636c434c) // LClc - context structure
  313. #define MEMTAG_LCSECTION (0x7378434c) // LCxs - section string
  314. #define MEMTAG_LCBUFFER (0x6278434c) // LCxb - other strings
  315. #define MEMTAG_LCINFO (0x6269434c) // LCib - info (array of buffers)
  316. #define MEMTAG_LCINDEXES (0x6969434c) // LCii - index
  317. //
  318. // Loaded_Inf tags
  319. //
  320. #define MEMTAG_INF (0x666e694c) // Linf - LOADED_INF
  321. #define MEMTAG_VBDATA (0x6462764c) // Lvbd - version block data
  322. //
  323. // File functions in fileutil.c
  324. //
  325. typedef struct _TEXTFILE_READ_BUFFER {
  326. PCTSTR TextBuffer;
  327. DWORD TextBufferSize;
  328. HANDLE FileHandle;
  329. HANDLE MappingHandle;
  330. PVOID ViewAddress;
  331. } TEXTFILE_READ_BUFFER, *PTEXTFILE_READ_BUFFER;
  332. DWORD
  333. ReadAsciiOrUnicodeTextFile(
  334. IN HANDLE FileHandle,
  335. OUT PTEXTFILE_READ_BUFFER Result,
  336. IN PSETUP_LOG_CONTEXT LogContext OPTIONAL
  337. );
  338. BOOL
  339. DestroyTextFileReadBuffer(
  340. IN PTEXTFILE_READ_BUFFER ReadBuffer
  341. );
  342. BOOL
  343. AddFileTimeSeconds(
  344. IN const FILETIME *Base,
  345. OUT FILETIME *Target,
  346. IN INT Seconds
  347. );
  348. DWORD
  349. GetSetFileTimestamp(
  350. IN PCTSTR FileName,
  351. OUT FILETIME *CreateTime, OPTIONAL
  352. OUT FILETIME *AccessTime, OPTIONAL
  353. OUT FILETIME *WriteTime, OPTIONAL
  354. IN BOOL Set
  355. );
  356. DWORD
  357. RetreiveFileSecurity(
  358. IN PCTSTR FileName,
  359. OUT PSECURITY_DESCRIPTOR *SecurityDescriptor
  360. );
  361. DWORD
  362. StampFileSecurity(
  363. IN PCTSTR FileName,
  364. IN PSECURITY_DESCRIPTOR SecurityInfo
  365. );
  366. DWORD
  367. TakeOwnershipOfFile(
  368. IN PCTSTR Filename
  369. );
  370. DWORD
  371. SearchForInfFile(
  372. IN PCTSTR InfName,
  373. OUT LPWIN32_FIND_DATA FindData,
  374. IN DWORD SearchControl,
  375. OUT PTSTR FullInfPath,
  376. IN UINT FullInfPathSize,
  377. OUT PUINT RequiredSize OPTIONAL
  378. );
  379. DWORD
  380. MultiSzFromSearchControl(
  381. IN DWORD SearchControl,
  382. OUT PTCHAR PathList,
  383. IN DWORD PathListSize,
  384. OUT PDWORD RequiredSize OPTIONAL
  385. );
  386. PSTR
  387. GetAnsiMuiSafePathname(
  388. IN PCTSTR FilePath
  389. );
  390. PSTR
  391. GetAnsiMuiSafeFilename(
  392. IN PCTSTR FilePath
  393. );
  394. BOOL
  395. pSetupAppendPath(
  396. IN PCTSTR Path1,
  397. IN PCTSTR Path2,
  398. OUT PTSTR* Combined
  399. );
  400. BOOL
  401. pSetupApplyExtension(
  402. IN PCTSTR Original,
  403. IN PCTSTR Extension,
  404. OUT PTSTR* NewName
  405. );
  406. //
  407. // Resource/string retrieval routines in resource.c
  408. //
  409. VOID
  410. SetDlgText(
  411. IN HWND hwndDlg,
  412. IN INT iControl,
  413. IN UINT nStartString,
  414. IN UINT nEndString
  415. );
  416. #define SDT_MAX_TEXT 1000 // Max SetDlgText() combined text size
  417. PTSTR
  418. MyLoadString(
  419. IN UINT StringId
  420. );
  421. PTSTR
  422. FormatStringMessage(
  423. IN UINT FormatStringId,
  424. ...
  425. );
  426. PTSTR
  427. FormatStringMessageV(
  428. IN UINT FormatStringId,
  429. IN va_list *ArgumentList
  430. );
  431. PTSTR
  432. FormatStringMessageFromString(
  433. IN PTSTR FormatString,
  434. ...
  435. );
  436. PTSTR
  437. FormatStringMessageFromStringV(
  438. IN PTSTR FormatString,
  439. IN va_list *ArgumentList
  440. );
  441. PTSTR
  442. RetreiveAndFormatMessage(
  443. IN UINT MessageId,
  444. ...
  445. );
  446. PTSTR
  447. RetreiveAndFormatMessageV(
  448. IN UINT MessageId,
  449. IN va_list *ArgumentList
  450. );
  451. INT
  452. FormatMessageBox(
  453. IN HANDLE hinst,
  454. IN HWND hwndParent,
  455. IN UINT TextMessageId,
  456. IN PCTSTR Title,
  457. IN UINT Style,
  458. ...
  459. );
  460. //
  461. // This is in shell32.dll and in windows\inc16\shlsemip.h but
  462. // that file cannot be #include'd here as it has macros that clash
  463. // with our own, etc.
  464. //
  465. #ifdef ANSI_SETUPAPI
  466. //
  467. // Win9x - does not have RestartDialogEx
  468. //
  469. #define RestartDialogEx(hwnd,Prompt,Return,ReasonCode) RestartDialog(hwnd,Prompt,Return)
  470. #endif
  471. //
  472. // Decompression/filename manupilation routines in decomp.c.
  473. //
  474. PTSTR
  475. SetupGenerateCompressedName(
  476. IN PCTSTR Filename
  477. );
  478. DWORD
  479. SetupInternalGetFileCompressionInfo(
  480. IN PCTSTR SourceFileName,
  481. OUT PTSTR *ActualSourceFileName,
  482. OUT PWIN32_FIND_DATA SourceFindData,
  483. OUT PDWORD TargetFileSize,
  484. OUT PUINT CompressionType
  485. );
  486. DWORD
  487. SetupDetermineSourceFileName(
  488. IN PCTSTR FileName,
  489. OUT PBOOL UsedCompressedName,
  490. OUT PTSTR *FileNameLocated,
  491. OUT PWIN32_FIND_DATA FindData
  492. );
  493. BOOL
  494. pSetupDoesFileMatch(
  495. IN PCTSTR InputName,
  496. IN PCTSTR CompareName,
  497. OUT PBOOL UsedCompressedName,
  498. OUT PTSTR *FileNameLocated
  499. );
  500. //
  501. // Diamond functions. The Process and Thread Attach routines are called
  502. // by the DLL entry point routine and should not be called by anyone else.
  503. //
  504. BOOL
  505. DiamondProcessAttach(
  506. IN BOOL Attach
  507. );
  508. BOOL
  509. DiamondTlsInit(
  510. IN BOOL Init
  511. );
  512. BOOL
  513. DiamondIsCabinet(
  514. IN PCTSTR FileName
  515. );
  516. DWORD
  517. DiamondProcessCabinet(
  518. IN PCTSTR CabinetFile,
  519. IN DWORD Flags,
  520. IN PVOID MsgHandler,
  521. IN PVOID Context,
  522. IN BOOL IsUnicodeMsgHandler
  523. );
  524. //
  525. // Misc routines
  526. //
  527. BOOL
  528. IsInteractiveWindowStation(
  529. VOID
  530. );
  531. VOID
  532. DiskPromptGetDriveType(
  533. IN PCTSTR PathToSource,
  534. OUT PUINT DriveType,
  535. OUT PBOOL IsRemovable
  536. );
  537. BOOL
  538. SetTruncatedDlgItemText(
  539. HWND hdlg,
  540. UINT CtlId,
  541. PCTSTR TextIn
  542. );
  543. LPTSTR
  544. CompactFileName(
  545. LPCTSTR FileNameIn,
  546. DWORD CharsToRemove
  547. );
  548. DWORD
  549. ExtraChars(
  550. HWND hwnd,
  551. LPCTSTR TextBuffer
  552. );
  553. VOID
  554. pSetupInitPlatformPathOverrideSupport(
  555. IN BOOL Init
  556. );
  557. VOID
  558. pSetupInitSourceListSupport(
  559. IN BOOL Init
  560. );
  561. DWORD
  562. pSetupDecompressOrCopyFile(
  563. IN PCTSTR SourceFileName,
  564. IN PCTSTR TargetFileName,
  565. IN PUINT CompressionType, OPTIONAL
  566. IN BOOL AllowMove,
  567. OUT PBOOL Moved OPTIONAL
  568. );
  569. BOOL
  570. _SetupInstallFileEx(
  571. IN PSP_FILE_QUEUE Queue, OPTIONAL
  572. IN PSP_FILE_QUEUE_NODE QueueNode, OPTIONAL
  573. IN HINF InfHandle, OPTIONAL
  574. IN PINFCONTEXT InfContext, OPTIONAL
  575. IN PCTSTR SourceFile, OPTIONAL
  576. IN PCTSTR SourcePathRoot, OPTIONAL
  577. IN PCTSTR DestinationName, OPTIONAL
  578. IN DWORD CopyStyle,
  579. IN PVOID CopyMsgHandler, OPTIONAL
  580. IN PVOID Context, OPTIONAL
  581. OUT PBOOL FileWasInUse,
  582. IN BOOL IsMsgHandlerNativeCharWidth,
  583. OUT PBOOL SignatureVerifyFailed
  584. );
  585. VOID
  586. pSetupFreeVerifyContextMembers(
  587. IN PVERIFY_CONTEXT VerifyContext
  588. );
  589. //
  590. // Define flags for _SetupCopyOEMInf
  591. //
  592. #define SCOI_NO_UI_ON_SIGFAIL 0x00000001
  593. #define SCOI_NO_ERRLOG_ON_MISSING_CATALOG 0x00000002
  594. #define SCOI_NO_ERRLOG_IF_INF_ALREADY_PRESENT 0x00000004
  595. #define SCOI_KEEP_INF_AND_CAT_ORIGINAL_NAMES 0x00000008 // for exception INFs
  596. #define SCOI_ABORT_IF_UNSIGNED 0x00000010
  597. #define SCOI_TRY_UPDATE_PNF 0x00000020 // not fatal if PNF
  598. // present and in use
  599. BOOL
  600. _SetupCopyOEMInf(
  601. IN PCTSTR SourceInfFileName,
  602. IN PCTSTR OEMSourceMediaLocation, OPTIONAL
  603. IN DWORD OEMSourceMediaType,
  604. IN DWORD CopyStyle,
  605. OUT PTSTR DestinationInfFileName, OPTIONAL
  606. IN DWORD DestinationInfFileNameSize,
  607. OUT PDWORD RequiredSize, OPTIONAL
  608. OUT PTSTR *DestinationInfFileNameComponent, OPTIONAL
  609. IN PCTSTR SourceInfOriginalName,
  610. IN PCTSTR SourceInfCatalogName, OPTIONAL
  611. IN HWND Owner,
  612. IN PCTSTR DeviceDesc, OPTIONAL
  613. IN DWORD DriverSigningPolicy,
  614. IN DWORD Flags,
  615. IN PCTSTR AltCatalogFile, OPTIONAL
  616. IN PSP_ALTPLATFORM_INFO_V2 AltPlatformInfo, OPTIONAL
  617. OUT PDWORD DriverSigningError, OPTIONAL
  618. OUT PTSTR CatalogFilenameOnSystem,
  619. IN PSETUP_LOG_CONTEXT LogContext,
  620. IN OUT PVERIFY_CONTEXT VerifyContext, OPTIONAL
  621. OUT HANDLE *hWVTStateData OPTIONAL
  622. );
  623. DWORD
  624. pSetupUninstallCatalog(
  625. IN LPCTSTR CatalogFilename
  626. );
  627. VOID
  628. pSetupUninstallOEMInf(
  629. IN LPCTSTR InfFullPath,
  630. IN PSETUP_LOG_CONTEXT LogContext, OPTIONAL
  631. IN DWORD Flags,
  632. OUT PDWORD InfDeleteErr OPTIONAL
  633. );
  634. PTSTR
  635. AllocAndReturnDriverSearchList(
  636. IN DWORD SearchControl
  637. );
  638. pSetupGetSecurityInfo(
  639. IN HINF Inf,
  640. IN PCTSTR SectionName,
  641. OUT PCTSTR *SecDesc );
  642. BOOL
  643. pSetupGetDriverDate(
  644. IN HINF InfHandle,
  645. IN PCTSTR Section,
  646. IN OUT PFILETIME pFileTime
  647. );
  648. BOOL
  649. pSetupGetDriverVersion(
  650. IN HINF InfHandle,
  651. IN PCTSTR Section,
  652. OUT DWORDLONG *Version
  653. );
  654. PTSTR
  655. GetMultiSzFromInf(
  656. IN HINF InfHandle,
  657. IN PCTSTR SectionName,
  658. IN PCTSTR Key,
  659. OUT PBOOL pSetupOutOfMemory
  660. );
  661. VOID
  662. pSetupInitNetConnectionList(
  663. IN BOOL Init
  664. );
  665. BOOL
  666. _SetupGetSourceFileSize(
  667. IN HINF InfHandle,
  668. IN PINFCONTEXT InfContext, OPTIONAL
  669. IN PCTSTR FileName, OPTIONAL
  670. IN PCTSTR Section, OPTIONAL
  671. IN PSP_ALTPLATFORM_INFO_V2 AltPlatformInfo, OPTIONAL
  672. OUT PDWORD FileSize,
  673. IN UINT RoundingFactor OPTIONAL
  674. );
  675. BOOL
  676. _SetupGetSourceFileLocation(
  677. IN HINF InfHandle,
  678. IN PINFCONTEXT InfContext, OPTIONAL
  679. IN PCTSTR FileName, OPTIONAL
  680. IN PSP_ALTPLATFORM_INFO_V2 AltPlatformInfo, OPTIONAL
  681. OUT PUINT SourceId, OPTIONAL
  682. OUT PTSTR ReturnBuffer, OPTIONAL
  683. IN DWORD ReturnBufferSize,
  684. OUT PDWORD RequiredSize, OPTIONAL
  685. OUT PINFCONTEXT LineContext OPTIONAL
  686. );
  687. DWORD
  688. pSetupLogSectionError(
  689. IN HINF InfHandle, OPTIONAL
  690. IN HDEVINFO DeviceInfoSet, OPTIONAL
  691. IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL
  692. IN PSP_FILE_QUEUE Queue, OPTIONAL
  693. IN PCTSTR SectionName,
  694. IN DWORD MsgID,
  695. IN DWORD Err,
  696. IN PCTSTR KeyName OPTIONAL
  697. );
  698. DWORD
  699. pSetupLogSectionWarning(
  700. IN HINF InfHandle, OPTIONAL
  701. IN HDEVINFO DeviceInfoSet, OPTIONAL
  702. IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL
  703. IN PSP_FILE_QUEUE Queue, OPTIONAL
  704. IN PCTSTR SectionName,
  705. IN DWORD MsgID,
  706. IN DWORD Err,
  707. IN PCTSTR KeyName OPTIONAL
  708. );
  709. DWORD
  710. pSetupCopyRelatedInfs(
  711. IN HINF hDeviceInf,
  712. IN PCTSTR InfFileName, OPTIONAL
  713. IN PCTSTR InfSectionName,
  714. IN DWORD OEMSourceMediaType,
  715. IN PSETUP_LOG_CONTEXT LogContext OPTIONAL
  716. );
  717. BOOL
  718. pCompareFilesExact(
  719. IN PCTSTR File1,
  720. IN PCTSTR File2
  721. );
  722. //
  723. // Routine to call out to a PSP_FILE_CALLBACK, handles
  724. // Unicode<-->ANSI issues
  725. //
  726. UINT
  727. pSetupCallMsgHandler(
  728. IN PSETUP_LOG_CONTEXT LogContext,
  729. IN PVOID MsgHandler,
  730. IN BOOL MsgHandlerIsNativeCharWidth,
  731. IN PVOID Context,
  732. IN UINT Notification,
  733. IN UINT_PTR Param1,
  734. IN UINT_PTR Param2
  735. );
  736. UINT
  737. pSetupCallDefaultMsgHandler(
  738. IN PVOID Context,
  739. IN UINT Notification,
  740. IN UINT_PTR Param1,
  741. IN UINT_PTR Param2
  742. );
  743. //
  744. // Internal routine to get MRU list.
  745. //
  746. DWORD
  747. pSetupGetList(
  748. IN DWORD Flags,
  749. OUT PCTSTR **List,
  750. OUT PUINT Count,
  751. OUT PBOOL NoBrowse
  752. );
  753. #define SRCPATH_USEPNFINFORMATION 0x00000001
  754. #define SRCPATH_USEINFLOCATION 0x00000002
  755. #define SRC_FLAGS_SVCPACK_SOURCE (0x0001)
  756. #define PSP_COPY_USE_DRIVERCACHE 0x80000000
  757. #define PSP_COPY_CHK_DRIVERCACHE 0x40000000
  758. //#define PSP_COPY_USE_SPCACHE 0x20000000 - moved to spapip.w
  759. PTSTR
  760. pSetupGetDefaultSourcePath(
  761. IN HINF InfHandle,
  762. IN DWORD Flags,
  763. OUT PDWORD InfSourceMediaType
  764. );
  765. VOID
  766. InfSourcePathFromFileName(
  767. IN PCTSTR InfFileName,
  768. OUT PTSTR *SourcePath, OPTIONAL
  769. OUT PBOOL TryPnf
  770. );
  771. BOOL
  772. pSetupGetSourceInfo(
  773. IN HINF InfHandle, OPTIONAL
  774. IN PINFCONTEXT LayoutLineContext, OPTIONAL
  775. IN UINT SourceId,
  776. IN PSP_ALTPLATFORM_INFO_V2 AltPlatformInfo, OPTIONAL
  777. IN UINT InfoDesired,
  778. OUT PTSTR ReturnBuffer, OPTIONAL
  779. IN DWORD ReturnBufferSize,
  780. OUT PDWORD RequiredSize OPTIONAL
  781. );
  782. //
  783. // function to get the apropriate return value for ReturnStatus, for specific callback Notification
  784. //
  785. UINT
  786. pGetCallbackErrorReturn(
  787. IN UINT Notification,
  788. IN DWORD ReturnStatus
  789. );
  790. //
  791. // Routines for creating/destroying global mini-icon list.
  792. //
  793. BOOL
  794. CreateMiniIcons(
  795. VOID
  796. );
  797. VOID
  798. DestroyMiniIcons(
  799. VOID
  800. );
  801. //
  802. // Global log init/terminate
  803. //
  804. VOID
  805. InitLogApi (
  806. VOID
  807. );
  808. VOID
  809. TerminateLogApi (
  810. VOID
  811. );
  812. //
  813. // DIRID mapping routines.
  814. //
  815. PCTSTR
  816. pSetupVolatileDirIdToPath(
  817. IN PCTSTR DirectoryId, OPTIONAL
  818. IN UINT DirectoryIdInt, OPTIONAL
  819. IN PCTSTR SubDirectory, OPTIONAL
  820. IN PLOADED_INF Inf
  821. );
  822. DWORD
  823. ApplyNewVolatileDirIdsToInfs(
  824. IN PLOADED_INF MasterInf,
  825. IN PLOADED_INF Inf OPTIONAL
  826. );
  827. PCTSTR
  828. pSetupDirectoryIdToPathEx(
  829. IN PCTSTR DirectoryId, OPTIONAL
  830. IN OUT PUINT DirectoryIdInt, OPTIONAL
  831. IN PCTSTR SubDirectory, OPTIONAL
  832. IN PCTSTR InfSourcePath, OPTIONAL
  833. IN OUT PCTSTR *OsLoaderPath, OPTIONAL
  834. OUT PBOOL VolatileSystemDirId OPTIONAL
  835. );
  836. PCTSTR
  837. pGetPathFromDirId(
  838. IN PCTSTR DirectoryId,
  839. IN PCTSTR SubDirectory, OPTIONAL
  840. IN PLOADED_INF pLoadedInf
  841. );
  842. //
  843. // routines for inter-thread communication
  844. //
  845. #ifndef UNICODE
  846. #define MyMsgWaitForMultipleObjectsEx(nc,ph,dwms,dwwm,dwfl) MsgWaitForMultipleObjects(nc,ph,FALSE,dwms,dwwm)
  847. #else
  848. #define MyMsgWaitForMultipleObjectsEx MsgWaitForMultipleObjectsEx
  849. #endif
  850. //
  851. // Macro to make ansi vs unicode string handling
  852. // a little easier
  853. //
  854. #ifdef UNICODE
  855. #define NewAnsiString(x) pSetupUnicodeToAnsi(x)
  856. #define NewPortableString(x) pSetupAnsiToUnicode(x)
  857. #else
  858. #define NewAnsiString(x) DuplicateString(x)
  859. #define NewPortableString(x) DuplicateString(x)
  860. #endif
  861. //
  862. // Internal file-handling routines in fileutil.c
  863. //
  864. DWORD
  865. MapFileForRead(
  866. IN HANDLE FileHandle,
  867. OUT PDWORD FileSize,
  868. OUT PHANDLE MappingHandle,
  869. OUT PVOID *BaseAddress
  870. );
  871. BOOL
  872. DoMove(
  873. IN PCTSTR CurrentName,
  874. IN PCTSTR NewName
  875. );
  876. BOOL
  877. DelayedMove(
  878. IN PCTSTR CurrentName,
  879. IN PCTSTR NewName OPTIONAL
  880. );
  881. extern GUID DriverVerifyGuid;
  882. //
  883. // Flags for VerifySourceFile and _VerifyFile
  884. //
  885. #define VERIFY_FILE_IGNORE_SELFSIGNED 0x00000001
  886. #define VERIFY_FILE_USE_OEM_CATALOGS 0x00000002
  887. #define VERIFY_FILE_USE_AUTHENTICODE_CATALOG 0x00000004
  888. #define VERIFY_FILE_DRIVERBLOCKED_ONLY 0x00000008
  889. #define VERIFY_FILE_NO_DRIVERBLOCKED_CHECK 0x00000010
  890. DWORD
  891. _VerifyFile(
  892. IN PSETUP_LOG_CONTEXT LogContext,
  893. IN OUT PVERIFY_CONTEXT VerifyContext, OPTIONAL
  894. IN LPCTSTR Catalog, OPTIONAL
  895. IN PVOID CatalogBaseAddress, OPTIONAL
  896. IN DWORD CatalogImageSize,
  897. IN LPCTSTR Key,
  898. IN LPCTSTR FileFullPath,
  899. OUT SetupapiVerifyProblem *Problem, OPTIONAL
  900. OUT LPTSTR ProblemFile, OPTIONAL
  901. IN BOOL CatalogAlreadyVerified,
  902. IN PSP_ALTPLATFORM_INFO_V2 AltPlatformInfo, OPTIONAL
  903. IN DWORD Flags, OPTIONAL
  904. OUT LPTSTR CatalogFileUsed, OPTIONAL
  905. OUT PDWORD NumCatalogsConsidered, OPTIONAL
  906. OUT LPTSTR DigitalSigner, OPTIONAL
  907. OUT LPTSTR SignerVersion, OPTIONAL
  908. OUT HANDLE *hWVTStateData OPTIONAL
  909. );
  910. DWORD
  911. VerifySourceFile(
  912. IN PSETUP_LOG_CONTEXT LogContext,
  913. IN PSP_FILE_QUEUE Queue, OPTIONAL
  914. IN PSP_FILE_QUEUE_NODE QueueNode, OPTIONAL
  915. IN PCTSTR Key,
  916. IN PCTSTR FileToVerifyFullPath,
  917. IN PCTSTR OriginalSourceFileFullPath, OPTIONAL
  918. IN PSP_ALTPLATFORM_INFO_V2 AltPlatformInfo, OPTIONAL
  919. IN DWORD Flags,
  920. OUT SetupapiVerifyProblem *Problem,
  921. OUT LPTSTR ProblemFile,
  922. OUT LPTSTR CatalogFileUsed, OPTIONAL
  923. OUT LPTSTR DigitalSigner, OPTIONAL
  924. OUT LPTSTR SignerVersion, OPTIONAL
  925. OUT HANDLE *hWVTStateData OPTIONAL
  926. );
  927. //
  928. // Flags for VerifyDeviceInfFile
  929. //
  930. #define VERIFY_INF_USE_AUTHENTICODE_CATALOG 0x00000004 // same as for _VerifyFile
  931. DWORD
  932. VerifyDeviceInfFile(
  933. IN PSETUP_LOG_CONTEXT LogContext,
  934. IN OUT PVERIFY_CONTEXT VerifyContext, OPTIONAL
  935. IN LPCTSTR CurrentInfName,
  936. IN PLOADED_INF pInf,
  937. IN PSP_ALTPLATFORM_INFO_V2 AltPlatformInfo, OPTIONAL
  938. OUT LPTSTR CatalogFileUsed, OPTIONAL
  939. OUT LPTSTR DigitalSigner, OPTIONAL
  940. OUT LPTSTR SignerVersion, OPTIONAL
  941. IN DWORD Flags,
  942. OUT HANDLE *hWVTStateData OPTIONAL
  943. );
  944. BOOL
  945. _HandleFailedVerification(
  946. IN HWND Owner,
  947. IN SetupapiVerifyProblem Problem,
  948. IN LPCTSTR ProblemFile,
  949. IN LPCTSTR DeviceDesc, OPTIONAL
  950. IN DWORD DriverSigningPolicy,
  951. IN BOOL NoUI,
  952. IN DWORD Error,
  953. IN PVOID LogContext, OPTIONAL
  954. OUT PDWORD Flags, OPTIONAL
  955. IN LPCTSTR TargetFile, OPTIONAL
  956. IN HANDLE hWUTStateData OPTIONAL
  957. );
  958. VOID
  959. pSetupCloseWVTStateData(
  960. IN HANDLE hWVTStateData
  961. );
  962. BOOL
  963. IsInfForDeviceInstall(
  964. IN PSETUP_LOG_CONTEXT LogContext, OPTIONAL
  965. IN CONST GUID *DeviceSetupClassGuid, OPTIONAL
  966. IN PLOADED_INF LoadedInf, OPTIONAL
  967. OUT PTSTR *DeviceDesc, OPTIONAL
  968. OUT PSP_ALTPLATFORM_INFO_V2 *ValidationPlatform, OPTIONAL
  969. OUT PDWORD PolicyToUse, OPTIONAL
  970. OUT PBOOL UseOriginalInfName, OPTIONAL
  971. IN BOOL ForceNonDrvSignPolicy
  972. );
  973. DWORD
  974. GetCodeSigningPolicyForInf(
  975. IN PSETUP_LOG_CONTEXT LogContext, OPTIONAL
  976. IN HINF InfHandle,
  977. OUT PSP_ALTPLATFORM_INFO_V2 *ValidationPlatform, OPTIONAL
  978. OUT PBOOL UseOriginalInfName OPTIONAL
  979. );
  980. typedef struct _DRVSIGN_CLASS_LIST_NODE {
  981. GUID DeviceSetupClassGuid; // class subject to driver signing policy
  982. INT MajorVerLB; // -1 if no validation platform override info
  983. INT MinorVerLB; // -1 if no validation platform override info
  984. } DRVSIGN_CLASS_LIST_NODE, *PDRVSIGN_CLASS_LIST_NODE;
  985. typedef struct _DRVSIGN_POLICY_LIST {
  986. //
  987. // Array of device setup class GUIDs for which driver signing policy is
  988. // applicable, along with validation platform override information (if
  989. // appropriate).
  990. //
  991. PDRVSIGN_CLASS_LIST_NODE Members;
  992. //
  993. // Number of elements in above array (initialized to -1).
  994. //
  995. INT NumMembers;
  996. //
  997. // Synchronization
  998. //
  999. MYLOCK Lock;
  1000. } DRVSIGN_POLICY_LIST, *PDRVSIGN_POLICY_LIST;
  1001. #define LockDrvSignPolicyList(d) BeginSynchronizedAccess(&((d)->Lock))
  1002. #define UnlockDrvSignPolicyList(d) EndSynchronizedAccess(&((d)->Lock))
  1003. //
  1004. // Global "Driver Search In-Progress" list.
  1005. //
  1006. extern DRVSIGN_POLICY_LIST GlobalDrvSignPolicyList;
  1007. BOOL
  1008. InitDrvSignPolicyList(
  1009. VOID
  1010. );
  1011. VOID
  1012. DestroyDrvSignPolicyList(
  1013. VOID
  1014. );
  1015. //
  1016. // Bit that may be OR'ed in with driver signing policy to indicate that
  1017. // Authenticode signatures may be accepted.
  1018. //
  1019. #define DRIVERSIGN_ALLOW_AUTHENTICODE 0x80000000
  1020. BOOL
  1021. IsFileProtected(
  1022. IN LPCTSTR FileFullPath,
  1023. IN PSETUP_LOG_CONTEXT LogContext, OPTIONAL
  1024. OUT PHANDLE phSfp OPTIONAL
  1025. );
  1026. #define FileExists pSetupFileExists
  1027. BOOL
  1028. GetVersionInfoFromImage(
  1029. IN PCTSTR FileName,
  1030. OUT PDWORDLONG Version,
  1031. OUT LANGID *Language
  1032. );
  1033. //
  1034. // Utils
  1035. //
  1036. PCTSTR
  1037. GetSystemSourcePath(
  1038. TRACK_ARG_DECLARE
  1039. );
  1040. PCTSTR
  1041. GetServicePackSourcePath(
  1042. TRACK_ARG_DECLARE
  1043. );
  1044. PCTSTR
  1045. GetServicePackCachePath(
  1046. TRACK_ARG_DECLARE
  1047. );
  1048. DWORD
  1049. RegistryDelnode(
  1050. IN HKEY RootKey,
  1051. IN PCTSTR SubKeyName,
  1052. IN DWORD ExtraFlags
  1053. );
  1054. DWORD
  1055. CaptureStringArg(
  1056. IN PCTSTR String,
  1057. OUT PCTSTR *CapturedString
  1058. );
  1059. DWORD
  1060. DelimStringToMultiSz(
  1061. IN PTSTR String,
  1062. IN DWORD StringLen,
  1063. IN TCHAR Delim
  1064. );
  1065. BOOL
  1066. pAToI(
  1067. IN PCTSTR Field,
  1068. OUT PINT IntegerValue
  1069. );
  1070. DWORD
  1071. pAcquireSCMLock(
  1072. IN SC_HANDLE SCMHandle,
  1073. OUT SC_LOCK *pSCMLock,
  1074. IN PSETUP_LOG_CONTEXT LogContext
  1075. );
  1076. //
  1077. // wrapper around pSetupStringTableStringFromIdEx to allocate buffer on fly
  1078. //
  1079. DWORD
  1080. QueryStringTableStringFromId(
  1081. IN PVOID StringTable,
  1082. IN LONG StringId,
  1083. IN ULONG Padding,
  1084. OUT PTSTR *pBuffer
  1085. );
  1086. VOID
  1087. pSetupExceptionHandler(
  1088. IN DWORD ExceptionCode,
  1089. IN DWORD AccessViolationError,
  1090. OUT PDWORD Win32ErrorCode OPTIONAL
  1091. );
  1092. LONG
  1093. pSetupExceptionFilter(
  1094. DWORD ExceptionCode
  1095. );
  1096. //
  1097. // Define flags for DoInstallActionWithParams
  1098. //
  1099. #define INSTALLACTION_CALL_CI 0x00000001
  1100. #define INSTALLACTION_NO_DEFAULT 0x00000002
  1101. DWORD
  1102. DoInstallActionWithParams(
  1103. IN DI_FUNCTION InstallFunction,
  1104. IN HDEVINFO DeviceInfoSet,
  1105. IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL
  1106. IN PSP_CLASSINSTALL_HEADER ClassInstallParams, OPTIONAL
  1107. IN DWORD ClassInstallParamsSize,
  1108. IN DWORD Flags
  1109. );
  1110. BOOL
  1111. LookUpStringInTable(
  1112. IN PSTRING_TO_DATA Table,
  1113. IN PCTSTR String,
  1114. OUT PUINT_PTR Data
  1115. );
  1116. //
  1117. // Diagnostic/debug functions in debug.c
  1118. //
  1119. #define DebugPrintEx pSetupDebugPrintEx
  1120. #if DBG
  1121. #define MYTRACE(x) DebugPrintEx x /*(...)*/
  1122. #else
  1123. #define MYTRACE(x)
  1124. #endif
  1125. //
  1126. // Allow assertion checking to be turned on independently
  1127. // of DBG, like by specifying C_DEFINES=-DASSERTS_ON=1 in sources file.
  1128. //
  1129. #ifndef ASSERTS_ON
  1130. #if DBG
  1131. #define ASSERTS_ON 1
  1132. #else
  1133. #define ASSERTS_ON 0
  1134. #endif
  1135. #endif
  1136. #ifdef _X86_
  1137. BOOL
  1138. IsNEC98(
  1139. VOID
  1140. );
  1141. #endif
  1142. //
  1143. // Stubs to allow ANSI build to run on Win9x
  1144. //
  1145. #ifdef DBGHEAP_CHECK
  1146. #ifdef ANSI_SETUPAPI
  1147. #define ASSERT_HEAP_IS_VALID()
  1148. #else
  1149. #define ASSERT_HEAP_IS_VALID() RtlValidateHeap(pSetupGetHeap(),0,NULL)
  1150. #endif // ANSI_SETUPAPI
  1151. #else
  1152. #define ASSERT_HEAP_IS_VALID()
  1153. #endif // DBGHEAP_CHECK
  1154. //
  1155. // TLS data/macro's
  1156. //
  1157. //
  1158. // Diamond TLS data.
  1159. //
  1160. typedef struct _DIAMOND_THREAD_DATA {
  1161. //
  1162. // Boolean value indicating whether the current thread
  1163. // is inside diamond. Diamond doesn't really providee
  1164. // a full context environment so we declare it non-reentrant.
  1165. //
  1166. BOOL InDiamond;
  1167. //
  1168. // Diamond context data
  1169. //
  1170. HFDI FdiContext;
  1171. ERF FdiError;
  1172. //
  1173. // Last encountered error
  1174. //
  1175. DWORD LastError;
  1176. //
  1177. // Name of cabinet as passed to DiamondProcessCabinet,
  1178. //
  1179. PCTSTR CabinetFile;
  1180. //
  1181. // Notification callback and context parameter
  1182. //
  1183. PVOID MsgHandler;
  1184. PVOID Context;
  1185. BOOL IsMsgHandlerNativeCharWidth;
  1186. //
  1187. // Full path of the current target file being extracted.
  1188. //
  1189. PTSTR CurrentTargetFile;
  1190. //
  1191. // Flag indicating whether diamond asked us to switch cabinets.
  1192. // If we do switch, then we stop copying when the current file
  1193. // is done. This prevents diamond from happily doing each file
  1194. // in the new cabinet, which would ruin the queue commit routine's
  1195. // ability to allow some files to exist outside the cabinet, etc.
  1196. //
  1197. BOOL SwitchedCabinets;
  1198. //
  1199. // If the source path changes as the result of a prompt for a
  1200. // new cabinet (when a file continues across multiple cabinets),
  1201. // we remember the path the user gave us here.
  1202. //
  1203. TCHAR UserPath[MAX_PATH];
  1204. } DIAMOND_THREAD_DATA, *PDIAMOND_THREAD_DATA;
  1205. typedef struct _SETUP_TLS {
  1206. struct _SETUP_TLS *Prev;
  1207. struct _SETUP_TLS *Next;
  1208. //
  1209. // all TLS data used by SetupAPI
  1210. //
  1211. DIAMOND_THREAD_DATA Diamond;
  1212. SETUP_LOG_TLS SetupLog;
  1213. DWORD PerThreadDoneComponent;
  1214. DWORD PerThreadFailedComponent;
  1215. } SETUP_TLS, *PSETUP_TLS;
  1216. PSETUP_TLS
  1217. SetupGetTlsData(
  1218. );
  1219. //
  1220. // Registration flags.
  1221. //
  1222. #define SP_GETSTATUS_FROMDLL 0x00000001 // in proc dll registration
  1223. #define SP_GETSTATUS_FROMPROCESS 0x00000002 // executable registration
  1224. #define SP_GETSTATUS_FROMSURRAGATE 0x00000004 // surragate process dll registration
  1225. #if MEM_DBG
  1226. //
  1227. // these have to be at the bottom to compile
  1228. //
  1229. #define GetSystemSourcePath() GetSystemSourcePath(TRACK_ARG_CALL)
  1230. #define GetServicePackSourcePath() GetServicePackSourcePath(TRACK_ARG_CALL)
  1231. #define GetServicePackCachePath() GetServicePackCachePath(TRACK_ARG_CALL)
  1232. #define InheritLogContext(a,b) InheritLogContext(TRACK_ARG_CALL,a,b)
  1233. #endif
  1234. BOOL
  1235. InitComponents(
  1236. DWORD Components
  1237. );
  1238. VOID
  1239. ComponentCleanup(
  1240. DWORD Components
  1241. );
  1242. //#define COMPONENT_OLE 0x00000001 // need to use OLE
  1243. //#define COMPONENT_FUSION 0x00000002 // need to use Fusion
  1244. //
  1245. // RetrieveAllDriversForDevice flags
  1246. //
  1247. #define RADFD_FLAG_FUNCTION_DRIVER 0x00000001
  1248. #define RADFD_FLAG_DEVICE_UPPER_FILTERS 0x00000002
  1249. #define RADFD_FLAG_DEVICE_LOWER_FILTERS 0x00000004
  1250. #define RADFD_FLAG_CLASS_UPPER_FILTERS 0x00000008
  1251. #define RADFD_FLAG_CLASS_LOWER_FILTERS 0x00000010
  1252. #define RADFD_FLAG_DEVICE_FILTERS RADFD_FLAG_DEVICE_UPPER_FILTERS | RADFD_FLAG_DEVICE_LOWER_FILTERS
  1253. #define RADFD_FLAG_CLASS_FILTERS RADFD_FLAG_CLASS_UPPER_FILTERS | RADFD_FLAG_CLASS_LOWER_FILTERS
  1254. #define RADFD_FLAG_ALL_FILTERS RADFD_FLAG_DEVICE_FILTERS | RADFD_FLAG_CLASS_FILTERS
  1255. BOOL
  1256. RetrieveAllDriversForDevice(
  1257. IN PDEVINFO_ELEM DevInfoElem,
  1258. OUT PTSTR *FilterDrivers,
  1259. IN DWORD Flags,
  1260. IN HMACHINE hMachine
  1261. );
  1262. VOID
  1263. pGetVersionText(
  1264. OUT PTSTR VersionText,
  1265. IN DWORDLONG Version
  1266. );