【问题标题】:EasyHook - CRT Debug Assertion Failed - "Buffer too small"EasyHook - CRT 调试断言失败 - “缓冲区太小”
【发布时间】:2017-02-05 15:18:49
【问题描述】:

我有一个注入器,它调用以下(删节)代码:

var processes = Process.GetProcessesByName("target");
/* ... */
var process = processes[0];
/* ... */
process.Kill();
RemoteHooking.CreateAndInject(process.MainModule.FileName, string.Empty, 0,
    InjectionOptions.NoService | InjectionOptions.DoNotRequireStrongName,
    typeof(EntryPoint).Assembly.Location, typeof(EntryPoint).Assembly.Location,
    out injectedProcessId, null);

应该注入的DLL只有以下代码:

public class EntryPoint : IEntryPoint {
    public EntryPoint(RemoteHooking.IContext InContext) {}

    public void Run(RemoteHooking.IContext InContext) {
        RemoteHooking.WakeUpProcess();
        Thread.Sleep(5000);
    }
}

不幸的是,注入器只是崩溃了,典型的 Windows 错误报告工具出现了,根本没有可视异常消息,甚至没有进入 DLL。事件视图的错误是这样的:

Faulting application name: TestInjector.vshost.exe, version: 14.0.23107.0, time stamp: 0x559b788a
Faulting module name: EasyHook64.dll, version: 2.7.0.0, time stamp: 0x589704aa
Exception code: 0xc0000409
Fault offset: 0x0000000000091a9b

在调试模式下运行时,我无法逐步通过 EasyHook 代码找到关键位置,但我至少遇到一个异常:

您对如何进一步调试此问题并找出原因有什么建议吗?我什至尝试关闭各种应用程序以减少干扰,但没有任何帮助。

【问题讨论】:

    标签: c# hook msvcrt easyhook


    【解决方案1】:

    我可以解决错误 - 我正在调用的应用程序也获得了一个命令行参数(不幸的是,它不在我的示例代码中),这对于库来说太长了。因此我增加了缓冲区大小right here 以及对它的引用调用right here,它现在可以正常工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-29
      • 1970-01-01
      • 2014-10-07
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多