Unity3D-WebPlayer上获取机器性能相关的尝试






http://blog.csdn.net/kun1234567/article/details/8846933?reload





今天花了数个小时研究如何获取机器性能相关参数,用来给用户做一个推荐配置选项。

首先介绍的是 SystemInfo , 这个是U3D自带类
可以获取除了CPU主频以外的绝大多数参数---除了主频。。
这没花什么时间,然后笔者很悲剧的花了一整天来找寻获取CPU主频的办法。

C#获取主频的方式大抵分为两种:
1、计时,然后自己算
2、直接查询。

我的结论是哪一种都没办法在webplayer里使用,参考:http://forum.unity3d.com/threads/7009-Unsafe-code-in-Unity
“to be more precise about webplayer: Anything relying on P/Invoke is disabled and cut, not only unsafe code”
最终采用的是使用SystemInfo的processorName,从中解析@ 3.00GHz 这类字符串来得到主频,解析不了就拉倒。

所以以下介绍的五种方法,如果客官感兴趣可以继续阅读(如果想知道我遇到的各种坑),否则就采用上述方案吧.

计时的方法有两种:

A)使用 RDTSC指令

具体使用方法搜一下即可,以下代码我没测试,只是转载用来描述RDTSC方法。

[cpp]  view plain copy
  1. 说到检测CPU的速度,一般是测试在单位时间内运算的指令条数,但用这种方法有太大的局限  
  2. 性,  
  3.    由于受到很多因素的影响,准确度比较低,特别是在Windows环境下,  
  4.    你不知道在你的程序外别的程序占用了多少的时间片。其实,在586及以上档次处理器中,  
  5.    已经有了一条专用的指令来测试主频,那就是 RDTSC指令,意思是读取时间标记计数器,  
  6.    是处理器内部的一个64位的MSR (model specific register),它每个时钟增加一个记数。  
  7.    在处理器复位的时候,初始值为0,RDTSC 指令把 TSC的值低32位装入EAX中,  
  8.    高32位装入EDX中。如果CPU的主频是200MHz,那么在一秒钟内,TSC的值增加 200.000.000次。  
  9.    所以在计算的时候,把两次的TSC差值除以两次的时间差值就是CPU的主频。  
  10.    程序的结构如下: 初始化的时候设置一个定时器,定时时间为1秒,然后在定时器消息中利用   
  11.    RDTSC 取得 TSC计数,再和上次保留的值相减,然后除以时间差即可。  
  12. bcb OK  
  13. #prgram inline  
  14. void __fastcall TForm1::Button1Click(TObject *Sender)  
  15. {  
  16.   
  17.      DWORD eax1,edx1,eax2,edx2;  
  18.    asm  
  19.    {  
  20.       rdtsc  
  21.       mov eax1,eax  
  22.       mov edx1,edx  
  23.    }  
  24.    Sleep(1000);  
  25.    asm{  
  26.      rdtsc  
  27.      mov eax2,eax  
  28.      mov edx2,edx  
  29.     }  
  30.   
  31.    eax2-=eax1;  
  32.    edx2-=edx1;  
  33.   
  34.    edx2*=2147483647;  
  35.    edx2+=eax2;  
  36.    Label2->Caption=IntToStr(edx2);  
  37. }  

U3D应用这种方法有几个难处
首先是asm的调用,c#调用asm很不友好,不过这个还能解决,各位参考如下代码:

[csharp]  view plain copy
  1. using System;  
  2. using System.Reflection;  
  3.   
  4. class Program  
  5. {  
  6.     public delegate uint Ret1ArgDelegate(uint arg1);  
  7.     static uint PlaceHolder1(uint arg1) { return 0; }  
  8.       
  9.     public static byte[] asmBytes = new byte[]  
  10.         {          
  11. 0x89,0xD0, // MOV EAX,EDX  
  12. 0xD1,0xC8, // ROR EAX,1  
  13. 0xC3       // RET  
  14.         };  
  15.           
  16.     unsafe static void Main(string[] args)  
  17.     {  
  18.         fixed(byte* startAddress = &asmBytes[0]) // Take the address of our x86 code  
  19.         {  
  20.             // Get the FieldInfo for "_methodPtr"  
  21.             Type delType = typeof(Delegate);  
  22.             FieldInfo _methodPtr = delType.GetField("_methodPtr", BindingFlags.NonPublic | BindingFlags.Instance);  
  23.   
  24.             // Set our delegate to our x86 code  
  25.             Ret1ArgDelegate del = new Ret1ArgDelegate(PlaceHolder1);  
  26.             _methodPtr.SetValue(del, (IntPtr)startAddress);  
  27.   
  28.             // Enjoy  
  29.             uint n = (uint)0xFFFFFFFC;  
  30.             n = del(n);  
  31.             Console.WriteLine("{0:x}", n);  
  32.         }  
  33.     }  
  34. }  
问题1:代码中0x89,0xD0这类机器码是如何得出来的?
不在乎,而且我也搜索到一个看起来很NB的类,姑且算作备选方案,但是文章后面会说到第2个难处:unsafe code

http://lotyong.blog.163.com/blog/static/98306907200841210340779/
http://lotyong.blog.163.com/blog/static/983069072008412103616779/

全部代码太长,我挪到文章的结尾了

B) 再一种计时方式

忘了(不要打我),不过要注意的是需要将程序所在线程的优先级提高,避免CPU使用权被抢占,反正挺麻烦,而且得的还不准,就没细查了。

直接查询的方式有3种:

A) 使用System.Management

[csharp]  view plain copy
  1. 代码中添加  
  2. using System.Management.Instrumentation;  
  3. using System.Management;  
  4.   
  5.  ManagementClass m = new ManagementClass("Win32_Processor");  
  6.             ManagementObjectCollection mn = m.GetInstances();  
  7.             MessageBox.Show("CPU个数:"+mn.Count.ToString());  
  8.             ManagementObjectSearcher MySearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor");  
  9.             foreach (ManagementObject MyObject in MySearcher.Get())  
  10.             {  
  11.                 MessageBox.Show("主频:"+MyObject.Properties["CurrentClockSpeed"].Value.ToString());  
  12.             }  
这种方式无法使用的问题在于,unity_web使用的dll是mono.2.0的子集,在这个子集里,是不带Management.dll的。
OK,那我就用调用DLL的方式加进去总可以了吧,于是乎这样干了:
将Editor自带的mono.2.0下的System.Management.dll扔到Assets目录里,然后在MonoDevelpment里编译,过了。

回到Unity-Build,居然报System.CodeDom.TypeDeclaration 不存在...查了一下,web版使用的System.dll压根就没有CodeDom这个namespace
(-___-;) ....

好吧,换方案

B) 使用注册表

如果这个世界上没有360的话,也许这个方案我还会去实验一下,360就是一流氓软件!
[cpp]  view plain copy
  1. CString strPath = L"HARDWARE//DESCRIPTION//System//CentralProcessor//0";  //注册表子键路径   
  2. CRegKey regkey;  //定义注册表类对象   
  3. LONG lResult;    //LONG型变量-反应结果   
  4. lResult=regkey.Open(HKEY_LOCAL_MACHINE,LPCTSTR(strPath),KEY_ALL_ACCESS); //打开注册表键   
  5. if (lResult!=ERROR_SUCCESS)   
  6. {   
  7.   AfxMessageBox(L"错误:无法查询有关的注册表信息");   
  8.   return;   
  9. }   
  10. DWORD dwMHz;   
  11. regkey.QueryValue(dwMHz, L"~MHz");//获取VendorIdentifier字段值   
  12. regkey.Close();//关闭注册表   
  13. CString str;   
  14. str.Format(L"%d", dwMHz);   
  15. MessageBox(str);  
有需要的同学凑合着看吧,反正少去动注册表,用户是不懂安全不安全的,360说你不安全你就不安全,特么的!
所以这个方案直接pass!

C) 使用系统API CallNtPowerInformation

先说个弯路,GetSystemInfo , 这个API可以获取一些和CPU相关的信息,我摘录了一部分。注意,64位系统应使用 GetNativeSystemInfo。

解释参考MSDN: http://msdn.microsoft.com/en-us/library/ms724381(VS.85).aspx
参考用法 http://blog.csdn.net/cbgn/article/details/4026897

