-
-
[求助]这个是新版的MAXTOCODE吗
-
发表于: 2012-6-10 21:02 5483
-
这个是新版的MAXTOCODE吗
internal interface LoveBaby_interface
{
}
public enum MachineClass
{
UNKNOW,
X86,
AMD64,
IA64
}
private static bool started = false;
private static IntPtr AppImageBase = IntPtr.Zero;
private static int ImportRuntimeSize = 65535;
[DllImport("KERNEL32.DLL", CharSet = CharSet.Ansi, EntryPoint = "GetModuleHandleA", ExactSpelling = true, SetLastError = true)]
private static extern IntPtr GetModuleHandle(string lpModuleName);
[DllImport("KERNEL32.DLL", CharSet = CharSet.Ansi, EntryPoint = "SetEnvironmentVariableA", ExactSpelling = true, SetLastError = true)]
private static extern bool SetEnvironmentVariable(string lpName, string lpValue);
[DllImport("SuperStar.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
private static extern int CheckRuntime(IntPtr ImageBase);
[DllImport("SuperStar.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
private static extern bool MainDLL(IntPtr RuntimeBase, IntPtr AppBase);
[DllImport("SuperStar.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
private static extern IntPtr GetModuleBase(string lpModuleName);
[DllImport("SuperStar.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
private static extern IntPtr EncryptString(IntPtr ImageBase, int Stringid);
[DllImport("SuperStar64.dll", CharSet = CharSet.Unicode, EntryPoint = "CheckRuntime", ExactSpelling = true, SetLastError = true)]
private static extern int CheckRuntime64(IntPtr ImageBase);
[DllImport("SuperStar64.dll", CharSet = CharSet.Ansi, EntryPoint = "MainDLL", ExactSpelling = true, SetLastError = true)]
private static extern bool MainDLL64(IntPtr RuntimeBase, IntPtr AppBase);
[DllImport("SuperStar64.dll", CharSet = CharSet.Ansi, EntryPoint = "GetModuleBase", ExactSpelling = true, SetLastError = true)]
private static extern IntPtr GetModuleBase64(string lpModuleName);
[DllImport("SuperStar64.dll", CharSet = CharSet.Ansi, EntryPoint = "EncryptString", ExactSpelling = true, SetLastError = true)]
private static extern IntPtr EncryptString64(IntPtr ImageBase, int Stringid);
private static string ByteToString(byte[] inbuf)
{
return Encoding.ASCII.GetString(inbuf);
}
private static string ByteToString(byte[] inbuf, int Index, int Count)
{
return Encoding.ASCII.GetString(inbuf, Index, Count);
}
private static string GetRuntimeName()
{
return LoveBaby.ByteToString(new byte[]
{
83,
117,
112,
101,
114,
83,
116,
97,
114,
46,
100,
108,
108
});
}
public static void Startup()
{
if (!LoveBaby.started)
{
LoveBaby.ImportRuntime(AppDomain.CurrentDomain.BaseDirectory);
LoveBaby.LoadRuntimes();
}
}
private static bool ImportRuntime(string bpath)
{
byte[] array = new byte[12];
array[0] = 47;
array[1] = 58;
array[2] = 59;
array[3] = 92;
array[4] = 112;
array[5] = 97;
array[6] = 116;
array[7] = 104;
array[8] = 0;
bool result;
try
{
string runtimeName = LoveBaby.GetRuntimeName();
string location = Assembly.GetExecutingAssembly().Location;
string text;
if (bpath.Substring(bpath.Length - 1, 1) == LoveBaby.ByteToString(array, 3, 1))
{
text = bpath;
}
else
{
text = bpath + LoveBaby.ByteToString(array, 3, 1);
}
string text2 = text;
if (!File.Exists(text2 + runtimeName))
{
try
{
byte[] buffer = new byte[LoveBaby.ImportRuntimeSize + 1];
FileStream fileStream = new FileStream(location, FileMode.Open, FileAccess.Read, FileShare.Read);
int num = (int)fileStream.Length - LoveBaby.ImportRuntimeSize;
fileStream.Seek((long)num, SeekOrigin.Begin);
fileStream.Read(buffer, 0, LoveBaby.ImportRuntimeSize);
fileStream.Close();
FileStream fileStream2 = new FileStream(text2 + runtimeName, FileMode.Create, FileAccess.Write, FileShare.Write);
fileStream2.Seek(0L, SeekOrigin.Begin);
fileStream2.Write(buffer, 0, LoveBaby.ImportRuntimeSize);
fileStream2.Close();
}
catch
{
text = Path.GetTempPath();
if (text.Substring(text.Length - 1, 1) == LoveBaby.ByteToString(array, 3, 1))
{
text2 = text;
}
else
{
text2 = text + LoveBaby.ByteToString(array, 3, 1);
}
string environmentVariable = Environment.GetEnvironmentVariable(LoveBaby.ByteToString(array, 4, 4));
if (environmentVariable.IndexOf(text2) == -1)
{
LoveBaby.SetEnvironmentVariable(LoveBaby.ByteToString(array, 4, 4), environmentVariable + LoveBaby.ByteToString(array, 1, 1) + text2.Replace(LoveBaby.ByteToString(array, 0, 1), LoveBaby.ByteToString(array, 3, 1)));
}
if (!File.Exists(text2 + runtimeName))
{
byte[] buffer2 = new byte[LoveBaby.ImportRuntimeSize + 1];
FileStream fileStream3 = new FileStream(location, FileMode.Open, FileAccess.Read, FileShare.Read);
int num2 = (int)fileStream3.Length - LoveBaby.ImportRuntimeSize;
fileStream3.Seek((long)num2, SeekOrigin.Begin);
fileStream3.Read(buffer2, 0, LoveBaby.ImportRuntimeSize);
fileStream3.Close();
FileStream fileStream4 = new FileStream(text2 + runtimeName, FileMode.Create, FileAccess.Write, FileShare.Write);
fileStream4.Seek(0L, SeekOrigin.Begin);
fileStream4.Write(buffer2, 0, LoveBaby.ImportRuntimeSize);
fileStream4.Close();
}
}
}
result = true;
}
catch
{
result = false;
}
return result;
}
public static string GetString(uint stringid)
{
string result = "";
if (IntPtr.Size == 4)
{
result = Marshal.PtrToStringAnsi(LoveBaby.EncryptString(LoveBaby.AppImageBase, (int)stringid));
}
else
{
result = Marshal.PtrToStringAnsi(LoveBaby.EncryptString64(LoveBaby.AppImageBase, (int)stringid));
}
return result;
}
private static void LoadRuntimes()
{
IntPtr intPtr = IntPtr.Zero;
if (!LoveBaby.started)
{
LoveBaby.started = true;
LoveBaby.MachineClass machineClass;
if (IntPtr.Size != 4)
{
machineClass = LoveBaby.MachineClass.IA64;
}
else
{
machineClass = LoveBaby.MachineClass.X86;
}
string text = Assembly.GetExecutingAssembly().Location;
if (text == "")
{
text = "sina.exe";
}
intPtr = LoveBaby.GetModuleHandle(text);
if (intPtr == IntPtr.Zero)
{
if (machineClass == LoveBaby.MachineClass.X86)
{
intPtr = LoveBaby.GetModuleBase("sina.exe");
}
else
{
intPtr = LoveBaby.GetModuleBase64("sina.exe");
}
}
if (intPtr == IntPtr.Zero)
{
throw new Exception("Not find manager image of memory, Program exception !");
}
LoveBaby.AppImageBase = intPtr;
string runtimeName = LoveBaby.GetRuntimeName();
int num = 5;
if (machineClass == LoveBaby.MachineClass.X86)
{
num = LoveBaby.CheckRuntime(intPtr);
}
else
{
num = LoveBaby.CheckRuntime64(intPtr);
}
if (num != 0)
{
string message = "UNKWON ERROR";
switch (num)
{
case 1:
{
message = "Not find Framework Runtime, Please check you Framework!\n\r";
break;
}
case 2:
{
message = "The Frmaework version is not support, please update your framework or restart setup .NET framework\n\rPlease get a new runtime support to website http://www.maxtocode.com/FrameworkSupport.html\n\r";
break;
}
case 3:
{
message = "The Frmaework version is not support, please update your framework or restart setup .NET framework\n\rPlease get a new runtime support to website http://www.maxtocode.com/FrameworkSupport.html\n\rError Code : 0x0003\n\r";
break;
}
case 4:
{
message = "Maker Decoder Error\n\r";
break;
}
case 5:
{
message = "Imports Runtime DLL is Error\n\r";
break;
}
}
throw new Exception(message);
}
IntPtr moduleHandle = LoveBaby.GetModuleHandle(runtimeName);
if (machineClass == LoveBaby.MachineClass.X86)
{
LoveBaby.started = LoveBaby.MainDLL(moduleHandle, intPtr);
return;
}
if (machineClass == LoveBaby.MachineClass.UNKNOW)
{
LoveBaby.started = LoveBaby.MainDLL(moduleHandle, intPtr);
return;
}
LoveBaby.started = LoveBaby.MainDLL64(moduleHandle, intPtr);
}
}
}
internal interface LoveBaby_interface
{
}
public enum MachineClass
{
UNKNOW,
X86,
AMD64,
IA64
}
private static bool started = false;
private static IntPtr AppImageBase = IntPtr.Zero;
private static int ImportRuntimeSize = 65535;
[DllImport("KERNEL32.DLL", CharSet = CharSet.Ansi, EntryPoint = "GetModuleHandleA", ExactSpelling = true, SetLastError = true)]
private static extern IntPtr GetModuleHandle(string lpModuleName);
[DllImport("KERNEL32.DLL", CharSet = CharSet.Ansi, EntryPoint = "SetEnvironmentVariableA", ExactSpelling = true, SetLastError = true)]
private static extern bool SetEnvironmentVariable(string lpName, string lpValue);
[DllImport("SuperStar.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
private static extern int CheckRuntime(IntPtr ImageBase);
[DllImport("SuperStar.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
private static extern bool MainDLL(IntPtr RuntimeBase, IntPtr AppBase);
[DllImport("SuperStar.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
private static extern IntPtr GetModuleBase(string lpModuleName);
[DllImport("SuperStar.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
private static extern IntPtr EncryptString(IntPtr ImageBase, int Stringid);
[DllImport("SuperStar64.dll", CharSet = CharSet.Unicode, EntryPoint = "CheckRuntime", ExactSpelling = true, SetLastError = true)]
private static extern int CheckRuntime64(IntPtr ImageBase);
[DllImport("SuperStar64.dll", CharSet = CharSet.Ansi, EntryPoint = "MainDLL", ExactSpelling = true, SetLastError = true)]
private static extern bool MainDLL64(IntPtr RuntimeBase, IntPtr AppBase);
[DllImport("SuperStar64.dll", CharSet = CharSet.Ansi, EntryPoint = "GetModuleBase", ExactSpelling = true, SetLastError = true)]
private static extern IntPtr GetModuleBase64(string lpModuleName);
[DllImport("SuperStar64.dll", CharSet = CharSet.Ansi, EntryPoint = "EncryptString", ExactSpelling = true, SetLastError = true)]
private static extern IntPtr EncryptString64(IntPtr ImageBase, int Stringid);
private static string ByteToString(byte[] inbuf)
{
return Encoding.ASCII.GetString(inbuf);
}
private static string ByteToString(byte[] inbuf, int Index, int Count)
{
return Encoding.ASCII.GetString(inbuf, Index, Count);
}
private static string GetRuntimeName()
{
return LoveBaby.ByteToString(new byte[]
{
83,
117,
112,
101,
114,
83,
116,
97,
114,
46,
100,
108,
108
});
}
public static void Startup()
{
if (!LoveBaby.started)
{
LoveBaby.ImportRuntime(AppDomain.CurrentDomain.BaseDirectory);
LoveBaby.LoadRuntimes();
}
}
private static bool ImportRuntime(string bpath)
{
byte[] array = new byte[12];
array[0] = 47;
array[1] = 58;
array[2] = 59;
array[3] = 92;
array[4] = 112;
array[5] = 97;
array[6] = 116;
array[7] = 104;
array[8] = 0;
bool result;
try
{
string runtimeName = LoveBaby.GetRuntimeName();
string location = Assembly.GetExecutingAssembly().Location;
string text;
if (bpath.Substring(bpath.Length - 1, 1) == LoveBaby.ByteToString(array, 3, 1))
{
text = bpath;
}
else
{
text = bpath + LoveBaby.ByteToString(array, 3, 1);
}
string text2 = text;
if (!File.Exists(text2 + runtimeName))
{
try
{
byte[] buffer = new byte[LoveBaby.ImportRuntimeSize + 1];
FileStream fileStream = new FileStream(location, FileMode.Open, FileAccess.Read, FileShare.Read);
int num = (int)fileStream.Length - LoveBaby.ImportRuntimeSize;
fileStream.Seek((long)num, SeekOrigin.Begin);
fileStream.Read(buffer, 0, LoveBaby.ImportRuntimeSize);
fileStream.Close();
FileStream fileStream2 = new FileStream(text2 + runtimeName, FileMode.Create, FileAccess.Write, FileShare.Write);
fileStream2.Seek(0L, SeekOrigin.Begin);
fileStream2.Write(buffer, 0, LoveBaby.ImportRuntimeSize);
fileStream2.Close();
}
catch
{
text = Path.GetTempPath();
if (text.Substring(text.Length - 1, 1) == LoveBaby.ByteToString(array, 3, 1))
{
text2 = text;
}
else
{
text2 = text + LoveBaby.ByteToString(array, 3, 1);
}
string environmentVariable = Environment.GetEnvironmentVariable(LoveBaby.ByteToString(array, 4, 4));
if (environmentVariable.IndexOf(text2) == -1)
{
LoveBaby.SetEnvironmentVariable(LoveBaby.ByteToString(array, 4, 4), environmentVariable + LoveBaby.ByteToString(array, 1, 1) + text2.Replace(LoveBaby.ByteToString(array, 0, 1), LoveBaby.ByteToString(array, 3, 1)));
}
if (!File.Exists(text2 + runtimeName))
{
byte[] buffer2 = new byte[LoveBaby.ImportRuntimeSize + 1];
FileStream fileStream3 = new FileStream(location, FileMode.Open, FileAccess.Read, FileShare.Read);
int num2 = (int)fileStream3.Length - LoveBaby.ImportRuntimeSize;
fileStream3.Seek((long)num2, SeekOrigin.Begin);
fileStream3.Read(buffer2, 0, LoveBaby.ImportRuntimeSize);
fileStream3.Close();
FileStream fileStream4 = new FileStream(text2 + runtimeName, FileMode.Create, FileAccess.Write, FileShare.Write);
fileStream4.Seek(0L, SeekOrigin.Begin);
fileStream4.Write(buffer2, 0, LoveBaby.ImportRuntimeSize);
fileStream4.Close();
}
}
}
result = true;
}
catch
{
result = false;
}
return result;
}
public static string GetString(uint stringid)
{
string result = "";
if (IntPtr.Size == 4)
{
result = Marshal.PtrToStringAnsi(LoveBaby.EncryptString(LoveBaby.AppImageBase, (int)stringid));
}
else
{
result = Marshal.PtrToStringAnsi(LoveBaby.EncryptString64(LoveBaby.AppImageBase, (int)stringid));
}
return result;
}
private static void LoadRuntimes()
{
IntPtr intPtr = IntPtr.Zero;
if (!LoveBaby.started)
{
LoveBaby.started = true;
LoveBaby.MachineClass machineClass;
if (IntPtr.Size != 4)
{
machineClass = LoveBaby.MachineClass.IA64;
}
else
{
machineClass = LoveBaby.MachineClass.X86;
}
string text = Assembly.GetExecutingAssembly().Location;
if (text == "")
{
text = "sina.exe";
}
intPtr = LoveBaby.GetModuleHandle(text);
if (intPtr == IntPtr.Zero)
{
if (machineClass == LoveBaby.MachineClass.X86)
{
intPtr = LoveBaby.GetModuleBase("sina.exe");
}
else
{
intPtr = LoveBaby.GetModuleBase64("sina.exe");
}
}
if (intPtr == IntPtr.Zero)
{
throw new Exception("Not find manager image of memory, Program exception !");
}
LoveBaby.AppImageBase = intPtr;
string runtimeName = LoveBaby.GetRuntimeName();
int num = 5;
if (machineClass == LoveBaby.MachineClass.X86)
{
num = LoveBaby.CheckRuntime(intPtr);
}
else
{
num = LoveBaby.CheckRuntime64(intPtr);
}
if (num != 0)
{
string message = "UNKWON ERROR";
switch (num)
{
case 1:
{
message = "Not find Framework Runtime, Please check you Framework!\n\r";
break;
}
case 2:
{
message = "The Frmaework version is not support, please update your framework or restart setup .NET framework\n\rPlease get a new runtime support to website http://www.maxtocode.com/FrameworkSupport.html\n\r";
break;
}
case 3:
{
message = "The Frmaework version is not support, please update your framework or restart setup .NET framework\n\rPlease get a new runtime support to website http://www.maxtocode.com/FrameworkSupport.html\n\rError Code : 0x0003\n\r";
break;
}
case 4:
{
message = "Maker Decoder Error\n\r";
break;
}
case 5:
{
message = "Imports Runtime DLL is Error\n\r";
break;
}
}
throw new Exception(message);
}
IntPtr moduleHandle = LoveBaby.GetModuleHandle(runtimeName);
if (machineClass == LoveBaby.MachineClass.X86)
{
LoveBaby.started = LoveBaby.MainDLL(moduleHandle, intPtr);
return;
}
if (machineClass == LoveBaby.MachineClass.UNKNOW)
{
LoveBaby.started = LoveBaby.MainDLL(moduleHandle, intPtr);
return;
}
LoveBaby.started = LoveBaby.MainDLL64(moduleHandle, intPtr);
}
}
}
赞赏
看原图
赞赏
雪币:
留言: