winmerge icon indicating copy to clipboard operation
winmerge copied to clipboard

diff tool/ moved block search for hex files

Open professor-jonny opened this issue 2 years ago • 9 comments

Hi

can we add the feature to compare and search hex files for simular blocks of code in differing locations in differing files not just side by side comparison?

In this case I have a rom dump that contains tables/ structures and maps I would like to compare it with another hex file to check if those structures may be present in a different location in the file (moved in to a different address)

professor-jonny avatar Apr 04 '22 10:04 professor-jonny

Unfortunately, there are currently no plans to add features like moved block detection for text file comparisons to binary file comparisons.

However, even with the current WinMerge, it is possible to search byte data as follows.

#1283

sdottaka avatar Apr 04 '22 12:04 sdottaka

The feature for compairing xml files with moved block detection works well I was just after the same thing for hex to hex comparisons.

In this case im looking into the difference between rom dumps in vehicle ECU's to compair and find things like injector tables knock maps maf scaling as this will give me aid in finding start locations of this data to define xml for use with tuning software.

Many of these vehicles contain the same or simular base maps but differing layout of the binary due to different features in the car.

is there a way to parse and select data defined in the file by an external file adress location size ?

professor-jonny avatar Apr 04 '22 19:04 professor-jonny

Unfortunately, WinMerge does not have the functionality you expected. You can extract a portion of the binary data with a PowerShell script like the following and then compare the output files.

$filein = "d:\input.bin"
$fileout = "d:\output.bin"
$start = 0x100
$size = 0x10
$data = [System.IO.File]::ReadAllBytes($filein)
$data2 = New-Object System.ArraySegment[byte] -ArgumentList $data, $start, $size
[System.IO.File]::WriteAllBytes($fileout, $data2)

sdottaka avatar Apr 05 '22 00:04 sdottaka

It is probally easier to just cut and past between the defined structures into the search box to acomplish this, I think this is the way I will go but this wil compair blocks 1-1 is there a function to compare blocks that are almost identical up to a percentage of difference ?

If I have two rom dumps from simular vehicles that dont have any defined maps from an xml provided by the community this won't work. Im trying to aviod disasembling the rom contents and trawling through assembly code to find structures in the rom.

professor-jonny avatar Apr 05 '22 00:04 professor-jonny

is there a function to compare blocks that are almost identical up to a percentage of difference ?

Unfortunately, WinMerge doesn't have such a feature.

sdottaka avatar Apr 05 '22 11:04 sdottaka

@sdottaka You are the master of screencasts (animated screenshots)! Which tool are you using to generate them?

Gitoffthelawn avatar Apr 13 '22 01:04 Gitoffthelawn

I used ScreenToGif to create the animated screenshots

sdottaka avatar Apr 13 '22 11:04 sdottaka

@sdottaka Thank you! I'll check it out too.

Gitoffthelawn avatar Apr 13 '22 15:04 Gitoffthelawn

Darn... ScreenToGif is Windows-only and is also requires .NET 6. Bummer... looked good.

Gitoffthelawn avatar Apr 13 '22 15:04 Gitoffthelawn