Red Gate的系列产品真是相当出色,从ANTS Profiler到现在正在用得不易乐乎的SQL Toolbelt工具集都是开发者手中不可多得的利器,但近日工作繁忙,都没有什么时间研究它,但眼看试用期即将过去,一时间又提不出不能让公司购买的理由,所以只好先延长它的试用期吧,只是暂时延长作研究,大家不要做非法用途哦 ^_^
到网上查了一些大大的文章,很多早期的方法是修改RedGate.Licensing.Client.dll中的get_Activated()方法来达到,但经过部分大大的试验有些组件用这个方法会导致某些功能缺损,所以只可以用比较迂回的方法,直接改试用期的期限。
方法是修改两个属性,DaysLeftInTrial和TrialStatus,主要是让DaysLeftInTrial的返回值永远大于0。
1.DaysLeftInTrial
修改后的代码:
对应的IL:
.method public hidebysig specialname instance int32 get_DaysLeftInTrial() cil managed { // 代码大小 95 (0x5f) .maxstack 12 .locals init (int32 V_0, valuetype [mscorlib]System.TimeSpan V_1, valuetype [mscorlib]System.DateTime V_2, valuetype [mscorlib]System.TimeSpan V_3) IL_0000: ldarg.0 IL_0001: call instance valuetype RedGate.Licensing.Client.TrialStatus RedGate.Licensing.Client.Licence::get_TrialStatus() IL_0006: ldc.i4.1 IL_0007: beq.s IL_000b IL_0009: ldc.i4.0 IL_000a: ret IL_000b: ldarg.0 IL_000c: ldfld valuetype [mscorlib]System.DateTime RedGate.Licensing.Client.Licence::d IL_0011: ldsfld valuetype [mscorlib]System.DateTime [mscorlib]System.DateTime::MinValue IL_0016: call bool [mscorlib]System.DateTime::op_Equality(valuetype [mscorlib]System.DateTime, valuetype [mscorlib]System.DateTime) IL_001b: brfalse.s IL_003e IL_001d: call valuetype [mscorlib]System.DateTime [mscorlib]System.DateTime::get_UtcNow() IL_0022: stloc.2 IL_0023: ldloca.s V_2 IL_0025: ldarg.0 IL_0026: ldfld valuetype [mscorlib]System.DateTime RedGate.Licensing.Client.Licence::b IL_002b: call instance valuetype [mscorlib]System.TimeSpan [mscorlib]System.DateTime::Subtract(valuetype [mscorlib]System.DateTime) IL_0030: stloc.1 IL_0031: ldc.i4.s 14 IL_0033: ldloca.s V_1 IL_0035: call instance int32 [mscorlib]System.TimeSpan::get_Days() IL_003a: sub IL_003b: stloc.0 IL_003c: br.s IL_0057 IL_003e: ldarg.0 IL_003f: ldflda valuetype [mscorlib]System.DateTime RedGate.Licensing.Client.Licence::d IL_0044: call valuetype [mscorlib]System.DateTime [mscorlib]System.DateTime::get_UtcNow() IL_0049: call instance valuetype [mscorlib]System.TimeSpan [mscorlib]System.DateTime::Subtract(valuetype [mscorlib]System.DateTime) IL_004e: stloc.3 IL_004f: ldloca.s V_3 IL_0051: call instance int32 [mscorlib]System.TimeSpan::get_Days() IL_0056: stloc.0 IL_0057: ldloc.0 IL_0058: ldc.i4 0x457 IL_0059: bge.s IL_005d IL_005b: ldc.i4.8 IL_005c: stloc.0 IL_005d: ldloc.0 IL_005e: ret } // end of method Licence::get_DaysLeftInTrial
2.TrialStatus
修改后的代码:
对应的IL:
.method public hidebysig specialname instance valuetype RedGate.Licensing.Client.TrialStatus get_TrialStatus() cil managed { // 代码大小 6 (0x6) .maxstack 1 .locals (valuetype RedGate.Licensing.Client.TrialStatus V_0) IL_0000: ldc.i4.1 IL_0001: stloc.0 IL_0002: br.s IL_0004 IL_0004: ldloc.0 IL_0005: ret } // end of method Licence::get_TrialStat
修改完成后记得去掉强命名哦 ^_^
运行脚本如:
path C:/Program Files/Microsoft Visual Studio 8/SDK/v2.0/Bin
sn -Vr RedGate.Licensing.Client.dll
看,这样就可以延长使用时间来做研究了,再次申明不要用于非法用途哦 o(∩_∩)o