hearthbuddy中的一段代码

// Token: 0x06001A79 RID: 6777 RVA: 0x000DD024 File Offset: 0x000DB224
internal IntPtr method_33(IntPtr intptr_37, string string_0, params Class276.Enum20[] enum20_0)
{
while (intptr_37 != IntPtr.Zero)
{
using (AllocatedMemory allocatedMemory = this.externalProcessMemory_0.CreateAllocatedMemory())
{
allocatedMemory.AllocateOfChunk<IntPtr>("Itr");
IntPtr intPtr;
while ((intPtr = this.method_35(intptr_37, allocatedMemory["Itr"])) != IntPtr.Zero)
{
IntPtr address = this.method_37(intPtr);
if (this.externalProcessMemory_0.ReadStringA(address) == string_0)
{
if (enum20_0 != null)
{
Class276.Enum20[] array = this.method_31(intPtr);
if (array.Length != enum20_0.Length || !array.SequenceEqual(enum20_0))
{
continue;
}
}
return intPtr;
}
}
intptr_37 = this.method_25(intptr_37);
}
}
return IntPtr.Zero;
}

// Token: 0x04000D28 RID: 3368
        private readonly ExternalProcessMemory externalProcessMemory_0;

public class ExternalProcessMemory : MemoryBase

// Token: 0x06000157 RID: 343 RVA: 0x0036DA50 File Offset: 0x00362E50
public AllocatedMemory CreateAllocatedMemory(int bytes)
{
return new AllocatedMemory(this, bytes);
}
// Token: 0x060000C1 RID: 193 RVA: 0x0036F644 File Offset: 0x00364A44
public void AllocateOfChunk(string allocatedName, int bytes)
{
IntPtr value = (IntPtr)this._currentOffset;
this._allocated.Add(allocatedName, value);
this._currentOffset += bytes;
ref int ptr = ref this._currentOffset;
int num = ptr;
int num2 = num % ;
if (num2 != )
{
ptr = num - num2 + ;
}
} // Token: 0x060000C2 RID: 194 RVA: 0x0036D637 File Offset: 0x00362A37
public void AllocateOfChunk<T>(string allocatedName) where T : struct
{
this.AllocateOfChunk(allocatedName, MarshalCache<T>.Size);
}

出处

https://github.com/lolp1/Process.NET   这个项目的致谢名单里有提到

GreyMagic - The best of both worlds, and then some

Download: https://dl.dropbox.com/u/2068143/GreyMagic.7z

So, I wrote this a while back for our bots (Honorbuddy, Demonbuddy,
BuddyWing, etc). It's a full-featured memory lib for both in and out of
process memory handling. Performance tests show that it's barely a tick
slower than calling ReadProcessMemory directly on simple data types, and
slightly over a tick slower than reading structures. (Write speeds have
not been tested, as writing is not done nearly as often)

The following are for perf tests over 1 million iterations:

Read<int>(addr, relative: true) - 4.57 ticks
ReadProcessMemory (direct) - 3.54 ticks
Deref on ReadBytes(addr, relative: true) - 3.90 ticks
Read<NonMarshalStruct>(addr, relative: true) - 5.06 ticks
Read<MarshalStruct>(addr, relative: true) - 6.48 ticks

