Detection methods are the different methods defined in the update schemas for use in the applicability rules. Different detection tools expose different detection methods. The most available detection methods are those that query the system registry or file system.
Applicability rule schemas
Detection methods are defined by one or more of the following schemas:
BaseApplicabilityRules.xsd defines the basic applicability rules, including checks for specific Windows versions and file or registry key existence.
LogicalApplicabilityRules.xsd defines the logical operators (And, Or, Not, True, and False) that allow more complex expressions to be built from the basic rules.
MsiApplicabilityRules.xsd defines the applicability rules used by Windows Installer files.
WindowsDriver.xsd defines the applicability rules used by Windows drivers.
Registry-based detection methods are easy to use. However, there is no way to guarantee that the state of the registry corresponds to the state of the product or update. For example, a registry key may not be removed when the application is removed, or it may not be updated when a new version is installed.
|All registry keys used by detection methods must be written under HKEY_LOCAL_MACHINE.|
The following are some examples of registry-based detection methods (from BaseApplicabilityRules.xsd):
RegKeyExists checks whether the specified registry key exists.
RegValueExists checks whether a certain registry type and/or value exists for a specified registry key.
RegDword compares a registry value to a certain number.
RegExpandSz compares a REG_EXPAND_SZ value to a certain string.
RegSz compares a REG_SZ value to a certain string.
RegSzToVersion compares a REG_SZ value to a version string.
RegKeyLoop evaluates a rule against every subkey of a given registry key.
File system-based detection methods are the most robust kind of detection methods, although they can become extremely complex. For example, an applicability rule that checks the versions of all the files in a product service pack would be a very long rule.
File-system based detection methods can be combined with registry-based methods. For example, an applicability rule can determine whether a patch is installed by checking for its registry value, and confirm the installation state by checking a subset of file versions.
|Some file system-based detection methods specify file paths relative to a base path stored in a registry key. This registry key must exist under HKEY_LOCAL_MACHINE.|
The following are some examples of file system-based detection methods (from BaseApplicabilityRules.xsd):
FileExists checks whether the specified file exists.
FileExistsPrependRegSz checks whether the file exists at a location partially specified by a registry key.
FileVersion compares the file version to a specified version string.
FileVersionPrependRegSz compares the file version to a version string if the file exists at a location partially specified by a registry key.
FileCreated compares the file's creation date to a specified value.
FileCreatedPrependRegSz compares the file's creation date to a specified value if the file exists at a location partially specified by a registry key.
FileModified compares the file's modification date to a specified value.
FileModifiedPrependRegSz compares the file's modification date to a specified value at if the file exists a location partially specified by a registry key.
FileSize compares the file size to a specified value.
FileSizePrependRegSz compares the file size to a specified value if the file exists at a location partially specified by a registry key.
Some examples of installer-based detection methods are in the schema MsiApplicabilityRules.xsd.
MsiProductInstalled checks that the product specified by the Windows Installer product code is installed.
MsiFeatureInstalledForProduct checks that the specified features of the specified product are installed.
MsiComponentInstalledForProduct checks that the specified components of the specified product are installed.
MsiPatchInstalledForProduct checks that the specified patch of the specified product is installed.