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.

952 lines
33 KiB

  1. ;============================================================================
  2. ;============================================================================
  3. ;
  4. ; NCPARAM.INF Netcard Detection Parameter handling routines
  5. ;
  6. ;============================================================================
  7. ; SECTION 1: Overview and description of variables.
  8. ;============================================================================
  9. ;
  10. ; This file is "shelled" to by OEMNxxyy.INF files to facilitate
  11. ; and generalize the handling of netcard detection, defaulted
  12. ; and detected parameter handling and parameter verification.
  13. ;
  14. ; These routines are based upon several precursors. This section
  15. ; documents all key information about netcard detection and
  16. ; the requirements necessary to use the routines in this file.
  17. ;
  18. ; 1) The document NCDETECT.DOC describes the detection
  19. ; driver, DLLs and the interfaces provided by them.
  20. ;
  21. ; 2) Netcard detection DLLs are registered in the Registry
  22. ; under HKEY_LOCAL_MACHINE\System\Setup, NetcardDlls,
  23. ; which is a REG_MULTI_SZ. The standard Microsoft DLL,
  24. ; MSNCDET.DLL, should be first in this list.
  25. ;
  26. ; 3) The netcard detection driver, NETDTECT.SYS, is installed
  27. ; as the NETDETECT service. he driver interface DLL,
  28. ; NETDTECT.DLL, interfaces to the driver.
  29. ;
  30. ; 4) The file NETDTECT.INF installs the NETDETECT service
  31. ; and updates the "NetcardDlls" value. In other words,
  32. ; it performs steps 3 and 4 above.
  33. ;
  34. ; The files MSNCDET.DLL, NETDETCT.DLL and NETDETCT.SYS
  35. ; must be in the minimum boot tree during main installation.
  36. ;
  37. ; 5) During main installation, NTLANMAN.INF shells to NETDTECT.INF
  38. ; to install the NETDETECT service, which it then starts.
  39. ;
  40. ; 6) During main installation, NTLANMAN.INF shells to OEMHOOK.INF
  41. ; so that additional OEM netcard detection DLLs can be
  42. ; properly registred.
  43. ;
  44. ; 7) NCPA.CPL exports wrapper functions through the generic
  45. ; SETUP-to-NCPA function CPlSetup(). These functions are:
  46. ;
  47. ; DTSTART Activate the NETDETECT service
  48. ; and instantiate the C++ objects
  49. ; required for support of detection.
  50. ;
  51. ; DTEND Stop detection and discard the objects.
  52. ; The NETDETECT service is not stopped.
  53. ;
  54. ; DTRESET Reset enumeration across buses, etc.
  55. ; Also discards all previous detected
  56. ; netcard information.
  57. ;
  58. ; DTPARAMS Return netcard parameter information about
  59. ; a particular netcard option.
  60. ;
  61. ; DTCARD Attempt to detect a card. This is a
  62. ; first-next enumeration routine. After
  63. ; it reports failure, it calls DTRESET
  64. ; internally to restart enumeration. If
  65. ; successful, it returns the option name
  66. ; of the detected card and a numeric
  67. ; index representing the card.
  68. ;
  69. ; DTQUERY Return detected parameters from a netcard
  70. ; reported by DTCARD.
  71. ;
  72. ; DTVERIFY Validate chosen netcard parameteres for a
  73. ; netcard reported by DTCARD.
  74. ;
  75. ;
  76. ; 8) Several new global INF variables are used for netcard
  77. ; detection:
  78. ;
  79. ; STF_NCDETECT = {YES|NO}
  80. ;
  81. ; This controls the use of detection in
  82. ; NTLANMAN.INF and all other INFs. If
  83. ; "NO", no use of the detection
  84. ; services is made.
  85. ;
  86. ; STF_INSTALL_MODE = {CUSTOM|EXPRESS}
  87. ;
  88. ; This is not new a new variable, but is
  89. ; a key factor in the UI presented.
  90. ;
  91. ; STF_NCDETCARD = 0,1,2, etc.
  92. ;
  93. ; This is an integer representing a
  94. ; detected card. The actual structures
  95. ; are maintained by ncpa!CPlSetup().
  96. ;
  97. ; STF_NCOPTION = OPTIONNAME (e.g., DE201)
  98. ;
  99. ; This is the name of the netcard option
  100. ; which has been detected.
  101. ;
  102. ; STF_NCDETINFO = INF list containing data about the
  103. ; detected card; it has the form:
  104. ;
  105. ; { OPTIONNAME,
  106. ; <card index>,
  107. ; <numeric card type>,
  108. ; <detection confidence level>,
  109. ; <bus interface type>,
  110. ; <bus number>
  111. ; }
  112. ;
  113. ; All values except OPTIONNAME are numeric.
  114. ; See NCDETECT.DOC for further details.
  115. ;
  116. ; STF_NC_PARAMS = INF list describing netcard parameters; it has
  117. ; the form:
  118. ;
  119. ; { {PARAMETER_1_NAME,
  120. ; <setting control>,
  121. ; <confidence>,
  122. ; {v1,v2,v3,...} },
  123. ; {PARAMETER_2_NAME,
  124. ; <setting control>,
  125. ; <confidence>,
  126. ; {v1,v2,v3,...} },
  127. ; ...
  128. ; }
  129. ;
  130. ; where PARAMETER_1_NAME might be IRQ;
  131. ; <setting control> determines whether the
  132. ; parameter is controllable through software;
  133. ; <confidence> is a number [0..100] representing
  134. ; the confidence with which the parameter can
  135. ; be detected. The nested list {v1,v2...}
  136. ; enumerates the possible numeric settings
  137. ; which the parameter can take.
  138. ;
  139. ; Each netcard INF must create this list
  140. ; and populate it with the hard-coded default
  141. ; values from its tables.
  142. ;
  143. ; This variable is set by [Param_BuildTypeLists].
  144. ;
  145. ; STF_NC_PNAMES = An INF list of the form:
  146. ;
  147. ; { { PARAMETER_1_NAME,
  148. ; <name of variable>,
  149. ; <default value> },
  150. ; { PARAMETER_2_NAME,
  151. ; <name of variable>,
  152. ; <default value> },
  153. ; ...
  154. ; }
  155. ;
  156. ; The <name of variable> is the name of the
  157. ; variable in the context level of the INF
  158. ; file which contains the current setting
  159. ; of the parameter.
  160. ;
  161. ; This variable is set by [Param_BuildTypeLists].
  162. ;
  163. ;
  164. ; 9) During main installation, NTLANMAN.INF runs the detection
  165. ; algorithm. If successful, and the netcard option returned
  166. ; maps to a known INF file, the variables STF_NCDETCARD
  167. ; and STF_NCOPTION are set.
  168. ;
  169. ; Then the INF is called. Note that the installation mode
  170. ; may be CUSTOM or EXPRESS. It will always be CUSTOM for
  171. ; post-installation usage from the NCPA.
  172. ;
  173. ; NTLANMAN.INF will set STF_NCOPTION to "" (empty string)
  174. ; if the card was merely chosen and not detected. This will
  175. ; always be the case in post-installation usage.
  176. ;
  177. ; An INF can therefore tell if the card was detected by
  178. ; first checking $(!STF_NCDETECT) == YES, and then comparing
  179. ; the option is was given to !STF_NCOPTION. If it's different,
  180. ; then the option was chosen, not detected, and no detection
  181. ; should be used.
  182. ;
  183. ; 10) The INF must instantiate the variables !STF_NC_PARAMS and
  184. ; !STF_NC_PNAMES. See OEMNADD2.INF, section
  185. ; [Param_BuildTypeList] for an example of this.
  186. ;
  187. ; 11) The routines in this file are used to interface between the
  188. ; netcard INF, the global variables, and the wrapper functions
  189. ; in NCPA.CPL.
  190. ;
  191. ; It is critical to note that the sections [Param_SetDefaults]
  192. ; and [Param_VerifyCard] access and/or modify variables
  193. ; in the calling INF through the use of the "!p:" syntax.
  194. ;
  195. ; THIS MEANS THAT THE NETCARD INF MUST BE THE IMMEDIATE PARENT!
  196. ;
  197. ; No "indirection" from another INF or a auxilliary section
  198. ; in the netcard INF can be allowed. This would cause the
  199. ; variables to be set in the caller's context, and then discarded
  200. ; when that context was discarded to return to the netcard INF>
  201. ;
  202. ; 12) Every attempt has been made to document the routines in this
  203. ; file throughly. Refer to their commentary for more details.
  204. ;
  205. ;===========================================================================
  206. ; SECTION 2: Behavior of NTLANMAN.INF.
  207. ;===========================================================================
  208. ;
  209. ;STEP 1: Installation of the detection sofware
  210. ;
  211. ; !STF_NCDETECT is set to "NO"
  212. ;
  213. ; * NETDTECT.INF is run by NTLANMAN.INF
  214. ;
  215. ; * OEMHOOK.INF is run by NTLANMAN.INF
  216. ;
  217. ; * NCPA's wrapper is used to start the NETDETECT service
  218. ; If successful, !STF_NCDETECT is set to "YES"
  219. ;
  220. ;
  221. ;STEP 2: Allow bypassing of detection
  222. ;
  223. ; * If EXPRESS, this step is skipped.
  224. ; * If CUSTOM, present a dialog:
  225. ;
  226. ; +--------------------------------------------+
  227. ; | Setup is about to attempt to detect your |
  228. ; | netcard. If this is OK, click Continue. |
  229. ; | |
  230. ; | [Continue] [Bypass] [Help] |
  231. ; +--------------------------------------------+
  232. ;
  233. ; * If "Bypass", set !STF_NCDETECT to NO
  234. ;
  235. ;
  236. ;STEP 3: Detect the netcard
  237. ;
  238. ; * If !STF_NCDETECT == NO, skip this step
  239. ;
  240. ; * Call NCPA!CPlSetup( DTSTART )
  241. ;
  242. ; This creates the DETECTION_CONTROL object in NCPA.CPL.
  243. ; If it fails, set !STF_DETECT to NO, display error
  244. ; accordingly, and go to STEP 4.
  245. ;
  246. ; * do..while
  247. ;
  248. ; * Call NCPA!CPlSetup( DTCARD ) -- detect a card
  249. ;
  250. ; * If success && EXPRESS
  251. ; save card index into !STF_NCDETCARD
  252. ; save card option name into !STF_NCOPTION
  253. ; Go to STEP 4.
  254. ;
  255. ; * If failed to find a card, do warning popup
  256. ;
  257. ; +--------------------------------------------+
  258. ; | Setup was unable to determine the type |
  259. ; | of network card in this machine. |
  260. ; | |
  261. ; | [Continue] [Try Again] |
  262. ; +--------------------------------------------+
  263. ;
  264. ; If Continue,
  265. ; set !STF_NCDETECT = NO, go to STEP 4
  266. ; else,
  267. ; call NCPA!CPlSetup( DTRESET ) (to reset
  268. ; enumeration), then go to do..while.
  269. ;
  270. ; * If success, do popup:
  271. ;
  272. ; +--------------------------------------------+
  273. ; | Setup found the following netcard in your |
  274. ; | machine. If OK, click Accept, otherwise |
  275. ; | you may stop detection or try again. |
  276. ; | |
  277. ; | [ Displayable name of netcard ] |
  278. ; | |
  279. ; | [Accept] [Try Again] [Stop] [Help] |
  280. ; +--------------------------------------------+
  281. ;
  282. ; If Try Again, go to do..while.
  283. ;
  284. ; If Stop, set !STF_NCDETECT = NO, go to STEP 4.
  285. ;
  286. ; If Accept,
  287. ; save card index into !STF_NCDETCARD
  288. ; save card option name into !STF_NCOPTION
  289. ; go to STEP 4.
  290. ;
  291. ;
  292. ;STEP 4: Display netcard choice list if necessary
  293. ;
  294. ; * If !STF_NCDETECT == YES, go to STEP 5.
  295. ;
  296. ; * Present standard netcard listbox.
  297. ;
  298. ;
  299. ;STEP 5: Run netcard INF file.
  300. ;
  301. ; * Each netcard INF file is aware of the following
  302. ; global variables:
  303. ;
  304. ; !STF_INSTALL_MODE == {CUSTOM|EXPRESS}
  305. ; !STF_NCDETECT == {YES|NO}
  306. ; !STF_NCDETCARD == 0,1,2, etc.
  307. ; !STF_NCOPTION == OPTIONNAME
  308. ;
  309. ; If !STF_NCDETECT == NO, no calls will be made to
  310. ; NCPA!CPlSetup() to query or verify the card's configuration.
  311. ;
  312. ; !STF_NCDETCARD is the CARD_REFERENCE index maintained internally
  313. ; by the code in NCPASETP.CXX.
  314. ;
  315. ;
  316. ;STEP 6: Terminate detection
  317. ;
  318. ; * If !STF_NCDETECT == YES, call NCPA!CPlSetup( DTEND ).
  319. ;
  320. ; This terminates all detection and discards all memory associated
  321. ; with netcard handling.
  322. ;
  323. ;
  324. ;============================================================================
  325. ; SECTION 3: Behavior of typical netcard INF
  326. ;
  327. ; (OEMNADD2.INF will be the exemplar)
  328. ;============================================================================
  329. ;
  330. ;General Behavior:
  331. ;
  332. ; * If !STF_DETECT == NO, no interaction with the netcard detection software
  333. ; will be attempted.
  334. ;
  335. ; * If !STF_DETECT == YES:
  336. ;
  337. ; * Detectable parameters are queried.
  338. ;
  339. ; * Overall confidence level is obtained.
  340. ;
  341. ; * If ( EXPRESS mode
  342. ; and confidence >= 70
  343. ; and no required parameters are undetected ),
  344. ; parameters detect are verified so that IRQ conflicts
  345. ; can be determined. If verification succeeds,
  346. ; installation is performed silently.
  347. ;
  348. ; * Initial settings for controls are based upon the detected
  349. ; settings.
  350. ;
  351. ; * If configuration dialog must be displayed, it is displayed.
  352. ;
  353. ; * On OK, verification is performed. If it fails, a popup appears:
  354. ;
  355. ; +--------------------------------------------+
  356. ; | The <nnn> parameter appears to be in |
  357. ; | conflict with another device. To reenter |
  358. ; | new values, click Configure. If you click |
  359. ; | Override, the parameters you entered will |
  360. ; | be used as specified. |
  361. ; | |
  362. ; | [Configure] [Override] [Help] |
  363. ; +--------------------------------------------+
  364. ;
  365. ; This cycle continues until satisfied.
  366. ;
  367. ;============================================================================
  368. ;============================================================================
  369. ;============================================================================
  370. [InitGlobals]
  371. !STF_NCDETECT = "NO"
  372. !STF_NCOPTION = ""
  373. !STF_NCDETCARD = 0
  374. !STF_NCDETINFO = {}
  375. [Param_SetGlobals]
  376. Read-syms InitGlobals
  377. return
  378. ;-----------------------------------------------------------------------
  379. ;
  380. ; ROUTINE: Param_ControlDetection
  381. ;
  382. ; DESCRIPTION: Control netcard detection; invoke parameterless
  383. ; wrapper functions
  384. ;
  385. ; INPUTS: $0: DTSTART -- start detection
  386. ; DTEND -- end detection
  387. ; DTRESET -- discard old results, restart iteration
  388. ;
  389. ; OUTPUTS: $R0: STATUS_SUCCESSFUL if Ok
  390. ;
  391. ;------------------------------------------------------------------------
  392. [Param_ControlDetection]
  393. Set DtMode = $($0)
  394. Debug-Output "NCPARAM.INF: calling "$(DtMode)" wrapper"
  395. Set FLibraryErrCtl = 1
  396. LibraryProcedure StartResult $(!NCPA_HANDLE), CPlSetup $(!STF_HWND), $(DtMode)
  397. Set FLibraryErrCtl = 0
  398. Set StartStatus = *($(StartResult),1)
  399. Debug-Output "NCPARAM.INF: "$(DtMode)" status was: "$(StartStatus)
  400. Ifint $(StartStatus) == 0
  401. Set ReturnStatus = STATUS_SUCCESSFUL
  402. Else
  403. Set ReturnStatus = STATUS_FAILED
  404. Endif
  405. Return $(ReturnStatus)
  406. ;-----------------------------------------------------------------------
  407. ;
  408. ; ROUTINE: Param_DetectCard
  409. ;
  410. ; DESCRIPTION: Perform netcard detection. DTSTART must have
  411. ; already been called.
  412. ;
  413. ; INPUTS: Nothing
  414. ;
  415. ;
  416. ; OUTPUTS: $R0: Result list from NCPA wrapper:
  417. ;
  418. ; { <error code>,
  419. ; OPTIONNAME,
  420. ; <card index>,
  421. ; <numeric card type code>,
  422. ; <detection confidence level>,
  423. ; <bus interface type>,
  424. ; <bus number>
  425. ; }
  426. ;
  427. ;------------------------------------------------------------------------
  428. [Param_DetectCard]
  429. Debug-Output "NCPARAM.INF: calling DTCARD wrapper"
  430. Set FLibraryErrCtl = 1
  431. LibraryProcedure DetectResult $(!NCPA_HANDLE), CPlSetup $(!STF_HWND), DTCARD
  432. Set FLibraryErrCtl = 0
  433. Set Status = *($(DetectResult),1)
  434. Debug-Output "NCPARAM.INF: DTCARD status was: "$(Status)
  435. Ifint $(DetectStatus) == 0
  436. Set DtOption = *($(DetectResult),2)
  437. Set DtIndex = *($(DetectResult),3)
  438. Debug-Output "NCPARAM.INF: card found is type "$(DtOption)", index "$(DtIndex)
  439. Endif
  440. Return $(DetectResult)
  441. ;-----------------------------------------------------------------------
  442. ;
  443. ; ROUTINE: Param_BuildTypeLists
  444. ;
  445. ; DESCRIPTION: Run the DTPARAMS wrapper for the given netcard option
  446. ; and merge the results with the list given.
  447. ;
  448. ; INPUTS: $0: Name of netcard option
  449. : $1: Parameter control list of the form:
  450. ;
  451. ; { { <parameter name>,
  452. ; <name of choice list var | NONE>,
  453. ; <name of default var | NONE> },
  454. ; ...
  455. ; }
  456. ;
  457. ; OUTPUTS: $R0: STATUS_SUCCESSFUL if OK; if OK, then:
  458. ;
  459. ; !STF_NC_PARAMS is set to a list formatted as:
  460. ;
  461. ; { {PARAMETER_1_NAME,<setting control>,<confidence>,
  462. ; {v1,v2,v3,...} },
  463. ; {PARAMETER_2_NAME,<setting control>,<confidence>,
  464. ; {v1,v2,v3,...} },
  465. ; ...
  466. ; }
  467. ;
  468. ; !STF_NC_PNAMES is set to a list formatted as:
  469. ;
  470. ; { {PARAMETER_1_NAME, <param variable name>, <param current value> },
  471. ; {PARAMETER_2_NAME, <param variable name>, <param current value> },
  472. ; ...
  473. ; }
  474. ;
  475. ;
  476. ; Also, the parameter choice list variables named in the
  477. ; input list (if not "NONE") are created with values from the DLL.
  478. ;
  479. ;------------------------------------------------------------------------
  480. [Param_BuildTypeLists]
  481. Set Option = $($0)
  482. Set OptList = $($1)
  483. Set Result1 = {}
  484. Set Result2 = {}
  485. Set !STF_NC_PARAMS = {}
  486. Set !STF_NC_PNAMES = {}
  487. Set Status = STATUS_FAILED
  488. ; Get parameter info from the detection DLLs for this card option
  489. Debug-Output "NCPARAM.INF: Querying parameters for netcard type: "$(Option)
  490. Set FLibraryErrCtl = 1 ; Report DLL errors back to INF code
  491. LibraryProcedure NcpaResult $(!NCPA_HANDLE), CPlSetup $(!STF_HWND), DTPARAMS, $(Option)
  492. Set FLibraryErrCtl = 0
  493. Set ErrorStatus = *($(NcpaResult),1)
  494. Debug-Output "NCPARAM.INF: DTPARAMS status was: "$(ErrorStatus)
  495. ; If error, return the input list
  496. Ifint $(ErrorStatus) != 0
  497. Goto PMTL_Return
  498. Endif
  499. Set DllList = *($(NcpaResult),2)
  500. Debug-Output "NCPARAM.INF: DLL param type list is: "$(DllList)
  501. ; For each element in the input list, try to find its
  502. ; corresponding element in the DLL's list. If found,
  503. ; set the corresponding parameter choice list variable
  504. ; and parameter default setting variable in the parent context.
  505. Set NbrOptions = 0
  506. Set NbrFound = 0
  507. ForListDo $(OptList)
  508. Set-add NbrOptions = $(NbrOptions),1
  509. Set Found = 0
  510. Set Plist = $($)
  511. Set Pname = *($(Plist),1)
  512. Set PlistVar = *($(Plist),2)
  513. Set Pvar = *($(Plist),3)
  514. Set Dentry = {}
  515. ForListDo $(DllList)
  516. Set Dlist = $($)
  517. Set Dname = *($(Dlist),1)
  518. Set Dvlist = *($(Dlist),4)
  519. Ifstr(i) $(Dname) == $(Pname)
  520. Set Found = 1
  521. Set Dvalue = *($(Dvlist),1)
  522. Set Dentry = $(Dlist)
  523. ; Set parameter choice list var value
  524. Ifstr(i) $(PlistVar) != NONE
  525. Set !p:$(PlistVar) = $(Dvlist)
  526. Debug-Output "NCPARAM.INF: DLL param "$(Pname)" list var "$(PlistVar)" set"
  527. Endif
  528. Endif
  529. EndForListDo
  530. Set-add NbrFound = $(NbrFound),$(Found)
  531. Ifint $(Found) == 1
  532. Set Result1 = >($(Result1),$(Dentry))
  533. Set Result2 = >($(Result2),{$(Pname),$(Pvar),$(Dvalue)})
  534. Else
  535. Debug-Output "NCPARAM.INF: parameter "$(Pname)" not in DLL for "$(Option)
  536. Endif
  537. EndForListDo
  538. Ifint $(NbrOptions) == $(NbrFound)
  539. Set Status = STATUS_SUCCESSFUL
  540. Set !STF_NC_PARAMS = $(Result1)
  541. Set !STF_NC_PNAMES = $(Result2)
  542. Debug-Output "NCPARAM.INF: Netcard list STF_NC_PARAMS for "$(Option)" is: "$(Result1)
  543. Debug-Output "NCPARAM.INF: Netcard list STF_NC_PNAMES for "$(Option)" is: "$(Result2)
  544. Endif
  545. PMTL_Return =+
  546. Return $(Status)
  547. ;*************************************************************************
  548. ;
  549. ; ROUTINE: Param_SaveValues
  550. ;
  551. ; DESCRIPTION: Create a list containing the current values
  552. ; of the netcard's parameters.
  553. ;
  554. ; INPUTS: !STF_NC_PNAMES
  555. ;
  556. ;
  557. ; OUTPUTS: $R0: list identical in form to STF_NC_PNAMES, but
  558. ; containing the current values of each parameter.
  559. ;
  560. ; Parameters with no corresponding variable name (e.g., NONE)
  561. ; are not included.
  562. ;
  563. ;*************************************************************************
  564. [Param_SaveValues]
  565. Set Plist = {}
  566. ForListDo $(!STF_NC_PNAMES)
  567. Set Pelem = $($)
  568. Set Name = *($(Pelem),1)
  569. Set Qvar = *($(Pelem),2)
  570. Set Qvalue = *($(Pelem),3)
  571. Ifstr(i) $(Qvar) != "NONE"
  572. Set Qvalue = $(!p:$(Qvar))
  573. Set Plist = >($(Plist),{$(Name),$(Qvar),$(Qvalue)})
  574. Endif
  575. EndForListDo
  576. Return $(Plist)
  577. ;*************************************************************************
  578. ;
  579. ; ROUTINE: Param_DiffValues
  580. ;
  581. ; DESCRIPTION: Given a list of the STF_NC_PNAMES form, produce a new
  582. ; list containing only those parameters whose values are
  583. ; different from those in the input list.
  584. ;
  585. ; INPUTS: $0: list of the !STF_NC_PNAMES form;
  586. ; (see [Param_SaveValues])
  587. ;
  588. ; OUTPUTS: $R0: list identical in form to STF_NC_PNAMES, but
  589. ; containing the current values of each parameter.
  590. ;
  591. ; Parameters with no corresponding variable name (e.g., NONE)
  592. ; are not included.
  593. ;
  594. ;*************************************************************************
  595. [Param_DiffValues]
  596. Set Plist = {}
  597. ForListDo $($0)
  598. Set Pelem = $($)
  599. Set Name = *($(Pelem),1)
  600. Set Qvar = *($(Pelem),2)
  601. Set Qvalue = *($(Pelem),3)
  602. Ifstr(i) $(Qvar) != "NONE"
  603. Set QnewValue = $(!p:$(Qvar))
  604. Ifint $(QnewValue) != $(Qvalue)
  605. Debug-Output "NCPARAM.INF: Param_DiffValues: param "$(Name)" value has changed"
  606. Set Plist = >($(Plist),{$(Name),$(Qvar),$(QnewValue)})
  607. Endif
  608. Endif
  609. EndForListDo
  610. Return $(Plist)
  611. ;-----------------------------------------------------------------------
  612. ;
  613. ; ROUTINE: Param_SetDefaults
  614. ;
  615. ; DESCRIPTION: Given the (possibly empty) set of results of a
  616. ; call to Query Netcard Parameters (DTQUERY), set the default
  617. ; value variables. First choice is to a detected value;
  618. ; second choice is the hard-coded default in [ParamSettings].
  619. ;
  620. ; INPUTS: $0: List returned by [Param_QueryCard] section below or
  621. ; an empty list, {}.
  622. ;
  623. ; !STF_NC_PNAMES list created by INF file.
  624. ;
  625. ; OUTPUTS: Variables named in !STF_NC_PNAMES are set.
  626. ;
  627. ;------------------------------------------------------------------------
  628. [Param_SetDefaults]
  629. Set QueryList = $($0)
  630. Debug-Output "NCPARAM.INF: Param_SetDefaults, QueryList = "$(QueryList)
  631. ; Iterate the name list; find the corresponding value in the
  632. ; QueryList, if any.
  633. ForListDo $(!STF_NC_PNAMES)
  634. Set Pelem = $($)
  635. Set Name = *($(Pelem),1)
  636. Set Qvar = *($(Pelem),2)
  637. Set Qvalue = *($(Pelem),3)
  638. ForListDo $(QueryList)
  639. Set Qname = *($($),1)
  640. Ifstr(i) $(Qname) == $(Name)
  641. ; Found a matching value from QueryList
  642. Debug-Output "NCPARAM.INF: Param_SetDefaults: default override for param "$(Qname)
  643. Set Qvalue = *($($),2)
  644. Endif
  645. EndForListDo
  646. ; If the name of the value-containing variable is not "NONE",
  647. ; set it IN THE PARENT CONTEXT!
  648. Ifstr(i) $(Qvar) != "NONE"
  649. Debug-Output "NCPARAM.INF: Param_SetDefaults: setting "$(Qvar)" to "$(Qvalue)
  650. Set !p:$(Qvar) = $(Qvalue)
  651. Endif
  652. EndForListDo
  653. Return
  654. ;-----------------------------------------------------------------------
  655. ;
  656. ; ROUTINE: Param_QueryCard
  657. ;
  658. ; DESCRIPTION: Call the NCPA's QueryConfiguration wrapper. Return
  659. ; the list or the error.
  660. ;
  661. ; INPUTS: $0: integer detected card index
  662. ;
  663. ; OUTPUTS: $R0: STATUS_SUCCESSFUL if OK
  664. ; $R1: QueryList; format:
  665. ;
  666. ; { {PARAMETER_1_NAME, <detected value> },
  667. ; {PARAMETER_2_NAME, <detected value> },
  668. ; ...
  669. ; }
  670. ;
  671. ;------------------------------------------------------------------------
  672. [Param_QueryCard]
  673. Set CardIndex = $($0)
  674. Set Status = STATUS_SUCCESSFUL
  675. Set ResultList = {}
  676. Debug-Output "OEMNADDE.INF: Querying parameters for netcard "$(CardIndex)
  677. Set FLibraryErrCtl = 1 ; Report DLL errors back to INF code
  678. LibraryProcedure NcpaResult $(!NCPA_HANDLE), CPlSetup $(!STF_HWND), DTQUERY, $(CardIndex)
  679. Set FLibraryErrCtl = 0
  680. Set ErrorStatus = *($(NcpaResult),1)
  681. Debug-Output "NCPARAM.INF: DTQUERY status was: "$(ErrorStatus)
  682. Ifint $(ErrorStatus) != 0
  683. Set Status = STATUS_FAILED
  684. Else
  685. Set ResultList = *($(NcpaResult),2)
  686. Endif
  687. Return $(Status) $(ResultList)
  688. ;-----------------------------------------------------------------------
  689. ;
  690. ; ROUTINE: Param_VerifyCard
  691. ;
  692. ; DESCRIPTION: Call the NCPA's VerifyConfiguration wrapper. Return
  693. ; the result. Current settings must be in the variables
  694. ; named as default variables in the [ParamSettings]
  695. ; section.
  696. ;
  697. ; INPUTS: $0: integer detected card index
  698. ;
  699. ; !STF_NC_PNAMES list
  700. ;
  701. ; OUTPUTS: $R0: STATUS_SUCCESSFUL if OK
  702. ;
  703. ; NOTES: The [ParamSettings] section is used to build up
  704. ; a list of the following form:
  705. ;
  706. ; { {PARAMETER_1_NAME, <chosen value> },
  707. ; {PARAMETER_2_NAME, <chosen value> },
  708. ; ...
  709. ; }
  710. ;
  711. ;------------------------------------------------------------------------
  712. [Param_VerifyCard]
  713. Set CardIndex = $($0)
  714. Set Status = STATUS_FAILED
  715. Set VerifyList = {}
  716. ; Build up the list of parameters using the default value
  717. ; variable from the PARENT CONTEXT. Ignore empty variables.
  718. ForListDo $(!STF_NC_PNAMES)
  719. Set Pelem = $($)
  720. Set Name = *($(Pelem),1)
  721. Set Qvar = *($(Pelem),2)
  722. Set Qvalue = $(!p:$(Qvar))
  723. Ifstr(i) $(Qvalue) != ""
  724. Debug-Output "NCPARAM.INF: VerifyCard: "$(Qvar)" = "$(Qvalue)
  725. Set VerifyList = >($(VerifyList),{$(Name),$(Qvalue)})
  726. Endif
  727. EndForListDo
  728. ; Verify the parameters.
  729. Debug-Output "NCPARAM.INF: Verifying parameters for netcard "$(CardIndex)
  730. Debug-Output "NCPARAM.INF: Parameters are: "$(VerifyList)
  731. Set FLibraryErrCtl = 1 ; Report DLL errors back to INF code
  732. LibraryProcedure NcpaResult $(!NCPA_HANDLE), CPlSetup $(!STF_HWND), DTVERIFY, $(CardIndex), $(VerifyList)
  733. Set FLibraryErrCtl = 0
  734. Set ErrorStatus = *($(NcpaResult),1)
  735. Debug-Output "NCPARAM.INF: DTVERIFY status was: "$(ErrorStatus)
  736. ;
  737. ; if in unattended mode, do not bother user with warnings that are mostly useless
  738. ;
  739. ifstr(i) $(!STF_GUI_UNATTENDED) == "YES"
  740. Set Status = STATUS_SUCCESSFUL
  741. else
  742. Ifint $(ErrorStatus) == 0
  743. Set Status = STATUS_SUCCESSFUL
  744. Endif
  745. endif
  746. Return $(Status)
  747. ;-----------------------------------------------------------------------
  748. ;
  749. ; ROUTINE: Param_VerifyResources
  750. ;
  751. ; DESCRIPTION: Call the NCPA's VerifyConfiguration wrapper for
  752. ; and existing card. This routine "diffs" the current
  753. ; parameter settings and attempts to "claim" the new
  754. ; parameters at the NT level. See [Param_SaveValues]
  755. ; and [Param_DiffValues] for list construction details.
  756. ;
  757. ; INPUTS: $0: parameter difference list produced by [Param_DiffValues]
  758. ;
  759. ; OUTPUTS: $R0: STATUS_SUCCESSFUL if OK
  760. ;
  761. ; NOTES: If $0 is the empty list, STATUS_SUCCESSFUL is returned.
  762. ;
  763. ; A list of the following form is constructed for DTVERIFY:
  764. ;
  765. ; { {PARAMETER_1_NAME, <chosen value> },
  766. ; {PARAMETER_2_NAME, <chosen value> },
  767. ; ...
  768. ; }
  769. ;
  770. ;------------------------------------------------------------------------
  771. [Param_VerifyResources]
  772. Set DiffParamList = $($0)
  773. ; See if the difference list is empty
  774. Ifstr(i) $(DiffParamList) == {}
  775. Set Status = STATUS_SUCCESSFUL
  776. Goto PVR_Return
  777. Endif
  778. Set Status = STATUS_FAILED
  779. ; Build up the list of parameters which have changed.
  780. Set VerifyList = {}
  781. ForListDo $(DiffParamList)
  782. Set Pelem = $($)
  783. Set Name = *($(Pelem),1)
  784. Set Qvar = *($(Pelem),2)
  785. Set Qvalue = $(!p:$(Qvar))
  786. Ifstr(i) $(Qvalue) != ""
  787. Debug-Output "NCPARAM.INF: VerifyResources: "$(Qvar)" = "$(Qvalue)
  788. Set VerifyList = >($(VerifyList),{$(Name),$(Qvalue)})
  789. Endif
  790. EndForListDo
  791. ; Claim the resource delta.
  792. Debug-Output "NCPARAM.INF: VerifyResources: Claiming changed resource parameter values"
  793. Debug-Output "NCPARAM.INF: Parameters are: "$(VerifyList)
  794. Set FLibraryErrCtl = 1 ; Report DLL errors back to INF code
  795. LibraryProcedure NcpaResult $(!NCPA_HANDLE), CPlSetup $(!STF_HWND), DTCLAIM, $(VerifyList)
  796. Set FLibraryErrCtl = 0
  797. Set ErrorStatus = *($(NcpaResult),1)
  798. Debug-Output "NCPARAM.INF: DTCLAIM status was: "$(ErrorStatus)
  799. Ifint $(ErrorStatus) == 0
  800. Set Status = STATUS_SUCCESSFUL
  801. Endif
  802. PVR_Return = +
  803. Return $(Status)
  804. ;-----------------------------------------------------------------------
  805. ;
  806. ; ROUTINE: Param_ParameterConfidence
  807. ;
  808. ; DESCRIPTION: Return TRUE if the netcard's required parameters are
  809. ; detectable.
  810. ;
  811. ; Iterate over STF_NC_PARAMS; check that all the type
  812. ; 0 and 1 parameters have a detection confidence
  813. ; factor greater than 70.
  814. ;
  815. ; INPUTS: None
  816. ;
  817. ; OUTPUTS: $R0: STATUS_SUCCESSFUL or STATUS_FAILED
  818. ;
  819. ;------------------------------------------------------------------------
  820. [Param_ParameterConfidence]
  821. Set LowestConf = 100
  822. Set Status = STATUS_SUCCESSFUL
  823. Set LowestParam = ""
  824. ForListDo $(!STF_NC_PARAMS)
  825. Set Ptype = *($($),2)
  826. Set Pconf = *($($),3)
  827. Ifint $(Ptype) < 2
  828. Ifint $(Pconf) < $(LowestConf)
  829. Set LowestConf = $(Pconf)
  830. Set LowestParam = *($($),1)
  831. Endif
  832. Endif
  833. EndForListDo
  834. Ifint $(LowestConf) < 70
  835. Set Status = STATUS_FAILED
  836. Debug-Output "NCPARAM.INF: parameter "$(LowestParam)" cannot be adequately detected"
  837. Endif
  838. Return $(Status)
  839. ;-----------------------------------------------------------------------
  840. ;
  841. ; ROUTINE: HexListFromDecList
  842. ;
  843. ; DESCRIPTION: Return a list of hex values from a list of decimal values
  844. ;
  845. ; INPUTS: $0: the input list of decimal numbers
  846. ;
  847. ; OUTPUTS: $R0: the result list of hex values
  848. ;
  849. ;------------------------------------------------------------------------
  850. [HexListFromDecList]
  851. Set HexList = {}
  852. ForListDo $($0)
  853. Set-DecToHex HexValue = $($)
  854. Set HexList = >($(HexList),$(HexValue))
  855. EndForListDo
  856. Return $(HexList)
  857. ;-----------------------------------------------------------------------
  858. ;
  859. ; End of NCPARAM.INF
  860. ;
  861. ;-----------------------------------------------------------------------