Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static unsafe void smethod_2(bool ver)
- {
- IntPtr ptr;
- ulong* numPtr2;
- uint num;
- bool_1 = ver;
- string jitdll
- if (ver)
- {
- jitdll = "clrjit.dll";
- }
- else
- {
- jitdll = "mscorjit.dll";
- }
- IntPtr lib = LoadLibrary(jitdll);
- intptr_0 = Marshal.ReadIntPtr(((Delegate4) Marshal.GetDelegateForFunctionPointer(GetProcAddress(lib, "getJit")), typeof(Delegate4)))());
- intptr_1 = Marshal.ReadIntPtr(intptr_0);
- //get compileMethod addr
- if (IntPtr.Size == 8)
- {
- ptr = Marshal.AllocHGlobal(0x10);
- numPtr2 = (ulong*) ptr;
- numPtr2[0] = 18446744073709533256L;
- numPtr2[1] = 10416984890032521215L;
- VirtualProtect(ptr, 12, 64, out num);
- //hook with custom
- Marshal.WriteIntPtr(ptr, 2, intptr_1);
- }
- else
- {
- ptr = Marshal.AllocHGlobal(8);
- numPtr2 = (ulong*) ptr;
- numPtr2[0] = 10439625411221520312L;
- VirtualProtect(ptr, 7, (uint) ((0x32da5ab6 ^ 0x67c82111) - 0x55127b67), out num);
- Marshal.WriteIntPtr(ptr, 1, intptr_1);
- }
- delegate0_0 = (Delegate0) Marshal.GetDelegateForFunctionPointer(ptr, typeof(Delegate0));
- RuntimeHelpers.PrepareDelegate(delegate0_0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement