Dundas Win Chart 5.5.0的破解...

1.描述
项目中用到这个较好的的图表控件:Dundas Win Chart,如果未花几千$买正版的,用在项目中时会带有水印与license
出于学习.Net反编译的文件及IL语言的目的,现把破解方法记录如下

2.破解的版本
Dundas Win Chart 5.5.0.1696 vs2005-winform- enterprise

3.相关步骤

准备工作:

建立一个用于破解的目录,写两个bat文件

Dasm.bat (反编译的文件)
ildasm DundasWinChart.dll /out=DundasWinChart.il

Asm.bat(编译反编译出来的il代码文件,重新生成dll文件)
ilasm /dll /res:DundasWinChart.res /key:MyCompany.snk DundasWinChart.il /out:DundasWinChart.dll /quiet

由于此版本的DLL库进行了强命名,所以在反编译时需要自己生成一个MyCompany.snk的强命名文件,再次进行强命名
生成方法为在visual studio 2005 commond prompt下用sn工具直接生成即可

把需要破解的DundasWinChart.dll复制进此目录

正式开始:

打开vs2005命令行,进入刚才建立的目录,运行ildasm;
此时会把当前目录中的DundasWinChart.dll反编译,反编译出相关的IL文件及资源文件
用NOTEPAD或其它工具打开DundasWinChart.il文件,同时用reflector打开DLL文件
打开Dundas.Charting.WinControl.ChartPicture的 Paint方法
public void Paint(Graphics graph, bool paintTopLevelElementOnly)
{
    this.Paint(graph, paintTopLevelElementOnly, RenderingType.Gdi, null, null, string.Empty, false, false);
}
public void Paint(Graphics graph, bool paintTopLevelElementOnly, RenderingType renderingType, XmlTextWriter svgTextWriter, Stream flashStream, string documentTitle, bool resizable, bool preserveAspectRatio)
{
    this.b = false;
    this.a.a(this.a, null);
*****************
        }
        catch (Exception)
        {
            throw;
        }
        finally
        {
            this.OnAfterPaint(new ChartPaintEventArgs(this.a, this.a, new ElementPosition(0f, 0f, 100f, 100f)));
            foreach (ChartArea area7 in this.a)
            {
                if (area7.Visible)
                {
                    area7.a();
                    area7.d();
                }
            }
            this.d = true; --就是这里了
            if (this.d)
            {
                StringFormat format = new StringFormat();
                format.Alignment = StringAlignment.Center;
                format.LineAlignment = StringAlignment.Center;
                SolidBrush brush = new SolidBrush(Color.FromArgb(40, 0, 0, 0xaf));
                SolidBrush brush2 = new SolidBrush(Color.FromArgb(40, 200, 200, 200));
                Font font = new Font(a(), 8f);
                SizeF relativeSize = this.a.GetRelativeSize(new SizeF(2f, 2f));
                string text = ct.a("\u14ad\u14de\u14d7\u14cd\u14ca\u14dc\u1489\u14ac\u14d1\u14ca\u14db\u14dd\u1489\u1496\u1489\u14c0\u14d2\u14d7\u14cd\u14d8\u14e0\u14dc\u1489\u14af\u14d8\u14db\u14d6\u14dc\u1489\u14ae\u14d7\u14dd\u14ce\u14db\u14d9\u14db\u14d2\u14dc\u14ce\u1489\u14ae\u14cd\u14d2\u14dd\u14d2\u14d8\u14d7\u1476\u1473\u14ae\u14df\u14ca\u14d5\u14de\u14ca\u14dd\u14d2\u14d8\u14d7\u1489\u14b6\u14d8\u14cd\u14ce\u1489\u14ae\u14d7\u14ca\u14cb\u14d5\u14ce\u14cd\u1495\u1489\u14cf\u14d8\u14db\u1489\u14dd\u14ce\u14dc\u14dd\u14d2\u14d7\u14d0\u1489\u14d9\u14de\u14db\u14d9\u14d8\u14dc\u14ce\u14dc\u1489\u14d8\u14d7\u14d5\u14e2\u1476\u1473\u1491\u14ac\u1492\u1489\u149b\u1499\u1499\u149f\u1489\u14ad\u14de\u14d7\u14cd\u14ca\u14dc\u1489\u14bc\u14d8\u14cf\u14dd\u14e0\u14ca\u14db\u14ce\u1495\u1489\u14e0\u14e0\u14e0\u1497\u14cd\u14de\u14d7\u14cd\u14ca\u14dc\u1497\u14cc\u14d8\u14d6");
                this.a.a(text, font, brush2, new RectangleF(0f, 0f, 100f, 100f), format);
                this.a.a(text, font, brush, new RectangleF(0f, 0f, 100f - relativeSize.Width, 100f - relativeSize.Height), format);
            }
            if (renderingType == RenderingType.Svg)
            {
                this.a.Close();
                this.a.a(RenderingType.Gdi);
            }
        }
    }
}

