gpt4 book ai didi

c# - 如何注销 EasyHook.dll、EasyHook64.dll 和 EasyLoad64.dll

转载 作者:太空宇宙 更新时间:2023-11-03 14:56:01 25 4
gpt4 key购买 nike

我正在使用 EasyHook dll 并执行 DoDragDrop API Hook ,一切正常,但如何释放以下 3 个 dll

1.EasyHook.dll2.EasyHook64.dll3.EasyLoad64.dll

即使在关闭我的应用程序后,这些 dll 也会挂接到 explorer.exe,一旦我重新启动 explorer.exe,它们就会释放

到目前为止我没有找到任何解决方案,所以我把它贴在这里,请帮助我解决这个问题。

下面是我的 DLL Run() 代码片段。

public void Run(RemoteHooking.IContext InContext, String InChannelName)
{
try
{
dragDropHook = LocalHook.Create(LocalHook.GetProcAddress("Ole32.dll", "DoDragDrop"), new DragDropDelegate(DoDragDropHook), this);

dragDropHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });

File.AppendAllText(logFilePath, "Run : LocalHook Created" + Environment.NewLine);
}
catch (Exception ex)
{
Interface.ErrorHandle(ex);

File.AppendAllText(logFilePath, "Run Exception :" + ex.ToString() + Environment.NewLine);

return;
}

Interface.IsInstalled(RemoteHooking.GetCurrentProcessId());

RemoteHooking.WakeUpProcess();
File.AppendAllText(logFilePath, "Running " + Environment.NewLine);
while (checkforDesktopExe())
{
Thread.Sleep(1000);
}

if (dragDropHook != null)
{
// Remove hooks
dragDropHook.Dispose();
// Finalise cleanup of hooks
LocalHook.Release();
File.AppendAllText(logFilePath, "Disposed " + Environment.NewLine);
}
}

最佳答案

您无法卸载托管程序集 EasyHook.dll 或 EasyLoad64.dll,因为它们已加载到默认的 .NET AppDomain 中,据我所知,.NET 不支持从此处卸载程序集。您的 Hook 程序集将被卸载,因为 EasyLoad 为此目的设置了一个新的 AppDomain。

理论上,可以使用 Win32 API 卸载 native EasyHook64.dll,但是它被 EasyHook.dll 托管程序集使用,我不确定如果您尝试重新挂接/注入(inject)会发生什么。考虑到无法卸载另外两个,我看不出有任何意义。

关于c# - 如何注销 EasyHook.dll、EasyHook64.dll 和 EasyLoad64.dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49048053/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com