由于经常要访问MS SQL Server数据库,经常要格式化T-SQL。
发现SQL Prompt的格式化功能确实不错,没有序列号的我,决定尝试下能不能免序列号破解。
用dnSpy(32位)打开SQL Prompt安装目录下的RedGate.Client.ActivationPluginShim.dll文件。
(我的安装路径是:C:\Program Files (x86)\Red Gate\SQL Prompt 10)
发现代码没有混淆,在以下几个关键的代码处下断点:
1. RedGate.Client.ActivationPluginShim.Licence的IsLicensed属性;
2. RedGate.Client.ActivationPluginShim.Licence的HasFeature()方法;
3. RedGate.Client.ActivationPluginShim.LicensingClientGuiMultiplexer的GetLicence()方法;
4. RedGate.Client.ActivationPluginShim.LicensingClientGui的GetLicence()方法;
5. RedGate.Client.ActivationPluginShim.LicensingClient的GetLicence()方法;
然后启动.net framework调试,选择SSMS 18+的执行文件进行调试。
我的路径是:C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe。
不出意外,在这些断点基本都有命中。于是直接编辑方法,改成下面这样。
[C#] 纯文本查看 复制代码 public bool IsLicensed
{
get
{
return this.m_LicenceState == LicenceState.Licensed;
}
}
改为
[C#] 纯文本查看 复制代码 public bool IsLicensed
{
get
{
return true;
}
}
[C#] 纯文本查看 复制代码 public bool HasFeature(string free)
{
return this.Features.Any((ProductFeature f) => f.Name.Equals(free, StringComparison.InvariantCultureIgnoreCase));
}
改为
[C#] 纯文本查看 复制代码 public bool HasFeature(string free)
{
return true;
}
基本上这样改了两下,我测试就没有问题了,不用激活就可以永久免费用。
为提升性能,再将RedGate.Client.ActivationPluginShim.LicensingClient的GetLicence()方法中的第一行注释掉。
[C#] 纯文本查看 复制代码 //this.RegisterOrReconnect();
同时将上面提到的其他两个GetLicence()方法体改为:
[C#] 纯文本查看 复制代码 public Licence GetLicence()
{
return new Licence(LicenceState.Licensed, new ProductFeature[0], new UserAction(), true, "ok", "ok");
}
保存模块即可。免序列号激活完美成功!!!
PS:保存好这个修改后的文件,后续升级版本后,直接替换或再修改一次即可。
|