Saturday, July 13, 2013

How to Make Your Own Windows Registry Hacks

Over the years, we’ve created many Registry hacks to customize and tweak your Windows computer. Today we’re going to give you the keys to making your own registry hack files that you can use on any computer.
Before we go further, it’s worth noting that even reading this article and thinking about the registry will make your computer melt, and we’re not responsible if you break stuff, which… you will.

So what is a Registry Hack?

Whenever you customize a key or value in the registry, you could arguably call it a registry hack… but in this context, we’re referring to those downloadable registry hack files with the .reg extension that do magical things to your computer. Like break it. Be afraid.
In simpler terms, a registry hack file is a backup of all the changes that you’ve done to your registry, saved in a file so that you can apply those same changes to your computer should you reinstall, or on another computer when you get a new one.
If you want some examples of registry hacks, flip through and read some of the ones we’ve covered over the years:
If you’re really determined to continue reading, please proceed. Just don’t blame us if your computer breaks.

Making a Registry Hack

Once you’ve mucked around and changed the Registry values to your liking, you’ll want to use the Export feature to save everything out into a text file with the .reg extension — otherwise known as a registry hack file. These files follow a standard format, so you could probably create them from scratch if you really wanted to, but when you can export directly from the Registry Editor, why bother?
When exporting keys, you should make a point of drilling down to the lowest level on the left-hand side that you can get to while still seeing the value on the right-hand side that you’re trying to save into a file. Then right-click, choose Export, and then save it somewhere.
Now that you’ve successfully saved the file, you can either double-click it to merge the values back into the registry, which wouldn’t make sense right now, or copy it to another computer and merge the values into the registry, which would set the same values.
And in the case of this particular registry hack, that would work just fine because there is only a single value on the right — but most of the time, you’re going to need to edit the file. So right-click on it and choose Edit to open in Notepad.
And now we see the registry hack format, which is pretty simple, but requires a little explanation. Every registry hack contains this line at the top, which identifies it as a registry hack — without this line, it’s not going to work right.
Windows Registry Editor Version 5.00
You only need this line once in the file, and it must be the very first line. If you’re trying to combine more than one registry hack, keep that in mind — you only want it at the top line, once.
The next section can be as long or as short as your registry hack needs to go, and is arranged into sections for the Keys (the stuff on the left-hand side of the Registry Editor) and then a set of values for that key. For instance, if you had two keys that you wanted to set values for, you could have them each in the file like this — the SomeVariableName would be the value on the right-hand side under the SOMEKEYHERE that is on the left-hand side — and SomeValue would be underneath ANOTHERKEY.
[HKEY_LOCAL_MACHINE\SOFTWARE\SOMEKEYHERE]
"SomeVariableName"=dword:00000000

[HKEY_LOCAL_MACHINE\SOFTWARE\ANOTHERKEY]
"SomeValue"=dword:00000001
We should really give you an example where you need to do some editing, what we’ll do is open up the Registry Editor and browse down to the following key on the left-hand side. This key determines whether User Account Control blacks out the rest of the screen when the popup shows up, but that’s not important now.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
Now go ahead and Export from the System key on the left-hand side, since that’s the lowest we can drill down while still seeing the key on the right. Open up the registry hack file and you’ll see a whole bunch of different stuff in it — yes, our PromptOnSecureDesktop is there in the file, but what about all the other stuff?
If you were to take this registry hack file to another computer and import it, everything else that was set on this machine underneath that Key… would end up being set on the new computer. For instance, the EnableLUA key that you see in the file? That disables or enables UAC depending on how it is set. So if you just wanted to set the Secure Desktop value and didn’t want to change UAC on the other computer, you could inadvertently change that value too — along with everything else in the file.
Luckily there is a very simple answer: it’s a text editor! Just delete everything that isn’t the value or values you want to set. In our case we’ll delete everything but this single value, but if you had five settings in here you wanted to change, you could leave all five of them.
The important thing is that you don’t delete the first line, and you don’t delete the [HKEY_LOCAL_MACHINE\SOFTW....etc] line right above the value, because the Registry Editor needs to know where to put the value.

Combining Registry Hacks Together

Remember that first example with the NoAutoReboot stuff? That’s one of my favorite registry hacks. Now what if we wanted to include that one in our registry hack file along with the Secure Desktop stuff? Luckily, it’s simple, you just have to remember the rule: the Windows Registry Editor Version 5.00 line… only goes in the file once, at the top.
So if you copy and paste the two files into each other, and make sure that top line is only in there once, you’ll end up with a registry hack that contains both settings.
And you can do this as many times as you want — if you want to put every single tweak that you’ve ever done into a single file so that you can use it every time you reinstall, we’d be interested to hear about it.

Deleting a Registry Value

And now, the thing they don’t teach you in school… how to delete a registry value.
There are some scenarios where a registry hack entails creating a new key that didn’t exist before, and changing the setting back requires deleting that registry key. The way this works in registry hack land is pretty simple:
Export the key and change the value that it is set to so that it is just a minus sign. For instance:
“NoAutoRebootWithLoggedOnUsers”=dword:00000001
Would become…
“NoAutoRebootWithLoggedOnUsers”=-
Not terribly hard once you do it once.
So what if you wanted to delete the registry Key instead of the value? You know, the stuff on the left-hand side of the Registry Editor? Again, it involves a minus symbol placed into a registry hack file. So if you wanted to delete the entire key shown in the above screenshot, you’d change it from this:
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Mic...]
To this:
[-HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Mic...]
See that little minus sign? That will tell the Registry Editor to completely delete that key, and every value underneath it.
You should use this with great caution. With great power comes greatly messed up computers when you screw up. In fact, you shouldn’t be doing any of this. Give me back the keys!

No comments:

Post a Comment