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.

544 lines
13 KiB

  1. ;***********************************************************************
  2. ;
  3. ; NETDTECT.INF
  4. ;
  5. ; Install Netcard Detection Driver
  6. ;
  7. ;***********************************************************************
  8. ;-----------------------------------------------------------------------
  9. ; OPTION TYPE
  10. ; -----------
  11. ; This identifies the Option type we are dealing with. The different
  12. ; possible types are:
  13. ;
  14. ; COMPUTER, DISPLAY, MOUSE, KEYBOARD, LAYOUT, SCSI, PRINTER, ...
  15. ;
  16. ; Types specific to networking:
  17. ;
  18. ; NetAdapter, a netcard / adapter combination or just a netcard
  19. ; NetDriver, just a netcard driver
  20. ; NetTransport, a complete NDIS-compliant TDI transport stack
  21. ; NetService, an NT networking service
  22. ; NetWork, a complete network ensemble.
  23. ; NetProvider a complete network which supports NT MPR protocol
  24. ;-----------------------------------------------------------------------
  25. [Identification]
  26. OptionType = NetDriver
  27. ;-----------------------------------------------------------------------
  28. ; OPTION LIST
  29. ; -----------
  30. ; This section lists the OEM Option key names. These keys are locale
  31. ; independent and used to represent the option in a locale independent
  32. ; manner.
  33. ;
  34. ;-----------------------------------------------------------------------
  35. [Options]
  36. NCDETECT
  37. ;***********************************************************************
  38. ; CONSTANTS FOR USING DIALOGS
  39. ;***********************************************************************
  40. [FileConstants]
  41. ;
  42. ; File names, etc.
  43. ;
  44. UtilityInf = "UTILITY.INF"
  45. subroutineinf = "SUBROUTN.INF"
  46. SoftwareType = "driver"
  47. Exit_Code = 0
  48. ;ShellCode = 0
  49. [GeneralConstants]
  50. ;
  51. ; Program flow control variables.
  52. ;
  53. from = ""
  54. to = ""
  55. ;
  56. ; Return codes; Exit_Code is set to one of these
  57. ;
  58. ExitCodeOk = 0
  59. ExitCodeCancel = 1
  60. ExitCodeFatal = 2
  61. KeyNull = ""
  62. MAXIMUM_ALLOWED = 33554432
  63. RegistryErrorIndex = NO_ERROR
  64. KeyProduct = ""
  65. KeyParameters = ""
  66. TRUE = 1
  67. FALSE = 0
  68. NoTitle = 0
  69. ExitState = "Active"
  70. OldVersionExisted = $(FALSE)
  71. DriverPath = $(!STF_NTPATH)\drivers
  72. ServiceKeyName = "NetDetect"
  73. ServiceKeyPath = "System\CurrentControlSet\Services\NcDetect"
  74. ServiceSysPath = "%SystemRoot%\System32\Drivers\netdtect.sys"
  75. ;---------------------------------------------------------------------------
  76. ; 1. Identify
  77. ;
  78. ; DESCRIPTION: To verify that this INF deals with the same type of options
  79. ; as we are choosing currently.
  80. ;
  81. ; INPUT: None
  82. ;
  83. ; OUTPUT: $($R0): STATUS: STATUS_SUCCESSFUL
  84. ; $($R1): Option Type (COMPUTER ...)
  85. ; $($R2): Diskette description
  86. ;---------------------------------------------------------------------------
  87. [Identify]
  88. ;
  89. ;
  90. read-syms Identification
  91. set Status = STATUS_SUCCESSFUL
  92. set Identifier = $(OptionType)
  93. set Media = #("Source Media Descriptions", 1, 1)
  94. Return $(Status) $(Identifier) $(Media)
  95. ;------------------------------------------------------------------------
  96. ; 2. ReturnOptions:
  97. ;
  98. ; DESCRIPTION: To return the option list supported by this INF and the
  99. ; localised text list representing the options.
  100. ;
  101. ;
  102. ; INPUT: $($0): Language used. ( ENG | FRN | ... )
  103. ;
  104. ; OUTPUT: $($R0): STATUS: STATUS_SUCCESSFUL |
  105. ; STATUS_NOLANGUAGE
  106. ; STATUS_FAILED
  107. ;
  108. ; $($R1): Option List
  109. ; $($R2): Option Text List
  110. ;------------------------------------------------------------------------
  111. [ReturnOptions]
  112. ;
  113. ;
  114. set Status = STATUS_FAILED
  115. set OptionList = {}
  116. set OptionTextList = {}
  117. ;
  118. ; Check if the language requested is supported
  119. ;
  120. set LanguageList = ^(LanguagesSupported, 1)
  121. Ifcontains(i) $($0) in $(LanguageList)
  122. goto returnoptions
  123. else
  124. set Status = STATUS_NOLANGUAGE
  125. goto finish_ReturnOptions
  126. endif
  127. ;
  128. ; form a list of all the options and another of the text representing
  129. ;
  130. returnoptions = +
  131. set OptionList = ^(Options, 1)
  132. set OptionTextList = ^(OptionsText$($0), 1)
  133. set Status = STATUS_SUCCESSFUL
  134. finish_ReturnOptions = +
  135. Return $(Status) $(OptionList) $(OptionTextList)
  136. ;----------InstallOption-------------------------------------------------
  137. ;
  138. ; InstallOption:
  139. ;
  140. ; This section is shelled to by main installation processing
  141. ; or by NCPASHEL.INF during reconfig, removal, update, etc.
  142. ;
  143. ;
  144. ; FUNCTION: To copy files representing Options
  145. ; To configure the installed option
  146. ; To update the registry for the installed option
  147. ;
  148. ; INPUT: $($0): Language to use
  149. ; $($1): OptionID to install
  150. ; $($2): SourceDirectory
  151. ; $($3): AddCopy (YES | NO)
  152. ; $($4): DoCopy (YES | NO)
  153. ; $($5): DoConfig (YES | NO)
  154. ;
  155. ; OUTPUT: $($R0): STATUS: STATUS_SUCCESSFUL |
  156. ; STATUS_NOLANGUAGE |
  157. ; STATUS_USERCANCEL |
  158. ; STATUS_FAILED
  159. ;
  160. ;------------------------------------------------------------------------
  161. [InstallOption]
  162. ;
  163. ; extract parameters
  164. ;
  165. set Option = $($1)
  166. set SrcDir = $($2)
  167. set AddCopy = $($3)
  168. set DoCopy = $($4)
  169. set DoConfig = $($5)
  170. ;
  171. ; Check if the language requested is supported
  172. ;
  173. set LanguageList = ^(LanguagesSupported, 1)
  174. Ifcontains(i) $($0) NOT-IN $(LanguageList)
  175. Return STATUS_NOLANGUAGE
  176. endif
  177. ; define all the constants
  178. set-subst LF = "\n"
  179. read-syms GeneralConstants
  180. read-syms FileConstants
  181. read-syms DialogConstants$(!STF_LANGUAGE)
  182. read-syms FileConstants$(!STF_LANGUAGE)
  183. set-title $(FunctionTitle)
  184. set to = Begin
  185. set from = Begin
  186. ;
  187. ; Assume all is well.
  188. ;
  189. set CommonStatus = STATUS_SUCCESSFUL
  190. EndWait
  191. ;
  192. ; Set up the operation-mode-based variables and gaily welcome
  193. ; the user. If the "install mode" variable is improperly set,
  194. ; assume this is a new installation.
  195. ;
  196. Begin = +
  197. Ifstr(i) $(!NTN_InstallMode) == deinstall
  198. set StartLabel = removeadapter
  199. else-Ifstr(i) $(!NTN_InstallMode) == update
  200. set StartLabel = UpgradeSoftware
  201. else-Ifstr(i) $(!NTN_InstallMode) == bind
  202. set StartLabel = bindingadapter
  203. else-Ifstr(i) $(!NTN_InstallMode) == configure
  204. set StartLabel = configureadapter
  205. ;
  206. ; You cannot config the software component
  207. ;
  208. Ifstr(i) $(ProductKeyName) == $(!NTN_RegBase)
  209. Shell $(UtilityInf),RegistryErrorString,CANNOT_CONFIGURE_SOFTWARE
  210. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  211. Debug-Output "ShellCode error: cannot get an error string."
  212. goto ShellCodeError
  213. endif
  214. set Error = $($R0)
  215. set from = end
  216. set to = end
  217. goto Warning
  218. endif
  219. else
  220. set StartLabel = installadapter
  221. endif
  222. set from = $(fatal)
  223. set to = $(fatal)
  224. goto $(StartLabel)
  225. ;-----------------------------------------------
  226. ; Installation Section
  227. ;-----------------------------------------------
  228. installadapter = +
  229. OpenRegKey $(!REG_H_LOCAL) "" $(ServiceKeyPath) $(MAXIMUM_ALLOWED) KeyService
  230. Ifstr $(KeyProduct) != $(KeyNull)
  231. ;
  232. ; Same version already existed in the local machine
  233. ; Popup the dialog and ask the user whether he wants to continue
  234. ;
  235. CloseRegKey $(KeyService)
  236. Shell $(UtilityInf), VerExistedDlg, $(ProductSoftwareTitle),+
  237. $(ProductVersion)
  238. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  239. Debug-Output "ShellCode error: cannot get an error string."
  240. goto ShellCodeError
  241. endif
  242. goto end
  243. endif
  244. goto nextstep
  245. ;-----------------------------------------------
  246. ; Configuration Section
  247. ;-----------------------------------------------
  248. configureadapter = +
  249. ;
  250. ; we should delete the old data here
  251. ;
  252. set OldVersionExisted = $(TRUE )
  253. goto nextstep
  254. ;
  255. ; If installing, go create the necessary keys;
  256. ; if configuring, they're already open.
  257. ;
  258. nextstep = +
  259. StartWait
  260. ;
  261. ; For now, there are no new files to copy
  262. ;
  263. Goto nofilestocopy
  264. ifstr(i) $(!NTN_InstallMode) == "install"
  265. Ifstr(i) $(DoCopy) == "YES"
  266. Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir) YES
  267. Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  268. Goto fatal
  269. Else-Ifstr(i) $($R0) == STATUS_FAILED
  270. Goto fatal
  271. Else-Ifstr(i) $($R0) == STATUS_USERCANCEL
  272. Goto successful
  273. Endif
  274. Set SrcDir = $($R1)
  275. Endif
  276. install "Install-Option"
  277. ifstr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
  278. goto fatal
  279. endif
  280. endif
  281. nofilestocopy =+
  282. Ifint $(OldVersionExisted) != $(FALSE)
  283. Goto writeparameters
  284. Endif
  285. set OEM_ABANDON_ON = TRUE
  286. ;
  287. ; Check for error so far, then create services
  288. ;
  289. createservice =+
  290. ;
  291. ; Create the NETDTECT service.
  292. ;
  293. Shell $(UtilityInf), CreateService, $(ServiceKeyName), $(ServiceDisplayName),+
  294. $(ServiceSysPath), "kernel", "", {}, "", "%SystemRoot%\System32\IoLogMsg.dll"
  295. Ifint $($ShellCode) != $(!SHELL_CODE_OK)
  296. Debug-Output "OEMNSVRP.INF: ShellCode error creating NETDTECT service"
  297. goto ShellCodeError
  298. endif
  299. Set RegistryErrorIndex = $($R0)
  300. CloseRegKey $($R1)
  301. CloseRegKey $($R2)
  302. CloseRegKey $($R3)
  303. Ifstr(i) $(RegistryErrorIndex) != NO_ERROR
  304. EndWait
  305. Debug-Output "OEMNSVRD.INF: Registry error: creating NETDTECT service"
  306. CloseRegKey $($R2)
  307. Goto fatalregistry
  308. Endif
  309. ;
  310. ; Create or update the NetcardDlls value
  311. ;
  312. Shell $(UtilityInf) UpdateDetectionDllNames
  313. writeparameters = +
  314. EndWait
  315. goto successful
  316. ;-----------------------------------------------
  317. ; Binding section
  318. ;-----------------------------------------------
  319. bindingadapter =+
  320. set Error = "RPC INF file invoked during bindings review."
  321. goto fatal
  322. ;-----------------------------------------------
  323. ; Removeadapter section
  324. ;-----------------------------------------------
  325. removeadapter = +
  326. ;
  327. ; Remove NETDETECT service
  328. ;
  329. Set OEM_ABANDON_OPTIONS = {$(ServiceKeyName)}
  330. ForListDo $(OEM_ABANDON_OPTIONS)
  331. debug-output "OEMNSVRP.INF: Remove component: "$($)
  332. Shell $(UtilityInf), RemoveService, $($), $(UseSvcctrl)
  333. EndForListDo
  334. goto end
  335. ;-----------------------------------------------
  336. ; Upgrade Software section
  337. ;-----------------------------------------------
  338. UpgradeSoftware = +
  339. set Error = "Upgrade/update not supported for this product yet."
  340. goto fatal
  341. ;
  342. ; Escape hatches
  343. ;
  344. successful = +
  345. goto end
  346. ;
  347. ; warning display
  348. ;
  349. warning = +
  350. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), STATUS, $(Error)
  351. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  352. goto ShellCodeError
  353. endif
  354. ifstr(i) $($R1) == "OK"
  355. goto $(to)
  356. else-ifstr(i) $($R1) == "CANCEL"
  357. goto $(from)
  358. else
  359. ; Debug-Msg "Error Error Bad DLGEVENT"
  360. goto "end"
  361. endif
  362. ;
  363. ; non fatal error display
  364. ;
  365. nonfatal = +
  366. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "NONFATAL", $(Error)
  367. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  368. goto ShellCodeError
  369. endif
  370. ifstr(i) $($R1) == "OK"
  371. goto $(from)
  372. else
  373. goto "end"
  374. endif
  375. ;
  376. ; Registry is broken
  377. ;
  378. fatalregistry = +
  379. Shell $(UtilityInf) RegistryErrorString $(RegistryErrorIndex)
  380. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  381. goto ShellCodeError
  382. endif
  383. set Error = $($R0)
  384. goto fatal
  385. ;
  386. ; fatal error display
  387. ;
  388. fatal = +
  389. Shell $(subroutineinf) SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
  390. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  391. goto ShellCodeError
  392. endif
  393. goto setfailed
  394. ;
  395. ; Shelling error
  396. ;
  397. ShellCodeError = +
  398. set DlgType = "MessageBox"
  399. set STF_MB_TITLE = $(ShellCodeErrorTitle)
  400. set STF_MB_TEXT = $(ShellCodeErrorText)
  401. set STF_MB_TYPE = 1
  402. set STF_MB_ICON = 3
  403. set STF_MB_DEF = 1
  404. ui start "Error Message"
  405. goto setfailed
  406. setfailed = +
  407. set CommonStatus = STATUS_FAILED
  408. ;
  409. ; If OEM_ABANDON_ON, we need to clean up the registry
  410. ;
  411. ifstr(i) $(OEM_ABANDON_ON) == TRUE
  412. set OEM_ABANDON_ON = FALSE
  413. goto removeadapter
  414. endif
  415. goto end
  416. end = +
  417. goto term
  418. term = +
  419. Return $(CommonStatus)
  420. ;***************************************************************
  421. ; INSTALL SECTIONS
  422. ;***************************************************************
  423. [Install-Option]
  424. set STF_VITAL = ""
  425. ifstr(i) $(AddCopy) == "YES"
  426. ;
  427. ; Add the files to the copy list
  428. ;
  429. ; BUGBUG: eliminate the "nt2" in the next line when Sunil fixes
  430. ; the other INF files
  431. ;
  432. AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
  433. endif
  434. ifstr(i) $(DoCopy) == "YES"
  435. ;
  436. ; Copy files in the copy list
  437. ;
  438. CopyFilesInCopyList
  439. endif
  440. ifstr(i) $(DoConfig) == "YES"
  441. ;
  442. ; Add product to registry
  443. ;
  444. ;
  445. ; Finish up
  446. endif
  447. Exit
  448. [Install-Update]
  449. set STF_VITAL = ""
  450. set STF_OVERWRITE = "VERIFYSOURCEOLDER"
  451. ;set STF_VERSION = "YES"
  452. AddSectionFilesToCopyList Files-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)\drivers
  453. AddSectionFilesToCopyList Files-DLL-$(Option) $(SrcDir) $(!STF_WINDOWSSYSPATH)
  454. CopyFilesInCopyList
  455. exit