GetNormalOperandType() public method

public GetNormalOperandType ( ) : x86OperandType
return x86OperandType
コード例 #1
0
        private byte[] ReadRawOperand(x86OpCode opcode)
        {
            switch (opcode.GetNormalOperandType())
            {
            case x86OperandType.Byte:
            case x86OperandType.ShortInstructionAddress:
                return(new byte[] { reader.ReadByte() });

            case x86OperandType.Dword:
            case x86OperandType.InstructionAddress:
                return(reader.ReadBytes(sizeof(int)));

            case x86OperandType.Fword:
                return(reader.ReadBytes(6));

            case x86OperandType.Word:
                return(reader.ReadBytes(sizeof(ushort)));

            case x86OperandType.WordAndByte:
                return(reader.ReadBytes(sizeof(ushort) + sizeof(byte)));

            case x86OperandType.Qword:
                return(reader.ReadBytes(sizeof(ulong)));

            case x86OperandType.Multiple32Register:
            case x86OperandType.Multiple16Register:
            case x86OperandType.Multiple32Or8Register:
            case x86OperandType.Register32:
            case x86OperandType.RegisterLeaRegister:
                break;
            }
            return(null);
        }
コード例 #2
0
        private void GenerateBytes()
        {
            switch (code.GetNormalOperandType())
            {
            case x86OperandType.None:
                break;

            case x86OperandType.Byte:
                operandbytes = new byte[] { (byte)operand1.Value };
                break;

            case x86OperandType.Word:
                operandbytes = BitConverter.GetBytes((short)operand1.Value);
                break;

            case x86OperandType.Dword:
                operandbytes = BitConverter.GetBytes((int)operand1.Value);
                break;

            case x86OperandType.Qword:
                operandbytes = BitConverter.GetBytes((long)operand1.Value);
                break;

            case x86OperandType.InstructionAddress:
                Offset targetOffset = ((Offset)operand1.Value);
                int    difference   = (int)((targetOffset.FileOffset + this.Size) - Offset.FileOffset);
                operandbytes = BitConverter.GetBytes(difference);
                break;

            case x86OperandType.ShortInstructionAddress:
                targetOffset = ((Offset)operand1.Value);
                difference   = (int)((targetOffset.FileOffset + this.Size) - Offset.FileOffset);
                operandbytes = new byte[] { (byte)difference };
                break;

            case x86OperandType.Register32:
                code._opcodeBytes[code._variableByteIndex] += (byte)(x86Register)operand1.Value;
                break;

            default:
                throw new NotImplementedException("The instruction bytes could not be created because the operand type is not supported yet.");
            }
        }
コード例 #3
0
ファイル: x86Disassembler.cs プロジェクト: Rex-Hays/GNIDA
        internal byte[] ReadRawOperand(x86OpCode opcode)
        {
            switch (opcode.GetNormalOperandType())
            {
                case x86OperandType.Byte:
                case x86OperandType.ShortInstructionAddress:
                    return new byte[] { reader.ReadByte() };

                case x86OperandType.Dword:
                case x86OperandType.InstructionAddress:
                    return reader.ReadBytes(sizeof(int));

                case x86OperandType.Fword:
                    return reader.ReadBytes(6);

                case x86OperandType.Word:
                    return reader.ReadBytes(sizeof(ushort));
                case x86OperandType.WordAndByte:
                    return reader.ReadBytes(sizeof(ushort) + sizeof(byte));

                case x86OperandType.Qword:
                    return reader.ReadBytes(sizeof(ulong));

                case x86OperandType.Multiple32Register:
                case x86OperandType.Multiple16Register:
                case x86OperandType.Multiple32Or8Register:
                case x86OperandType.Register32:
                case x86OperandType.RegisterLeaRegister:
                    break;
            }
            return null;
        }