checking in all the old panacean stuff
This commit is contained in:
930
puttysrc/SMFTP/IntelliProtector.cs
Normal file
930
puttysrc/SMFTP/IntelliProtector.cs
Normal file
@@ -0,0 +1,930 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright 2010. IntelliProtector.com
|
||||
// Web site: http://intelliprotector.com
|
||||
// Version: v2.5
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
||||
namespace netprotector.api
|
||||
{
|
||||
internal delegate void dVoid_NoParams();
|
||||
internal delegate void dVoid_BoolParam(out bool b1);
|
||||
internal delegate void dVoid_IntParam(out int i1);
|
||||
internal delegate void dVoid_2IntParam(out int i1, int i2);
|
||||
internal delegate void dVoid_5IntParams(out int i1, out int i2, out int i3, out int i4, out int i5);
|
||||
internal delegate void dVoid_StringBuilderParam([MarshalAs(UnmanagedType.LPWStr)] StringBuilder s1, int iMaxLength);
|
||||
internal delegate void dBool_StringParam(out bool res, [MarshalAs(UnmanagedType.LPWStr)]String s1, int iMaxLength);
|
||||
internal delegate void dBool_StringOnlyParam(out bool res, [MarshalAs(UnmanagedType.LPWStr)]String s1);
|
||||
internal delegate void dBool_StringStringParam(out bool res, [MarshalAs(UnmanagedType.LPWStr)]String s1, [MarshalAs(UnmanagedType.LPWStr)]String s2);
|
||||
}
|
||||
|
||||
namespace IntelliProtectorService.attributes
|
||||
{
|
||||
internal class Encrypt : Attribute { }
|
||||
internal class GetBuyNowLinkAttribute : Attribute { }
|
||||
internal class IsSoftwareProtectedAttribute : Attribute { }
|
||||
internal class IsSoftwareRegisteredAttribute : Attribute { }
|
||||
internal class GetTrialDaysCountAttribute : Attribute { }
|
||||
internal class GetTrialUnitsCountAttribute : Attribute { }
|
||||
internal class GetTrialDaysLeftCountAttribute : Attribute { }
|
||||
internal class GetTrialUnitsLeftCountAttribute : Attribute { }
|
||||
internal class GetTrialLaunchesCountAttribute : Attribute { }
|
||||
internal class GetTrialLaunchesLeftCountAttribute : Attribute { }
|
||||
internal class ShowRegistrationWindowAttribute : Attribute { }
|
||||
internal class IsTrialElapsedAttribute : Attribute { }
|
||||
internal class GetRenewalPurchaseLinkAttribute : Attribute { }
|
||||
internal class GetLicenseTypeAttribute : Attribute { }
|
||||
internal class GetLicenseExpirationDaysCountAttribute : Attribute { }
|
||||
internal class GetLicenseExpirationDaysLeftCountAttribute : Attribute { }
|
||||
internal class GetSupportExpirationDaysCountAttribute : Attribute { }
|
||||
internal class GetSupportExpirationDaysLeftCountAttribute : Attribute { }
|
||||
internal class GetCurrentProductVersionAttribute : Attribute { }
|
||||
internal class GetCustomerNameAttribute : Attribute { }
|
||||
internal class GetCustomerEMailAttribute : Attribute { }
|
||||
internal class GetLicenseCodeAttribute : Attribute { }
|
||||
internal class RegisterSoftwareAttribute : Attribute { }
|
||||
internal class RenewLicenseCodeAttribute : Attribute { }
|
||||
internal class GetCurrentActivationDateAttribute : Attribute { }
|
||||
internal class GetCurrentRegistrationDateAttribute : Attribute { }
|
||||
internal class GetFirstRegistrationDateAttribute : Attribute { }
|
||||
internal class GetOrderDateAttribute : Attribute { }
|
||||
internal class GetLicenseExpirationDateAttribute : Attribute { }
|
||||
internal class GetProtectionDateAttribute : Attribute { }
|
||||
internal class GetSupportExpirationDateAttribute : Attribute { }
|
||||
internal class GetSupportExpirationProductVersionAttribute : Attribute { }
|
||||
internal class GetIntelliProtectorVersionAttribute : Attribute { }
|
||||
internal class CreateRegistrationRequestCertificateAttribute : Attribute { }
|
||||
internal class UseRegistrationResponseCertificateAttribute : Attribute { }
|
||||
internal class SystemFunction1Attribute : Attribute { }
|
||||
}
|
||||
|
||||
namespace IntelliProtectorService
|
||||
{
|
||||
internal class IntelliProtector
|
||||
{
|
||||
public static double Version_2_5()
|
||||
{
|
||||
return 2.5f;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
public static bool IsInDebugMode()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
public enum enUnitDimension
|
||||
{
|
||||
eudMinutes,
|
||||
eudHours,
|
||||
eudDays,
|
||||
eudWeeks,
|
||||
eudMonths
|
||||
};
|
||||
|
||||
private class Init32
|
||||
{
|
||||
[DllImport("JitHookCore.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "Init")]
|
||||
public static extern void Init();
|
||||
};
|
||||
|
||||
private class Init64
|
||||
{
|
||||
[DllImport("JitHookCoreX64.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "Init")]
|
||||
public static extern void Init();
|
||||
};
|
||||
|
||||
public static bool Init()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool tryLoadX64 = false;
|
||||
try
|
||||
{
|
||||
Init32.Init();
|
||||
}
|
||||
catch (BadImageFormatException)
|
||||
{
|
||||
tryLoadX64 = true;
|
||||
}
|
||||
|
||||
if (tryLoadX64)
|
||||
{
|
||||
try
|
||||
{
|
||||
Init64.Init();
|
||||
}
|
||||
catch (BadImageFormatException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (System.Exception)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#region GetBuyNowLink
|
||||
[attributes.GetBuyNowLinkAttribute]
|
||||
public static String GetBuyNowLink()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
int ciMinLength = 0;
|
||||
int ciMaxLength = 1024;
|
||||
StringBuilder rValue = new StringBuilder(ciMaxLength);
|
||||
object[] obj = new object[] { rValue, ciMaxLength - ciMinLength };
|
||||
Type tp = typeof(netprotector.api.dVoid_StringBuilderParam);
|
||||
|
||||
GetBuyNowLinkTest(address, obj, tp);
|
||||
return rValue.ToString();
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetBuyNowLinkTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(StringBuilder))
|
||||
return;
|
||||
|
||||
string strLink = "";
|
||||
if ((int)obj[1] >= strLink.Length)
|
||||
((StringBuilder)obj[0]).Append(strLink);
|
||||
}
|
||||
#endregion
|
||||
#region IsSoftwareProtected
|
||||
[attributes.IsSoftwareProtected]
|
||||
public static bool IsSoftwareProtected()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { false };
|
||||
Type tp = typeof(netprotector.api.dVoid_BoolParam);
|
||||
|
||||
IsSoftwareProtectedTest(address, obj, tp);
|
||||
return (bool)obj[0];
|
||||
}
|
||||
|
||||
[attributes.Encrypt]
|
||||
protected static void IsSoftwareProtectedTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(bool))
|
||||
return;
|
||||
|
||||
obj[0] = false;
|
||||
}
|
||||
#endregion
|
||||
#region IsSoftwareRegistered
|
||||
[attributes.IsSoftwareRegistered]
|
||||
public static bool IsSoftwareRegistered()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { false };
|
||||
Type tp = typeof(netprotector.api.dVoid_BoolParam);
|
||||
|
||||
IsSoftwareRegisteredTest(address, obj, tp);
|
||||
return (bool)obj[0];
|
||||
}
|
||||
|
||||
[attributes.Encrypt]
|
||||
protected static void IsSoftwareRegisteredTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(bool))
|
||||
return;
|
||||
|
||||
obj[0] = false;
|
||||
}
|
||||
#endregion
|
||||
#region GetTrialDaysCount
|
||||
[attributes.GetTrialDaysCount]
|
||||
public static int GetTrialDaysCount()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { (int)0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_IntParam);
|
||||
|
||||
GetTrialDaysCountTest(address, obj, tp);
|
||||
return (int)obj[0];
|
||||
}
|
||||
|
||||
[attributes.Encrypt]
|
||||
protected static void GetTrialDaysCountTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int))
|
||||
return;
|
||||
|
||||
obj[0] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetTrialUnitsCount
|
||||
[attributes.GetTrialUnitsCount]
|
||||
public static int GetTrialUnitsCount(int dimensions)
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { (int)0, dimensions };
|
||||
Type tp = typeof(netprotector.api.dVoid_2IntParam);
|
||||
GetTrialUnitsCountTest(address, obj, tp);
|
||||
return (int)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
public static void GetTrialUnitsCountTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int) && obj[1].GetType() != typeof(int))
|
||||
return;
|
||||
|
||||
obj[0] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetTrialDaysLeftCount
|
||||
[attributes.GetTrialDaysLeftCount]
|
||||
public static int GetTrialDaysLeftCount()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { (int)0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_IntParam);
|
||||
GetTrialDaysLeftCountTest(address, obj, tp);
|
||||
return (int)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
public static void GetTrialDaysLeftCountTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int))
|
||||
return;
|
||||
|
||||
obj[0] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetTrialUnitsLeftCount
|
||||
[attributes.GetTrialUnitsLeftCount]
|
||||
public static int GetTrialUnitsLeftCount(int dimension)
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { (int)0, dimension };
|
||||
Type tp = typeof(netprotector.api.dVoid_2IntParam);
|
||||
GetTrialUnitsLeftCountTest(address, obj, tp);
|
||||
return (int)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
public static void GetTrialUnitsLeftCountTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int) && obj[1].GetType() != typeof(int))
|
||||
return;
|
||||
|
||||
obj[0] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetTrialLaunchesCount
|
||||
[attributes.GetTrialLaunchesCount]
|
||||
public static int GetTrialLaunchesCount()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { (int)0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_IntParam);
|
||||
GetTrialLaunchesCountTest(address, obj, tp);
|
||||
return (int)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
public static void GetTrialLaunchesCountTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int))
|
||||
return;
|
||||
|
||||
obj[0] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetTrialLaunchesLeftCount
|
||||
[attributes.GetTrialLaunchesLeftCount]
|
||||
public static int GetTrialLaunchesLeftCount()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { (int)0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_IntParam);
|
||||
GetTrialLaunchesLeftCountTest(address, obj, tp);
|
||||
return (int)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
public static void GetTrialLaunchesLeftCountTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int))
|
||||
return;
|
||||
|
||||
obj[0] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region ShowRegistrationWindow
|
||||
[attributes.ShowRegistrationWindow]
|
||||
public static void ShowRegistrationWindow()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
Type tp = typeof(netprotector.api.dVoid_NoParams);
|
||||
ShowRegistrationWindowTest(address, null, tp);
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
public static void ShowRegistrationWindowTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
#region IsTrialElapsed
|
||||
[attributes.IsTrialElapsed]
|
||||
public static bool IsTrialElapsed()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { false };
|
||||
Type tp = typeof(netprotector.api.dVoid_BoolParam);
|
||||
|
||||
IsTrialElapsedTest(address, obj, tp);
|
||||
return (bool)obj[0];
|
||||
}
|
||||
|
||||
[attributes.Encrypt]
|
||||
protected static void IsTrialElapsedTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(bool))
|
||||
return;
|
||||
|
||||
obj[0] = false;
|
||||
}
|
||||
#endregion
|
||||
#region GetRenewalPurchaseLink
|
||||
[attributes.GetRenewalPurchaseLink]
|
||||
public static String GetRenewalPurchaseLink()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
int ciMinLength = 0;
|
||||
int ciMaxLength = 1024;
|
||||
StringBuilder rValue = new StringBuilder(ciMaxLength);
|
||||
object[] obj = new object[] { rValue, ciMaxLength - ciMinLength };
|
||||
Type tp = typeof(netprotector.api.dVoid_StringBuilderParam);
|
||||
|
||||
GetRenewalPurchaseLinkTest(address, obj, tp);
|
||||
return rValue.ToString();
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetRenewalPurchaseLinkTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(StringBuilder))
|
||||
return;
|
||||
|
||||
string strLink = "";
|
||||
if ((int)obj[1] >= strLink.Length)
|
||||
((StringBuilder)obj[0]).Append(strLink);
|
||||
}
|
||||
#endregion
|
||||
#region GetLicenseType
|
||||
[attributes.GetLicenseType]
|
||||
public static int GetLicenseType()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { (int)0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_IntParam);
|
||||
GetLicenseTypeTest(address, obj, tp);
|
||||
return (int)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
public static void GetLicenseTypeTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int))
|
||||
return;
|
||||
|
||||
obj[0] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetLicenseExpirationDaysCount
|
||||
[attributes.GetLicenseExpirationDaysCount]
|
||||
public static int GetLicenseExpirationDaysCount()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { (int)0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_IntParam);
|
||||
GetLicenseExpirationDaysCountTest(address, obj, tp);
|
||||
return (int)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
public static void GetLicenseExpirationDaysCountTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int))
|
||||
return;
|
||||
|
||||
obj[0] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetLicenseExpirationDaysLeftCount
|
||||
[attributes.GetLicenseExpirationDaysLeftCount]
|
||||
public static int GetLicenseExpirationDaysLeftCount()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { (int)0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_IntParam);
|
||||
GetLicenseExpirationDaysLeftTest(address, obj, tp);
|
||||
return (int)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
public static void GetLicenseExpirationDaysLeftTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int))
|
||||
return;
|
||||
|
||||
obj[0] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetSupportExpirationDaysCount
|
||||
[attributes.GetSupportExpirationDaysCount]
|
||||
public static int GetSupportExpirationDaysCount()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { (int)0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_IntParam);
|
||||
GetSupportExpirationDaysCountTest(address, obj, tp);
|
||||
return (int)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
public static void GetSupportExpirationDaysCountTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int))
|
||||
return;
|
||||
|
||||
obj[0] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetSupportExpirationDaysLeftCount
|
||||
[attributes.GetSupportExpirationDaysLeftCount]
|
||||
public static int GetSupportExpirationDaysLeftCount()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { (int)0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_IntParam);
|
||||
GetSupportExpirationDaysLeftCountTest(address, obj, tp);
|
||||
return (int)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
public static void GetSupportExpirationDaysLeftCountTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int))
|
||||
return;
|
||||
|
||||
obj[0] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetCurrentProductVersion
|
||||
[attributes.GetCurrentProductVersion]
|
||||
public static String GetCurrentProductVersion()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
int ciMinLength = 0;
|
||||
int ciMaxLength = 1024;
|
||||
StringBuilder rValue = new StringBuilder(ciMaxLength);
|
||||
object[] obj = new object[] { rValue, ciMaxLength - ciMinLength };
|
||||
Type tp = typeof(netprotector.api.dVoid_StringBuilderParam);
|
||||
|
||||
GetCurrentProductVersionTest(address, obj, tp);
|
||||
return rValue.ToString();
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetCurrentProductVersionTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(StringBuilder))
|
||||
return;
|
||||
|
||||
string strLink = "";
|
||||
if ((int)obj[1] >= strLink.Length)
|
||||
((StringBuilder)obj[0]).Append(strLink);
|
||||
}
|
||||
#endregion
|
||||
#region GetCustomerName
|
||||
[attributes.GetCustomerName]
|
||||
public static String GetCustomerName()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
int ciMinLength = 0;
|
||||
int ciMaxLength = 1024;
|
||||
StringBuilder rValue = new StringBuilder(ciMaxLength);
|
||||
object[] obj = new object[] { rValue, ciMaxLength - ciMinLength };
|
||||
Type tp = typeof(netprotector.api.dVoid_StringBuilderParam);
|
||||
|
||||
GetCustomerNameTest(address, obj, tp);
|
||||
return rValue.ToString();
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetCustomerNameTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(StringBuilder))
|
||||
return;
|
||||
|
||||
string strLink = "";
|
||||
if ((int)obj[1] >= strLink.Length)
|
||||
((StringBuilder)obj[0]).Append(strLink);
|
||||
}
|
||||
#endregion
|
||||
#region GetCustomerEMail
|
||||
[attributes.GetCustomerEMail]
|
||||
public static String GetCustomerEMail()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
int ciMinLength = 0;
|
||||
int ciMaxLength = 1024;
|
||||
StringBuilder rValue = new StringBuilder(ciMaxLength);
|
||||
object[] obj = new object[] { rValue, ciMaxLength - ciMinLength };
|
||||
Type tp = typeof(netprotector.api.dVoid_StringBuilderParam);
|
||||
|
||||
GetCustomerEMailTest(address, obj, tp);
|
||||
return rValue.ToString();
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetCustomerEMailTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(StringBuilder))
|
||||
return;
|
||||
|
||||
string strLink = "";
|
||||
if ((int)obj[1] >= strLink.Length)
|
||||
((StringBuilder)obj[0]).Append(strLink);
|
||||
}
|
||||
#endregion
|
||||
#region GetLicenseCode
|
||||
[attributes.GetLicenseCode]
|
||||
public static String GetLicenseCode()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
int ciMinLength = 0;
|
||||
int ciMaxLength = 1024;
|
||||
StringBuilder rValue = new StringBuilder(ciMaxLength);
|
||||
object[] obj = new object[] { rValue, ciMaxLength - ciMinLength };
|
||||
Type tp = typeof(netprotector.api.dVoid_StringBuilderParam);
|
||||
|
||||
GetLicenseCodeTest(address, obj, tp);
|
||||
return rValue.ToString();
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetLicenseCodeTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(StringBuilder))
|
||||
return;
|
||||
|
||||
string strLink = "";
|
||||
if ((int)obj[1] >= strLink.Length)
|
||||
((StringBuilder)obj[0]).Append(strLink);
|
||||
}
|
||||
#endregion
|
||||
#region RegisterSoftware
|
||||
[attributes.RegisterSoftware]
|
||||
public static bool RegisterSoftware(string licenseKey)
|
||||
{
|
||||
UInt64 address = 0;
|
||||
bool res = false;
|
||||
object[] obj = new object[] { res, licenseKey, licenseKey.Length };
|
||||
Type tp = typeof(netprotector.api.dBool_StringParam);
|
||||
|
||||
RegisterSoftwareTest(address, obj, tp);
|
||||
return (bool)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void RegisterSoftwareTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
obj[0] = false;
|
||||
}
|
||||
#endregion
|
||||
#region RenewLicenseCode
|
||||
[attributes.RenewLicenseCode]
|
||||
public static bool RenewLicenseCode(string renewalCode)
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { false, renewalCode, renewalCode.Length };
|
||||
Type tp = typeof(netprotector.api.dBool_StringParam);
|
||||
|
||||
RenewLicenseCodeTest(address, obj, tp);
|
||||
return (bool)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void RenewLicenseCodeTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
obj[0] = false;
|
||||
}
|
||||
#endregion
|
||||
#region GetCurrentActivationDate
|
||||
[attributes.GetCurrentActivationDate]
|
||||
public static DateTime GetCurrentActivationDate()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { 0, 0, 0, 0, 0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_5IntParams);
|
||||
|
||||
GetCurrentActivationDateTest(address, obj, tp);
|
||||
if ((int)obj[0] < 0)
|
||||
return DateTime.MinValue;
|
||||
|
||||
return new DateTime((int)obj[0], (int)obj[1], (int)obj[2], (int)obj[3], (int)obj[4], 0);
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetCurrentActivationDateTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int) ||
|
||||
obj[1].GetType() != typeof(int) ||
|
||||
obj[2].GetType() != typeof(int) ||
|
||||
obj[3].GetType() != typeof(int) ||
|
||||
obj[4].GetType() != typeof(int))
|
||||
{
|
||||
return;
|
||||
}
|
||||
obj[0] = -1;
|
||||
obj[1] = -1;
|
||||
obj[2] = -1;
|
||||
obj[3] = -1;
|
||||
obj[4] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetCurrentRegistrationDate
|
||||
[attributes.GetCurrentRegistrationDate]
|
||||
public static DateTime GetCurrentRegistrationDate()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { 0, 0, 0, 0, 0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_5IntParams);
|
||||
|
||||
GetCurrentRegistrationDateTest(address, obj, tp);
|
||||
if ((int)obj[0] < 0)
|
||||
return DateTime.MinValue;
|
||||
|
||||
return new DateTime((int)obj[0], (int)obj[1], (int)obj[2], (int)obj[3], (int)obj[4], 0);
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetCurrentRegistrationDateTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int) ||
|
||||
obj[1].GetType() != typeof(int) ||
|
||||
obj[2].GetType() != typeof(int) ||
|
||||
obj[3].GetType() != typeof(int) ||
|
||||
obj[4].GetType() != typeof(int))
|
||||
{
|
||||
return;
|
||||
}
|
||||
obj[0] = -1;
|
||||
obj[1] = -1;
|
||||
obj[2] = -1;
|
||||
obj[3] = -1;
|
||||
obj[4] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetFirstRegistrationDate
|
||||
[attributes.GetFirstRegistrationDate]
|
||||
public static DateTime GetFirstRegistrationDate()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { 0, 0, 0, 0, 0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_5IntParams);
|
||||
|
||||
GetFirstRegistrationDateTest(address, obj, tp);
|
||||
if ((int)obj[0] < 0)
|
||||
return DateTime.MinValue;
|
||||
|
||||
return new DateTime((int)obj[0], (int)obj[1], (int)obj[2], (int)obj[3], (int)obj[4], 0);
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetFirstRegistrationDateTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int) ||
|
||||
obj[1].GetType() != typeof(int) ||
|
||||
obj[2].GetType() != typeof(int) ||
|
||||
obj[3].GetType() != typeof(int) ||
|
||||
obj[4].GetType() != typeof(int))
|
||||
{
|
||||
return;
|
||||
}
|
||||
obj[0] = -1;
|
||||
obj[1] = -1;
|
||||
obj[2] = -1;
|
||||
obj[3] = -1;
|
||||
obj[4] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetOrderDate
|
||||
[attributes.GetOrderDate]
|
||||
public static DateTime GetOrderDate()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { 0, 0, 0, 0, 0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_5IntParams);
|
||||
|
||||
GetOrderDateTest(address, obj, tp);
|
||||
if ((int)obj[0] < 0)
|
||||
return DateTime.MinValue;
|
||||
|
||||
return new DateTime((int)obj[0], (int)obj[1], (int)obj[2], (int)obj[3], (int)obj[4], 0);
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetOrderDateTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int) ||
|
||||
obj[1].GetType() != typeof(int) ||
|
||||
obj[2].GetType() != typeof(int) ||
|
||||
obj[3].GetType() != typeof(int) ||
|
||||
obj[4].GetType() != typeof(int))
|
||||
{
|
||||
return;
|
||||
}
|
||||
obj[0] = -1;
|
||||
obj[1] = -1;
|
||||
obj[2] = -1;
|
||||
obj[3] = -1;
|
||||
obj[4] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetLicenseExpirationDate
|
||||
[attributes.GetLicenseExpirationDate]
|
||||
public static DateTime GetLicenseExpirationDate()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { 0, 0, 0, 0, 0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_5IntParams);
|
||||
|
||||
GetLicenseExpirationDateTest(address, obj, tp);
|
||||
if ((int)obj[0] < 0)
|
||||
return DateTime.MinValue;
|
||||
|
||||
return new DateTime((int)obj[0], (int)obj[1], (int)obj[2], (int)obj[3], (int)obj[4], 0);
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetLicenseExpirationDateTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int) ||
|
||||
obj[1].GetType() != typeof(int) ||
|
||||
obj[2].GetType() != typeof(int) ||
|
||||
obj[3].GetType() != typeof(int) ||
|
||||
obj[4].GetType() != typeof(int))
|
||||
{
|
||||
return;
|
||||
}
|
||||
obj[0] = -1;
|
||||
obj[1] = -1;
|
||||
obj[2] = -1;
|
||||
obj[3] = -1;
|
||||
obj[4] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetProtectionDate
|
||||
[attributes.GetProtectionDate]
|
||||
public static DateTime GetProtectionDate()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { 0, 0, 0, 0, 0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_5IntParams);
|
||||
|
||||
GetProtectionDateTest(address, obj, tp);
|
||||
if ((int)obj[0] < 0)
|
||||
return DateTime.MinValue;
|
||||
|
||||
return new DateTime((int)obj[0], (int)obj[1], (int)obj[2], (int)obj[3], (int)obj[4], 0);
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetProtectionDateTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int) ||
|
||||
obj[1].GetType() != typeof(int) ||
|
||||
obj[2].GetType() != typeof(int) ||
|
||||
obj[3].GetType() != typeof(int) ||
|
||||
obj[4].GetType() != typeof(int))
|
||||
{
|
||||
return;
|
||||
}
|
||||
obj[0] = -1;
|
||||
obj[1] = -1;
|
||||
obj[2] = -1;
|
||||
obj[3] = -1;
|
||||
obj[4] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetSupportExpirationDate
|
||||
[attributes.GetSupportExpirationDate]
|
||||
public static DateTime GetSupportExpirationDate()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
object[] obj = new object[] { 0, 0, 0, 0, 0 };
|
||||
Type tp = typeof(netprotector.api.dVoid_5IntParams);
|
||||
|
||||
GetSupportExpirationDateTest(address, obj, tp);
|
||||
if ((int)obj[0] < 0)
|
||||
return DateTime.MinValue;
|
||||
|
||||
return new DateTime((int)obj[0], (int)obj[1], (int)obj[2], (int)obj[3], (int)obj[4], 0);
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetSupportExpirationDateTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(int) ||
|
||||
obj[1].GetType() != typeof(int) ||
|
||||
obj[2].GetType() != typeof(int) ||
|
||||
obj[3].GetType() != typeof(int) ||
|
||||
obj[4].GetType() != typeof(int))
|
||||
{
|
||||
return;
|
||||
}
|
||||
obj[0] = -1;
|
||||
obj[1] = -1;
|
||||
obj[2] = -1;
|
||||
obj[3] = -1;
|
||||
obj[4] = -1;
|
||||
}
|
||||
#endregion
|
||||
#region GetSupportExpirationProductVersion
|
||||
[attributes.GetSupportExpirationProductVersion]
|
||||
public static String GetSupportExpirationProductVersion()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
int ciMinLength = 0;
|
||||
int ciMaxLength = 1024;
|
||||
StringBuilder rValue = new StringBuilder(ciMaxLength);
|
||||
object[] obj = new object[] { rValue, ciMaxLength - ciMinLength };
|
||||
Type tp = typeof(netprotector.api.dVoid_StringBuilderParam);
|
||||
|
||||
GetSupportExpirationProductVersionTest(address, obj, tp);
|
||||
return rValue.ToString();
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetSupportExpirationProductVersionTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(StringBuilder))
|
||||
return;
|
||||
|
||||
string strLink = "";
|
||||
if ((int)obj[1] >= strLink.Length)
|
||||
((StringBuilder)obj[0]).Append(strLink);
|
||||
}
|
||||
#endregion
|
||||
#region GetIntelliProtectorVersion
|
||||
[attributes.GetIntelliProtectorVersion]
|
||||
public static String GetIntelliProtectorVersion()
|
||||
{
|
||||
UInt64 address = 0;
|
||||
int ciMinLength = 0;
|
||||
int ciMaxLength = 1024;
|
||||
StringBuilder rValue = new StringBuilder(ciMaxLength);
|
||||
object[] obj = new object[] { rValue, ciMaxLength - ciMinLength };
|
||||
Type tp = typeof(netprotector.api.dVoid_StringBuilderParam);
|
||||
|
||||
GetIntelliProtectorVersionTest(address, obj, tp);
|
||||
return rValue.ToString();
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void GetIntelliProtectorVersionTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
if (obj[0].GetType() != typeof(StringBuilder))
|
||||
return;
|
||||
|
||||
string strLink = "";
|
||||
if ((int)obj[1] >= strLink.Length)
|
||||
((StringBuilder)obj[0]).Append(strLink);
|
||||
}
|
||||
#endregion
|
||||
#region CreateRegistrationRequestCertificate
|
||||
[attributes.CreateRegistrationRequestCertificate]
|
||||
public static bool CreateRegistrationRequestCertificate(string path, string licenseCode)
|
||||
{
|
||||
UInt64 address = 0;
|
||||
bool res = false;
|
||||
object[] obj = new object[] { res, path, licenseCode };
|
||||
Type tp = typeof(netprotector.api.dBool_StringStringParam);
|
||||
|
||||
CreateRegistrationRequestCertificateTest(address, obj, tp);
|
||||
return (bool)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void CreateRegistrationRequestCertificateTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
obj[0] = true;
|
||||
}
|
||||
#endregion
|
||||
#region UseRegistrationResponseCertificate
|
||||
[attributes.UseRegistrationResponseCertificate]
|
||||
public static bool UseRegistrationResponseCertificate(string path)
|
||||
{
|
||||
UInt64 address = 0;
|
||||
bool res = false;
|
||||
object[] obj = new object[] { res, path };
|
||||
Type tp = typeof(netprotector.api.dBool_StringOnlyParam);
|
||||
|
||||
UseRegistrationResponseCertificateTest(address, obj, tp);
|
||||
return (bool)obj[0];
|
||||
}
|
||||
[attributes.Encrypt]
|
||||
protected static void UseRegistrationResponseCertificateTest(UInt64 address, object[] obj, Type delegateType)
|
||||
{
|
||||
obj[0] = true;
|
||||
}
|
||||
#endregion
|
||||
#region SystemFunction1
|
||||
[attributes.SystemFunction1]
|
||||
protected static void SystemFunction1(UInt64 address, object[] parameters, Type delegateType)
|
||||
{
|
||||
Delegate delegateFunc = Marshal.GetDelegateForFunctionPointer((IntPtr)address, delegateType);
|
||||
delegateFunc.DynamicInvoke(parameters);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user