tags:

views:

48

answers:

2

Hello folks,

This is out of curiosity, but I have seen several (and some of them very popular) software called registry defragmenter. While I can see the benefit they offer, but I am very curious on how exactly do you do registry defragmenting? Note that I'm not asking for software name, just a basic description of how it's done programmatically. I understand there is disk defragmenting API from microsoft. Is this that they are using? Or is there "registry defragmenting" api?

A: 

I suspect they're just defragmenting the files used to store registry information. Since the registry files are open during all normal Windows operation, a "normal" file defragmenting tool won't even touch them.

Jerry Coffin
Initially I suspect that too. But like wallyk mentioned, many claim they do reordering registry nodes (as to children keys placed right next to the parent).
DonnVall
Btw, I have seen JkDefrag (now MyDefrag) defragmenting paging files. So ordinary defragmenting tool should be able to defrag registry files.
DonnVall
A: 

While disk defragmenting would be helpful, the more important speed benefit which could be obtained would be arranging the registry nodes so that a typical depth-first search would put the sequentially-accessed nodes in the same registry page.

I'm not aware of any API for that. The algorithm is a straightforward reordering and rewriting operation, complicated by dealing with Windows' concurrent access.

wallyk
Do you suggest they actually understand the registry file format? Gotta fire up my hex editor... :)
DonnVall
There are tools out there that read the raw registry hive files. Check out some of the open source password crackers or forensic tools.
Anders
The registry file format is nothing too complicated. View the raw hex format is unenlightening, but there are some documents floating around that are more or less correct. See http://www.sentinelchicken.com/data/TheWindowsNTRegistryFileFormat.pdf
wallyk
@Anders, done! Found some "interesting" projects in sourceforge.net.
DonnVall
So in the end it's just moving the file content? Personally, after I learn how it is done, I don't like it. Mainly because they don't use (since there is none - I believe) official information from Microsoft. A tiny misunderstanding could easily screw up users' machines. On the other side I also respect the team behind those software for they manage not to wreaking havoc so far. :)
DonnVall
Well, testing such a utility is fairly easy: Windows tends to crash and not ever boot again if the registry is munged.
wallyk