如:KS.Gantt.DLL 为例

1、使用ILSpy反编译 工具

2、利用ildasm反编译 KS.Gantt.dll  生成IL中间代码 一般会生成 *.il 和*.res 一些其它资源文件 *.resources

3、然后用记事本修改IL文件

4、然后用ilasm编译中间代码,生成新的KS.Gantt.dll

5、在项目中使用 查看效果

破解过程

1 我找到了Gantt 控件的验证的代码

2 利用ildasm反编译 KS.Gantt.dll

3 打开IL文件找到对应的代码然后删除掉 如果不会 去学习一哈 怎么使用IL

哈哈 就这个。。

.try
  {
   IL_0260: ldarg.0
   IL_0261: ldtoken  KS.Gantt.Gantt
   IL_0266: call    class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
   IL_026b: ldarg.0
   IL_026c: call    class [System]System.ComponentModel.License [System]System.ComponentModel.LicenseManager::Validate(class [mscorlib]System.Type,
                                                               object)
   IL_0271: stfld   class [System]System.ComponentModel.License KS.Gantt.Gantt::license
   IL_0276: leave.s  IL_0297

  } // end .try
  catch [mscorlib]System.Exception 
  {
   IL_0278: pop
   IL_0279: call    bool [mscorlib]System.Diagnostics.Debugger::get_IsAttached()
   IL_027e: brtrue.s  IL_0295

   IL_0280: newobj   instance void KS.Gantt.frmAbout::.ctor()
   IL_0285: stloc.0
   IL_0286: ldloc.0
   IL_0287: callvirt  instance valuetype [System.Windows.Forms]System.Windows.Forms.DialogResult [System.Windows.Forms]System.Windows.Forms.Form::ShowDialog()
   IL_028c: pop
   IL_028d: ldloc.0
   IL_028e: callvirt  instance void [System]System.ComponentModel.Component::Dispose()
   IL_0293: ldnull
   IL_0294: stloc.0
   IL_0295: leave.s  IL_0297

  } 

4 然后用ilasm编译中间代码

ilasm /dll /output=D:MyDllKS.Gantt.dll /Resource=D:MyDllGantt.res D:MyDllGantt.il


我一看到这几个单词。我就知道成功了。。

5 然后在去验证一哈DLL文件

那个授权验证代码不在了哈。。

不过呢。后来我测试 。我发现在这个DLL不能用的。运行会报这个错的

Unhandled Exception: System.IO.FileLoadException: Strong name validation failed 

所以又得删除那个签名,删除以下所有内容

.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........ 
        3B B2 D0 F9 DA 7E 55 B2 50 40 6B CF EB 20 F6 67  // ;....~U.P@k.. .g 
        E7 D6 AF 65 32 4F 6D 21 5D 91 53 0B 04 C7 E2 15  // ...e2Om!].S..... 
        F0 6A EE 38 F8 74 DB 22 34 F9 A1 B5 16 C1 04 66  // .j.8.t."4......f 
        B7 0B A8 36 49 9E 8A 71 E1 D1 26 AB A2 78 4E 3A  // ...6I..q..&..xN: 
        8B 71 8C 7F 4D 54 22 28 5F 1F 8D DE 6C 96 EC 22  // .q..MT"(_...l.." 
        34 8A 35 3F 95 0A F4 F4 7F B7 8C F5 5D F4 CB 54  // 4.5?........]..T 
        92 94 DD 5E D5 0D 20 12 7F B1 9B 15 7F 0E FB 2A  // ...^.. ........* 
        76 5F 45 3D 20 2C E2 6D FE 55 72 30 49 76 28 FE ) // v_E= ,.m.Ur0Iv(.

最后在从新编译DLL。成功了

以上这篇编辑IL文件 修改DLL文件的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持悠悠之家。

点赞(224)

评论列表共有 0 条评论

立即
投稿
返回
顶部