Difference between revisions of "Printer drivers"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
(Added missing upgrade stanzas to HP Universal Printing PS driver package)
(Updated Ricoh Aficio 2045e example to work on 64-bit (amd64) Windows)
Line 51: Line 51:
 
   id="ricoh-aficio2045e-drivers"
 
   id="ricoh-aficio2045e-drivers"
 
   name="Ricoh drivers"
 
   name="Ricoh drivers"
   revision="2"
+
   revision="3"
 
   reboot="false"
 
   reboot="false"
 
   priority="0">
 
   priority="0">
  
   <!-- XXX this check is inadequate. -->
+
   <!-- XXX this check is inadequate. Wpkg doesn't handle REG_BINARY very well. -->
 
   <!-- Note: the packages only provide x86 drivers, so no other arch are checked -->
 
   <!-- Note: the packages only provide x86 drivers, so no other arch are checked -->
  
   <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-3\Ricoh Aficio 2045e PCL 6\Data File" value="RIC634K.DLL" />
+
   <check type="logical" condition="or">
  <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-3\Ricoh Aficio 2045e PS\Data File" value="RAF245E3.PPD" />
+
    <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\PrintEnvironments\Windows NT x86\Drivers\Version-3\Ricoh Aficio 2045e PCL 6\Data File" value="RIC634K.DLL" />
 +
    <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\PrintEnvironments\Windows x64\Drivers\Version-3\Ricoh Aficio 2045e PCL 6\Data File" value="RIC634K.DLL" />
 +
  </check>
 +
  <check type="logical" condition="or">
 +
    <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\PrintEnvironments\Windows NT x86\Drivers\Version-3\Ricoh Aficio 2045e PS\Data File" value="RAF245E3.PPD" />
 +
    <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\PrintEnvironments\Windows x64\Drivers\Version-3\Ricoh Aficio 2045e PS\Data File" value="RAF245E3.PPD" />
 +
  </check>
  
   <install cmd='rundll32 PrintUI.dll,PrintUIEntry /ia /f "%SOFTWARE%\printerdrivers\ricoh\PCL6\3.1.0.0\disk1\OEMSETUP.INF" /m "RICOH Aficio 2045e PCL 6" /q' />
+
   <install cmd='%COMSPEC% /C if not exist "%PROGRAMFILES(x86)%" rundll32 PrintUI.dll,PrintUIEntry /ia /f "%SOFTWARE%\printerdrivers\ricoh\PCL6\3.1.0.0\disk1\OEMSETUP.INF" /m "RICOH Aficio 2045e PCL 6" /q' />
   <install cmd='rundll32 PrintUI.dll,PrintUIEntry /ia /f "%SOFTWARE%\printerdrivers\ricoh\PS\3.0.0\DISK1\RICSETUP.INF" /m "RICOH Aficio 2045e PS" /q' />
+
   <install cmd='%COMSPEC% /C if exist "%PROGRAMFILES(x86)%" rundll32 PrintUI.dll,PrintUIEntry /ia /f %SOFTWARE%\printerdrivers\ricoh\PCL6-x64\3.1.0.0\disk1\OEMSETUP.INF" /m "RICOH Aficio 2045e PCL 6" /q' />
 +
 
 +
  <install cmd='%COMSPEC% /C if not exist "%PROGRAMFILES(x86)%" rundll32 PrintUI.dll,PrintUIEntry /ia /f %SOFTWARE%\printerdrivers\ricoh\PS\3.0.0\DISK1\RICSETUP.INF" /m "RICOH Aficio 2045e PS" /q' />
 +
  <install cmd='%COMSPEC% /C if exist "%PROGRAMFILES(x86)%" rundll32 PrintUI.dll,PrintUIEntry /ia /f %SOFTWARE%\printerdrivers\ricoh\PS-x64\3.0.0\DISK1\RICSETUP.INF" /m "RICOH Aficio 2045e PS" /q' />
  
 
</package>
 
</package>

Revision as of 21:35, 6 July 2011

Generic Instructions

Most printer drivers should come packaged with an INF file which describes them. Printui.dll provides a generic method to install these. You'll need to know the name of the printer driver, which you can obtain by examining the INF file. For check conditions, find the name of the driver file it drops, and check (on x86) HKLM\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-3\Your Printer Name Here\Data File. You can obtain this information from the INF file or by examining a computer on which the driver is already installed.

For additional information on how to manipulate printers silently, run rundll32 PrintUI.dll,PrintUIEntry /?. Note that the string PrintUIEntry is case-sensitive.

(Note that if Point and Print is turned on and works correctly in your environment, none of this is probably necessary.)

Working Examples

HP Universal Printer Driver

