zloveless / regdiff

Note: This repository is not mine. I forked/imported it to keep a copy of the code just in case it disappeared.
0 stars 1 forks source link

Errors with big registry exports #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. export entire registry of users on a windows 2012 r2 server
2. compare them

What do you see instead?
REGDIFF - Version 4.2
Freeware written by Gerson Kurz (http://p-nand-q.com) [32-bit process on 64-bit 
OS]

Reading reg_export.test_test_wts01-bln\reg_export.reg...
System.ArgumentException: Destination array is not long enough to copy all the 
items in the collection. Check array index and length.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.BitConverter.ToInt64(Byte[] value, Int32 startIndex)
   at com.tikumo.regis3.RegValueEntry.SetBinaryType(RegValueEntryKind kind, Byte[] bytes)

Unhandled Exception: System.ArgumentException: Destination array is not long 
enough to copy all the items in the collection. Check array ind
ex and length.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.BitConverter.ToInt64(Byte[] value, Int32 startIndex)
   at com.tikumo.regis3.RegValueEntry.SetBinaryType(RegValueEntryKind kind, Byte[] bytes)
   at com.tikumo.regis3.RegFileParser.ExpectMultiByteValueDefinition(Char c)
   at com.tikumo.regis3.AbstractFileParser.Parse(String content, ExpectFunc initialFunc)
   at com.tikumo.regis3.RegFileParser.Parse(String content)
   at com.tikumo.regis3.RegFileImporter.Import()
   at com.tikumo.regdiff.regdiff.ReadInputFiles()
   at com.tikumo.regdiff.regdiff.Run(String[] args)
   at com.tikumo.regdiff.regdiff.Main(String[] args)

What version of the product are you using? On what operating system?
4.2 ; windows 7 64bit pro German.

Original issue reported on code.google.com by pierqr.a...@gmail.com on 25 Jun 2014 at 9:38

GoogleCodeExporter commented 9 years ago
I forgot: 2.5 GB of ram, the registry files are 170 MB each.

Original comment by pierqr.a...@gmail.com on 25 Jun 2014 at 9:39

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Same problem - 4.2 - Windows 8.1 Enterprise - 32 GB RAM - files are ~280 MB each

Original comment by jamie.sc...@gmail.com on 31 Jul 2014 at 2:47

batteryshark commented 9 years ago

I fixed this - instead of making a commit because I'm in a hurry, here's how:

In RegValueEntry.cs (regis3), you need to add another if (it assumes there are only 4 and 8 byte ints, however, we can have 1 byte ints for small crap now so you need another if like this):

where you see "if (bytes.Length == 4)" you'll see it has an else to assume it's an int64 if it's not - it needs an: else if (bytes.Length == 1) which makes Value = bytes[0]; then the original else will catch anything... well...else

Also, if you're hitting HKLM and exporting to XML, you're gonna want to add

HeapDeCommitFreeBlockThreshold = 0x00040000

to RegValueEntryKind.cs as this value will get flagged as not a real 'kind' and will mess up the XML generation.

Cheers!

zloveless commented 9 years ago

@batteryshark I don't maintain this repo (nor am I the original owner), I just copied it from Google Code prior to them shutting down in case I needed the code later.

However, if you want, you can submit a pull request to the repo with this fix and, assuming it works, I'll merge it in for you.