Example #1
0
        public HypercallComponent(UInt64 code, UInt64 param1, UInt64 param2)
        {
            InitializeComponent();
            createHexBox();
            cmbFuzzType.SelectedIndex = 0;

            txtCallnr.Text  = HypercallConversions.getCallCode(code).ToString();
            txtCount.Text   = HypercallConversions.getCountOfElements(code).ToString();
            txtStart.Text   = HypercallConversions.getRepStartIndex(code).ToString();
            optFast.Checked = HypercallConversions.isFast(code);

            byte[] byteArr = new byte[16];
            for (int x = 0; x < 8; x++)
            {
                byteArr[x] = (byte)(param1 & 0xFF);
                param1     = param1 >> 8;
            }
            for (int x = 0; x < 8; x++)
            {
                byteArr[x + 8] = (byte)(param2 & 0xFF);
                param2         = param2 >> 8;
            }
            hexBoxIn.ByteProvider = new DynamicByteProvider(byteArr);
            updateEnabled();
        }
        public HypercallSelectionForm(MainWindow parentIn, List <HypercallStruct> callsIn)
        {
            InitializeComponent();
            cmbFuzzType.SelectedIndex = 0;
            parent = parentIn;
            calls  = callsIn;

            table.Rows.Clear();
            int idx     = 0;
            int largest = 16;

            foreach (HypercallStruct call in calls)
            {
                String code  = "0x" + HypercallConversions.getCallCode(call.code).ToString("X2");
                String count = "0x" + HypercallConversions.getCountOfElements(call.code).ToString("X");
                String start = "0x" + HypercallConversions.getRepStartIndex(call.code).ToString("X");
                bool   fast  = HypercallConversions.isFast(call.code);
                if (call.input.Length > largest)
                {
                    largest = call.input.Length;
                }
                object[] row = new object[] { idx++, code, fast, count, start, call.input.Length.ToString(), "open" };
                table.Rows.Add(row);
            }
            txtFuzzMaxPos.Text = largest.ToString();
        }
Example #3
0
        public HypercallComponent(UInt64 code, byte[] input)
        {
            InitializeComponent();
            createHexBox();
            cmbFuzzType.SelectedIndex = 0;

            txtCallnr.Text  = HypercallConversions.getCallCode(code).ToString();
            txtCount.Text   = HypercallConversions.getCountOfElements(code).ToString();
            txtStart.Text   = HypercallConversions.getRepStartIndex(code).ToString();
            optFast.Checked = HypercallConversions.isFast(code);

            hexBoxIn.ByteProvider = new DynamicByteProvider(input);
            updateEnabled();
        }
Example #4
0
 static public void save(String fname, ulong hypercallCodeInput, byte[] input)
 {
     using (BinaryWriter writer = new BinaryWriter(File.Open(fname, FileMode.Create)))
     {
         writer.Write(0x4c435648);
         writer.Write(hypercallCodeInput);
         if (!HypercallConversions.isFast(hypercallCodeInput))
         {
             writer.Write(input.Length);
         }
         writer.Write(input);
         writer.Close();
     }
 }
Example #5
0
        static public List <HypercallStruct> open(String fname)
        {
            List <HypercallStruct> result = new List <HypercallStruct>();

            using (BinaryReader reader = new BinaryReader(File.Open(fname, FileMode.Open)))
            {
                if (reader.ReadInt32() != 0x4c435648)
                {
                    return(null);
                }

                while (reader.BaseStream.Position != reader.BaseStream.Length)
                {
                    HypercallStruct res = new HypercallStruct();
                    res.code = (ulong)reader.ReadInt64();
                    if (HypercallConversions.isFast(res.code))
                    {
                        res.input = reader.ReadBytes(16);
                    }
                    else
                    {
                        int tmp = reader.ReadInt32();
                        if (tmp == 0)
                        {
                            res.input = new byte[0];
                        }
                        else
                        {
                            res.input = reader.ReadBytes(tmp);
                        }
                    }
                    result.Add(res);
                }
            }
            return(result);
        }