Previous Next

INF BitReg Directive

[DDInstall] |
[DDInstall.HW] |
[DDInstall.CoInstallers] |
[ClassInstall32] |
[ClassInstall32.ntx86] |
[ClassInstall32.ntia64]
 
BitReg=bit-registry-section[,bit-registry-section]...
 
 

A BitReg directive references one or more INF-writer-defined sections used to set or clear bits within an existing REG_BINARY-type value entry in the registry. However, this directive is very rarely used in device/driver INF files.

A BitReg directive can be specified under any of the sections shown in the formal syntax statement above. This directive also can be specified under any of the following INF-writer-defined sections:

Comments

Eachbit-registry-section name must be unique to the INF file, but it can be referenced by BitReg directives in other sections of the same INF. Each INF-writer-created section name must be unique within the INF and must follow the general rules for defining section names. These rules are described in General Syntax Rules for INF Files. For information about how to use the system-defined .nt, .ntx86, and .ntia64 extensions, see Creating INF Files for Multiple Platforms and Operating Systems.

Each named section referenced by an BitReg directive has the following form:

[bit-registry-section]
reg-root, [subkey], value-entry-name, [flags], byte-mask, byte-to-modify
reg-root, [subkey], value-entry-name, [flags], byte-mask, byte-to-modify
...

A bit-registry-section can have any number of entries, each on a separate line.

BitReg-Referenced Section Entries

reg-root
Identifies the root of the registry tree for other values supplied in this entry. The value can be one of the following:
HKCR
Abbreviation for HKEY_CLASSES_ROOT.
HKCU
Abbreviation for HKEY_CURRENT_USER.
HKLM
Abbreviation for HKEY_LOCAL_MACHINE.
HKU
Abbreviation for HKEY_USERS.
HKR
Relative root – that is, keys specified using this abbreviation are relative to the registry key associated with the INF section in which this BitReg directive appears, as indicated in the following table.
INF Section Containing BitReg Directive Registry Key Referenced by HKR
INF DDInstall section The device's software key
INF DDInstall.HW section The device's hardware key
INF DDInstall.Services section The Services key

Note that HKR cannot be used in an bit-registry-section referenced from an INF DefaultInstall section.

For more information about driver information stored under the HKEY_LOCAL_MACHINE root, see Driver Information in the Registry.

subkey
This optional value, expressed either as a %strkey% token defined in a Strings section of the INF or as a registry path under the given reg-root (key1\key2\key3...), specifies the key containing the value entry to be modified.
value-entry-name
Specifies the name of an existing REG_BINARY-type value entry in the (existing) subkey to be modified. It can be expressed either as "quoted string" or as a %strkey% token that is defined in the INF's Strings section.
flags
This optional hexadecimal value, expressed as an ORed bitmask of system-defined low word and high word flag values, specifies whether to clear or set the bits specified in the given byte-mask. Its default value is zero, meaning clear the bits in the 64-bit section of the registry. Specify one to set the bits. Bitmask values for each of these flags are as follows:
0x00000000 (FLG_BITREG_CLEARBITS)
Clear the bits specified by byte-mask.
0x00000001 (FLG_BITREG_SETBITS)
Set the bits specified by byte-mask.
0x00004000 (FLG_BITREG_32BITKEY)
(Windows XP and later.) Make the specified change in the 32-bit registry. If not specified, the change is made to the native registry.
byte-mask
This byte-sized mask, expressed in hexadecimal notation, specifies which bits to clear or set in the current value of the given value-entry-name.
byte-to-modify
This byte-sized value, expressed in decimal, specifies the zero-based index of the byte within the REG_BINARY-type value to be modified.

Comments

The value of an existing REG_BINARY-type value entry also can be modified by simply overwriting its current value within an add-registry section elsewhere in the INF file. For more information about add-registry sections, see the reference for the AddReg directive.

Using a BitReg directive requires the definition of another INF file section. However, the value of an existing REG_BINARY-type value entry can be modified bit-by-bit in such a section, thereby preserving the values of all remaining bits.

Examples

These examples show a bit-registry section for a fictional application.

[AppX_BitReg]
; set first bit of byte 0 in ProgramData value entry
HKLM,Software\AppX,ProgramData,1,0x01,0 
; preceding would change value 30,00,10 to 31,00,10
 
; clear high bit of byte 2 in ProgramData value entry
HKLM,Software\AppX,ProgramData,,0x80,2
; preceding would change value 30,00,f0 to 30,00,70
 
; set second and third bits of byte 1 in ProgramData value entry
HKLM,Software\AppX,ProgramData,1,0x06,1
; preceding would change value 30,00,f0 to 30,06,f0

See Also

AddInterface, AddReg, AddService, ClassInstall32, DDInstall, DDInstall.CoInstallers, DDInstall.HW, InterfaceInstall32