huiyadanli/RevokeMsgPatcher · warning · BusinessException

installed

installed

Error message

你已经安装过此补丁!

What it means

In ValidateAndFindModifyInfo (the precise/SHA1 patch path), the file's SHA1 matched a ModifyInfo.SHA1After (the hash of an already-patched file). AppModifier throws BusinessException('installed') because the file has already been patched and there is nothing to do.

Solutions

  1. Restore the original DLL first (the tool copies the .h.bak back).
  2. If no backup exists, obtain a clean DLL of that version.
Defensive patterns

Strategy: try-catch

Type guard

static bool IsBusinessException(Exception e, string code) => e is BusinessException b && b.ErrorCode == code;

static bool IsInstalled(Exception e) => IsBusinessException(e, "installed");

Try / catch

try
{
    modifier.ValidateAndFindModifyInfo(categories);
}
catch (BusinessException ex) when (ex.ErrorCode == "installed")
{
    // SHA1After matched: already patched. Offer Restore instead.
    MessageBox.Show("你已经安装过此补丁,如需重装请先还原。");
}

Prevention

When it happens

Trigger: Running the precise (SHA1-based) patch on a DLL whose hash equals the post-patch hash for that version: the patch was already applied previously.

Common situations: User re-runs the patch without restoring; patch was applied in a prior session.

Related errors


AI-assisted analysis of huiyadanli/RevokeMsgPatcher@89cbbb3f0c (2026-08-13). Data as JSON: /api/errors/ca4c8169e092159c. Report an issue: GitHub.

Appendix: source

Thrown at RevokeMsgPatcher/Modifier/AppModifier.cs:337

                                matchingVersion = modifyInfo;
                            }
                        }
                    }
                }


                // 补丁前SHA1匹配上,肯定是正确的dll
                if (matchingSHA1Before != null)
                {
                    editor.FileModifyInfo = matchingSHA1Before;
                    editor.TargetChanges = matchingSHA1Before.Changes;
                    continue;
                }

                // 补丁后SHA1匹配上,肯定已经打过补丁
                if (matchingSHA1After != null)
                {
                    throw new BusinessException("installed", $"你已经安装过此补丁!");
                }

                // SHA1不匹配说明精准替换肯定不支持
                if (matchingSHA1Before == null && matchingSHA1After == null)
                {
                    // 尝试使用特征码替换
                    // 多个版本范围,匹配出对应版本可以使用的特征
                    if (config.FileCommonModifyInfos != null)
                    {
                        editor.FileCommonModifyInfo = FindCommonModifyInfo(editor);
                    }

                    // 存在对应的特征时不报错
                    if (editor.FileCommonModifyInfo != null && editor.FileCommonModifyInfo.ReplacePatterns != null)
                    {
                        List<ReplacePattern> replacePatterns = editor.FileCommonModifyInfo.ReplacePatterns;
                        // 根据需要操作的功能类型(防撤回或者多开等)筛选特征码
                        if (categories != null && categories.Count > 0)

View on GitHub (pinned to 89cbbb3f0c)