Printer Installation in Windows Vista - 1

Printer Installation in WindowsVista

May 3, 2006

Abstract

This paper provides information about printer installation for the Microsoft® Windows Vista™operating system. It provides guidelines for developerswho are writing or updating printer installation applications and INF files for Windows Vista.

This information applies for the Microsoft Windows Vistaoperating system.

The current version of this paper is maintained on the Web at:

The Microsoft Windows® Driver Kit should be used as the development resource for the topics discussed in this paper.

References and resources discussed here are listed at the end of this paper.

Contents

Introduction

The Windows Vista Driver Store

Using the Driver Store

Adding a Driver to the Driver Store

Installing a Driver from the Driver Store

Driver Package Dependencies

Printer Installation and Driver Packages

Compatibility with Earlier Versions of Windows

Package-aware Drivers

Package-aware Print Drivers that Do Not Share Files

Package-aware Print Drivers that Share Files

Writing Core Drivers

Core Driver Sample

Supporting More than One Version of Windows

Setup Applications and User Account Control

Marking Applications with Application Manifests

Creating an Application Manifest

Marking the Application with the Manifest

Verifying the Change

Nonadministrator Applications

Call to Action

Resources

Disclaimer

This is a preliminary document and may be changed substantially prior to final commercial release of the software described herein.

The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication.

This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT.

Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, email address, logo, person, place or event is intended or should be inferred.

© 2006 Microsoft Corporation. All rights reserved.

Microsoft, Visual Studio, Windows, and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

The names of actual companies and products mentioned herein may be the trademarks of their respective owners.

Introduction

Microsoft®Windows Vista™ introduces several new features that improve the security and stability of the Windows Vista platform. Although many of these features are not visible to the end user, they are of interest to the print driver developer.This paper describes new featuresof Windows Vista that a print driver developer should consider including in driver installation strategy and planning.

The Windows Vista Driver Store

Windows Vista introduces the driver store, a trusted cache of in-box and third-party drivers that are stored on a local hard disk.When a third-party driver is installed on Windows Vista, Setup automatically copies the driver package into the driver store and then installs the driver from the driver package in the driver store.A driver package that has been copied into the driver store is said to be staged.

Drivers can be staged without immediately being installed on the system so that they are availablefor installation later. Adding a driver package to the driver store, either during installation or separately, requires administrator rights. After a driver package is in the driver store, however, a standard user can install the driver.

Using the Driver Store

End users do not generally interact directly with the driver store. Print driver developers, however,must understand how the driver store is used during driver installation because it has a direct effect on the driver development process.

Adding a Driver to the Driver Store

Normal driver installation methods, such as INF-based installation or installation from a setup application, automatically copy the driver package into the driver store. Driver package integrity and signing are checked when the driver package is added to the driver store.

An administrator can also add a driver package to the driver store manually, without installing the driver, by using the pnputil.exe utility. Pnputil ships in Windows Vista and supports the following operations:

  • Add a specified driver package.
    pnputil.exe -a <package INF file>
  • Enumerate all third-party driver packages.
    pnputil.exe -e
  • Delete a specified driver package.
    pnputil.exe -d <package INF file>
  • Display usage help.
    pnputil.exe -?

Note that the driver store is a side-by-side store. Earlier versions of driver packages remain in the store even after a later version is added. Also, driver packages are not automatically deleted from the driver store when drivers are deleted.Standard driver ranking determines which driver is selecting during installation.

During driver development, there might be more than one version of the same driver package in the driver store, for example, as new versions are installed for testing. To ensure that the correct version of driver package is selected for installation, developers should use the DriverVer directive in the driver's INF file.

Drivers can be added to the driver store for later installation.For example,a computer vendor canadd driver packages to the driver store,without installing the drivers, to support custom hardware that might be installed lateron their computers.

Because the driver store is a trusted store, adding a package to the driver store is a privileged operation. A driver can be staged only by an administrator or a standard user who has been granted driver installation rights by the Group Policy for Devices policy.

