本文整理汇总了C#中EasyHook.LocalHook类的典型用法代码示例。如果您正苦于以下问题:C# LocalHook类的具体用法?C# LocalHook怎么用?C# LocalHook使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocalHook类属于EasyHook命名空间,在下文中一共展示了LocalHook类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: InstallHook
public override void InstallHook()
{
sendHook = LocalHook.Create(
LocalHook.GetProcAddress("Ws2_32.dll", "send"),
new Dsend(send_Hooked),
this.Injector);
sendHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
sendtoHook = LocalHook.Create(
LocalHook.GetProcAddress("Ws2_32.dll", "sendto"),
new Dsendto(sendto_Hooked),
this.Injector);
sendtoHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
recvHook = LocalHook.Create(
LocalHook.GetProcAddress("Ws2_32.dll", "recv"),
new Drecv(recv_Hooked),
this.Injector);
recvHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
recvFunc = LocalHook.GetProcDelegate<Drecv>("Ws2_32.dll", "recv");
recvfromHook = LocalHook.Create(
LocalHook.GetProcAddress("Ws2_32.dll", "recvfrom"),
new Drecvfrom(recvfrom_Hooked),
this.Injector);
recvfromHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
recvfromFunc = LocalHook.GetProcDelegate<Drecvfrom>("Ws2_32.dll", "recvfrom");
}
开发者ID:ming-hai,项目名称:APIMonitor,代码行数:28,代码来源:NetActivities.cs
示例2: InstallHook
public override void InstallHook()
{
CreateProcessHook = LocalHook.Create(
LocalHook.GetProcAddress("kernel32.dll", "CreateProcessW"),
new DCreateProcessW(CreateProcessW_Hooked),
this.Injector);
CreateProcessHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
ExitProcessHook = LocalHook.Create(
LocalHook.GetProcAddress("kernel32.dll", "ExitProcess"),
new DExitProcess(ExitProcess_Hooked),
this.Injector);
ExitProcessHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
TerminateProcessHook = LocalHook.Create(
LocalHook.GetProcAddress("kernel32.dll", "TerminateProcess"),
new DTerminateProcess(TerminateProcess_Hooked),
this.Injector);
TerminateProcessHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
CreateThreadHook = LocalHook.Create(
LocalHook.GetProcAddress("kernel32.dll", "CreateThread"),
new DCreateThread(CreateThread_Hooked),
this.Injector);
CreateThreadHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
TerminateThreadHook = LocalHook.Create(
LocalHook.GetProcAddress("kernel32.dll", "TerminateThread"),
new DTerminateThread(TerminateThread_Hooked),
this.Injector);
TerminateThreadHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
}
开发者ID:ming-hai,项目名称:APIMonitor,代码行数:32,代码来源:ProcActivities.cs
示例3: Run
public void Run(RemoteHooking.IContext InContext,
String InChannelName)
{
// install hook...
try
{
CreateFileHook = LocalHook.Create(LocalHook.GetProcAddress("kernel32.dll", "CreateFileW"),
new DCreateFile(CreateFile_Hooked),
this);
CreateFileHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
RemoteHooking.WakeUpProcess();
}
catch (Exception ExtInfo)
{
Interface.ReportException(ExtInfo);
return;
}
//Interface.IsInstalled(RemoteHooking.GetCurrentProcessId());
try
{
while (true)
{
Interface.Ping();
}
}
catch
{
//
}
}
开发者ID:DjPasco,项目名称:Mag,代码行数:33,代码来源:FileMonInject.cs
示例4: Run
public void Run(
RemoteHooking.IContext InContext,
String InChannelName)
{
// install hook...
try
{
LocalHook.BeginUpdate(true);
CreateFileHook = LocalHook.Create(
LocalHook.GetProcAddress("kernel32.dll", "CreateFileW"),
new DCreateFile(CreateFile_Hooked),
this);
LocalHook.EndUpdate();
CreateFileHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
}
catch (Exception ExtInfo)
{
Interface.ReportException(ExtInfo);
return;
}
Interface.IsInstalled(RemoteHooking.GetCurrentProcessId());
RemoteHooking.WakeUpProcess();
// wait for host process termination...
try
{
while (true)
{
Thread.Sleep(500);
// transmit newly monitored file accesses...
if (Queue.Count > 0)
{
String[] Package = null;
lock (Queue)
{
Package = Queue.ToArray();
Queue.Clear();
}
Interface.OnCreateFile(RemoteHooking.GetCurrentProcessId(), Package);
}
else
Interface.Ping();
}
}
catch
{
// Ping() will raise an exception if host is unreachable
}
}
开发者ID:ZionOps,项目名称:b00ks-d0c,代码行数:60,代码来源:Main.cs
示例5: DX9Controller
public DX9Controller(HWSettings settings)
{
this._settings = settings;
this.Name = typeof(DX9Controller).Name;
IntPtr direct3D = Direct3DCreate9(32);
try {
if (direct3D == IntPtr.Zero){
MessageBox.Show("error");
throw new Exception("Failed to create D3D.");
}
IntPtr adapterIdentPtr = Marshal.ReadIntPtr(Marshal.ReadIntPtr(direct3D), 20);
GetAdapterIdentifierOriginal = (GetAdapterIdentifierDelegate)Marshal.GetDelegateForFunctionPointer(adapterIdentPtr, typeof(GetAdapterIdentifierDelegate));
_name = string.Format("GetAdapterIdentHook_{0:X}", adapterIdentPtr.ToInt32());
_hook = LocalHook.Create(adapterIdentPtr, new GetAdapterIdentifierDelegate(GetAdapterIdentifierDetour), this);
_hook.ThreadACL.SetExclusiveACL(new Int32[] { 1 });
} catch (Exception ex) {
HookManager.Log("[DX9Controller] Exception: " + ex.ToString());
this.Error = true;
}
}
开发者ID:Blinker,项目名称:QuestorLauncher,代码行数:26,代码来源:DX9Controller.cs
示例6: Initialize
public override void Initialize()
{
Form form = new Form();
IntPtr intPtr = Direct3DCreate9(32u);
if (intPtr == IntPtr.Zero)
{
throw new Exception("Failed to create D3D.");
}
D3D9.Struct0 @struct = new D3D9.Struct0
{
bool_0 = true,
uint_6 = 1u,
uint_2 = 0u
};
D3D9.Delegate4 @delegate = (D3D9.Delegate4)Marshal.GetDelegateForFunctionPointer(Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr), 64), typeof(D3D9.Delegate4));
IntPtr intPtr2;
if (@delegate(intPtr, 0u, 1u, form.Handle, 32u, ref @struct, out intPtr2) < 0)
{
throw new Exception("Failed to create device.");
}
this.EndScenePointer = Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr2), 168);
D3D9.Delegate3 delegate2 = (D3D9.Delegate3)Marshal.GetDelegateForFunctionPointer(Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr2), 8), typeof(D3D9.Delegate3));
D3D9.Delegate3 delegate3 = (D3D9.Delegate3)Marshal.GetDelegateForFunctionPointer(Marshal.ReadIntPtr(Marshal.ReadIntPtr(intPtr), 8), typeof(D3D9.Delegate3));
delegate2(intPtr2);
delegate3(intPtr);
form.Dispose();
this.delegate2_0 = (D3D9.Delegate2)Marshal.GetDelegateForFunctionPointer(this.EndScenePointer, typeof(D3D9.Delegate2));
this.localHook_0 = LocalHook.Create(this.EndScenePointer, new D3D9.Delegate2(this.method_0), this);
int[] exclusiveACL = new int[1];
localHook_0.ThreadACL.SetExclusiveACL(exclusiveACL);
}
开发者ID:isxGames,项目名称:QuestorISX,代码行数:32,代码来源:D3D9.cs
示例7: RegistryHook
public RegistryHook(IntPtr address, string prodKey)
{
_prodKey = prodKey;
_name = string.Format("RegQueryValueExAHook_{0:X}", address.ToInt32());
_hook = LocalHook.Create(address, new RegQueryValueExADelegate(RegQueryValueExADetour), this);
_hook.ThreadACL.SetExclusiveACL(new Int32[] {0});
}
开发者ID:Blinker,项目名称:DirectEve,代码行数:8,代码来源:RegistryHook.cs
示例8: AppdataHook
public AppdataHook(IntPtr address, string userLogin)
{
_userLogin = userLogin;
_name = string.Format("AppDataHook_{0:X}", address.ToInt32());
_hook = LocalHook.Create(address, new SHGetFolderPathDelegate(SHGetFolderPathDetour), this);
_hook.ThreadACL.SetExclusiveACL(new Int32[] {0});
}
开发者ID:Blinker,项目名称:DirectEve,代码行数:8,代码来源:AppdataHook.cs
示例9: MemoryHook
public MemoryHook(IntPtr address, ulong totalPhys)
{
_totalPhys = totalPhys;
_name = string.Format("MemoryHook{0:X}", address.ToInt32());
_hook = LocalHook.Create(address, new GlobalMemoryStatusDelegate(GlobalMemoryStatusDetour), this);
_hook.ThreadACL.SetExclusiveACL(new Int32[] {0});
}
开发者ID:Blinker,项目名称:DirectEve,代码行数:8,代码来源:MemoryHook.cs
示例10: Run
public void Run(
RemoteHooking.IContext InContext,
String InChannelName)
{
// install hook...
try
{
CreateKeywordHook = LocalHook.Create(
LocalHook.GetProcAddress("python27.dll", "PyEval_CallObjectWithKeywords"),
new DCallKeywords(CallKeywords_Hooked),
this);
CreateKeywordHook.ThreadACL.SetExclusiveACL(new Int32[] {0});
CreateGetModuleHandleAHook = LocalHook.Create(LocalHook.GetProcAddress("kernel32", "GetModuleHandleA"), new DGetModuleHandleA(GetModuleHandleHooked), this);
CreateGetModuleHandleAHook.ThreadACL.SetExclusiveACL(new Int32[] {0});
}
catch (Exception ExtInfo)
{
Interface.ReportException(ExtInfo);
return;
}
Interface.IsInstalled(RemoteHooking.GetCurrentProcessId());
RemoteHooking.WakeUpProcess();
// wait for host process termination...
try
{
while (true)
{
Thread.Sleep(500);
// transmit newly monitored file accesses...
if (Queue.Count > 0)
{
String[] Package = null;
lock (Queue)
{
Package = Queue.ToArray();
Queue.Clear();
}
}
else
Interface.Ping();
}
}
catch
{
// Ping() will raise an exception if host is unreachable
}
}
开发者ID:Blinker,项目名称:DirectEve,代码行数:57,代码来源:Main.cs
示例11: NetworkAdapterHook
public NetworkAdapterHook(IntPtr address, string guid, string mac, string ipaddress)
{
_guid = guid;
_mac = mac;
_address = ipaddress;
_name = string.Format("GetAdaptersInfoHook_{0:X}", address.ToInt32());
_hook = LocalHook.Create(address, new GetAdaptersInfoDelegate(GetAdaptersInfoDetour), this);
_hook.ThreadACL.SetExclusiveACL(new Int32[] {0});
}
开发者ID:Blinker,项目名称:DirectEve,代码行数:10,代码来源:NetworkAdapterHook.cs
示例12: Hook
public override void Hook()
{
SwapBuffers_Hook = LocalHook.Create (LocalHook.GetProcAddress ("gdi32.dll","SwapBuffers"), new Delegate_SwapBuffers(SwapBuffers_Hooked),this);
//gfx = Graphics.FromImage(imag);
//gfx.FillRectangle(Brushes.Blue, 0, 0, 350, 350);
SwapBuffers_Hook.ThreadACL.SetExclusiveACL(new Int32[1]);
this.DebugMessage("Hook: Done" + DateTime.Now.ToString() + ":" + DateTime.Now.Millisecond.ToString());
}
开发者ID:xttx,项目名称:mCheats,代码行数:10,代码来源:DXHookOGL.cs
示例13: GraphicsCardHook
public GraphicsCardHook(IntPtr address, Settings settings)
{
_settings = settings;
var dxgiHandle = Utility.GetModuleHandle("dxgi.dll");
var getDescPtr = dxgiHandle + getDescOffset;
GetDesc1Original = (GetDesc1Delegate) Marshal.GetDelegateForFunctionPointer(getDescPtr, typeof (GetDesc1Delegate));
_name = string.Format("GetDescHook_{0:X}", getDescPtr.ToInt32());
_hook = LocalHook.Create(getDescPtr, new GetDesc1Delegate(GetDesc1Detour), this);
_hook.ThreadACL.SetExclusiveACL(new Int32[] {0});
}
开发者ID:Blinker,项目名称:DirectEve,代码行数:12,代码来源:GraphicsCardHook.cs
示例14: CryptHashDataController
public CryptHashDataController(IntPtr address)
{
this.Name = typeof(CryptHashDataController).Name;
try {
_name = string.Format("CryptDataHash_{0:X}", address.ToInt32());
_hook = LocalHook.Create(address, new CryptHashDataDelegate(CryptHashDataDetour), this);
_hook.ThreadACL.SetExclusiveACL(new Int32[] { 1 });
} catch (Exception) {
this.Error= true;
}
}
开发者ID:Blinker,项目名称:QuestorLauncher,代码行数:14,代码来源:CryptHashDataController.cs
示例15: Hook
public override void Hook()
{
this.DebugMessage("Hook: Begin");
// First we need to determine the function address for IDirect3DDevice9
Device device;
List<IntPtr> id3dDeviceFunctionAddresses = new List<IntPtr>();
this.DebugMessage("Hook: Before device creation");
using (Direct3D d3d = new Direct3D())
{
this.DebugMessage("Hook: Device created");
using (device = new Device(d3d, 0, DeviceType.NullReference, IntPtr.Zero, CreateFlags.HardwareVertexProcessing, new PresentParameters() { BackBufferWidth = 1, BackBufferHeight = 1 }))
{
id3dDeviceFunctionAddresses.AddRange(GetVTblAddresses(device.ComPointer, D3D9_DEVICE_METHOD_COUNT));
}
}
// We want to hook each method of the IDirect3DDevice9 interface that we are interested in
// 42 - EndScene (we will retrieve the back buffer here)
Direct3DDevice_EndSceneHook = LocalHook.Create(
id3dDeviceFunctionAddresses[(int)Direct3DDevice9FunctionOrdinals.EndScene],
// On Windows 7 64-bit w/ 32-bit app and d3d9 dll version 6.1.7600.16385, the address is equiv to:
// (IntPtr)(GetModuleHandle("d3d9").ToInt32() + 0x1ce09),
// A 64-bit app would use 0xff18
// Note: GetD3D9DeviceFunctionAddress will output these addresses to a log file
new Direct3D9Device_EndSceneDelegate(EndSceneHook),
this);
// 16 - Reset (called on resolution change or windowed/fullscreen change - we will reset some things as well)
Direct3DDevice_ResetHook = LocalHook.Create(
id3dDeviceFunctionAddresses[(int)Direct3DDevice9FunctionOrdinals.Reset],
// On Windows 7 64-bit w/ 32-bit app and d3d9 dll version 6.1.7600.16385, the address is equiv to:
//(IntPtr)(GetModuleHandle("d3d9").ToInt32() + 0x58dda),
// A 64-bit app would use 0x3b3a0
// Note: GetD3D9DeviceFunctionAddress will output these addresses to a log file
new Direct3D9Device_ResetDelegate(ResetHook),
this);
/*
* Don't forget that all hooks will start deactivated...
* The following ensures that all threads are intercepted:
* Note: you must do this for each hook.
*/
Direct3DDevice_EndSceneHook.ThreadACL.SetExclusiveACL(new Int32[1]);
Direct3DDevice_ResetHook.ThreadACL.SetExclusiveACL(new Int32[1]);
this.DebugMessage("Hook: End");
}
开发者ID:spazzarama,项目名称:Afterglow,代码行数:49,代码来源:DXHookD3D9.cs
示例16: GlobalMemoryStatusController
public GlobalMemoryStatusController(IntPtr address, ulong totalPhys)
{
this._totalPhys = totalPhys;
this.Name = typeof(GlobalMemoryStatusController).Name;
try {
_name = string.Format("MemoryHook{0:X}", address.ToInt32());
_hook = LocalHook.Create(address, new GlobalMemoryStatusDelegate(GlobalMemoryStatusDetour), this);
_hook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
} catch (Exception) {
this.Error = true;
}
}
开发者ID:Blinker,项目名称:QuestorLauncher,代码行数:15,代码来源:GlobalMemoryStatusController.cs
示例17: InstallHook
public override void InstallHook()
{
RegCreateKeyHook = LocalHook.Create(
LocalHook.GetProcAddress("Advapi32.dll", "RegCreateKeyW"),
new DRegCreateKeyW(RegCreateKeyW_Hooked),
this.Injector);
RegCreateKeyHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
RegDeleteKeyHook = LocalHook.Create(
LocalHook.GetProcAddress("Advapi32.dll", "RegDeleteKeyW"),
new DRegDeleteKeyW(RegDeleteKeyW_Hooked),
this.Injector);
RegDeleteKeyHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
}
开发者ID:ming-hai,项目名称:APIMonitor,代码行数:15,代码来源:RegActivities.cs
示例18: InternetConnectAController
public InternetConnectAController()
{
Name = "InternetConnectAHook_" + "wininet.dll";
try
{
_hook = LocalHook.Create(LocalHook.GetProcAddress("wininet.dll", "InternetConnectA"), new HInternetConnectADelegate(HInternetConnectADetour), this);
_hook.ThreadACL.SetExclusiveACL(new Int32[] { 1 });
this.Error = false;
}
catch (Exception e)
{
this.Error = true;
HookManager.Log("[" + Name + "] Exception: " + e);
}
}
开发者ID:Blinker,项目名称:QuestorLauncher,代码行数:16,代码来源:InternetConnectAController.cs
示例19: GetAdaptersInfoController
public GetAdaptersInfoController(IntPtr address, string guid, string mac, string ipaddress)
{
this.Name = typeof(GetAdaptersInfoController).Name;
_guid = guid;
_mac = mac;
_address = ipaddress;
try {
_name = string.Format("GetAdaptersInfoHook_{0:X}", address.ToInt32());
_hook = LocalHook.Create(address, new GetAdaptersInfoDelegate(GetAdaptersInfoDetour), this);
_hook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });
} catch (Exception) {
this.Error = true;
}
}
开发者ID:Blinker,项目名称:QuestorLauncher,代码行数:16,代码来源:GetAdaptersInfoController.cs
示例20: RegQueryValueExAController
public RegQueryValueExAController(IntPtr address, string prodKey)
{
_prodKey = prodKey;
this.Name = typeof(RegQueryValueExAController).Name;
try {
_name = string.Format("RegQueryValueExAHook_{0:X}", address.ToInt32());
_hook = LocalHook.Create(address, new RegQueryValueExADelegate(RegQueryValueExADetour), this);
_hook.ThreadACL.SetExclusiveACL(new Int32[] { 1 });
} catch (Exception) {
this.Error = true;
}
}
开发者ID:Blinker,项目名称:QuestorLauncher,代码行数:16,代码来源:RegQueryValueExAController.cs
注:本文中的EasyHook.LocalHook类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论