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.

247 lines
7.1 KiB

  1. ;--------------
  2. ; PRINTER SETUP
  3. ;--------------
  4. [PrintersUiVars]
  5. ;
  6. PrinterINF = "printer.inf"
  7. ;
  8. ; Printer Installation
  9. ;
  10. PRINTER_ATTRIBUTE_QUEUED = 1
  11. PRINTER_ATTRIBUTE_QUEUEDDEFAULT = 5
  12. ;
  13. ; Printer lists..
  14. ;
  15. ; Each list member is a printer record:
  16. ; Field1: Printer Name
  17. ; Field2: Printer Port
  18. ; Field3: Printer Model
  19. ; Field4: Printer Description
  20. ; Field5: Print Processor
  21. ; Field6: Printer Attributes
  22. ;
  23. PrintersToInstall = {}
  24. ;
  25. ;-----------------------------------------------------------------------
  26. ; ROUTINE: DoPrinterSetup
  27. ;
  28. ; DESCRIPTION: This routine lets the user setup a single printer
  29. ;
  30. ; INPUTS: None
  31. ;
  32. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  33. ; STATUS_USERCANCEL |
  34. ; STATUS_FAILED
  35. ;
  36. ; $R1: PrintersToConfigure
  37. ;
  38. ;------------------------------------------------------------------------
  39. [DoPrinterSetup]
  40. ;
  41. ; Initialize
  42. ;
  43. set Status = STATUS_FAILED
  44. read-syms PrintersUiVars
  45. read-syms Strings$(!STF_LANGUAGE)
  46. set PrintersToInstall = {}
  47. ;
  48. ; Determine our INF options
  49. ;
  50. set OurINFFile = "printer.inf"
  51. shell "other.inf", GetOptionsFromINF $(!STF_LANGUAGE) "Printer" $(PrinterINF)
  52. ifstr(i) $($R0) == STATUS_SUCCESSFUL
  53. set PrinterList = $($R1)
  54. set PrinterTextList = $($R2)
  55. set $R1 = ""
  56. set $R2 = ""
  57. else
  58. EndWait
  59. shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "FATAL" $(String2)
  60. StartWait
  61. goto finish_printer
  62. endif
  63. printersetup=+
  64. read-syms PrintersSetupDlg$(!STF_LANGUAGE)
  65. EndWait
  66. ui start PrinterSetup
  67. ifstr(i) $(DLGEVENT) == "CONTINUE"
  68. ifstr(i) $(EditTextOut) == ""
  69. set ReInit = NO
  70. shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(String1)
  71. goto printersetup
  72. else
  73. LibraryProcedure STATUS,$(!LIBHANDLE),AreCharsInString $(EditTextOut) ",\"
  74. ifstr(i) $(STATUS) == YES
  75. set ReInit = NO
  76. shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(String8)
  77. goto printersetup
  78. endif
  79. endif
  80. StartWait
  81. set Name = $(EditTextOut)
  82. set Port = $(Combo2Out)
  83. set Model = *( $(PrinterList), ~( $(PrinterTextList), $(Combo1Out) ) )
  84. set Description = $(Combo1Out)" "$(String3)" "$(Combo2Out)
  85. set PrintProcessor = "winprint"
  86. set PrinterAttribute = $(PRINTER_ATTRIBUTE_QUEUEDDEFAULT)
  87. set Printer = { $(Name), +
  88. $(Port), +
  89. $(Model), +
  90. $(Description), +
  91. $(PrintProcessor), +
  92. $(Attributes) +
  93. }
  94. set PrintersToInstall = >( $(PrintersToInstall), $(Printer) )
  95. set Status = STATUS_SUCCESSFUL
  96. ui pop 1
  97. goto install_printers
  98. else-ifstr(i) $(DLGEVENT) == "BACK"
  99. ifstr(i) $(PrintersToInstall) == {}
  100. shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "STATUS" $(String4)
  101. set Status = STATUS_USERCANCEL
  102. ui pop 1
  103. goto finish_printer
  104. endif
  105. else-ifstr(i) $(DLGEVENT) == "EXIT"
  106. shell "subroutn.inf" QueryUserQuit $(!STF_LANGUAGE)
  107. ifstr(i) $($R1) == "OK"
  108. set Status = STATUS_USERQUIT
  109. ui pop 1
  110. goto finish_printer
  111. else
  112. set ReInit = NO
  113. goto printersetup
  114. endif
  115. else
  116. ui pop 1
  117. goto finish_printer
  118. endif
  119. install_printers = +
  120. ForListDo $(PrintersToInstall)
  121. set Model = *($($), 3)
  122. shell "printer.inf" +
  123. InstallOption +
  124. $(!STF_LANGUAGE) +
  125. $(Model) +
  126. $(!STF_SRCDIR) +
  127. YES +
  128. NO +
  129. NO +
  130. {}
  131. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  132. Debug-Output "Failed to execute install routine in Printer.inf"
  133. goto finish_printer
  134. else-ifstr(i) $($R0) != STATUS_SUCCESSFUL
  135. Debug-Output "Failed to install printer driver"$(Model)
  136. goto finish_printer
  137. endif
  138. EndForListDo
  139. set Status = STATUS_SUCCESSFUL
  140. finish_printer = +
  141. StartWait
  142. Return $(Status) $(PrintersToInstall)
  143. ;-----------------------------------------------------------------------
  144. ; ROUTINE: DoPrinterConfigure
  145. ;
  146. ; DESCRIPTION: This routine lets the user configure printers
  147. ;
  148. ; INPUTS: $0: PrintersToConfigure
  149. ;
  150. ; OUTPUTS: $R0: STATUS: STATUS_SUCCESSFUL |
  151. ; STATUS_FAILED
  152. ;
  153. ;------------------------------------------------------------------------
  154. [DoPrinterConfigure]
  155. set Status = STATUS_SUCCESSFUL
  156. read-syms Strings$(!STF_LANGUAGE)
  157. ForListDo $($0)
  158. ;
  159. ; get printer particulars
  160. ;
  161. set Name = *($($), 1)
  162. set Port = *($($), 2)
  163. set Model = *($($), 3)
  164. set Description = *($($), 4)
  165. set PrintProcessor = *($($), 5)
  166. set Attribute = *($($), 6)
  167. ;
  168. ; First configure the printer model
  169. ;
  170. shell "printer.inf" +
  171. InstallOption +
  172. $(!STF_LANGUAGE) +
  173. $(Model) +
  174. "" +
  175. NO +
  176. NO +
  177. YES +
  178. {}
  179. ifint $($ShellCode) != $(!SHELL_CODE_OK)
  180. Debug-Output "Failed to execute install routine in Printer.inf"
  181. goto finish_printerconfigure
  182. else-ifstr(i) $($R0) != STATUS_SUCCESSFUL
  183. Debug-Output "Failed to configure printer driver"$(Model)
  184. goto finish_printerconfigure
  185. endif
  186. ;
  187. ; then configure the printer
  188. ;
  189. LibraryProcedure STATUS,$(!LIBHANDLE), SetupAddPrinter +
  190. $(Name), +
  191. $(Port), +
  192. $(Model), +
  193. $(Description), +
  194. $(PrintProcessor), +
  195. $(Attribute), +
  196. $(!STF_PRINTSERVER)
  197. ifstr(i) $(STATUS) == "ERROR"
  198. EndWait
  199. shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(String5)$(Name)$(String7)
  200. StartWait
  201. goto finish_printerconfigure
  202. else-ifstr(i) $(STATUS) == "PRESENT"
  203. EndWait
  204. shell "subroutn.inf" SetupMessage $(!STF_LANGUAGE) "NONFATAL" $(String5)$(Name)$(String6)
  205. StartWait
  206. endif
  207. EndForListDo
  208. set Status = STATUS_SUCCESSFUL
  209. finish_printerconfigure = +
  210. return $(Status)