SHARE
TWEET

Lock/Unlock decorators

Eddlm Oct 25th, 2017 146 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     public unsafe static byte* FindPattern(string pattern, string mask)
  3.     {
  4.         ProcessModule module = Process.GetCurrentProcess().MainModule;
  5.  
  6.         ulong address = (ulong)module.BaseAddress.ToInt64();
  7.         ulong endAddress = address + (ulong)module.ModuleMemorySize;
  8.  
  9.         for (; address < endAddress; address++)
  10.         {
  11.             for (int i = 0; i < pattern.Length; i++)
  12.             {
  13.                 if (mask[i] != '?' && ((byte*)address)[i] != pattern[i])
  14.                 {
  15.                     break;
  16.                 }
  17.                 else if (i + 1 == pattern.Length)
  18.                 {
  19.                     return (byte*)address;
  20.                 }
  21.             }
  22.         }
  23.  
  24.         return null;
  25.     }
  26.     void UnlockDecorator()
  27.     {
  28.  
  29.         unsafe
  30.         {
  31.             IntPtr addr = (IntPtr)FindPattern("\x40\x53\x48\x83\xEC\x20\x80\x3D\x00\x00\x00\x00\x00\x8B\xDA\x75\x29",
  32.                             "xxxxxxxx????xxxxx");
  33.             if (addr != IntPtr.Zero)
  34.             {
  35.                 byte* g_bIsDecorRegisterLockedPtr = (byte*)(addr + *(int*)(addr + 8) + 13);
  36.                 *g_bIsDecorRegisterLockedPtr = 0;
  37.             }
  38.  
  39.         }
  40.     }
  41.     void LockDecotator()
  42.     {
  43.         unsafe
  44.         {
  45.             IntPtr addr = (IntPtr)FindPattern("\x40\x53\x48\x83\xEC\x20\x80\x3D\x00\x00\x00\x00\x00\x8B\xDA\x75\x29",
  46.                             "xxxxxxxx????xxxxx");
  47.             if (addr != IntPtr.Zero)
  48.             {
  49.                 byte* g_bIsDecorRegisterLockedPtr = (byte*)(addr + *(int*)(addr + 8) + 13);
  50.                 *g_bIsDecorRegisterLockedPtr = 1;
  51.             }
  52.  
  53.         }
  54.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top