regdelta 0.2 has been released
Submitted by ross on Wed, 11/08/2006 - 20:00.
I created regdelta to provide an automated way to produce .reg files of changes made when installing or running applications.
You can download the binary here and the binary with the source code here. The program includes a complete test suite. Using it, I even discovered a few anomolies with the Microsoft tools regedit, and reg. Here's the changelog:regdelta changelog Version 0.2 - 12 Jul 06: Standardized version information across all programs Version 0.1 - 09 Jun 06: Initial release
And here's the readme.txt:
regdelta 0.2 - 12 Jul 2006 Copyright (c) 2005-2006 Ross Smith II (http://smithii.com) All Rights Reserved ------------------------------------------------------------------------------ Usage: regdelta [options] [key | file.reg] [key | file.reg] Options: -a | --all Compare/export all keys (HKCC HKCU HKCR HKLM HKU) -x | --export key(s) ex.reg Export key(s) to ex.reg -o | --output output.reg Set output filename to 'output.reg' -c | --comments Include original values as comments in diff -r | --regedit Export in RegEdit format (implies -u -w) -u | --unsorted Do not sort the keys or values, as RegEdit -w | --wordwrap Wordwrap at 78 chars, as RegEdit -v | --verbose Show warnings that are normally hidden -V | --version Show version & copyright information & quit -? | --help Show this help message and quit Examples: regdelta HKCU hkcu.reg ; compare HKCU key with hkcu.reg regdelta HKCU\1 HKCU\2 ; compare HKCU\1 key with HKCU\2 key regdelta -o diff.reg HKCU hkcu.reg ; compare HKCU key with hkcu.reg regdelta -x HKCU hkcu.reg ; export HKCU key to hkcu.reg regdelta -xr HKCU\Software ex.reg ; export HKCU to ex.reg in REGEDIT format regdelta -ax allkeys.reg ; export all keys to allkeys.reg ------------------------------------------------------------------------------ Notes: regdelta.exe reads and writes ASCII .reg files (Windows 9x/NT 4) regdeltau.exe reads and writes Unicode .reg files (Windows 2000/XP/2003) 'key' can be one of the following: HKCC HKEY_CURRENT_CONFIG HKCU HKEY_CURRENT_USER HKCR HKEY_CLASSES_ROOT HKLM HKEY_LOCAL_MACHINE HKU HKEY_USERS Reads entire registry into memory for performance, so this may be an issue in a low memory environment. ------------------------------------------------------------------------------ To Do List: Compare currently only works on files created by regdelta. This will be fixed in a related release. Add HKA | HKEY_ALL key Options: -e | --execute 'cmd' ex.reg Execute cmd & save differences to ex.reg -s | --sort in.reg out.reg Sort in.reg to out.reg Examples: regdelta -s input.reg output.reg ; sort input.reg to output.reg regdelta -e 'setup.exe /S' ex.reg ; run setup & save differences in ex.reg To emulate the --execute option, I've used this batch script, called regdiff.cmd: @echo off del "%TEMP%\~regdiff_?.reg" >nul 2>nul regdelta.exe -ax "%TEMP%\~regdiff_1.reg" start /wait %* regdelta.exe -ax "%TEMP%\~regdiff_2.reg" regdelta.exe -o "%~1_redo.reg" "%TEMP%\~regdiff_1.reg" "%TEMP%\~regdiff_2.reg" regdelta.exe -o "%~1_undo.reg" "%TEMP%\~regdiff_2.reg" "%TEMP%\~regdiff_1.reg" del "%TEMP%\~regdiff_?.reg" >nul 2>nul
Other keywords: diff, regdiff
»
- ross's blog
- Login or register to post comments

Oops!
All of my C/C++ programs require shared-1.1-win32-src.zip.
I will add this information to the readme files.
Cheers, was able to build it
Cheers, was able to build it now and it even run. The only thing I'm unsure of is that I built it with Visual Studio 2005, so I got this
#error Only MS VC++ 5/6/7/7.1 supported. Check if the '_CrtMemBlockHeader' has not changed with this compiler!
in the stackwalker.h
Do you think it's major? Anyhow, I'll try to profile this when I get to the box where I expirience the considirable slow down.
//Andrew
Thanks, Andrew
your help is much appreciated.
Okey, most likely, it's not
OK, most likely, it's not the program fault, but environmental condition. I tried to profile it and most of the time is spent in RegFile:_write_file, which indicates that WriteFile API call takes longer then it should. After having found out this, I immediately realized, that F: drive that I used for testing is the network drive. I tried to used a local drive, and lo and behold, it ran several times faster.
Now, I have no idea why under certain conditions WriteFile gives considerable slowdown over network. Quick google search reveals a few cases where people have similar problem, but nowhere I have found an answer. For example, see http://www.zeusedit.com/forum/viewtopic.php?p=1507 and http://www.thescripts.com/forum/post2441072-6.html.
Note that the author claims that copying file with explorer is fast, copying it from code with WriteFile is slow. I can observe the same behavior in my environment.
But anyway, this should hardly concern you, because it's definitely has nothing to do with regdelta itself.
Speed of execution
Ross, do you know, why regdelta export is running so slow on my machine? Exporting HKCU takes several minutes, while the same command performed by regedit takes just several seconds. Look at this data:
PS F:\> Measure-Command { ./REGDELTAU.EXE -rx HKCU deleteme-user.reg }
Days : 0
Hours : 0
Minutes : 7
Seconds : 40
Milliseconds : 76
Ticks : 4600762864
TotalDays : 0.00532495701851852
TotalHours : 0.127798968444444
TotalMinutes : 7.66793810666667
TotalSeconds : 460.0762864
TotalMilliseconds : 460076.2864
PS F:\> Measure-Command { regedit /e deleteme-user1.reg HKEY_CURRENT_USER | Out-Null }
Days : 0
Hours : 0
Minutes : 0
Seconds : 6
Milliseconds : 416
Ticks : 64161416
TotalDays : 7.42608981481482E-05
TotalHours : 0.00178226155555556
TotalMinutes : 0.106935693333333
TotalSeconds : 6.4161416
TotalMilliseconds : 6416.1416
PS F:\> Measure-Command { reg export HKCU deleteme-user2.reg /y }
Days : 0
Hours : 0
Minutes : 0
Seconds : 6
Milliseconds : 362
Ticks : 63624498
TotalDays : 7.36394652777778E-05
TotalHours : 0.00176734716666667
TotalMinutes : 0.10604083
TotalSeconds : 6.3624498
TotalMilliseconds : 6362.4498
I have no idea
Regdelta is written in C++, and I've optimized it somewhat, but it could certainly be optimized more.
I'm using Windows XP SP2 and for me regdelta runs about 50% as fast as regedit or reg:
C:\>timethis regdelta -rx HKCU hkcu-regdelta.reg TimeThis : Command Line : regdelta -rx HKCU hkcu-regdelta.reg TimeThis : Start Time : Mon Apr 30 22:05:06 2007 TimeThis : Command Line : regdelta -rx HKCU hkcu-regdelta.reg TimeThis : Start Time : Mon Apr 30 22:05:06 2007 TimeThis : End Time : Mon Apr 30 22:05:09 2007 TimeThis : Elapsed Time : 00:00:02.234 C:\>timethis regdeltau -rx HKCU hkcu-regdeltau.reg TimeThis : Command Line : regdeltau -rx HKCU hkcu-regdeltau.reg TimeThis : Start Time : Mon Apr 30 22:05:13 2007 TimeThis : Command Line : regdeltau -rx HKCU hkcu-regdeltau.reg TimeThis : Start Time : Mon Apr 30 22:05:13 2007 TimeThis : End Time : Mon Apr 30 22:05:16 2007 TimeThis : Elapsed Time : 00:00:02.562 C:\>timethis regedit /e hkcu-regedit.reg HKEY_CURRENT_USER TimeThis : Command Line : regedit /e hkcu-regedit.reg HKEY_CURRENT_USER TimeThis : Start Time : Mon Apr 30 22:05:22 2007 TimeThis : Command Line : regedit /e hkcu-regedit.reg HKEY_CURRENT_USER TimeThis : Start Time : Mon Apr 30 22:05:22 2007 TimeThis : End Time : Mon Apr 30 22:05:24 2007 TimeThis : Elapsed Time : 00:00:01.984 C:\>timethis reg export HKCU hkcu-reg.reg TimeThis : Command Line : reg export HKCU hkcu-reg.reg TimeThis : Start Time : Mon Apr 30 22:06:46 2007 The operation completed successfully TimeThis : Command Line : reg export HKCU hkcu-reg.reg TimeThis : Start Time : Mon Apr 30 22:06:46 2007 TimeThis : End Time : Mon Apr 30 22:06:47 2007 TimeThis : Elapsed Time : 00:00:00.906 C:\>dir hkcu*.reg 04/30/2007 10:06 PM 8,604,316 hkcu-reg.reg 04/30/2007 10:05 PM 7,739,849 hkcu-regdelta.reg 04/30/2007 10:05 PM 15,579,778 hkcu-regdeltau.reg 04/30/2007 10:05 PM 15,579,778 hkcu-regedit.reg 4 File(s) 47,503,721 bytesTried on another Win 2003
Tried on another Win 2003 SP2 and this time got comparable results. The only think I can think of now is getting the libraries for you, and then building and profiling regdelta.
This is wierd indeed. I'll
This is wierd indeed. I'll run on another box tommorow and let you know the result. I'm running Win2003 SP2. There shouldn't be hundreds time diffirence in our result. I could build your code and run some profiling on my machine, unfortunately I don't have all the libraries you are using, so VS wouldn't compile the project. You can make the library available to me, then I can try and see what's going on.
//Andrew