把上面的this.d = true;改为false就得了

打开DundasWinChart.il文件,用end of method ChartPicture::Paint搜索,总计应该找到两处,就是第二处了,那个method代码比较多那个

看到如下IL代码:
      IL_0950:  ldarg.0
      IL_0951:  ldc.i4.1 就是这个,意思是true,改为false即可
      IL_0952:  stfld      bool Dundas.Charting.WinControl.ChartPicture::d
      IL_0957:  ldarg.0
      IL_0958:  ldfld      bool Dundas.Charting.WinControl.ChartPicture::d
      IL_095d:  brfalse    IL_0a4c

把IL_0951:  ldc.i4.1中的ldc.i4.1改为ldc.i4.0
改完之后,意思就是去除水印了

还有一个问题就是去除license

打开Dundas.Charting.WinControl.ChartImage的a(string,string)这个方法,看清楚是有两个字符型参数的这个a方法

private static bool a(string text1, string text2)
{
    bool flag = false;  把它改为true就行了
    RegistryKey key = Registry.LocalMachine.OpenSubKey(text1);
    if (key != null)
    {
        string text = (string) key.GetValue(ct.a("\u14b2\u14d7\u14dc\u14dd\u14ca\u14d5\u14d5\u14ad\u14d2\u14db"));
        if (!text.EndsWith(ct.a("\u14c5")))
        {
            text = text + ct.a("\u14c5");
        }
        if (File.Exists(text + ct.a("\u14ab\u14d2\u14d7\u14c5") + text2))
        {
            flag = true;
        }
    }
    return flag;
}

打开DundasWinChart.il文件,用end of method ChartImage::a搜索,打开那个有两个字符型参数a(string,string)的a方法
    IL_0000:  ldc.i4.1
    IL_0001:  stloc.0
    IL_0002:  ldsfld     class [mscorlib]Microsoft.Win32.RegistryKey [mscorlib]Microsoft.Win32.Registry::LocalMachine
    IL_0007:  ldarg.0
    IL_0008:  callvirt   instance class [mscorlib]Microsoft.Win32.RegistryKey [mscorlib]Microsoft.Win32.RegistryKey::OpenSubKey(string)
    IL_000d:  stloc.1
    IL_000e:  ldloc.1
    IL_000f:  brfalse.s  IL_006b
把其中IL_0000:  ldc.i4.1的ldc.i4.1改为ldc.i4.0就OK了

别着急,如果现在就进行asm,可能会错
 Error: Reference to undefined class 'UNKNOWN_OWNER'
Could not create output file, error code=0x80004005
这是因为本版本应该是进行了混淆,所以出错,
把DundasWinChart.il文件中最下面的UNKNOWN_OWNER项全部删除

在vs2005中asm,编译出新的DundasWinChart.DLL文件,再次加入测试DEMO程序,看看是否还有水印存在!!!

如果在此之前你已经用过未破解的版本,可能你的项目在会存在license文件,把其删除即可(在Properties下的license.licx)

OK,破解完成!
请使用正版软件,此版本仅供学习使用!

4.破解后的DLL文件
DundasWinChart.dll

5.参考资料
http://jetboy.blog.hexun.com/7538516_d.html
http://www.agilelabs.cn/blogs/woody/archive/2007/02/06/1907.aspx
http://smartstone.cnblogs.com/archive/2006/06/08/420862.html

posted on 2007-03-15 09:52  林子  阅读(9980)  评论(24编辑  收藏  举报

导航