51
Device Installation Device Installation For Windows For Windows ® ® 2000 2000 Lonny McMichael Lonny McMichael Plug and Play Development Plug and Play Development Lead Lead Windows NT Base Systems Windows NT Base Systems Microsoft Corporation Microsoft Corporation

Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Embed Size (px)

Citation preview

Page 1: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Device Installation For Device Installation For WindowsWindows®® 2000 2000

Lonny McMichaelLonny McMichaelPlug and Play Development LeadPlug and Play Development LeadWindows NT Base SystemsWindows NT Base SystemsMicrosoft CorporationMicrosoft Corporation

Page 2: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation
Page 3: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

AgendaAgenda

Goals for Plug and Play Goals for Plug and Play device installationdevice installation

Plug and Play device identificationPlug and Play device identification Device installation and the OS LifecycleDevice installation and the OS Lifecycle

Text-mode SetupText-mode Setup GUI-mode SetupGUI-mode Setup Upgrade IssuesUpgrade Issues Post-SetupPost-Setup

Page 4: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

AgendaAgenda

Improving the user experienceImproving the user experience INF rules to live byINF rules to live by Class installers and co-installersClass installers and co-installers Multifunction devicesMultifunction devices Custom setup applicationsCustom setup applications

INF generation and debugging toolsINF generation and debugging tools

Page 5: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Goals For Plug And Play Goals For Plug And Play Device InstallationDevice Installation Ideally, “prompt-less installation”Ideally, “prompt-less installation”

If possible, defer questions until first useIf possible, defer questions until first use Seamless integration of custom UISeamless integration of custom UI

Found New Hardware and Found New Hardware and Add Hardware wizardsAdd Hardware wizards

Separation of core driver from Separation of core driver from “value-add” software“value-add” software

Painless upgrade from Windows 95/98Painless upgrade from Windows 95/98

Page 6: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Plug And Play Plug And Play Device IdentificationDevice Identification Plug and Play starts early in boot Plug and Play starts early in boot

(during I/O system initialization)(during I/O system initialization) Machine topology represented Machine topology represented

as a devnode treeas a devnode tree Top-level devicesTop-level devices

HALHAL Root-enumerated (legacy or virtual devices)Root-enumerated (legacy or virtual devices)

Page 7: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Plug And Play Plug And Play Device IdentificationDevice Identification Retrieve identification information for Retrieve identification information for

device encountereddevice encountered Device and instance ID (for devnode name)Device and instance ID (for devnode name) Device capabilities (UniqueID capability Device capabilities (UniqueID capability

indicates whether we must “unique-ify” indicates whether we must “unique-ify” devnode name)devnode name)

Hardware and compatible IDs Hardware and compatible IDs (for INF matching)(for INF matching)

Page 8: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Processing A New DeviceProcessing A New Device

See if device is already installed and See if device is already installed and has no problemhas no problem

If so, attempt to start itIf so, attempt to start it If not yet installed, try to bootstrap device via If not yet installed, try to bootstrap device via

Critical Device Database (CDD)Critical Device Database (CDD) E.g., SCSI card moved to a different PCI slotE.g., SCSI card moved to a different PCI slot CDD is populated when devices in certain CDD is populated when devices in certain

“critical classes” are installed“critical classes” are installed If device starts successfully, ask the device If device starts successfully, ask the device

if it has children (a.k.a., enumeration)if it has children (a.k.a., enumeration) Repeat process until all leaf nodes in devnode Repeat process until all leaf nodes in devnode

tree have been reachedtree have been reached

Page 9: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Device Installation In Device Installation In Text-Mode SetupText-Mode Setup SETUPLDR is a variant of NTLDR SETUPLDR is a variant of NTLDR

that has some UI, allowing limited that has some UI, allowing limited user interactionuser interaction Prompt for boot floppiesPrompt for boot floppies Prompt for third-party HAL disk (via F5)Prompt for third-party HAL disk (via F5) Prompt for third-party mass storage driver Prompt for third-party mass storage driver

disk (via F6)disk (via F6)

Page 10: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

SETUPLDRSETUPLDR

Drivers necessary for accessing the Drivers necessary for accessing the boot device must be known a priori boot device must be known a priori (i.e., before Plug and Play has (i.e., before Plug and Play has enumerated the device)enumerated the device) All in-the-box mass storage drivers are All in-the-box mass storage drivers are

