How use wildcard symbols in replace field?

In the last few years, in my practice, pairs of hex patterns (search + replace) have become increasingly common, in which wildcard characters are present both there and there, for example:

74 ?? 48 8B 44 24 ?? 8B 4C 24 ?? 89 48 ?? 33 C0 EB ?? 48 8B 44 24 ?? 8B 90 ?? ?? 00 00 48 8B 44 24 ?? 8B 88 ?? ?? 00 00 E8 ?? ?? ?? ?? 89 44 24 ?? 83 7C 24 ?? ?? 74
EB ?? 48 8B 44 24 ?? 8B 4C 24 ?? 89 48 ?? 33 C0 EB ?? 48 8B 44 24 ?? 8B 90 ?? ?? 00 00 48 8B 44 24 ?? 8B 88 ?? ?? 00 00 E8 ?? ?? ?? ?? 89 44 24 ?? 83 7C 24 ?? ?? EB

or

74 ?? 48 8B 44 24 ?? 8B 4C 24 ?? 89 48 ?? 33 C0 EB ?? 48 8B 44 24 ?? 8B 90 ?? ?? 00 00 48 8B 44 24 ?? 8B 88 ?? ?? 00 00 E8 ?? ?? ?? ?? 89 44 24 ?? 83 7C 24 ?? ?? 74
EB ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? EB

or

40 53 48 83 EC ?? 48 8B D9 48 8D 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B 03 48 8D 15
B0 01 C3 83 EC ?? 48 8B D9 48 8D 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B 03 48 8D 15

or

40 53 48 83 EC ?? 48 8B D9 48 8D 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B 03 48 8D 15
B0 01 C3 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??

When, during manual testing, you have to manually modify a binary file using such pairs of patterns in the 010 Editor, you have to do more manual work than you would like.
If I press Command+R, select the type “Hex Bytes:” in front of the search and replace fields and check the boxes “Show All Replacements” and “Search with Wildcards” in the “Options” field, then after clicking on the “Replace All” button, a window with error “Error: Invalid replace value.” appears

This is because there are wildcard characters “??” in the replacement field. If you remove them from the replacement field, then there will be no errors, but in the examples I have given, I cannot remove wildcards from the replacement field.:

I have to manually search for each search pattern and manually replace specific few bytes from the pattern.

Please add support for wildcards in hex replacement patterns.

You are correct that wildcards are not supported in the replacement field. That is something we’d have to add in the future. If you need this right away, you could switch to using regular expressions which supports doing replacements with capture groups. If you need more information about this, we can give some examples on how this could be done. If you have a lot of these replacements to do, it would even be possible to use a short script to convert your wildcard expressions to regular expressions and do the proper replacements.

Graeme
SweetScape Software

1 Like