Skip navigation

JSI Tip 6143. REGLN freeware creates REG_LINK registry data types.

Download REGLN - Manage Windows Registry Links 

REGLN - Manage Windows Rregistry Links                           V16R3

Antoni Sawicki ; Dublin, February 2003; Index ~~~~~ - Legal stuff - Usage Copyright (c) 1999-2003 by NTinternals Team, C4 Corporation License: This software is distributed under the terms and conditions of GPL - Gnu General Public License. The software is provided AS IS and ABSOLUTELY NO WARRANTY IS GIVEN. The author takes no any responsibility for damages or any consequences of usage of this software. Please read the attached file: GPL.TXT for more informations. For informations regarding modifications and redistribution please refer to GPL.TXT as well. WARNING: PLEASE READ THE LICENSING AGREEMENT BEFORE USING THE SOFTWARE. USING IT AUTOMATICALLY ASSUMES THAT YOU HAVE AGREED TO THE TERMS AND CONDITIONS OF THE LICENSE. PLEASE REMEMBER: ABSOLUTELY NO WARRANTY IS GIVEN AND THE SOFTWARE IS PROVIDED AS-IS. THE AUTHOR *TAKES NO ANY RESPONSIBILITY* FOR THE SOFTWARE, DAMAGES OR ANY CONSEQUENCES CAUSED BY ITS USAGE. Usage: ~~~~~~ PLEASE - PLEASE - PLEASE -- READ THIS:


This software was developed with experienced system administrators or developers in mind. This software does serious things in the system registry. It may result in serious damage to your system, which may easily cause LOSS OF ALL DATA and being unable to repair the system. If you are not a serious and experienced user, or you are not 100% sure what you are doing, please do not even attempt to use this software! End of warnings.