loadedloaded If upgrading, previously installed third-If upgrading, previously installed third-

party mass storage drivers are loadedparty mass storage drivers are loaded Any additional user-supplied drivers Any additional user-supplied drivers

are loadedare loaded

Page 11: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Third-Party Driver Support Third-Party Driver Support For Text-Mode SetupFor Text-Mode Setup Only necessary if device is needed in Only necessary if device is needed in

textmode setup (i.e., mass storage driver textmode setup (i.e., mass storage driver for boot device)for boot device)

Supplied via floppy disk, containing:Supplied via floppy disk, containing: Txtsetup.oem (INF-like format)Txtsetup.oem (INF-like format) Driver file(s), e.g., myscsi.sysDriver file(s), e.g., myscsi.sys Device INF, e.g., myscsi.infDevice INF, e.g., myscsi.inf Driver package catalog, e.g., myscsi.catDriver package catalog, e.g., myscsi.cat

Cannot override an in-the-box driverCannot override an in-the-box driver

Page 12: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Sample TXTSETUP.OEMSample TXTSETUP.OEM

[Disks][Disks]d1d1 = " = "OEM SCSI Driver diskOEM SCSI Driver disk", ", \disk1.tag\disk1.tag, , \\ [Defaults][Defaults]SCSI = SCSI = myscsimyscsi [SCSI][SCSI]myscsimyscsi = “ = “OEM Fast SCSI ControllerOEM Fast SCSI Controller"" [Files.SCSI.[Files.SCSI.myscsimyscsi]]driver = driver = d1d1, , myscsi.sysmyscsi.sys, , myscsimyscsiinf = inf = d1d1, , myscsi.infmyscsi.infcatalog = catalog = d1d1, , myscsi.catmyscsi.cat [Config.[Config.myscsimyscsi]]value = parameters\PnpInterface,5,REG_DWORD,1value = parameters\PnpInterface,5,REG_DWORD,1

[HardwareIds.scsi.[HardwareIds.scsi.myscsimyscsi]]id = "id = "PCI\VEN_9205&DEV_8111PCI\VEN_9205&DEV_8111",“",“myscsimyscsi""

Page 13: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Problems With DDK Problems With DDK Example TXTSETUP.OEMExample TXTSETUP.OEM Specifies a “tag” for the driver in the Specifies a “tag” for the driver in the

[Config.service] section:[Config.service] section:value = "",tag,REG_DWORD,5value = "",tag,REG_DWORD,5

This is not necessary. (Tags are automatically This is not necessary. (Tags are automatically assigned in GUI setup)assigned in GUI setup)

Furthermore, the tag chosen conflicts with a tag Furthermore, the tag chosen conflicts with a tag already assigned to an in-the-box SCSI miniportalready assigned to an in-the-box SCSI miniport

[HardwareIds.scsi.service] section is omitted [HardwareIds.scsi.service] section is omitted Necessary to match Plug and Play ID -> driverNecessary to match Plug and Play ID -> driver

Page 14: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Device Installation In Device Installation In GUI-Mode SetupGUI-Mode Setup ““Installing and Configuring Devices”Installing and Configuring Devices”

1.1. Install all hardware in devnode treeInstall all hardware in devnode tree

2.2. Do (ordered) detection for legacy hardware Do (ordered) detection for legacy hardware and “one time” setup (e.g., installing audio and “one time” setup (e.g., installing audio codecs, etc.)codecs, etc.)

3.3. Install any additional hardware that may Install any additional hardware that may have been enumerated off of devnodes have been enumerated off of devnodes installed during Step 2installed during Step 2

Page 15: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

GUI-Mode Setup GUI-Mode Setup

All non-present devices are marked All non-present devices are marked as “needs reinstall”as “needs reinstall”

Devices requiring UI for installation Devices requiring UI for installation are deferredare deferred These devices may be installed during net setup These devices may be installed during net setup

(e.g., ISDN cards) (e.g., ISDN cards) Or postponed until 1st loginOr postponed until 1st login

%windir%%windir%\pnplog.txt is used when restarting \pnplog.txt is used when restarting GUI-mode setup to skip:GUI-mode setup to skip: Class installers that hung during detectionClass installers that hung during detection Devices that hung during installationDevices that hung during installation

