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.

117 lines
3.7 KiB

  1. '<script language='VBScript'>
  2. ' wiconsts.inc - VBScript constants
  3. '
  4. ' 2000/06/12 - created - Rob Mensching (robmen@microsoft.com)
  5. '
  6. ' requires:
  7. ' none
  8. '
  9. ' entrypoints:
  10. ' ResolveFileSourcePath
  11. ' ResolveDirectorySourcePath
  12. '
  13. ' GetDefaultDir
  14. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  15. ' ResolveFileSourcePath
  16. Function ResolveFileSourcePath(db, sKey, fLong)
  17. Dim sDir, sFile
  18. Dim vw, rec
  19. Set vw = db.OpenView("SELECT `Directory_`, `FileName` FROM `Component`, `File` WHERE `Component`.`Component`=`File`.`Component_` AND `File`.`File`='" & sKey & "'")
  20. vw.Execute
  21. Set rec = vw.Fetch
  22. If rec Is Nothing Then
  23. ResolveFileSourcePath = Empty
  24. Else
  25. sDir = ResolveDirectorySourcePath(db, rec.StringData(1), fLong)
  26. sFile = GetDefaultDir(rec.StringData(2), True, fLong)
  27. ResolveFileSourcePath = sDir & sFile
  28. End If
  29. End Function ' ResolveFileSourcePath
  30. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  31. ' ResolveFileTargetPath
  32. Function ResolveFileTargetPath(db, sKey, fLong)
  33. Dim sDir, sFile
  34. Dim vw, rec
  35. Set vw = db.OpenView("SELECT `Directory_`, `FileName` FROM `Component`, `File` WHERE `Component`.`Component`=`File`.`Component_` AND `File`.`File`='" & sKey & "'")
  36. vw.Execute
  37. Set rec = vw.Fetch
  38. If rec Is Nothing Then
  39. ResolveFileTargetPath = Empty
  40. Else
  41. sDir = ResolveDirectoryTargetPath(db, rec.StringData(1), fLong)
  42. sFile = GetDefaultDir(rec.StringData(2), False, fLong)
  43. ResolveFileTargetPath = sDir & sFile
  44. End If
  45. End Function ' ResolveFileTargetPath
  46. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  47. ' ResolveDirectorySourcePath
  48. Function ResolveDirectorySourcePath(db, sKey, fLong)
  49. Dim vw, rec
  50. Set vw = db.OpenView("SELECT Directory_Parent, DefaultDir FROM Directory WHERE Directory=?")
  51. Set rec = installer.CreateRecord(1)
  52. rec.StringData(1) = sKey
  53. ResolveDirectorySourcePath = widir_ResolveDirectory(vw, rec, True, fLong)
  54. End Function ' ResolveDirectorySourcePath
  55. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  56. ' ResolveDirectoryTargetPath
  57. Function ResolveDirectoryTargetPath(db, sKey, fLong)
  58. Dim vw, rec
  59. Set vw = db.OpenView("SELECT Directory_Parent, DefaultDir FROM Directory WHERE Directory=?")
  60. Set rec = installer.CreateRecord(1)
  61. rec.StringData(1) = sKey
  62. ResolveDirectoryTargetPath = widir_ResolveDirectory(vw, rec, False, fLong)
  63. End Function ' ResolveDirectoryTargetPath
  64. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  65. ' widir_ResolveDirectory
  66. Function widir_ResolveDirectory(vw, rec, fSource, fLong)
  67. Dim sDir, sPath, sTemp
  68. sPath = Empty
  69. Do
  70. sDir = rec.StringData(1)
  71. vw.Execute rec
  72. Set rec = vw.Fetch
  73. If rec Is Nothing Then Exit Do
  74. If Not fSource Then
  75. Select Case rec.StringData(1)
  76. Case "ProgramFilesFolder" : sPath = "PFILES\" & sPath : Exit Do
  77. Case "WindowsFolder" : sPath = "WIN\" & sPath : Exit Do
  78. Case "SystemFolder" : sPath = "SYS\" & sPath : Exit Do
  79. Case "System16Folder" : sPath = "Sys16\" & sPath : Exit Do
  80. End Select
  81. End If
  82. sTemp = GetDefaultDir(rec.StringData(2), fSource, fLong)
  83. If 0 < Len(sTemp) And "." <> sTemp Then sPath = sTemp & "\" & sPath
  84. Loop While (0 < Len(rec.StringData(1)))
  85. widir_ResolveDirectory = sPath
  86. End Function ' widir_ResolveDirectory
  87. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  88. ' GetDefaultDir
  89. Function GetDefaultDir(ByVal s, fSource, fLong)
  90. Dim a
  91. a = Split(s, ":")
  92. If fSource And 1 = UBound(a) Then s = Split(a(1), "|") Else s = Split(a(0), "|")
  93. If fLong And 1 = UBound(s) Then GetDefaultDir = s(1) Else GetDefaultDir = s(0)
  94. End Function ' GetDefaultDir