- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在使用 EasyHook 拦截注册表调用。更详细地说,我使用 RegQueryValue 来拦截从注册表中读取一个键并用其他东西改变它的值的调用。相关代码如下:
[UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)]
delegate int DRegQueryValueExW(
IntPtr hKey,
string lpValueName,
int lpReserved,
ref Microsoft.Win32.RegistryValueKind lpType,
StringBuilder lpData,
ref int lpcbData);
[DllImport("Advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention = CallingConvention.StdCall)]
static extern int RegQueryValueExW(
IntPtr hKey,
string lpValueName,
int lpReserved,
ref Microsoft.Win32.RegistryValueKind lpType,
StringBuilder lpData,
ref int lpcbData);
int RegQueryValueExW_Hooked(
IntPtr hKey,
string lpValueName,
int lpReserved,
ref Microsoft.Win32.RegistryValueKind lpType,
StringBuilder lpData,
ref int lpcbData)
{
// todo: change value of lpData and return 0
return RegQueryValueExW(hKey, lpValueName, lpReserved, ref lpType, lpData, ref lpcbData);
}
如果我使用目标 x64 构建所有内容,这一切都可以毫无问题地执行。
但是,如果我使用目标 x32 构建它,它会在 RegQueryValueExW_Hooked 中崩溃并出现错误:
Unhandled Exception: System.Runtime.InteropServices.SEHException: External component has thrown an exception. at DummyDCA.Program.Main(String[] args) Unhandled Exception: System.ArgumentOutOfRangeException: Capacity exceeds maximum capacity. Parameter name: capacity at AG.RU.Valuation.Controller.AFMToolbox.Inject.Main.RegQueryValueExW(IntPtrhKey, String lpValueName, Int32 lpReserved, RegistryValueKind& lpType, StringBuilder lpData, Int32& lpcbData) at AG.RU.Valuation.Controller.AFMToolbox.Inject.Main.RegQueryValueExW_Hooked(IntPtr hKey, String lpValueName, Int32 lpReserved, RegistryValueKind& lpType, StringBuilder lpData, Int32& lpcbData)
问题似乎是 StringBuilder 类型的 lpData(某种溢出,StringBuilder 不够大或其他原因)。如果我用 IntPtr 替换 StringBuilder,它不会崩溃;但是我有一个指针而不是 StringBuilder,所以我不确定如何替换 lpData 的值。
有没有人知道为什么会这样,应该怎么做?
谢谢!
最佳答案
似乎我不得不使用 IntPtr 而不是 StringBuilder; RegQueryValueExW_Hooked 的实现也比较特殊。
Luaan 在此线程中描述了实际的解决方案:Changing the string to which an IntPtr is pointing
关于c# - Easyhook 32 位应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21722555/
使用 EasyHook 我设置了以下结构: APP 接口(interface) DLL 当我按下应用程序中的按钮时,我试图在注入(inject)的 DLL 中运行一些代码。 我设法让 DLL 使用
我正在使用开源库 EasyHook . 我想做的是,当 VB6 应用程序在特定 CLSID 上从 ole32.dll 调用 CoCreateInstance 时 Hook ,返回我自己的对象 C# 实
对不起,但我必须放一段代码,这样你才能理解。 using System; using System.Collections.Generic; using System.Text; using Syst
我可以使用 EasyHook 从内核模式 Hook 一些 API(NtOpenProcess)吗? 我对通过进程范围的 dll 注入(inject)进行用户模式 Hook 不感兴趣,但正如我所见,ea
我正在尝试了解 easyhook 如何为即将到来的项目工作。为此,我决定尝试劫持 firefox.exe 进程中的 GetMonitorInfoW 和 GetDeviceCaps 以获取 window
我正在使用 EasyHook 拦截注册表调用。更详细地说,我使用 RegQueryValue 来拦截从注册表中读取一个键并用其他东西改变它的值的调用。相关代码如下: [UnmanagedFunctio
我一直在尝试使用 EasyHook 从 Chrome 和 Firefox Hook 对“recv”的调用。但是,这不起作用 - 它不会因任何错误而失败,但也不会捕获任何数据包。我已经尝试过带有“Cre
在多次寻找在 C# 中创建到外部应用程序的 Hook 的方法后,我偶然发现了 EasyHook,这将是理想的选择。不幸的是,周围的社区为零,该软件自 2008 年以来就没有维护过,似乎无法在 Visu
如果我这样做: try { try { Config.Register(
我有一个调用以下(删节)代码的注入(inject)器: var processes = Process.GetProcessesByName("target"); /* ... */ var proc
IPC 客户端和IPC 服务器如何调用共享远程接口(interface)(继承MarshalByRefObject 的类)进行通信,而不必将接口(interface)类放在注入(inject)应用程序
我在使方法 Hook 正常工作时遇到了一些问题。如果“我”调用被 Hook 的方法,我就可以让 Hook 工作。但是当它在进程运行期间自然发生时,它不会被钩住。我的问题可能源于这样一个事实,即我实际上
所以我在 winspool.drv!WritePrinter 上有一个 Hook 函数,它成功地 Hook 了远程注入(inject)到 spoolsv.exe 的非托管 C++。 目前, Hook
我设法编写了一个 Hook recv 函数的半工作 EasyHook 示例。我编写了一个表单,添加了一个 WebBrowser 组件,然后启动了应用程序。问题是,我得到了 HTTP 数据包,但如果有套
我已经下载了 EasyHook 2.7 源代码,并尝试在我的 Visual Studio 2012 环境中编译它。 在解决了很多warnings之后,我又发现了其他无法解决的warnings,分别是:
我使用 EasyHook 从库中 Hook 系统 API 例程(在 C++ 中)取得了很多成功。这些库一直是扁平的,基本上充满了全局可调用的例程。这是一个使用 User32.dll 库中的 Messa
我曾尝试使用 EasyHook 将 DLL 注入(inject)到另一个进程中,但是当宿主进程关闭时,EasyHook 和其他注入(inject)的 DLL 仍在处理中。有谁知道如何从目标进程中卸载它
在有人提到它之前,我提到了 this链接以了解我需要如何将后备缓冲区复制到位图。 现状 我被注入(inject)了目标进程 目标进程'FeatureLevel = Level_11_0 正在使用 DX
我正在使用 Easyhook,退出应用程序后,被 Hook 的应用程序崩溃了。我知道它发生在哪里,但不知道如何解决。我正在 Hook DrawText。我什么也没做: int Draw
我正在使用 EasyHook dll 并执行 DoDragDrop API Hook ,一切正常,但如何释放以下 3 个 dll 1.EasyHook.dll2.EasyHook64.dll3.Eas
我是一名优秀的程序员,十分优秀!