上传者: gnishuihan
|
上传时间: 2024-03-22 15:53:47
|
文件大小: 11.14MB
|
文件类型: DLL
只需在使用前调用一下Crack方法即可达到Patch的目的,不破坏原dll的完整性,无需反编译原dll。
private static void Crack()
{
var stModule = new[]
{
"\u000E\u2008\u200A\u2001",
"\u000F\u2008\u200A\u2001",
"\u0002\u200A\u200A\u2001",
"\u000F",
"\u0006",
"\u000E",
"\u0003",
"\u0002"
};
var assembly = Assembly.GetAssembly(typeof(Aspose.Words.License));
Type typeLic = null, typeIsTrial = null, typeHelper = null;
foreach (var type in assembly.GetTypes())
{
if ((typeLic == null) && (type.Name == stModule[0]))
{
typeLic = type;
}
else if ((typeIsTrial == null) && (type.Name == stModule[1]))
{
typeIsTrial = type;
}
else if ((typeHelper == null) && (type.Name == stModule[2]))
{
typeHelper = type;
}
}
if (typeLic == null || typeIsTrial == null || typeHelper == null)
{
throw new Exception();
}
var lic = Activator.CreateInstance(typeLic);
var findCount = 0;
foreach (var field in typeLic.GetFields(BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance))
{
if (field.FieldType == typeLic && field.Name == stModule[3])
{
field.SetValue(null, lic);
++findCount;
}
else if (field.FieldType == typeof(DateTime) && field.Name == stModule[4])
{
field.SetValue(lic, DateTime.MaxValue);
++findCount;
}
else if (field.FieldType == typeIsTrial && field.Name == stModule[5])
{
field.SetValue(lic, 1);
++findCount;
}
}
foreach (var field in typeHelper.GetFields(BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance))
{
if (field.FieldType == typeof(bool) && field.Name == stModule[6])
{
field.SetValue(null, false);
++findCount;
}
if (field.FieldType != typeof (int) || field.Name != stModule[7]) continue;
field.SetValue(null, 128);
++findCount;
}
if (findCount < 5)
{
throw new NotSupportedException("无效的版本");
}
}