Page 16: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Device Installation Upgrade Device Installation Upgrade Issues (Windows 95/98)Issues (Windows 95/98) Existing installed Windows 95/98 Existing installed Windows 95/98

drivers assumed to be incompatible with drivers assumed to be incompatible with Windows 2000Windows 2000

Windows 95/98 migration code in winnt32.exe Windows 95/98 migration code in winnt32.exe searches for devnodes that are not supported searches for devnodes that are not supported by in-the-box Windows 2000 driversby in-the-box Windows 2000 drivers User is prompted for location of driver package User is prompted for location of driver package

that supports Windows 2000that supports Windows 2000 Driver package is copied to hard drive and used Driver package is copied to hard drive and used

later in GUI-mode setuplater in GUI-mode setup

Page 17: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Windows 95/98 Windows 95/98 Upgrade IssuesUpgrade Issues Alternatively IHVs/OEMs may supply Alternatively IHVs/OEMs may supply

migration DLLmigration DLL Preferable for unattended upgrades Preferable for unattended upgrades

(e.g., corporate deployment)(e.g., corporate deployment) Required if the driver package makes use Required if the driver package makes use

of include= and needs= directivesof include= and needs= directives A generic migration DLL that can be A generic migration DLL that can be

distributed with a Windows 2000-distributed with a Windows 2000-compatible driver package is available at compatible driver package is available at http://www.microsoft.com/hwdev/ntdrivers/http://www.microsoft.com/hwdev/ntdrivers/

Page 18: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Device Installation Device Installation Post-SetupPost-Setup New devices encountered (either at boot New devices encountered (either at boot

or plugged in later) are relayed to user-or plugged in later) are relayed to user-mode Plug and Play Managermode Plug and Play Manager

Happens regardless of whether or not Happens regardless of whether or not we can immediately start the devicewe can immediately start the device I.e., because it can run without a driver I.e., because it can run without a driver

(i.e., (i.e., RawDeviceOKRawDeviceOK capability is set), or capability is set), or It has an entry in the It has an entry in the Critical Device Critical Device

DatabaseDatabase

Page 19: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Server-Side InstallServer-Side Install

Installation of devices attempted by the Installation of devices attempted by the user-mode Plug and Play Manageruser-mode Plug and Play Manager

Devices are installed in the system Devices are installed in the system security contextsecurity context

Allows certain devices to be installed Allows certain devices to be installed without requiring an administrator to log inwithout requiring an administrator to log in

Installs devices required for login Installs devices required for login (e.g., keyboard)(e.g., keyboard)

Installs virtual devices controlled remotely Installs virtual devices controlled remotely (e.g., volumes created by remoted disk (e.g., volumes created by remoted disk nanagement snapin)nanagement snapin)

Not to be confused with server computersNot to be confused with server computers

Page 20: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Server-Side InstallServer-Side Install Criteria required for server-side install:Criteria required for server-side install: Signed driver packageSigned driver package Class installer and co-installers must also Class installer and co-installers must also

be signed (treated as trusted code)be signed (treated as trusted code) All files must be locally accessibleAll files must be locally accessible

Cannot prompt user to insert media or find Cannot prompt user to insert media or find driver componentsdriver components

Note all in-the-box drivers are available Note all in-the-box drivers are available locally in driver.cablocally in driver.cab

No UI whatsoever (non-interactive)No UI whatsoever (non-interactive) RunOnce can only launch RunDll32 RunOnce can only launch RunDll32

Required for KS/SWENUM-based devicesRequired for KS/SWENUM-based devices

Page 21: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Client-Side InstallClient-Side Install

Plug and Play resorts to client-side Plug and Play resorts to client-side install when server-side criteria is install when server-side criteria is not metnot met

““Traditional install” done interactively Traditional install” done interactively with logged-in userwith logged-in user

Requires administrative privilegesRequires administrative privileges User can browse for third-party files, User can browse for third-party files,

search Windows Update, etc.search Windows Update, etc. Install can ask additional questions, Install can ask additional questions,

prompt user for installation of additional prompt user for installation of additional software, etc.software, etc.

Page 22: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

