资源简介
C# 最简单使用 EasyHook 源码,极简而全,Hook入门者,让大家都会Hook。支持注入托管非托管程序,32位和64位程序,windows 10 x64 调试通过。

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using EasyHook;
using System.Threading;
using System.Diagnostics;
using System.Windows.Forms;
namespace ClassLibrary1
{
[Serializable]
public class HookParameter
{
public string Msg { get; set; }
public int HostProcessId { get; set; }
}
public class Main : EasyHook.IEntryPoint
{
public LocalHook MessageBoxWHook = null;
public LocalHook MessageBoxAHook = null;
public Main(
RemoteHooking.IContext context
String channelName
HookParameter parameter
)
{
MessageBox.Show(parameter.Msg “Hooked“);
}
public void Run(
RemoteHooking.IContext context
String channelName
HookParameter parameter
)
{
try
{
MessageBoxWHook = LocalHook.Create(
LocalHook.GetProcAddress(“user32.dll“ “MessageBoxW“)
new DMessageBoxW(MessageBoxW_Hooked)
this);
MessageBoxWHook.ThreadACL.SetExclusiveACL(new Int32[1]);
MessageBoxAHook = LocalHook.Create(
LocalHook.GetProcAddress(“user32.dll“ “MessageBoxA“)
new DMessageBoxW(MessageBoxA_Hooked)
this);
MessageBoxAHook.ThreadACL.SetExclusiveACL(new Int32[1]);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
try
{
while (true)
{
Thread.Sleep(10);
}
}
catch
{
}
}
#region MessageBoxW
[DllImport(“user32.dll“ EntryPoint = “MessageBoxW“ CharSet = CharSet.Unicode)]
public static extern IntPtr MessageBoxW(int hWnd string text string caption uint type);
[UnmanagedFunctionPointer(CallingConvention.StdCall CharSet = CharSet.Unicode)]
delegate IntPtr DMessageBoxW(int hWnd string text string caption uint type);
static IntPtr MessageBoxW_Hooked(int hWnd string text string caption uint type)
{
return MessageBoxW(hWnd “Hooked - “ + text “Hooked - “ + caption type);
}
#endregion
#region MessageBoxA
[DllImport(“user32.dll“ EntryPoint = “MessageBoxA“ CharSet = CharSet.Ansi)]
public static extern IntPtr MessageBoxA(int hWnd string text string caption uint type);
[UnmanagedFunctionPointer(CallingConvention.StdCall CharSet = CharSet.Ansi)]
delegate IntPtr DMessageBoxA(int hWnd string text string caption uint type);
static IntP
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6656 2017-09-27 17:26 ClassLibrary1\bin\Debug\ClassLibrary1.dll
文件 15872 2017-09-27 17:26 ClassLibrary1\bin\Debug\ClassLibrary1.pdb
文件 2976 2017-09-27 16:58 ClassLibrary1\ClassLibrary1.csproj
文件 3218 2017-09-27 17:26 ClassLibrary1\Main.cs
文件 999 2017-09-27 16:33 ClassLibrary1\obj\Debug\ClassLibrary1.csproj.FileListAbsolute.txt
文件 6680 2017-09-27 16:32 ClassLibrary1\obj\Debug\ClassLibrary1.csprojResolveAssemblyReference.cache
文件 6656 2017-09-27 17:26 ClassLibrary1\obj\Debug\ClassLibrary1.dll
文件 15872 2017-09-27 17:26 ClassLibrary1\obj\Debug\ClassLibrary1.pdb
文件 6105 2017-09-27 17:26 ClassLibrary1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 1358 2017-09-27 15:47 ClassLibrary1\Properties\AssemblyInfo.cs
文件 49152 2017-09-27 15:50 ClassLibrary1\RefLib\EasyHook.dll
文件 596 2017-09-27 16:10 ClassLibrary1\SN.snk
文件 6656 2017-09-27 17:26 WindowsFormsApplication8\bin\Debug\ClassLibrary1.dll
文件 15872 2017-09-27 17:26 WindowsFormsApplication8\bin\Debug\ClassLibrary1.pdb
文件 49152 2017-09-27 16:22 WindowsFormsApplication8\bin\Debug\EasyHook.dll
文件 263680 2017-09-27 16:21 WindowsFormsApplication8\bin\Debug\EasyHook32.dll
文件 299008 2017-09-27 16:21 WindowsFormsApplication8\bin\Debug\EasyHook64.dll
文件 10240 2017-09-27 17:26 WindowsFormsApplication8\bin\Debug\WindowsFormsApplication8.exe
文件 34304 2017-09-27 17:26 WindowsFormsApplication8\bin\Debug\WindowsFormsApplication8.pdb
文件 11592 2017-09-28 13:49 WindowsFormsApplication8\bin\Debug\WindowsFormsApplication8.vshost.exe
文件 490 2015-07-10 19:01 WindowsFormsApplication8\bin\Debug\WindowsFormsApplication8.vshost.exe.manifest
文件 49152 2017-09-27 16:22 WindowsFormsApplication8\EasyHook.dll
文件 263680 2017-09-27 16:21 WindowsFormsApplication8\EasyHook32.dll
文件 299008 2017-09-27 16:21 WindowsFormsApplication8\EasyHook64.dll
文件 4189 2017-09-27 17:18 WindowsFormsApplication8\Form1.cs
文件 3112 2017-09-27 17:11 WindowsFormsApplication8\Form1.Designer.cs
文件 5817 2017-09-27 17:11 WindowsFormsApplication8\Form1.resx
文件 5420 2017-09-27 16:18 WindowsFormsApplication8\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7128 2017-09-27 17:26 WindowsFormsApplication8\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 3518 2017-09-28 13:49 WindowsFormsApplication8\obj\x86\Debug\WindowsFormsApplication8.csproj.FileListAbsolute.txt
............此处省略40个文件信息
- 上一篇:c#做的一个计算器
- 下一篇:局域网聊天软件C#源码
相关资源
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
评论
共有 条评论