示例#1
0
 public void Insert(int pos, zString str)
 {
     if (Address == 0)
     {
         throw new Exception("The zString-Address can't be 0!");
     }
     Process.THISCALL <NullReturnCall>((uint)Address, 0x0046B400, new CallValue[] { new IntArg(pos), str });
 }
示例#2
0
        public void Set(zString str)
        {
            if (Address == 0)
            {
                throw new Exception("The zString-Address can't be 0!");
            }

            Process.THISCALL <zString>((uint)Address, (uint)0x0059CEB0, new CallValue[] { str });
        }
示例#3
0
        //public static zString Create(Process process, String value)
        //{

        //    IntPtr charArr = process.Alloc((uint)value.Length + 2);
        //    IntPtr stringArr = process.Alloc(20);

        //    System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
        //    byte[] arr = enc.GetBytes(value);
        //    if (arr.Length > 0)
        //        process.Write(arr, charArr.ToInt32() + 1);

        //    zString str = new zString(process, stringArr.ToInt32());
        //    str.PTR = charArr.ToInt32() + 1;
        //    str.Length = value.Length;
        //    str.Res = value.Length + 1;
        //    str.memorySave = true;

        //    return str;
        //}
        public static zString Create(Process process, String value)
        {
            if (process == null)
            {
                throw new ArgumentNullException("Process can't be null!");
            }
            if (value == null)
            {
                throw new ArgumentNullException("Value can't be null!");
            }
            //IntPtr charArr = process.Alloc((uint)value.Length + 2);
            //IntPtr stringArr = process.Alloc(20);

            //System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
            //byte[] arr = enc.GetBytes(value);
            //if (arr.Length > 0)
            //    process.Write(arr, charArr.ToInt32() + 1);

            //zString str = new zString(process, stringArr.ToInt32());
            //str.PTR = charArr.ToInt32() + 1;
            //str.Length = value.Length;
            //str.Res = value.Length + 1;

            //return str;

            System.Text.Encoding enc = System.Text.Encoding.Default;
            byte[] arr = enc.GetBytes(value);

            IntPtr charArr   = process.Alloc((uint)arr.Length + 1);
            IntPtr stringArr = process.Alloc(20);



            if (arr.Length > 0)
            {
                process.Write(arr, charArr.ToInt32());
            }

            process.THISCALL <NullReturnCall>((uint)stringArr.ToInt32(), (uint)0x004010C0, new CallValue[] { new IntArg(charArr.ToInt32()) });
            process.Free(charArr, (uint)arr.Length + 1);
            zString str = new zString(process, stringArr.ToInt32());

            str.memorySave = false;
            return(str);
        }
示例#4
0
        public void CopyTo(int address)
        {
            zString str = new zString(Process, address);

            str.Dispose();

            IntPtr charArr = Process.Alloc((uint)this.Value.Length + 1);

            System.Text.Encoding enc = System.Text.Encoding.Default;
            byte[] arr = enc.GetBytes(this.Value);
            if (arr.Length > 0)
            {
                Process.Write(arr, charArr.ToInt32());
            }

            Process.THISCALL <NullReturnCall>((uint)address, (uint)0x004010C0, new CallValue[] { new IntArg(charArr.ToInt32()) });
            Process.Free(charArr, (uint)this.Value.Length + 1);
        }