The Structure Of An INFThe Structure Of An INF[ControlFlags][ControlFlags] ExcludeFromSelect.NT = ExcludeFromSelect.NT = PCI\VENPCI\VEN 9205&DEV9205&DEV 81118111

[Manufacturer][Manufacturer] └└““Vendor A”Vendor A” = = VendorAVendorA └└[[VendorAVendorA]] ├ ├””Vendor A Non-PnP Device” Vendor A Non-PnP Device” = = VendorA-LegacyVendorA-Legacy, , *PNP1234*PNP1234 │ ├ │ ├[[VendorA-LegacyVendorA-Legacy]] ; ; Windows 95/98/ME installationWindows 95/98/ME installation │ │ ├ │ │ ├[[VendorA-LegacyVendorA-Legacy.FactDef].FactDef] │ │ ├ │ │ ├[[VendorA-LegacyVendorA-Legacy.HW].HW] │ │ │ │ └└[[VendorA-LegacyVendorA-Legacy.Interfaces].Interfaces] │ │ └└[[VendorA-LegacyVendorA-Legacy.NTx86].NTx86] ; ; Windows 2000 installationWindows 2000 installation │ ├ │ ├[[VendorA-LegacyVendorA-Legacy.NTx86.CoInstallers].NTx86.CoInstallers] │ ├ │ ├[[VendorA-LegacyVendorA-Legacy.NTx86.FactDef].NTx86.FactDef] │ ├ │ ├[[VendorA-LegacyVendorA-Legacy.NTx86.HW].NTx86.HW] │ ├ │ ├[[VendorA-LegacyVendorA-Legacy.NTx86.Services].NTx86.Services] │ │ └└[[VendorA-LegacyVendorA-Legacy.NTx86.Interfaces].NTx86.Interfaces] └└””Vendor A PnP Device” Vendor A PnP Device” = = VendorA-PnPVendorA-PnP, , PCI\VENPCI\VEN 9205&DEV9205&DEV 81118111 ├ ├[[VendorA-PnPVendorA-PnP]] ; ; Windows 95/98/ME Windows 95/98/ME

installationinstallation │ ├ │ ├[[VendorA-PnPVendorA-PnP.HW].HW] │ │ └└[[VendorA-PnPVendorA-PnP.Interfaces].Interfaces] └└[[VendorA-PnPVendorA-PnP.NTx86].NTx86] ; ; Windows 2000 installationWindows 2000 installation ├ ├[[VendorA-PnPVendorA-PnP.NTx86.CoInstallers].NTx86.CoInstallers] ├ ├[[VendorA-PnPVendorA-PnP.NTx86.LogConfigOverride].NTx86.LogConfigOverride] ├ ├[[VendorA-PnPVendorA-PnP.NTx86.HW].NTx86.HW] ├ ├[[VendorA-PnPVendorA-PnP.NTx86.Services].NTx86.Services] └└[[VendorA-PnPVendorA-PnP.NTx86.Interfaces].NTx86.Interfaces]

Page 23: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

The [Version] SectionThe [Version] Section

The The LayoutFile= LayoutFile= entryentry Can only reference system INFs Can only reference system INFs

(e.g., layout.inf)(e.g., layout.inf) If possible, use If possible, use include= include= and and needs=needs=

directives to reference common install directives to reference common install sections provided in system INFs sections provided in system INFs

The The DriverVer=DriverVer= entry entry Format is Format is mmmm//dddd//yyyyyyyy[,[,xx..yy..vv..zz] ] Date is used in signed INFs to select Date is used in signed INFs to select

“newer” driver from identically-ranked “newer” driver from identically-ranked matchesmatches Date is ignored for unsigned INFsDate is ignored for unsigned INFs Version is informational onlyVersion is informational only

Page 24: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

The [Version] SectionThe [Version] Section

The The CatalogFile=CatalogFile= entry entry Ignored by Windows 95 and Ignored by Windows 95 and

Windows NTWindows NT®® 4.0 4.0 Single catalog file may be used if same files Single catalog file may be used if same files

are installed for Windows 98/ME and are installed for Windows 98/ME and Windows 2000 (e.g., WDM driver) Windows 2000 (e.g., WDM driver) CatalogFile=CatalogFile=mydev.catmydev.cat