[html]  view plain copy
  1. [StructLayout(LayoutKind.Sequential)]   
  2. public struct SYSTEM_INFO  
  3. {  
  4.     public uint dwOemId;  
  5.     public uint dwPageSize;  
  6.     public uint lpMinimumApplicationAddress;  
  7.     public uint lpMaximumApplicationAddress;  
  8.     public uint dwActiveProcessorMask;  
  9.     public uint dwNumberOfProcessors;  
  10.     public uint dwProcessorType;  
  11.     public uint dwAllocationGranularity;  
  12.     public uint dwProcessorLevel;  
  13.     public uint dwProcessorRevision;   
  14. }  
  15.   
  16.   
  17. class A  
  18. {  
  19.     [DllImport("kernel32")]  
  20.     private static extern void GetSystemInfo(ref SYSTEM_INFO<span style="font-family:Arial, Helvetica, sans-serif;"> </span>cpuInfo);  
  21.   
  22.   
  23.     public SYSTEM_INFO GetCpuInfo()  
  24.     {  
  25.         SYSTEM_INFO cpuInfo = new SYSTEM_INFO();  
  26.         GetSystemInfo(ref cpuInfo);  
  27.         return cpuInfo;  
  28.     }  
  29. }  
其中最让人感兴趣的是 dwProcessorLevel ,OK,什么是CPU等级。。。以下是MSDN的解释

wProcessorLevel

The architecture-dependent processor level. It should be used only for display purposes. To determine the feature set of a processor, use theIsProcessorFeaturePresent function.

If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_INTEL, wProcessorLevel is defined by the CPU vendor.

If wProcessorArchitecture is PROCESSOR_ARCHITECTURE_IA64, wProcessorLevel is set to 1.

CPU等级,可以类比显卡能力,就是CPU支持的一些指令集,比如3D-NOW之类的. 虽然很厉害,但是这个不是我想要的....可能以后能用上也说不定,比如显示出很多详细信息,让玩家觉得自己的CPU很NB之类..总之现在对我没用。

CallNtPowerInformation

这个API可以查询到CPU主频,当时在知道真相之前,我简直就跟发现真主了一样--直到我被狠狠的坑了一下.

NTSTATUS WINAPI CallNtPowerInformation(
  _In_   POWER_INFORMATION_LEVEL InformationLevel,
  _In_   PVOID lpInputBuffer,
  _In_   ULONG nInputBufferSize,
  _Out_  PVOID lpOutputBuffer,
  _In_   ULONG nOutputBufferSize
);

如你所见,这是C++,那么怎么在C#里调用呢,花费了大量时间之后,我终于找到了正确写法:

调用时,需要使用到指定的枚举:11

ProcessorInformation
11

The lpInBuffer parameter must be NULL; otherwise the function returns ERROR_INVALID_PARAMETER.

The lpOutputBuffer buffer receives one PROCESSOR_POWER_INFORMATION structure for each processor that is installed on the system. Use the GetSystemInfo function to retrieve the number of processors.

然后是C#的语法,为了写对,花了我好几个小时的时间,那个PLVOID搞死人了
参考《C#调用C++的DLL搜集整理的所有数据类型转换方式》