Installing aDriver from the Driver Store

Drivers are installed from the driver store and not directly from media or other install location. The driver package remains in the driver store after the driver has been installed.A standard user can install a driver that is in the driver storeby using such methods as Plug and Play or the Add Printer Wizard.

Driver writers are not required to make any INF-file changes specifically to support the driver store. However, custom installation actions, such as those performed by co-installers, require administrative rights to run as they have in the past. If an administrator is not available during the installation of a driver that has these custom actions, the co-installer is not invoked until an administrator logs onto the machine.

Driver Package Dependencies

Before a driver package is added to the driver store, the package is checked to ensure that all files that the INF filereferences are actually in the driver package. Some INF files might refer to files that are not included in the driver package, whichis an INF-file bug. Although this was sometimes ignored in Windows XP, Windows Vista requiresthat all files that the INF file references are in the package or the package will not be staged.

Printer Installation and Driver Packages

In Windows Vista, Setup and the printing infrastructure use complete driver packages whenever possible:

  • Local printer installation. When a user installs a printer on a Windows Vista machine, Setup automatically adds the complete print driver package to the driver storeand then installs the driver.
  • Remote printer installation. When a user installs a print driver on a remote Windows Vista machine, Setup adds the complete print driver package to the driver store on the remote machineand then installs the print driver from the driver store on the remote machine.
  • Package point and print. When a Windows Vista client connects to a shared printer on another machine that is running Windows Vista, package point and print copies the complete driver package from the driver store on the remote print server to the driver store on the client. Then package point and print installs the driveron the local machine from the local driver store.
  • Web package point and print. When a Windows Vista client uses Hypertext Transfer Protocol (HTTP) to connect to a shared printerthat is hosted by a Windows Vista print server and has a driver package, web package point and print installs the driver in the same way aspackage pointand print.

Compatibility with Earlier Versions of Windows

The package point and print process in Windows Vista is different from the traditional point and printprocess on computers that are running WindowsXP or Windows Server™ 2003. In earlier versions of Microsoft Windows®, traditional point and print installs only basic printing functionality on the client. A Windows Vista client that is connecting to a Windows Vista server usespackage point and printto copy the entire driver package for installation. The advantages of package point and print are that:

  • All components of the driver are installed on the print client.
  • Driver signing and driver integrity are checked on the print client.
  • Point and print is more trustworthy and can be controlled better by administrators in a managed environment.

Windows Vista uses package installation as the preferred method of driver installation.Driver package installation requires the driver store,which is not available on earlier versions of Windows.When a client that is running an earlier version of Windows connects to a Windows Vista print server, the print server usestraditional point and print to install the printer on the client computer.

Package-aware Drivers

To use package point and print support, vendors must make some changes to the INF files. These changes make it possible for package point and print to accommodate the dependencies that the print driver might have. Print drivers that include these changes to the INF files are called package-aware print drivers.These changes can be minor and depend on the nature of the driver package.

  • If the files in the driver package are unique and are not listed in other print driver packages, use the PackageAware keyword in the INF.
  • If the files in the driver package are sharedwith files in other print driver packages:
  • Move the shared files into a separate, coredriver INF.
  • Use the PackageAware keyword and the CoreDriverDependencies keyword to refer to this separate core INF. This is necessary to avoid file version conflicts during various remote installation scenarios.

Package-aware Print Drivers that Do Not Share Files

Whenthe files in the driver package are unique, add a PrinterPackageInstallation section to the INF file. In that section, add the PackageAware keyword as shown in the following sample:

[Version]

Signature="$Windows NT$"

ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}

Class=Printer

Provider="OEM Company"

CatalogFile=PackageAware.cat ; Single Catalog file for all OS versions

DriverVer=10/10/2005, 1.2.3.4

[Manufacturer]

"OEM Company" = Company, NTx86.6.0

;Models section for installation of x86 driver on

; Windows Vista and later