If two If two differentdifferent sets of files are required (one sets of files are required (one for Windows 98/ME and another for for Windows 98/ME and another for Windows 2000), two different catalogs may Windows 2000), two different catalogs may be specifiedbe specifiedCatalogFile=CatalogFile=mydev.cat mydev.cat ; used by Win98/ME; used by Win98/MECatalogFile.NTx86=CatalogFile.NTx86=mydevnt.cat mydevnt.cat ; used by Win2K; used by Win2K

Page 25: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

To Copy Or Not To Copy…To Copy Or Not To Copy…

Copy files that originate from youCopy files that originate from you Your INF must contain source media Your INF must contain source media

descriptors for these files in its descriptors for these files in its [SourceDisksNames] and [SourceDisksNames] and [SourceDisksFiles] sections[SourceDisksFiles] sections

Do not redistribute files that originate Do not redistribute files that originate from Microsoft (e.g., msvcrt.dll)from Microsoft (e.g., msvcrt.dll) Use Use include=include=//needs=needs= to perform base to perform base

device installation from MS-provided INFdevice installation from MS-provided INF NeverNever directly copy an INF into %windir directly copy an INF into %windir

%\Inf%\Inf Use SetupCopyOEMInf insteadUse SetupCopyOEMInf instead

Page 26: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Class Installers And Class Installers And Co-InstallersCo-Installers Each device setup class may have Each device setup class may have

a class installera class installer Each device setup class may have zero Each device setup class may have zero

or more class-specific co-installersor more class-specific co-installers Each device instance may have zero Each device instance may have zero

or more device-specific co-installersor more device-specific co-installers

Page 27: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Class InstallersClass Installers

Installed when a new device setup Installed when a new device setup class is registered via [ClassInstall32 ] class is registered via [ClassInstall32 ] Class installer is only installed Class installer is only installed once – once – the the

first time a device is encountered whose first time a device is encountered whose INF’s class isn’t already registeredINF’s class isn’t already registered

Microsoft-provided class installers are Microsoft-provided class installers are updated at system-upgrade timeupdated at system-upgrade time

Don’t define a new class to “tweak” Don’t define a new class to “tweak” behavior of an existing class installerbehavior of an existing class installer Use co-installer to customize class Use co-installer to customize class

installer behaviorinstaller behavior

Page 28: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Class Co-InstallersClass Co-Installers

System-supplied class co-installers are System-supplied class co-installers are registered at system setup timeregistered at system setup time

Class co-installers operate on Class co-installers operate on everyevery device of a given class, typically not device of a given class, typically not the desired result for third-party codethe desired result for third-party code

If in doubt, use a device-specific If in doubt, use a device-specific co-installerco-installer

Page 29: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Device Co-InstallersDevice Co-Installers

Device co-installers are registered Device co-installers are registered when the device is installedwhen the device is installed INF [INF [DDInstallDDInstall.CoInstallers] section.CoInstallers] section Happens during Happens during

DIF_REGISTER_COINSTALLERSDIF_REGISTER_COINSTALLERS Takes place Takes place afterafter file copying file copying

(DIF_INSTALLDEVICEFILES), but (DIF_INSTALLDEVICEFILES), but beforebefore registration of device interfaces registration of device interfaces (DIF_INSTALLINTERFACES) and (DIF_INSTALLINTERFACES) and completion of device installation completion of device installation (DIF_INSTALLDEVICE)(DIF_INSTALLDEVICE)

Page 30: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Device Co-InstallersDevice Co-Installers

Most common (and simplest) way Most common (and simplest) way to extend device installation to extend device installation with custom codewith custom code

Caveat: Upgrading a device Caveat: Upgrading a device co-installer during driver upgrade co-installer during driver upgrade is “difficult”is “difficult” Current (i.e., old) co-installer is already Current (i.e., old) co-installer is already

in-use, so new one must be queued up in-use, so new one must be queued up for delayed rename (requires reboot)for delayed rename (requires reboot)

If necessary to update co-installer, use If necessary to update co-installer, use new name (e.g., coinstv2.dll)new name (e.g., coinstv2.dll)

Page 31: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Handling A Device Install Handling A Device Install (DIF) Request (Step 1)(DIF) Request (Step 1)

Class-specificClass-specific Co-installerCo-installer

