官方网址:http://www.9rays.net/
未破解前,会有45天的试用期限制。超其以后运行时会有异常:“9Rays.Net FlyTreeView for ASP.NET 2.0 evaluation period has
expired.”
破解工具:ildasm,ilasm,StrongNameRemove20, UEdit, Reflector(个人习惯使用,这个随便了) [注] ildasm[vs2003版]可以到看雪下载
修改版,原版的有限制
这个DLL的破解的关键是让它永不过期或者修改一个足够大的时间值让我们使用就可以了,网上有破解的就是直接修改它的过期期限,使用
用户可以使用的期限加长,达到破解。在本例中,我使用的是直接把过期异常干掉,使得永不过期。
1. 用ildasm打开NineRays.WebControls.FlyTreeView.dll,转存为aaa.il;
2. 找到用UEdit打开aaa.il,并找到"has expired",来到如下的代码处理
// 为了便于分析,我把reflactor的反编译代码贴出来
public FlyTreeView()
{
this.NodeEvents = new List<FlyTreeNodeEventArgs>();
DateTime maxValue = DateTime.MaxValue;
// 当然这个异常我们也可以去掉,但在本次过程中,我们主要去掉下面那个过期的异常部分
try
{
maxValue = File.GetLastWriteTime(base.GetType().Assembly.Location);
}
catch
{
throw new Exception("Unknown TRIAL version error has occurred."
![](http://www.unpack.cn/images/smilies/default/wink.gif)
}
// 我们最关心的是过期的异常,所以这个异常是关键部分
if (maxValue < DateTime.Now.AddDays(-45))
{
throw new Exception("9Rays.Net FlyTreeView for ASP.NET 2.0 evaluation period has expired."
![](http://www.unpack.cn/images/smilies/default/wink.gif)
}
this._flyControlCommon = new FlyControlCommon<FlyTreeView>(this, this.ViewState, this.Context);
this._dataBindings = new FlyNodeBindingCollection();
this._nodes = new FlyTreeNodeCollection(this);
this._nodeTypes = new FlyNodeTypeCollection();
this.ShadowNodes = new FlyTreeNodeCollection(this);
}
看了反编译的代码,简单一点儿,我们只要把
if (maxValue < DateTime.Now.AddDays(-45))
{
throw new Exception("9Rays.Net FlyTreeView for ASP.NET 2.0 evaluation period has expired."
![](http://www.unpack.cn/images/smilies/default/wink.gif)
}
这段代码干掉就可以了啊?当然,我们也可以把
try
{
maxValue = File.GetLastWriteTime(base.GetType().Assembly.Location);
}
catch
{
throw new Exception("Unknown TRIAL version error has occurred."
![](http://www.unpack.cn/images/smilies/default/wink.gif)
}
这段代码也干掉,呵呵。
那我们就开始吧,
下面我们结合反编译代码对下面的程序进行分析,并去掉关键的异常代码部分
// 源代码如下
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// 代码大小 173 (0xad)
.maxstack 5
.locals init (valuetype [mscorlib]System.DateTime V_0,
string V_1,
valuetype [mscorlib]System.DateTime V_2)
//*** this.NodeEvents = new List<FlyTreeNodeEventArgs>(); 对应的IL代码开始 ***//
IL_0000: ldarg.0
IL_0001: newobj instance void class [mscorlib]System.Collections.Generic.List`1<class
NineRays.WebControls.FlyTreeNodeEventArgs>::.ctor()
IL_0006: stfld class [mscorlib]System.Collections.Generic.List`1<class NineRays.WebControls.FlyTreeNodeEventArgs>
NineRays.WebControls.FlyTreeView::NodeEvents
//*** this.NodeEvents = new List<FlyTreeNodeEventArgs>(); 对应的IL代码结束 ***//
//**************** 获取最大的时间值,并保存到本地变量maxValue里对应IL就是V_0
//*** DateTime maxValue = DateTime.MaxValue; 对应的IL代码开始 ***//
IL_000b: ldarg.0
IL_000c: call instance void [System.Web]System.Web.UI.WebControls.HierarchicalDataBoundControl::.ctor()
IL_0011: ldsfld valuetype [mscorlib]System.DateTime [mscorlib]System.DateTime::MaxValue
IL_0016: stloc.0
//*** DateTime maxValue = DateTime.MaxValue; 对应的IL代码结束 ***//
// ************************************ 第一个异常的代码对应 开始 ***********************************//
//************ 取文件的最后修改时间值,正常的话保存到本地变量maxValue里对应IL就是V_0,如果错误,则异常
* reflector反编译代码
* try
* {
* maxValue = File.GetLastWriteTime(base.GetType().Assembly.Location);
* }
* catch
* {
* throw new Exception("Unknown TRIAL version error has occurred."
![](http://www.unpack.cn/images/smilies/default/wink.gif)
* }
* 对应的IL 代码
.try
{
IL_0017: ldarg.0
IL_0018: call instance class [mscorlib]System.Type [mscorlib]System.Object::GetType()
IL_001d: callvirt instance class [mscorlib]System.Reflection.Assembly [mscorlib]System.Type::get_Assembly()
IL_0022: callvirt instance string [mscorlib]System.Reflection.Assembly::get_Location()
IL_0027: stloc.1
IL_0028: ldloc.1
IL_0029: call valuetype [mscorlib]System.DateTime [mscorlib]System.IO.File::GetLastWriteTime(string)
IL_002e: stloc.0
IL_002f: leave.s IL_003d
} // end .try
catch [mscorlib]System.Object
{
IL_0031: pop
IL_0032: ldstr "Unknown TRIAL version error has occurred."
IL_0037: newobj instance void [mscorlib]System.Exception::.ctor(string)
IL_003c: throw
} // end handler
// ************************************ 第一个异常的代码对应 结束 ***********************************//
// ************************************* 第二个异常的代码对应 开始 ***********************************//
//************ maxValue跟当前时间-45天相比较,如果在试用期内,则正常,不在试用期内,则异常
* reflector反编译代码
* if (maxValue < DateTime.Now.AddDays(-45))
* {
* throw new Exception("9Rays.Net FlyTreeView for ASP.NET 2.0 evaluation period has expired."
![](http://www.unpack.cn/images/smilies/default/wink.gif)
* }
* IL 代码开始
// ******** 这里开始是判断当前时间与文件创建时间的比较,如果在试用期内,则正常试用,否则则抛出过期的异常
IL_003d: ldloc.0
IL_003e: call valuetype [mscorlib]System.DateTime [mscorlib]System.DateTime::get_Now()
IL_0043: stloc.2
IL_0044: ldloca.s V_2
IL_0046: ldc.r8 -45.
IL_004f: call instance valuetype [mscorlib]System.DateTime [mscorlib]System.DateTime::AddDays(float64)
IL_0054: call bool [mscorlib]System.DateTime:
![](http://www.unpack.cn/images/smilies/default/13.gif)
valuetype [mscorlib]System.DateTime)
IL_0059: brfalse.s IL_0066 // 如果没超出试用期,则跳转,否则抛异常
// 我们的思路,不管是否超出试用期都不让它抛出异常,那么我们最简单的方法,就是把抛异常的代码段干掉
// 那我们还等什么呀,直接把下面的关键部分代码注释掉不就行了吗,呵呵:) 是不是很Easy的啊
//************************* 关键位置开始 ^_^ *******************************************************//
//IL_005b: ldstr "9Rays.Net FlyTreeView for ASP.NET 2.0 evaluation p"
//+ "eriod has expired." // 查找到的位置***************************
//IL_0060: newobj instance void [mscorlib]System.Exception::.ctor(string)
//IL_0065: throw
//************************* 关键位置结束 ^_^ *******************************************************//
// ************************************* 其他类域的初始化代码 开始 ***********************************//
* reflector反编译代码
* this._flyControlCommon = new FlyControlCommon<FlyTreeView>(this, this.ViewState, this.Context);
* this._dataBindings = new FlyNodeBindingCollection();
* this._nodes = new FlyTreeNodeCollection(this);
* this._nodeTypes = new FlyNodeTypeCollection();
* this.ShadowNodes = new FlyTreeNodeCollection(this);
* IL 代码开始
IL_0066: ldarg.0
IL_0067: ldarg.0
IL_0068: ldarg.0
IL_0069: callvirt instance class [System.Web]System.Web.UI.StateBag [System.Web]System.Web.UI.Control::get_ViewState()
IL_006e: ldarg.0
IL_006f: callvirt instance class [System.Web]System.Web.HttpContext [System.Web]System.Web.UI.Control::get_Context()
IL_0074: newobj instance void class NineRays.WebControls.FlyControlCommon`1<class
NineRays.WebControls.FlyTreeView>::.ctor(!0,
class [System.Web]System.Web.UI.StateBag,
class [System.Web]System.Web.HttpContext)
IL_0079: stfld class NineRays.WebControls.FlyControlCommon`1<class NineRays.WebControls.FlyTreeView>
NineRays.WebControls.FlyTreeView::_flyControlCommon
IL_007e: ldarg.0
IL_007f: newobj instance void NineRays.WebControls.FlyNodeBindingCollection::.ctor()
IL_0084: stfld class NineRays.WebControls.FlyNodeBindingCollection NineRays.WebControls.FlyTreeView::_dataBindings
IL_0089: ldarg.0
IL_008a: ldarg.0
IL_008b: newobj instance void NineRays.WebControls.FlyTreeNodeCollection::.ctor(object)
IL_0090: stfld class NineRays.WebControls.FlyTreeNodeCollection NineRays.WebControls.FlyTreeView::_nodes
IL_0095: ldarg.0
IL_0096: newobj instance void NineRays.WebControls.FlyNodeTypeCollection::.ctor()
IL_009b: stfld class NineRays.WebControls.FlyNodeTypeCollection NineRays.WebControls.FlyTreeView::_nodeTypes
IL_00a0: ldarg.0
IL_00a1: ldarg.0
IL_00a2: newobj instance void NineRays.WebControls.FlyTreeNodeCollection::.ctor(object)
IL_00a7: stfld class NineRays.WebControls.FlyTreeNodeCollection NineRays.WebControls.FlyTreeView::ShadowNodes
// ************************************* 其他类域的初始化代码 结束 ***********************************//
IL_00ac: ret
} // end of method FlyTreeView::.ctor
3. 别忘了看一下文件开头有没有加publickey,还真的有呀,我这里找到如下的代码
.publickey = (00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 // .$..............
00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 // .$..RSA1........
EB FD B1 7F 49 35 9E C0 95 39 EE 11 CD D2 30 A3 // ....I5...9....0.
72 D3 A0 72 DD 10 42 86 EA 59 60 AB 5F C4 3F 7F // r..r..B..Y`._.?.
09 A7 6C 5E FA D0 54 FF B9 B7 12 C6 13 DD 6D C3 // ..l^..T.......m.
D3 5B E4 90 76 EC CC 92 CD B0 7E 9B 22 A5 A4 71 // .[..v.....~."..q
D0 EA 1A EE 0D 6B BE 82 55 D6 7E B2 7F B1 32 DB // .....k..U.~...2.
50 5B F7 50 07 19 91 59 22 BF FB 82 A9 0B F7 DE // P[.P...Y".......
87 36 F9 6C 19 CA D9 63 55 63 78 44 C6 33 6C 55 // .6.l...cUcxD.3lU
39 00 7B 0A 89 8E C2 C5 8E 4A 52 C2 8E 23 37 B3 ) // 9.{......JR..#7.
.hash algorithm 0x00008004
还在想什么呢?直接删除呀,嘿嘿
![](http://www.unpack.cn/images/smilies/default/icon8.gif)
4. 到现在破解就完工了,可以编译新的程序了。ilasm /dll /resource=aaa.res aaa.il,得到的aaa.dll即为完美破解版了。
顺便说一句,使用的时候,最好先安装原版,再把破解版覆盖,就好了
如果感觉好用,请支持正版