[Company.NTx86.6.0]

"My Device Description" = DriverInstall_Vista, OEM_Company_NameABC_640A

[DriverInstall_Vista]

CopyFiles=@OEMRES.DLL,@OEMABC.GPD

DataFile=OEMABC.GPD

[PrinterPackageInstallation.x86]

PackageAware=TRUE

; Source Media Information Sections

[DestinationDirs]

DefaultDestDir=66000

[SourceDisksNames.x86]

1 = %MediaDescription%,,,"I386"

[SourceDisksFiles]

OEMRES.DLL = 1

OEMABC.GPD = 1

OEMCORE.DLL = 1

[Strings]

MediaDescription = "Description for Vendor provided media"

Package-aware Print Driversthat Share Files

Whenmore than one print driver package shares driver files, which is true for Universal (Unidrv) print drivers, the shared files must be isolated into a separate, coredriver package. For example, Unidrv is a collection of files thatmanyprint drivers use. Print drivers have used the Needs and IncludeINF-file directives in Unidrv print drivers as shown in the following section of an INF file for Windows XP:

[UniDrvInstall]

CopyFiles=@OEMRES.DLL,@OEMABC.GPD

DataFile=OEMABC.GPD

DataSection=UNIDRV_DATA

Include=NTPRINT.INF

Needs=UNIDRV.OEM,TTFSUB.OEM

In Windows Vista, a package-aware driver must use the new CoreDriverSections keyword when referring to Unidrv files as shown in this section from an INF file for Windows Vista:

[UniDrvInstall_Vista]

CopyFiles=@OEMRES.DLL,@OEMABC.GPD

DataFile=OEMABC.GPD

CoreDriverSections="{D20EA372-DD35-4950-9ED8-A6335AFE79F0}, UNIDRV.OEM, UNIDRV_DATA, TTFSUB.OEM"

In Windows Vista, the reference to NTPRINT.INF is no longer necessary because Unidrv is packaged as a core driver and referred to by its globally unique identifier (GUID). Other core files in Vista are listed in the following table.

Name / GUID
UNIDRV / {D20EA372-DD35-4950-9ED8-A6335AFE79F0}
PSCRIPT / {D20EA372-DD35-4950-9ED8-A6335AFE79F1}
PCLXL / {D20EA372-DD35-4950-9ED8-A6335AFE79F2}
PLOTTER / {D20EA372-DD35-4950-9ED8-A6335AFE79F4}
XPSDRV / {D20EA372-DD35-4950-9ED8-A6335AFE79F5}

Writing Core Drivers

Print driver writers can use the core driver functionality that Windows Vista provides. To make a core driver, generate a GUID that other driver packages can use to refer to the set of files that makes up the core driver. For example, in NTPRINT.INF, the Unidrv core driver file definition is shown in the following example:

[Microsoft.NTx86]

"{D20EA372-DD35-4950-9ED8-A6335AFE79F0}" = {D20EA372-DD35-4950-9ED8-A6335AFE79F0},{D20EA372-DD35-4950-9ED8-A6335AFE79F0}

[{D20EA372-DD35-4950-9ED8-A6335AFE79F0}]

CopyFiles=UNIDRV,PJLMON.DLL,@TTFSUB.GPD,@LOCALE.GPD,@MSXPSINC.GPD

[UNIDRV]

; Unidrv files and pjlmon sections follow…

With this definition, a print driver INF file can refer to core driver filesby using the CoreDriverSectionskeyword as shown in the previous sample.

It is important to note that a core driver package must retain compatibility with earlier versions. Because more than one driver may use the core driver, it must continue to work with existing drivers that depend on it when it is updated.

Core Driver Sample

The Windows Driver Kit includes the following sample as the PackageAware.inf file. This sample shows how to use the PackageAware keyword to support package point and print and how to define a core driver package that other print driver packages can use. This sample also demonstrates how an INF file can support more than one driver architecture.

[Version]

Signature="$Windows NT$"

ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}