Device-specificDevice-specific Co-installerCo-installer Class InstallerClass Installer

DIF_INSTALLDEVICEDIF_INSTALLDEVICE

NO_ERRORNO_ERROR

Page 32: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Handling a Device Install Handling a Device Install (DIF) Request (Step 2)(DIF) Request (Step 2)

Class-specificClass-specific Co-installerCo-installer

Device-specificDevice-specific Co-installerCo-installer Class InstallerClass Installer

DIF_INSTALLDEVICEDIF_INSTALLDEVICE

ERROR_DI_POSTPROCESSING_REQUIREDERROR_DI_POSTPROCESSING_REQUIRED

Page 33: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Handling A Device Install Handling A Device Install (DIF) Request (Step 3)(DIF) Request (Step 3)

Class-specificClass-specific Co-installerCo-installer

Device-specificDevice-specific Co-installerCo-installer Class InstallerClass Installer

DIF_INSTALLDEVICEDIF_INSTALLDEVICE

ERROR_DI_DO_DEFAULTERROR_DI_DO_DEFAULT

Page 34: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Handling A Device Install Handling A Device Install (DIF) Request (Step 4)(DIF) Request (Step 4)

Class-specificClass-specific Co-installerCo-installer

Device-specificDevice-specific Co-installerCo-installer Class InstallerClass Installer

Since the class installer responded withSince the class installer responded withERROR_DI_DO_DEFAULT, the defaultERROR_DI_DO_DEFAULT, the defaultaction is taken. For DIF_INSTALLDEVICE,action is taken. For DIF_INSTALLDEVICE,the default handler is SetupDiInstallDevice.the default handler is SetupDiInstallDevice.

Page 35: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Handling A Device Install Handling A Device Install (DIF) Request (Step 5)(DIF) Request (Step 5)

Class-specificClass-specific Co-installerCo-installer

Device-specificDevice-specific Co-installerCo-installer Class InstallerClass Installer

DIF_INSTALLDEVICE, DIF_INSTALLDEVICE, InstallResult InstallResult = NO_ERROR= NO_ERROR

NO_ERRORNO_ERROR

Page 36: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

An Example Co-Installer ForAn Example Co-Installer ForMulti-Function DevicesMulti-Function Devices The problem: Multi-function devices The problem: Multi-function devices

expose several devnodes, each expose several devnodes, each potentially having different device setup potentially having different device setup classes and requiring different INFsclasses and requiring different INFs

If devices aren’t supported in the box, If devices aren’t supported in the box, the user has to step through “Found New the user has to step through “Found New Hardware” wizard for each device, and Hardware” wizard for each device, and go back to setup media to retrieve each go back to setup media to retrieve each device’s INF individuallydevice’s INF individually

Page 37: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Multi-Function Co-Installer Multi-Function Co-Installer

A first attempt might be to add all the A first attempt might be to add all the necessary INFs to a necessary INFs to a CopyFiles CopyFiles section section in each INFin each INF As previously discussed, this is a no-noAs previously discussed, this is a no-no INF’s catalog wouldn’t be installed in INF’s catalog wouldn’t be installed in

catalog store (thus would appear unsigned)catalog store (thus would appear unsigned) Original source path information wouldn’t Original source path information wouldn’t

be stored with INF, thus prompt for files be stored with INF, thus prompt for files wouldn’t point to correct locationwouldn’t point to correct location

Page 38: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Multi-Function Co-Installer Multi-Function Co-Installer

Instead, we can use a device-Instead, we can use a device-specific co-installer to cause the specific co-installer to cause the additional INFs to be installed additional INFs to be installed properly via SetupCopyOEMInfproperly via SetupCopyOEMInf If all devices are enumerated as peers If all devices are enumerated as peers

of each other (i.e., may appear in any of each other (i.e., may appear in any order), then co-installer must be order), then co-installer must be registered for each of themregistered for each of them

If a single device is enumerated and it If a single device is enumerated and it enumerates the other devices as its enumerates the other devices as its children, then co-installer only needs children, then co-installer only needs to be registered for that deviceto be registered for that device

Page 39: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Multi-Function Co-InstallerMulti-Function Co-Installer

Co-installer installs additional INFs Co-installer installs additional INFs during postprocessing of a successful during postprocessing of a successful DIF_INSTALLDEVICE requestDIF_INSTALLDEVICE request

