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.

403 lines
13 KiB

  1. [Identification]
  2. OptionType = NetService
  3. [Options]
  4. DFS
  5. [FileConstants]
  6. Manufacturer = "Microsoft"
  7. ProductMajorVersion = "4"
  8. ProductMinorVersion = "0"
  9. ProductVersion = $(ProductMajorVersion)"."$(ProductMinorVersion)
  10. ProductDfsName = "Dfs"
  11. ProductDfsDisplayName = "Distributed File System"
  12. ProductDfsImagePath = "%SystemRoot%\System32\dfssvc.exe"
  13. ProductDfsSvcType = "serviceauto"
  14. ProductGroup = "Administrative Tools"
  15. DfsAdminName = "Dfs Administrator"
  16. [GeneralConstants]
  17. UtilityInf = "UTILITY.INF"
  18. subroutineinf = "SUBROUTN.INF"
  19. Exit_Code = 0
  20. BillboardVisible = 0
  21. ProCaption = "Microsoft Distributed File System"
  22. ProCancel = "Cancel"
  23. ProCancelMsg = "The Distributed File System is not correctly installed. "+
  24. "Are you sure you want to cancel copying files?"
  25. ProCancelCap = "Network Setup Message"
  26. ProText1 = "Copying:"
  27. ProText2 = "To:"
  28. from = ""
  29. to = ""
  30. ExitCodeOk = 0
  31. ExitCodeCancel = 1
  32. ExitCodeFatal = 2
  33. KeyNull = ""
  34. RegistryErrorIndex = NO_ERROR
  35. KeyProduct = ""
  36. KeyParameters = ""
  37. TRUE = 1
  38. FALSE = 0
  39. NoTitle = 0
  40. ExitState = "Active"
  41. OldVersionExisted = $(FALSE)
  42. [date]
  43. Now = {} ? $(!LIBHANDLE) GetSystemDate
  44. [Identify]
  45. read-syms Identification
  46. set Status = STATUS_SUCCESSFUL
  47. set Identifier = $(OptionType)
  48. set Media = #("Source Media Descriptions", 1, 1)
  49. Return $(Status) $(Identifier) $(Media)
  50. [ReturnOptions]
  51. set Status = STATUS_SUCCESSFUL
  52. set OptionList = {"DFS"}
  53. set OptionTextList = {"Distributed File System"}
  54. Return $(Status) $(OptionList) $(OptionTextList)
  55. [InstallOption]
  56. set Option = $($1)
  57. set SrcDir = $($2)
  58. set AddCopy = $($3)
  59. set DoCopy = $($4)
  60. set DoConfig = $($5)
  61. Debug-Output "OEMNSVDF.INF: STF_CWDIR is: "$(!STF_CWDIR)
  62. Debug-Output "OEMNSVDF.INF: STF_LANGUAGE is: "$(!STF_LANGUAGE)
  63. set-subst LF = "\n"
  64. read-syms GeneralConstants
  65. read-syms FileConstants
  66. ifstr(i) $(!NTN_Origination) == "NCPA"
  67. set Continue = $(OK)
  68. endif
  69. detect date
  70. set-title $(FunctionTitle)
  71. set to = Begin
  72. set from = Begin
  73. set CommonStatus = STATUS_REBOOT
  74. EndWait
  75. Begin = +
  76. Ifstr(i) $(!NTN_InstallMode) == deinstall
  77. set StartLabel = removeadapter
  78. else-Ifstr(i) $(!NTN_InstallMode) == Update
  79. set StartLabel = UpgradeSoftware
  80. else-Ifstr(i) $(!NTN_InstallMode) == configure
  81. set StartLabel = configureadapter
  82. Ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)
  83. Debug-Output "Cannot configure the software."
  84. Shell $(UtilityInf),RegistryErrorString,CANNOT_CONFIGURE_SOFTWARE
  85. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  86. Debug-Output "ShellCode error: cannot get an error string."
  87. goto ShellCodeError
  88. endif
  89. set Error = $($R0)
  90. set from = end
  91. set to = end
  92. goto nonfatalinfo
  93. endif
  94. else-Ifstr(i) $(!NTN_InstallMode) == bind
  95. set StartLabel = bindingadapter
  96. else
  97. set StartLabel = installadapter
  98. endif
  99. set from = $(fatal)
  100. set to = $(fatal)
  101. goto $(StartLabel)
  102. installadapter = +
  103. Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir) NO
  104. Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  105. Goto ShellCodeError
  106. Else-Ifstr(i) $($R0) == STATUS_FAILED
  107. Shell $(UtilityInf) RegistryErrorString "ASK_SOURCE_FAIL"
  108. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  109. goto ShellCodeError
  110. endif
  111. set Error = $($R0)
  112. Goto fatal
  113. Else-Ifstr(i) $($R0) == STATUS_USERCANCEL
  114. Goto successful
  115. Endif
  116. Set SrcDir = $($R1)
  117. OpenRegKey $(!REG_H_LOCAL) "" "SOFTWARE\Microsoft\Windows NT\CurrentVersion" 33554432 KeyCurrentVersion
  118. ifstr(i) $(KeyCurrentVersion) != ""
  119. GetRegValue $(KeyCurrentVersion), "CurrentBuildNumber", BuildNum
  120. CloseRegKey $(KeyCurrentVersion)
  121. set Build = *($(BuildNum),4)
  122. debug-output "Nt build = "$(Build)
  123. ifint $(Build) < 1381
  124. goto invalidbuild
  125. endif
  126. else
  127. goto fatalregistry
  128. endif
  129. ifstr(i) $(!NTN_InstallMode) == "install"
  130. Debug-Output "OEMNSVDF.INF: installadapter: installing [Install-Option]"
  131. install "Install-Option"
  132. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  133. Shell $(UtilityInf) RegistryErrorString "UNABLE_COPY_FILE"
  134. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  135. goto ShellCodeError
  136. endif
  137. set Error = $($R0)
  138. goto fatal
  139. endif
  140. endif
  141. set OEM_ABANDON_ON = TRUE
  142. StartWait
  143. LoadLibrary "" dfssetup.dll DfsSetupLib
  144. LibraryProcedure InstallStatus $(DfsSetupLib) DfsSetupDfs
  145. FreeLibrary $(DfsSetupLib)
  146. Shell $(UtilityInf), AddSoftwareComponent, $(Manufacturer),+
  147. $(ProductDfsName),+
  148. $(ProductDfsName),+
  149. $(ProductDfsDisplayName), $(STF_CONTEXTINFNAME),+
  150. $(ProductDfsImagePath),+
  151. $(ProductDfsSvcType),+
  152. "NetworkProvider", {"DfsDriver", "Mup", "LanmanWorkstation", "LanmanServer"}, "",+
  153. "", "", "", "", "", ""
  154. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  155. Debug-Output "OEMNSVDF.INF: ShellCode error, add software component"
  156. goto ShellCodeError
  157. endif
  158. set RegistryErrorIndex = $($R0)
  159. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  160. EndWait
  161. Debug-Output "OEMNSVDF.INF: Registry error: add software components"
  162. goto fatalregistry
  163. endif
  164. set DfsVersKeyHandle = $($R1)
  165. set DfsNetRulesKeyHandle = $($R2)
  166. CloseRegKey $($R3)
  167. CloseRegKey $($R4)
  168. CloseRegKey $($R5)
  169. set NewValueList = {{SoftwareType,$(NoTitle),$(!REG_VT_SZ),"service"},+
  170. {MajorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMajorVersion)},+
  171. {MinorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMinorVersion)},+
  172. {Title,$(NoTitle),$(!REG_VT_SZ),$(ProductDfsDisplayName)},+
  173. {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductDfsDisplayName)},+
  174. {ServiceName,$(NoTitle),$(!REG_VT_SZ),$(ProductDfsName)},+
  175. {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}}
  176. Shell $(UtilityInf), AddValueList, $(DfsVersKeyHandle), $(NewValueList)
  177. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  178. Debug-Output "OEMNSVDF.INF: ShellCode error, add value list"
  179. goto ShellCodeError
  180. endif
  181. set RegistryErrorIndex = $($R0)
  182. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  183. EndWait
  184. Debug-Output "OEMNSVDF.INF: Registry error: add value list."
  185. CloseRegKey $(DfsVersKeyHandle)
  186. CloseRegKey $(DfsNetRulesKeyHandle)
  187. goto fatalregistry
  188. Endif
  189. set NewValueList = {{InfOption,$(NoTitle),$(!REG_VT_SZ),$(Option)}}
  190. Shell $(UtilityInf), AddValueList, $(DfsNetRulesKeyHandle), $(NewValueList)
  191. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  192. Debug-Output "ShellCode error."
  193. goto ShellCodeError
  194. endif
  195. set RegistryErrorIndex = $($R0)
  196. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  197. EndWait
  198. Debug-Output "OEMNXPTC.INF: Registry error: add value list."
  199. CloseRegKey $(DfsVersKeyHandle)
  200. CloseRegKey $(DfsNetRulesKeyHandle)
  201. goto fatalregistry
  202. Endif
  203. CloseRegKey $(DfsVersKeyHandle)
  204. CloseRegKey $(DfsNetRulesKeyHandle)
  205. LoadLibrary "" dfssetup.dll DfsSetupLib
  206. LibraryProcedure ConfigureResult $(DfsSetupLib) DfsSetupConfigure $(!STF_HWND)
  207. FreeLibrary $(DfsSetupLib)
  208. EndWait
  209. install Install-DFSAdmin-Icon
  210. goto successful
  211. configureadapter = +
  212. LoadLibrary "" dfssetup.dll DfsSetupLib
  213. LibraryProcedure ConfigureResult $(DfsSetupLib) DfsSetupConfigure $(!STF_HWND)
  214. Ifstr(i) $(ConfigureResult) == Cancel
  215. Debug-Output "OEMNSVDF.INF: Configuration Cancelled"
  216. set CommonStatus = STATUS_USERCANCEL
  217. Else-Ifstr(i) $(ConfigureResult) == Reboot
  218. Debug-Output "OEMNSVDF.INF: Configuration complete - Reboot required"
  219. set CommonStatus = STATUS_REBOOT
  220. Endif
  221. FreeLibrary $(DfsSetupLib)
  222. goto end
  223. bindingadapter =+
  224. goto end
  225. removeadapter = +
  226. DeleteRegTree $(!REG_H_LOCAL) "Software\Microsoft\DfsHost"
  227. DeleteRegTree $(!REG_H_LOCAL) "System\CurrentControlSet\Services\DfsDriver"
  228. Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer), $(ProductDfsName)
  229. install Remove-DFSAdmin-Icon
  230. set CommonStatus = STATUS_SUCCESSFUL
  231. goto end
  232. UpgradeSoftware = +
  233. install "Install-Update"
  234. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  235. goto fatal
  236. endif
  237. install Install-DFSAdmin-Icon
  238. goto end
  239. successful = +
  240. goto end
  241. infomsg =+
  242. read-syms InfoDlg
  243. ui start "Warning"
  244. set CommonStatus = STATUS_USERCANCEL
  245. goto end
  246. warning = +
  247. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "WARNING", $(Error)
  248. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  249. goto ShellCodeError
  250. endif
  251. ifstr(i) $($R1) == "OK"
  252. goto $(to)
  253. else-ifstr(i) $($R1) == "CANCEL"
  254. goto $(from)
  255. else
  256. goto "end"
  257. endif
  258. nonfatalinfo = +
  259. Set CommonStatus = STATUS_USERCANCEL
  260. Set Severity = STATUS
  261. goto nonfatalmsg
  262. nonfatal = +
  263. Set Severity = NONFATAL
  264. goto nonfatalmsg
  265. nonfatalmsg = +
  266. ifstr(i) $(Error) == ""
  267. Set Severity = NONFATAL
  268. Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  269. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  270. goto ShellCodeError
  271. endif
  272. set Error = $($R0)
  273. endif
  274. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), $(Severity), $(Error)
  275. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  276. goto ShellCodeError
  277. endif
  278. ifstr(i) $($R1) == "OK"
  279. goto $(from)
  280. else
  281. goto "end"
  282. endif
  283. fatalregistry = +
  284. Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
  285. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  286. goto ShellCodeError
  287. endif
  288. set Error = $($R0)
  289. goto fatal
  290. fatal = +
  291. ifstr(i) $(Error) == ""
  292. Shell $(UtilityInf) RegistryErrorString "SETUP_FAIL"
  293. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  294. goto ShellCodeError
  295. endif
  296. set Error = $($R0)
  297. endif
  298. Ifint $(BillboardVisible) != 0
  299. Shell "subroutn.inf" PopBillboard
  300. Set BillboardVisible = 0
  301. Endif
  302. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
  303. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  304. goto ShellCodeError
  305. endif
  306. goto setfailed
  307. ShellCodeError = +
  308. set DlgType = "MessageBox"
  309. set STF_MB_TITLE = $(ShellCodeErrorTitle)
  310. set STF_MB_TEXT = $(ShellCodeErrorText)
  311. set STF_MB_TYPE = 1
  312. set STF_MB_ICON = 3
  313. set STF_MB_DEF = 1
  314. ui start "Error Message"
  315. goto setfailed
  316. invalidproducttype = +
  317. set DlgType = "MessageBox"
  318. set STF_MB_TITLE = "Microsoft Distributed File System"
  319. set STF_MB_TEXT = "This product can only be installed on a Windows NT Advanced Server (TM)"
  320. set STF_MB_TYPE = 1
  321. set STF_MB_ICON = 3
  322. set STF_MB_DEF = 1
  323. ui start "Error Message"
  324. goto setfailed
  325. invalidbuild = +
  326. set DlgType = "MessageBox"
  327. set STF_MB_TITLE = "Microsoft Distributed File System"
  328. set STF_MB_TEXT = "The operating system version is too old."
  329. set STF_MB_TYPE = 1
  330. set STF_MB_ICON = 3
  331. set STF_MB_DEF = 1
  332. ui start "Error Message"
  333. goto setfailed
  334. setfailed = +
  335. set CommonStatus = STATUS_FAILED
  336. ifstr(i) $(OEM_ABANDON_ON) == TRUE
  337. set OEM_ABANDON_ON = FALSE
  338. goto removeadapter
  339. endif
  340. goto end
  341. end = +
  342. goto term
  343. term = +
  344. Return $(CommonStatus)
  345. [GetFilesSize]
  346. set FileSizeList = ^(Files-DFS,3)
  347. set TotalSize = 0
  348. ForListDo $(FileSizeList)
  349. Split-String $($) "=" SplitString
  350. set Size = *($(SplitString),3)
  351. set-add TotalSize = $(TotalSize) $(Size)
  352. EndForListDo
  353. set-div SizeInK = $(TotalSize) 1024
  354. return $(SizeInK)
  355. [Install-Option]
  356. set STF_VITAL = ""
  357. ifstr(i) $(AddCopy) == "YES"
  358. AddSectionFilesToCopyList Files-DFS $(SrcDir) $(!STF_WINDOWSSYSPATH)
  359. AddSectionFilesToCopyList Files-DFSDRV $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
  360. endif
  361. ifstr(i) $(DoCopy) == "YES"
  362. set !STF_NCPA_FLUSH_COPYLIST = TRUE
  363. CopyFilesInCopyList
  364. endif
  365. ifstr(i) $(DoConfig) == "YES"
  366. endif
  367. Exit
  368. [Install-Update]
  369. set STF_VITAL = ""
  370. set STF_OVERWRITE = "ALWAYS"
  371. AddSectionFilesToCopyList Files-DFS $(SrcDir) $(!STF_WINDOWSSYSPATH)
  372. AddSectionFilesToCopyList Files-DFSDRV $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
  373. set !STF_NCPA_FLUSH_COPYLIST = TRUE
  374. CopyFilesInCopyList
  375. Exit
  376. [Install-DFSAdmin-Icon]
  377. CreateCommonProgManGroup $(ProductGroup) ""
  378. ShowCommonProgManGroup $(ProductGroup), 1
  379. RemoveCommonProgManItem $(ProductGroup), $(DfsAdminName)
  380. CreateCommonProgManItem $(ProductGroup), $(DfsAdminName) "dfsadmin.exe" "dfsadmin.exe" ""
  381. Exit
  382. [Remove-DFSAdmin-Icon]
  383. RemoveCommonProgManItem $(ProductGroup), $(DfsAdminName)
  384. Exit
  385. [Source Media Descriptions]
  386. 1 = "Microsoft Distributed File System CD-ROM", TAGFILE = dfs.s
  387. [Signature]
  388. FileType = MICROSOFT_FILE
  389. [GetSignature]
  390. read-syms Signature
  391. return $(FileType)
  392. [Files-Inf]
  393. 2, oemsetup.inf, SIZE=1000, RENAME=$(!UG_Filename)
  394. [Files-DFS]
  395. 1,DFSADMIN.CNT, SIZE=999
  396. 1,DFSADMIN.EXE, SIZE=999
  397. 1,DFSADMIN.HLP, SIZE=999
  398. 1,DFSCMD.EXE, SIZE=999
  399. 1,DFSINIT.EXE, SIZE=999
  400. 1,DFSSETUP.DLL, SIZE=999
  401. 1,DFSSVC.EXE, SIZE=999
  402. [Files-DFSDRV]
  403. 1,DFS.SYS, SIZE=999