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.

91 lines
2.2 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. INFSCAN
  5. parseinfctx.inl
  6. Abstract:
  7. ParseInfContext inline functions
  8. History:
  9. Created July 2001 - JamieHun
  10. --*/
  11. inline ParseInfContext::ParseInfContext()
  12. {
  13. Locked = false;
  14. pGlobalScan = NULL;
  15. pInfScan = NULL;
  16. InfHandle = INVALID_HANDLE_VALUE;
  17. LooksLikeLayoutInf = false;
  18. HasDependentFileChanged = false;
  19. DefaultTargetDirectory = DestinationDirectories.end();
  20. }
  21. inline ParseInfContext::~ParseInfContext()
  22. {
  23. if(InfHandle != INVALID_HANDLE_VALUE) {
  24. SetupCloseInfFile(InfHandle);
  25. }
  26. }
  27. inline TargetDirectoryEntry * ParseInfContext::GetDefaultTargetDirectory()
  28. {
  29. if(DefaultTargetDirectory != DestinationDirectories.end()) {
  30. DefaultTargetDirectory->second.Used = true;
  31. return &(DefaultTargetDirectory->second);
  32. }
  33. return NULL;
  34. }
  35. inline TargetDirectoryEntry * ParseInfContext::GetTargetDirectory(const SafeString & section)
  36. {
  37. CopySectionToTargetDirectoryEntry::iterator i;
  38. i = DestinationDirectories.find(section);
  39. if(i != DestinationDirectories.end()) {
  40. i->second.Used = true;
  41. return &(i->second);
  42. }
  43. return GetDefaultTargetDirectory();
  44. }
  45. inline DWORD ParseInfContext::DoingCopySection(const SafeString & section,DWORD platforms)
  46. {
  47. StringToInt::iterator i = CompletedCopySections.find(section);
  48. if(i == CompletedCopySections.end()) {
  49. //
  50. // never done this section before
  51. //
  52. CompletedCopySections[section] = platforms;
  53. return 0;
  54. }
  55. if(i->second & PLATFORM_MASK_IGNORE) {
  56. //
  57. // attempted this section before, but there isn't one
  58. //
  59. return (DWORD)-1;
  60. }
  61. if(platforms & ~i->second) {
  62. //
  63. // never done these specific platforms before
  64. //
  65. i->second |= platforms;
  66. return 0;
  67. }
  68. return i->second;
  69. }
  70. inline void ParseInfContext::NoCopySection(const SafeString & section)
  71. {
  72. //
  73. // effectively do a no-section platform to get the bit there
  74. //
  75. DoingCopySection(section,PLATFORM_MASK_IGNORE);
  76. }