INFs to be copied are specified in the INFs to be copied are specified in the INF’s INF’s DDInstallDDInstall section as follows: section as follows:

CopyINF = CopyINF = filename.inffilename.inf[,[,filename2.inffilename2.inf]...]...

Co-installer does not complete the Co-installer does not complete the CopyInf CopyInf operation if the 3operation if the 3rdrd-party INF is -party INF is already in %windir%\Infalready in %windir%\Inf UsesUses

SetupQueryInfOriginalFileInformation SetupQueryInfOriginalFileInformation Not presently documented in DDK docsNot presently documented in DDK docs

Page 40: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Multi-Function Co-InstallerMulti-Function Co-Installer

Provided as a redistributable sample Provided as a redistributable sample on the WinHEC CD (on the WinHEC CD (cocpyinf.dllcocpyinf.dll))

To register this from your INFs:To register this from your INFs:[DestinationDirs][DestinationDirs]CoInstaller_CopyCoInstaller_Copy = 11 \\DIRID_SYSTEM = 11 \\DIRID_SYSTEM

[[DDInstallDDInstall.CoInstallers] .CoInstallers] CopyFiles = CopyFiles = CoInstaller_CopyCoInstaller_CopyAddReg = AddReg = CoInstaller_AddRegCoInstaller_AddReg [[CoInstaller_CopyCoInstaller_Copy]]cocpyinf.dllcocpyinf.dll [[CoInstaller_AddRegCoInstaller_AddReg]]HKR,,CoInstallers32,0x00010000,“cocpyinf.dll,CoCopyINF“HKR,,CoInstallers32,0x00010000,“cocpyinf.dll,CoCopyINF“

Be sure to add Be sure to add cocpyinf.dllcocpyinf.dll to your to your INF’s [SourceDisksFiles] sectionINF’s [SourceDisksFiles] section

Page 41: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Custom Setup ApplicationsCustom Setup Applications

The problem: Customers approach The problem: Customers approach device installation in different waysdevice installation in different ways Plug in hardware firstPlug in hardware first

Two scenarios here, depending on whether Two scenarios here, depending on whether or not the device is supported by drivers or not the device is supported by drivers that ship with the OSthat ship with the OS

Insert driver support CD firstInsert driver support CD first May or may not include installation of May or may not include installation of

value-add software (e.g., imaging app, etc.)value-add software (e.g., imaging app, etc.)

Page 42: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Custom Setup ApplicationsCustom Setup Applications

In the past, many solutions have In the past, many solutions have been attemptedbeen attempted INF-based installation (difficult to install INF-based installation (difficult to install

value-add software, results in RunOnce value-add software, results in RunOnce nastiness, etc.)nastiness, etc.)

Custom setup application (user is Custom setup application (user is instructed to “Click cancel on Found New instructed to “Click cancel on Found New Hardware popup”)Hardware popup”) May or may not use device installer, May or may not use device installer,

depending on whether there’s another depending on whether there’s another (non-Plug and Play) way to install the device(non-Plug and Play) way to install the device

Page 43: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Ideal Experience For Ideal Experience For Plugging In Hardware FirstPlugging In Hardware First Device supported by in-box driver(s)Device supported by in-box driver(s)

Automatically install drivers (no Automatically install drivers (no prompting) – get the device up and prompting) – get the device up and running – Goal is ”it just works”running – Goal is ”it just works”

User can insert vendor-supplied support User can insert vendor-supplied support disk (e.g., CD which launches an disk (e.g., CD which launches an auto-run app)auto-run app) App can upgrade existing devices App can upgrade existing devices

to newer/better driverto newer/better driver App can also launch MicrosoftApp can also launch Microsoft®® Installer Installer

(MSI) for value-add software(MSI) for value-add software

Page 44: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Ideal Experience For Ideal Experience For Plugging In Hardware FirstPlugging In Hardware First No in-box supportNo in-box support

User gets “Found New Hardware” popupUser gets “Found New Hardware” popup They insert the vendor-supplied support They insert the vendor-supplied support

disk, then let the wizard search for driversdisk, then let the wizard search for drivers Driver is found on vendor disk, and install Driver is found on vendor disk, and install