The library itself implements a neat little trick to avoid using the
marshaler wherever possible. MarshalCache<T> provides a way to
cache certain data for types (size, typeof(), whether the type needs to
be run through the marshaler, etc), as well as implements a way for C#
to take a pointer to a generic type. (You can't do &T in C#...
well... at least you couldn't)

The lib itself takes into account quite a few things, and should
hopefully be plug-and-play ready. It includes a few other things that
aren't really useful (but tossed in for the sake of tossing it in). I
will be adding more features in the future (it lacks a pattern scanner).
Feel free to use and abuse, please let me know of any bugs you run
into.

In-process memory class: InProcessMemoryReader
OOP memory class: ExternalProcessMemoryReader

Enjoy folks!

GreyMagic的更多相关文章

  1. Web安全工具大汇聚

    http://www.owasp.org/index.PHP/Phoenix/Tools http://sebug.net/paper/other/Web安全工具大汇聚.txt =========== ...

  2. 跨站脚本(XSS)备忘单-2019版

    这是一份跨站脚本(XSS)备忘录,收集了大量的XSS攻击向量,包含了各种事件处理.通讯协议.特殊属性.限制字符.编码方式.沙箱逃逸等技巧,可以帮助渗透测试人员绕过WAF和过滤机制. 译者注:原文由Po ...

  3. HearthBuddy炉石兄弟 Method 'Entity.GetRace' not found.

    解决方案 namespace Triton.Game.Mapping{// Token: 0x020004A4 RID: 1188[Attribute38("Entity")]pu ...

  4. HearthBuddy Plugin编写遇到的问题

    错误1 赋值问题 貌似编译器版本有点低,无法识别C#的高级语法糖 属性的初始值,必须是public bool IsEnabled { get{return true;} } 不能写成public bo ...

  5. github搜索不到代码的问题

    Hi team, Please check the following three query url :https://github.com/Konctantin/GreyMagic/search? ...

  6. HearthBuddy炉石兄弟 Method 'CollectionDeckBoxVisual.IsValid' not found.

    [CollectionManagerScene_COLLECTION] An exception occurred when calling CacheCustomDecks: System.Miss ...

  7. HearthBuddy 第一次调试

    HearthBuddy https://www.jiligame.com/70639.html 解压缩包,打开hearthbuddy.exe直接运行就可以:不用替换mono.dll直接可用:不需要校验 ...

随机推荐

  1. 关于redis的几件小事(五)redis保证高并发以及高可用

    如果你用redis缓存技术的话,肯定要考虑如何用redis来加多台机器,保证redis是高并发的,还有就是如何让Redis保证自己不是挂掉以后就直接死掉了,redis高可用 redis高并发:主从架构 ...

  2. spring-boot 启动图标修改-启动彩蛋

    spring boot启动总会显示这样的图标,但是我想不一样 到网上找了一圈,恩,找到一个不错的,做个记录 首先我们在resource目录下面放入一个banner.txt文件,Spring Boot启 ...

  3. 无线传输模块HC-12

    无线传输模块HC-12使用 因为实验室的无人机需要使用一款无线传输模块进行遥控控制,我们讨论的中测试了HC-12,并对HC-12传输距离进行了简单测试.在此做下使用记录. 模块概述 HC-12 无线串 ...

  4. adb进阶知识,如何过滤只查看某一个app的日志

    前面大概学习了adb基础,但是adb的存在,在测试人员中究竟有什么必要,以及看log时,那么多的log,让我们看个屁啊,所以这一次,我决定一定要把adb这件事情搞清楚.   1.先来看最感兴趣的adb ...

  5. (转)Python3.X如何下载安装urllib2包 ?

    python 3.X版本是不需要安装:urllib2包的,urllib和urllib2包集合成在一个包了那现在问题是:在python3.x版本中,如何使用:urllib2.urlopen()? 答:i ...

  6. linux下创建软链--laravel软链

    ln -s /www/wwwroot/project_name/storage/app/public/ /www/wwwroot/project_name/public/storage

  7. java执行字符串中的运算公式

    import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.Scrip ...

  8. win7安装xmanager报错error1303、err1317

    安装xmanager时出现的一些问题,记录如下. 1.安装xmanager时,提示error1303.如下图,按照百度的办法,创建相应的文件夹后,点击重试. 2.重试后提示err1317,如下图所示. ...

  9. 使用TortoiseGit,设置ssh方式连接git仓库。

    开始设置之前的准备:建立项目文件夹,初始化git仓库(右键 git  init),右键打开 git bash ,git pull “仓库地址”, 把网站上的仓库代码拉取下来. TortoiseGit使 ...

  10. anaconda安装失败

    2019.10版本怎么安装都不行换了2018.10安装ok