Target Analyzer detection of previously installed hardware
Target Analyzer contains a quirk when used on an OS that has seen hardware changes.
Target Analyzer probes a target system for hardware-specific data to automatically generate a hardware inventory list that is stored in a PMQ file. The PMQ file can be used by Target Designer to automatically select the components that are necessary to support the hardware of the target system and to build the XP Embedded image.
Target Analyzer determines the hardware configuration of the target system by enumerating the contents of the registry keys located under HKEY_LOCAL_MACHINE (as shown). Those registry entries define the physical state of the computer, the bus type, the system memory and the installed software and hardware, including the Plug and Play information that is stored in the Enum branch.
Special attention should be given to the fact that the Enum branch not only includes a complete list of all the hardware currently present on the system, but also includes all the hardware that has ever been on the system. Target Analyzer captures all that information and stores it in the PMQ file.
A simple test may be run to see how this works. Run TAP.exe to capture the current hardware configuration of your machine. Rename the PMQ file to OriginalState.pmq, then connect a new device to your machine, for example a webcam, and run TAP.exe again. Rename the PMQ to WebCamInstalled.pmq.
If you compare WebCamInstalled.pmq with OriginalState.pmq you will notice that a section has been correctly added to describe the presence of the new device:
<DEVICE ConfigFlags="0">
<DEVICEDESC>WebCam Live! </DEVICEDESC>
<HARDWAREIDS>
<DEVICEID Order="1">USB\VID_041E&PID_4036&REV_0100</DEVICEID>
<DEVICEID Order="2">USB\VID_041E&PID_4036</DEVICEID>
</HARDWAREIDS>
<COMPATIBLEIDS>
<DEVICEID Order="1">USB\Class_FF&SubClass_FF&Prot_FF</DEVICEID>
<DEVICEID Order="2">USB\Class_FF&SubClass_FF</DEVICEID>
<DEVICEID Order="3">USB\Class_FF</DEVICEID>
</COMPATIBLEIDS>
</DEVICE>
Then remove the webcam from your machine, and run TAP.exe again. You will notice that the new PMQ file still reports the section shown above. In fact, if you access the registry you will notice that the Enum branch still lists the webcam among the system devices.
Importing a PMQ file to a configuration that includes hardware that is not currently installed will cause Target Designer to include components that are not required. Furthermore, those components may have dependencies on other components. When a dependency check is run with the auto-resolve option, the dependent components will be added to the configuration as well. As a result, the image will include unnecessary components and, consequently, have an increased footprint.
A good practice to avoid the risk of detecting previously installed hardware is to run TAP.exe from a clean installed OS, or from WinPE.