proceeds using that INFproceeds using that INF Installation of associated value-add Installation of associated value-add

software is integrated into the end of the software is integrated into the end of the “Found New Hardware” wizard in one “Found New Hardware” wizard in one seamless UI experienceseamless UI experience

Page 45: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Ideal Experience For Ideal Experience For Inserting Driver CD FirstInserting Driver CD First Setup launches from auto-run CDSetup launches from auto-run CD ““Pre-installs” necessary INF(s)Pre-installs” necessary INF(s) Installs any value-add software the Installs any value-add software the

user wantsuser wants If device is hot-pluggable (e.g., USB device), If device is hot-pluggable (e.g., USB device),

instruct user to plug in the deviceinstruct user to plug in the device If bus doesn’t provide hot-plug notification, If bus doesn’t provide hot-plug notification,

initiate re-enumerationinitiate re-enumeration Otherwise, instruct user to power-down Otherwise, instruct user to power-down

machine and plug-in devicemachine and plug-in device

Page 46: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

How To Achieve “Ideal”How To Achieve “Ideal” Device-specific co-installerDevice-specific co-installer SetupCopyOEMInfSetupCopyOEMInf UpdateDriverForPlugAndPlayDevicesUpdateDriverForPlugAndPlayDevices CMP_WaitNoPendingInstallEventsCMP_WaitNoPendingInstallEvents

Suppress autorun when CD is inserted for Suppress autorun when CD is inserted for “Found New Hardware” wizard“Found New Hardware” wizard

Supply “finish-install” wizard page(s)Supply “finish-install” wizard page(s) Separate core driver files from Separate core driver files from

value-add softwarevalue-add software Core driver files installed via stand-alone Core driver files installed via stand-alone

Plug and Play device INFPlug and Play device INF Value-add software authored in MSIValue-add software authored in MSI

Page 47: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

INF Generation And INF Generation And Debugging ToolsDebugging Tools DDK toolsDDK tools

GenINF – GenINF – INF generation utilityINF generation utility ChkINF – ChkINF – useful for troubleshooting INF useful for troubleshooting INF

problems and preparing for WHQL problems and preparing for WHQL certificationcertification

%windir%\setupapi.log%windir%\setupapi.log Useful for troubleshooting device Useful for troubleshooting device

installation problemsinstallation problems Verbosity is configurable – documented in Verbosity is configurable – documented in

the DDK under “Troubleshooting Device the DDK under “Troubleshooting Device Installation”Installation”

Page 48: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Device Manager And Device Manager And Non-Present DevicesNon-Present Devices On Windows 2000, Device Manager On Windows 2000, Device Manager

must be used to uninstall devicesmust be used to uninstall devices Devices that aren’t physically present Devices that aren’t physically present

aren’t displayed by defaultaren’t displayed by default To access non-present devices, set the To access non-present devices, set the

following environment variable to a following environment variable to a non-zero value before launching non-zero value before launching devmgmt.msc:devmgmt.msc:

DEVMGR_SHOW_NONPRESENT_DEVICESDEVMGR_SHOW_NONPRESENT_DEVICES

Page 49: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Additional InformationAdditional Information

WinHEC CD ContentWinHEC CD Content Windows 2000 DDK (Device Installation)Windows 2000 DDK (Device Installation) Windows 2000 SDK (Microsoft Installer)Windows 2000 SDK (Microsoft Installer) http://www.microsoft.com/windows2000/http://www.microsoft.com/windows2000/ http://www.microsoft.com/hwdev/http://www.microsoft.com/hwdev/ Windows Hardware NewsletterWindows Hardware Newsletter Microsoft Developer SupportMicrosoft Developer Support

Page 50: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation

Call To ActionCall To Action

Provide Windows 2000 support with Provide Windows 2000 support with your devices!your devices!

Provide stand-alone device INF, Provide stand-alone device INF, obtain WHQL certificationobtain WHQL certification

Augment your installation with Augment your installation with co-installers, etc. to provide seamless co-installers, etc. to provide seamless user experienceuser experience

Use Microsoft Installer (MSI) technology Use Microsoft Installer (MSI) technology to install value-add softwareto install value-add software

Page 51: Device Installation For Windows ® 2000 Lonny McMichael Plug and Play Development Lead Windows NT Base Systems Microsoft Corporation