Guest User

Untitled

a guest
Dec 22nd, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.17 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.IO;
  5. using WinApi;
  6. using System.Threading;
  7. using Gothic.zClasses;
  8. using Gothic.zTypes;
  9. using WinApi.User;
  10. using WinApi.User.Enumeration;
  11. using Gothic.mClasses;
  12. using Gothic.mClasses.Elements;
  13. using Gothic.zStruct;
  14.  
  15. namespace marvinenabler
  16. {
  17.     public class Program
  18.     {
  19.         public static Int32 InjectedMain(String message)
  20.         {
  21.             try
  22.             {
  23.                 Process Process = Process.ThisProcess();
  24.  
  25.                 AddHooks();
  26.                 MarvinModeEnable();
  27.                 while (true)
  28.                 {
  29.                     Thread.Sleep(10000);
  30.                 }
  31.             }
  32.             catch (System.Exception ex)
  33.             {
  34.                 zERROR.GetZErr(Process.ThisProcess()).Report(4, 'G', ex.ToString(), 0, "Program.cs", 0);
  35.             }
  36.             return 11;
  37.         }
  38.  
  39.         public static void AddHooks()
  40.         {
  41.             Process Process = Process.ThisProcess();
  42.  
  43.             Process.Hook("GUC.dll", typeof(Program).GetMethod("ocGameUpdate"), 0x006C8AB2, 5, 0);
  44.         }
  45.         //(That will add a hook at the end of the render function)
  46.  
  47.         public static Int32 ocGameUpdate(String message)
  48.         {
  49.             Process Process = Process.ThisProcess();
  50.             //each time when gothic renders the game this function will be called
  51.             return 0;
  52.         }
  53.         //Functions
  54.         static byte[] mmenable;
  55.         public static void MarvinModeEnable()
  56.         {
  57.             Process Process = Process.ThisProcess();
  58.             Process.Write(mmenable, 0x006CBF60);
  59.         }
  60.  
  61.         public static void MarvinModeDisable()
  62.         {
  63.             Process Process = Process.ThisProcess();
  64.             Process.VirtualProtect(0x006CBF60, 25);
  65.             mmenable = Process.ReadBytes(0x006CBF60, 25);
  66.             byte[] arr = new byte[25];
  67.             for (int i = 0; i < arr.Length; i++)
  68.                 arr[i] = 0x90;
  69.             Process.Write(arr, 0x006CBF60);
  70.  
  71.  
  72.             arr = new byte[] { 0xC3 };
  73.             Process.Write(arr, 0x00432EC0);//Eventhandle marvin mode
  74.  
  75.  
  76.         }
  77.     }
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment