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.

761 lines
24 KiB

  1. //
  2. // DEVNODE.C
  3. //
  4. #include "sigverif.h"
  5. #include <initguid.h>
  6. #include <devguid.h>
  7. //
  8. // Given the full path to a driver, add it to the file list.
  9. //
  10. LPFILENODE
  11. AddDriverFileToList(
  12. LPTSTR lpDirName,
  13. LPTSTR lpFullPathName
  14. )
  15. {
  16. LPFILENODE lpFileNode = NULL;
  17. TCHAR szFullPath[MAX_PATH];
  18. TCHAR szDirName[MAX_PATH];
  19. TCHAR szFileName[MAX_PATH];
  20. LPTSTR lpFilePart;
  21. BOOL bRet;
  22. *szFullPath = 0;
  23. *szDirName = 0;
  24. *szFileName = 0;
  25. //
  26. // If no directory is passed in, try to get the full path
  27. //
  28. if (!lpDirName || !*lpDirName) {
  29. bRet = GetFullPathName(lpFullPathName, MAX_PATH, szDirName, &lpFilePart);
  30. if (bRet) {
  31. lstrcpy(szFullPath, szDirName);
  32. if (lpFilePart && *lpFilePart) {
  33. lstrcpy(szFileName, lpFilePart);
  34. *lpFilePart = 0;
  35. if (lstrlen(szDirName) > 3) {
  36. *(lpFilePart - 1) = 0;
  37. }
  38. }
  39. }
  40. } else {
  41. //
  42. // Use the directory and filename that was passed in to us
  43. // Expand out lpDirName in case there are any ".." entries
  44. //
  45. if (!GetFullPathName(lpDirName, MAX_PATH, szDirName, NULL)) {
  46. lstrcpy(szDirName, lpDirName);
  47. }
  48. lstrcpy(szFileName, lpFullPathName);
  49. }
  50. if (*szDirName && *szFileName && !IsFileAlreadyInList(szDirName, szFileName)) {
  51. //
  52. // Create a filenode, based on the directory and filename
  53. //
  54. lpFileNode = CreateFileNode(szDirName, szFileName);
  55. if (lpFileNode) {
  56. InsertFileNodeIntoList(lpFileNode);
  57. // Increment the total number of files we've found that meet the search criteria.
  58. g_App.dwFiles++;
  59. }
  60. }
  61. return lpFileNode;
  62. }
  63. void
  64. GetFilesFromInfSection(
  65. HINF hInf,
  66. LPTSTR lpFileName,
  67. LPTSTR lpSectionName
  68. )
  69. {
  70. TCHAR szTarget[MAX_PATH];
  71. TCHAR szBuffer[MAX_PATH];
  72. LPTSTR lpBuffer;
  73. LPTSTR lpString, lpSeparator;
  74. BOOL bRet;
  75. DWORD dwRequiredSize;
  76. INFCONTEXT iContext;
  77. ZeroMemory(szTarget, sizeof(szTarget));
  78. SetupGetTargetPath(hInf, NULL, lpSectionName, szTarget, sizeof(szTarget), NULL);
  79. // HYDRA HACK!!!
  80. //
  81. // Check to see if the target is %WINDIR% and if %WINDIR% has been redirected, change it back!!
  82. // We have the real %WINDIR% stored in g_App.szWinDir, so we can stuff that into szTarget.
  83. // We just have to remember to put back whatever was at the end of szTarget.
  84. //
  85. if (GetWindowsDirectory(szBuffer, MAX_PATH) &&
  86. !_tcsnicmp(szBuffer, szTarget, lstrlen(szBuffer)) &&
  87. _tcsicmp(g_App.szWinDir, szBuffer)) {
  88. lstrcpy(szBuffer, szTarget + lstrlen(szBuffer));
  89. lstrcpy(szTarget, g_App.szWinDir);
  90. lstrcat(szTarget, szBuffer);
  91. }
  92. ZeroMemory(&iContext, sizeof(INFCONTEXT));
  93. bRet = SetupFindFirstLine(hInf, lpSectionName, NULL, &iContext);
  94. while (bRet && !g_App.bStopScan) {
  95. dwRequiredSize = 0;
  96. bRet = SetupGetLineText(&iContext, NULL, NULL, NULL, NULL, 0, &dwRequiredSize);
  97. if (dwRequiredSize) {
  98. lpBuffer = MALLOC((dwRequiredSize + 1) * sizeof(TCHAR));
  99. if (lpBuffer) {
  100. bRet = SetupGetLineText(&iContext, NULL, NULL, NULL, lpBuffer, dwRequiredSize, NULL);
  101. if (bRet) {
  102. lpString = lpBuffer;
  103. if (lpString && *lpString) {
  104. // If there's a comma, then terminate the string at the comma
  105. lpSeparator = _tcschr(lpString, TEXT(','));
  106. if (lpSeparator) {
  107. // Null terminate at the comma, so the first entry is a null-terminated string
  108. *lpSeparator = 0;
  109. }
  110. // Make sure we didn't just terminate ourselves.
  111. if (*lpString) {
  112. AddDriverFileToList(szTarget, lpString);
  113. }
  114. }
  115. }
  116. FREE(lpBuffer);
  117. }
  118. }
  119. bRet = SetupFindNextLine(&iContext, &iContext);
  120. }
  121. }
  122. void
  123. GetStuffFromInfSection(
  124. LPTSTR lpFileName,
  125. LPTSTR lpSectionName
  126. )
  127. {
  128. TCHAR szFullPath[MAX_PATH];
  129. TCHAR szTarget[MAX_PATH];
  130. TCHAR szKeyName[MAX_PATH];
  131. LPTSTR lpString = NULL;
  132. LPTSTR lpSeparator = NULL;
  133. LPTSTR lpBuffer = NULL;
  134. DWORD dwRequiredSize;
  135. HINF hInf;
  136. BOOL bRet;
  137. UINT uError;
  138. szFullPath[0] = 0;
  139. GetFullPathName(lpFileName, MAX_PATH, szFullPath, NULL);
  140. //
  141. // Try opening the INF in the usual INF directory
  142. //
  143. hInf = SetupOpenInfFile(szFullPath, NULL, INF_STYLE_WIN4, &uError);
  144. if (hInf == INVALID_HANDLE_VALUE) {
  145. //
  146. // Add the INF to the file list so it shows up as unscanned.
  147. //
  148. AddDriverFileToList(NULL, lpFileName);
  149. return;
  150. } else {
  151. //
  152. // The INF must exist, so add it to the file list for verification!
  153. //
  154. AddDriverFileToList(NULL, szFullPath);
  155. }
  156. MyLoadString(szKeyName, IDS_COPYFILES);
  157. dwRequiredSize = 0;
  158. bRet = SetupGetLineText(NULL, hInf, lpSectionName, szKeyName, NULL, 0, &dwRequiredSize);
  159. if (dwRequiredSize) {
  160. lpBuffer = MALLOC((dwRequiredSize + 1) * sizeof(TCHAR));
  161. if (lpBuffer) {
  162. bRet = SetupGetLineText(NULL, hInf, lpSectionName, szKeyName, lpBuffer, dwRequiredSize, NULL);
  163. if (!bRet) {
  164. //MyMessageBox(TEXT("SetupGetLineText Failed!"));
  165. FREE(lpBuffer);
  166. return;
  167. }
  168. }
  169. lpString = lpBuffer;
  170. }
  171. ZeroMemory(szTarget, sizeof(szTarget));
  172. SetupGetTargetPath(hInf, NULL, lpSectionName, szTarget, sizeof(szTarget), NULL);
  173. while (lpString && *lpString && !g_App.bStopScan) {
  174. // If there's a comma, then bump lpSeparator to after the comma
  175. lpSeparator = _tcschr(lpString, TEXT(','));
  176. if (lpSeparator) {
  177. // Null terminate at the comma, so the first entry is a null-terminated string
  178. *lpSeparator = 0;
  179. lpSeparator++;
  180. }
  181. //
  182. // If the section has an '@' symbol, then it is directly referencing a filename
  183. // Otherwise, it's a section and we need to process that via GetFilesFromInfSection()
  184. //
  185. if (*lpString == TEXT('@')) {
  186. lpString++;
  187. if (*lpString) {
  188. AddDriverFileToList(szTarget, lpString);
  189. }
  190. } else GetFilesFromInfSection(hInf, lpFileName, lpString);
  191. lpString = lpSeparator;
  192. }
  193. if (lpBuffer) {
  194. FREE(lpBuffer);
  195. }
  196. SetupCloseInfFile(hInf);
  197. }
  198. UINT
  199. ScanQueueCallback(
  200. PVOID Context,
  201. UINT Notification,
  202. UINT_PTR Param1,
  203. UINT_PTR Param2
  204. )
  205. {
  206. LPFILENODE lpFileNode;
  207. TCHAR szBuffer[MAX_PATH];
  208. LPTSTR lpFilePart;
  209. if ((Notification == SPFILENOTIFY_QUEUESCAN_SIGNERINFO) &&
  210. Param1) {
  211. //
  212. // Special case for printers:
  213. // After setupapi copies files from the file queue into their destination
  214. // location, the printer class installer moves some of these files into
  215. // other 'special' locations. This can lead to the callback Win32Error
  216. // returning ERROR_FILE_NOT_FOUND or ERROR_PATH_NOT_FOUND since the file
  217. // is not present in the location where setupapi put it. So, we will
  218. // catch this case for printers and not add the file to our list of
  219. // files to scan. These 'special' printer files will get added later
  220. // when we call the spooler APIs.
  221. // Also note that we can't just skip getting the list of files for printers
  222. // altogether since the printer class installer only moves some of the
  223. // files that setupapi copies and not all of them.
  224. //
  225. if (Context &&
  226. (IsEqualGUID((LPGUID)Context, &GUID_DEVCLASS_PRINTER)) &&
  227. ((((PFILEPATHS_SIGNERINFO)Param1)->Win32Error == ERROR_FILE_NOT_FOUND) ||
  228. (((PFILEPATHS_SIGNERINFO)Param1)->Win32Error == ERROR_PATH_NOT_FOUND))) {
  229. //
  230. // Assume this was a file moved by the printer class installer. Don't
  231. // add it to the list of files to be scanned at this time.
  232. //
  233. return NO_ERROR;
  234. }
  235. lpFileNode = AddDriverFileToList(NULL,
  236. (LPTSTR)((PFILEPATHS_SIGNERINFO)Param1)->Target);
  237. //
  238. // Fill in some information into the FILENODE structure since we already
  239. // scanned the file.
  240. //
  241. if (lpFileNode) {
  242. lpFileNode->bScanned = TRUE;
  243. lpFileNode->bSigned = (((PFILEPATHS_SIGNERINFO)Param1)->Win32Error == NO_ERROR);
  244. if (lpFileNode->bSigned) {
  245. if (((PFILEPATHS_SIGNERINFO)Param1)->CatalogFile) {
  246. GetFullPathName(((PFILEPATHS_SIGNERINFO)Param1)->CatalogFile, MAX_PATH, szBuffer, &lpFilePart);
  247. lpFileNode->lpCatalog = MALLOC((lstrlen(lpFilePart) + 1) * sizeof(TCHAR));
  248. if (lpFileNode->lpCatalog) {
  249. lstrcpy(lpFileNode->lpCatalog, lpFilePart);
  250. }
  251. }
  252. if (((PFILEPATHS_SIGNERINFO)Param1)->DigitalSigner) {
  253. lpFileNode->lpSignedBy = MALLOC((lstrlen(((PFILEPATHS_SIGNERINFO)Param1)->DigitalSigner) + 1) * sizeof(TCHAR));
  254. if (lpFileNode->lpSignedBy) {
  255. lstrcpy(lpFileNode->lpSignedBy, ((PFILEPATHS_SIGNERINFO)Param1)->DigitalSigner);
  256. }
  257. }
  258. if (((PFILEPATHS_SIGNERINFO)Param1)->Version) {
  259. lpFileNode->lpVersion = MALLOC((lstrlen(((PFILEPATHS_SIGNERINFO)Param1)->Version) + 1) * sizeof(TCHAR));
  260. if (lpFileNode->lpVersion) {
  261. lstrcpy(lpFileNode->lpVersion, ((PFILEPATHS_SIGNERINFO)Param1)->Version);
  262. }
  263. }
  264. } else {
  265. //
  266. // Get the icon (if the file isn't signed) so we can display it in the listview faster.
  267. //
  268. MyGetFileInfo(lpFileNode);
  269. }
  270. }
  271. }
  272. return NO_ERROR;
  273. }
  274. void
  275. BuildDriverFileList(
  276. void
  277. )
  278. {
  279. HDEVINFO hDeviceInfo = INVALID_HANDLE_VALUE;
  280. SP_DEVINFO_DATA DeviceInfoData;
  281. SP_DRVINFO_DATA DriverInfoData;
  282. SP_DEVINSTALL_PARAMS DeviceInstallParams;
  283. DWORD DeviceMemberIndex;
  284. HSPFILEQ hFileQueue;
  285. DWORD ScanResult;
  286. //
  287. // Build up a list of all the devices currently present in the system.
  288. //
  289. hDeviceInfo = SetupDiGetClassDevs(NULL,
  290. NULL,
  291. NULL,
  292. DIGCF_ALLCLASSES | DIGCF_PRESENT
  293. );
  294. if (hDeviceInfo == INVALID_HANDLE_VALUE) {
  295. goto clean0;
  296. }
  297. DeviceInfoData.cbSize = sizeof(DeviceInfoData);
  298. DeviceMemberIndex = 0;
  299. //
  300. // Enumerate through the list of present devices.
  301. //
  302. while (SetupDiEnumDeviceInfo(hDeviceInfo,
  303. DeviceMemberIndex++,
  304. &DeviceInfoData
  305. ) &&
  306. !g_App.bStopScan) {
  307. DeviceInstallParams.cbSize = sizeof(DeviceInstallParams);
  308. //
  309. // Before we call SetupDiBuildDriverInfoList to build up a list of drivers
  310. // for this device we first need to set the DI_FLAGSEX_INSTALLEDDRIVER flag
  311. // (which tells the API to only include the currently installed driver in
  312. // the list) and the DI_FLAGSEX_ALLOWEXCLUDEDRVS (allow ExcludeFromSelect
  313. // devices in the list).
  314. //
  315. if (SetupDiGetDeviceInstallParams(hDeviceInfo,
  316. &DeviceInfoData,
  317. &DeviceInstallParams
  318. )) {
  319. DeviceInstallParams.FlagsEx = (DI_FLAGSEX_INSTALLEDDRIVER |
  320. DI_FLAGSEX_ALLOWEXCLUDEDDRVS);
  321. if (SetupDiSetDeviceInstallParams(hDeviceInfo,
  322. &DeviceInfoData,
  323. &DeviceInstallParams
  324. ) &&
  325. SetupDiBuildDriverInfoList(hDeviceInfo,
  326. &DeviceInfoData,
  327. SPDIT_CLASSDRIVER
  328. )) {
  329. //
  330. // Now we will get the one driver node that is in the list that
  331. // was just built and make it the selected driver node.
  332. //
  333. DriverInfoData.cbSize = sizeof(DriverInfoData);
  334. if (SetupDiEnumDriverInfo(hDeviceInfo,
  335. &DeviceInfoData,
  336. SPDIT_CLASSDRIVER,
  337. 0,
  338. &DriverInfoData
  339. ) &&
  340. SetupDiSetSelectedDriver(hDeviceInfo,
  341. &DeviceInfoData,
  342. &DriverInfoData
  343. )) {
  344. hFileQueue = SetupOpenFileQueue();
  345. if (hFileQueue != INVALID_HANDLE_VALUE) {
  346. //
  347. // Set the FileQueue parameter to the file queue we just
  348. // created and set the DI_NOVCP flag.
  349. //
  350. // The call SetupDiCallClassInstaller with DIF_INSTALLDEVICEFILES
  351. // to build up a queue of all the files that are copied for
  352. // this driver node.
  353. //
  354. DeviceInstallParams.FileQueue = hFileQueue;
  355. DeviceInstallParams.Flags |= DI_NOVCP;
  356. if (SetupDiSetDeviceInstallParams(hDeviceInfo,
  357. &DeviceInfoData,
  358. &DeviceInstallParams
  359. ) &&
  360. SetupDiCallClassInstaller(DIF_INSTALLDEVICEFILES,
  361. hDeviceInfo,
  362. &DeviceInfoData
  363. )) {
  364. //
  365. // Scan the file queue and have it call our callback
  366. // function for each file in the queue.
  367. //
  368. SetupScanFileQueue(hFileQueue,
  369. SPQ_SCAN_USE_CALLBACK_SIGNERINFO,
  370. NULL,
  371. ScanQueueCallback,
  372. (PVOID)&(DeviceInfoData.ClassGuid),
  373. &ScanResult
  374. );
  375. //
  376. // Dereference the file queue so we can close it.
  377. //
  378. DeviceInstallParams.FileQueue = NULL;
  379. DeviceInstallParams.Flags &= ~DI_NOVCP;
  380. SetupDiSetDeviceInstallParams(hDeviceInfo,
  381. &DeviceInfoData,
  382. &DeviceInstallParams
  383. );
  384. }
  385. SetupCloseFileQueue(hFileQueue);
  386. }
  387. }
  388. SetupDiDestroyDriverInfoList(hDeviceInfo,
  389. &DeviceInfoData,
  390. SPDIT_CLASSDRIVER
  391. );
  392. }
  393. }
  394. }
  395. clean0:
  396. if (hDeviceInfo != INVALID_HANDLE_VALUE) {
  397. SetupDiDestroyDeviceInfoList(hDeviceInfo);
  398. }
  399. }
  400. void
  401. BuildPrinterFileList(
  402. void
  403. )
  404. {
  405. BOOL bRet;
  406. DWORD dwBytesNeeded = 0;
  407. DWORD dwDrivers = 0;
  408. LPBYTE lpBuffer = NULL, lpTemp = NULL;
  409. LPTSTR lpFileName;
  410. DRIVER_INFO_3 DriverInfo;
  411. PDRIVER_INFO_3 lpDriverInfo;
  412. TCHAR szBuffer[MAX_PATH];
  413. LPFILENODE lpFileNode = NULL;
  414. ZeroMemory(&DriverInfo, sizeof(DRIVER_INFO_3));
  415. bRet = EnumPrinterDrivers( NULL,
  416. SIGVERIF_PRINTER_ENV,
  417. 3,
  418. (LPBYTE) &DriverInfo,
  419. sizeof(DRIVER_INFO_3),
  420. &dwBytesNeeded,
  421. &dwDrivers);
  422. if (!bRet && dwBytesNeeded > 0) {
  423. lpBuffer = MALLOC(dwBytesNeeded);
  424. //
  425. // If we can't get any memory then just bail out of this function
  426. //
  427. if (!lpBuffer) {
  428. return;
  429. }
  430. bRet = EnumPrinterDrivers( NULL,
  431. SIGVERIF_PRINTER_ENV,
  432. 3,
  433. (LPBYTE) lpBuffer,
  434. dwBytesNeeded,
  435. &dwBytesNeeded,
  436. &dwDrivers);
  437. }
  438. if (dwDrivers > 0) {
  439. //
  440. // By default, go into the System directory, since Win9x doesn't give full paths to drivers.
  441. //
  442. GetSystemDirectory(szBuffer, MAX_PATH);
  443. SetCurrentDirectory(szBuffer);
  444. for (lpTemp = lpBuffer; dwDrivers > 0; dwDrivers--) {
  445. lpDriverInfo = (PDRIVER_INFO_3) lpTemp;
  446. if (lpDriverInfo->pName) {
  447. if (lpDriverInfo->pDriverPath && *lpDriverInfo->pDriverPath) {
  448. lpFileNode = AddDriverFileToList(NULL, lpDriverInfo->pDriverPath);
  449. if (lpFileNode) {
  450. lpFileNode->bValidateAgainstAnyOs = TRUE;
  451. }
  452. }
  453. if (lpDriverInfo->pDataFile && *lpDriverInfo->pDataFile) {
  454. lpFileNode = AddDriverFileToList(NULL, lpDriverInfo->pDataFile);
  455. if (lpFileNode) {
  456. lpFileNode->bValidateAgainstAnyOs = TRUE;
  457. }
  458. }
  459. if (lpDriverInfo->pConfigFile && *lpDriverInfo->pConfigFile) {
  460. lpFileNode = AddDriverFileToList(NULL, lpDriverInfo->pConfigFile);
  461. if (lpFileNode) {
  462. lpFileNode->bValidateAgainstAnyOs = TRUE;
  463. }
  464. }
  465. if (lpDriverInfo->pHelpFile && *lpDriverInfo->pHelpFile) {
  466. lpFileNode = AddDriverFileToList(NULL, lpDriverInfo->pHelpFile);
  467. if (lpFileNode) {
  468. lpFileNode->bValidateAgainstAnyOs = TRUE;
  469. }
  470. }
  471. lpFileName = lpDriverInfo->pDependentFiles;
  472. while (lpFileName && *lpFileName) {
  473. lpFileNode = AddDriverFileToList(NULL, lpFileName);
  474. if (lpFileNode) {
  475. lpFileNode->bValidateAgainstAnyOs = TRUE;
  476. }
  477. for (;*lpFileName;lpFileName++);
  478. lpFileName++;
  479. }
  480. }
  481. lpTemp += sizeof(DRIVER_INFO_3);
  482. }
  483. }
  484. if (lpBuffer) {
  485. FREE(lpBuffer);
  486. }
  487. }
  488. BOOL
  489. GetBVTFileList(
  490. LPTSTR lpDirName,
  491. LPTSTR lpFileName
  492. )
  493. {
  494. TCHAR szBuffer[MAX_PATH];
  495. LPTSTR lpString, lpFilePart;
  496. //
  497. // If the user specified the "/BVT:" switch, we want to grab the string after it
  498. //
  499. MyLoadString(szBuffer, IDS_BVT);
  500. lpString = MyStrStr(GetCommandLine(), szBuffer);
  501. if (lpString && *lpString) {
  502. //
  503. // Switch back into the original startup directory
  504. //
  505. SetCurrentDirectory(g_App.szAppDir);
  506. lpString += lstrlen(szBuffer);
  507. if (!EXIST(lpString)) {
  508. return FALSE;
  509. }
  510. GetFullPathName(lpString, MAX_PATH, lpDirName, &lpFilePart);
  511. lstrcpy(lpFileName, lpDirName);
  512. *lpFilePart = 0;
  513. SetCurrentDirectory(lpDirName);
  514. return TRUE;
  515. }
  516. return FALSE;
  517. }
  518. BOOL
  519. IsNTServer(
  520. void
  521. )
  522. {
  523. BOOL bRet = FALSE;
  524. HKEY hKey;
  525. LONG lRet;
  526. DWORD dwSize, dwType;
  527. TCHAR szBuffer[MAX_PATH];
  528. TCHAR szRegBuffer[MAX_PATH];
  529. // Open HKLM\System\CurrentControlSet\Control\ProductOptions
  530. MyLoadString(szRegBuffer, IDS_REG_PRODUCTOPTIONS);
  531. lRet = RegOpenKey(HKEY_LOCAL_MACHINE, szRegBuffer, &hKey);
  532. if (lRet == ERROR_SUCCESS) {
  533. // Now we need to query the ProductType value
  534. ZeroMemory(szBuffer, sizeof(szBuffer));
  535. dwSize = sizeof(szBuffer);
  536. MyLoadString(szRegBuffer, IDS_REG_PRODUCTTYPE);
  537. lRet = RegQueryValueEx(hKey, szRegBuffer, NULL, &dwType, (PVOID)szBuffer, &dwSize);
  538. if (lRet == ERROR_SUCCESS) {
  539. // Check to see if ProductType contained "ServerNT"
  540. MyLoadString(szRegBuffer, IDS_PRODUCT_SERVER);
  541. if (!_tcsnicmp(szRegBuffer, szBuffer, lstrlen(szRegBuffer))) {
  542. // If so, then we want to return TRUE!
  543. bRet = TRUE;
  544. }
  545. }
  546. RegCloseKey(hKey);
  547. }
  548. return bRet;
  549. }
  550. BOOL
  551. IsProcessorAlpha(
  552. void
  553. )
  554. {
  555. OSVERSIONINFO osinfo;
  556. SYSTEM_INFO sysinfo;
  557. ZeroMemory(&osinfo, sizeof(OSVERSIONINFO));
  558. osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  559. GetVersionEx(&osinfo);
  560. if (osinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) {
  561. ZeroMemory(&sysinfo, sizeof(SYSTEM_INFO));
  562. GetSystemInfo(&sysinfo);
  563. if (sysinfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ALPHA) {
  564. return TRUE;
  565. }
  566. }
  567. return FALSE;
  568. }
  569. void
  570. BuildCoreFileList(
  571. void
  572. )
  573. {
  574. LPFILENODE lpFileNode;
  575. TCHAR szInfName[MAX_PATH];
  576. TCHAR szSectionName[MAX_PATH];
  577. TCHAR szBuffer[MAX_PATH];
  578. //
  579. // Check to see if the "/BVT:" switch was specified for a custom file list
  580. // If so, then don't verify that the file is digitally signed.
  581. //
  582. if (GetBVTFileList(szBuffer, szInfName)) {
  583. GetCurrentDirectory(MAX_PATH, szBuffer);
  584. MyLoadString(szSectionName, IDS_MASTERFILELIST);
  585. GetStuffFromInfSection(szInfName, szSectionName);
  586. if (IsNTServer()) {
  587. SetCurrentDirectory(szBuffer);
  588. MyLoadString(szSectionName, IDS_SERVERFILELIST);
  589. GetStuffFromInfSection(szInfName, szSectionName);
  590. }
  591. if (!IsProcessorAlpha()) {
  592. SetCurrentDirectory(szBuffer);
  593. MyLoadString(szSectionName, IDS_X86FILELIST);
  594. GetStuffFromInfSection(szInfName, szSectionName);
  595. }
  596. } else {
  597. PROTECTED_FILE_DATA pfd;
  598. //
  599. // The user didn't use "/BVT:", so call SfcGetNextProtectedFile to get
  600. // the list of files that SFC protects.
  601. //
  602. pfd.FileNumber = 0;
  603. while (!g_App.bStopScan && SfcGetNextProtectedFile(NULL, &pfd)) {
  604. AddDriverFileToList(NULL, pfd.FileName);
  605. }
  606. }
  607. }