Usage: regln \[-v\] regln -d Where: link_key -> new registry key (link) target_key -> existing registry key -v = volatile, exist in memory only -d = delete link REGLN operates in two modes: Create and Delete. = To Create a Registry Link you need to have a Registry Key to link to and decide whenever the link has to be Volatile or Permanent. Volatile means it will be stored in the RAM memory and not saved in any HIVE file, which is good for testing since a simple reboot will remove the link. If you don't specify "-v" option the link will be created permanently, stored in a registry HIVE file and will last till it will be manualy removed. The key names used by NTAPI are just Namespace Paths. For example: \Registry\Machine\Software\NTinternals Although for compatibility and ease of use, a conversion function to translate Win32 "root key" names was implemented in public release. From now on, you can use simply: HKEY_LOCAL_MACHINE\Software\NTinternals or: HKLM\Software\NTinternals Unfortunately "root keys" like HKEY_CURRENT_USER and others are only Win32 additions and are not visible from Native API. Thus it is not possible use them in REGLN. Therefore the only valid root keys are: HKEY_LOCAL_MACHINE -> HKLM -> \Registry\Machine HKEY_USERS -> HKUS -> \Registry\Users The keys: HKEY_CURRENT_USER, HKEY_DYN_DATA, HKEY_CLASSES_ROOT or any other CANNOT be used by Regln. No, it is not possible at all. = To Delete a Registry Link you just have to specify the link-key name with "-d" option. It does not matter if the link is volatile or not. = Examples: regln -v HKLM\Software\TestInc HKLM\Software\Microsoft Will create a temporary link TestInc pointing to Microsoft. If you open Regedit or any other registry editor and open HKLM->Software and then TestInc you will see exacly same content as in Microsoft key. If you add/delete/change something in a Microsoft tree, it will be obviously "changed" in TestInc as well. \[Remember to refresh display by pressing F5 if you're using the system regedit.exe\] regln -d HKLM\Software\TestInc Will remove the link... Now a more interesting example: Imagine yourself (no, I'm not recommending this to inexperienced users) renaming "HKLM\Software\Microsoft\Windows\CurrentVersion" to "HKLM\Software\Microsoft\Windows\Version1" and creating the link: regln \Registry\Machine\Software\Microsoft\Windows\CurrentVersion \Registry\Machine\Software\Microsoft\Windows\Version1 This will create a permanent link from CurrentVersion pointing to existing key Version1. Now copy the whole tree recursively from Version1 to Version2 so that you'll have: HKLM\Software\Microsoft\Windows: - CurrentVersion ==LINK==>>> Version1 - Version1 - Version2 Now, alter some variables in Version2 and try to re-link the key CurrentVersion to Version2 by typing: regln -d \Registry\Machine\Software\Microsoft\Windows\CurrentVersion regln \Registry\Machine\Software\Microsoft\Windows\CurrentVersion \Registry\Machine\Software\Microsoft\Windows\Version2 As you see now, you can have many "sets of settings" for various applications, or even whole Windows and can swap them around at any time. This is useful for testing and debugging purposes... ! Remember: you have to extend Registry Quota to have enough space to do things like that... Also most applications will have open handles to the registry keys and will write to the old place so you have to reboot to really use that. It seems clear that the "CurrentVersion" key was really designed for that, just the functionality was never fully released... (it is now! :-) What else can I do with links? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I have few ideas in my mind. First of all, you can link any registry key to one of HardwareProfiles thus extending their functionality / allowing any registry key to be Hardware-Profile dependent. You can then have various system settings dependent on choosen Windows Hardware Profile. Another idea, never tested, is to swap some settings that are system-based (HKEY_LOCAL_MACHINE) with settings that are based on the user, or in other words, allow users to change (or have their own) settings that normally would be in HKLM. It's also possible to reverse this -> to link some user-based keys to HKLM to force all users to have all the same, common setting for example: desktop color scheme or background ;-) - Normally you do that through policies and domain settings. But linking is far more effective, especially on stand-alone terminal server, etc. Another possibility is to group some sets of settings spreaded across whole registry in a single HIVE files for easier backup or sharing purposes. There are a few other variations and possibilities associated with upgrades and installations of new software, backups, etc. If you find any other things you can do with REG-LINK, please let us know! Thanks! Where are other registry links in the system? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In Windows NT, they are really used by Control-Sets and Hardware Profiles only. Also NTBACKUP and few other utilities are able to open registry links to perform backups. As far as I know, no other software currently uses Registry Links. Source code ~~~~~~~~~~~ It is included in the zip file along with Makefile and the header file. No documentation is provided, apart from my comments in the files. If you need more informations or have any questions feel free to email me or my colleagues or follow the references secion. Build ~~~~~ Makefile is included. No other header files or libraries are required. This software was developed using "Lcc-Win32" by Jacob Navia (see references). I don't use MSVC and I never tested it using this product. I only can hope it builds fine. Compatibility ~~~~~~~~~~~~~ REGLN has been successfully tested on the following platforms: - Windows NT 3.51 Server/Workstation/WinFrame - Windows NT 4.0 Server/Workstation/Terminal Server Edition - Windows 2000 Proffesional/Advanced Server - Windows XP Proffesional - Windows NET 2003 Standard Server If you have running Windows NT running on Alpha/PPC or MIPS and you can compile it for me, I would be really pleased to get a copy! Contacts/Support ~~~~~~~~~~~~~~~~ No support is given but you can contact us directly by email if you have any questions, problems or remarks. The email address is [email protected] You can also contact the author directly: Antoni Sawicki References ~~~~~~~~~~ - Windows NT DDK, Platform SDK, MSDN Library. - (most other NTAPI functions are documented here) - - some usefull info and examples - - LCC-Win32 Thanks ~~~~~~ - Jacob Navia - for LCC-Win32 system - Bram Moolenaar - for VIM - Mark Russinovich - for some NTAPI examples Credits ~~~~~~~ Antoni Sawicki Tomasz Nowak Alex Finch Szymon Kunysz


Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.