Esempio n. 1
0
        public static string RUnicodeStr(Memloc addr, int maxLength)
        {
            System.Text.StringBuilder Str = new System.Text.StringBuilder(maxLength);
            int loc = 0;

            var nextChr = '?';


            if (maxLength != 0)
            {
                byte[] bytes = new byte[3];

                while ((maxLength < 0 || loc < maxLength))
                {
                    Kernel.ReadProcessMemory_SAFE(DARKSOULS.GetHandle(), ((uint)addr) + (uint)loc * 2, bytes, 2, 0);
                    nextChr = System.Text.Encoding.Unicode.GetChars(bytes)[0];

                    if (nextChr == (char)0)
                    {
                        break; // TODO: might not be correct. Was : Exit While
                    }
                    else
                    {
                        Str.Append(nextChr);
                    }

                    loc += 1;
                }
            }

            return(Str.ToString());
        }
Esempio n. 2
0
 public static void WUnicodeStr(Memloc addr, string str)
 {
     Kernel.WriteProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, System.Text.Encoding.Unicode.GetBytes(str).Concat(new byte[] {
         0,
         0
     }).ToArray(), str.Length * 2 + 2, 0);
 }
Esempio n. 3
0
 public static T CallReg <T>(Memloc address, dynamic[] args,
                             dynamic eax = null,
                             dynamic ecx = null,
                             dynamic edx = null,
                             dynamic ebx = null,
                             dynamic esp = null,
                             dynamic esi = null,
                             dynamic edi = null)
 {
     return(ASM.CallIngameFuncReg <T>(address, args, eax, ecx, edx, ebx, esp, esi, edi));
 }
Esempio n. 4
0
 public static IntPtr RIntPtr(Memloc addr)
 {
     Kernel.ReadProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, ByteBuffer, IntPtr.Size, 0);
     if (IntPtr.Size == 4)
     {
         return(new IntPtr(BitConverter.ToUInt32(ByteBuffer, 0)));
     }
     else
     {
         return(new IntPtr(BitConverter.ToInt64(ByteBuffer, 0)));
     }
 }
Esempio n. 5
0
        public static bool RBit(Memloc baseAddr, int bitOffset)
        {
            var state = GetCurrentState();

            state.RBit_actualAddress = (baseAddr + (bitOffset / 8));
            state.RBit_mask          = 0b10000000 >> (bitOffset % 8);

            if (Kernel.ReadProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)(state.RBit_actualAddress), ByteBuffer, 1, 0))
            {
                byte b = RByte(state.RBit_actualAddress);
                return((b & state.RBit_mask) == state.RBit_mask);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 6
0
        public static void WBit(Memloc baseAddr, int bitOffset, bool val)
        {
            var state = GetCurrentState();

            state.WBit_actualAddress = (baseAddr + (bitOffset / 8));
            state.WBit_mask          = 0b10000000 >> (bitOffset % 8);

            if (Kernel.ReadProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)(state.WBit_actualAddress), ByteBuffer, 1, 0))
            {
                byte b = RByte(state.WBit_actualAddress);
                // ((b & mask) == mask) is the boolean value of the flag
                if (((b & state.WBit_mask) == state.WBit_mask) != val)
                {
                    if (val)
                    {
                        WByte(state.WBit_actualAddress, (byte)(b | state.WBit_mask));
                    }
                    else
                    {
                        WByte(state.WBit_actualAddress, (byte)(b & (~state.WBit_mask)));
                    }
                }
            }
        }
Esempio n. 7
0
 public static bool RBool(Memloc addr)
 {
     Kernel.ReadProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, ByteBuffer, 1, 0);
     return(ByteBuffer[0] != 0);
 }
Esempio n. 8
0
 public static uint RUInt32(Memloc addr)
 {
     Kernel.ReadProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, ByteBuffer, 4, 0);
     return(BitConverter.ToUInt32(ByteBuffer, 0));
 }
Esempio n. 9
0
 public static void WBytes(Memloc addr, byte[] val)
 {
     Kernel.WriteProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, val, val.Length, 0);
 }
Esempio n. 10
0
 public static void WByte(Memloc addr, byte val)
 {
     Kernel.WriteProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, new byte[] { val }, 1, 0);
 }
Esempio n. 11
0
 public static void WUInt64(Memloc addr, UInt64 val)
 {
     Kernel.WriteProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, BitConverter.GetBytes(val), 8, 0);
 }
Esempio n. 12
0
 public static void WFloat(Memloc addr, float val)
 {
     Kernel.WriteProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, BitConverter.GetBytes(val), 4, 0);
 }
Esempio n. 13
0
 public static short RInt16(Memloc addr)
 {
     Kernel.ReadProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, ByteBuffer, 2, 0);
     return(BitConverter.ToInt16(ByteBuffer, 0));
 }
Esempio n. 14
0
 public static T Call <T>(Memloc address, params dynamic[] args)
 {
     return(ASM.CallIngameFunc <T>(address, args));
 }
Esempio n. 15
0
 public static float RFloat(Memloc addr)
 {
     Kernel.ReadProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, ByteBuffer, 4, 0);
     return(BitConverter.ToSingle(ByteBuffer, 0));
 }
Esempio n. 16
0
 public static byte[] RBytes(Memloc addr, int size)
 {
     byte[] _rtnBytes = new byte[size];
     Kernel.ReadProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, _rtnBytes, size, 0);
     return(_rtnBytes);
 }
Esempio n. 17
0
 public static double RDouble(Memloc addr)
 {
     Kernel.ReadProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, ByteBuffer, 8, 0);
     return(BitConverter.ToDouble(ByteBuffer, 0));
 }
Esempio n. 18
0
 public static void WBool(Memloc addr, bool val)
 {
     Kernel.WriteProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, BitConverter.GetBytes(val), 1, 0);
 }
Esempio n. 19
0
 public static sbyte RInt8(Memloc addr)
 {
     Kernel.ReadProcessMemory_SAFE(DARKSOULS.GetHandle(), (uint)addr, ByteBuffer, 1, 0);
     return((sbyte)ByteBuffer[0]);
 }