The easiest way to create a .reg
file is to export a subkey from RegEdit.
The resulting file will look approximately like :
REGEDIT4
[HKEY_USERS\My SubKey]
"REG_SZ Entry"="Bla
bla bla"
"REG_DWORD Entry"=dword:00000040
"REG_BINARY Entry"=hex:01,00,01,00
"REG_EXPAND_SZ
Entry"=hex(2):30,31,32,33,00
"REG_MULTI_SZ
Entry"=hex(7):30,31,32,33,00,00,00 |
REGEDIT4 |
Header which identifies a .reg
file.
Windows 95/98/ME/NT header : REGEDIT4
Windows 2000 header :
Windows Registry Editor Version 5.00 |
[HKEY_USERS\My
SubKey] |
It is not
possible to use HKU, HKLM,
etc shortcuts. |
"REG_SZ
Entry"= |
REG_SZ entry name. |
"Bla
bla bla" |
REG_SZ
entry value. It is the only type which is not
specified explicitly but whose value is indicated
between quotes. |
"REG_DWORD
Entry"= |
REG_DWORD entry name. |
dword:00000040 |
dword:,
indicates a REG_DWORD entry in hexadecimal value
(40 hexadecimal = 64 decimal). |
"REG_BINARY
Entry"= |
REG_BINARY entry name. |
hex:01,00,01,00 |
hex:
indicates a REG_BINARY entry. |
"REG_EXPAND_SZ
Entry"= |
REG_EXPAND_SZ entry name. |
hex(2):30,31,32,33,00 |
hex(2):
indicates a REG_EXPAND_SZ entry. The hexadecimal
value indicated corresponds to decimal 0123. |
"REG_MULTI_SZ
Entry"= |
REG_MULTI_SZ entry name. |
hex(7):30,31,32,33,00,00,00 |
hex(7):
indicates a REG_MULTI_SZ entry. The hexadecimal
value indicated corresponds to decimal 0123. |
|
.inf files may
prove more practical insofar as they support more
functionalities. For example, they can be used to present
a menu and an uninstallation tool to the user :
[Version]
Signature = "$Windows NT$"
[Optional Components]
InstallMyOption
UninstallMyOption
[InstallMyOption]
AddReg = InstallMyOption.Procedure
OptionDesc = %Option1%
Tip = %Tip1%
IconIndex = 44
[UninstallMyOption]
AddReg = UninstallMyOption.Procedure
OptionDesc = %Option2%
Tip = %Tip2%
IconIndex = 45
[InstallMyOption.Procedure]
HKCU,Software\"My
SubKey","REG_SZ_A Entry",,"Bla
bla bla"
HKCU,Software\"My SubKey","REG_SZ_B
Entry",0,"Bli bli bli"
HKCU,Software\"My
SubKey","REG_SZ_C Entry",2,"Blu
blu blu"
HKCU,Software\"MyS
ubKey","REG_DWORD Entry",0x1001,40,00,00,00
HKCU,Software\"My
SubKey","REG_BINARY_A Entry",1,01,00,01,00
HKCU,Software\"My SubKey","REG_BINARY_B
Entry",3,02,00,02,00
[UninstallMyOption.Procedure]
HKCU,Software\"My
SubKey","REG_SZ_A Entry",,"Other
value"
HKCU,Software\"My SubKey","REG_SZ_B
Entry",0,"Other
value"
HKCU,Software\"My
SubKey","REG_SZ_C Entry",2,"Other
value"
HKCU,Software\"My
SubKey","REG_DWORD Entry",0x1001,Other
value
HKCU,Software\"My
SubKey","REG_BINARY_A Entry",1,Other
value
HKCU,Software\"My SubKey","REG_BINARY_B
Entry",3,Other value
[Strings]
Option1 = "Installing MyOption"
Tip1 = "Detailed description of MyOption's
installation."
Option2 = "Uninstalling MyOption"
Tip2 = "Detailed description of MyOption's
uninstallation." |
[Version]
Signature = "$Windows NT$" |
Header which identifies a .reg
file.
Windows 95/98/ME header : $Chicago$
Windows NT/2000 header :
$Windows NT$ |
[Optional
Components]
InstallMyOption
UninstallMyOption |
Procedure
list. |
[InstallMyOption]
AddReg = InstallMyOption.Procedure |
Calling the installation procedure. |
OptionDesc
= %Option1% |
Refers to
the installation option title. |
Tip
= %Tip1% |
Refers to the detailed description
of the installation option. |
IconIndex
= 44 |
Installation
option icon number. |
[UninstallMyOption]
AddReg = UninstallMyOption.Procedure |
Calling the uninstallation procedure. |
OptionDesc
= %Option2% |
Refers to
the uninstallation option title. |
Tip
= %Tip2% |
Refers to the detailed description
of the uninstallation option. |
IconIndex
= 45 |
Uninstallation
option icon number. |
[InstallMyOption.Procedure] |
Installation procedure. |
HKCU,Software\"My
SubKey","REG_SZ_A Entry",,"Bla
bla bla" |
Creating a
REG_SZ entry. Use quotes for key or value names
with spaces. The entry will be overwritten if it
already exists, type is implicit. |
HKCU,Software\"My
SubKey","REG_SZ_B Entry",0,"Bli
bli bli" |
Creating a REG_SZ entry. Use quotes
for key or value names with spaces. The entry
will be overwritten if it already exists, type 0. |
HKCU,Software\"My
SubKey","REG_SZ_C Entry",2,"Blu
blu blu" |
Creating a
REG_SZ entry. Use quotes for key or value names
with spaces. The entry will not be updated if it
already exists, type 2. |
HKCU,Software\"My
SubKey","REG_DWORD Entry",0x1001,40,00,00,00 |
Creating a REG_DWORD entry. Invert
the order of the 4 bytes. For example, indicate
40,00,00,00 to obtain 0x00000040. The entry will
be overwritten if it already exists, type 0x1001. |
HKCU,Software\"My
SubKey","REG_BINARY_A Entry",1,01,00,01,00 |
Creating a
REG_BINARY entry. The entry will be overwritten
if it already exists, type 1. |
HKCU,Software\"My
SubKey","REG_BINARY_B Entry",3,02,00,02,00 |
Creating a REG_BINARY entry. The
entry will not be updated if it already exists,
type 3. |
[UninstallMyOption.Procedure] |
Uninstallation
procedure. Syntax is the same. |
[Strings] |
National message strings header.
This section is to be translated into the
language of the platform where you want to
install this .inf file. |
Option1
= "Installing MyOption" |
Installation
option title which will be displayed in the
installation dialog box. |
Tip1
= "Detailed description of MyOption's
installation." |
Detailed description of installation
option which will be displayed at the bottom of
the installation dialog box. |
Option2
= "Uninstalling MyOption" |
Uninstallation
option title which will be displayed in the
installation dialog box. |
Tip2
= "Detailed description of MyOption's
uninstallation." |
Detailed description of
uninstallation option which will be displayed at
the bottom of the installation dialog box. |
|