Class=Printer

Provider="OEM Company"

CatalogFile=PackageAware.cat ; Single Catalog file for all OS versions

DriverVer=10/10/2005, 1.2.3.4

; Manufacturer and Models Sections

;Use decorations and platform extensions to differentiate between different platforms

[Manufacturer]

"OEM Company" = Company, NTx86.6.0, NTamd64.6.0

;Models section for installation of x86 driver on Windows Vista and above

[Company.NTx86.6.0]

"My Device Description" = DriverInstall_Vista, OEM_Company_NameABC_640A, ABC_UniDrv5_Printer

"{BD1D2EBA-CE77-4d4f-89D8-A5BF1CE00EB3}" = {BD1D2EBA-CE77-4d4f-89D8-A5BF1CE00EB3}, {BD1D2EBA-CE77-4d4f-89D8-A5BF1CE00EB3}

;Models section for installation of x64 driver on Windows Vista and above

[Company.NTamd64.6.0]

"My Device Description" = DriverInstall_Vista, OEM_Company_NameABC_640A, ABC_UniDrv5_Printer

"{BD1D2EBA-CE77-4d4f-89D8-A5BF1CE00EB3}" = {BD1D2EBA-CE77-4d4f-89D8-A5BF1CE00EB3}, {BD1D2EBA-CE77-4d4f-89D8-A5BF1CE00EB3}

;DDInstall Sections for Windows Vista and above

[DriverInstall_Vista]

CopyFiles=@OEMRES.DLL,@OEMABC.GPD

DataFile=OEMABC.GPD

CoreDriverSections="{D20EA372-DD35-4950-9ED8-A6335AFE79F0}, UNIDRV.OEM,UNIDRV_DATA,TTFSUB.OEM","{BD1D2EBA-CE77-4d4f-89D8-A5BF1CE00EB3},OEMCORE"

;"Fake" DDInstall section for OEM's own Core Printer Driver.

;This section must reference all files used by the Core Printer Driver (in this case OEMCORE.DLL)

;to ensure that the driver will be correctly imported into the Driver Store.

[{BD1D2EBA-CE77-4d4f-89D8-A5BF1CE00EB3}]

DriverVer=11/25/2005,2.3.4.5

CopyFiles=OEMCORE_FILES

; Core Printer Driver Section

;Note: in this case the Core Printer Driver Section contains only the CopyFiles keyword.

;In the general case however this section can contain any of the printer specific INF

;keywords such as DataFile, DriverFile, ConfigFile, LanguageMonitor ...

[OEMCORE]

CopyFiles=OEMCORE_FILES

;Note: in this case it may not be necessary to define a new section for the files,

;however in the general case this section may contain many core printer driver files

;in which case defining a unique section is of more value.

[OEMCORE_FILES]

OEMCORE.DLL

;These sections are to identify the Vista drivers as "Package Aware" to allow them to

;take advantage of features such as "Package Point-and-Print" in Vista and above

[PrinterPackageInstallation.x86]

PackageAware=TRUE

CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0},{BD1D2EBA-CE77-4d4f-89D8-A5BF1CE00EB3}

[PrinterPackageInstallation.amd64]

PackageAware=TRUE

CoreDriverDependencies={D20EA372-DD35-4950-9ED8-A6335AFE79F0},{BD1D2EBA-CE77-4d4f-89D8-A5BF1CE00EB3}

;This will ensure that the OEM's own Core Printer Driver is never displayed in the UI

[ControlFlags]

AlwaysExcludeFromSelect={BD1D2EBA-CE77-4d4f-89D8-A5BF1CE00EB3}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Source Media Information Sections

[DestinationDirs]

DefaultDestDir=66000

;Specify different paths for different processor architectures.

;Note that these paths are relative to the root of the physical media,

; e.g. the location where the INF is located.

[SourceDisksNames.x86]

1 = %MediaDescription%,,,"I386"

[SourceDisksNames.amd64]