Ejemplo n.º 1
0
        public callSender(oFunctionList recordedData)
        {
            this.recordedData = recordedData;

            InitializeComponent();

            if( recordedData != null )
            {
                // Set the call list count
                this.dataGridCalls.RowCount = recordedData.getCallCount();

                // Make sure only 1 function is in the function list.
                if( recordedData.getCount() == 1 )
                {
                    // Set this function address
                    this.address = recordedData.functions[0].address;

                    // Set this function
                    this.function = recordedData.functions[0];

                    // Initialize the arguments data grid view control
                    this.dataGridArguments.Rows.Add(new string[] { "ecx", "0x0" });
                    this.dataGridArguments.Rows.Add(new string[] { "edx", "0x0" });
                    this.dataGridArguments.Rows.Add(new string[] { "eax", "0x0" });
                    for (int i = 0; i < recordedData.functions[0].getNumParams(); i++)
                    {
                        // Add this argument
                        this.dataGridArguments.Rows.Add(new string[] {"ebp+0x" + (8+i*4).ToString("X"), "0x0"});
                    }

                    // Load the initial arguments from the most recent function call
                    if (recordedData.getCallCount() > 0)
                    {
                        // Set the register inputs
                        this.dataGridArguments.Rows[0].Cells[1].Value = "0x" + recordedData.getData()[recordedData.getCallCount() - 1].ecx.ToString("X");
                        this.dataGridArguments.Rows[1].Cells[1].Value = "0x" + recordedData.getData()[recordedData.getCallCount() - 1].edx.ToString("X");
                        this.dataGridArguments.Rows[2].Cells[1].Value = "0x" + recordedData.getData()[recordedData.getCallCount() - 1].eax.ToString("X");

                        // Set the stack inputs
                        for (int i = 0; i < recordedData.functions[0].getNumParams(); i++)
                        {
                            // Set this argument
                            this.dataGridArguments.Rows[i+3].Cells[1].Value = "0x" + recordedData.getData()[recordedData.getCallCount() - 1].arguments[i].ToString("X");
                        }
                    }

                }
            }

            // Initialize the code text
            textCallAssembly.Text = generateCode();
        }