<package
   id="hpuniv-drivers"
   name="HP Universal Printer Driver 5.2.6"
   revision="3"
   reboot="false"
   priority="0">

   <!-- XXX this check may be inadequate. Wpkg doesn't handle REG_BINARY very
        well, but Data File changes with different versions of this driver and
        appears to not be updated on a partial wrong-architecture install. -->

   <check type="logical" condition="or">
     <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-3\HP Universal Printing PS\Data File" value="hpcu112s.ppd" />
     <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Drivers\Version-3\HP Universal Printing PS\Data File" value="hpcu112s.ppd" />
   </check>

   <!-- unfortunately /h doesn't seem to work to install
        drivers for both architectures on one computer (tested on XP and 7), so
        we do this instead.  It would probably be possible to ignore return
        codes instead.  -->
   <!-- ia32 uses hpcu112d.inf -->
   <install cmd='%COMSPEC% /C if not exist "%PROGRAMFILES(x86)%" rundll32 PrintUI.dll,PrintUIEntry /ia /f "%SOFTWARE%\printerdrivers\hp-universal-v5.2.6/32/hpcu112d.inf" /m "HP Universal Printing PS" /q' />
   <!-- amd64 uses hpcu112v.inf -->
   <install cmd='%COMSPEC% /C if exist "%PROGRAMFILES(x86)%" rundll32 PrintUI.dll,PrintUIEntry /ia /f "%SOFTWARE%\printerdrivers\hp-universal-v5.2.6/64/hpcu112v.inf" /m "HP Universal Printing PS" /q' />

   <upgrade cmd='%COMSPEC% /C if not exist "%PROGRAMFILES(x86)%" rundll32 PrintUI.dll,PrintUIEntry /ia /f "%SOFTWARE%\printerdrivers\hp-universal-v5.2.6/32/hpcu112d.inf" /m "HP Universal Printing PS" /q' />
   <upgrade cmd='%COMSPEC% /C if exist "%PROGRAMFILES(x86)%" rundll32 PrintUI.dll,PrintUIEntry /ia /f "%SOFTWARE%\printerdrivers\hp-universal-v5.2.6/64/hpcu112v.inf" /m "HP Universal Printing PS" /q' />

</package>

Ricoh Aficio 2045e

<package
   id="ricoh-aficio2045e-drivers"
   name="Ricoh drivers"
   revision="3"
   reboot="false"
   priority="0">

   <!-- XXX this check is inadequate. Wpkg doesn't handle REG_BINARY very well. -->
   <!-- Note: the packages only provide x86 drivers, so no other arch are checked -->

   <check type="logical" condition="or">
     <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\PrintEnvironments\Windows NT x86\Drivers\Version-3\Ricoh Aficio 2045e PCL 6\Data File" value="RIC634K.DLL" />
     <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\PrintEnvironments\Windows x64\Drivers\Version-3\Ricoh Aficio 2045e PCL 6\Data File" value="RIC634K.DLL" />
   </check>
   <check type="logical" condition="or">
     <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\PrintEnvironments\Windows NT x86\Drivers\Version-3\Ricoh Aficio 2045e PS\Data File" value="RAF245E3.PPD" />
     <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\PrintEnvironments\Windows x64\Drivers\Version-3\Ricoh Aficio 2045e PS\Data File" value="RAF245E3.PPD" />
   </check>

   <install cmd='%COMSPEC% /C if not exist "%PROGRAMFILES(x86)%" rundll32 PrintUI.dll,PrintUIEntry /ia /f "%SOFTWARE%\printerdrivers\ricoh\PCL6\3.1.0.0\disk1\OEMSETUP.INF" /m "RICOH Aficio 2045e PCL 6" /q' />
   <install cmd='%COMSPEC% /C if exist "%PROGRAMFILES(x86)%" rundll32 PrintUI.dll,PrintUIEntry /ia /f %SOFTWARE%\printerdrivers\ricoh\PCL6-x64\3.1.0.0\disk1\OEMSETUP.INF" /m "RICOH Aficio 2045e PCL 6" /q' />

   <install cmd='%COMSPEC% /C if not exist "%PROGRAMFILES(x86)%" rundll32 PrintUI.dll,PrintUIEntry /ia /f %SOFTWARE%\printerdrivers\ricoh\PS\3.0.0\DISK1\RICSETUP.INF" /m "RICOH Aficio 2045e PS" /q' />
   <install cmd='%COMSPEC% /C if exist "%PROGRAMFILES(x86)%" rundll32 PrintUI.dll,PrintUIEntry /ia /f %SOFTWARE%\printerdrivers\ricoh\PS-x64\3.0.0\DISK1\RICSETUP.INF" /m "RICOH Aficio 2045e PS" /q' />

</package>

HP Deskjet 5800 series

<package
   id="hpdj5800-drivers"
   name="HP Deskjet 5800 series"
   revision="1"
   reboot="false"
   priority="0">

   <!-- XXX this check is inadequate. Wpkg doesn't handle REG_BINARY very well. -->
   <!-- Note: the packages only provide x86 drivers, so no other arch are checked -->

   <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-3\hp deskjet 5800 series\Data File" value="hpf4h409.dat" />

   <install cmd='rundll32 PrintUI.dll,PrintUIEntry /ia /f "%SOFTWARE%\printerdrivers\lj5800-basic\5800\enu\drivers\win2k_xp\hpf5800k.inf" /m "hp deskjet 5800 series" /q' />

</package>

Adding a Printer Port

If you need to add a Printer using an IP Port you have to create the Port first. I did it under WinXP with the build in prnport.vbs. Create a Batch file and run this, to install a Brother HL-2150N connected to the Port ExamplePortName behind the IP ExampleIP (RAW Mode Port 9100).

cscript %WINDIR%\system32\prnport.vbs -a -r ExamplePortName -h ExampleIP -o raw -n 9100
rundll32 PrintUI.dll,PrintUIEntry /if /b "Brother HL-2150N" /f "%SOFTWARE%\BrotherHL2150N\BROHL07A.INF" /m "Brother HL-2150N series" /r "ExamplePortName"