using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Runtime.InteropServices;
using
System.Text;
using
System.Threading;
using
EasyHook;
namespace
EasyHookDemo
{
[Serializable]
public
class
FileMonInterface { }
public
class
Main : EasyHook.IEntryPoint
{
private
LocalHook Hook;
[DllImport(
"user32.dll"
)]
public
static
extern
bool
SetWindowText(IntPtr hWnd,
string
text);
[UnmanagedFunctionPointer(CallingConvention.StdCall, SetLastError =
true
)]
public
delegate
bool
DSetWindowText(IntPtr hWnd,
string
text);
public
bool
SetWindowTextHook(IntPtr hWnd,
string
text)
{
return
SetWindowText(hWnd,
"吾爱破解-wtujoxk"
);
}
#region 第一种方式,按引用传递,MarshalByRefObject
public
Main(RemoteHooking.IContext context,
string
InChannelName)
{
RemoteHooking.IpcConnectClient<MarshalByRefObject>(InChannelName);
}
public
void
Run(RemoteHooking.IContext context,
string
InChannelName)
{
Hook = LocalHook.Create(
LocalHook.GetProcAddress(
"user32.dll"
,
"SetWindowTextW"
),
new
DSetWindowText(SetWindowTextHook),
this
);
Hook.ThreadACL.SetExclusiveACL(
new
[] { 0 });
try
{
while
(
true
)
{
Thread.Sleep(500);
}
}
catch
{ }
}
#endregion
#region 第二种方式,按值传递,Serializable
public
Main(RemoteHooking.IContext context,
string
InChnnelName, FileMonInterface fmi)
{
}
public
void
Run(RemoteHooking.IContext context,
string
InChannelName, FileMonInterface fmi)
{
Hook = LocalHook.Create(
LocalHook.GetProcAddress(
"user32.dll"
,
"SetWindowTextW"
),
new
DSetWindowText(SetWindowTextHook),
this
);
Hook.ThreadACL.SetExclusiveACL(
new
[] { 0 });
try
{
while
(
true
)
{
Thread.Sleep(500);
}
}
catch
{ }
}
#endregion
}
}