innoreg
— Inno Setup Registry¶
innoreg
customizes Windows Registry.
Dependencies¶
- Python 3.6+
- Inno Setup 5u, 6 — chosen against NSIS for its DPI scaling
- ExecTI — optional, for full permissions
Registry¶
Keys | Content |
---|---|
HKCR [1] | → HKCU\Software\Classes + HKLM\Software\Classes |
HKCU | C:\Users\*\ NTUSER.DAT |
HKLM | HKLM\SYSTEM\CurrentControlSet\Control\hivelist |
HKLM\BCD00000000 | B:\Boot\ BCD [2] |
HKLM\SAM | C:\Windows\System32\config\ SAM |
HKLM\SECURITY | C:\Windows\System32\config\ SECURITY |
HKLM\SOFTWARE | C:\Windows\System32\config\ SOFTWARE |
HKLM\SYSTEM | C:\Windows\System32\config\ SYSTEM |
HKU\.DEFAULT [3] | C:\Windows\System32\config\ DEFAULT |
HKU\S-1-5-18 | → HKU\.DEFAULT |
HKU\S-1-5-19 | C:\Windows\ServiceProfiles\LocalService\ NTUSER.DAT |
HKU\S-1-5-20 | C:\Windows\ServiceProfiles\NetworkService\ NTUSER.DAT |
[1] | Write to HKCU or HKLM to modify HKCR , do not let HKCR choose for you |
[2] | To name B: the boot partition, right click on “This PC” → Manage → Disk Management |
[3] | .DEFAULT is the HKCU of the logon desktop and the System and Trusted Installer accounts |
Usage¶
usage: innoreg [-h] [-adelqrsuvx] [file] ...
Inno Setup Registry 0.4
positional arguments:
files *.ireg (expand and compile) or *.iss (compile)
optional arguments:
-h, --help show this help message and exit
-a, --admin auto-selected if key other than HKCU
-d, --default HKCU is C:\Users\Default
-e, --expand expand only, do not compile to *.exe
-l, --lang always shop language dialog
-q, --quiet hide errors
-r, --reboot prompt the user to restart the system
-s, --start start the new *.exe
-u, --users HKCU is C:\Users\Default + current user
-v, --verbose detail all actions and sections
-x, --x86 32 bit registry only
no file: -e stdin to stdout
Example: compile 3 scripts in parallel then start the created executables:
pip install innoreg
innoreg -s file1.ireg file2.iss file3.ireg
The expansion of the 2 scripts *.ireg
is sequential to ensure consistency of the error messages. The command ends when all executables are started, but does not wait for the end of these executables.
Exit status:
0: success 1: missing file 2: syntax error
The innoreg
command calls the innoreg()
function:
from innoreg import *
innoreg(('file1.ireg', 'file2.iss', 'file3.ireg'), 's')
Inno Setup 6 is used if both versions 5u and 6 are installed. The *.ireg
scripts must be in UTF-8 but not necessarily signed. The *.iss
scripts created by innoreg
are in UTF-8 with BOM signature because Inno Setup 5u and 6 assume that an unsigned file is ANSI encoded.
Syntax¶
innoreg
syntax is shorter than *.reg
files, the reg
command and PowerShell’s *-ItemProperty
:
en
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\
Advanced\HideFileExt 0 1
AutoplayHandlers\DisableAutoplay 1
CLSID\{20d04fe0-3aea-1069-a2d8-08002b30309d}\ 'PC'
+Serialize\StartupDelayinmsec 0
The first line contains the languages to include in the executable, version 0.4 offers en
and fr
.
The value HideFileExt
of type REG_DWORD
is 0 if the box is checked, 1 if unchecked. DisableAutoplay
is 1 if checked, is deleted if unchecked. The default value of the key {...}
is “PC” if checked, is deleted if unchecked.
Values are of type REG_SZ
in simple quotes, REG_EXPAND_SZ
with a %variable%
, REG_MULTI_SZ
in double quotes, REG_BINARY
in dots, REG_DWORD
without decorator.
Adding +
at line beginning creates the key if checked, deletes the key if unchecked. -
deletes the key if checked, creates the key if unchecked.
Do not worry about the key WoW6432Node
(Windows on Windows 64 bit, 32 bit Node), innoreg
writes all directives in 32 bit and 64 bit.
Administrator privileges¶
en fr
HKLM\Software\Policies\Microsoft\Windows\Explorer\DisableNotificationCenter 1!
HKLM\System\CurrentControlSet\Control\
Power\HibernateEnabled - 1
Session Manager\Memory Management\PagingFiles "" "?:\pagefile.sys"
Any key other than HKCU
activates the -a
option that causes run as administrator.
Adding !
at line ending marks the exclusivity between HKCU
and HKLM
, the value is deleted of HKCU
if defined in HKLM
and vice versa, useful for Group Policy.
Writing -
deletes the value, HibernateEnabled
is deleted if checked, but not PagingFiles
.
If several languages are included but not the final system language, a window offers the user to choose among the included languages.
Custom messages¶
en fr
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\
Explorer
Explorateur
Advanced\HideFileExt 0 1
Show file extensions
Afficher les extensions des fichiers
CLSID\{20d04fe0-3aea-1069-a2d8-08002b30309d}\ 'PC'
Rename “This PC” to “PC”
Renommer “Ce PC” en “PC”
HKLM\Software\Microsoft\Windows\CurrentVersion\
Windows
-Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}\
Hide Documents
Cacher Documents
Personalize messages if the values are not very explicit or have a meaning opposite to the desired effect: HideFileExt
becomes “Show file extensions”.
Write the messages in the language declaration order. If a message is missing, the message of the first language is displayed, start with English if possible. If an item has only one message, it is hard-coded as Description and does not overload the CustomMessages
section.
Long example¶
Inno Setup 5 classic wizard has a fixed size. Inno Setup 6 modern wizard can expand up to 50%, innoreg
sets the size according to the checkboxes.
Source code usable with administrator privileges, but some other registry keys require higher permissions.
Full permissions¶
en fr
HKLM\BCD00000000\Objects\{d810e1d4-0aa2-11e9-9b99-f526ca416017}\Elements\1600006c\Element .01.
Hide Windows logo at startup
Cacher le logo Windows au démarrage
HKLM\Software\Classes\CLSID\
Classes
{679f85cb-0220-4080-b29b-5540cc05aab6}\ShellFolder\Attributes a0600000 a0100000
Hide Quick access
Cacher l’accès rapide
{f02c1a0d-be21-4350-88b0-7367fc96ef3c}\ShellFolder\Attributes b0940064 b0040064
Hide Network
Cacher le réseau
HKLM\System\CurrentControlSet\Control\Power\User\PowerSchemes\381b4222-f694-41f0-9685-ff5bb260df2e\
Power
Alimentation
7516b95f-f776-4464-8c53-06167f40cc99\3c0bc021-c8a8-4e07-a973-6b14cbcb2b7e\ACSettingIndex 0
Do not turn off screen after 10 minutes
Ne pas éteindre l’écran après 10 minutes
238c9fa8-0aad-41ed-83f4-97be242c8f20\29f6c1db-86da-48c5-9fdb-f2b67b1f44da\ACSettingIndex 0
Do not go to sleep after 30 minutes
Ne pas mettre le PC en veille après 30 minutes
innoreg
does not handle permissions higher than administrator. You can run your executable as Trusted Installer with ExecTI to get full permissions on HKLM
but HKCU
will be the Trusted Installer account, this account has no profile, so HKCU
will be HKU\.DEFAULT
.
You cannot create a wizard that modifies both HKLM
with full permissions and HKCU
for the current user.
Versions¶
0.4: | February 16, 2019 — First beta release, Inno Setup 6 |
---|---|
0.3: | February 8, 2019 — import * imports innoreg() only |
0.2: | January 29, 2019 — Packaging with setuptools and metadata |
0.1: | January 28, 2019 — First alpha release |