Sysinternals Homepage
Forum Home Forum Home > Windows Discussions > Internals
  New Posts New Posts RSS Feed: regedit question - unable to load hive error
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

regedit question - unable to load hive error

 Post Reply Post Reply Page  <12345>
Author
Message Reverse Sort Order
molotov View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 04 October 2006
Online Status: Offline
Posts: 17492
Post Options Post Options   Quote molotov Quote  Post ReplyReply Direct Link To This Post Topic: regedit question - unable to load hive error
    Posted: 27 July 2009 at 10:52am
Obvious corruption vs subtle corruption... what do you mean, and how can I tell the difference?

Obvious may mean a string of 'b' bytes in the middle of one of the segments, where the "good" hive has nothing of the sort.  Even then, it may be difficult to determine that the data that is present is not accurate.

I suppose more importantly, when I do find corruption (which I'm pretty certain I will, lol.. Ouch) would there be any way to fix it? For example, if data was corrupted, I wouldn't be able to repair it... would I?
It would be a manual process, likely, involving manual parsing of the registry hive to attempt to determine where the corruption is, and then trying to find a way to address it.  Perhaps the fix is to truncate some reference to other data in the hive, which may restore integrity to the structure of the hive, but still not fully take care of the problem since it essentially results in data loss.  Structural corruption, vs. content corruption - you seem to be dealing with at least structural corruption at this point, but recovering the structure may still leave behind corrupted content.

Or if it was something with the parameters (as the evidence suggests) how would I edit/repair that?
The invalid parameter result is likely a result of the corruption - a value read from the hive was used to attempt to do something, and the value made no sense in the context of the activity.
Daily affirmation:
net helpmsg 4006
Back to Top
Matts_User_Name View Drop Down
Senior Member
Senior Member
Avatar

Joined: 10 August 2006
Location: USA
Online Status: Offline
Posts: 675
Post Options Post Options   Quote Matts_User_Name Quote  Post ReplyReply Direct Link To This Post Posted: 27 July 2009 at 3:17am

It is hard to say how to repair it because of the undocumented nature of the windows registry, and since we dont really have the windows source code, we can not really be sure why the kernel sees this hive as being corrupted, and then fix it.

If we cannot get the ek command to work on that offline NT reg editor, then I am curious if the hive can be read from Hive tools - http://lilith.tec-man.com/hivetools

If so then I guess if I get some time I can use those alternative APIs to enumerate every subkey in that hive, and have the app manually create a .reg file.

EDIT: It appears that these .c and .h files need to be compiled into a .dll first, although I seem unable to with VS2005, DevC++ or Jgrasp (I cannot say I have much C/C++ experience) so I guess if someone compiles this into a .dll and then uploads it, then I can work on a application that can read data from that software hive (if in fact this works the same way that the Offline Nt Registry editor does, and is able to read the hive)



As for the Offline NT reg editor:
I do see what you mean with not knowing how to exactly save the file because of the linux system.
I tried just the file name itself, ex:
ek test.reg HKEY_LOCAL_MACHINE\Software Microsoft


This works, but the file is not there when rebooting (must be created in the RAM disc, and cleared on restart)

Also tried
ek /dev/sda/windows/t.reg
ek /dev/sda/WINDOWS/t.reg
ek /dev/sda1/WINDOWS/t.reg
ek /mnt/hda1/WINDOWS/t.reg
ek WINDOWS/t.reg
ek /dev/sda1/t.reg

but these and similar ones kept giving file/directory not found =(


The only issue is that you would have to do this for all the subkeys under the software hive, but atleast it does indeed work, we just need to figure out how to save the file to the HDD.




So basically if we find a way to:
1. Use a wildcard to export all keys in the software hive
2. Save the .reg file to the HDD

Then everything will work great.


Edited by Matts_User_Name - 27 July 2009 at 3:43am
Back to Top
gatts.casca View Drop Down
Newbie
Newbie


Joined: 16 July 2009
Online Status: Offline
Posts: 16
Post Options Post Options   Quote gatts.casca Quote  Post ReplyReply Direct Link To This Post Posted: 27 July 2009 at 1:57am
http://www.mediafire.com/?sharekey=32ed690f7cacd14abda4076e811714c83c16fc26d334b00cb8eada0a1ae8665a

Hopefully that link works. I zipped the corrupt software hive without password protection. It should be 6.42 mb, unzipped ~28.7 mb.
Back to Top
gatts.casca View Drop Down
Newbie
Newbie


Joined: 16 July 2009
Online Status: Offline
Posts: 16
Post Options Post Options   Quote gatts.casca Quote  Post ReplyReply Direct Link To This Post Posted: 27 July 2009 at 1:26am
Thanks to all (again) btw
Back to Top
gatts.casca View Drop Down
Newbie
Newbie


Joined: 16 July 2009
Online Status: Offline
Posts: 16
Post Options Post Options   Quote gatts.casca Quote  Post ReplyReply Direct Link To This Post Posted: 27 July 2009 at 12:49am
Matts_user_name

To be honest, I think the ek command is my best shot. I've tried using the command, although I can't ever seem to find the exported file, if it was ever exported. Perhaps I'm not using the command correctly, it specifies:
ek <filename> <prefix> <keyname>
but I'm not familiar with linux commands, let alone PNH's custom commands, so I don't know what <prefix> means. Also, I can't specify a path because any input is taken as part of the filename, so if I write ek c:\microsoft.reg Microsoft, the filename would be 'c:\microsoft.reg'. Just FYI, I used Search to try to find it and came up with nothing too, so... yeah, can't find the file if it exists. Perhaps the key to using the command is the <prefix>...

Matts / Redhawk (Richard)

I will try to upload the hive as suggested.

Molotov,

Obvious corruption vs subtle corruption... what do you mean, and how can I tell the difference? I suppose more importantly, when I do find corruption (which I'm pretty certain I will, lol.. Ouch) would there be any way to fix it? For example, if data was corrupted, I wouldn't be able to repair it... would I? Or if it was something with the parameters (as the evidence suggests) how would I edit/repair that?
Back to Top
molotov View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 04 October 2006
Online Status: Offline
Posts: 17492
Post Options Post Options   Quote molotov Quote  Post ReplyReply Direct Link To This Post Posted: 26 July 2009 at 5:09pm
Originally posted by gatts.casca

So... no luck, then? I'm stuck?
I'd suggest comparing the bytes that regedit (RegLoadKey) is reading, in the corrupted hive, to a hive that's not corrupted, and seeing what you may be able to determine.  Is there obvious corruption, or is it perhaps more subtle?
Daily affirmation:
net helpmsg 4006
Back to Top
redhawk View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 14 September 2005
Location: United Kingdom
Online Status: Offline
Posts: 1220
Post Options Post Options   Quote redhawk Quote  Post ReplyReply Direct Link To This Post Posted: 26 July 2009 at 12:38pm
Matts thanks for the correction I Google for SAM I was wasn't sure about the correct acronym for it. :)

Having a look at the registry file seems like the next step I am also curious about this problem.
Gatts.casca if you decide to upload please password the ZIP or send the link privately.

Richard S.
Back to Top
Matts_User_Name View Drop Down
Senior Member
Senior Member
Avatar

Joined: 10 August 2006
Location: USA
Online Status: Offline
Posts: 675
Post Options Post Options   Quote Matts_User_Name Quote  Post ReplyReply Direct Link To This Post Posted: 26 July 2009 at 9:19am
@Redhawk
Actually SAM = Security Accounts Manager but your expanded acronym sound more technical :P haha

@gats.casca
Could you upload the this software hive? (you might want to do it at MediaFire.com since it is probably around 50 MB)

Also: Looking at the source for that offline registry editor it appears to support exporting keys into .reg file formats using the ek command... have you tried that?
If not then, I would suggest doing so, or upload the hive and I try it for you.


Edited by Matts_User_Name - 26 July 2009 at 9:32am
Back to Top
gatts.casca View Drop Down
Newbie
Newbie


Joined: 16 July 2009
Online Status: Offline
Posts: 16
Post Options Post Options   Quote gatts.casca Quote  Post ReplyReply Direct Link To This Post Posted: 26 July 2009 at 8:37am
So... no luck, then? I'm stuck?
Back to Top
molotov View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 04 October 2006
Online Status: Offline
Posts: 17492
Post Options Post Options   Quote molotov Quote  Post ReplyReply Direct Link To This Post Posted: 25 July 2009 at 5:16pm
I think the registry events are included, as well as filesystem events.
Resetting the filter and choosing to only display registry events, when checking out corruptsofthive.PML, resulted in no events displaying.

In corruptswlog2...
Hmm...
regedit.exe    4652    6096    RegLoadKey    HKLM\123    REGISTRY CORRUPT    Hive Path: C:\Users\fatcat\Desktop\software.bak        Registry 0.0032917


Followed by...

regedit.exe    4652    6096    IRP_MJ_READ    C:\Users\fatcat\Desktop\software.bak    SUCCESS    Offset: 0, Length: 512, Priority: Normal    Read    File System
regedit.exe    4652    6096    IRP_MJ_READ    C:\Users\fatcat\Desktop\software.bak    SUCCESS    Offset: 4,096, Length: 512, Priority: Normal    Read    File System
regedit.exe    4652    6096    <Unknown>    C:\Users\fatcat\Desktop\software.bak    INVALID PARAMETER    Type: <Unknown : 20 >    Read Metadata    File System


So, something in bytes 1-512, or bytes 4096-4608, would seem to be being used to determine that that hive is corrupt...

Edited by molotov - 25 July 2009 at 5:16pm
Daily affirmation:
net helpmsg 4006
Back to Top
 Post Reply Post Reply Page  <12345>

Forum Jump Forum Permissions View Drop Down