1 / 15

Best Practices for Developing Printer Drivers

Best Practices for Developing Printer Drivers. Justin Hutchings Program Manager Microsoft Corporation. Shawn Maloney Program Manager Microsoft Corporation. Agenda. Setup & Installation INFs PnP ranking for printers Installers/Co-installers Device Physical Configuration

ismael
Download Presentation

Best Practices for Developing Printer Drivers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Best Practices for Developing Printer Drivers Justin Hutchings Program Manager Microsoft Corporation Shawn Maloney Program Manager Microsoft Corporation

  2. Agenda • Setup & Installation • INFs • PnP ranking for printers • Installers/Co-installers • Device Physical Configuration • Performance Guidelines • Reliability Guidelines • Using Microsoft Core Components • Security Guidelines • Call To Action/Resources

  3. Setup & Install – Multiple INFs • Managing driver packages with multiple driver INFs • Support for multifunction printers (MFPs) and core drivers • Create individual driver subdirectories • Use CopyINF command to preload drivers [MyMFPDevice.NTx86] CopyINF = \i386\ntprint.INF

  4. Setup & Install - PnP Ranking for Printers • Never list the same hardware ID twice in a single model section • Never put hardware IDs for different devices on the same line • Compatible IDs for a printer (new in Windows 7) always go in the 2nd position • Hardware IDs on a line from most specific to least specific Device Name = Install_Section, HWID, CompatID “Fabrikam 6000” = InstallMe, USBPrint\Fabrikam6000, 1284_CID_FabrikamClass1

  5. Setup & Install - Installers and Co-Installers • Avoid version checks in the installer • Use OS mechanisms for installing the driver • Do not circumvent OS security and stability mechanisms • Avoid hard dependencies between applications and drivers • The use of co-installers is discouraged. Never perform essential installation functions in a co-installer.

  6. Device Physical Configuration • MFPs should enumerate all device functions (print, scan, fax, storage) on all available ports (USB, Ethernet, Wireless) • “Maintenance ports” should be exclusively for maintenance • Identical ports should expose the same functionality • PictBridge and modem ports may vary, but should be marked clearly • Installable options should be auto-configured

  7. Performance Guidelines • User interface (UI) Modules should use worker threads to maintain a responsive UI • Filters in filter pipeline should flow from XPS document to stream • Stream to XPS Document conversion is very costly

  8. Reliability Guidelines • Power cycling is not an acceptable error mitigation • Use Driver Isolation in Windows 7 • Will protect the spooler from crashing drivers • If you use COM, use only multithreaded apartment (MTA) threading in spooler processes • Do not crash on unsupported escapes or fail print jobs • Test with Print Verifier • Will identify unsafe usage of spooler methods • Validates reference counts, handles, COM interactions • Helps with debugging PrintTicket/PrintCapabilities issues

  9. Processor Architecture • 64-bit OS adoption is at critical mass • Print driver components must be built in the proper architecture • Applications should be built in the proper architecture

  10. Using Microsoft Core Components • Unidrv & PostScript • Use generic printer description (GPD) and PostScript printer description (PPD) files as the backbone of your driver • They are simple, robust, backwards and forwards compatible, and have good performance • Port monitors • One of the most crash-prone, difficult components in the stack • Custom port monitors are expensive to build and maintain • USBMon andWSDMon are the preferred, supported port monitors and represent the best experience for customers • WSDMon is a foundational piece in the Rally platform • Microsoft is moving away from TCPMon– so should you

  11. Security Guidelines • User account control • Test drivers as a limited user • Store data only in the registry or in locations you control (not C:\Temp) • Clean up data in any temporary folders on uninstall • Data execution prevention (DEP) • Protects our customers from viruses • Do not disable DEP on the system or the application • Do not mark data pages as executable • Encrypt personally identifiable information • Secure devices should be denial-of-service safe • Clear unretrieved jobs • Always accept new jobs

  12. Call To Action • Review your development and test processes and make needed changes • Look for Best Practices Guide at WinHEC • Provide feedback to prninfo@microsoft.com

  13. Additional Resources • Blogs • Print Verifier Team Blog: http://blogs.msdn.com/PrintVerifier • WDK Documentation • Data Execution Prevention http://msdn.microsoft.com/en-us/library/aa366553.aspx • Updating Your Package-Aware Driver’s INF http://msdn.microsoft.com/en-us/library/cc678339.asp

  14. Related Sessions

More Related