[csharp]  view plain copy
  1. [StructLayout(LayoutKind.Sequential)]   
  2. public struct _PROCESSOR_POWER_INFORMATION  
  3. {  
  4.   uint Number;  
  5.   uint MaxMhz;  
  6.   uint CurrentMhz;  
  7.   uint MhzLimit;  
  8.   uint MaxIdleState;  
  9.   uint CurrentIdleState;  
  10. };  
  11.   
  12.   
  13. class A  
  14. {  
  15.     [DllImport("powrprof")]  
  16.     public static extern int void CallNtPowerInformation(  
  17.         System.Int32 InformationLevel,  
  18.         System.IntPtr lpInputBuffer,  
  19.         System.UInt32 nInputBufferSize,  
  20.         System.IntPtr lpOutputBuffer,  
  21.         System.UInt32 nOutputBufferSize  
  22.     );  
  23.   
  24.     uint _GetMaxMHz()  
  25.     {  
  26.         Type type = typeof(_PROCESSOR_POWER_INFORMATION);  
  27.         int size = Marshal.SizeOf( type);  
  28.         uint cb = (uint)( size * SystemInfo.processorCount; // 也可以使用API:GetSystemInfo中获取的CPU数量,这里的尺寸大小,有几个CPU,就需要申请几个结构体  
  29.       
  30.         System.IntPtr buffer = Marshal.AllocCoTaskMem((int)cb);  
  31.         System.IntPtr nullp = (SystemIntPtr)null;  
  32.         try  
  33.         {  
  34.             int r = CallNtPowerInformation(11,nullp,0,buffer,cb);  
  35.         }  
  36.         catch  
  37.         {  
  38.             Marshal.FreeCoTaskMem(buffer);  
  39.             return 0;  
  40.         }  
  41.   
  42.         byte[] ptr = new byte[size];  
  43.         Marshal.Copy(buffer, ptr, 0, size);  
  44.         Marshal.FreeCoTaskMem(buffer);  
  45.   
  46.         _PROCESSOR_POWER_INFORMATION info = (_PROCESSOR_POWER_INFORMATION)BytesToStrcut(ptr, type);  
  47.         return info.MaxMhz;  
  48.     }  
  49.   
  50.     static object BytesToStruct(byte[] bytes, Type structType)  
  51.     {  
  52.         int size = Marshal.SizeOf(strcutType);  
  53.         System.IntPtr buffer = Marshal.AllocCoTaskMem(size);  
  54.         try  
  55.         {  
  56.             Marshal.Copy( bytes, 0, buffer, size);  
  57.             return Marshal.PtrToStructure(buffer,structType);  
  58.         }  
  59.         finally  
  60.         {  
  61.             Marshal.FreeCoTaskMem(buffer);  
  62.         }  
  63.     }  
  64. }  
千辛万苦走到这步,在Unity Editor中已经可以得到我的CPU主频了: 3000 * 4
然后Build,上网页,一分钟后听到了心碎的声音。。。至于原因,你懂的。

最后的尝试:asm / Unity使用Unsafe代码

好吧,我还有asm那个备选方案没尝试,那就试试吧。
c#使用asm,一定会使用到unsafe code的,所以就有“Unity使用Unsafe代码”这个问题出来了,
在网上找了下,unity使用unsafe code是可行的,一共有两种方法:

1、rsp文件,

具体方法是利用 unity 编译代码的工作流特性。
以c#脚本为例,smcs.exe 是用来编译c#脚本的,unity启动时,会调用各种脚本的编译工具,而smcs.exe则使用名为 smcs.rsp文件作为其自定义编译选项配置文件。
rsp文件里只写一行:-unsafe

可以参考以下回答:

We are improving the documentation on Custom Defines, and it's important to update these threads with the correct way of using them in the current versions of Unity. If you want to modify only global defines, you should use Scripting Define Symbols in Player Settings, because this will cover all the compilers. If you choose the .rsp files instead, you'll have to provide one file for every compiler Unity uses, and you won't know when one or another compiler is used. To do this you must add a text file with the extra directives to the "Assets/" folder:

C# <Project Path>/Assets/smcs.rsp
C# - Editor Scripts <Project Path>/Assets/gmcs.rsp
UnityScript <Project Path>/Assets/us.rsp
Boo <Project Path>/Assets/boo.rsp
As an example, if you include the single line "-define:UNITY_DEBUG" in your smcs.rsp file the define UNITY_DEBUG will exist as a global define for C# scripts, except for Editor scripts. Every time you make changes to .rsp files you will need to recompile for them to be effective. You can do this by updating or reimporting a single script (.js, .cs or .boo) file. All this information is being added to our documentation.

我试了下,在3.5.7f6版本该方法无效,切换平台之后一样无效,但是我看应用这个方法并宣称成功的人在2012年就有了,不知道是我RP问题还是什么。。但是我在4.0的版本测试是通过了。

2、使用UnityEditor提供的 Custom defines方法

参考:http://docs.unity3d.com/Documentation/Manual/PlatformDependentCompilation.html

Custom defines

It is also possible to add to the built-in selection of defines by supplying your own. In theOther Settings panel of thePlayer Settings, you will see the Scripting Define Symbols textbox.

Here, you can enter the names of the symbols you want to define for that particular platform, separated by semicolons. These symbols can then be used as the conditions for#if directives just like the built-in ones. 

这也是4.0才有的功能。


也正是因为做到这一步的尝试后,找到了unity开发人员出来辟谣的帖子,终于选用10个小时前就萌生的那个听上去很井的解析字符串的方案,我走了弯路,你会继续吗?


附录1:NB的C#调用ASM的类

[csharp]  view plain copy
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Text;  
  4. using System.Runtime.InteropServices;  
  5. namespace AsmClassLibrary  
  6. {  
  7.     public class Class1  
  8.     {  
  9.         [DllImport("kernel32.dll", EntryPoint = "CloseHandle")]  
  10.         public static extern int CloseHandle(int hObject);  
  11.         [DllImport("kernel32.dll")]  
  12.         public static extern Int32 WriteProcessMemory(  
  13.             IntPtr hProcess,  
  14.             IntPtr lpBaseAddress,  
  15.             [In, Out] byte[] buffer,  
  16.             int size,  
  17.             out IntPtr lpNumberOfBytesWritten);  
  18.         [DllImport("kernel32.dll")]  
  19.         public static extern Int32 WriteProcessMemory(  
  20.             int hProcess,  
  21.             int lpBaseAddress,  
  22.             byte[] buffer,  
  23.             int size,          
  24.             int lpNumberOfBytesWritten);  
  25.         [DllImport("kernel32", EntryPoint = "CreateRemoteThread")]  
  26.         public static extern int CreateRemoteThread(  
  27.             int hProcess,  
  28.             int lpThreadAttributes,  
  29.             int dwStackSize,  
  30.             int lpStartAddress,  
  31.             int lpParameter,  
  32.             int dwCreationFlags,  
  33.             ref int lpThreadId  
  34.             );  
  35.         [DllImport("Kernel32.dll")]  
  36.         public static extern System.Int32 VirtualAllocEx(  
  37.             System.IntPtr hProcess,  
  38.             System.Int32 lpAddress,  
  39.             System.Int32 dwSize,  
  40.             System.Int16 flAllocationType,  
  41.             System.Int16 flProtect  
  42.             );  
  43.         [DllImport("Kernel32.dll")]  
  44.         public static extern System.Int32 VirtualAllocEx(  
  45.             int hProcess,  
  46.             int lpAddress,  
  47.             int dwSize,  
  48.             int flAllocationType,  
  49.             int flProtect  
  50.             );  
  51.         [DllImport("Kernel32.dll")]  
  52.         public static extern System.Int32 VirtualFreeEx(  
  53.             int hProcess,  
  54.             int lpAddress,  
  55.             int dwSize,  
  56.             int flAllocationType  
  57.             );  
  58.         [DllImport("kernel32.dll", EntryPoint = "OpenProcess")]  
  59.             public static extern int OpenProcess(  
  60.             int dwDesiredAccess,  
  61.             int bInheritHandle,  
  62.             int dwProcessId  
  63.             );  
  64.         private const int PAGE_EXECUTE_READWRITE = 0x4;  
  65.         private const int MEM_COMMIT = 4096;  
  66.         private const int MEM_RELEASE = 0x8000;  
  67.         private const int MEM_DECOMMIT = 0x4000;  
  68.         private const int PROCESS_ALL_ACCESS = 0x1F0FFF;  
  69.         private const int PROCESS_CREATE_THREAD = 0x2;  
  70.         private const int PROCESS_VM_OPERATION = 0x8;  
  71.         private const int PROCESS_VM_WRITE = 0x20;  
  72.         public string Asmcode="";  
  73.         private string hex(int address)  
  74.         {  
  75.             string str = address.ToString("X");  
  76.             return str;  
  77.         }  
  78.         public string intTohex(int value, int num)  
  79.         {  
  80.             string str1;  
  81.            string str2 = "";  
  82.             str1 = "0000000" + this.hex(value);  
  83.             str1 = str1.Substring(str1.Length - num,num);  
  84.             for (int i = 0; i < str1.Length/2; i++)  
  85.             {  
  86.                 str2 = str2 + str1.Substring(str1.Length - 2 - 2 * i, 2);  
  87.             }  
  88.             return str2;  
  89.         }  
  90.         public void SUB_ESP(int addre)  
  91.         {  
  92.             if ((addre <= 127) && (addre >= -128))  
  93.             {  
  94.                 this.Asmcode = this.Asmcode + "83EC" + intTohex(addre, 2);  
  95.             }  
  96.             else  
  97.             {  
  98.                 this.Asmcode = this.Asmcode + "81EC" + intTohex(addre, 8);  
  99.             }  
  100.         }  
  101.                
  102.         public void Nop()  
  103.         {  
  104.             this.Asmcode = this.Asmcode + "90";  
  105.         }  
  106.         public void RetA(int addre)  
  107.         {  
  108.             this.Asmcode = this.Asmcode + intTohex(addre, 4);  
  109.         }  
  110.         public void IN_AL_DX()  
  111.         {  
  112.             this.Asmcode = this.Asmcode + "EC";  
  113.         }  
  114.         public void TEST_EAX_EAX()  
  115.         {  
  116.             this.Asmcode = this.Asmcode + "85C0";  
  117.         }  
  118.         public void Leave()  
  119.         {  
  120.             this.Asmcode = this.Asmcode + "C9";  
  121.         }  
  122.         public void Pushad()  
  123.         {  
  124.             this.Asmcode = this.Asmcode + "60";  
  125.         }  
  126.     public void Popad()  
  127.         {  
  128.             this.Asmcode = this.Asmcode + "61";  
  129.         }  
  130.         public void Ret()  
  131.         {  
  132.             this.Asmcode = this.Asmcode + "C3";  
  133.         }        #region ADD  
  134.         public void Add_EAX_EDX()  
  135.         {  
  136.             this.Asmcode = this.Asmcode + "03C2";  
  137.         }  
  138.         public void Add_EBX_EAX()  
  139.         {  
  140.             this.Asmcode = this.Asmcode + "03D8";  
  141.         }  
  142.         public void Add_EAX_DWORD_Ptr(int addre)  
  143.         {  
  144.             this.Asmcode = this.Asmcode + "0305" + intTohex(addre, 8);  
  145.         }  
  146.         public void Add_EBX_DWORD_Ptr(int addre)  
  147.         {  
  148.             this.Asmcode = this.Asmcode + "031D" + intTohex(addre, 8);  
  149.         }  
  150.         public void Add_EBP_DWORD_Ptr(int addre)  
  151.         {  
  152.             this.Asmcode = this.Asmcode + "032D" + intTohex(addre, 8);  
  153.         }  
  154.         public void Add_EAX(int addre)  
  155.         {  
  156.             this.Asmcode = this.Asmcode + "05" + intTohex(addre, 8);  
  157.         }  
  158.         public void Add_EBX(int addre)  
  159.         {  
  160.             if ((addre <= 127) && (addre >= -128))  
  161.                 this.Asmcode = this.Asmcode + "83C3" + intTohex(addre, 2);  
  162.             else  
  163.                 this.Asmcode = this.Asmcode + "81C3" + intTohex(addre, 8);  
  164.         }  
  165.         public void Add_ECX(int addre)  
  166.         {  
  167.             if ((addre <= 127) && (addre >= -128))  
  168.                 this.Asmcode = this.Asmcode + "83C1" + intTohex(addre, 2);  
  169.             else  
  170.                 this.Asmcode = this.Asmcode + "81C1" + intTohex(addre, 8);  
  171.         }  
  172.         public void Add_EDX(int addre)  
  173.         {  
  174.             if ((addre <= 127) && (addre >= -128))  
  175.                 this.Asmcode = this.Asmcode + "83C2" + intTohex(addre, 2);  
  176.             else  
  177.                 this.Asmcode = this.Asmcode + "81C2" + intTohex(addre, 8);  
  178.         }  
  179.         public void Add_ESI(int addre)  
  180.         {  
  181.             if ((addre <= 127) && (addre >= -128))  
  182.                 this.Asmcode = this.Asmcode + "83C6" + intTohex(addre, 2);  
  183.             else  
  184.                 this.Asmcode = this.Asmcode + "81C6" + intTohex(addre, 8);  
  185.         }  
  186.         public void Add_ESP(int addre)  
  187.         {  
  188.             if ((addre <= 127) && (addre >= -128))  
  189.                 this.Asmcode = this.Asmcode + "83C4" + intTohex(addre, 2);  
  190.             else  
  191.                 this.Asmcode = this.Asmcode + "81C4" + intTohex(addre, 8);  
  192.         }  
  193.         #endregion   
  194.         #region mov  
  195.         public void Mov_DWORD_Ptr_EAX_ADD(int addre, int addre1)  
  196.         {  
  197.             if ((addre <= 127) && (addre >= -128))  
  198.             {  
  199.                 this.Asmcode = this.Asmcode + "C740" + intTohex(addre, 2) + intTohex(addre1, 8);  
  200.             }  
  201.             else  
  202.             {  
  203.                 this.Asmcode = this.Asmcode + "C780" + intTohex(addre, 8) + intTohex(addre1, 8);  
  204.             }  
  205.         }  
  206.         public void Mov_DWORD_Ptr_ESP_ADD(int addre,int addre1)  
  207.         {  
  208.             if ((addre <= 127) && (addre >= -128))  
  209.             {  
  210.                 this.Asmcode = this.Asmcode + "C74424" + intTohex(addre, 2)+intTohex(addre1,8);  
  211.             }  
  212.             else  
  213.             {  
  214.                 this.Asmcode = this.Asmcode + "C78424" + intTohex(addre, 8) + intTohex(addre1, 8);  
  215.             }  
  216.         }  
  217.         public void Mov_DWORD_Ptr_ESP_ADD_EAX(int addre)  
  218.         {  
  219.             if ((addre <= 127) && (addre >= -128))  
  220.             {  
  221.                 this.Asmcode = this.Asmcode + "894424" + intTohex(addre, 2);  
  222.             }  
  223.             else  
  224.             {  
  225.                 this.Asmcode = this.Asmcode + "898424" + intTohex(addre, 8);  
  226.             }  
  227.         }  
  228.         public void Mov_DWORD_Ptr_ESP(int addre)  
  229.         {  
  230.             this.Asmcode = this.Asmcode + "C70424" + intTohex(addre, 8);  
  231.         }  
  232.         public void Mov_DWORD_Ptr_EAX(int addre)  
  233.         {  
  234.             this.Asmcode = this.Asmcode + "A3" + intTohex(addre, 8);  
  235.         }  
  236.         public void Mov_EBX_DWORD_Ptr(int addre)  
  237.         {  
  238.             this.Asmcode = this.Asmcode + "8B1D" + intTohex(addre, 8);  
  239.         }  
  240.         public void Mov_ECX_DWORD_Ptr(int addre)  
  241.         {  
  242.             this.Asmcode = this.Asmcode + "8B0D" + intTohex(addre, 8);  
  243.         }  
  244.         public void Mov_EAX_DWORD_Ptr(int addre)  
  245.         {  
  246.             this.Asmcode = this.Asmcode + "A1" + intTohex(addre, 8);  
  247.         }  
  248.         public void Mov_EDX_DWORD_Ptr(int addre)  
  249.         {  
  250.             this.Asmcode = this.Asmcode + "8B15" + intTohex(addre, 8);  
  251.         }  
  252.         public void Mov_ESI_DWORD_Ptr(int addre)  
  253.         {  
  254.             this.Asmcode = this.Asmcode + "8B35" + intTohex(addre, 8);  
  255.         }  
  256.         public void Mov_ESP_DWORD_Ptr(int addre)  
  257.         {  
  258.             this.Asmcode = this.Asmcode + "8B25" + intTohex(addre, 8);  
  259.         }  
  260.         public void Mov_EBP_DWORD_Ptr(int addre)  
  261.         {  
  262.             this.Asmcode = this.Asmcode + "8B2D" + intTohex(addre, 8);  
  263.         }  
  264.         public void Mov_EAX_DWORD_Ptr_EAX(int addre)  
  265.         {  
  266.             this.Asmcode = this.Asmcode + "8B00";  
  267.         }  
  268.         public void Mov_EAX_DWORD_Ptr_EAX()  
  269.         {  
  270.             this.Asmcode = this.Asmcode + "8B00";  
  271.         }  
  272.         public void Mov_EAX_DWORD_Ptr_EBP()  
  273.         {  
  274.             this.Asmcode = this.Asmcode + "8B4500";  
  275.         }  
  276.         public void Mov_EAX_DWORD_Ptr_EBX()  
  277.         {  
  278.             this.Asmcode = this.Asmcode + "8B03";  
  279.         }  
  280.         public void Mov_EAX_DWORD_Ptr_ECX()  
  281.         {  
  282.             this.Asmcode = this.Asmcode + "8B01";  
  283.         }  
  284.         public void Mov_EAX_DWORD_Ptr_EDX()  
  285.         {  
  286.             this.Asmcode = this.Asmcode + "8B02";  
  287.         }  
  288.         public void Mov_EAX_DWORD_Ptr_EDI()  
  289.         {  
  290.             this.Asmcode = this.Asmcode + "8B07";  
  291.         }  
  292.         public void Mov_EAX_DWORD_Ptr_ESP()  
  293.         {  
  294.             this.Asmcode = this.Asmcode + "8B0424";  
  295.         }  
  296.         public void Mov_EAX_DWORD_Ptr_ESI()  
  297.         {  
  298.             this.Asmcode = this.Asmcode + "8B06";  
  299.         }  
  300.         public void Mov_EAX_DWORD_Ptr_EAX_Add(int addre)  
  301.         {  
  302.             if ((addre <= 127) && (addre >= -128))  
  303.             {  
  304.                 this.Asmcode = this.Asmcode + "8B40" + intTohex(addre, 2);  
  305.             }  
  306.             else  
  307.             {  
  308.                 this.Asmcode = this.Asmcode + "8B80" + intTohex(addre, 8);  
  309.             }  
  310.         }  
  311.         public void Mov_EAX_DWORD_Ptr_ESP_Add(int addre)  
  312.         {  
  313.              if((addre<=127)&&(addre>=-128))  
  314.                 this.Asmcode = this.Asmcode + "8B4424" + intTohex(addre, 2);  
  315.             else  
  316.                 this.Asmcode = this.Asmcode + "8B8424" + intTohex(addre, 8);  
  317.         }  
  318.         public void Mov_EAX_DWORD_Ptr_EBX_Add(int addre)  
  319.         {  
  320.              if((addre<=127)&&(addre>=-128))  
  321.                 this.Asmcode = this.Asmcode + "8B43" + intTohex(addre, 2);  
  322.             else  
  323.                 this.Asmcode = this.Asmcode + "8B83" + intTohex(addre, 8);  
  324.         }  
  325.         public void Mov_EAX_DWORD_Ptr_ECX_Add(int addre)  
  326.         {  
  327.             if ((addre <= 127) && (addre >= -128))  
  328.                 this.Asmcode = this.Asmcode + "8B41" + intTohex(addre, 2);  
  329.             else  
  330.                 this.Asmcode = this.Asmcode + "8B81" + intTohex(addre, 8);  
  331.         }  
  332.         public void Mov_EAX_DWORD_Ptr_EDX_Add(int addre)  
  333.         {  
  334.             if ((addre <= 127) && (addre >= -128))  
  335.                 this.Asmcode = this.Asmcode + "8B42" + intTohex(addre, 2);  
  336.             else  
  337.                 this.Asmcode = this.Asmcode + "8B82" + intTohex(addre, 8);  
  338.         }  
  339.         public void Mov_EAX_DWORD_Ptr_EDI_Add(int addre)  
  340.         {  
  341.             if ((addre <= 127) && (addre >= -128))  
  342.                 this.Asmcode = this.Asmcode + "8B47" + intTohex(addre, 2);  
  343.             else  
  344.                 this.Asmcode = this.Asmcode + "8B87" + intTohex(addre, 8);  
  345.         }  
  346.         public void Mov_EAX_DWORD_Ptr_EBP_Add(int addre)  
  347.         {  
  348.             if ((addre <= 127) && (addre >= -128))  
  349.                 this.Asmcode = this.Asmcode + "8B45" + intTohex(addre, 2);  
  350.             else  
  351.                 this.Asmcode = this.Asmcode + "8B85" + intTohex(addre, 8);  
  352.         }  
  353.         public void Mov_EAX_DWORD_Ptr_ESI_Add(int addre)  
  354.         {  
  355.             if ((addre <= 127) && (addre >= -128))  
  356.                 this.Asmcode = this.Asmcode + "8B46" + intTohex(addre, 2);  
  357.             else  
  358.                 this.Asmcode = this.Asmcode + "8B86" + intTohex(addre, 8);  
  359.         }  
  360.         public void Mov_EBX_DWORD_Ptr_EAX_Add(int addre)  
  361.         {  
  362.             if ((addre <= 127) && (addre >= -128))  
  363.                 this.Asmcode = this.Asmcode + "8B58" + intTohex(addre, 2);  
  364.             else  
  365.                 this.Asmcode = this.Asmcode + "8B98" + intTohex(addre, 8);  
  366.         }  
  367.         public void Mov_EBX_DWORD_Ptr_ESP_Add(int addre)  
  368.         {  
  369.             if ((addre <= 127) && (addre >= -128))  
  370.                 this.Asmcode = this.Asmcode + "8B5C24" + intTohex(addre, 2);  
  371.             else  
  372.                 this.Asmcode = this.Asmcode + "8B9C24" + intTohex(addre, 8);  
  373.         }  
  374.         public void Mov_EBX_DWORD_Ptr_EBX_Add(int addre)  
  375.         {  
  376.             if ((addre <= 127) && (addre >= -128))  
  377.                 this.Asmcode = this.Asmcode + "8B5B" + intTohex(addre, 2);  
  378.             else  
  379.                 this.Asmcode = this.Asmcode + "8B9B" + intTohex(addre, 8);  
  380.         }  
  381.         public void Mov_EBX_DWORD_Ptr_ECX_Add(int addre)  
  382.         {  
  383.             if ((addre <= 127) && (addre >= -128))  
  384.                 this.Asmcode = this.Asmcode + "8B59" + intTohex(addre, 2);  
  385.             else  
  386.                 this.Asmcode = this.Asmcode + "8B99" + intTohex(addre, 8);  
  387.         }  
  388.         public void Mov_EBX_DWORD_Ptr_EDX_Add(int addre)  
  389.         {  
  390.             if ((addre <= 127) && (addre >= -128))  
  391.                 this.Asmcode = this.Asmcode + "8B5A" + intTohex(addre, 2);  
  392.             else  
  393.                 this.Asmcode = this.Asmcode + "8B9A" + intTohex(addre, 8);  
  394.         }  
  395.         public void Mov_EBX_DWORD_Ptr_EDI_Add(int addre)  
  396.         {  
  397.             if ((addre <= 127) && (addre >= -128))  
  398.                 this.Asmcode = this.Asmcode + "8B5F" + intTohex(addre, 2);  
  399.             else  
  400.                 this.Asmcode = this.Asmcode + "8B9F" + intTohex(addre, 8);  
  401.         }  
  402.         public void Mov_EBX_DWORD_Ptr_EBP_Add(int addre)  
  403.         {  
  404.             if ((addre <= 127) && (addre >= -128))  
  405.                 this.Asmcode = this.Asmcode + "8B5D" + intTohex(addre, 2);  
  406.             else  
  407.                 this.Asmcode = this.Asmcode + "8B9D" + intTohex(addre, 8);  
  408.         }  
  409.         public void Mov_EBX_DWORD_Ptr_ESI_Add(int addre)  
  410.         {  
  411.             if ((addre <= 127) && (addre >= -128))  
  412.                 this.Asmcode = this.Asmcode + "8B5E" + intTohex(addre, 2);  
  413.             else  
  414.                 this.Asmcode = this.Asmcode + "8B9E" + intTohex(addre, 8);  
  415.         }  
  416.         public void Mov_ECX_DWORD_Ptr_EAX_Add(int addre)  
  417.         {  
  418.             if ((addre <= 127) && (addre >= -128))  
  419.                 this.Asmcode = this.Asmcode + "8B48" + intTohex(addre, 2);  
  420.             else  
  421.                 this.Asmcode = this.Asmcode + "8B88" + intTohex(addre, 8);  
  422.         }  
  423.         public void Mov_ECX_DWORD_Ptr_ESP_Add(int addre)  
  424.         {  
  425.             if ((addre <= 127) && (addre >= -128))  
  426.                 this.Asmcode = this.Asmcode + "8B4C24" + intTohex(addre, 2);  
  427.             else  
  428.                 this.Asmcode = this.Asmcode + "8B8C24" + intTohex(addre, 8);  
  429.         }  
  430.         public void Mov_ECX_DWORD_Ptr_EBX_Add(int addre)  
  431.         {  
  432.             if ((addre <= 127) && (addre >= -128))  
  433.                 this.Asmcode = this.Asmcode + "8B4B" + intTohex(addre, 2);  
  434.             else  
  435.                 this.Asmcode = this.Asmcode + "8B8B" + intTohex(addre, 8);  
  436.         }  
  437.         public void Mov_ECX_DWORD_Ptr_ECX_Add(int addre)  
  438.         {  
  439.             if ((addre <= 127) && (addre >= -128))  
  440.                 this.Asmcode = this.Asmcode + "8B49" + intTohex(addre, 2);  
  441.             else  
  442.                 this.Asmcode = this.Asmcode + "8B89" + intTohex(addre, 8);  
  443.         }  
  444.         public void Mov_ECX_DWORD_Ptr_EDX_Add(int addre)  
  445.         {  
  446.             if ((addre <= 127) && (addre >= -128))  
  447.                 this.Asmcode = this.Asmcode + "8B4A" + intTohex(addre, 2);  
  448.             else  
  449.                 this.Asmcode = this.Asmcode + "8B8A" + intTohex(addre, 8);  
  450.         }  
  451.         public void Mov_ECX_DWORD_Ptr_EDI_Add(int addre)  
  452.         {  
  453.             if ((addre <= 127) && (addre >= -128))  
  454.                 this.Asmcode = this.Asmcode + "8B4F" + intTohex(addre, 2);  
  455.             else  
  456.                 this.Asmcode = this.Asmcode + "8B8F" + intTohex(addre, 8);  
  457.         }  
  458.         public void Mov_ECX_DWORD_Ptr_EBP_Add(int addre)  
  459.         {  
  460.             if ((addre <= 127) && (addre >= -128))  
  461.                 this.Asmcode = this.Asmcode + "8B4D" + intTohex(addre, 2);  
  462.             else  
  463.                 this.Asmcode = this.Asmcode + "8B8D" + intTohex(addre, 8);  
  464.         }  
  465.         public void Mov_ECX_DWORD_Ptr_ESI_Add(int addre)  
  466.         {  
  467.             if ((addre <= 127) && (addre >= -128))  
  468.                 this.Asmcode = this.Asmcode + "8B4E" + intTohex(addre, 2);  
  469.             else  
  470.                 this.Asmcode = this.Asmcode + "8B8E" + intTohex(addre, 8);  
  471.         }  
  472.         public void Mov_EDX_DWORD_Ptr_EAX_Add(int addre)  
  473.         {  
  474.             if ((addre <= 127) && (addre >= -128))  
  475.                 this.Asmcode = this.Asmcode + "8B50" + intTohex(addre, 2);  
  476.             else  
  477.                 this.Asmcode = this.Asmcode + "8B90" + intTohex(addre, 8);  
  478.         }  
  479.         public void Mov_EDX_DWORD_Ptr_ESP_Add(int addre)  
  480.         {  
  481.             if ((addre <= 127) && (addre >= -128))  
  482.                 this.Asmcode = this.Asmcode + "8B5424" + intTohex(addre, 2);  
  483.             else  
  484.                 this.Asmcode = this.Asmcode + "8B9424" + intTohex(addre, 8);  
  485.         }  
  486.         public void Mov_EDX_DWORD_Ptr_EBX_Add(int addre)  
  487.         {  
  488.             if ((addre <= 127) && (addre >= -128))  
  489.                 this.Asmcode = this.Asmcode + "8B53" + intTohex(addre, 2);  
  490.             else  
  491.                 this.Asmcode = this.Asmcode + "8B93" + intTohex(addre, 8);  
  492.         }  
  493.         public void Mov_EDX_DWORD_Ptr_ECX_Add(int addre)  
  494.         {  
  495.             if ((addre <= 127) && (addre >= -128))  
  496.                 this.Asmcode = this.Asmcode + "8B51" + intTohex(addre, 2);  
  497.             else  
  498.                 this.Asmcode = this.Asmcode + "8B91" + intTohex(addre, 8);  
  499.         }  
  500.         public void Mov_EDX_DWORD_Ptr_EDX_Add(int addre)  
  501.         {  
  502.             if ((addre <= 127) && (addre >= -128))  
  503.                 this.Asmcode = this.Asmcode + "8B52" + intTohex(addre, 2);  
  504.             else  
  505.                 this.Asmcode = this.Asmcode + "8B92" + intTohex(addre, 8);  
  506.         }  
  507.         public void Mov_EDX_DWORD_Ptr_EDI_Add(int addre)  
  508.         {  
  509.             if ((addre <= 127) && (addre >= -128))  
  510.                 this.Asmcode = this.Asmcode + "8B57" + intTohex(addre, 2);  
  511.             else  
  512.                 this.Asmcode = this.Asmcode + "8B97" + intTohex(addre, 8);  
  513.         }  
  514.         public void Mov_EDX_DWORD_Ptr_EBP_Add(int addre)  
  515.         {  
  516.             if ((addre <= 127) && (addre >= -128))  
  517.                 this.Asmcode = this.Asmcode + "8B55" + intTohex(addre, 2);  
  518.             else  
  519.                 this.Asmcode = this.Asmcode + "8B95" + intTohex(addre, 8);  
  520.         }  
  521.         public void Mov_EDX_DWORD_Ptr_ESI_Add(int addre)  
  522.         {  
  523.             if ((addre <= 127) && (addre >= -128))  
  524.                 this.Asmcode = this.Asmcode + "8B56" + intTohex(addre, 2);  
  525.             else  
  526.                 this.Asmcode = this.Asmcode + "8B96" + intTohex(addre, 8);  
  527.         }  
  528.         public void Mov_ECX_EAX()  
  529.         {  
  530.             this.Asmcode = this.Asmcode + "8BC8";  
  531.         }  
  532.         public void Mov_EAX(int addre)  
  533.         {  
  534.             this.Asmcode = this.Asmcode + "B8" + intTohex(addre, 8);  
  535.         }  
  536.         public void Mov_EBX(int addre)  
  537.         {  
  538.             this.Asmcode = this.Asmcode + "BB" + intTohex(addre, 8);  
  539.         }  
  540.         public void Mov_ECX(int addre)  
  541.         {  
  542.             this.Asmcode = this.Asmcode + "B9" + intTohex(addre, 8);  
  543.         }  
  544.         public void Mov_EDX(int addre)  
  545.         {  
  546.             this.Asmcode = this.Asmcode + "BA" + intTohex(addre, 8);  
  547.         }  
  548.         public void Mov_ESI(int addre)  
  549.         {  
  550.             this.Asmcode = this.Asmcode + "BE" + intTohex(addre, 8);  
  551.         }  
  552.         public void Mov_ESP(int addre)  
  553.         {  
  554.             this.Asmcode = this.Asmcode + "BC" + intTohex(addre, 8);  
  555.         }  
  556.         public void Mov_EBP(int addre)  
  557.         {  
  558.             this.Asmcode = this.Asmcode + "BD" + intTohex(addre, 8);  
  559.         }  
  560.         public void Mov_EDI(int addre)  
  561.         {  
  562.             this.Asmcode = this.Asmcode + "BF" + intTohex(addre, 8);  
  563.         }  
  564.         public void Mov_ESI_DWORD_Ptr_EAX()  
  565.         {  
  566.             this.Asmcode = this.Asmcode + "8B7020";  
  567.         }  
  568.         public void Mov_EBX_DWORD_Ptr_EAX()  
  569.         {  
  570.             this.Asmcode = this.Asmcode + "8B18";  
  571.         }  
  572.         public void Mov_EBX_DWORD_Ptr_EBP()  
  573.         {  
  574.             this.Asmcode = this.Asmcode + "8B5D00";  
  575.         }  
  576.         public void Mov_EBX_DWORD_Ptr_EBX()  
  577.         {  
  578.             this.Asmcode = this.Asmcode + "8B1B";  
  579.         }  
  580.         public void Mov_EBX_DWORD_Ptr_ECX()  
  581.         {  
  582.             this.Asmcode = this.Asmcode + "8B19";  
  583.         }  
  584.         public void Mov_EBX_DWORD_Ptr_EDX()  
  585.         {  
  586.             this.Asmcode = this.Asmcode + "8B1A";  
  587.         }  
  588.         public void Mov_EBX_DWORD_Ptr_EDI()  
  589.         {  
  590.             this.Asmcode = this.Asmcode + "8B1F";  
  591.         }  
  592.         public void Mov_EBX_DWORD_Ptr_ESP()  
  593.         {  
  594.             this.Asmcode = this.Asmcode + "8B1C24";  
  595.         }  
  596.         public void Mov_EBX_DWORD_Ptr_ESI()  
  597.         {  
  598.             this.Asmcode = this.Asmcode + "8B1E";  
  599.         }  
  600.     public void Mov_ECX_DWORD_Ptr_EAX()  
  601.         {  
  602.             this.Asmcode = this.Asmcode + "8B08";  
  603.         }  
  604.         public void Mov_ECX_DWORD_Ptr_EBP()  
  605.         {  
  606.             this.Asmcode = this.Asmcode + "8B4D00";  
  607.         }  
  608.         public void Mov_ECX_DWORD_Ptr_EBX()  
  609.         {  
  610.             this.Asmcode = this.Asmcode + "8B0B";  
  611.         }  
  612.         public void Mov_ECX_DWORD_Ptr_ECX()  
  613.         {  
  614.             this.Asmcode = this.Asmcode + "8B09";  
  615.         }  
  616.         public void Mov_ECX_DWORD_Ptr_EDX()  
  617.         {  
  618.             this.Asmcode = this.Asmcode + "8B0A";  
  619.         }  
  620.         public void Mov_ECX_DWORD_Ptr_EDI()  
  621.         {  
  622.             this.Asmcode = this.Asmcode + "8B0F";  
  623.         }  
  624.         public void Mov_ECX_DWORD_Ptr_ESP()  
  625.         {  
  626.             this.Asmcode = this.Asmcode + "8B0C24";  
  627.         }  
  628.         public void Mov_ECX_DWORD_Ptr_ESI()  
  629.         {  
  630.             this.Asmcode = this.Asmcode + "8B0E";  
  631.         }  
  632.         public void Mov_EDX_DWORD_Ptr_EAX()  
  633.         {  
  634.             this.Asmcode = this.Asmcode + "8B10";  
  635.         }  
  636.         public void Mov_EDX_DWORD_Ptr_EBP()  
  637.         {  
  638.             this.Asmcode = this.Asmcode + "8B5500";  
  639.         }  
  640.         public void Mov_EDX_DWORD_Ptr_EBX()  
  641.         {  
  642.             this.Asmcode = this.Asmcode + "8B13";  
  643.         }  
  644.         public void Mov_EDX_DWORD_Ptr_ECX()  
  645.         {  
  646.             this.Asmcode = this.Asmcode + "8B11";  
  647.         }  
  648.         public void Mov_EDX_DWORD_Ptr_EDX()  
  649.         {  
  650.             this.Asmcode = this.Asmcode + "8B12";  
  651.         }  
  652.         public void Mov_EDX_DWORD_Ptr_EDI()  
  653.         {  
  654.             this.Asmcode = this.Asmcode + "8B17";  
  655.         }  
  656.         public void Mov_EDX_DWORD_Ptr_ESI()  
  657.         {  
  658.             this.Asmcode = this.Asmcode + "8B16";  
  659.         }  
  660.         public void Mov_EDX_DWORD_Ptr_ESP()  
  661.         {  
  662.             this.Asmcode = this.Asmcode + "8B1424";  
  663.         }  
  664.         public void Mov_EAX_EBP()  
  665.         {  
  666.             this.Asmcode = this.Asmcode + "8BC5";  
  667.         }  
  668.         public void Mov_EAX_EBX()  
  669.         {  
  670.             this.Asmcode = this.Asmcode + "8BC3";  
  671.         }  
  672.         public void Mov_EAX_ECX()  
  673.         {  
  674.             this.Asmcode = this.Asmcode + "8BC1";  
  675.         }  
  676.         public void Mov_EAX_EDI()  
  677.         {  
  678.             this.Asmcode = this.Asmcode + "8BC7";  
  679.         }  
  680.         public void Mov_EAX_EDX()  
  681.         {  
  682.             this.Asmcode = this.Asmcode + "8BC2";  
  683.         }  
  684.         public void Mov_EAX_ESI()  
  685.         {  
  686.             this.Asmcode = this.Asmcode + "8BC6";  
  687.         }  
  688.         public void Mov_EAX_ESP()  
  689.         {  
  690.             this.Asmcode = this.Asmcode + "8BC4";  
  691.         }  
  692.         public void Mov_EBX_EBP()  
  693.         {  
  694.             this.Asmcode = this.Asmcode + "8BDD";  
  695.         }  
  696.         public void Mov_EBX_EAX()  
  697.         {  
  698.             this.Asmcode = this.Asmcode + "8BD8";  
  699.         }  
  700.         public void Mov_EBX_ECX()  
  701.         {  
  702.             this.Asmcode = this.Asmcode + "8BD9";  
  703.         }  
  704.         public void Mov_EBX_EDI()  
  705.         {  
  706.             this.Asmcode = this.Asmcode + "8BDF";  
  707.         }  
  708.         public void Mov_EBX_EDX()  
  709.         {  
  710.             this.Asmcode = this.Asmcode + "8BDA";  
  711.         }  
  712.         public void Mov_EBX_ESI()  
  713.         {  
  714.             this.Asmcode = this.Asmcode + "8BDE";  
  715.         }  
  716.         public void Mov_EBX_ESP()  
  717.         {  
  718.             this.Asmcode = this.Asmcode + "8BDC";  
  719.         }  
  720.         public void Mov_ECX_EBP()  
  721.         {  
  722.             this.Asmcode = this.Asmcode + "8BCD";  
  723.         }  
  724.        /* public void Mov_ECX_EAX() 
  725.         { 
  726.             this.Asmcode = this.Asmcode + "8BC8"; 
  727.         }*/  
  728.         public void Mov_ECX_EBX()  
  729.         {  
  730.             this.Asmcode = this.Asmcode + "8BCB";  
  731.         }  
  732.         public void Mov_ECX_EDI()  
  733.         {  
  734.             this.Asmcode = this.Asmcode + "8BCF";  
  735.         }  
  736.         public void Mov_ECX_EDX()  
  737.         {  
  738.             this.Asmcode = this.Asmcode + "8BCA";  
  739.         }  
  740.         public void Mov_ECX_ESI()  
  741.         {  
  742.             this.Asmcode = this.Asmcode + "8BCE";  
  743.         }  
  744.         public void Mov_ECX_ESP()  
  745.         {  
  746.             this.Asmcode = this.Asmcode + "8BCC";  
  747.         }  
  748.         public void Mov_EDX_EBP()  
  749.         {  
  750.             this.Asmcode = this.Asmcode + "8BD5";  
  751.         }  
  752.         public void Mov_EDX_EBX()  
  753.         {  
  754.             this.Asmcode = this.Asmcode + "8BD3";  
  755.         }  
  756.         public void Mov_EDX_ECX()  
  757.         {  
  758.             this.Asmcode = this.Asmcode + "8BD1";  
  759.         }  
  760.         public void Mov_EDX_EDI()  
  761.         {  
  762.             this.Asmcode = this.Asmcode + "8BD7";  
  763.         }  
  764.         public void Mov_EDX_EAX()  
  765.         {  
  766.             this.Asmcode = this.Asmcode + "8BD0";  
  767.         }  
  768.         public void Mov_EDX_ESI()  
  769.         {  
  770.             this.Asmcode = this.Asmcode + "8BD6";  
  771.         }  
  772.         public void Mov_EDX_ESP()  
  773.         {  
  774.             this.Asmcode = this.Asmcode + "8BD4";  
  775.         }  
  776.         public void Mov_ESI_EBP()  
  777.         {  
  778.             this.Asmcode = this.Asmcode + "8BF5";  
  779.         }  
  780.         public void Mov_ESI_EBX()  
  781.         {  
  782.             this.Asmcode = this.Asmcode + "8BF3";  
  783.         }  
  784.         public void Mov_ESI_ECX()  
  785.         {  
  786.             this.Asmcode = this.Asmcode + "8BF1";  
  787.         }  
  788.         public void Mov_ESI_EDI()  
  789.         {  
  790.             this.Asmcode = this.Asmcode + "8BF7";  
  791.         }  
  792.         public void Mov_ESI_EAX()  
  793.         {  
  794.             this.Asmcode = this.Asmcode + "8BF0";  
  795.         }  
  796.         public void Mov_ESI_EDX()  
  797.         {  
  798.             this.Asmcode = this.Asmcode + "8BF2";  
  799.         }  
  800.         public void Mov_ESI_ESP()  
  801.         {  
  802.             this.Asmcode = this.Asmcode + "8BF4";  
  803.         }  
  804.         public void Mov_ESP_EBP()  
  805.         {  
  806.             this.Asmcode = this.Asmcode + "8BE5";  
  807.         }  
  808.         public void Mov_ESP_EBX()  
  809.         {  
  810.             this.Asmcode = this.Asmcode + "8BE3";  
  811.         }  
  812.         public void Mov_ESP_ECX()  
  813.         {  
  814.             this.Asmcode = this.Asmcode + "8BE1";  
  815.         }  
  816.         public void Mov_ESP_EDI()  
  817.         {  
  818.             this.Asmcode = this.Asmcode + "8BE7";  
  819.         }  
  820.         public void Mov_ESP_EAX()  
  821.         {  
  822.             this.Asmcode = this.Asmcode + "8BE0";  
  823.         }  
  824.         public void Mov_ESP_EDX()  
  825.         {  
  826.             this.Asmcode = this.Asmcode + "8BE2";  
  827.         }  
  828.         public void Mov_ESP_ESI()  
  829.         {  
  830.             this.Asmcode = this.Asmcode + "8BE6";  
  831.         }  
  832.         public void Mov_EDI_EBP()  
  833.         {  
  834.             this.Asmcode = this.Asmcode + "8BFD";  
  835.         }  
  836.         public void Mov_EDI_EAX()  
  837.         {  
  838.             this.Asmcode = this.Asmcode + "8BF8";  
  839.         }  
  840.         public void Mov_EDI_EBX()  
  841.         {  
  842.             this.Asmcode = this.Asmcode + "8BFB";  
  843.         }  
  844.         public void Mov_EDI_ECX()  
  845.         {  
  846.             this.Asmcode = this.Asmcode + "8BF9";  
  847.         }  
  848.         public void Mov_EDI_EDX()  
  849.         {  
  850.             this.Asmcode = this.Asmcode + "8BFA";  
  851.         }  
  852.         public void Mov_EDI_ESI()  
  853.         {  
  854.             this.Asmcode = this.Asmcode + "8BFE";  
  855.         }  
  856.         public void Mov_EDI_ESP()  
  857.         {  
  858.             this.Asmcode = this.Asmcode + "8BFC";  
  859.         }  
  860.         public void Mov_EBP_EDI()  
  861.         {  
  862.             this.Asmcode = this.Asmcode + "8BDF";  
  863.         }  
  864.         public void Mov_EBP_EAX()  
  865.         {  
  866.             this.Asmcode = this.Asmcode + "8BE8";  
  867.         }  
  868.         public void Mov_EBP_EBX()  
  869.         {  
  870.             this.Asmcode = this.Asmcode + "8BEB";  
  871.         }  
  872.         public void Mov_EBP_ECX()  
  873.         {  
  874.             this.Asmcode = this.Asmcode + "8BE9";  
  875.         }  
  876.         public void Mov_EBP_EDX()  
  877.         {  
  878.             this.Asmcode = this.Asmcode + "8BEA";  
  879.         }  
  880.         public void Mov_EBP_ESI()  
  881.         {  
  882.             this.Asmcode = this.Asmcode + "8BEE";  
  883.         }  
  884.         public void Mov_EBP_ESP()  
  885.         {  
  886.             this.Asmcode = this.Asmcode + "8BEC";  
  887.         }  
  888.         #endregion  
  889.         #region Push  
  890.         public void Push68(int addre)  
  891.         {  
  892.             this.Asmcode = this.Asmcode + "68" + intTohex(addre, 8);  
  893.              
  894.         }  
  895.         public void Push6A(int addre)  
  896.         {  
  897.             this.Asmcode = this.Asmcode + "6A" + intTohex(addre, 2);  
  898.         }  
  899.         public void Push_EAX()  
  900.         {  
  901.             this.Asmcode = this.Asmcode + "50";  
  902.         }  
  903.         public void Push_DWORD_Ptr(int addre)  
  904.         {  
  905.             this.Asmcode = this.Asmcode + "FF35" + intTohex(addre, 8);  
  906.         }  
  907.         public void Push_ECX()  
  908.         {  
  909.             this.Asmcode = this.Asmcode +"51";  
  910.         }  
  911.         public void Push_EDX()  
  912.         {  
  913.             this.Asmcode = this.Asmcode + "52";  
  914.         }  
  915.         public void Push_EBX()  
  916.         {  
  917.             this.Asmcode = this.Asmcode + "53";  
  918.         }  
  919.         public void Push_ESP()  
  920.         {  
  921.             this.Asmcode = this.Asmcode + "54";  
  922.         }  
  923.         public void Push_EBP()  
  924.         {  
  925.             this.Asmcode = this.Asmcode + "55";  
  926.         }  
  927.         public void Push_ESI()  
  928.         {  
  929.             this.Asmcode = this.Asmcode + "56";  
  930.         }  
  931.         public void Push_EDI()  
  932.         {  
  933.             this.Asmcode = this.Asmcode + "57";  
  934.         }  
  935.         #endregion  
  936.         #region Call  
  937.         public void Call_EAX()  
  938.         {  
  939.             this.Asmcode = this.Asmcode + "FFD0";  
  940.         }  
  941.         public void Call_EBX()  
  942.         {  
  943.             this.Asmcode = this.Asmcode + "FFD3";  
  944.         }  
  945.         public void Call_ECX()  
  946.         {  
  947.             this.Asmcode = this.Asmcode + "FFD1";  
  948.         }  
  949.         public void Call_EDX()  
  950.         {  
  951.             this.Asmcode = this.Asmcode + "FFD2";  
  952.         }  
  953.         public void Call_ESI()  
  954.         {  
  955.             this.Asmcode = this.Asmcode + "FFD2";  
  956.         }  
  957.         public void Call_ESP()  
  958.         {  
  959.             this.Asmcode = this.Asmcode + "FFD4";  
  960.         }  
  961.         public void Call_EBP()  
  962.         {  
  963.             this.Asmcode = this.Asmcode + "FFD5";  
  964.         }  
  965.         public void Call_EDI()  
  966.         {  
  967.             this.Asmcode = this.Asmcode + "FFD7";  
  968.         }  
  969.         public void Call_DWORD_Ptr(int addre)  
  970.         {  
  971.             this.Asmcode = this.Asmcode + "FF15" + intTohex(addre, 8);  
  972.         }  
  973.         public void Call_DWORD_Ptr_EAX()  
  974.         {  
  975.             this.Asmcode = this.Asmcode + "FF10";  
  976.         }  
  977.         public void Call_DWORD_Ptr_EBX()  
  978.         {  
  979.             this.Asmcode = this.Asmcode + "FF13";  
  980.         }  
  981.         #endregion  
  982.         #region Lea  
  983.         public void Lea_EAX_DWORD_Ptr_EAX_Add(int addre)  
  984.         {  
  985.             if ((addre <= 127) && (addre >= -128))  
  986.                 this.Asmcode = this.Asmcode + "8D40" + intTohex(addre, 2);  
  987.             else  
  988.                 this.Asmcode = this.Asmcode + "8D80" + intTohex(addre, 8);  
  989.         }  
  990.         public void Lea_EAX_DWORD_Ptr_EBX_Add(int addre)  
  991.         {  
  992.             if ((addre <= 127) && (addre >= -128))  
  993.                 this.Asmcode = this.Asmcode + "8D43" + intTohex(addre, 2);  
  994.             else  
  995.                 this.Asmcode = this.Asmcode + "8D83" + intTohex(addre, 8);  
  996.         }  
  997.         public void Lea_EAX_DWORD_Ptr_ECX_Add(int addre)  
  998.         {  
  999.             if ((addre <= 127) && (addre >= -128))  
  1000.                 this.Asmcode = this.Asmcode + "8D41" + intTohex(addre, 2);  
  1001.             else  
  1002.                 this.Asmcode = this.Asmcode + "8D81" + intTohex(addre, 8);  
  1003.         }  
  1004.         public void Lea_EAX_DWORD_Ptr_EDX_Add(int addre)  
  1005.         {  
  1006.             if ((addre <= 127) && (addre >= -128))  
  1007.                 this.Asmcode = this.Asmcode + "8D42" + intTohex(addre, 2);  
  1008.             else  
  1009.                 this.Asmcode = this.Asmcode + "8D82" + intTohex(addre, 8);  
  1010.         }  
  1011.         public void Lea_EAX_DWORD_Ptr_ESI_Add(int addre)  
  1012.         {  
  1013.             if ((addre <= 127) && (addre >= -128))  
  1014.                 this.Asmcode = this.Asmcode + "8D46" + intTohex(addre, 2);  
  1015.             else  
  1016.                 this.Asmcode = this.Asmcode + "8D86" + intTohex(addre, 8);  
  1017.         }  
  1018.         public void Lea_EAX_DWORD_Ptr_ESP_Add(int addre)  
  1019.         {  
  1020.             if ((addre <= 127) && (addre >= -128))  
  1021.                 this.Asmcode = this.Asmcode + "8D40" + intTohex(addre, 2);  
  1022.             else  
  1023.                 this.Asmcode = this.Asmcode + "8D80" + intTohex(addre, 8);  
  1024.         }  
  1025.         public void Lea_EAX_DWORD_Ptr_EBP_Add(int addre)  
  1026.         {  
  1027.             if ((addre <= 127) && (addre >= -128))  
  1028.                 this.Asmcode = this.Asmcode + "8D4424" + intTohex(addre, 2);  
  1029.             else  
  1030.                 this.Asmcode = this.Asmcode + "8D8424" + intTohex(addre, 8);  
  1031.         }  
  1032.         public void Lea_EAX_DWORD_Ptr_EDI_Add(int addre)  
  1033.         {  
  1034.             if ((addre <= 127) && (addre >= -128))  
  1035.                 this.Asmcode = this.Asmcode + "8D47" + intTohex(addre, 2);  
  1036.             else  
  1037.                 this.Asmcode = this.Asmcode + "8D87" + intTohex(addre, 8);  
  1038.         }  
  1039.         public void Lea_EBX_DWORD_Ptr_EAX_Add(int addre)  
  1040.         {  
  1041.             if ((addre <= 127) && (addre >= -128))  
  1042.                 this.Asmcode = this.Asmcode + "8D58" + intTohex(addre, 2);  
  1043.             else  
  1044.                 this.Asmcode = this.Asmcode + "8D98" + intTohex(addre, 8);  
  1045.         }  
  1046.         public void Lea_EBX_DWORD_Ptr_ESP_Add(int addre)  
  1047.         {  
  1048.             if ((addre <= 127) && (addre >= -128))  
  1049.                 this.Asmcode = this.Asmcode + "8D5C24" + intTohex(addre, 2);  
  1050.             else  
  1051.                 this.Asmcode = this.Asmcode + "8D9C24" + intTohex(addre, 8);  
  1052.         }  
  1053.         public void Lea_EBX_DWORD_Ptr_EBX_Add(int addre)  
  1054.         {  
  1055.             if ((addre <= 127) && (addre >= -128))  
  1056.                 this.Asmcode = this.Asmcode + "8D5B" + intTohex(addre, 2);  
  1057.             else  
  1058.                 this.Asmcode = this.Asmcode + "8D9B" + intTohex(addre, 8);  
  1059.         }  
  1060.         public void Lea_EBX_DWORD_Ptr_ECX_Add(int addre)  
  1061.         {  
  1062.             if ((addre <= 127) && (addre >= -128))  
  1063.                 this.Asmcode = this.Asmcode + "8D59" + intTohex(addre, 2);  
  1064.             else  
  1065.                 this.Asmcode = this.Asmcode + "8D99" + intTohex(addre, 8);  
  1066.         }  
  1067.         public void Lea_EBX_DWORD_Ptr_EDX_Add(int addre)  
  1068.         {  
  1069.             if ((addre <= 127) && (addre >= -128))  
  1070.                 this.Asmcode = this.Asmcode + "8D5A" + intTohex(addre, 2);  
  1071.             else  
  1072.                 this.Asmcode = this.Asmcode + "8D9A" + intTohex(addre, 8);  
  1073.         }  
  1074.         public void Lea_EBX_DWORD_Ptr_EDI_Add(int addre)  
  1075.         {  
  1076.             if ((addre <= 127) && (addre >= -128))  
  1077.                 this.Asmcode = this.Asmcode + "8D5F" + intTohex(addre, 2);  
  1078.             else  
  1079.                 this.Asmcode = this.Asmcode + "8D9F" + intTohex(addre, 8);  
  1080.         }  
  1081.         public void Lea_EBX_DWORD_Ptr_EBP_Add(int addre)  
  1082.         {  
  1083.             if((addre<=127)&&(addre>=-128))  
  1084.                 this.Asmcode = this.Asmcode + "8D5D" + intTohex(addre, 2);  
  1085.             else  
  1086.                 this.Asmcode = this.Asmcode + "8D9D" + intTohex(addre, 8);  
  1087.         }  
  1088.         public void Lea_EBX_DWORD_Ptr_ESI_Add(int addre)  
  1089.         {  
  1090.             if ((addre <= 127) && (addre >= -128))  
  1091.                 this.Asmcode = this.Asmcode + "8D5E" + intTohex(addre, 2);  
  1092.             else  
  1093.                 this.Asmcode = this.Asmcode + "8D9E" + intTohex(addre, 8);  
  1094.         }  
  1095.         public void Lea_ECX_DWORD_Ptr_EAX_Add(int addre)  
  1096.         {  
  1097.             if ((addre <= 127) && (addre >= -128))  
  1098.                 this.Asmcode = this.Asmcode + "8D48" + intTohex(addre, 2);  
  1099.             else  
  1100.                 this.Asmcode = this.Asmcode + "8D88" + intTohex(addre, 8);  
  1101.         }  
  1102.         public void Lea_ECX_DWORD_Ptr_ESP_Add(int addre)  
  1103.         {  
  1104.             if ((addre <= 127) && (addre >= -128))  
  1105.                 this.Asmcode = this.Asmcode + "8D4C24" + intTohex(addre, 2);  
  1106.             else  
  1107.                 this.Asmcode = this.Asmcode + "8D8C24" + intTohex(addre, 8);  
  1108.         }  
  1109.         public void Lea_ECX_DWORD_Ptr_EBX_Add(int addre)  
  1110.         {  
  1111.             if ((addre <= 127) && (addre >= -128))  
  1112.                 this.Asmcode = this.Asmcode + "8D4B" + intTohex(addre, 2);  
  1113.             else  
  1114.                 this.Asmcode = this.Asmcode + 

你可能感兴趣的:(Unity3D-WebPlayer上获取机器性能相关的尝试)