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.

980 lines
26 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. lookup.c
  5. Abstract:
  6. this is the sr lookup functionlity implementation
  7. Author:
  8. Kanwaljit Marok (kmarok) 01-May-2000
  9. Revision History:
  10. --*/
  11. #include "precomp.h"
  12. //
  13. // Include hlist.c to use the inline funtions
  14. //
  15. #include "hlist.c"
  16. #include "ptree.c"
  17. //
  18. // Internal helper APIs
  19. //
  20. static
  21. NTSTATUS
  22. SrOpenLookupBlob(
  23. IN PUNICODE_STRING pFileName,
  24. IN PDEVICE_OBJECT pTargetDevice,
  25. OUT PBLOB_INFO pBlobInfo
  26. );
  27. //
  28. // linker commands
  29. //
  30. #ifdef ALLOC_PRAGMA
  31. #pragma alloc_text( PAGE, SrOpenLookupBlob )
  32. #pragma alloc_text( PAGE, SrLoadLookupBlob )
  33. #pragma alloc_text( PAGE, SrReloadLookupBlob )
  34. #pragma alloc_text( PAGE, SrFreeLookupBlob )
  35. #pragma alloc_text( PAGE, SrIsExtInteresting )
  36. #pragma alloc_text( PAGE, SrIsPathInteresting )
  37. #endif // ALLOC_PRAGMA
  38. //++
  39. // Function:
  40. // SrOpenLookupBlob
  41. //
  42. // Description:
  43. // This function loads the lookup blob in memory and
  44. // sets the appropriate pointers for lookup.
  45. //
  46. // Arguments:
  47. //
  48. // Return Value:
  49. // This function returns STATUS_XXX
  50. //--
  51. static
  52. NTSTATUS
  53. SrOpenLookupBlob(
  54. IN PUNICODE_STRING pFileName,
  55. IN PDEVICE_OBJECT pTargetDevice,
  56. OUT PBLOB_INFO pBlobInfo
  57. )
  58. {
  59. NTSTATUS Status;
  60. OBJECT_ATTRIBUTES oa;
  61. IO_STATUS_BLOCK IoStatusBlock;
  62. HANDLE Handle = NULL;
  63. PLIST_ENTRY pListEntry;
  64. PSR_DEVICE_EXTENSION pExtension;
  65. static char blobFailureMessage[] = "sr!System Restore's BLOB file \"%wZ\" is invalid.\n";
  66. PAGED_CODE();
  67. ASSERT(pFileName);
  68. ASSERT(pBlobInfo);
  69. ASSERT( IS_BLOB_LOCK_ACQUIRED() );
  70. try
  71. {
  72. //
  73. // Zero out the pointers that get initialized when the
  74. // blob is successfully read into the memory from disk
  75. //
  76. pBlobInfo->LookupBlob = NULL;
  77. pBlobInfo->LookupTree = NULL;
  78. pBlobInfo->LookupList = NULL;
  79. pBlobInfo->DefaultType= NODE_TYPE_UNKNOWN;
  80. //
  81. // open and read the file
  82. //
  83. InitializeObjectAttributes( &oa,
  84. pFileName,
  85. OBJ_KERNEL_HANDLE,
  86. NULL,
  87. NULL );
  88. Status = SrIoCreateFile(
  89. &Handle,
  90. GENERIC_READ | SYNCHRONIZE,
  91. &oa,
  92. &IoStatusBlock,
  93. 0,
  94. FILE_ATTRIBUTE_NORMAL,
  95. FILE_SHARE_READ,
  96. FILE_OPEN,
  97. FILE_SYNCHRONOUS_IO_NONALERT,
  98. NULL,
  99. 0,
  100. 0,
  101. pTargetDevice );
  102. if (NT_SUCCESS(Status))
  103. {
  104. DWORD dwBytesRead = 0, dwBytes = 0;
  105. LARGE_INTEGER nOffset;
  106. BlobHeader blobHeader;
  107. //
  108. // Read the blob header
  109. //
  110. nOffset.QuadPart = 0;
  111. dwBytes = sizeof(blobHeader);
  112. Status = ZwReadFile(
  113. Handle,
  114. NULL,
  115. NULL,
  116. NULL,
  117. &IoStatusBlock,
  118. &blobHeader,
  119. dwBytes,
  120. &nOffset,
  121. NULL
  122. );
  123. if (NT_SUCCESS(Status))
  124. {
  125. //
  126. // need to do some sanity check on the header
  127. //
  128. if ( !VERIFY_BLOB_VERSION(&blobHeader) ||
  129. !VERIFY_BLOB_MAGIC (&blobHeader) )
  130. {
  131. SrTrace( BLOB_VERIFICATION, (blobFailureMessage, pFileName) );
  132. Status = STATUS_FILE_CORRUPT_ERROR;
  133. leave;
  134. }
  135. pBlobInfo->LookupBlob = SR_ALLOCATE_POOL(
  136. NonPagedPool,
  137. blobHeader.m_dwMaxSize,
  138. SR_LOOKUP_TABLE_TAG );
  139. if( pBlobInfo->LookupBlob )
  140. {
  141. //
  142. // Read the entire file now
  143. //
  144. nOffset.QuadPart = 0;
  145. dwBytes = blobHeader.m_dwMaxSize;
  146. Status = ZwReadFile(
  147. Handle,
  148. NULL,
  149. NULL,
  150. NULL,
  151. &IoStatusBlock,
  152. pBlobInfo->LookupBlob,
  153. dwBytes,
  154. &nOffset,
  155. NULL
  156. );
  157. if (NT_SUCCESS(Status))
  158. {
  159. //
  160. // TODO: verify that size of the file matched the
  161. // size from the header
  162. //
  163. //
  164. // Setup the lookup pointers properly in blobinfo
  165. //
  166. pBlobInfo->LookupTree = pBlobInfo->LookupBlob +
  167. sizeof(blobHeader);
  168. pBlobInfo->LookupList = pBlobInfo->LookupTree +
  169. BLOB_MAXSIZE((pBlobInfo->LookupTree));
  170. pBlobInfo->DefaultType = TREE_HEADER((pBlobInfo->LookupTree))->m_dwDefault;
  171. //
  172. // Verify the individual blobs
  173. //
  174. if (!SrVerifyBlob(pBlobInfo->LookupBlob)) {
  175. SrTrace( BLOB_VERIFICATION,
  176. (blobFailureMessage,pFileName) );
  177. Status = STATUS_FILE_CORRUPT_ERROR;
  178. leave;
  179. }
  180. }
  181. }
  182. else
  183. {
  184. Status = STATUS_INSUFFICIENT_RESOURCES;
  185. }
  186. }
  187. }
  188. else
  189. {
  190. SrTrace( VERBOSE_ERRORS,
  191. ("sr!SrOpenLookupBlob: Cannot Open Blob file \"%wZ\"\n",
  192. pFileName) );
  193. }
  194. //
  195. // The new blob was loaded successfully, perge all contexts on all
  196. // volumes since what is interesting and what is not interesting
  197. // may have changed.
  198. //
  199. ASSERT(!IS_DEVICE_EXTENSION_LIST_LOCK_ACQUIRED());
  200. try
  201. {
  202. SrAcquireDeviceExtensionListLockShared();
  203. for (pListEntry = _globals.DeviceExtensionListHead.Flink;
  204. pListEntry != &_globals.DeviceExtensionListHead;
  205. pListEntry = pListEntry->Flink)
  206. {
  207. pExtension = CONTAINING_RECORD( pListEntry,
  208. SR_DEVICE_EXTENSION,
  209. ListEntry );
  210. ASSERT(IS_VALID_SR_DEVICE_EXTENSION(pExtension));
  211. //
  212. // Skip Control Device Objects.
  213. //
  214. if (!FlagOn(pExtension->FsType,SrFsControlDeviceObject))
  215. {
  216. SrDeleteAllContexts( pExtension );
  217. }
  218. }
  219. }
  220. finally
  221. {
  222. SrReleaseDeviceExtensionListLock();
  223. }
  224. }
  225. finally
  226. {
  227. Status = FinallyUnwind(SrOpenLookupBlob, Status);
  228. //
  229. // close the blob file handle
  230. //
  231. if (Handle)
  232. {
  233. ZwClose( Handle );
  234. }
  235. //
  236. // incase of a failure free up the resources
  237. //
  238. if (!NT_SUCCESS(Status))
  239. {
  240. if( pBlobInfo->LookupBlob )
  241. {
  242. SR_FREE_POOL( pBlobInfo->LookupBlob, SR_LOOKUP_TABLE_TAG );
  243. }
  244. pBlobInfo->LookupBlob = NULL;
  245. pBlobInfo->LookupTree = NULL;
  246. pBlobInfo->LookupList = NULL;
  247. pBlobInfo->DefaultType= NODE_TYPE_UNKNOWN;
  248. }
  249. }
  250. RETURN(Status);
  251. }
  252. //
  253. // Public APIs called by the filer
  254. //
  255. //++
  256. // Function:
  257. // SrLoadLookupBlob
  258. //
  259. // Description:
  260. // This function loads the lookup blob in memory and
  261. // sets the appropriate pointers for lookup.
  262. //
  263. // Arguments:
  264. //
  265. // Return Value:
  266. // This function returns STATUS_XXX
  267. //--
  268. NTSTATUS
  269. SrLoadLookupBlob(
  270. IN PUNICODE_STRING pFileName,
  271. IN PDEVICE_OBJECT pTargetDevice,
  272. OUT PBLOB_INFO pBlobInfo
  273. )
  274. {
  275. NTSTATUS Status;
  276. PAGED_CODE();
  277. ASSERT( pFileName );
  278. ASSERT( pBlobInfo );
  279. try
  280. {
  281. SrAcquireBlobLockExclusive();
  282. //
  283. // if somebody else did it, bail out
  284. //
  285. if (global->BlobInfoLoaded)
  286. {
  287. Status = STATUS_SUCCESS;
  288. leave;
  289. }
  290. //
  291. // initialize return information
  292. //
  293. RtlZeroMemory( pBlobInfo, sizeof( BLOB_INFO ) );
  294. //
  295. // Try and open the lookup blob
  296. //
  297. Status = SrOpenLookupBlob( pFileName,
  298. pTargetDevice,
  299. pBlobInfo );
  300. //
  301. // If we failed to read the file for some reason,
  302. // reinitlialize the return info
  303. //
  304. if ( NT_SUCCESS( Status ) )
  305. {
  306. SrTrace(LOOKUP, ("Loaded lookup blob :%wZ\n", pFileName) );
  307. global->BlobInfoLoaded = TRUE;
  308. }
  309. else
  310. {
  311. SrFreeLookupBlob( pBlobInfo );
  312. }
  313. }
  314. finally
  315. {
  316. SrReleaseBlobLock();
  317. }
  318. RETURN(Status);
  319. }
  320. //++
  321. // Function:
  322. // SrReloadLookupBlob
  323. //
  324. // Description:
  325. // This function loads the lookup blob in memory and
  326. // sets the appropriate pointers for lookup.
  327. //
  328. // Arguments:
  329. // Pointer to LookupBlob
  330. // Pointer to BlobInfo structure
  331. //
  332. // Return Value:
  333. // This function returns STATUS_XXX
  334. //--
  335. NTSTATUS
  336. SrReloadLookupBlob(
  337. IN PUNICODE_STRING pFileName,
  338. IN PDEVICE_OBJECT pTargetDevice,
  339. OUT PBLOB_INFO pBlobInfo
  340. )
  341. {
  342. NTSTATUS Status = STATUS_UNSUCCESSFUL;
  343. BLOB_INFO OldBlobInfo;
  344. PAGED_CODE();
  345. ASSERT( pFileName != NULL );
  346. ASSERT( pBlobInfo != NULL );
  347. ASSERT( !IS_BLOB_LOCK_ACQUIRED() );
  348. try
  349. {
  350. SrAcquireBlobLockExclusive();
  351. if (global->BlobInfoLoaded == 0)
  352. {
  353. Status = SrLoadLookupBlob( pFileName,
  354. pTargetDevice,
  355. pBlobInfo );
  356. leave;
  357. }
  358. //
  359. // Save the current blob info
  360. //
  361. RtlCopyMemory( &OldBlobInfo, pBlobInfo, sizeof( BLOB_INFO ) );
  362. //
  363. // Open the new blob file
  364. //
  365. Status = SrOpenLookupBlob( pFileName,
  366. pTargetDevice,
  367. pBlobInfo );
  368. if(NT_SUCCESS(Status))
  369. {
  370. //
  371. // Free up the memory taken up by the old blob
  372. //
  373. if (OldBlobInfo.LookupBlob)
  374. {
  375. SR_FREE_POOL( OldBlobInfo.LookupBlob, SR_LOOKUP_TABLE_TAG );
  376. }
  377. SrTrace(LOOKUP, ("Reloaded lookup blob :%wZ\n", pFileName) );
  378. }
  379. else
  380. {
  381. //
  382. // Copy the old information back in the original context
  383. //
  384. RtlCopyMemory( pBlobInfo, &OldBlobInfo, sizeof( BLOB_INFO ) );
  385. SrTrace(LOOKUP, (" Cannot reload blob :%wZ\n", pFileName) );
  386. }
  387. }
  388. finally
  389. {
  390. if (NT_SUCCESS_NO_DBGBREAK( Status ))
  391. {
  392. //
  393. // The blob has been reload successfully, so make sure that the
  394. // global BlobError flag is cleared.
  395. //
  396. // We do this here because we are still holding the blob lock.
  397. //
  398. _globals.HitErrorLoadingBlob = FALSE;
  399. }
  400. SrReleaseBlobLock();
  401. }
  402. RETURN(Status);
  403. }
  404. //++
  405. // Function:
  406. // SrFreeLookupBlob
  407. //
  408. // Description:
  409. // This function Frees the lookup blob in memory
  410. //
  411. // Arguments:
  412. // Pointer to BlobInfo structure
  413. //
  414. // Return Value:
  415. // This function returns STATUS_XXX
  416. //--
  417. NTSTATUS
  418. SrFreeLookupBlob(
  419. IN PBLOB_INFO pBlobInfo
  420. )
  421. {
  422. NTSTATUS Status = STATUS_SUCCESS;
  423. PAGED_CODE();
  424. ASSERT( pBlobInfo );
  425. try
  426. {
  427. SrAcquireBlobLockExclusive();
  428. if (_globals.BlobInfoLoaded == 0)
  429. {
  430. //
  431. // Reset our error flag here.
  432. //
  433. _globals.HitErrorLoadingBlob = FALSE;
  434. leave;
  435. }
  436. if( pBlobInfo->LookupBlob )
  437. {
  438. SR_FREE_POOL( pBlobInfo->LookupBlob, SR_LOOKUP_TABLE_TAG );
  439. pBlobInfo->LookupBlob = NULL;
  440. }
  441. RtlZeroMemory( pBlobInfo, sizeof(BLOB_INFO) );
  442. pBlobInfo->DefaultType = NODE_TYPE_UNKNOWN;
  443. SrTrace(LOOKUP, ("Freed lookup blob\n") );
  444. global->BlobInfoLoaded = 0;
  445. }
  446. finally
  447. {
  448. SrReleaseBlobLock();
  449. }
  450. RETURN(Status);
  451. }
  452. //++
  453. // Function:
  454. // SrIsExtInteresting
  455. //
  456. // Description:
  457. // This function checks the file extension in the blob to
  458. // see if we care about it
  459. //
  460. // Arguments:
  461. // Pointer to BlobInfo structure
  462. // Pointer to Path
  463. // Pointer to boolean return value
  464. //
  465. // Return Value:
  466. // This function returns TRUE/FALSE
  467. //--
  468. NTSTATUS
  469. SrIsExtInteresting(
  470. IN PUNICODE_STRING pFileName,
  471. OUT PBOOLEAN pInteresting
  472. )
  473. {
  474. BOOL fRet = FALSE;
  475. NTSTATUS Status = STATUS_SUCCESS;
  476. INT iType = 0;
  477. BOOL fPathHasExt = FALSE;
  478. BOOL fMatch = FALSE;
  479. PAGED_CODE();
  480. //
  481. // check parameters and lookup info
  482. //
  483. ASSERT(pFileName);
  484. ASSERT(pInteresting);
  485. //
  486. // Lookup code is enclosed in an exception handler to protect against
  487. // bad memroy accesses generated by corrupt lookup data
  488. //
  489. try
  490. {
  491. *pInteresting = FALSE;
  492. //
  493. // CODEWORK : put some blob verification code,
  494. // magicnum, type etc
  495. //
  496. //
  497. // Take the blob lock so that other threads won't change
  498. // the blob while we are looking up. Note that the blob
  499. // can be gone after we get the lock.
  500. //
  501. SrAcquireBlobLockShared();
  502. if ( !global->BlobInfoLoaded ||
  503. !global->BlobInfo.LookupList )
  504. {
  505. Status = SR_STATUS_VOLUME_DISABLED;
  506. leave;
  507. }
  508. //
  509. // parse the filename for lookup in the mem blob
  510. //
  511. fMatch = MatchExtension(
  512. global->BlobInfo.LookupList,
  513. pFileName,
  514. &iType,
  515. &fPathHasExt );
  516. if ( !fMatch )
  517. {
  518. //
  519. // Extension didn't match, so setting to default type
  520. //
  521. iType = global->BlobInfo.DefaultType;
  522. }
  523. if ( !fPathHasExt )
  524. {
  525. //
  526. // If the path didn't contain an extension then we should
  527. // treat it as an exclude
  528. //
  529. iType = NODE_TYPE_EXCLUDE;
  530. }
  531. //
  532. // If type is still unknown then set the type to the default.
  533. //
  534. if ( NODE_TYPE_UNKNOWN == iType )
  535. {
  536. iType = global->BlobInfo.DefaultType;
  537. }
  538. *pInteresting = (iType != NODE_TYPE_EXCLUDE);
  539. // SrTrace(LOOKUP, ("Extention Interest:%d\n", *pInteresting) );
  540. }
  541. finally
  542. {
  543. Status = FinallyUnwind(SrIsExtInteresting, Status);
  544. SrReleaseBlobLock();
  545. if (!NT_SUCCESS(Status))
  546. {
  547. *pInteresting = FALSE;
  548. }
  549. }
  550. RETURN(Status);
  551. }
  552. //++
  553. // Function:
  554. // SrIsPathInteresting
  555. //
  556. // Description:
  557. // This function checks the file name in the blob to
  558. // see if we care about it
  559. //
  560. // Arguments:
  561. // Pointer to BlobInfo structure
  562. // Pointer to Full Path
  563. // Pointer to Volume Prefix
  564. // Boolean to indicate if this path is a directory
  565. // Pointer to boolean return value
  566. //
  567. // Return Value:
  568. // This function returns TRUE/FALSE
  569. //--
  570. NTSTATUS
  571. SrIsPathInteresting(
  572. IN PUNICODE_STRING pFullPath,
  573. IN PUNICODE_STRING pVolPrefix,
  574. IN BOOLEAN IsDirectory,
  575. OUT PBOOLEAN pInteresting
  576. )
  577. {
  578. BOOL fRet = FALSE;
  579. NTSTATUS Status = STATUS_UNSUCCESSFUL;
  580. PBYTE pFileName = NULL;
  581. WORD FileNameSize = 0;
  582. UNICODE_STRING localName;
  583. PAGED_CODE();
  584. //
  585. // check parameters and lookup info
  586. //
  587. ASSERT(pFullPath);
  588. ASSERT(pVolPrefix);
  589. ASSERT(pFullPath->Length >= pVolPrefix->Length);
  590. ASSERT(pInteresting);
  591. try
  592. {
  593. *pInteresting = FALSE;
  594. //
  595. // Take the blob lock so that other threads won't change
  596. //
  597. SrAcquireBlobLockShared();
  598. if ( !global->BlobInfoLoaded ||
  599. !global->BlobInfo.LookupList ||
  600. !global->BlobInfo.LookupTree )
  601. {
  602. Status = SR_STATUS_VOLUME_DISABLED;
  603. leave;
  604. }
  605. ASSERT(global->BlobInfo.DefaultType != NODE_TYPE_UNKNOWN );
  606. //
  607. // allocate space for a parsed path
  608. //
  609. FileNameSize = CALC_PPATH_SIZE( pFullPath->Length/sizeof(WCHAR) );
  610. pFileName = ExAllocatePoolWithTag( PagedPool,
  611. FileNameSize,
  612. SR_FILENAME_BUFFER_TAG );
  613. if (NULL == pFileName)
  614. {
  615. Status = STATUS_INSUFFICIENT_RESOURCES;
  616. leave;
  617. }
  618. //
  619. // parse the filename for lookup in the mem blob
  620. //
  621. fRet = ConvertToParsedPath(
  622. pFullPath->Buffer,
  623. pFullPath->Length/sizeof(WCHAR),
  624. pFileName,
  625. FileNameSize );
  626. if(fRet)
  627. {
  628. INT iNode = -1;
  629. INT iType = 0;
  630. INT iLevel = 0;
  631. BOOL fExactMatch = FALSE;
  632. BOOL fMatch = FALSE;
  633. //
  634. // Lookup the parsed path in the tree blob
  635. //
  636. fMatch = MatchPrefix(
  637. global->BlobInfo.LookupTree,
  638. TREE_ROOT_NODE,
  639. ((path_t)pFileName)->pp_elements,
  640. &iNode,
  641. &iLevel,
  642. &iType,
  643. NULL,
  644. &fExactMatch);
  645. if (fMatch)
  646. {
  647. SrTrace(LOOKUP,
  648. ("Found match in pathtree N: %d L:%d T:%d\n",
  649. iNode, iLevel, iType));
  650. }
  651. //
  652. // Lookup in __ALLVOLUMES__ to see is there is a match
  653. //
  654. if ( NODE_TYPE_UNKNOWN == iType ||
  655. (!fExactMatch && NODE_TYPE_EXCLUDE != iType )
  656. )
  657. {
  658. PBYTE pRelFileName = NULL;
  659. INT RelFileNameLen = 0;
  660. //
  661. // Lookup only volume relative filename
  662. //
  663. RelFileNameLen = sizeof(L'\\' ) +
  664. sizeof(ALLVOLUMES_PATH_W) +
  665. (pFullPath->Length - pVolPrefix->Length);
  666. pRelFileName = ExAllocatePoolWithTag( PagedPool,
  667. RelFileNameLen,
  668. SR_FILENAME_BUFFER_TAG );
  669. if (NULL == pRelFileName)
  670. {
  671. Status = STATUS_INSUFFICIENT_RESOURCES;
  672. leave;
  673. }
  674. localName.Buffer = &pFullPath->Buffer[pVolPrefix->Length/sizeof(WCHAR)];
  675. localName.Length = pFullPath->Length - pVolPrefix->Length;
  676. localName.MaximumLength = localName.Length;
  677. RelFileNameLen = swprintf(
  678. (LPWSTR)pRelFileName,
  679. L"\\%s%wZ",
  680. ALLVOLUMES_PATH_W,
  681. &localName );
  682. fRet = ConvertToParsedPath(
  683. (LPWSTR)pRelFileName,
  684. (USHORT)RelFileNameLen,
  685. pFileName,
  686. FileNameSize );
  687. if(fRet)
  688. {
  689. //
  690. // Lookup the parsed path in the appropriate protion of
  691. // the tree blob NTROOT\\__ALLVOLUMES__
  692. //
  693. fMatch = MatchPrefix(
  694. global->BlobInfo.LookupTree,
  695. TREE_ROOT_NODE,
  696. ((path_t)pFileName)->pp_elements,
  697. &iNode,
  698. &iLevel,
  699. &iType,
  700. NULL,
  701. &fExactMatch);
  702. if (fMatch)
  703. {
  704. SrTrace(LOOKUP,
  705. ("Found match in pathtree N: %d L:%d T:%d\n",
  706. iNode, iLevel, iType));
  707. }
  708. }
  709. else
  710. {
  711. CHECK_STATUS( Status );
  712. }
  713. ExFreePoolWithTag( pRelFileName, SR_FILENAME_BUFFER_TAG );
  714. NULLPTR( pRelFileName );
  715. }
  716. if ( !IsDirectory )
  717. {
  718. //
  719. // If path didn't match or matched partially, we need to
  720. // lookup the extension list also
  721. //
  722. if ( NODE_TYPE_UNKNOWN == iType ||
  723. (!fExactMatch && NODE_TYPE_EXCLUDE != iType )
  724. )
  725. {
  726. BOOL fPathHasExt = FALSE;
  727. fMatch = MatchExtension(
  728. global->BlobInfo.LookupList,
  729. pFullPath,
  730. &iType,
  731. &fPathHasExt );
  732. if ( !fMatch )
  733. {
  734. //
  735. // Extension didn't match, setting to default type
  736. //
  737. iType = global->BlobInfo.DefaultType;
  738. }
  739. if ( !fPathHasExt )
  740. {
  741. //
  742. // If path didn't contain an extension then
  743. // treat it as an exclude
  744. //
  745. iType = NODE_TYPE_EXCLUDE;
  746. }
  747. }
  748. //
  749. // If still type is unknown then set type to the default.
  750. //
  751. if ( NODE_TYPE_UNKNOWN == iType )
  752. {
  753. iType = global->BlobInfo.DefaultType;
  754. }
  755. }
  756. else
  757. {
  758. //
  759. // If this is directory operation and no match found in
  760. // tree then treat is as include.
  761. //
  762. if ( NODE_TYPE_UNKNOWN == iType )
  763. {
  764. iType = NODE_TYPE_INCLUDE;
  765. }
  766. }
  767. *pInteresting = (iType != NODE_TYPE_EXCLUDE);
  768. Status = STATUS_SUCCESS;
  769. }
  770. else
  771. {
  772. SrTrace( LOOKUP,
  773. ( "ConvertToParsedPath Failed : %wZ\n", pFullPath )
  774. );
  775. CHECK_STATUS( Status );
  776. }
  777. // SrTrace(LOOKUP, ("Path Interest:%d\n", *pInteresting) );
  778. }
  779. finally
  780. {
  781. Status = FinallyUnwind(SrIsPathInteresting, Status);
  782. SrReleaseBlobLock();
  783. if (pFileName != NULL)
  784. {
  785. ExFreePoolWithTag( pFileName, SR_FILENAME_BUFFER_TAG );
  786. NULLPTR( pFileName );;
  787. }
  788. if (!NT_SUCCESS(Status))
  789. {
  790. *pInteresting = FALSE;
  791. }
  792. }
  793. RETURN(Status);
  794. }