.. module:: innoreg :mod:`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* .. _ExecTI: https://winaero.com/comment.php?comment.news.1843 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 ----- .. literalinclude:: ../innoreg/help.txt :language: text .. raw:: html Compile **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``: .. raw:: html :file: ../innoreg/simple.html .. raw:: html simple.exe The first line contains the languages ​​to include in the executable, version 0.1 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 ------------------------ .. raw:: html :file: ../innoreg/admin.html .. raw:: html admin.exe 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 --------------- .. raw:: html :file: ../innoreg/custom.html .. raw:: html custom.exe 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 ------------ .. raw:: html long.exe 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 <../innoreg/long.ireg>`_ usable with administrator privileges, but some other registry keys require higher permissions. Full permissions ---------------- .. raw:: html :file: ../innoreg/trusted.html .. raw:: html trusted.exe ``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*