huiyadanli/RevokeMsgPatcher · error · Exception
查询串与替换串完全相同!请确认补丁信息的正确性。
Error message
查询串与替换串完全相同!请确认补丁信息的正确性。
What it means
After the length check, ComputChanges scans byte-by-byte collecting 'changeOffsets' wherever search != replace. If the two arrays are byte-for-byte identical (zero differences), changeOffsets is empty and it throws a plain Exception treating it as a data error, because a no-op patch almost always means the author entered the same string twice by mistake.
Source
Thrown at RevokeMsgPatcher.Assistant/FormAssisant.cs:96
else
{
if (diff != null)
{
changeOffsets.Last().Content = diff.ToArray();
diff = null;
}
}
}
// 最后一位也是要被替换的情况
if (diff != null)
{
changeOffsets.Last().Content = diff.ToArray();
diff = null;
}
if (changeOffsets.Count == 0)
{
throw new Exception("查询串与替换串完全相同!请确认补丁信息的正确性。");
}
List<Change> changes = new List<Change>();
foreach (int index in indexs)
{
foreach (Change offset in changeOffsets)
{
Change c = offset.Clone();
c.Position += index;
changes.Add(c);
}
}
return changes;
}
private void btnGetVersion_Click(object sender, EventArgs e)
{
string version = FileUtil.GetFileVersion(@"");View on GitHub (pinned to 89cbbb3f0c)
Solutions
- Provide a replaceBytes value that actually differs from searchBytes.
- Double-check you copied the post-patch bytes (the disassembled/edited target) into the replace field, not the original again.
- Validate that at least one byte differs before calling ComputChanges.
Example fix
// before
byte[] searchBytes = ByteUtil.HexStringToByteArray("AA BB CC");
byte[] replaceBytes = ByteUtil.HexStringToByteArray("AA BB CC"); // identical -> throws
// after
byte[] replaceBytes = ByteUtil.HexStringToByteArray("AA BB 99"); // differs at index 2 Defensive patterns
Strategy: validation
Validate before calling
bool anyDiff = false;
for (int i = 0; i < searchBytes.Length; i++)
{
if (searchBytes[i] != replaceBytes[i]) { anyDiff = true; break; }
}
if (!anyDiff)
{
txtInfo.AppendText("查询串与替换串完全相同,请确认补丁信息。" + Environment.NewLine);
return;
}
List<Change> changes = ComputChanges(indexs, searchBytes, replaceBytes); Prevention
- When authoring, always confirm the replace bytes are the actual post-patch bytes, not a duplicate of the search.
- Run a quick diff check in the Assistant UI before generating patch data.
When it happens
Trigger: Calling ComputChanges with searchBytes and replaceBytes that are identical (changeOffsets.Count == 0). Typically the same hex string was pasted into both the search and replace fields of btnSearch_Click.
Common situations: Copy-paste error putting the same signature into both the search and replace text boxes; forgetting to actually author the replacement bytes.
Related errors
AI-assisted analysis of huiyadanli/RevokeMsgPatcher@89cbbb3f0c (2026-08-13).
Data as JSON: /api/errors/520e7218242267e2.
Report an issue: GitHub.