【发布时间】:2016-11-24 17:09:27
【问题描述】:
我发现了这个错误,因为我在 windows 内置的事件查看器中看到了它:
描述:进程因未处理的异常而终止。 异常信息:System.MissingMethodException 堆: 在 Injection.Main.DrawText_Hooked(...)
我有一个使用 easyhook 的 c# 应用程序。我的 dll 关键代码:
public void Run(RemoteHooking.IContext InContext, String InChannelName)
{
// Install system hook to detect calls to DrawTextExW that is made by the client and call the function DrawText_Hooked when ever this happens
try
{
DrawTextExHook = LocalHook.Create(LocalHook.GetProcAddress("user32.dll", "DrawTextExW"), new DDrawTextEx(DrawText_Hooked), this);
DrawTextExHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
}....
我处理挂钩函数的委托是:
int DrawText_Hooked(...)
{
Interface.Read(hdc, lpString, cchText, dwDTFormat);
return DrawTextExW(hdc, lpString, cchText, ref lprc, dwDTFormat, ref dparams);
}
当我关闭我的主应用程序时,一切正常,除非我使用Interface.Read(...):在这种情况下,挂钩的应用程序会崩溃。我读过它可能是因为一旦我退出我的应用程序,Interface.Read(...) 将不再存在,但我不知道如何告诉我的 dll 停止这样做或简单地卸载,以便它不会尝试执行 Interface.Read(...)并发现它实际上不再存在。我该怎么做?
【问题讨论】:
标签: c# dll missingmethodexception