现在的位置: 首页 > 综合 > 正文

SQLDBCompare_Rel2.0破解手记

2011年04月13日 ⁄ 综合 ⁄ 共 3105字 ⁄ 字号 评论关闭

 引子:montaque POST了数据库脚本版本控制 和 数据库比较工具,推荐了工具SQLDBCompare,于是有了此文.

正文:一路NEXT下来顺利安装完毕,立刻启动程序来尝尝鲜,咚


 

未授权,还剩14天,太TNND吝啬了吧,WINXP激活期也给30天呢!算了,不与计较,先点“NO”进去再说,

 

作为SQL SERVER数据库比较功能比较单一(当然你也可以说专业,呵呵),随便选择两个数据库比较了一下,呵,还行(不行的话我还懒得破你呢),点击View>>License,出现出现输入License key的对话框,随便输入几个字符,昏,当然是Invalid License String

 

不过各位看官注意了,记好这提示文字“The License string you entered is invalid,这个可是破门的好引子呀。好了,试用软件到此为止。言归正传,开工,把SQLDBCompare.exe先给拎出来瞧瞧!

左手拿出照妖镜ILDASM,一瞄,呵呵,原来SQLDBCompare.exe赤裸裸的,呜呼,多无辜的XX,怎么就不整块遮羞布呢(SQLDBCompare.exe在寒风中瑟瑟发抖,满俯委屈:“呸,有遮羞布你还能占得便宜末?”),右手嚓地一声拔出利剑Reflector,只见寒光一闪,SQLDBCompare已经皮开肉绽,血肉模糊,不过,依稀可见如下敏感部位:

  private void menuItemLicense_Click(object sender, EventArgs e)

        {

            if (CompareDatabaseOptionDlg.m_nVersionStatus == 0)

            {

                MessageBox.Show(this, "The SQLDBCompare on this computer is already licensed!", "Good News", MessageBoxButtons.OK);

            }

            else

            {

                AddLicenseDlg dlg1 = new AddLicenseDlg();

                if (dlg1.ShowDialog() != DialogResult.OK)

                {

                    return;

                }

               ......               

                }

                else

                {

                    MessageBox.Show(this, "The License string you entered is invalid!", "Invalid License String", MessageBoxButtons.OK);

                }

            }

        }

 

各位看官一定很迷惑,怎么一眼就发现如上敏感部位的呢,呵呵,我说各位兄弟姐妹、叔叔伯伯、大妈大婶……,你们难道忘了我曾经提醒大家记好这些”The License string you entered is invalid”,呵呵,我们继续,仔细打量打量上面的“部位“,大家不难发现这个重点中的重点”LicenseKey.IsValidLicensedKey ()”,乘胜追击,原来LicenseKey是住在BestCommonObj.dll地区(俗称程序集)的一个没落家族(俗称类),而IsValidLicensedKey则是LicenseKey家族的N多活动(俗称方法)中的一项,好了,我们不妨到BestCommonObj.dll瞧瞧LicenseKey.IsValidLicensedKey()的内幕,好家伙,简直是不看知道,一看吓一跳,

public static int IsValidLicensedKey(int nProductCode, string strWholeKey, ref string strModifiedKey, ref string strReason)

{

      strModifiedKey = strWholeKey;

      if (strWholeKey == null)

      {

            strReason = "Invalid key type";

            return 4;

      } 

     .....     

      if (text3[0x21] == '1')

      {

            strReason = "Unlimit License";

            return 0;

      } 

  ......    

   strReason = "Invalid key type";

      return 4;

}

看到红字部分,这是多末令人激动的东东呀,如果我能把它放到

if (strWholeKey == null)

      {

            strReason = "Invalid key type";

            return 4;

      }

之前该多好了,一切不就Pass了吗?呵呵,心动不如行动,还得请ILDASM宝贝让BestCommonObj.dll现真身BestCommonObj.il,Editplus打开BestCommonObj.il,到3615行附近,瞧这

      IL_00d2:  ldarg.3

      IL_00d3:  ldstr      "Unlimit License"

      IL_00d8:  stind.ref

      IL_00d9:  ldc.i4.0

      IL_00da:  ret

 

不就是

if (text3[0x21] == '1')

      {

            strReason = "Unlimit License";

            return 0;

      }
 

  

对应的MSIL吗?立即动手,将行35023508代码修改为

      IL_0004:  brtrue.s   IL_0006

 

      IL_0006:  ldarg.3

      IL_0007:  ldstr      "Unlimit License"

      IL_000c:  stind.ref

      IL_000d:  ldc.i4.0

      IL_000e:  ret

注意:行35023508原来的代码为

      IL_0004:  brtrue.s   IL_000f

 

      IL_0006:  ldarg.3

      IL_0007:  ldstr      "Invalid key type"

      IL_000c:  stind.ref

      IL_000d:  ldc.i4.4

      IL_000e:  ret

 

保存BestCommonObj.il,再让ILASM大师把BestCommonObj.il带回到从前的BestCommonObj.dll,如果没错的话,这下再运行SQLDBCompare.exe,呵呵,已经不是上次提示的14天到期了,而是礼貌地提示请你提交用户信息的提示了,以图为证

 

甭理它,直接 do it later”进入,呵呵,标题栏上已经没有“Trial(14 Days Left)”的字样了,再点View>>License,乖乖,多惹人喜欢的提示呀!

 

OK,That's all.

抱歉!评论已关闭.