Main | Registration | Login Welcome Guest | RSS
Vote for RawrGunz!Please VOTE for RawrGunz at top 200 pserver list!
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum moderator: Splash, ManyBlackPpl  
Forum » RawrGamerz Gunz » Server Developments » [CODING][TUT]Direct ASM Bytes in C#
[CODING][TUT]Direct ASM Bytes in C#
xVengeanceDate: Tuesday, 2009-07-21, 4:58 AM | Message # 1
RawrGunz Beginner
Group: Users
Messages: 79
Reputation: 6
Status: Offline
Code

using System;
using System.Reflection;

class Proggy
{
     public delegate uint Ret1ArgDelegate(uint args);
     static uint PlaceHolder(uint args) { return 0; }
      
     public static byte[] asmByt = new byte[]
         {         
             0x89,0xD0,  
             0xD1,0xC8,  
             0xC3        
         };
          
     unsafe static void Main()
     {
         fixed(byte* startAddy = &asmByt[0])  
         {
              
             Type delType = typeof(Delegate);
             FieldInfo _methodPtr = delType.GetField("_methodPtr", BindingFlags.NonPublic | BindingFlags.Instance);

              
             Ret1ArgDelegate del = new Ret1ArgDelegate(PlaceHolder);
             _methodPtr.SetValue(del, (IntPtr)startAddy);

              
             uint ncd = (uint)0xFFFFFFFC;
             ncd = del(ncd);
             Console.WriteLine("{0:x}", ncd);
         }
     }
}

I posted this on another forum, just sharing it here. wink


Check this out. :P
http://rawrgaming.ucoz.com/forum/16-745-1
 
GraphiDate: Tuesday, 2009-07-21, 5:04 PM | Message # 2
eSOBe
Group: Users
Messages: 1326
Reputation: 22
Status: Offline
We got a pro coder here^^


 
Forum » RawrGamerz Gunz » Server Developments » [CODING][TUT]Direct ASM Bytes in C#
  • Page 1 of 1
  • 1
Search:

Copyright RawrGunz © 2024
Powered by uCoz