Malfist
Malfist

Reputation: 31815

How to tell if the file supplied really is a registry hive

I'm doing some work with registry hives, and I need to know if the file the user supplies the program with really is a registry hive. Short of attempting to mount it, how can I tell if the file really is a registry hive?

Upvotes: 2

Views: 303

Answers (2)

C-F
C-F

Reputation: 1778

Very quick preliminary check: the file must start with "regf" signature.

Upvotes: 1

curtisk
curtisk

Reputation: 20175

Interesting question, upon digging around, there is a call that is part of the Offline Registry Library that will attempt to validate the hive and report back whether it was successful or not, but it's part of Win32/COM

OROpenHive

Sounds like what you want to do, just no direct .NET implementation of it

Upvotes: 2

Related Questions