mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-19 18:06:10 +00:00
f2ac1ece55
add
652 lines
25 KiB
C#
652 lines
25 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: PvLogiciels.dotNetProtector.RuntimeInterop
|
|
// Assembly: Cursor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
|
// MVID: BB91517D-96CD-4859-A72C-BFC1CBA44DE2
|
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Trojan.Win32.Refroso.hqmj-a46444251debd74675b60bb330cf99debe122ec24698468f4a3835595fddbe4e.exe
|
|
|
|
using \u0081é;
|
|
using \u0082\u00BC;
|
|
using õ;
|
|
using System;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using System.Diagnostics;
|
|
using System.Reflection;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
|
|
namespace PvLogiciels.dotNetProtector
|
|
{
|
|
public class RuntimeInterop : IRuntime
|
|
{
|
|
internal Assembly[] ò;
|
|
internal Assembly \u0081\u00BD;
|
|
internal string \u0082\u00B4;
|
|
|
|
private static unsafe byte* Ô(Assembly _param0) => (byte*) Marshal.GetHINSTANCE(_param0.GetLoadedModules()[0]).ToPointer();
|
|
|
|
internal RuntimeInterop() => this.ò = new Assembly[0];
|
|
|
|
internal unsafe Assembly \u0081â(IntPtr _param1)
|
|
{
|
|
int id = AppDomain.CurrentDomain.Id;
|
|
byte* numPtr = (byte*) \u0082\u00BB.\u00B7(_param1.ToPointer());
|
|
if ((IntPtr) numPtr == IntPtr.Zero)
|
|
return (Assembly) null;
|
|
IntPtr ptr = (IntPtr) (void*) numPtr;
|
|
_param1 = ptr;
|
|
int num1 = Marshal.ReadInt32(ptr);
|
|
int length1 = Marshal.ReadInt32(_param1, 4);
|
|
int length2 = Marshal.ReadInt32(_param1, 8);
|
|
IntPtr source1 = (IntPtr) (void*) (numPtr + 12);
|
|
IntPtr source2 = (IntPtr) (void*) (numPtr + length1 + 12);
|
|
byte[] numArray = new byte[length1];
|
|
byte[] destination = numArray;
|
|
int length3 = length1;
|
|
Marshal.Copy(source1, destination, 0, length3);
|
|
Assembly assembly;
|
|
if (length2 != 0)
|
|
{
|
|
byte[] rawSymbolStore = new byte[length2];
|
|
Marshal.Copy(source2, numArray, 0, length2);
|
|
assembly = Assembly.Load(numArray, rawSymbolStore);
|
|
}
|
|
else
|
|
assembly = Assembly.Load(numArray);
|
|
Marshal.FreeCoTaskMem(_param1);
|
|
if ((object) assembly != null && num1 >= 0)
|
|
{
|
|
Type[] types = assembly.GetTypes();
|
|
IntPtr num2 = types[types.Length - 1].TypeHandle.Value;
|
|
\u0082\u00BB.\u0081\u0081((byte*) Marshal.GetHINSTANCE(assembly.GetLoadedModules()[0]).ToPointer(), num2.ToPointer(), num1, id);
|
|
}
|
|
return assembly;
|
|
}
|
|
|
|
internal static unsafe void Î(Assembly _param0)
|
|
{
|
|
string assemblyString = PvLogiciels.dotNetProtector.Runtime.GetAssemblyString(_param0);
|
|
IntPtr ptr = IntPtr.Zero;
|
|
if (assemblyString != (string) null)
|
|
ptr = Marshal.StringToCoTaskMemAnsi(assemblyString);
|
|
\u0082\u00BB.\u0081\u0081((byte*) Marshal.GetHINSTANCE(_param0.GetLoadedModules()[0]).ToPointer(), (void*) 0, (int*) 0, (sbyte*) ptr.ToPointer(), AppDomain.CurrentDomain.Id);
|
|
if (!(ptr != IntPtr.Zero))
|
|
return;
|
|
Marshal.FreeCoTaskMem(ptr);
|
|
}
|
|
|
|
public virtual Assembly GetEntryAssembly()
|
|
{
|
|
if ((object) \u0081ê.\u0081\u0099 != null)
|
|
return \u0081ê.\u0081\u0099;
|
|
Assembly entryAssembly = Assembly.GetEntryAssembly();
|
|
if ((object) entryAssembly != null)
|
|
{
|
|
\u0081ê.\u0081\u0099 = entryAssembly;
|
|
return entryAssembly;
|
|
}
|
|
Assembly executingAssembly = Assembly.GetExecutingAssembly();
|
|
if (executingAssembly.FullName.StartsWith("PvLogiciels.dotNetProtector.Runtime"))
|
|
return (Assembly) null;
|
|
\u0081ê.\u0081\u0099 = executingAssembly;
|
|
return executingAssembly;
|
|
}
|
|
|
|
public static IRuntime InitRuntime()
|
|
{
|
|
RuntimeInterop runtimeInterop = new RuntimeInterop();
|
|
if (AppDomain.CurrentDomain.IsDefaultAppDomain())
|
|
{
|
|
AppDomain.CurrentDomain.ProcessExit += new EventHandler(RuntimeInterop.AppDomain_ProcessExit);
|
|
return (IRuntime) runtimeInterop;
|
|
}
|
|
AppDomain.CurrentDomain.DomainUnload += new EventHandler(new \u0081Þ(AppDomain.CurrentDomain, AppDomain.CurrentDomain.Id).\u0081\u0084);
|
|
return (IRuntime) runtimeInterop;
|
|
}
|
|
|
|
public static void AppDomain_ProcessExit(object sender, EventArgs e)
|
|
{
|
|
GC.Collect();
|
|
GC.WaitForPendingFinalizers();
|
|
\u0082\u00BB.\u0081\u0086();
|
|
}
|
|
|
|
public virtual void NGenInitRuntime()
|
|
{
|
|
}
|
|
|
|
public virtual ulong GetComputerHash() => \u0082\u00BB.\u0081\u008C();
|
|
|
|
public virtual long GetMacAddress() => \u0082\u00BB.Ç();
|
|
|
|
public virtual ulong GetBiosHash() => \u0082\u00BB.Ï();
|
|
|
|
public virtual int UnloadDomain() => \u0082\u00BB.\u0095(AppDomain.CurrentDomain.Id);
|
|
|
|
public virtual unsafe int InitModule(Type pReserved1, IntPtr pReserved2, string Reserved3)
|
|
{
|
|
IntPtr ptr = IntPtr.Zero;
|
|
if (Reserved3 != (string) null)
|
|
ptr = Marshal.StringToCoTaskMemAnsi(Reserved3);
|
|
IntPtr num1 = pReserved1.TypeHandle.Value;
|
|
int num2 = \u0082\u00BB.\u0081\u0081((byte*) Marshal.GetHINSTANCE(pReserved1.Assembly.GetLoadedModules()[0]).ToPointer(), num1.ToPointer(), (int*) pReserved2.ToPointer(), (sbyte*) ptr.ToPointer(), AppDomain.CurrentDomain.Id);
|
|
if (ptr != IntPtr.Zero)
|
|
Marshal.FreeCoTaskMem(ptr);
|
|
if (num2 == 2)
|
|
{
|
|
this.\u0081\u00BD = pReserved1.Assembly;
|
|
this.\u0082\u00B4 = pReserved1.Assembly.GetName().Name;
|
|
int length = \u0082\u00BB.\u0081\u009B();
|
|
if (length != 0)
|
|
{
|
|
this.ò = new Assembly[length];
|
|
int index = 0;
|
|
if (0 < length)
|
|
{
|
|
do
|
|
{
|
|
this.ò[index] = (Assembly) null;
|
|
++index;
|
|
}
|
|
while (index < length);
|
|
}
|
|
}
|
|
}
|
|
return num2;
|
|
}
|
|
|
|
public virtual unsafe string DesignLicenseKey(Type pReserved1, string pReserved2)
|
|
{
|
|
IntPtr ptr = Marshal.AllocCoTaskMem(IntPtr.Size);
|
|
IntPtr coTaskMemAnsi = Marshal.StringToCoTaskMemAnsi(pReserved2);
|
|
\u0082\u00BB.Ý((byte*) Marshal.GetHINSTANCE(pReserved1.Assembly.GetLoadedModules()[0]).ToPointer(), (sbyte*) coTaskMemAnsi.ToPointer(), (sbyte**) ptr.ToPointer());
|
|
IntPtr num = Marshal.ReadIntPtr(ptr);
|
|
string str = (string) null;
|
|
if (num != IntPtr.Zero)
|
|
{
|
|
string stringAnsi = Marshal.PtrToStringAnsi(num);
|
|
Marshal.FreeHGlobal(num);
|
|
str = stringAnsi;
|
|
}
|
|
Marshal.FreeCoTaskMem(ptr);
|
|
if (!(coTaskMemAnsi != IntPtr.Zero))
|
|
return str;
|
|
Marshal.FreeCoTaskMem(coTaskMemAnsi);
|
|
return str;
|
|
}
|
|
|
|
[return: MarshalAs(UnmanagedType.U1)]
|
|
public virtual unsafe bool SameSoftware(Assembly pReserved, IntPtr pSoft, ulong SwMajor)
|
|
{
|
|
int num;
|
|
if (\u0082\u00BB.\u0081\u00A5((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), (sbyte*) pSoft.ToPointer(), SwMajor, &num) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return num != 0;
|
|
}
|
|
|
|
[return: MarshalAs(UnmanagedType.U1)]
|
|
public virtual unsafe bool IsLicensed(Assembly pReserved, string licenseKey, [MarshalAs(UnmanagedType.U1)] bool usb)
|
|
{
|
|
IntPtr coTaskMemAnsi = Marshal.StringToCoTaskMemAnsi(licenseKey);
|
|
int num1 = usb ? 1 : 0;
|
|
int num2 = \u0082\u00BB.\u0081ª((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), (sbyte*) coTaskMemAnsi.ToPointer(), num1);
|
|
if (coTaskMemAnsi != IntPtr.Zero)
|
|
Marshal.FreeCoTaskMem(coTaskMemAnsi);
|
|
return num2 != 0;
|
|
}
|
|
|
|
public virtual unsafe int HardwareScore(Assembly pReserved, ulong HwConfig1, ulong HwConfig2)
|
|
{
|
|
int num;
|
|
if (\u0082\u00BB.\u00A1((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), HwConfig1, HwConfig2, &num) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return num;
|
|
}
|
|
|
|
public virtual unsafe IntPtr GenProductKey(
|
|
Assembly pReserved,
|
|
IntPtr pKeys,
|
|
uint LicenseID,
|
|
ulong data)
|
|
{
|
|
sbyte* numPtr;
|
|
if (\u0082\u00BB.\u0081µ((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), pKeys.ToPointer(), LicenseID, data, &numPtr) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) numPtr;
|
|
}
|
|
|
|
public virtual unsafe IntPtr GenProductKey(
|
|
Assembly pReserved,
|
|
IntPtr pKeys,
|
|
uint LicenseID)
|
|
{
|
|
sbyte* numPtr;
|
|
if (\u0082\u00BB.\u0081µ((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), pKeys.ToPointer(), LicenseID, &numPtr) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) numPtr;
|
|
}
|
|
|
|
public virtual unsafe uint GetLicenseId(Assembly pReserved, IntPtr pProductKey)
|
|
{
|
|
uint licenseId;
|
|
if (\u0082\u00BB.\u0081\u00BC((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), (sbyte*) pProductKey.ToPointer(), &licenseId) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return licenseId;
|
|
}
|
|
|
|
public virtual unsafe ulong GetProductkeyData(Assembly pReserved, IntPtr pProductKey)
|
|
{
|
|
uint num;
|
|
ulong productkeyData;
|
|
if (\u0082\u00BB.\u0081\u00BC((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), (sbyte*) pProductKey.ToPointer(), &num, &productkeyData) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return productkeyData;
|
|
}
|
|
|
|
public virtual unsafe IntPtr DecodeActivationString(
|
|
Assembly pReserved,
|
|
IntPtr pKeys,
|
|
IntPtr pActivationString)
|
|
{
|
|
byte* numPtr;
|
|
if (\u0082\u00BB.\u0081Ä((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), pKeys.ToPointer(), (sbyte*) pActivationString.ToPointer(), &numPtr) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) numPtr;
|
|
}
|
|
|
|
public virtual unsafe IntPtr EncodeActivationRequest(Assembly pReserved, IntPtr preq)
|
|
{
|
|
sbyte* numPtr;
|
|
if (\u0082\u00BB.Ã((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), preq.ToPointer(), &numPtr) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) numPtr;
|
|
}
|
|
|
|
public virtual unsafe IntPtr GetConfig(
|
|
Assembly pReserved,
|
|
uint LicenseID,
|
|
ushort ActivationDuration)
|
|
{
|
|
sbyte* config;
|
|
if (\u0082\u00BB.\u0081Ñ((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), LicenseID, ActivationDuration, &config) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) config;
|
|
}
|
|
|
|
public virtual unsafe IntPtr GetConfig(
|
|
Assembly pReserved,
|
|
uint LicenseID,
|
|
ushort ActivationDuration,
|
|
IntPtr pAssemblyFile)
|
|
{
|
|
sbyte* config;
|
|
if (\u0082\u00BB.\u0081Ñ((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), LicenseID, ActivationDuration, (sbyte*) pAssemblyFile.ToPointer(), &config) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) config;
|
|
}
|
|
|
|
public virtual unsafe IntPtr GetConfig(
|
|
Assembly pReserved,
|
|
uint LicenseID,
|
|
ushort ActivationDuration,
|
|
AssemblyName Name)
|
|
{
|
|
string name = Name.Name;
|
|
byte[] bytes = Encoding.UTF8.GetBytes(string.Concat((object) "\0"));
|
|
GCHandle gcHandle = GCHandle.Alloc((object) bytes, GCHandleType.Pinned);
|
|
IntPtr num1 = Marshal.UnsafeAddrOfPinnedArrayElement((Array) bytes, 0);
|
|
sbyte* config;
|
|
int num2 = \u0082\u00BB.\u0081Ñ((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), LicenseID, ActivationDuration, (byte*) num1.ToPointer(), (ushort) Name.Version.Major, (ushort) Name.Version.Minor, &config);
|
|
gcHandle.Free();
|
|
if (num2 == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) config;
|
|
}
|
|
|
|
public virtual unsafe string GetThumbPrint(Assembly pReserved)
|
|
{
|
|
\u0081Ï ï;
|
|
if (\u0082\u00BB.\u0081\u00D7((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), (byte*) &ï) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
int num = 0;
|
|
do
|
|
{
|
|
// ISSUE: cast to a reference type
|
|
// ISSUE: explicit reference operation
|
|
stringBuilder.Append(string.Format("{0:x}", (object) ^(byte&) (num + (IntPtr) &ï)).PadLeft(2, '0'));
|
|
++num;
|
|
}
|
|
while (num < 20);
|
|
return stringBuilder.ToString();
|
|
}
|
|
|
|
public virtual unsafe byte[] GetConfigForDemo(Assembly pReserved)
|
|
{
|
|
uint length;
|
|
byte* numPtr;
|
|
if (\u0082\u00BB.\u0081\u00B4((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), &length, &numPtr) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
byte[] destination = new byte[(int) length];
|
|
IntPtr num = (IntPtr) (void*) numPtr;
|
|
Marshal.Copy(num, destination, 0, (int) length);
|
|
Marshal.FreeCoTaskMem(num);
|
|
return destination;
|
|
}
|
|
|
|
public virtual unsafe IntPtr GetUsbConfig(
|
|
Assembly pReserved,
|
|
uint LicenseID,
|
|
ushort ActivationDuration,
|
|
ulong UsbHash,
|
|
ulong UsbIdentity)
|
|
{
|
|
sbyte* usbConfig;
|
|
if (\u0082\u00BB.\u0081è((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), LicenseID, ActivationDuration, UsbHash, UsbIdentity, &usbConfig) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) usbConfig;
|
|
}
|
|
|
|
public virtual unsafe IntPtr GetUsbConfig(
|
|
Assembly pReserved,
|
|
uint LicenseID,
|
|
ushort ActivationDuration,
|
|
ulong UsbHash,
|
|
ulong UsbIdentity,
|
|
IntPtr pAssemblyFile)
|
|
{
|
|
sbyte* usbConfig;
|
|
if (\u0082\u00BB.\u0081è((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), LicenseID, ActivationDuration, UsbHash, UsbIdentity, (sbyte*) pAssemblyFile.ToPointer(), &usbConfig) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) usbConfig;
|
|
}
|
|
|
|
public virtual unsafe IntPtr GetUsbConfig(
|
|
Assembly pReserved,
|
|
uint LicenseID,
|
|
ushort ActivationDuration,
|
|
ulong UsbHash,
|
|
ulong UsbIdentity,
|
|
AssemblyName Name)
|
|
{
|
|
string name = Name.Name;
|
|
byte[] bytes = Encoding.UTF8.GetBytes(string.Concat((object) "\0"));
|
|
GCHandle gcHandle = GCHandle.Alloc((object) bytes, GCHandleType.Pinned);
|
|
IntPtr num1 = Marshal.UnsafeAddrOfPinnedArrayElement((Array) bytes, 0);
|
|
sbyte* usbConfig;
|
|
int num2 = \u0082\u00BB.\u0081è((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), LicenseID, ActivationDuration, UsbHash, UsbIdentity, (byte*) num1.ToPointer(), (ushort) Name.Version.Major, (ushort) Name.Version.Minor, &usbConfig);
|
|
gcHandle.Free();
|
|
if (num2 == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) usbConfig;
|
|
}
|
|
|
|
public virtual unsafe IntPtr GenerateLicense(
|
|
Assembly pReserved,
|
|
IntPtr pKeys,
|
|
IntPtr preq)
|
|
{
|
|
sbyte* license;
|
|
if (\u0082\u00BB.\u0081ð((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), pKeys.ToPointer(), preq.ToPointer(), &license) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) license;
|
|
}
|
|
|
|
public virtual unsafe IntPtr GenerateLicense(
|
|
Assembly pReserved,
|
|
IntPtr pKeys,
|
|
IntPtr preq,
|
|
int tolerance,
|
|
[MarshalAs(UnmanagedType.U1)] bool ignoreMinor,
|
|
long RuntimeLicensesLimit)
|
|
{
|
|
sbyte* license;
|
|
if (\u0082\u00BB.\u0081ð((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), pKeys.ToPointer(), preq.ToPointer(), tolerance, ignoreMinor ? 1 : 0, RuntimeLicensesLimit, &license) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) license;
|
|
}
|
|
|
|
public virtual unsafe IntPtr GenerateUsbLicense(
|
|
Assembly pReserved,
|
|
IntPtr pKeys,
|
|
IntPtr preq)
|
|
{
|
|
sbyte* usbLicense;
|
|
if (\u0082\u00BB.\u0081\u00AC((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), pKeys.ToPointer(), preq.ToPointer(), &usbLicense, (byte) 0) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) usbLicense;
|
|
}
|
|
|
|
public virtual unsafe IntPtr GenerateUsbLicense(
|
|
Assembly pReserved,
|
|
IntPtr pKeys,
|
|
IntPtr preq,
|
|
int tolerance,
|
|
[MarshalAs(UnmanagedType.U1)] bool ignoreMinor,
|
|
long RuntimeLicensesLimit)
|
|
{
|
|
sbyte* usbLicense;
|
|
if (\u0082\u00BB.\u0081\u00AC((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), pKeys.ToPointer(), preq.ToPointer(), tolerance, ignoreMinor ? 1 : 0, RuntimeLicensesLimit, &usbLicense, (byte) 0) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return (IntPtr) (void*) usbLicense;
|
|
}
|
|
|
|
public virtual unsafe Assembly ResolveAssembly(string Name)
|
|
{
|
|
// ISSUE: untyped stack allocation
|
|
int num1 = (int) __untypedstackalloc(\u0082\u00BB.Õ());
|
|
try
|
|
{
|
|
AssemblyName assemblyName = new AssemblyName(Name);
|
|
}
|
|
catch (Exception ex1) when (
|
|
{
|
|
// ISSUE: unable to correctly present filter
|
|
uint exceptionCode = (uint) Marshal.GetExceptionCode();
|
|
if (\u0082\u00BB.\u0082\u00AE((void*) Marshal.GetExceptionPointers(), (void*) 0, 0, (void*) 0) != 0)
|
|
{
|
|
SuccessfulFiltering;
|
|
}
|
|
else
|
|
throw;
|
|
}
|
|
)
|
|
{
|
|
uint num2 = 0;
|
|
\u0082\u00BB.\u0081\u009A((void*) Marshal.GetExceptionPointers(), (void*) num1);
|
|
try
|
|
{
|
|
try
|
|
{
|
|
return (Assembly) null;
|
|
}
|
|
catch (Exception ex2) when (
|
|
{
|
|
// ISSUE: unable to correctly present filter
|
|
num2 = (uint) \u0082\u00BB.\u0084((void*) Marshal.GetExceptionPointers());
|
|
if (num2 != 0U)
|
|
{
|
|
SuccessfulFiltering;
|
|
}
|
|
else
|
|
throw;
|
|
}
|
|
)
|
|
{
|
|
}
|
|
if (num2 != 0U)
|
|
throw;
|
|
}
|
|
finally
|
|
{
|
|
\u0082\u00BB.ã((void*) num1, (int) num2);
|
|
}
|
|
}
|
|
byte[] bytes = Encoding.UTF8.GetBytes(Name);
|
|
GCHandle gcHandle = GCHandle.Alloc((object) bytes, GCHandleType.Pinned);
|
|
IntPtr num3 = Marshal.UnsafeAddrOfPinnedArrayElement((Array) bytes, 0);
|
|
int index = \u0082\u00BB.\u0082\u0082(num3.ToPointer());
|
|
if (index >= 0)
|
|
{
|
|
Assembly[] ò = this.ò;
|
|
if (index < ò.Length)
|
|
{
|
|
if ((object) ò[index] == null)
|
|
this.ò[index] = this.\u0081â(num3);
|
|
gcHandle.Free();
|
|
return this.ò[index];
|
|
}
|
|
}
|
|
gcHandle.Free();
|
|
return new AssemblyName(Name).Name == this.\u0082\u00B4 ? this.\u0081\u00BD : (Assembly) null;
|
|
}
|
|
|
|
public virtual int ExecuteEmbLockAssembly(Type pReserved1, int Reserved2) => \u0081Ù.\u0081Ö(pReserved1.Assembly, Reserved2);
|
|
|
|
public virtual unsafe Assembly GetEmbLockAssembly(Type pReserved1)
|
|
{
|
|
byte* numPtr = (byte*) \u0082\u00BB.î((byte*) Marshal.GetHINSTANCE(pReserved1.Assembly.GetLoadedModules()[0]).ToPointer());
|
|
if ((IntPtr) numPtr == IntPtr.Zero)
|
|
return (Assembly) null;
|
|
IntPtr ptr = (IntPtr) (void*) numPtr;
|
|
int length1 = Marshal.ReadInt32(ptr);
|
|
IntPtr source = (IntPtr) (void*) (numPtr + 4);
|
|
byte[] rawAssembly = new byte[length1];
|
|
byte[] destination = rawAssembly;
|
|
int length2 = length1;
|
|
Marshal.Copy(source, destination, 0, length2);
|
|
Assembly embLockAssembly = Assembly.Load(rawAssembly);
|
|
Marshal.FreeCoTaskMem(ptr);
|
|
return embLockAssembly;
|
|
}
|
|
|
|
public virtual unsafe Assembly GetEmbLockAssemblyName(Type pReserved1)
|
|
{
|
|
byte* numPtr = (byte*) \u0082\u00BB.ô((byte*) Marshal.GetHINSTANCE(pReserved1.Assembly.GetLoadedModules()[0]).ToPointer());
|
|
if ((IntPtr) numPtr == IntPtr.Zero)
|
|
return (Assembly) null;
|
|
IntPtr ptr = (IntPtr) (void*) numPtr;
|
|
string stringAnsi = Marshal.PtrToStringAnsi(ptr);
|
|
Marshal.FreeCoTaskMem(ptr);
|
|
Assembly lockAssemblyName = (Assembly) null;
|
|
try
|
|
{
|
|
lockAssemblyName = Assembly.Load(stringAnsi);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
}
|
|
return lockAssemblyName;
|
|
}
|
|
|
|
public virtual unsafe ArrayList GetEmbLockAssemblyServices(Type pReserved1)
|
|
{
|
|
byte* ptr1 = (byte*) \u0082\u00BB.\u0082\u008B((byte*) Marshal.GetHINSTANCE(pReserved1.Assembly.GetLoadedModules()[0]).ToPointer());
|
|
if ((IntPtr) ptr1 == IntPtr.Zero)
|
|
return (ArrayList) null;
|
|
IntPtr ptr2 = (IntPtr) (void*) ptr1;
|
|
ArrayList assemblyServices = new ArrayList();
|
|
if (*ptr1 != (byte) 0)
|
|
{
|
|
do
|
|
{
|
|
string stringAnsi = Marshal.PtrToStringAnsi((IntPtr) (void*) ptr1);
|
|
assemblyServices.Add((object) stringAnsi);
|
|
ptr1 = (byte*) (stringAnsi.Length + (IntPtr) ptr1 + 1);
|
|
}
|
|
while (*ptr1 != (byte) 0);
|
|
}
|
|
Marshal.FreeCoTaskMem(ptr2);
|
|
return assemblyServices;
|
|
}
|
|
|
|
[return: MarshalAs(UnmanagedType.U1)]
|
|
public virtual unsafe bool ProductKeyChecksumIsOk(Assembly pReserved, IntPtr pString)
|
|
{
|
|
int num;
|
|
if (\u0082\u00BB.\u0082\u0096((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), (sbyte*) pString.ToPointer(), &num) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return num != 0;
|
|
}
|
|
|
|
[return: MarshalAs(UnmanagedType.U1)]
|
|
public virtual unsafe bool ConfigStringChecksumIsOk(Assembly pReserved, IntPtr pString)
|
|
{
|
|
int num;
|
|
if (\u0082\u00BB.\u0082\u00A1((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), (sbyte*) pString.ToPointer(), &num) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return num != 0;
|
|
}
|
|
|
|
[return: MarshalAs(UnmanagedType.U1)]
|
|
public virtual unsafe bool LicenseKeyChecksumIsOk(Assembly pReserved, IntPtr pString)
|
|
{
|
|
int num;
|
|
if (\u0082\u00BB.\u0081Ø((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), (sbyte*) pString.ToPointer(), &num) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return num != 0;
|
|
}
|
|
|
|
[return: MarshalAs(UnmanagedType.U1)]
|
|
public virtual unsafe bool IsDemo(Assembly pReserved)
|
|
{
|
|
int num;
|
|
if (\u0082\u00BB.\u0082\u00AB((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), &num) == 0)
|
|
throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
return num != 0;
|
|
}
|
|
|
|
public virtual unsafe int DaysLeft(Assembly pReserved)
|
|
{
|
|
int num;
|
|
return \u0082\u00BB.\u0082\u00AF((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), &num) != 0 ? num : throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
}
|
|
|
|
public virtual unsafe int MinutesLeft(Assembly pReserved)
|
|
{
|
|
int num;
|
|
return \u0082\u00BB.\u0082\u00B9((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), &num) != 0 ? num : throw new LicenseException(typeof (PvLogiciels.dotNetProtector.Runtime));
|
|
}
|
|
|
|
public virtual unsafe uint GetProductID(Assembly pReserved) => \u0082\u00BB.\u0082((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer());
|
|
|
|
public virtual void UnloadAppdomain(AppDomain domain)
|
|
{
|
|
int id = domain.Id;
|
|
AppDomain.Unload(domain);
|
|
\u0082\u00BB.\u0095(id);
|
|
}
|
|
|
|
public virtual unsafe IntPtr StartUsbDetect() => (IntPtr) \u0082\u00BB.\u0081ø();
|
|
|
|
public virtual unsafe void EndUsbDetect(IntPtr handle) => \u0082\u00BB.\u008B(handle.ToPointer());
|
|
|
|
public virtual unsafe IntPtr LoadNativeLibrary(Assembly pReserved, IntPtr[] pointers)
|
|
{
|
|
GCHandle gcHandle = GCHandle.Alloc((object) pointers, GCHandleType.Pinned);
|
|
IntPtr num1 = Marshal.UnsafeAddrOfPinnedArrayElement((Array) pointers, 0);
|
|
IntPtr num2 = (IntPtr) \u0082\u00BB.\u0082\u0087((byte*) Marshal.GetHINSTANCE(pReserved.GetLoadedModules()[0]).ToPointer(), (void**) num1.ToPointer());
|
|
gcHandle.Free();
|
|
return num2;
|
|
}
|
|
|
|
public virtual unsafe void FreeNativeLibrary(IntPtr pLib) => \u0082\u00BB.\u0096(pLib.ToPointer());
|
|
|
|
public virtual StackFrame[] GetFrames(StackTrace trace) => trace == null ? new StackFrame[0] : trace.GetFrames();
|
|
|
|
public virtual unsafe void EncodeTrace(Guid[] Guids, long[] Indexes, IntPtr[] Handles)
|
|
{
|
|
GCHandle gcHandle1 = GCHandle.Alloc((object) Guids, GCHandleType.Pinned);
|
|
GCHandle gcHandle2 = GCHandle.Alloc((object) Indexes, GCHandleType.Pinned);
|
|
GCHandle gcHandle3 = GCHandle.Alloc((object) Handles, GCHandleType.Pinned);
|
|
IntPtr num1 = Marshal.UnsafeAddrOfPinnedArrayElement((Array) Guids, 0);
|
|
IntPtr num2 = Marshal.UnsafeAddrOfPinnedArrayElement((Array) Indexes, 0);
|
|
IntPtr num3 = Marshal.UnsafeAddrOfPinnedArrayElement((Array) Handles, 0);
|
|
\u0082\u00BB.\u0098(Handles.Length, num3.ToPointer(), num2.ToPointer(), num1.ToPointer());
|
|
gcHandle1.Free();
|
|
gcHandle2.Free();
|
|
gcHandle3.Free();
|
|
}
|
|
}
|
|
}
|