diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..e7f5fa79 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,211 @@ +root = true + +[*] +charset = utf-8 +trim_trailing_whitespace = true + +[*.{c,h,cpp,hpp}] + +# Indentation and spacing +indent_size = 4 +indent_style = tab +tab_width = 4 + +[*.cs] + +#### Core EditorConfig Options #### + +# Indentation and spacing +indent_size = 4 +indent_style = tab +tab_width = 4 + +# New line preferences +end_of_line = crlf +insert_final_newline = false + +#### .NET Coding Conventions #### + +# Organize usings +dotnet_separate_import_directive_groups = false +dotnet_sort_system_directives_first = true + +# this. and Me. preferences +dotnet_style_qualification_for_event = false:silent +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_property = false:silent + +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true:silent +dotnet_style_predefined_type_for_member_access = true:silent + +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent + +# Expression-level preferences +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_object_initializer = true:suggestion +dotnet_style_prefer_auto_properties = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion + +# Field preferences +dotnet_style_readonly_field = true:suggestion + +# Parameter preferences +dotnet_code_quality_unused_parameters = all:suggestion + +#### C# Coding Conventions #### + +# var preferences +csharp_style_var_elsewhere = true:suggestion +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion + +# Expression-bodied members +csharp_style_expression_bodied_accessors = true:suggestion +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_indexers = true:suggestion +csharp_style_expression_bodied_lambdas = true:suggestion +csharp_style_expression_bodied_local_functions = true:suggestion +csharp_style_expression_bodied_methods = true:silent +csharp_style_expression_bodied_operators = true:suggestion +csharp_style_expression_bodied_properties = true:suggestion + +# Pattern matching preferences +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_prefer_switch_expression = true:suggestion + +# Null-checking preferences +csharp_style_conditional_delegate_call = true:suggestion + +# Modifier preferences +csharp_prefer_static_local_function = true:suggestion +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent + +# Code-block preferences +csharp_prefer_braces = true:suggestion +csharp_prefer_simple_using_statement = true:suggestion + +# Expression-level preferences +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_pattern_local_over_anonymous_function = true:suggestion +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:silent + +# 'using' directive preferences +csharp_using_directive_placement = outside_namespace:error + +#### C# Formatting Rules #### + +# New line preferences +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_labels = one_less_than_current +csharp_indent_switch_labels = true + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Wrapping preferences +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true + +#### Naming styles #### + +# Naming rules + +dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i + +dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.types_should_be_pascal_case.symbols = types +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case + +# Symbol specifications + +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interface.required_modifiers = + +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types.required_modifiers = + +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.required_modifiers = + +# Naming styles + +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = +dotnet_naming_style.pascal_case.capitalization = pascal_case + +dotnet_naming_style.begins_with_i.required_prefix = I +dotnet_naming_style.begins_with_i.required_suffix = +dotnet_naming_style.begins_with_i.word_separator = +dotnet_naming_style.begins_with_i.capitalization = pascal_case + +#### Warnings #### + +# CS8509: The switch expression does not handle all possible values of its input type (it is not exhaustive). +dotnet_diagnostic.CS8509.severity = none diff --git a/.gitignore b/.gitignore index 8df17fb3..3a3e6d33 100644 --- a/.gitignore +++ b/.gitignore @@ -251,4 +251,4 @@ paket-files/ .idea/ *.sln.iml -/Resources/BuildDate.txt +/ReClass.NET/Resources/BuildDate.txt diff --git a/AddressParser/Interpreter.cs b/AddressParser/Interpreter.cs deleted file mode 100644 index f26e0252..00000000 --- a/AddressParser/Interpreter.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Design taken from https://github.com/pieterderycke/Jace - -using System; -using System.Diagnostics.Contracts; -using System.Linq; -using ReClassNET.Memory; -using ReClassNET.Util; - -namespace ReClassNET.AddressParser -{ - class Interpreter - { - public IntPtr Execute(Operation operation, RemoteProcess process) - { - Contract.Requires(operation != null); - Contract.Requires(process != null); - - if (operation is OffsetOperation) - { - return ((OffsetOperation)operation).Value; - } - else if (operation is ModuleOffsetOperation) - { - var module = process.GetModuleByName(((ModuleOffsetOperation)operation).Name); - if (module != null) - { - return module.Start; - } - - return IntPtr.Zero; - } - else if (operation is AdditionOperation) - { - var addition = (AdditionOperation)operation; - return Execute(addition.Argument1, process).Add(Execute(addition.Argument2, process)); - } - else if (operation is SubtractionOperation) - { - var addition = (SubtractionOperation)operation; - return Execute(addition.Argument1, process).Sub(Execute(addition.Argument2, process)); - } - else if (operation is MultiplicationOperation) - { - var multiplication = (MultiplicationOperation)operation; - return Execute(multiplication.Argument1, process).Mul(Execute(multiplication.Argument2, process)); - } - else if (operation is DivisionOperation) - { - var division = (DivisionOperation)operation; - return Execute(division.Dividend, process).Div(Execute(division.Divisor, process)); - } - else if (operation is ReadPointerOperation) - { - return process.ReadRemoteObject(Execute(((ReadPointerOperation)operation).Argument, process)); - } - - throw new ArgumentException($"Unsupported operation '{operation.GetType().FullName}'."); - } - } -} diff --git a/AddressParser/Token.cs b/AddressParser/Token.cs deleted file mode 100644 index acabb006..00000000 --- a/AddressParser/Token.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Design taken from https://github.com/pieterderycke/Jace - -namespace ReClassNET.AddressParser -{ - enum TokenType - { - Offset, - ModuleOffset, - Operation, - LeftBracket, - RightBracket, - ReadPointer - } - - class Token - { - /// - /// The type of the token. - /// - public TokenType TokenType; - - /// - /// The value of the token. - /// - public object Value; - - public override string ToString() - { - return $"{TokenType} {Value}"; - } - } -} diff --git a/AddressParser/TokenReader.cs b/AddressParser/TokenReader.cs deleted file mode 100644 index f8acf958..00000000 --- a/AddressParser/TokenReader.cs +++ /dev/null @@ -1,131 +0,0 @@ -// Design taken from https://github.com/pieterderycke/Jace - -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.Globalization; -using System.IO; -using System.Linq; - -namespace ReClassNET.AddressParser -{ - class TokenReader - { - /// - /// Read in the provided formula and convert it into a list of takens that can be processed by the - /// Abstract Syntax Tree Builder. - /// - /// The formula that must be converted into a list of tokens. - /// The list of tokens for the provided formula. - public List Read(string formula) - { - Contract.Requires(formula != null); - - var tokens = new List(); - - var isFormulaSubPart = true; - - var characters = formula.ToCharArray(); - for (var i = 0; i < characters.Length; ++i) - { - if (characters[i] == '<') - { - var buffer = string.Empty; - while (++i < characters.Length && IsPartOfModuleName(characters[i])) - { - buffer += characters[i]; - } - - if (i >= characters.Length) - { - throw new ParseException("Unexpected end of input detected."); - } - if (characters[i] != '>') - { - throw new ParseException($"Invalid token '{characters[i]}' detected at position {i}."); - } - ++i; - - tokens.Add(new Token { TokenType = TokenType.ModuleOffset, Value = buffer }); - isFormulaSubPart = false; - - if (i == characters.Length) - { - continue; - } - } - - if (IsPartOfNumeric(characters[i], true, isFormulaSubPart)) - { - var buffer = characters[i].ToString(); - while (++i < characters.Length && IsPartOfNumeric(characters[i], false, isFormulaSubPart)) - { - buffer += characters[i]; - } - - if (buffer.StartsWith("0x", StringComparison.InvariantCultureIgnoreCase)) - { - buffer = buffer.Substring(2); - } - - long offsetValue; - if (long.TryParse(buffer, NumberStyles.HexNumber, null, out offsetValue)) - { -#if WIN64 - var address = (IntPtr)offsetValue; -#else - var address = (IntPtr)unchecked((int)offsetValue); -#endif - - tokens.Add(new Token { TokenType = TokenType.Offset, Value = address }); - isFormulaSubPart = false; - } - else - { - throw new ParseException($"'{buffer}' is not a valid number."); - } - - if (i == characters.Length) - { - continue; - } - } - - switch (characters[i]) - { - case ' ': - continue; - case '+': - case '-': - case '*': - case '/': - tokens.Add(new Token { TokenType = TokenType.Operation, Value = characters[i] }); - isFormulaSubPart = true; - break; - case '[': - tokens.Add(new Token { TokenType = TokenType.LeftBracket, Value = characters[i] }); - isFormulaSubPart = true; - break; - case ']': - tokens.Add(new Token { TokenType = TokenType.RightBracket, Value = characters[i] }); - isFormulaSubPart = false; - break; - default: - throw new ParseException($"Invalid token '{characters[i]}' detected at position {i}."); - } - } - - return tokens; - } - - private bool IsPartOfNumeric(char character, bool isFirstCharacter, bool isFormulaSubPart) - { - return (character >= '0' && character <= '9') || (character >= 'a' && character <= 'f') || (character >= 'A' && character <= 'F') || (isFormulaSubPart && !isFirstCharacter && (character == 'x' || character == 'X')); - } - - private bool IsPartOfModuleName(char character) - { - return !Path.GetInvalidFileNameChars().Contains(character); - } - } -} diff --git a/CodeGenerator/CSharpCodeGenerator.cs b/CodeGenerator/CSharpCodeGenerator.cs deleted file mode 100644 index bcd83b50..00000000 --- a/CodeGenerator/CSharpCodeGenerator.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.Linq; -using System.Text; -using ReClassNET.Logger; -using ReClassNET.Nodes; - -namespace ReClassNET.CodeGenerator -{ - class CSharpCodeGenerator : ICodeGenerator - { - private readonly Dictionary typeToTypedefMap = new Dictionary - { - [typeof(DoubleNode)] = "double", - [typeof(FloatNode)] = "float", - [typeof(Int8Node)] = "sbyte", - [typeof(Int16Node)] = "short", - [typeof(Int32Node)] = "int", - [typeof(Int64Node)] = "long", - [typeof(UInt8Node)] = "byte", - [typeof(UInt16Node)] = "ushort", - [typeof(UInt32Node)] = "uint", - [typeof(UInt64Node)] = "ulong", - - [typeof(FunctionPtrNode)] = "IntPtr", - [typeof(UTF8TextPtrNode)] = "IntPtr", - [typeof(UTF16TextPtrNode)] = "IntPtr", - [typeof(UTF32TextPtrNode)] = "IntPtr", - [typeof(ClassPtrNode)] = "IntPtr", - [typeof(VTableNode)] = "IntPtr" - }; - - public Language Language => Language.CSharp; - - public string GenerateCode(IEnumerable classes, ILogger logger) - { - var sb = new StringBuilder(); - sb.AppendLine($"// Created with {Constants.ApplicationName} by {Constants.Author}"); - sb.AppendLine(); - sb.AppendLine("// Warning: The code doesn't contain arrays and instances!"); - sb.AppendLine(); - sb.AppendLine("using System.Runtime.InteropServices;"); - sb.AppendLine(); - - sb.Append( - string.Join( - "\n\n", - classes.Select(c => - { - var csb = new StringBuilder(); - - csb.AppendLine("[StructLayout(LayoutKind.Explicit)]"); - csb.Append($"struct {c.Name}"); - if (!string.IsNullOrEmpty(c.Comment)) - { - csb.Append($" // {c.Comment}"); - } - csb.AppendLine(); - - csb.AppendLine("{"); - - csb.AppendLine( - string.Join( - "\n\n", - YieldMemberDefinitions(c.Nodes, logger) - .Select(m => $"\t{GetFieldDecorator(m)}\n\t{GetFieldDefinition(m)}") - ) - ); - csb.Append("}"); - return csb.ToString(); - }) - ) - ); - - return sb.ToString(); - } - - private IEnumerable YieldMemberDefinitions(IEnumerable members, ILogger logger) - { - Contract.Requires(members != null); - Contract.Requires(Contract.ForAll(members, m => m != null)); - Contract.Ensures(Contract.Result>() != null); - Contract.Ensures(Contract.ForAll(Contract.Result>(), d => d != null)); - - foreach (var member in members.Where(n => !(n is BaseHexNode))) - { - if (member is BitFieldNode) - { - string type; - switch (((BitFieldNode)member).Bits) - { - default: - case 8: - type = typeToTypedefMap[typeof(UInt8Node)]; - break; - case 16: - type = typeToTypedefMap[typeof(UInt16Node)]; - break; - case 32: - type = typeToTypedefMap[typeof(UInt32Node)]; - break; - case 64: - type = typeToTypedefMap[typeof(UInt64Node)]; - break; - } - - yield return new MemberDefinition(member, type); - } - else - { - string type; - if (typeToTypedefMap.TryGetValue(member.GetType(), out type)) - { - yield return new MemberDefinition(member, type); - } - else - { - var generator = CustomCodeGenerator.GetGenerator(member, Language); - if (generator != null) - { - yield return generator.GetMemberDefinition(member, Language, logger); - - continue; - } - - logger.Log(LogLevel.Error, $"Skipping node with unhandled type: {member.GetType()}"); - } - } - } - } - - private string GetFieldDecorator(MemberDefinition member) - { - Contract.Requires(member != null); - - return $"[FieldOffset({member.Offset})]"; - } - - private string GetFieldDefinition(MemberDefinition member) - { - Contract.Requires(member != null); - - return $"public {member.Type} {member.Name}; //0x{member.Offset:X04} {member.Comment}".Trim(); - } - } -} diff --git a/CodeGenerator/CppCodeGenerator.cs b/CodeGenerator/CppCodeGenerator.cs deleted file mode 100644 index 7cce9650..00000000 --- a/CodeGenerator/CppCodeGenerator.cs +++ /dev/null @@ -1,252 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.Linq; -using System.Text; -using ReClassNET.Logger; -using ReClassNET.Nodes; - -namespace ReClassNET.CodeGenerator -{ - class CppCodeGenerator : ICodeGenerator - { - private readonly Dictionary typeToTypedefMap = new Dictionary - { - [typeof(DoubleNode)] = Program.Settings.TypeDouble, - [typeof(FloatNode)] = Program.Settings.TypeFloat, - [typeof(FunctionPtrNode)] = Program.Settings.TypeFunctionPtr, - [typeof(Int8Node)] = Program.Settings.TypeInt8, - [typeof(Int16Node)] = Program.Settings.TypeInt16, - [typeof(Int32Node)] = Program.Settings.TypeInt32, - [typeof(Int64Node)] = Program.Settings.TypeInt64, - [typeof(Matrix3x3Node)] = Program.Settings.TypeMatrix3x3, - [typeof(Matrix3x4Node)] = Program.Settings.TypeMatrix3x4, - [typeof(Matrix4x4Node)] = Program.Settings.TypeMatrix4x4, - [typeof(UInt8Node)] = Program.Settings.TypeUInt8, - [typeof(UInt16Node)] = Program.Settings.TypeUInt16, - [typeof(UInt32Node)] = Program.Settings.TypeUInt32, - [typeof(UInt64Node)] = Program.Settings.TypeUInt64, - [typeof(UTF8TextNode)] = Program.Settings.TypeUTF8Text, - [typeof(UTF8TextPtrNode)] = Program.Settings.TypeUTF8TextPtr, - [typeof(UTF16TextNode)] = Program.Settings.TypeUTF16Text, - [typeof(UTF16TextPtrNode)] = Program.Settings.TypeUTF16TextPtr, - [typeof(UTF32TextNode)] = Program.Settings.TypeUTF32Text, - [typeof(UTF32TextPtrNode)] = Program.Settings.TypeUTF32PtrText, - [typeof(Vector2Node)] = Program.Settings.TypeVector2, - [typeof(Vector3Node)] = Program.Settings.TypeVector3, - [typeof(Vector4Node)] = Program.Settings.TypeVector4 - }; - - public Language Language => Language.Cpp; - - public string GenerateCode(IEnumerable classes, ILogger logger) - { - var sb = new StringBuilder(); - sb.AppendLine($"// Created with {Constants.ApplicationName} by {Constants.Author}"); - sb.AppendLine(); - sb.AppendLine( - string.Join( - "\n\n", - OrderByInheritance(classes).Select(c => - { - var csb = new StringBuilder(); - csb.Append($"class {c.Name}"); - - bool skipFirstMember = false; - var inheritedFromNode = c.Nodes.FirstOrDefault() as ClassInstanceNode; - if (inheritedFromNode != null) - { - skipFirstMember = true; - - csb.Append(" : public "); - csb.Append(inheritedFromNode.InnerNode.Name); - } - - if (!string.IsNullOrEmpty(c.Comment)) - { - csb.Append($" // {c.Comment}"); - } - csb.AppendLine(); - - csb.AppendLine("{"); - csb.AppendLine("public:"); - csb.AppendLine( - string.Join( - "\n", - YieldMemberDefinitions(c.Nodes.Skip(skipFirstMember ? 1 : 0), logger) - .Select(m => MemberDefinitionToString(m)) - .Select(s => "\t" + s) - ) - ); - - var vtables = c.Nodes.OfType(); - if (vtables.Any()) - { - csb.AppendLine(); - csb.AppendLine( - string.Join( - "\n", - vtables.SelectMany(vt => vt.Nodes).OfType().Select(m => $"\tvirtual void {m.MethodName}();") - ) - ); - } - - csb.Append($"}}; //Size: 0x{c.MemorySize:X04}"); - return csb.ToString(); - }) - ) - ); - - return sb.ToString(); - } - - private IEnumerable OrderByInheritance(IEnumerable classes) - { - Contract.Requires(classes != null); - Contract.Requires(Contract.ForAll(classes, c => c != null)); - Contract.Ensures(Contract.Result>() != null); - - var alreadySeen = new HashSet(); - - return classes.SelectMany(c => YieldReversedHierarchy(c, alreadySeen)).Distinct(); - } - - private IEnumerable YieldReversedHierarchy(ClassNode node, HashSet alreadySeen) - { - Contract.Requires(node != null); - Contract.Requires(alreadySeen != null); - Contract.Requires(Contract.ForAll(alreadySeen, c => c != null)); - Contract.Ensures(Contract.Result>() != null); - - if (!alreadySeen.Add(node)) - { - yield break; - } - - foreach (var referenceNode in node.Nodes.OfType()) - { - foreach (var referencedNode in YieldReversedHierarchy(referenceNode.InnerNode as ClassNode, alreadySeen)) - { - yield return referencedNode; - } - } - - yield return node; - } - - private IEnumerable YieldMemberDefinitions(IEnumerable members, ILogger logger) - { - Contract.Requires(members != null); - Contract.Requires(Contract.ForAll(members, m => m != null)); - Contract.Ensures(Contract.Result>() != null); - Contract.Ensures(Contract.ForAll(Contract.Result>(), d => d != null)); - - int fill = 0; - int fillStart = 0; - - foreach (var member in members.Where(m => !(m is VTableNode))) - { - if (member is BaseHexNode) - { - if (fill == 0) - { - fillStart = member.Offset.ToInt32(); - } - fill += member.MemorySize; - - continue; - } - - if (fill != 0) - { - yield return new MemberDefinition(Program.Settings.TypePadding, fill, $"pad_{fillStart:X04}", fillStart, string.Empty); - - fill = 0; - } - - string type; - if (typeToTypedefMap.TryGetValue(member.GetType(), out type)) - { - int count = 0; - if (member is BaseTextNode) - { - count = ((BaseTextNode)member).Length; - } - - yield return new MemberDefinition(member, type, count); - } - else if (member is BitFieldNode) - { - switch (((BitFieldNode)member).Bits) - { - case 8: - type = Program.Settings.TypeUInt8; - break; - case 16: - type = Program.Settings.TypeUInt16; - break; - case 32: - type = Program.Settings.TypeUInt32; - break; - case 64: - type = Program.Settings.TypeUInt64; - break; - } - - yield return new MemberDefinition(member, type); - } - else if (member is ClassInstanceArrayNode) - { - var instanceArray = (ClassInstanceArrayNode)member; - - yield return new MemberDefinition(member, instanceArray.InnerNode.Name, instanceArray.Count); - } - else if (member is ClassInstanceNode) - { - yield return new MemberDefinition(member, ((ClassInstanceNode)member).InnerNode.Name); - } - else if (member is ClassPtrArrayNode) - { - var ptrArray = (ClassPtrArrayNode)member; - - yield return new MemberDefinition(member, $"class {ptrArray.InnerNode.Name}*", ptrArray.Count); - } - else if (member is ClassPtrNode) - { - yield return new MemberDefinition(member, $"class {((ClassPtrNode)member).InnerNode.Name}*"); - } - else - { - var generator = CustomCodeGenerator.GetGenerator(member, Language); - if (generator != null) - { - yield return generator.GetMemberDefinition(member, Language, logger); - } - else - { - logger.Log(LogLevel.Error, $"Skipping node with unhandled type: {member.GetType()}"); - } - } - } - - if (fill != 0) - { - yield return new MemberDefinition(Program.Settings.TypePadding, fill, $"pad_{fillStart:X04}", fillStart, string.Empty); - } - } - - private string MemberDefinitionToString(MemberDefinition member) - { - Contract.Requires(member != null); - - if (member.IsArray) - { - return $"{member.Type} {member.Name}[{member.ArrayCount}]; //0x{member.Offset:X04} {member.Comment}".Trim(); - } - else - { - return $"{member.Type} {member.Name}; //0x{member.Offset:X04} {member.Comment}".Trim(); - } - } - } -} diff --git a/CodeGenerator/CustomCodeGenerator.cs b/CodeGenerator/CustomCodeGenerator.cs deleted file mode 100644 index 03453547..00000000 --- a/CodeGenerator/CustomCodeGenerator.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.Linq; -using ReClassNET.Logger; -using ReClassNET.Nodes; - -namespace ReClassNET.CodeGenerator -{ - [ContractClass(typeof(ICustomCodeGeneratorContract))] - public interface ICustomCodeGenerator - { - bool CanGenerateCode(BaseNode node, Language language); - - MemberDefinition GetMemberDefinition(BaseNode node, Language language, ILogger logger); - } - - [ContractClassFor(typeof(ICustomCodeGenerator))] - internal abstract class ICustomCodeGeneratorContract : ICustomCodeGenerator - { - public bool CanGenerateCode(BaseNode node, Language language) - { - Contract.Requires(node != null); - - throw new NotImplementedException(); - } - - public MemberDefinition GetMemberDefinition(BaseNode node, Language language, ILogger logger) - { - Contract.Requires(node != null); - Contract.Ensures(Contract.Result() != null); - - throw new NotImplementedException(); - } - } - - public class CustomCodeGenerator - { - private static readonly List generators = new List(); - - public static void RegisterCustomType(ICustomCodeGenerator generator) - { - Contract.Requires(generator != null); - - generators.Add(generator); - } - - public static void DeregisterCustomType(ICustomCodeGenerator generator) - { - Contract.Requires(generator != null); - - generators.Remove(generator); - } - - public static ICustomCodeGenerator GetGenerator(BaseNode node, Language language) - { - Contract.Requires(node != null); - - return generators.Where(c => c.CanGenerateCode(node, language)).FirstOrDefault(); - } - } -} diff --git a/CodeGenerator/MemberDefinition.cs b/CodeGenerator/MemberDefinition.cs deleted file mode 100644 index 3fc6015a..00000000 --- a/CodeGenerator/MemberDefinition.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ReClassNET.Nodes; -using System.Diagnostics; - -namespace ReClassNET.CodeGenerator -{ - public class MemberDefinition - { - public bool IsArray => ArrayCount != 0; - public int ArrayCount { get; } - - public int Offset { get; } - - public string Type { get; } - public string Name { get; } - public string Comment { get; } - - public MemberDefinition(BaseNode node, string type) - : this(node, type, 0) - { - - } - - public MemberDefinition(BaseNode node, string type, int arrayCount) - : this(type, arrayCount, node.Name, node.Offset.ToInt32(), node.Comment) - { - Contract.Requires(node != null); - Contract.Requires(type != null); - } - - public MemberDefinition(string type, int arrayCount, string name, int offset, string comment) - { - Contract.Requires(type != null); - Contract.Requires(name != null); - Contract.Requires(comment != null); - - ArrayCount = arrayCount; - - Offset = offset; - - Type = type; - Name = name; - Comment = comment; - } - } -} diff --git a/Constants.cs b/Constants.cs deleted file mode 100644 index c681aa32..00000000 --- a/Constants.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace ReClassNET -{ - class Constants - { - public const string ApplicationName = "ReClass.NET"; - - public const string ApplicationVersion = "1.0"; - - public const string Author = "KN4CK3R"; - - public const string HomepageUrl = "https://github.com/KN4CK3R/ReClass.NET"; - - public const string HelpUrl = "https://github.com/KN4CK3R/ReClass.NET/issues"; - -#if WIN64 - public const string Platform = "x64"; -#else - public const string Platform = "x86"; -#endif - - public const string SettingsFile = "settings.xml"; - - public const string PluginsFolder = "Plugins"; - } -} diff --git a/DataExchange/ReClass2007File.cs b/DataExchange/ReClass2007File.cs deleted file mode 100644 index 9809a6d1..00000000 --- a/DataExchange/ReClass2007File.cs +++ /dev/null @@ -1,207 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.SQLite; -using System.Diagnostics.Contracts; -using System.Linq; -using ReClassNET.Logger; -using ReClassNET.Nodes; -using ReClassNET.Util; - -namespace ReClassNET.DataExchange -{ - class ReClass2007File : IReClassImport - { - public const string FormatName = "ReClass 2007 File"; - public const string FileExtension = ".rdc"; - - private static readonly Type[] TypeMap = new Type[] - { - null, - typeof(ClassInstanceNode), - typeof(ClassNode), - null, - typeof(Hex32Node), - typeof(Hex16Node), - typeof(Hex8Node), - typeof(ClassPtrNode), - typeof(Int32Node), - typeof(Int16Node), - typeof(Int8Node), - typeof(FloatNode), - typeof(UInt32Node), - typeof(UInt16Node), - typeof(UInt8Node), - typeof(UTF8TextNode), - typeof(FunctionPtrNode) - }; - - private ReClassNetProject project; - - public ReClass2007File(ReClassNetProject project) - { - Contract.Requires(project != null); - - this.project = project; - } - - public void Load(string filePath, ILogger logger) - { - using (var connection = new SQLiteConnection($@"Data Source={filePath}")) - { - connection.Open(); - - var classes = new Dictionary(); - var vtables = new Dictionary(); - - foreach (var row in Query(connection, "SELECT tbl_name FROM sqlite_master WHERE tbl_name LIKE 'class%'")) - { - var id = Convert.ToInt32(row["tbl_name"].ToString().Substring(5)); - - var classRow = Query(connection, $"SELECT variable, comment FROM class{id} WHERE type = 2 LIMIT 1").FirstOrDefault(); - if (classRow == null) - { - continue; - } - - // Skip the vtable classes. - if (classRow["variable"].ToString() == "VTABLE") - { - var vtableNode = new VTableNode(); - - Query(connection, $"SELECT variable, comment FROM class{id} WHERE type = 16") - .Select(e => new VMethodNode - { - Name = Convert.ToString(e["variable"]) ?? string.Empty, - Comment = Convert.ToString(e["comment"]) ?? string.Empty - }) - .ForEach(vtableNode.AddNode); - - foreach (var method in vtableNode.Nodes) - { - if (method.Name == "void function()") - { - method.Name = string.Empty; - } - } - - vtables.Add(id, vtableNode); - - continue; - } - - var node = new ClassNode(false) - { - Name = classRow["variable"].ToString(), - Comment = classRow["comment"].ToString() - }; - - project.AddClass(node); - - classes.Add(id, node); - } - - foreach (var kv in classes) - { - ReadNodeRows( - Query(connection, $"SELECT variable, comment, type, length, ref FROM class{kv.Key} WHERE type != 2"), - kv.Value, - classes, - vtables, - logger - ).ForEach(kv.Value.AddNode); - } - } - } - - private IEnumerable ReadNodeRows(IEnumerable rows, ClassNode parent, IReadOnlyDictionary classes, IReadOnlyDictionary vtables, ILogger logger) - { - Contract.Requires(rows != null); - Contract.Requires(parent != null); - Contract.Requires(logger != null); - - foreach (var row in rows) - { - Type nodeType = null; - - int typeVal = Convert.ToInt32(row["type"]); - if (typeVal >= 0 && typeVal < TypeMap.Length) - { - nodeType = TypeMap[typeVal]; - } - - if (nodeType == null) - { - logger.Log(LogLevel.Error, $"Skipping node with unknown type: {row["type"]}"); - logger.Log(LogLevel.Warning, string.Join(",", row.ItemArray)); - - continue; - } - - var node = Activator.CreateInstance(nodeType) as BaseNode; - if (node == null) - { - logger.Log(LogLevel.Error, $"Could not create node of type: {nodeType}"); - - continue; - } - - node.Name = Convert.ToString(row["variable"]) ?? string.Empty; - node.Comment = Convert.ToString(row["comment"]) ?? string.Empty; - - var referenceNode = node as BaseReferenceNode; - if (referenceNode != null) - { - var reference = Convert.ToInt32(row["ref"]); - if (!classes.ContainsKey(reference)) - { - VTableNode vtableNode; - if (!vtables.TryGetValue(reference, out vtableNode)) - { - logger.Log(LogLevel.Error, $"Skipping node with unknown reference: {row["ref"]}"); - logger.Log(LogLevel.Warning, string.Join(",", row.ItemArray)); - - continue; - } - - yield return vtableNode; - - continue; - } - - var innerClassNode = classes[reference]; - if (referenceNode.PerformCycleCheck && !ClassUtil.IsCycleFree(parent, innerClassNode, project.Classes)) - { - logger.Log(LogLevel.Error, $"Skipping node with cycle reference: {parent.Name}->{node.Name}"); - - continue; - } - - referenceNode.ChangeInnerNode(innerClassNode); - } - var textNode = node as BaseTextNode; - if (textNode != null) - { - textNode.Length = Math.Max(IntPtr.Size, Convert.ToInt32(row["length"])); - } - - yield return node; - } - } - - private IEnumerable Query(SQLiteConnection connection, string query) - { - Contract.Requires(connection != null); - Contract.Requires(query != null); - - using (var adapter = new SQLiteDataAdapter(query, connection)) - { - var ds = new DataSet(); - - adapter.Fill(ds); - - return ds.Tables[0].AsEnumerable(); - } - } - } -} diff --git a/DataExchange/ReClassNetFile.Read.cs b/DataExchange/ReClassNetFile.Read.cs deleted file mode 100644 index d746122b..00000000 --- a/DataExchange/ReClassNetFile.Read.cs +++ /dev/null @@ -1,232 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.IO; -using System.IO.Compression; -using System.Linq; -using System.Xml.Linq; -using ReClassNET.Logger; -using ReClassNET.Nodes; -using ReClassNET.Util; - -namespace ReClassNET.DataExchange -{ - public partial class ReClassNetFile - { - public void Load(string filePath, ILogger logger) - { - using (var fs = new FileStream(filePath, FileMode.Open)) - { - Load(fs, logger); - } - } - - public void Load(Stream input, ILogger logger) - { - using (var archive = new ZipArchive(input, ZipArchiveMode.Read)) - { - var dataEntry = archive.GetEntry(DataFileName); - if (dataEntry == null) - { - throw new FormatException(); - } - using (var entryStream = dataEntry.Open()) - { - var document = XDocument.Load(entryStream); - - var version = document.Root.Attribute(XmlVersionAttribute)?.Value; - var platform = document.Root.Attribute(XmlTypeAttribute)?.Value; - if (platform != Constants.Platform) - { - logger.Log(LogLevel.Warning, $"The platform of the file ({platform}) doesn't match the program platform ({Constants.Platform})."); - } - - var classes = new List>(); - - foreach (var element in document.Root - .Element(XmlClassesElement) - .Elements(XmlClassElement) - .DistinctBy(e => e.Attribute(XmlUuidAttribute)?.Value)) - { - var node = new ClassNode(false) - { - Uuid = NodeUuid.FromBase64String(element.Attribute(XmlUuidAttribute)?.Value, true), - Name = element.Attribute(XmlNameAttribute)?.Value ?? string.Empty, - Comment = element.Attribute(XmlCommentAttribute)?.Value ?? string.Empty, - AddressFormula = element.Attribute(XmlAddressAttribute)?.Value ?? string.Empty - }; - - if (!project.ContainsClass(node.Uuid)) - { - project.AddClass(node); - - classes.Add(Tuple.Create(element, node)); - } - } - - foreach (var t in classes) - { - ReadNodeElements( - t.Item1.Elements(XmlNodeElement), - t.Item2, - logger - ).ForEach(t.Item2.AddNode); - } - } - } - } - - private IEnumerable ReadNodeElements(IEnumerable elements, ClassNode parent, ILogger logger) - { - Contract.Requires(elements != null); - Contract.Requires(parent != null); - Contract.Requires(logger != null); - - foreach (var element in elements) - { - var converter = CustomNodeConvert.GetReadConverter(element); - if (converter != null) - { - BaseNode customNode; - if (converter.TryCreateNodeFromElement(element, parent, project.Classes, logger, out customNode)) - { - yield return customNode; - } - - continue; - } - - Type nodeType; - if (!BuildInStringToTypeMap.TryGetValue(element.Attribute(XmlTypeAttribute)?.Value, out nodeType)) - { - logger.Log(LogLevel.Error, $"Skipping node with unknown type: {element.Attribute(XmlTypeAttribute)?.Value}"); - logger.Log(LogLevel.Warning, element.ToString()); - - continue; - } - - var node = Activator.CreateInstance(nodeType) as BaseNode; - if (node == null) - { - logger.Log(LogLevel.Error, $"Could not create node of type: {nodeType}"); - - continue; - } - - node.Name = element.Attribute(XmlNameAttribute)?.Value ?? string.Empty; - node.Comment = element.Attribute(XmlCommentAttribute)?.Value ?? string.Empty; - - var referenceNode = node as BaseReferenceNode; - if (referenceNode != null) - { - var reference = NodeUuid.FromBase64String(element.Attribute(XmlReferenceAttribute)?.Value, false); - if (!project.ContainsClass(reference)) - { - logger.Log(LogLevel.Error, $"Skipping node with unknown reference: {reference}"); - logger.Log(LogLevel.Warning, element.ToString()); - - continue; - } - - var innerClassNode = project.GetClassByUuid(reference); - if (referenceNode.PerformCycleCheck && !ClassUtil.IsCycleFree(parent, innerClassNode, project.Classes)) - { - logger.Log(LogLevel.Error, $"Skipping node with cycle reference: {parent.Name}->{node.Name}"); - - continue; - } - - referenceNode.ChangeInnerNode(innerClassNode); - } - var vtableNode = node as VTableNode; - if (vtableNode != null) - { - element - .Elements(XmlMethodElement) - .Select(e => new VMethodNode - { - Name = e.Attribute(XmlNameAttribute)?.Value ?? string.Empty, - Comment = e.Attribute(XmlCommentAttribute)?.Value ?? string.Empty - }) - .ForEach(vtableNode.AddNode); - } - var arrayNode = node as BaseArrayNode; - if (arrayNode != null) - { - int count; - TryGetAttributeValue(element, XmlCountAttribute, out count, logger); - arrayNode.Count = count; - } - var textNode = node as BaseTextNode; - if (textNode != null) - { - int length; - TryGetAttributeValue(element, XmlLengthAttribute, out length, logger); - textNode.Length = length; - } - var bitFieldNode = node as BitFieldNode; - if (bitFieldNode != null) - { - int bits; - TryGetAttributeValue(element, XmlBitsAttribute, out bits, logger); - bitFieldNode.Bits = bits; - } - - yield return node; - } - } - - private static void TryGetAttributeValue(XElement element, string attribute, out int val, ILogger logger) - { - if (!int.TryParse(element.Attribute(attribute)?.Value, out val)) - { - val = 0; - - logger.Log(LogLevel.Error, $"Node is missing a valid '{attribute}' attribute, defaulting to 0."); - logger.Log(LogLevel.Warning, element.ToString()); - } - } - - public static Tuple, List> ReadNodes(Stream input, ReClassNetProject templateProject, ILogger logger) - { - Contract.Requires(input != null); - Contract.Requires(logger != null); - - using (var project = new ReClassNetProject()) - { - if (templateProject != null) - { - templateProject.Classes.ForEach(project.AddClass); - } - - var file = new ReClassNetFile(project); - file.Load(input, logger); - - var classes = new List(); - - var nodes = new List(); - - var serialisationClassNode = project.Classes.FirstOrDefault(c => c.Name == SerialisationClassName); - if (serialisationClassNode != null) - { - if (templateProject != null) - { - foreach (var classNode in project.Classes.Where(c => c != serialisationClassNode)) - { - if (!templateProject.ContainsClass(classNode.Uuid)) - { - classes.Add(classNode); - } - } - } - - nodes.AddRange(serialisationClassNode.Nodes); - - project.Remove(serialisationClassNode); - } - - return Tuple.Create(classes, nodes); - } - } - } -} diff --git a/DataExchange/ReClassNetFile.Write.cs b/DataExchange/ReClassNetFile.Write.cs deleted file mode 100644 index ba00f1b4..00000000 --- a/DataExchange/ReClassNetFile.Write.cs +++ /dev/null @@ -1,183 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.IO; -using System.IO.Compression; -using System.Linq; -using System.Xml.Linq; -using ReClassNET.Logger; -using ReClassNET.Nodes; -using ReClassNET.Util; - -namespace ReClassNET.DataExchange -{ - public partial class ReClassNetFile - { - public void Save(string filePath, ILogger logger) - { - using (var fs = new FileStream(filePath, FileMode.Create)) - { - Save(fs, logger); - } - } - - public void Save(Stream output, ILogger logger) - { - using (var archive = new ZipArchive(output, ZipArchiveMode.Create)) - { - var dataEntry = archive.CreateEntry(DataFileName); - using (var entryStream = dataEntry.Open()) - { - var document = new XDocument( - new XComment("ReClass.NET by KN4CK3R"), - new XElement( - XmlRootElement, - new XAttribute(XmlVersionAttribute, Version1), - new XAttribute(XmlTypeAttribute, Constants.Platform), - new XElement(XmlClassesElement, CreateClassElements(project.Classes, logger)) - ) - ); - - document.Save(entryStream); - } - } - } - - private IEnumerable CreateClassElements(IEnumerable classes, ILogger logger) - { - Contract.Requires(classes != null); - Contract.Requires(logger != null); - Contract.Ensures(Contract.Result>() != null); - - return classes.Select(c => new XElement( - XmlClassElement, - new XAttribute(XmlUuidAttribute, c.Uuid.ToBase64String()), - new XAttribute(XmlNameAttribute, c.Name ?? string.Empty), - new XAttribute(XmlCommentAttribute, c.Comment ?? string.Empty), - new XAttribute(XmlAddressAttribute, c.AddressFormula ?? string.Empty), - CreateNodeElements(c.Nodes, logger) - )); - } - - private IEnumerable CreateNodeElements(IEnumerable nodes, ILogger logger) - { - Contract.Requires(nodes != null); - Contract.Requires(logger != null); - Contract.Ensures(Contract.Result>() != null); - - foreach (var node in nodes) - { - var converter = CustomNodeConvert.GetWriteConverter(node); - if (converter != null) - { - yield return converter.CreateElementFromNode(node, logger); - - continue; - } - - string typeString; - if (!BuildInTypeToStringMap.TryGetValue(node.GetType(), out typeString)) - { - logger.Log(LogLevel.Error, $"Skipping node with unknown type: {node.Name}"); - logger.Log(LogLevel.Warning, node.GetType().ToString()); - - continue; - } - - var element = new XElement( - XmlNodeElement, - new XAttribute(XmlNameAttribute, node.Name ?? string.Empty), - new XAttribute(XmlCommentAttribute, node.Comment ?? string.Empty), - new XAttribute(XmlTypeAttribute, typeString) - ); - - var referenceNode = node as BaseReferenceNode; - if (referenceNode != null) - { - element.SetAttributeValue(XmlReferenceAttribute, referenceNode.InnerNode.Uuid.ToBase64String()); - } - var vtableNode = node as VTableNode; - if (vtableNode != null) - { - element.Add(vtableNode.Nodes.Select(n => new XElement( - XmlMethodElement, - new XAttribute(XmlNameAttribute, n.Name ?? string.Empty), - new XAttribute(XmlCommentAttribute, n.Comment ?? string.Empty) - ))); - } - var arrayNode = node as BaseArrayNode; - if (arrayNode != null) - { - element.SetAttributeValue(XmlCountAttribute, arrayNode.Count); - } - var textNode = node as BaseTextNode; - if (textNode != null) - { - element.SetAttributeValue(XmlLengthAttribute, textNode.Length); - } - var bitFieldNode = node as BitFieldNode; - if (bitFieldNode != null) - { - element.SetAttributeValue(XmlBitsAttribute, bitFieldNode.Bits); - } - - yield return element; - } - } - - public static void WriteNodes(Stream output, IEnumerable nodes, ILogger logger) - { - Contract.Requires(output != null); - Contract.Requires(nodes != null); - Contract.Requires(logger != null); - - using (var project = new ReClassNetProject()) - { - Action recursiveAddReferences = null; - recursiveAddReferences = delegate (BaseReferenceNode referenceNode) - { - if (project.ContainsClass(referenceNode.InnerNode.Uuid)) - { - return; - } - - project.AddClass(referenceNode.InnerNode); - - foreach (var reference in referenceNode.InnerNode.Nodes.OfType()) - { - recursiveAddReferences(reference); - } - }; - - var serialisationClass = new ClassNode(false) - { - Name = SerialisationClassName - }; - - project.AddClass(serialisationClass); - - foreach (var node in nodes) - { - var classNode = node as ClassNode; - if (classNode != null) - { - project.AddClass(classNode); - - continue; - } - - var referenceNode = node as BaseReferenceNode; - if (referenceNode != null) - { - recursiveAddReferences(referenceNode); - } - - serialisationClass.AddNode(node); - } - - var file = new ReClassNetFile(project); - file.Save(output, logger); - } - } - } -} diff --git a/DataExchange/ReClassNetFile.cs b/DataExchange/ReClassNetFile.cs deleted file mode 100644 index 1b40d125..00000000 --- a/DataExchange/ReClassNetFile.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.IO; -using System.IO.Compression; -using System.Linq; -using System.Xml.Linq; -using ReClassNET.Logger; -using ReClassNET.Nodes; -using ReClassNET.Util; - -namespace ReClassNET.DataExchange -{ - public partial class ReClassNetFile : IReClassImport, IReClassExport - { - public const string FormatName = "ReClass.NET File"; - public const string FileExtension = ".rcnet"; - - private const string Version1 = "1"; - - private const string DataFileName = "Data.xml"; - - private const string SerialisationClassName = "__Serialization_Class__"; - - public const string XmlRootElement = "reclass"; - public const string XmlClassesElement = "classes"; - public const string XmlClassElement = "class"; - public const string XmlNodeElement = "node"; - public const string XmlMethodElement = "method"; - public const string XmlVersionAttribute = "version"; - public const string XmlUuidAttribute = "uuid"; - public const string XmlNameAttribute = "name"; - public const string XmlCommentAttribute = "comment"; - public const string XmlAddressAttribute = "address"; - public const string XmlTypeAttribute = "type"; - public const string XmlReferenceAttribute = "reference"; - public const string XmlCountAttribute = "count"; - public const string XmlBitsAttribute = "bits"; - public const string XmlLengthAttribute = "length"; - - private ReClassNetProject project; - - public ReClassNetFile(ReClassNetProject project) - { - Contract.Requires(project != null); - - this.project = project; - } - - private static Dictionary BuildInStringToTypeMap = new Type[] - { - typeof(BitFieldNode), - typeof(ClassInstanceArrayNode), - typeof(ClassInstanceNode), - typeof(ClassPtrArrayNode), - typeof(ClassPtrNode), - typeof(DoubleNode), - typeof(FloatNode), - typeof(FunctionPtrNode), - typeof(Hex8Node), - typeof(Hex16Node), - typeof(Hex32Node), - typeof(Hex64Node), - typeof(Int8Node), - typeof(Int16Node), - typeof(Int32Node), - typeof(Int64Node), - typeof(Matrix3x3Node), - typeof(Matrix3x4Node), - typeof(Matrix4x4Node), - typeof(UInt8Node), - typeof(UInt16Node), - typeof(UInt32Node), - typeof(UInt64Node), - typeof(UTF8TextNode), - typeof(UTF8TextPtrNode), - typeof(UTF16TextNode), - typeof(UTF16TextPtrNode), - typeof(UTF32TextNode), - typeof(UTF32TextPtrNode), - typeof(Vector2Node), - typeof(Vector3Node), - typeof(Vector4Node), - typeof(VTableNode) - }.ToDictionary(t => t.Name, t => t); - private static Dictionary BuildInTypeToStringMap = BuildInStringToTypeMap.ToDictionary(kv => kv.Value, kv => kv.Key); - } -} diff --git a/Dependencies/ColorCode.dll b/Dependencies/ColorCode.dll index fa5dc5ec..ab841941 100644 Binary files a/Dependencies/ColorCode.dll and b/Dependencies/ColorCode.dll differ diff --git a/Dependencies/nuget.exe b/Dependencies/nuget.exe new file mode 100644 index 00000000..dfe622ae Binary files /dev/null and b/Dependencies/nuget.exe differ diff --git a/Forms/CodeForm.cs b/Forms/CodeForm.cs deleted file mode 100644 index baa4fbff..00000000 --- a/Forms/CodeForm.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.Windows.Forms; -using ColorCode; -using ReClassNET.CodeGenerator; -using ReClassNET.Logger; -using ReClassNET.Nodes; -using ReClassNET.UI; - -namespace ReClassNET.Forms -{ - public partial class CodeForm : IconForm - { - public CodeForm(ICodeGenerator generator, IEnumerable classes, ILogger logger) - { - Contract.Requires(generator != null); - Contract.Requires(classes != null); - - InitializeComponent(); - - var code = generator.GenerateCode(classes, logger); - codeWebBrowser.DocumentText = new CodeColorizer().Colorize(code, generator.Language == Language.Cpp ? Languages.Cpp : Languages.CSharp); - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - GlobalWindowManager.AddWindow(this); - } - - protected override void OnFormClosed(FormClosedEventArgs e) - { - base.OnFormClosed(e); - - GlobalWindowManager.RemoveWindow(this); - } - } -} diff --git a/Forms/MainForm.Designer.cs b/Forms/MainForm.Designer.cs deleted file mode 100644 index efe821e4..00000000 --- a/Forms/MainForm.Designer.cs +++ /dev/null @@ -1,1289 +0,0 @@ -namespace ReClassNET.Forms -{ - partial class MainForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); - this.processUpdateTimer = new System.Windows.Forms.Timer(this.components); - this.splitContainer = new System.Windows.Forms.SplitContainer(); - this.classesView = new ReClassNET.UI.ClassNodeView(); - this.memoryViewControl = new ReClassNET.UI.MemoryViewControl(); - this.toolStrip = new System.Windows.Forms.ToolStrip(); - this.selectProcessToolStripButton = new System.Windows.Forms.ToolStripButton(); - this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); - this.openProjectToolStripButton = new System.Windows.Forms.ToolStripButton(); - this.saveToolStripButton = new System.Windows.Forms.ToolStripButton(); - this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); - this.newClassToolStripButton = new System.Windows.Forms.ToolStripButton(); - this.addBytesToolStripDropDownButton = new System.Windows.Forms.ToolStripDropDownButton(); - this.add4BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.add8BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.add64BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.add256BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.add1024BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.add2048BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.add4096BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.addXBytesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.insertBytesToolStripDropDownButton = new System.Windows.Forms.ToolStripDropDownButton(); - this.insert4BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.insert8BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.insert64BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.insert256BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.insert1024BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.insert2048BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.insert4096BytesToolStripMenuItem = new ReClassNET.UI.IntegerToolStripMenuItem(); - this.insertXBytesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); - this.hex64ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.hex32ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.hex16ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.hex8ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); - this.int64ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.int32ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.int16ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.int8ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator(); - this.uint64ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.uint32ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.uint16ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.uint8ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator(); - this.bitFieldToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.toolStripSeparator18 = new System.Windows.Forms.ToolStripSeparator(); - this.floatToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.doubleToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); - this.vec4ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.vec3ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.vec2ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.mat44ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.mat34ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.mat33ToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator(); - this.utf8TextToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.utf8TextPtrToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.utf16TextToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.utf16TextPtrToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.toolStripSeparator14 = new System.Windows.Forms.ToolStripSeparator(); - this.classInstanceToolStripButton6 = new ReClassNET.UI.TypeToolStripButton(); - this.classPtrToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator(); - this.arrayToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.ptrArrayToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.vtableToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.fnPtrToolStripButton = new ReClassNET.UI.TypeToolStripButton(); - this.toolStripSeparator19 = new System.Windows.Forms.ToolStripSeparator(); - this.statusStrip = new System.Windows.Forms.StatusStrip(); - this.processInfoToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); - this.infoToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); - this.mainMenuStrip = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.selectProcessToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.openProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.mergeWithProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.clearProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.pluginsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); - this.quitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.processToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.memoryViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator(); - this.loadSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.loadSymbolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); - this.resumeProcessToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.suspendProcessToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.terminateProcessToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.projectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.cleanUnusedClassesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator(); - this.generateCppCodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.generateCSharpCodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); - this.splitContainer.Panel1.SuspendLayout(); - this.splitContainer.Panel2.SuspendLayout(); - this.splitContainer.SuspendLayout(); - this.toolStrip.SuspendLayout(); - this.statusStrip.SuspendLayout(); - this.mainMenuStrip.SuspendLayout(); - this.SuspendLayout(); - // - // processUpdateTimer - // - this.processUpdateTimer.Enabled = true; - this.processUpdateTimer.Interval = 5000; - this.processUpdateTimer.Tick += new System.EventHandler(this.processUpdateTimer_Tick); - // - // splitContainer - // - this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; - this.splitContainer.Location = new System.Drawing.Point(0, 49); - this.splitContainer.Name = "splitContainer"; - // - // splitContainer.Panel1 - // - this.splitContainer.Panel1.Controls.Add(this.classesView); - // - // splitContainer.Panel2 - // - this.splitContainer.Panel2.BackColor = System.Drawing.SystemColors.Control; - this.splitContainer.Panel2.Controls.Add(this.memoryViewControl); - this.splitContainer.Size = new System.Drawing.Size(1141, 524); - this.splitContainer.SplitterDistance = 201; - this.splitContainer.TabIndex = 4; - // - // classesView - // - this.classesView.Dock = System.Windows.Forms.DockStyle.Fill; - this.classesView.Location = new System.Drawing.Point(0, 0); - this.classesView.Name = "classesView"; - this.classesView.Size = new System.Drawing.Size(201, 524); - this.classesView.TabIndex = 0; - this.classesView.SelectionChanged += new ReClassNET.UI.ClassNodeView.SelectionChangedEvent(this.classesView_ClassSelected); - // - // memoryViewControl - // - this.memoryViewControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.memoryViewControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.memoryViewControl.Location = new System.Drawing.Point(0, 0); - this.memoryViewControl.Name = "memoryViewControl"; - this.memoryViewControl.Size = new System.Drawing.Size(936, 524); - this.memoryViewControl.TabIndex = 0; - this.memoryViewControl.SelectionChanged += new System.EventHandler(this.memoryViewControl_SelectionChanged); - // - // toolStrip - // - this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.selectProcessToolStripButton, - this.toolStripSeparator6, - this.openProjectToolStripButton, - this.saveToolStripButton, - this.toolStripSeparator7, - this.newClassToolStripButton, - this.addBytesToolStripDropDownButton, - this.insertBytesToolStripDropDownButton, - this.toolStripSeparator8, - this.hex64ToolStripButton, - this.hex32ToolStripButton, - this.hex16ToolStripButton, - this.hex8ToolStripButton, - this.toolStripSeparator9, - this.int64ToolStripButton, - this.int32ToolStripButton, - this.int16ToolStripButton, - this.int8ToolStripButton, - this.toolStripSeparator10, - this.uint64ToolStripButton, - this.uint32ToolStripButton, - this.uint16ToolStripButton, - this.uint8ToolStripButton, - this.toolStripSeparator11, - this.bitFieldToolStripButton, - this.toolStripSeparator18, - this.floatToolStripButton, - this.doubleToolStripButton, - this.toolStripSeparator12, - this.vec4ToolStripButton, - this.vec3ToolStripButton, - this.vec2ToolStripButton, - this.mat44ToolStripButton, - this.mat34ToolStripButton, - this.mat33ToolStripButton, - this.toolStripSeparator13, - this.utf8TextToolStripButton, - this.utf8TextPtrToolStripButton, - this.utf16TextToolStripButton, - this.utf16TextPtrToolStripButton, - this.toolStripSeparator14, - this.classInstanceToolStripButton6, - this.classPtrToolStripButton, - this.toolStripSeparator15, - this.arrayToolStripButton, - this.ptrArrayToolStripButton, - this.vtableToolStripButton, - this.fnPtrToolStripButton, - this.toolStripSeparator19}); - this.toolStrip.Location = new System.Drawing.Point(0, 24); - this.toolStrip.Name = "toolStrip"; - this.toolStrip.Size = new System.Drawing.Size(1141, 25); - this.toolStrip.TabIndex = 3; - // - // selectProcessToolStripButton - // - this.selectProcessToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.selectProcessToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Magnifier; - this.selectProcessToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.selectProcessToolStripButton.Name = "selectProcessToolStripButton"; - this.selectProcessToolStripButton.Size = new System.Drawing.Size(23, 22); - this.selectProcessToolStripButton.ToolTipText = "Select Process..."; - this.selectProcessToolStripButton.Click += new System.EventHandler(this.selectProcessToolStripMenuItem_Click); - // - // toolStripSeparator6 - // - this.toolStripSeparator6.Name = "toolStripSeparator6"; - this.toolStripSeparator6.Size = new System.Drawing.Size(6, 25); - // - // openProjectToolStripButton - // - this.openProjectToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.openProjectToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Folder; - this.openProjectToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.openProjectToolStripButton.Name = "openProjectToolStripButton"; - this.openProjectToolStripButton.Size = new System.Drawing.Size(23, 22); - this.openProjectToolStripButton.ToolTipText = "Open Project..."; - this.openProjectToolStripButton.Click += new System.EventHandler(this.openProjectToolStripMenuItem_Click); - // - // saveToolStripButton - // - this.saveToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.saveToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Save; - this.saveToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.saveToolStripButton.Name = "saveToolStripButton"; - this.saveToolStripButton.Size = new System.Drawing.Size(23, 22); - this.saveToolStripButton.ToolTipText = "Save Project"; - this.saveToolStripButton.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); - // - // toolStripSeparator7 - // - this.toolStripSeparator7.Name = "toolStripSeparator7"; - this.toolStripSeparator7.Size = new System.Drawing.Size(6, 25); - // - // newClassToolStripButton - // - this.newClassToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.newClassToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Class_Add; - this.newClassToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.newClassToolStripButton.Name = "newClassToolStripButton"; - this.newClassToolStripButton.Size = new System.Drawing.Size(23, 22); - this.newClassToolStripButton.Text = "addClassToolStripButton"; - this.newClassToolStripButton.ToolTipText = "Add a new class to this project"; - this.newClassToolStripButton.Click += new System.EventHandler(this.newClassToolStripButton_Click); - // - // addBytesToolStripDropDownButton - // - this.addBytesToolStripDropDownButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.addBytesToolStripDropDownButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.add4BytesToolStripMenuItem, - this.add8BytesToolStripMenuItem, - this.add64BytesToolStripMenuItem, - this.add256BytesToolStripMenuItem, - this.add1024BytesToolStripMenuItem, - this.add2048BytesToolStripMenuItem, - this.add4096BytesToolStripMenuItem, - this.addXBytesToolStripMenuItem}); - this.addBytesToolStripDropDownButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_X; - this.addBytesToolStripDropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.addBytesToolStripDropDownButton.Name = "addBytesToolStripDropDownButton"; - this.addBytesToolStripDropDownButton.Size = new System.Drawing.Size(29, 22); - // - // add4BytesToolStripMenuItem - // - this.add4BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_4; - this.add4BytesToolStripMenuItem.Name = "add4BytesToolStripMenuItem"; - this.add4BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); - this.add4BytesToolStripMenuItem.Tag = ""; - this.add4BytesToolStripMenuItem.Text = "Add 4 Bytes"; - this.add4BytesToolStripMenuItem.Value = 4; - this.add4BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); - // - // add8BytesToolStripMenuItem - // - this.add8BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_8; - this.add8BytesToolStripMenuItem.Name = "add8BytesToolStripMenuItem"; - this.add8BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); - this.add8BytesToolStripMenuItem.Text = "Add 8 Bytes"; - this.add8BytesToolStripMenuItem.Value = 8; - this.add8BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); - // - // add64BytesToolStripMenuItem - // - this.add64BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_64; - this.add64BytesToolStripMenuItem.Name = "add64BytesToolStripMenuItem"; - this.add64BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); - this.add64BytesToolStripMenuItem.Text = "Add 64 Bytes"; - this.add64BytesToolStripMenuItem.Value = 64; - this.add64BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); - // - // add256BytesToolStripMenuItem - // - this.add256BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_256; - this.add256BytesToolStripMenuItem.Name = "add256BytesToolStripMenuItem"; - this.add256BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); - this.add256BytesToolStripMenuItem.Text = "Add 256 Bytes"; - this.add256BytesToolStripMenuItem.Value = 256; - this.add256BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); - // - // add1024BytesToolStripMenuItem - // - this.add1024BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_1024; - this.add1024BytesToolStripMenuItem.Name = "add1024BytesToolStripMenuItem"; - this.add1024BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); - this.add1024BytesToolStripMenuItem.Text = "Add 1024 Bytes"; - this.add1024BytesToolStripMenuItem.Value = 1024; - this.add1024BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); - // - // add2048BytesToolStripMenuItem - // - this.add2048BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_2048; - this.add2048BytesToolStripMenuItem.Name = "add2048BytesToolStripMenuItem"; - this.add2048BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); - this.add2048BytesToolStripMenuItem.Text = "Add 2048 Bytes"; - this.add2048BytesToolStripMenuItem.Value = 2048; - this.add2048BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); - // - // add4096BytesToolStripMenuItem - // - this.add4096BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_4096; - this.add4096BytesToolStripMenuItem.Name = "add4096BytesToolStripMenuItem"; - this.add4096BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); - this.add4096BytesToolStripMenuItem.Text = "Add 4096 Bytes"; - this.add4096BytesToolStripMenuItem.Value = 4096; - this.add4096BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); - // - // addXBytesToolStripMenuItem - // - this.addXBytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_X; - this.addXBytesToolStripMenuItem.Name = "addXBytesToolStripMenuItem"; - this.addXBytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); - this.addXBytesToolStripMenuItem.Text = "Add ... Bytes"; - this.addXBytesToolStripMenuItem.Click += new System.EventHandler(this.addXBytesToolStripMenuItem_Click); - // - // insertBytesToolStripDropDownButton - // - this.insertBytesToolStripDropDownButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.insertBytesToolStripDropDownButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.insert4BytesToolStripMenuItem, - this.insert8BytesToolStripMenuItem, - this.insert64BytesToolStripMenuItem, - this.insert256BytesToolStripMenuItem, - this.insert1024BytesToolStripMenuItem, - this.insert2048BytesToolStripMenuItem, - this.insert4096BytesToolStripMenuItem, - this.insertXBytesToolStripMenuItem}); - this.insertBytesToolStripDropDownButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_X; - this.insertBytesToolStripDropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.insertBytesToolStripDropDownButton.Name = "insertBytesToolStripDropDownButton"; - this.insertBytesToolStripDropDownButton.Size = new System.Drawing.Size(29, 22); - this.insertBytesToolStripDropDownButton.ToolTipText = "Insert bytes at selected position"; - // - // insert4BytesToolStripMenuItem - // - this.insert4BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_4; - this.insert4BytesToolStripMenuItem.Name = "insert4BytesToolStripMenuItem"; - this.insert4BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); - this.insert4BytesToolStripMenuItem.Tag = ""; - this.insert4BytesToolStripMenuItem.Text = "Insert 4 Bytes"; - this.insert4BytesToolStripMenuItem.Value = 4; - this.insert4BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); - // - // insert8BytesToolStripMenuItem - // - this.insert8BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_8; - this.insert8BytesToolStripMenuItem.Name = "insert8BytesToolStripMenuItem"; - this.insert8BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); - this.insert8BytesToolStripMenuItem.Text = "Insert 8 Bytes"; - this.insert8BytesToolStripMenuItem.Value = 8; - this.insert8BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); - // - // insert64BytesToolStripMenuItem - // - this.insert64BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_64; - this.insert64BytesToolStripMenuItem.Name = "insert64BytesToolStripMenuItem"; - this.insert64BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); - this.insert64BytesToolStripMenuItem.Text = "Insert 64 Bytes"; - this.insert64BytesToolStripMenuItem.Value = 64; - this.insert64BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); - // - // insert256BytesToolStripMenuItem - // - this.insert256BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_256; - this.insert256BytesToolStripMenuItem.Name = "insert256BytesToolStripMenuItem"; - this.insert256BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); - this.insert256BytesToolStripMenuItem.Text = "Insert 256 Bytes"; - this.insert256BytesToolStripMenuItem.Value = 256; - this.insert256BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); - // - // insert1024BytesToolStripMenuItem - // - this.insert1024BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_1024; - this.insert1024BytesToolStripMenuItem.Name = "insert1024BytesToolStripMenuItem"; - this.insert1024BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); - this.insert1024BytesToolStripMenuItem.Text = "Insert 1024 Bytes"; - this.insert1024BytesToolStripMenuItem.Value = 1024; - this.insert1024BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); - // - // insert2048BytesToolStripMenuItem - // - this.insert2048BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_2048; - this.insert2048BytesToolStripMenuItem.Name = "insert2048BytesToolStripMenuItem"; - this.insert2048BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); - this.insert2048BytesToolStripMenuItem.Text = "Insert 2048 Bytes"; - this.insert2048BytesToolStripMenuItem.Value = 2048; - this.insert2048BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); - // - // insert4096BytesToolStripMenuItem - // - this.insert4096BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_4096; - this.insert4096BytesToolStripMenuItem.Name = "insert4096BytesToolStripMenuItem"; - this.insert4096BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); - this.insert4096BytesToolStripMenuItem.Text = "Insert 4096 Bytes"; - this.insert4096BytesToolStripMenuItem.Value = 4096; - this.insert4096BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); - // - // insertXBytesToolStripMenuItem - // - this.insertXBytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_X; - this.insertXBytesToolStripMenuItem.Name = "insertXBytesToolStripMenuItem"; - this.insertXBytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); - this.insertXBytesToolStripMenuItem.Text = "Insert ... Bytes"; - this.insertXBytesToolStripMenuItem.Click += new System.EventHandler(this.insertXBytesToolStripMenuItem_Click); - // - // toolStripSeparator8 - // - this.toolStripSeparator8.Name = "toolStripSeparator8"; - this.toolStripSeparator8.Size = new System.Drawing.Size(6, 25); - // - // hex64ToolStripButton - // - this.hex64ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.hex64ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Hex_64; - this.hex64ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.hex64ToolStripButton.Name = "hex64ToolStripButton"; - this.hex64ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.hex64ToolStripButton.ToolTipText = "Hex64"; - this.hex64ToolStripButton.Value = typeof(ReClassNET.Nodes.Hex64Node); - this.hex64ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // hex32ToolStripButton - // - this.hex32ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.hex32ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Hex_32; - this.hex32ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.hex32ToolStripButton.Name = "hex32ToolStripButton"; - this.hex32ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.hex32ToolStripButton.ToolTipText = "Hex32"; - this.hex32ToolStripButton.Value = typeof(ReClassNET.Nodes.Hex32Node); - this.hex32ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // hex16ToolStripButton - // - this.hex16ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.hex16ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Hex_16; - this.hex16ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.hex16ToolStripButton.Name = "hex16ToolStripButton"; - this.hex16ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.hex16ToolStripButton.ToolTipText = "Hex16"; - this.hex16ToolStripButton.Value = typeof(ReClassNET.Nodes.Hex16Node); - this.hex16ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // hex8ToolStripButton - // - this.hex8ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.hex8ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Hex_8; - this.hex8ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.hex8ToolStripButton.Name = "hex8ToolStripButton"; - this.hex8ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.hex8ToolStripButton.ToolTipText = "Hex8"; - this.hex8ToolStripButton.Value = typeof(ReClassNET.Nodes.Hex8Node); - this.hex8ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // toolStripSeparator9 - // - this.toolStripSeparator9.Name = "toolStripSeparator9"; - this.toolStripSeparator9.Size = new System.Drawing.Size(6, 25); - // - // int64ToolStripButton - // - this.int64ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.int64ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Int_64; - this.int64ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.int64ToolStripButton.Name = "int64ToolStripButton"; - this.int64ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.int64ToolStripButton.ToolTipText = "Int64"; - this.int64ToolStripButton.Value = typeof(ReClassNET.Nodes.Int64Node); - this.int64ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // int32ToolStripButton - // - this.int32ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.int32ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Int_32; - this.int32ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.int32ToolStripButton.Name = "int32ToolStripButton"; - this.int32ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.int32ToolStripButton.ToolTipText = "Int32"; - this.int32ToolStripButton.Value = typeof(ReClassNET.Nodes.Int32Node); - this.int32ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // int16ToolStripButton - // - this.int16ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.int16ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Int_16; - this.int16ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.int16ToolStripButton.Name = "int16ToolStripButton"; - this.int16ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.int16ToolStripButton.ToolTipText = "Int16"; - this.int16ToolStripButton.Value = typeof(ReClassNET.Nodes.Int16Node); - this.int16ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // int8ToolStripButton - // - this.int8ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.int8ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Int_8; - this.int8ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.int8ToolStripButton.Name = "int8ToolStripButton"; - this.int8ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.int8ToolStripButton.ToolTipText = "Int8"; - this.int8ToolStripButton.Value = typeof(ReClassNET.Nodes.Int8Node); - this.int8ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // toolStripSeparator10 - // - this.toolStripSeparator10.Name = "toolStripSeparator10"; - this.toolStripSeparator10.Size = new System.Drawing.Size(6, 25); - // - // uint64ToolStripButton - // - this.uint64ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.uint64ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_UInt_64; - this.uint64ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.uint64ToolStripButton.Name = "uint64ToolStripButton"; - this.uint64ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.uint64ToolStripButton.ToolTipText = "UInt64 / QWORD"; - this.uint64ToolStripButton.Value = typeof(ReClassNET.Nodes.UInt64Node); - this.uint64ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // uint32ToolStripButton - // - this.uint32ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.uint32ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_UInt_32; - this.uint32ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.uint32ToolStripButton.Name = "uint32ToolStripButton"; - this.uint32ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.uint32ToolStripButton.ToolTipText = "UInt32 / DWORD"; - this.uint32ToolStripButton.Value = typeof(ReClassNET.Nodes.UInt32Node); - this.uint32ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // uint16ToolStripButton - // - this.uint16ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.uint16ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_UInt_16; - this.uint16ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.uint16ToolStripButton.Name = "uint16ToolStripButton"; - this.uint16ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.uint16ToolStripButton.ToolTipText = "UInt16 / WORD"; - this.uint16ToolStripButton.Value = typeof(ReClassNET.Nodes.UInt16Node); - this.uint16ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // uint8ToolStripButton - // - this.uint8ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.uint8ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_UInt_8; - this.uint8ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.uint8ToolStripButton.Name = "uint8ToolStripButton"; - this.uint8ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.uint8ToolStripButton.ToolTipText = "UInt8 / BYTE"; - this.uint8ToolStripButton.Value = typeof(ReClassNET.Nodes.UInt8Node); - this.uint8ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // toolStripSeparator11 - // - this.toolStripSeparator11.Name = "toolStripSeparator11"; - this.toolStripSeparator11.Size = new System.Drawing.Size(6, 25); - // - // bitFieldToolStripButton - // - this.bitFieldToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.bitFieldToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Bits; - this.bitFieldToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.bitFieldToolStripButton.Name = "bitFieldToolStripButton"; - this.bitFieldToolStripButton.Size = new System.Drawing.Size(23, 22); - this.bitFieldToolStripButton.ToolTipText = "Bit Field"; - this.bitFieldToolStripButton.Value = typeof(ReClassNET.Nodes.BitFieldNode); - this.bitFieldToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // toolStripSeparator18 - // - this.toolStripSeparator18.Name = "toolStripSeparator18"; - this.toolStripSeparator18.Size = new System.Drawing.Size(6, 25); - // - // floatToolStripButton - // - this.floatToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.floatToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Float; - this.floatToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.floatToolStripButton.Name = "floatToolStripButton"; - this.floatToolStripButton.Size = new System.Drawing.Size(23, 22); - this.floatToolStripButton.ToolTipText = "Float"; - this.floatToolStripButton.Value = typeof(ReClassNET.Nodes.FloatNode); - this.floatToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // doubleToolStripButton - // - this.doubleToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.doubleToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Double; - this.doubleToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.doubleToolStripButton.Name = "doubleToolStripButton"; - this.doubleToolStripButton.Size = new System.Drawing.Size(23, 22); - this.doubleToolStripButton.ToolTipText = "Double"; - this.doubleToolStripButton.Value = typeof(ReClassNET.Nodes.DoubleNode); - this.doubleToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // toolStripSeparator12 - // - this.toolStripSeparator12.Name = "toolStripSeparator12"; - this.toolStripSeparator12.Size = new System.Drawing.Size(6, 25); - // - // vec4ToolStripButton - // - this.vec4ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.vec4ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Vector_4; - this.vec4ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.vec4ToolStripButton.Name = "vec4ToolStripButton"; - this.vec4ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.vec4ToolStripButton.ToolTipText = "Vector4"; - this.vec4ToolStripButton.Value = typeof(ReClassNET.Nodes.Vector4Node); - this.vec4ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // vec3ToolStripButton - // - this.vec3ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.vec3ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Vector_3; - this.vec3ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.vec3ToolStripButton.Name = "vec3ToolStripButton"; - this.vec3ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.vec3ToolStripButton.ToolTipText = "Vector3"; - this.vec3ToolStripButton.Value = typeof(ReClassNET.Nodes.Vector3Node); - this.vec3ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // vec2ToolStripButton - // - this.vec2ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.vec2ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Vector_2; - this.vec2ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.vec2ToolStripButton.Name = "vec2ToolStripButton"; - this.vec2ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.vec2ToolStripButton.ToolTipText = "Vector2"; - this.vec2ToolStripButton.Value = typeof(ReClassNET.Nodes.Vector2Node); - this.vec2ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // mat44ToolStripButton - // - this.mat44ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.mat44ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Matrix_4x4; - this.mat44ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.mat44ToolStripButton.Name = "mat44ToolStripButton"; - this.mat44ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.mat44ToolStripButton.ToolTipText = "4x4 Matrix"; - this.mat44ToolStripButton.Value = typeof(ReClassNET.Nodes.Matrix4x4Node); - this.mat44ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // mat34ToolStripButton - // - this.mat34ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.mat34ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Matrix_3x4; - this.mat34ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.mat34ToolStripButton.Name = "mat34ToolStripButton"; - this.mat34ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.mat34ToolStripButton.ToolTipText = "3x4 Matrix"; - this.mat34ToolStripButton.Value = typeof(ReClassNET.Nodes.Matrix3x4Node); - this.mat34ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // mat33ToolStripButton - // - this.mat33ToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.mat33ToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Matrix_3x3; - this.mat33ToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.mat33ToolStripButton.Name = "mat33ToolStripButton"; - this.mat33ToolStripButton.Size = new System.Drawing.Size(23, 22); - this.mat33ToolStripButton.ToolTipText = "3x3 Matrix"; - this.mat33ToolStripButton.Value = typeof(ReClassNET.Nodes.Matrix3x3Node); - this.mat33ToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // toolStripSeparator13 - // - this.toolStripSeparator13.Name = "toolStripSeparator13"; - this.toolStripSeparator13.Size = new System.Drawing.Size(6, 25); - // - // utf8TextToolStripButton - // - this.utf8TextToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.utf8TextToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Text; - this.utf8TextToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.utf8TextToolStripButton.Name = "utf8TextToolStripButton"; - this.utf8TextToolStripButton.Size = new System.Drawing.Size(23, 22); - this.utf8TextToolStripButton.ToolTipText = "UTF8 Text"; - this.utf8TextToolStripButton.Value = typeof(ReClassNET.Nodes.UTF8TextNode); - this.utf8TextToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // utf8TextPtrToolStripButton - // - this.utf8TextPtrToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.utf8TextPtrToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Text_Pointer; - this.utf8TextPtrToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.utf8TextPtrToolStripButton.Name = "utf8TextPtrToolStripButton"; - this.utf8TextPtrToolStripButton.Size = new System.Drawing.Size(23, 22); - this.utf8TextPtrToolStripButton.ToolTipText = "Pointer to UTF8 text"; - this.utf8TextPtrToolStripButton.Value = typeof(ReClassNET.Nodes.UTF8TextPtrNode); - this.utf8TextPtrToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // utf16TextToolStripButton - // - this.utf16TextToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.utf16TextToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_UText; - this.utf16TextToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.utf16TextToolStripButton.Name = "utf16TextToolStripButton"; - this.utf16TextToolStripButton.Size = new System.Drawing.Size(23, 22); - this.utf16TextToolStripButton.ToolTipText = "UTF16 / Unicode Text"; - this.utf16TextToolStripButton.Value = typeof(ReClassNET.Nodes.UTF16TextNode); - this.utf16TextToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // utf16TextPtrToolStripButton - // - this.utf16TextPtrToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.utf16TextPtrToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_UText_Pointer; - this.utf16TextPtrToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.utf16TextPtrToolStripButton.Name = "utf16TextPtrToolStripButton"; - this.utf16TextPtrToolStripButton.Size = new System.Drawing.Size(23, 22); - this.utf16TextPtrToolStripButton.ToolTipText = "Pointer to UTF16 / Unicode text"; - this.utf16TextPtrToolStripButton.Value = typeof(ReClassNET.Nodes.UTF16TextPtrNode); - this.utf16TextPtrToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // toolStripSeparator14 - // - this.toolStripSeparator14.Name = "toolStripSeparator14"; - this.toolStripSeparator14.Size = new System.Drawing.Size(6, 25); - // - // classInstanceToolStripButton6 - // - this.classInstanceToolStripButton6.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.classInstanceToolStripButton6.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Class_Instance; - this.classInstanceToolStripButton6.ImageTransparentColor = System.Drawing.Color.Magenta; - this.classInstanceToolStripButton6.Name = "classInstanceToolStripButton6"; - this.classInstanceToolStripButton6.Size = new System.Drawing.Size(23, 22); - this.classInstanceToolStripButton6.ToolTipText = "Class instance"; - this.classInstanceToolStripButton6.Value = typeof(ReClassNET.Nodes.ClassInstanceNode); - this.classInstanceToolStripButton6.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // classPtrToolStripButton - // - this.classPtrToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.classPtrToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Class_Pointer; - this.classPtrToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.classPtrToolStripButton.Name = "classPtrToolStripButton"; - this.classPtrToolStripButton.Size = new System.Drawing.Size(23, 22); - this.classPtrToolStripButton.ToolTipText = "Pointer to class instance"; - this.classPtrToolStripButton.Value = typeof(ReClassNET.Nodes.ClassPtrNode); - this.classPtrToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // toolStripSeparator15 - // - this.toolStripSeparator15.Name = "toolStripSeparator15"; - this.toolStripSeparator15.Size = new System.Drawing.Size(6, 25); - // - // arrayToolStripButton - // - this.arrayToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.arrayToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Array; - this.arrayToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.arrayToolStripButton.Name = "arrayToolStripButton"; - this.arrayToolStripButton.Size = new System.Drawing.Size(23, 22); - this.arrayToolStripButton.ToolTipText = "Array of Classes"; - this.arrayToolStripButton.Value = typeof(ReClassNET.Nodes.ClassInstanceArrayNode); - this.arrayToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // ptrArrayToolStripButton - // - this.ptrArrayToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.ptrArrayToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Pointer_Array; - this.ptrArrayToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.ptrArrayToolStripButton.Name = "ptrArrayToolStripButton"; - this.ptrArrayToolStripButton.Size = new System.Drawing.Size(23, 22); - this.ptrArrayToolStripButton.ToolTipText = "Array of Pointers"; - this.ptrArrayToolStripButton.Value = typeof(ReClassNET.Nodes.ClassPtrArrayNode); - this.ptrArrayToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // vtableToolStripButton - // - this.vtableToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.vtableToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_VTable; - this.vtableToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.vtableToolStripButton.Name = "vtableToolStripButton"; - this.vtableToolStripButton.Size = new System.Drawing.Size(23, 22); - this.vtableToolStripButton.ToolTipText = "Pointer to VTable"; - this.vtableToolStripButton.Value = typeof(ReClassNET.Nodes.VTableNode); - this.vtableToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // fnPtrToolStripButton - // - this.fnPtrToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.fnPtrToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Function_Pointer; - this.fnPtrToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.fnPtrToolStripButton.Name = "fnPtrToolStripButton"; - this.fnPtrToolStripButton.Size = new System.Drawing.Size(23, 22); - this.fnPtrToolStripButton.ToolTipText = "Pointer to a function"; - this.fnPtrToolStripButton.Value = typeof(ReClassNET.Nodes.FunctionPtrNode); - this.fnPtrToolStripButton.Click += new System.EventHandler(this.memoryTypeToolStripButton_Click); - // - // toolStripSeparator19 - // - this.toolStripSeparator19.Name = "toolStripSeparator19"; - this.toolStripSeparator19.Size = new System.Drawing.Size(6, 25); - // - // statusStrip - // - this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.processInfoToolStripStatusLabel, - this.infoToolStripStatusLabel}); - this.statusStrip.Location = new System.Drawing.Point(0, 573); - this.statusStrip.Name = "statusStrip"; - this.statusStrip.Size = new System.Drawing.Size(1141, 22); - this.statusStrip.TabIndex = 1; - // - // processInfoToolStripStatusLabel - // - this.processInfoToolStripStatusLabel.Name = "processInfoToolStripStatusLabel"; - this.processInfoToolStripStatusLabel.Size = new System.Drawing.Size(112, 17); - this.processInfoToolStripStatusLabel.Text = "No process selected"; - // - // infoToolStripStatusLabel - // - this.infoToolStripStatusLabel.Name = "infoToolStripStatusLabel"; - this.infoToolStripStatusLabel.Size = new System.Drawing.Size(23, 17); - this.infoToolStripStatusLabel.Text = "<>"; - this.infoToolStripStatusLabel.Visible = false; - // - // mainMenuStrip - // - this.mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem, - this.processToolStripMenuItem, - this.projectToolStripMenuItem, - this.helpToolStripMenuItem}); - this.mainMenuStrip.Location = new System.Drawing.Point(0, 0); - this.mainMenuStrip.Name = "mainMenuStrip"; - this.mainMenuStrip.Size = new System.Drawing.Size(1141, 24); - this.mainMenuStrip.TabIndex = 2; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.selectProcessToolStripMenuItem, - this.toolStripSeparator1, - this.openProjectToolStripMenuItem, - this.mergeWithProjectToolStripMenuItem, - this.clearProjectToolStripMenuItem, - this.toolStripSeparator2, - this.saveToolStripMenuItem, - this.saveAsToolStripMenuItem, - this.toolStripSeparator3, - this.settingsToolStripMenuItem, - this.pluginsToolStripMenuItem, - this.toolStripSeparator5, - this.quitToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); - this.fileToolStripMenuItem.Text = "File"; - // - // selectProcessToolStripMenuItem - // - this.selectProcessToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Magnifier; - this.selectProcessToolStripMenuItem.Name = "selectProcessToolStripMenuItem"; - this.selectProcessToolStripMenuItem.Size = new System.Drawing.Size(246, 22); - this.selectProcessToolStripMenuItem.Text = "Select Process..."; - this.selectProcessToolStripMenuItem.Click += new System.EventHandler(this.selectProcessToolStripMenuItem_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(243, 6); - // - // openProjectToolStripMenuItem - // - this.openProjectToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Folder; - this.openProjectToolStripMenuItem.Name = "openProjectToolStripMenuItem"; - this.openProjectToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.openProjectToolStripMenuItem.Size = new System.Drawing.Size(246, 22); - this.openProjectToolStripMenuItem.Text = "Open Project..."; - this.openProjectToolStripMenuItem.Click += new System.EventHandler(this.openProjectToolStripMenuItem_Click); - // - // mergeWithProjectToolStripMenuItem - // - this.mergeWithProjectToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Folder_Add; - this.mergeWithProjectToolStripMenuItem.Name = "mergeWithProjectToolStripMenuItem"; - this.mergeWithProjectToolStripMenuItem.Size = new System.Drawing.Size(246, 22); - this.mergeWithProjectToolStripMenuItem.Text = "Merge with Project..."; - this.mergeWithProjectToolStripMenuItem.Click += new System.EventHandler(this.mergeWithProjectToolStripMenuItem_Click); - // - // clearProjectToolStripMenuItem - // - this.clearProjectToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Arrow_Refresh; - this.clearProjectToolStripMenuItem.Name = "clearProjectToolStripMenuItem"; - this.clearProjectToolStripMenuItem.Size = new System.Drawing.Size(246, 22); - this.clearProjectToolStripMenuItem.Text = "Clear Project"; - this.clearProjectToolStripMenuItem.Click += new System.EventHandler(this.clearProjectToolStripMenuItem_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(243, 6); - // - // saveToolStripMenuItem - // - this.saveToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Save; - this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; - this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.saveToolStripMenuItem.Size = new System.Drawing.Size(246, 22); - this.saveToolStripMenuItem.Text = "Save"; - this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); - // - // saveAsToolStripMenuItem - // - this.saveAsToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Save_As; - this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; - this.saveAsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) - | System.Windows.Forms.Keys.S))); - this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(246, 22); - this.saveAsToolStripMenuItem.Text = "Save as..."; - this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click); - // - // toolStripSeparator3 - // - this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(243, 6); - // - // settingsToolStripMenuItem - // - this.settingsToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Cogs; - this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; - this.settingsToolStripMenuItem.Size = new System.Drawing.Size(246, 22); - this.settingsToolStripMenuItem.Text = "Settings..."; - this.settingsToolStripMenuItem.Click += new System.EventHandler(this.settingsToolStripMenuItem_Click); - // - // pluginsToolStripMenuItem - // - this.pluginsToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Plugin; - this.pluginsToolStripMenuItem.Name = "pluginsToolStripMenuItem"; - this.pluginsToolStripMenuItem.Size = new System.Drawing.Size(246, 22); - this.pluginsToolStripMenuItem.Text = "Plugins..."; - this.pluginsToolStripMenuItem.Click += new System.EventHandler(this.pluginsToolStripButton_Click); - // - // toolStripSeparator5 - // - this.toolStripSeparator5.Name = "toolStripSeparator5"; - this.toolStripSeparator5.Size = new System.Drawing.Size(243, 6); - // - // quitToolStripMenuItem - // - this.quitToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Quit; - this.quitToolStripMenuItem.Name = "quitToolStripMenuItem"; - this.quitToolStripMenuItem.Size = new System.Drawing.Size(246, 22); - this.quitToolStripMenuItem.Text = "Quit"; - this.quitToolStripMenuItem.Click += new System.EventHandler(this.quitToolStripMenuItem_Click); - // - // processToolStripMenuItem - // - this.processToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.memoryViewerToolStripMenuItem, - this.toolStripSeparator17, - this.loadSymbolToolStripMenuItem, - this.loadSymbolsToolStripMenuItem, - this.toolStripSeparator4, - this.resumeProcessToolStripMenuItem, - this.suspendProcessToolStripMenuItem, - this.terminateProcessToolStripMenuItem}); - this.processToolStripMenuItem.Name = "processToolStripMenuItem"; - this.processToolStripMenuItem.Size = new System.Drawing.Size(59, 20); - this.processToolStripMenuItem.Text = "Process"; - // - // memoryViewerToolStripMenuItem - // - this.memoryViewerToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Magnifier; - this.memoryViewerToolStripMenuItem.Name = "memoryViewerToolStripMenuItem"; - this.memoryViewerToolStripMenuItem.Size = new System.Drawing.Size(163, 22); - this.memoryViewerToolStripMenuItem.Text = "Memory Viewer"; - this.memoryViewerToolStripMenuItem.Click += new System.EventHandler(this.memoryViewerToolStripMenuItem_Click); - // - // toolStripSeparator17 - // - this.toolStripSeparator17.Name = "toolStripSeparator17"; - this.toolStripSeparator17.Size = new System.Drawing.Size(160, 6); - // - // loadSymbolToolStripMenuItem - // - this.loadSymbolToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Pdb; - this.loadSymbolToolStripMenuItem.Name = "loadSymbolToolStripMenuItem"; - this.loadSymbolToolStripMenuItem.Size = new System.Drawing.Size(163, 22); - this.loadSymbolToolStripMenuItem.Text = "Load Symbol..."; - this.loadSymbolToolStripMenuItem.Click += new System.EventHandler(this.loadSymbolToolStripMenuItem_Click); - // - // loadSymbolsToolStripMenuItem - // - this.loadSymbolsToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("loadSymbolsToolStripMenuItem.Image"))); - this.loadSymbolsToolStripMenuItem.Name = "loadSymbolsToolStripMenuItem"; - this.loadSymbolsToolStripMenuItem.Size = new System.Drawing.Size(163, 22); - this.loadSymbolsToolStripMenuItem.Text = "Load all Symbols"; - this.loadSymbolsToolStripMenuItem.Click += new System.EventHandler(this.loadSymbolsToolStripMenuItem_Click); - // - // toolStripSeparator4 - // - this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(160, 6); - // - // resumeProcessToolStripMenuItem - // - this.resumeProcessToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Control_Play; - this.resumeProcessToolStripMenuItem.Name = "resumeProcessToolStripMenuItem"; - this.resumeProcessToolStripMenuItem.Size = new System.Drawing.Size(163, 22); - this.resumeProcessToolStripMenuItem.Text = "Resume"; - this.resumeProcessToolStripMenuItem.Click += new System.EventHandler(this.ControlRemoteProcessToolStripMenuItem_Click); - // - // suspendProcessToolStripMenuItem - // - this.suspendProcessToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Control_Pause; - this.suspendProcessToolStripMenuItem.Name = "suspendProcessToolStripMenuItem"; - this.suspendProcessToolStripMenuItem.Size = new System.Drawing.Size(163, 22); - this.suspendProcessToolStripMenuItem.Text = "Suspend"; - this.suspendProcessToolStripMenuItem.Click += new System.EventHandler(this.ControlRemoteProcessToolStripMenuItem_Click); - // - // terminateProcessToolStripMenuItem - // - this.terminateProcessToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Control_Stop; - this.terminateProcessToolStripMenuItem.Name = "terminateProcessToolStripMenuItem"; - this.terminateProcessToolStripMenuItem.Size = new System.Drawing.Size(163, 22); - this.terminateProcessToolStripMenuItem.Text = "Kill"; - this.terminateProcessToolStripMenuItem.Click += new System.EventHandler(this.ControlRemoteProcessToolStripMenuItem_Click); - // - // projectToolStripMenuItem - // - this.projectToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.cleanUnusedClassesToolStripMenuItem, - this.toolStripSeparator16, - this.generateCppCodeToolStripMenuItem, - this.generateCSharpCodeToolStripMenuItem}); - this.projectToolStripMenuItem.Name = "projectToolStripMenuItem"; - this.projectToolStripMenuItem.Size = new System.Drawing.Size(56, 20); - this.projectToolStripMenuItem.Text = "Project"; - // - // cleanUnusedClassesToolStripMenuItem - // - this.cleanUnusedClassesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Chart_Delete; - this.cleanUnusedClassesToolStripMenuItem.Name = "cleanUnusedClassesToolStripMenuItem"; - this.cleanUnusedClassesToolStripMenuItem.Size = new System.Drawing.Size(198, 22); - this.cleanUnusedClassesToolStripMenuItem.Text = "Remove unused classes"; - this.cleanUnusedClassesToolStripMenuItem.Click += new System.EventHandler(this.cleanUnusedClassesToolStripMenuItem_Click); - // - // toolStripSeparator16 - // - this.toolStripSeparator16.Name = "toolStripSeparator16"; - this.toolStripSeparator16.Size = new System.Drawing.Size(195, 6); - // - // generateCppCodeToolStripMenuItem - // - this.generateCppCodeToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Page_Code_Cpp; - this.generateCppCodeToolStripMenuItem.Name = "generateCppCodeToolStripMenuItem"; - this.generateCppCodeToolStripMenuItem.Size = new System.Drawing.Size(198, 22); - this.generateCppCodeToolStripMenuItem.Text = "Generate C++ Code"; - this.generateCppCodeToolStripMenuItem.Click += new System.EventHandler(this.generateCppCodeToolStripMenuItem_Click); - // - // generateCSharpCodeToolStripMenuItem - // - this.generateCSharpCodeToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Page_Code_Csharp; - this.generateCSharpCodeToolStripMenuItem.Name = "generateCSharpCodeToolStripMenuItem"; - this.generateCSharpCodeToolStripMenuItem.Size = new System.Drawing.Size(198, 22); - this.generateCSharpCodeToolStripMenuItem.Text = "Generate C# Code"; - this.generateCSharpCodeToolStripMenuItem.Click += new System.EventHandler(this.generateCSharpCodeToolStripMenuItem_Click); - // - // helpToolStripMenuItem - // - this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.aboutToolStripMenuItem}); - this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; - this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); - this.helpToolStripMenuItem.Text = "Help"; - // - // aboutToolStripMenuItem - // - this.aboutToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Information; - this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(116, 22); - this.aboutToolStripMenuItem.Text = "About..."; - this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); - // - // MainForm - // - this.AllowDrop = true; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1141, 595); - this.Controls.Add(this.splitContainer); - this.Controls.Add(this.toolStrip); - this.Controls.Add(this.statusStrip); - this.Controls.Add(this.mainMenuStrip); - this.MainMenuStrip = this.mainMenuStrip; - this.MinimumSize = new System.Drawing.Size(200, 100); - this.Name = "MainForm"; - this.Text = "ReClass.NET"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); - this.DragDrop += new System.Windows.Forms.DragEventHandler(this.MainForm_DragDrop); - this.DragEnter += new System.Windows.Forms.DragEventHandler(this.MainForm_DragEnter); - this.splitContainer.Panel1.ResumeLayout(false); - this.splitContainer.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); - this.splitContainer.ResumeLayout(false); - this.toolStrip.ResumeLayout(false); - this.toolStrip.PerformLayout(); - this.statusStrip.ResumeLayout(false); - this.statusStrip.PerformLayout(); - this.mainMenuStrip.ResumeLayout(false); - this.mainMenuStrip.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - - #endregion - - private UI.MemoryViewControl memoryViewControl; - private System.Windows.Forms.StatusStrip statusStrip; - private System.Windows.Forms.MenuStrip mainMenuStrip; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem selectProcessToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private System.Windows.Forms.ToolStripMenuItem clearProjectToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem openProjectToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; - private System.Windows.Forms.ToolStripMenuItem quitToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem processToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem memoryViewerToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; - private System.Windows.Forms.ToolStripMenuItem resumeProcessToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem suspendProcessToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem terminateProcessToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; - private System.Windows.Forms.ToolStripMenuItem loadSymbolsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; - private System.Windows.Forms.ToolStrip toolStrip; - private System.Windows.Forms.ToolStripButton selectProcessToolStripButton; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator6; - private System.Windows.Forms.SplitContainer splitContainer; - private System.Windows.Forms.ToolStripStatusLabel processInfoToolStripStatusLabel; - private System.Windows.Forms.ToolStripMenuItem pluginsToolStripMenuItem; - private System.Windows.Forms.ToolStripButton saveToolStripButton; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator7; - private System.Windows.Forms.ToolStripButton newClassToolStripButton; - private System.Windows.Forms.ToolStripDropDownButton addBytesToolStripDropDownButton; - private UI.IntegerToolStripMenuItem add4BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem add8BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem add64BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem add256BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem add1024BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem add2048BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem add4096BytesToolStripMenuItem; - private System.Windows.Forms.ToolStripDropDownButton insertBytesToolStripDropDownButton; - private UI.IntegerToolStripMenuItem insert4BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem insert8BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem insert64BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem insert256BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem insert1024BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem insert2048BytesToolStripMenuItem; - private UI.IntegerToolStripMenuItem insert4096BytesToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem addXBytesToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem insertXBytesToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator8; - private UI.TypeToolStripButton hex64ToolStripButton; - private UI.TypeToolStripButton hex32ToolStripButton; - private UI.TypeToolStripButton hex16ToolStripButton; - private UI.TypeToolStripButton hex8ToolStripButton; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator9; - private UI.TypeToolStripButton int64ToolStripButton; - private UI.TypeToolStripButton int32ToolStripButton; - private UI.TypeToolStripButton int16ToolStripButton; - private UI.TypeToolStripButton int8ToolStripButton; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator10; - private UI.TypeToolStripButton uint64ToolStripButton; - private UI.TypeToolStripButton uint32ToolStripButton; - private UI.TypeToolStripButton uint16ToolStripButton; - private UI.TypeToolStripButton uint8ToolStripButton; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator11; - private UI.TypeToolStripButton floatToolStripButton; - private UI.TypeToolStripButton doubleToolStripButton; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator12; - private UI.TypeToolStripButton vec4ToolStripButton; - private UI.TypeToolStripButton vec3ToolStripButton; - private UI.TypeToolStripButton vec2ToolStripButton; - private UI.TypeToolStripButton mat44ToolStripButton; - private UI.TypeToolStripButton mat34ToolStripButton; - private UI.TypeToolStripButton mat33ToolStripButton; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator13; - private UI.TypeToolStripButton utf8TextToolStripButton; - private UI.TypeToolStripButton utf8TextPtrToolStripButton; - private UI.TypeToolStripButton utf16TextToolStripButton; - private UI.TypeToolStripButton utf16TextPtrToolStripButton; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator14; - private UI.TypeToolStripButton classInstanceToolStripButton6; - private UI.TypeToolStripButton classPtrToolStripButton; - private UI.TypeToolStripButton arrayToolStripButton; - private UI.TypeToolStripButton vtableToolStripButton; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator15; - private UI.TypeToolStripButton fnPtrToolStripButton; - private UI.ClassNodeView classesView; - private System.Windows.Forms.ToolStripMenuItem projectToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem cleanUnusedClassesToolStripMenuItem; - private UI.TypeToolStripButton ptrArrayToolStripButton; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator16; - private System.Windows.Forms.ToolStripMenuItem generateCppCodeToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem generateCSharpCodeToolStripMenuItem; - private System.Windows.Forms.Timer processUpdateTimer; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator17; - private System.Windows.Forms.ToolStripMenuItem loadSymbolToolStripMenuItem; - private System.Windows.Forms.ToolStripButton openProjectToolStripButton; - private UI.TypeToolStripButton bitFieldToolStripButton; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator18; - private System.Windows.Forms.ToolStripStatusLabel infoToolStripStatusLabel; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator19; - private System.Windows.Forms.ToolStripMenuItem mergeWithProjectToolStripMenuItem; - } -} - diff --git a/Forms/MainForm.cs b/Forms/MainForm.cs deleted file mode 100644 index d1934a19..00000000 --- a/Forms/MainForm.cs +++ /dev/null @@ -1,674 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Forms; -using ReClassNET.CodeGenerator; -using ReClassNET.DataExchange; -using ReClassNET.Logger; -using ReClassNET.Memory; -using ReClassNET.Nodes; -using ReClassNET.Plugins; -using ReClassNET.UI; -using ReClassNET.Util; - -namespace ReClassNET.Forms -{ - public partial class MainForm : IconForm - { - private readonly NativeHelper nativeHelper; - - private readonly RemoteProcess remoteProcess; - private readonly MemoryBuffer memory; - - private readonly PluginManager pluginManager; - - private ReClassNetProject currentProject; - public ReClassNetProject CurrentProject => currentProject; - - private Task updateProcessInformationsTask; - private Task loadSymbolsTask; - private CancellationTokenSource loadSymbolsTaskToken; - - public MainForm(NativeHelper nativeHelper) - { - Contract.Requires(nativeHelper != null); - - this.nativeHelper = nativeHelper; - - InitializeComponent(); - - mainMenuStrip.Renderer = new CustomToolStripProfessionalRenderer(true); - toolStrip.Renderer = new CustomToolStripProfessionalRenderer(false); - - remoteProcess = new RemoteProcess(nativeHelper); - remoteProcess.ProcessChanged += delegate (RemoteProcess sender) - { - if (sender.Process == null) - { - processInfoToolStripStatusLabel.Text = "No process selected"; - } - else - { - var text = $"{sender.Process.Name} (PID: {sender.Process.Id})"; - - Text = $"{Constants.ApplicationName} - {text}"; - processInfoToolStripStatusLabel.Text = text; - } - }; - - memory = new MemoryBuffer - { - Process = remoteProcess - }; - - memoryViewControl.Memory = memory; - - pluginManager = new PluginManager(new DefaultPluginHost(this, remoteProcess, Program.Logger), nativeHelper); - - SetProject(new ReClassNetProject()); - - newClassToolStripButton_Click(null, null); - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - GlobalWindowManager.AddWindow(this); - - pluginManager.LoadAllPlugins(Path.Combine(Application.StartupPath, Constants.PluginsFolder), Program.Logger); - } - - protected override void OnFormClosed(FormClosedEventArgs e) - { - pluginManager.UnloadAllPlugins(); - - GlobalWindowManager.RemoveWindow(this); - - base.OnClosed(e); - } - - #region Event Handler - - private async void MainForm_FormClosing(object sender, FormClosingEventArgs e) - { - // Stop the update timer - processUpdateTimer.Stop(); - - // and cancel all running tasks. - if (loadSymbolsTask != null || updateProcessInformationsTask != null) - { - e.Cancel = true; - - Hide(); - - if (loadSymbolsTask != null) - { - loadSymbolsTaskToken.Cancel(); - - try - { - await loadSymbolsTask; - } - catch - { - - } - - loadSymbolsTask = null; - } - - if (updateProcessInformationsTask != null) - { - try - { - await updateProcessInformationsTask; - } - catch - { - - } - - updateProcessInformationsTask = null; - } - - Close(); - } - } - - #region Menustrip - - private void selectProcessToolStripMenuItem_Click(object sender, EventArgs e) - { - using (var pb = new ProcessBrowserForm(nativeHelper, Program.Settings.LastProcess)) - { - if (pb.ShowDialog() == DialogResult.OK) - { - if (remoteProcess.Process != null) - { - remoteProcess.Process.Close(); - } - - remoteProcess.Process = pb.SelectedProcess; - remoteProcess.UpdateProcessInformations(); - if (pb.LoadSymbols) - { - LoadAllSymbolsForCurrentProcess(); - } - - Program.Settings.LastProcess = remoteProcess.Process.Name; - } - } - } - - private void newClassToolStripButton_Click(object sender, EventArgs e) - { - var node = ClassNode.Create(); - node.AddBytes(64); - - classesView.SelectedClass = node; - } - - private void openProjectToolStripMenuItem_Click(object sender, EventArgs e) - { - try - { - var path = ShowOpenProjectFileDialog(); - if (path != null) - { - var project = new ReClassNetProject(); - - LoadFileFromPath(path, ref project); - - // If the file is a ReClass.NET file remember the path. - if (Path.GetExtension(path) == ReClassNetFile.FileExtension) - { - project.Path = path; - } - - SetProject(project); - } - } - catch (Exception ex) - { - Program.Logger.Log(ex); - } - } - - private void mergeWithProjectToolStripMenuItem_Click(object sender, EventArgs e) - { - try - { - var path = ShowOpenProjectFileDialog(); - if (path != null) - { - LoadFileFromPath(path, ref currentProject); - } - } - catch (Exception ex) - { - Program.Logger.Log(ex); - } - } - - private void clearProjectToolStripMenuItem_Click(object sender, EventArgs e) - { - SetProject(new ReClassNetProject()); - - memoryViewControl.ClassNode = null; - } - - private void saveToolStripMenuItem_Click(object sender, EventArgs e) - { - if (!currentProject.Classes.Any()) - { - return; - } - - if (string.IsNullOrEmpty(currentProject.Path)) - { - saveAsToolStripMenuItem_Click(sender, e); - - return; - } - - var file = new ReClassNetFile(currentProject); - file.Save(currentProject.Path, Program.Logger); - } - - private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) - { - if (!currentProject.Classes.Any()) - { - return; - } - - using (var sfd = new SaveFileDialog()) - { - sfd.DefaultExt = ReClassNetFile.FileExtension; - sfd.Filter = $"{ReClassNetFile.FormatName} (*{ReClassNetFile.FileExtension})|*{ReClassNetFile.FileExtension}"; - - if (sfd.ShowDialog() == DialogResult.OK) - { - currentProject.Path = sfd.FileName; - - saveToolStripMenuItem_Click(sender, e); - } - } - } - - private void settingsToolStripMenuItem_Click(object sender, EventArgs e) - { - using (var sd = new SettingsForm(Program.Settings)) - { - sd.ShowDialog(); - } - } - - private void pluginsToolStripButton_Click(object sender, EventArgs e) - { - using (var pf = new PluginForm(pluginManager, nativeHelper)) - { - pf.ShowDialog(); - } - } - - private void quitToolStripMenuItem_Click(object sender, EventArgs e) - { - Close(); - } - - private void memoryViewerToolStripMenuItem_Click(object sender, EventArgs e) - { - new ProcessMemoryViewer(remoteProcess, classesView).Show(); - } - - private void ControlRemoteProcessToolStripMenuItem_Click(object sender, EventArgs e) - { - if (!remoteProcess.IsValid) - { - return; - } - - var action = NativeHelper.ControlRemoteProcessAction.Terminate; - if (sender == resumeProcessToolStripMenuItem) - { - action = NativeHelper.ControlRemoteProcessAction.Resume; - } - else if (sender == suspendProcessToolStripMenuItem) - { - action = NativeHelper.ControlRemoteProcessAction.Suspend; - } - - nativeHelper.ControlRemoteProcess(remoteProcess.Process.Handle, action); - } - - private void loadSymbolToolStripMenuItem_Click(object sender, EventArgs e) - { - using (var ofd = new OpenFileDialog()) - { - ofd.Filter = "Program Debug Database (*.pdb)|*.pdb|All Files (*.*)|*.*"; - - if (ofd.ShowDialog() == DialogResult.OK) - { - try - { - remoteProcess.Symbols.LoadSymbolsFromPDB(ofd.FileName); - } - catch (Exception ex) - { - Program.Logger.Log(ex); - } - } - } - } - - private void loadSymbolsToolStripMenuItem_Click(object sender, EventArgs e) - { - LoadAllSymbolsForCurrentProcess(); - } - - private void cleanUnusedClassesToolStripMenuItem_Click(object sender, EventArgs e) - { - currentProject.RemoveUnusedClasses(); - } - - private void generateCppCodeToolStripMenuItem_Click(object sender, EventArgs e) - { - ShowCodeForm(new CppCodeGenerator()); - } - - private void generateCSharpCodeToolStripMenuItem_Click(object sender, EventArgs e) - { - ShowCodeForm(new CSharpCodeGenerator()); - } - - private void aboutToolStripMenuItem_Click(object sender, EventArgs e) - { - using (var af = new AboutForm()) - { - af.ShowDialog(); - } - } - - #endregion - - #region Toolstrip - - private void addBytesToolStripMenuItem_Click(object sender, EventArgs e) - { - var item = sender as IntegerToolStripMenuItem; - if (item == null) - { - return; - } - - memoryViewControl.AddBytes(item.Value); - } - - private void addXBytesToolStripMenuItem_Click(object sender, EventArgs e) - { - AskAddOrInsertBytes("Add Bytes", memoryViewControl.AddBytes); - } - - private void insertBytesToolStripMenuItem_Click(object sender, EventArgs e) - { - var item = sender as IntegerToolStripMenuItem; - if (item == null) - { - return; - } - - memoryViewControl.InsertBytes(item.Value); - } - - private void insertXBytesToolStripMenuItem_Click(object sender, EventArgs e) - { - AskAddOrInsertBytes("Insert Bytes", memoryViewControl.InsertBytes); - } - - private void memoryTypeToolStripButton_Click(object sender, EventArgs e) - { - var item = sender as TypeToolStripButton; - if (item == null) - { - return; - } - - memoryViewControl.ReplaceSelectedNodesWithType(item.Value); - } - - #endregion - - private void MainForm_DragEnter(object sender, DragEventArgs e) - { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) - { - var files = e.Data.GetData(DataFormats.FileDrop) as string[]; - if (files != null && files.Any()) - { - switch (Path.GetExtension(files.First())) - { - case ReClassNetFile.FileExtension: - case ReClassQtFile.FileExtension: - case ReClassFile.FileExtension: - case ReClass2007File.FileExtension: - e.Effect = DragDropEffects.Copy; - break; - } - } - } - } - - private void MainForm_DragDrop(object sender, DragEventArgs e) - { - var files = e.Data.GetData(DataFormats.FileDrop) as string[]; - if (files != null && files.Any()) - { - try - { - var path = files.First(); - - var project = new ReClassNetProject(); - - LoadFileFromPath(path, ref project); - - // If the file is a ReClass.NET file remember the path. - if (Path.GetExtension(path) == ReClassNetFile.FileExtension) - { - project.Path = path; - } - - SetProject(project); - } - catch (Exception ex) - { - Program.Logger.Log(ex); - } - } - } - - private void processUpdateTimer_Tick(object sender, EventArgs e) - { - if (updateProcessInformationsTask != null && !updateProcessInformationsTask.IsCompleted) - { - return; - } - - updateProcessInformationsTask = remoteProcess.UpdateProcessInformationsAsync(); - } - - private void classesView_ClassSelected(object sender, ClassNode node) - { - memoryViewControl.ClassNode = node; - - memoryViewControl.Invalidate(); - } - - private void memoryViewControl_SelectionChanged(object sender, EventArgs e) - { - var memoryView = sender as MemoryViewControl; - if (memoryView == null) - { - return; - } - - var count = memoryView.SelectedNodes.Count(); - var node = memoryView.SelectedNodes.FirstOrDefault(); - - addBytesToolStripDropDownButton.Enabled = node?.ParentNode != null || node is ClassNode; - insertBytesToolStripDropDownButton.Enabled = count == 1 && node?.ParentNode != null; - - var enabled = count > 0 && !(node is ClassNode); - toolStrip.Items.OfType().ForEach(b => b.Enabled = enabled); - } - - #endregion - - /// Sets the current project. - /// The new project. - public void SetProject(ReClassNetProject newProject) - { - Contract.Requires(newProject != null); - - if (currentProject == newProject) - { - return; - } - - if (currentProject != null) - { - ClassNode.ClassCreated -= currentProject.AddClass; - } - - currentProject = newProject; - - ClassUtil.Classes = currentProject.Classes; - - ClassNode.ClassCreated += currentProject.AddClass; - - classesView.Project = currentProject; - memoryViewControl.Project = currentProject; - - memoryViewControl.ClassNode = currentProject.Classes.FirstOrDefault(); - } - - /// Registers the node type which will create the ToolStrip and MenuStrip entries. - /// The node type. - /// The name of the node type. - /// The icon of the node type. - internal void RegisterNodeType(Type type, string name, Image icon) - { - Contract.Requires(type != null); - Contract.Requires(name != null); - Contract.Requires(icon != null); - - var item = new TypeToolStripButton - { - Image = icon, - ToolTipText = name, - Value = type - }; - item.Click += memoryTypeToolStripButton_Click; - - toolStrip.Items.Add(item); - - memoryViewControl.RegisterNodeType(type, name, icon); - } - - /// Deregisters the node type. - /// The node type. - internal void DeregisterNodeType(Type type) - { - Contract.Requires(type != null); - - var item = toolStrip.Items.OfType().Where(i => i.Value == type).FirstOrDefault(); - if (item != null) - { - item.Click -= memoryTypeToolStripButton_Click; - toolStrip.Items.Remove(item); - } - - memoryViewControl.DeregisterNodeType(type); - } - - /// Shows the code form with the given . - /// The generator. - private void ShowCodeForm(ICodeGenerator generator) - { - Contract.Requires(generator != null); - - new CodeForm(generator, currentProject.Classes, Program.Logger).Show(); - } - - /// Opens the and calls with the result. - /// The title of the input form. - /// The function to call afterwards. - private void AskAddOrInsertBytes(string title, Action callback) - { - Contract.Requires(title != null); - Contract.Requires(callback != null); - - if (memoryViewControl.ClassNode == null) - { - return; - } - - using (var ib = new InputBytesForm(memoryViewControl.ClassNode.MemorySize)) - { - ib.Text = title; - - if (ib.ShowDialog() == DialogResult.OK) - { - callback(ib.Bytes); - } - } - } - - /// Shows an with all valid file extensions. - /// The path to the selected file or null if no file was selected. - public static string ShowOpenProjectFileDialog() - { - using (var ofd = new OpenFileDialog()) - { - ofd.CheckFileExists = true; - ofd.Filter = $"All ReClass Types |*{ReClassNetFile.FileExtension};*{ReClassFile.FileExtension};*{ReClassQtFile.FileExtension};*{ReClass2007File.FileExtension}" - + $"|{ReClassNetFile.FormatName} (*{ReClassNetFile.FileExtension})|*{ReClassNetFile.FileExtension}" - + $"|{ReClassFile.FormatName} (*{ReClassFile.FileExtension})|*{ReClassFile.FileExtension}" - + $"|{ReClassQtFile.FormatName} (*{ReClassQtFile.FileExtension})|*{ReClassQtFile.FileExtension}" - + $"|{ReClass2007File.FormatName} (*{ReClass2007File.FileExtension})|*{ReClass2007File.FileExtension}"; - - if (ofd.ShowDialog() == DialogResult.OK) - { - return ofd.FileName; - } - } - - return null; - } - - /// Loads the file into the given project. - /// Full pathname of the file. - /// [in,out] The project. - private void LoadFileFromPath(string filePath, ref ReClassNetProject project) - { - Contract.Requires(filePath != null); - Contract.Requires(project != null); - - IReClassImport import = null; - switch (Path.GetExtension(filePath)) - { - case ReClassNetFile.FileExtension: - import = new ReClassNetFile(project); - break; - case ReClassQtFile.FileExtension: - import = new ReClassQtFile(project); - break; - case ReClassFile.FileExtension: - import = new ReClassFile(project); - break; - case ReClass2007File.FileExtension: - import = new ReClass2007File(project); - break; - default: - Program.Logger.Log(LogLevel.Error, $"The file '{filePath}' has an unknown type."); - break; - } - if (import != null) - { - import.Load(filePath, Program.Logger); - } - } - - /// Loads all symbols for the current process and displays the progress status. - private void LoadAllSymbolsForCurrentProcess() - { - if (loadSymbolsTask != null && !loadSymbolsTask.IsCompleted) - { - return; - } - - infoToolStripStatusLabel.Visible = true; - - int index = 0; - - var progress = new Progress>>( - report => - { - infoToolStripStatusLabel.Text = $"[{++index}/{report.Item2.Count()}] Loading symbols for module: {report.Item1.Name}"; - } - ); - - loadSymbolsTaskToken = new CancellationTokenSource(); - - loadSymbolsTask = remoteProcess - .LoadAllSymbolsAsync(progress, loadSymbolsTaskToken.Token) - .ContinueWith(_ => infoToolStripStatusLabel.Visible = false, TaskScheduler.FromCurrentSynchronizationContext()); - } - } -} diff --git a/Forms/MainForm.resx b/Forms/MainForm.resx deleted file mode 100644 index 638a48bf..00000000 --- a/Forms/MainForm.resx +++ /dev/null @@ -1,445 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 366, 17 - - - 268, 17 - - - 17, 17 - - - 133, 17 - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH - DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp - bGUAAEjHnZZ3VFTXFofPvXd6oc0wAlKG3rvAANJ7k15FYZgZYCgDDjM0sSGiAhFFRJoiSFDEgNFQJFZE - sRAUVLAHJAgoMRhFVCxvRtaLrqy89/Ly++Osb+2z97n77L3PWhcAkqcvl5cGSwGQyhPwgzyc6RGRUXTs - AIABHmCAKQBMVka6X7B7CBDJy82FniFyAl8EAfB6WLwCcNPQM4BOB/+fpFnpfIHomAARm7M5GSwRF4g4 - JUuQLrbPipgalyxmGCVmvihBEcuJOWGRDT77LLKjmNmpPLaIxTmns1PZYu4V8bZMIUfEiK+ICzO5nCwR - 3xKxRoowlSviN+LYVA4zAwAUSWwXcFiJIjYRMYkfEuQi4uUA4EgJX3HcVyzgZAvEl3JJS8/hcxMSBXQd - li7d1NqaQffkZKVwBALDACYrmcln013SUtOZvBwAFu/8WTLi2tJFRbY0tba0NDQzMv2qUP91829K3NtF - ehn4uWcQrf+L7a/80hoAYMyJarPziy2uCoDOLQDI3fti0zgAgKSobx3Xv7oPTTwviQJBuo2xcVZWlhGX - wzISF/QP/U+Hv6GvvmckPu6P8tBdOfFMYYqALq4bKy0lTcinZ6QzWRy64Z+H+B8H/nUeBkGceA6fwxNF - hImmjMtLELWbx+YKuGk8Opf3n5r4D8P+pMW5FonS+BFQY4yA1HUqQH7tBygKESDR+8Vd/6NvvvgwIH55 - 4SqTi3P/7zf9Z8Gl4iWDm/A5ziUohM4S8jMX98TPEqABAUgCKpAHykAd6ABDYAasgC1wBG7AG/iDEBAJ - VgMWSASpgA+yQB7YBApBMdgJ9oBqUAcaQTNoBcdBJzgFzoNL4Bq4AW6D+2AUTIBnYBa8BgsQBGEhMkSB - 5CEVSBPSh8wgBmQPuUG+UBAUCcVCCRAPEkJ50GaoGCqDqqF6qBn6HjoJnYeuQIPQXWgMmoZ+h97BCEyC - qbASrAUbwwzYCfaBQ+BVcAK8Bs6FC+AdcCXcAB+FO+Dz8DX4NjwKP4PnEIAQERqiihgiDMQF8UeikHiE - j6xHipAKpAFpRbqRPuQmMorMIG9RGBQFRUcZomxRnqhQFAu1BrUeVYKqRh1GdaB6UTdRY6hZ1Ec0Ga2I - 1kfboL3QEegEdBa6EF2BbkK3oy+ib6Mn0K8xGAwNo42xwnhiIjFJmLWYEsw+TBvmHGYQM46Zw2Kx8lh9 - rB3WH8vECrCF2CrsUexZ7BB2AvsGR8Sp4Mxw7rgoHA+Xj6vAHcGdwQ3hJnELeCm8Jt4G749n43PwpfhG - fDf+On4Cv0CQJmgT7AghhCTCJkIloZVwkfCA8JJIJKoRrYmBRC5xI7GSeIx4mThGfEuSIemRXEjRJCFp - B+kQ6RzpLuklmUzWIjuSo8gC8g5yM/kC+RH5jQRFwkjCS4ItsUGiRqJDYkjiuSReUlPSSXK1ZK5kheQJ - yeuSM1J4KS0pFymm1HqpGqmTUiNSc9IUaVNpf+lU6RLpI9JXpKdksDJaMm4ybJkCmYMyF2TGKQhFneJC - YVE2UxopFykTVAxVm+pFTaIWU7+jDlBnZWVkl8mGyWbL1sielh2lITQtmhcthVZKO04bpr1borTEaQln - yfYlrUuGlszLLZVzlOPIFcm1yd2WeydPl3eTT5bfJd8p/1ABpaCnEKiQpbBf4aLCzFLqUtulrKVFS48v - vacIK+opBimuVTyo2K84p6Ss5KGUrlSldEFpRpmm7KicpFyufEZ5WoWiYq/CVSlXOavylC5Ld6Kn0Cvp - vfRZVUVVT1Whar3qgOqCmrZaqFq+WpvaQ3WCOkM9Xr1cvUd9VkNFw08jT6NF454mXpOhmai5V7NPc15L - Wytca6tWp9aUtpy2l3audov2Ax2yjoPOGp0GnVu6GF2GbrLuPt0berCehV6iXo3edX1Y31Kfq79Pf9AA - bWBtwDNoMBgxJBk6GWYathiOGdGMfI3yjTqNnhtrGEcZ7zLuM/5oYmGSYtJoct9UxtTbNN+02/R3Mz0z - llmN2S1zsrm7+QbzLvMXy/SXcZbtX3bHgmLhZ7HVosfig6WVJd+y1XLaSsMq1qrWaoRBZQQwShiXrdHW - ztYbrE9Zv7WxtBHYHLf5zdbQNtn2iO3Ucu3lnOWNy8ft1OyYdvV2o/Z0+1j7A/ajDqoOTIcGh8eO6o5s - xybHSSddpySno07PnU2c+c7tzvMuNi7rXM65Iq4erkWuA24ybqFu1W6P3NXcE9xb3Gc9LDzWepzzRHv6 - eO7yHPFS8mJ5NXvNelt5r/Pu9SH5BPtU+zz21fPl+3b7wX7efrv9HqzQXMFb0ekP/L38d/s/DNAOWBPw - YyAmMCCwJvBJkGlQXlBfMCU4JvhI8OsQ55DSkPuhOqHC0J4wybDosOaw+XDX8LLw0QjjiHUR1yIVIrmR - XVHYqLCopqi5lW4r96yciLaILoweXqW9KnvVldUKq1NWn46RjGHGnIhFx4bHHol9z/RnNjDn4rziauNm - WS6svaxnbEd2OXuaY8cp40zG28WXxU8l2CXsTphOdEisSJzhunCruS+SPJPqkuaT/ZMPJX9KCU9pS8Wl - xqae5Mnwknm9acpp2WmD6frphemja2zW7Fkzy/fhN2VAGasyugRU0c9Uv1BHuEU4lmmfWZP5Jiss60S2 - dDYvuz9HL2d7zmSue+63a1FrWWt78lTzNuWNrXNaV78eWh+3vmeD+oaCDRMbPTYe3kTYlLzpp3yT/LL8 - V5vDN3cXKBVsLBjf4rGlpVCikF84stV2a9021DbutoHt5turtn8sYhddLTYprih+X8IqufqN6TeV33za - Eb9joNSydP9OzE7ezuFdDrsOl0mX5ZaN7/bb3VFOLy8qf7UnZs+VimUVdXsJe4V7Ryt9K7uqNKp2Vr2v - Tqy+XeNc01arWLu9dn4fe9/Qfsf9rXVKdcV17w5wD9yp96jvaNBqqDiIOZh58EljWGPft4xvm5sUmoqb - PhziHRo9HHS4t9mqufmI4pHSFrhF2DJ9NProje9cv+tqNWytb6O1FR8Dx4THnn4f+/3wcZ/jPScYJ1p/ - 0Pyhtp3SXtQBdeR0zHYmdo52RXYNnvQ+2dNt293+o9GPh06pnqo5LXu69AzhTMGZT2dzz86dSz83cz7h - /HhPTM/9CxEXbvUG9g5c9Ll4+ZL7pQt9Tn1nL9tdPnXF5srJq4yrndcsr3X0W/S3/2TxU/uA5UDHdavr - XTesb3QPLh88M+QwdP6m681Lt7xuXbu94vbgcOjwnZHokdE77DtTd1PuvriXeW/h/sYH6AdFD6UeVjxS - fNTws+7PbaOWo6fHXMf6Hwc/vj/OGn/2S8Yv7ycKnpCfVEyqTDZPmU2dmnafvvF05dOJZ+nPFmYKf5X+ - tfa5zvMffnP8rX82YnbiBf/Fp99LXsq/PPRq2aueuYC5R69TXy/MF72Rf3P4LeNt37vwd5MLWe+x7ys/ - 6H7o/ujz8cGn1E+f/gUDmPP8usTo0wAAAAlwSFlzAAALDAAACwwBP0AiyAAAOjBpVFh0WE1MOmNvbS5h - ZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3pr - YzlkIj8+Cjx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhN - UCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDoyMCAgICAgICAgIj4KICAg - PHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgt - bnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6 - eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgICAgICAgICB4bWxuczp4bXBNTT0i - aHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIKICAgICAgICAgICAgeG1sbnM6c3RFdnQ9Imh0 - dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIKICAgICAgICAgICAg - eG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICAgICAgICAgICB4bWxu - czpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iCiAgICAgICAgICAg - IHhtbG5zOnRpZmY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vdGlmZi8xLjAvIgogICAgICAgICAgICB4bWxu - czpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyI+CiAgICAgICAgIDx4bXA6Q3JlYXRv - clRvb2w+QWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKFdpbmRvd3MpPC94bXA6Q3JlYXRvclRvb2w+CiAg - ICAgICAgIDx4bXA6Q3JlYXRlRGF0ZT4yMDE2LTEwLTA4VDE2OjUwOjQyKzAyOjAwPC94bXA6Q3JlYXRl - RGF0ZT4KICAgICAgICAgPHhtcDpNZXRhZGF0YURhdGU+MjAxNi0xMC0wOFQxNjo1MDo0MiswMjowMDwv - eG1wOk1ldGFkYXRhRGF0ZT4KICAgICAgICAgPHhtcDpNb2RpZnlEYXRlPjIwMTYtMTAtMDhUMTY6NTA6 - NDIrMDI6MDA8L3htcDpNb2RpZnlEYXRlPgogICAgICAgICA8eG1wTU06SW5zdGFuY2VJRD54bXAuaWlk - Ojg1MzJkMjM5LTcwZjgtMzc0Ny05OTg1LTY4OTBjYzBjMTdkNTwveG1wTU06SW5zdGFuY2VJRD4KICAg - ICAgICAgPHhtcE1NOkRvY3VtZW50SUQ+YWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjc1MWJkZTA5LThkNjYt - MTFlNi1hMTM0LWU5YjI3OTU0YzcwODwveG1wTU06RG9jdW1lbnRJRD4KICAgICAgICAgPHhtcE1NOk9y - aWdpbmFsRG9jdW1lbnRJRD54bXAuZGlkOjIzYjk1Yjc2LTFlMTgtYmQ0Mi04MDk3LTRlN2JkZWQwYzQw - NzwveG1wTU06T3JpZ2luYWxEb2N1bWVudElEPgogICAgICAgICA8eG1wTU06SGlzdG9yeT4KICAgICAg - ICAgICAgPHJkZjpTZXE+CiAgICAgICAgICAgICAgIDxyZGY6bGkgcmRmOnBhcnNlVHlwZT0iUmVzb3Vy - Y2UiPgogICAgICAgICAgICAgICAgICA8c3RFdnQ6YWN0aW9uPmNyZWF0ZWQ8L3N0RXZ0OmFjdGlvbj4K - ICAgICAgICAgICAgICAgICAgPHN0RXZ0Omluc3RhbmNlSUQ+eG1wLmlpZDoyM2I5NWI3Ni0xZTE4LWJk - NDItODA5Ny00ZTdiZGVkMGM0MDc8L3N0RXZ0Omluc3RhbmNlSUQ+CiAgICAgICAgICAgICAgICAgIDxz - dEV2dDp3aGVuPjIwMTYtMTAtMDhUMTY6NTA6NDIrMDI6MDA8L3N0RXZ0OndoZW4+CiAgICAgICAgICAg - ICAgICAgIDxzdEV2dDpzb2Z0d2FyZUFnZW50PkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE1IChXaW5kb3dz - KTwvc3RFdnQ6c29mdHdhcmVBZ2VudD4KICAgICAgICAgICAgICAgPC9yZGY6bGk+CiAgICAgICAgICAg - ICAgIDxyZGY6bGkgcmRmOnBhcnNlVHlwZT0iUmVzb3VyY2UiPgogICAgICAgICAgICAgICAgICA8c3RF - dnQ6YWN0aW9uPnNhdmVkPC9zdEV2dDphY3Rpb24+CiAgICAgICAgICAgICAgICAgIDxzdEV2dDppbnN0 - YW5jZUlEPnhtcC5paWQ6ODUzMmQyMzktNzBmOC0zNzQ3LTk5ODUtNjg5MGNjMGMxN2Q1PC9zdEV2dDpp - bnN0YW5jZUlEPgogICAgICAgICAgICAgICAgICA8c3RFdnQ6d2hlbj4yMDE2LTEwLTA4VDE2OjUwOjQy - KzAyOjAwPC9zdEV2dDp3aGVuPgogICAgICAgICAgICAgICAgICA8c3RFdnQ6c29mdHdhcmVBZ2VudD5B - ZG9iZSBQaG90b3Nob3AgQ0MgMjAxNSAoV2luZG93cyk8L3N0RXZ0OnNvZnR3YXJlQWdlbnQ+CiAgICAg - ICAgICAgICAgICAgIDxzdEV2dDpjaGFuZ2VkPi88L3N0RXZ0OmNoYW5nZWQ+CiAgICAgICAgICAgICAg - IDwvcmRmOmxpPgogICAgICAgICAgICA8L3JkZjpTZXE+CiAgICAgICAgIDwveG1wTU06SGlzdG9yeT4K - ICAgICAgICAgPGRjOmZvcm1hdD5pbWFnZS9wbmc8L2RjOmZvcm1hdD4KICAgICAgICAgPHBob3Rvc2hv - cDpDb2xvck1vZGU+MzwvcGhvdG9zaG9wOkNvbG9yTW9kZT4KICAgICAgICAgPHBob3Rvc2hvcDpJQ0NQ - cm9maWxlPnNSR0IgSUVDNjE5NjYtMi4xPC9waG90b3Nob3A6SUNDUHJvZmlsZT4KICAgICAgICAgPHRp - ZmY6T3JpZW50YXRpb24+MTwvdGlmZjpPcmllbnRhdGlvbj4KICAgICAgICAgPHRpZmY6WFJlc29sdXRp - b24+NzIwMDAwLzEwMDAwPC90aWZmOlhSZXNvbHV0aW9uPgogICAgICAgICA8dGlmZjpZUmVzb2x1dGlv - bj43MjAwMDAvMTAwMDA8L3RpZmY6WVJlc29sdXRpb24+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25V - bml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDxleGlmOkNvbG9yU3BhY2U+MTwvZXhp - ZjpDb2xvclNwYWNlPgogICAgICAgICA8ZXhpZjpQaXhlbFhEaW1lbnNpb24+MTY8L2V4aWY6UGl4ZWxY - RGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFlEaW1lbnNpb24+MTY8L2V4aWY6UGl4ZWxZRGlt - ZW5zaW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4K - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAog - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAK - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAog - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg - ICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVu - ZD0idyI/PrRM3i8AAAJMSURBVDhPlZHrS5NhGMb9SxKrLxVhBU3DyIygA4lW0pcyzGSJgZl0lE4ytGxU - mBge5pdYSQc1rTYUCx1YlLrcKZfm1qbNZam5uVPT/XrfVzKGaXXD9Tzw3M/147qfJwaYV4vOyp/U+NLM - g9Z3qJ++ocfiEK7+9iwALFYRQapHHWzcdZT7LZ3iUTRg3GTgRWUt+opy9DXVWDUa8ZJUEcEdnolQqW6l - rcs8B2nuEFtzAFtzIxZlKSNV5YyUl/G+6BTtRw7TcvoMs6I5HCEYmqXirhbZ7px5SYBxsxFTiYJJdR1+ - TRNTDfdw3VZizMvhYUoy8tSLyPJteP0zTE6HJcgvkAQw1NXy6boC72M1Pm0TnsZ6XBVKLAXHaduxDdXe - DDy+GSY8YcYmw7i+hSSAOIYE6L51A/uls4yrKoUUKr7W3cFeepme3GxatydTFrcC2Qk76+RGVmd2YncH - owH66ioMx7JxFJ/Hee0KQ8VFGPNz0R1I40nCeqr2pOOe+MHIWBD7aIABpz8a0K95jmZ/Or2HMjDIs+jO - OohuXyraLYnUrIwjM/mkkMBGvJBgjZDAZPdFA8SloaCQ+k0yyaTdnEDThrVUL4/lZmISDneIwc8B+h1+ - TLZpege8CwGi+p5pKElK4eqyWC6sSiBvZyFpijG2nhuVfiFebpDe4LVlEYAoseGeCDEszGtzBfkwHMAi - RO4b9NFt9fLK4kFnmFoa4PwSYkgwW50BIbIP/eA0b/u9dJk9dPZN0d77fWnAR2Fecf+bFgWIjX/VAsD/ - i5ifMJftCPEu7d0AAAAASUVORK5CYII= - - - - 42 - - \ No newline at end of file diff --git a/Forms/PluginForm.Designer.cs b/Forms/PluginForm.Designer.cs deleted file mode 100644 index 52a232e2..00000000 --- a/Forms/PluginForm.Designer.cs +++ /dev/null @@ -1,478 +0,0 @@ -namespace ReClassNET.Forms -{ - partial class PluginForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.tabControl = new System.Windows.Forms.TabControl(); - this.pluginsTabPage = new System.Windows.Forms.TabPage(); - this.descriptionGroupBox = new System.Windows.Forms.GroupBox(); - this.descriptionLabel = new System.Windows.Forms.Label(); - this.pluginsDataGridView = new System.Windows.Forms.DataGridView(); - this.iconColumn = new System.Windows.Forms.DataGridViewImageColumn(); - this.nameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.versionColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.authorColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.nativesTabPage = new System.Windows.Forms.TabPage(); - this.label10 = new System.Windows.Forms.Label(); - this.controlRemoteProcessComboBox = new System.Windows.Forms.ComboBox(); - this.label9 = new System.Windows.Forms.Label(); - this.disassembleRemoteCodeComboBox = new System.Windows.Forms.ComboBox(); - this.label8 = new System.Windows.Forms.Label(); - this.writeRemoteMemoryComboBox = new System.Windows.Forms.ComboBox(); - this.label7 = new System.Windows.Forms.Label(); - this.readRemoteMemoryComboBox = new System.Windows.Forms.ComboBox(); - this.label6 = new System.Windows.Forms.Label(); - this.closeRemoteProcessComboBox = new System.Windows.Forms.ComboBox(); - this.label5 = new System.Windows.Forms.Label(); - this.openRemoteProcessComboBox = new System.Windows.Forms.ComboBox(); - this.label4 = new System.Windows.Forms.Label(); - this.isProcessValidComboBox = new System.Windows.Forms.ComboBox(); - this.enumerateProcessesComboBox = new System.Windows.Forms.ComboBox(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.enumerateRemoteSectionsAndModulesComboBox = new System.Windows.Forms.ComboBox(); - this.label1 = new System.Windows.Forms.Label(); - this.getMoreLinkLabel = new System.Windows.Forms.LinkLabel(); - this.closeButton = new System.Windows.Forms.Button(); - this.bannerBox = new ReClassNET.UI.BannerBox(); - this.tabControl.SuspendLayout(); - this.pluginsTabPage.SuspendLayout(); - this.descriptionGroupBox.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pluginsDataGridView)).BeginInit(); - this.nativesTabPage.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); - this.SuspendLayout(); - // - // tabControl - // - this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tabControl.Controls.Add(this.pluginsTabPage); - this.tabControl.Controls.Add(this.nativesTabPage); - this.tabControl.Location = new System.Drawing.Point(12, 60); - this.tabControl.Name = "tabControl"; - this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size(716, 328); - this.tabControl.TabIndex = 0; - // - // pluginsTabPage - // - this.pluginsTabPage.Controls.Add(this.descriptionGroupBox); - this.pluginsTabPage.Controls.Add(this.pluginsDataGridView); - this.pluginsTabPage.Location = new System.Drawing.Point(4, 22); - this.pluginsTabPage.Name = "pluginsTabPage"; - this.pluginsTabPage.Padding = new System.Windows.Forms.Padding(3); - this.pluginsTabPage.Size = new System.Drawing.Size(708, 302); - this.pluginsTabPage.TabIndex = 0; - this.pluginsTabPage.Text = "Plugins"; - this.pluginsTabPage.UseVisualStyleBackColor = true; - // - // descriptionGroupBox - // - this.descriptionGroupBox.Controls.Add(this.descriptionLabel); - this.descriptionGroupBox.Location = new System.Drawing.Point(6, 206); - this.descriptionGroupBox.Name = "descriptionGroupBox"; - this.descriptionGroupBox.Size = new System.Drawing.Size(696, 90); - this.descriptionGroupBox.TabIndex = 1; - this.descriptionGroupBox.TabStop = false; - this.descriptionGroupBox.Text = "<>"; - // - // descriptionLabel - // - this.descriptionLabel.Location = new System.Drawing.Point(6, 16); - this.descriptionLabel.Name = "descriptionLabel"; - this.descriptionLabel.Size = new System.Drawing.Size(684, 65); - this.descriptionLabel.TabIndex = 0; - this.descriptionLabel.Text = "<>"; - // - // pluginsDataGridView - // - this.pluginsDataGridView.AllowUserToAddRows = false; - this.pluginsDataGridView.AllowUserToDeleteRows = false; - this.pluginsDataGridView.AllowUserToResizeRows = false; - this.pluginsDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleHorizontal; - this.pluginsDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.pluginsDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.iconColumn, - this.nameColumn, - this.versionColumn, - this.authorColumn}); - this.pluginsDataGridView.Dock = System.Windows.Forms.DockStyle.Top; - this.pluginsDataGridView.Location = new System.Drawing.Point(3, 3); - this.pluginsDataGridView.MultiSelect = false; - this.pluginsDataGridView.Name = "pluginsDataGridView"; - this.pluginsDataGridView.ReadOnly = true; - this.pluginsDataGridView.RowHeadersVisible = false; - this.pluginsDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.pluginsDataGridView.Size = new System.Drawing.Size(702, 197); - this.pluginsDataGridView.TabIndex = 0; - this.pluginsDataGridView.SelectionChanged += new System.EventHandler(this.pluginsDataGridView_SelectionChanged); - // - // iconColumn - // - this.iconColumn.DataPropertyName = "Icon"; - this.iconColumn.HeaderText = ""; - this.iconColumn.MinimumWidth = 18; - this.iconColumn.Name = "iconColumn"; - this.iconColumn.ReadOnly = true; - this.iconColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.iconColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.iconColumn.Width = 18; - // - // nameColumn - // - this.nameColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.nameColumn.DataPropertyName = "Name"; - this.nameColumn.HeaderText = "Name"; - this.nameColumn.Name = "nameColumn"; - this.nameColumn.ReadOnly = true; - // - // versionColumn - // - this.versionColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.versionColumn.DataPropertyName = "Version"; - this.versionColumn.HeaderText = "Version"; - this.versionColumn.Name = "versionColumn"; - this.versionColumn.ReadOnly = true; - this.versionColumn.Width = 67; - // - // authorColumn - // - this.authorColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.authorColumn.DataPropertyName = "Author"; - this.authorColumn.HeaderText = "Author"; - this.authorColumn.Name = "authorColumn"; - this.authorColumn.ReadOnly = true; - this.authorColumn.Width = 63; - // - // nativesTabPage - // - this.nativesTabPage.Controls.Add(this.label10); - this.nativesTabPage.Controls.Add(this.controlRemoteProcessComboBox); - this.nativesTabPage.Controls.Add(this.label9); - this.nativesTabPage.Controls.Add(this.disassembleRemoteCodeComboBox); - this.nativesTabPage.Controls.Add(this.label8); - this.nativesTabPage.Controls.Add(this.writeRemoteMemoryComboBox); - this.nativesTabPage.Controls.Add(this.label7); - this.nativesTabPage.Controls.Add(this.readRemoteMemoryComboBox); - this.nativesTabPage.Controls.Add(this.label6); - this.nativesTabPage.Controls.Add(this.closeRemoteProcessComboBox); - this.nativesTabPage.Controls.Add(this.label5); - this.nativesTabPage.Controls.Add(this.openRemoteProcessComboBox); - this.nativesTabPage.Controls.Add(this.label4); - this.nativesTabPage.Controls.Add(this.isProcessValidComboBox); - this.nativesTabPage.Controls.Add(this.enumerateProcessesComboBox); - this.nativesTabPage.Controls.Add(this.label3); - this.nativesTabPage.Controls.Add(this.label2); - this.nativesTabPage.Controls.Add(this.enumerateRemoteSectionsAndModulesComboBox); - this.nativesTabPage.Controls.Add(this.label1); - this.nativesTabPage.Location = new System.Drawing.Point(4, 22); - this.nativesTabPage.Name = "nativesTabPage"; - this.nativesTabPage.Padding = new System.Windows.Forms.Padding(3); - this.nativesTabPage.Size = new System.Drawing.Size(708, 302); - this.nativesTabPage.TabIndex = 1; - this.nativesTabPage.Text = "Native Helper"; - this.nativesTabPage.UseVisualStyleBackColor = true; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(6, 268); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(115, 13); - this.label10.TabIndex = 18; - this.label10.Text = "ControlRemoteProcess"; - // - // controlRemoteProcessComboBox - // - this.controlRemoteProcessComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.controlRemoteProcessComboBox.FormattingEnabled = true; - this.controlRemoteProcessComboBox.Location = new System.Drawing.Point(218, 265); - this.controlRemoteProcessComboBox.Name = "controlRemoteProcessComboBox"; - this.controlRemoteProcessComboBox.Size = new System.Drawing.Size(161, 21); - this.controlRemoteProcessComboBox.TabIndex = 17; - this.controlRemoteProcessComboBox.SelectionChangeCommitted += new System.EventHandler(this.NativeMethodComboBox_SelectionChangeCommitted); - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(6, 241); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(128, 13); - this.label9.TabIndex = 16; - this.label9.Text = "DisassembleRemoteCode"; - // - // disassembleRemoteCodeComboBox - // - this.disassembleRemoteCodeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.disassembleRemoteCodeComboBox.FormattingEnabled = true; - this.disassembleRemoteCodeComboBox.Location = new System.Drawing.Point(218, 238); - this.disassembleRemoteCodeComboBox.Name = "disassembleRemoteCodeComboBox"; - this.disassembleRemoteCodeComboBox.Size = new System.Drawing.Size(161, 21); - this.disassembleRemoteCodeComboBox.TabIndex = 15; - this.disassembleRemoteCodeComboBox.SelectionChangeCommitted += new System.EventHandler(this.NativeMethodComboBox_SelectionChangeCommitted); - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(6, 214); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(106, 13); - this.label8.TabIndex = 14; - this.label8.Text = "WriteRemoteMemory"; - // - // writeRemoteMemoryComboBox - // - this.writeRemoteMemoryComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.writeRemoteMemoryComboBox.FormattingEnabled = true; - this.writeRemoteMemoryComboBox.Location = new System.Drawing.Point(218, 211); - this.writeRemoteMemoryComboBox.Name = "writeRemoteMemoryComboBox"; - this.writeRemoteMemoryComboBox.Size = new System.Drawing.Size(161, 21); - this.writeRemoteMemoryComboBox.TabIndex = 13; - this.writeRemoteMemoryComboBox.SelectionChangeCommitted += new System.EventHandler(this.NativeMethodComboBox_SelectionChangeCommitted); - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(6, 187); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(107, 13); - this.label7.TabIndex = 12; - this.label7.Text = "ReadRemoteMemory"; - // - // readRemoteMemoryComboBox - // - this.readRemoteMemoryComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.readRemoteMemoryComboBox.FormattingEnabled = true; - this.readRemoteMemoryComboBox.Location = new System.Drawing.Point(218, 184); - this.readRemoteMemoryComboBox.Name = "readRemoteMemoryComboBox"; - this.readRemoteMemoryComboBox.Size = new System.Drawing.Size(161, 21); - this.readRemoteMemoryComboBox.TabIndex = 11; - this.readRemoteMemoryComboBox.SelectionChangeCommitted += new System.EventHandler(this.NativeMethodComboBox_SelectionChangeCommitted); - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(6, 160); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(108, 13); - this.label6.TabIndex = 10; - this.label6.Text = "CloseRemoteProcess"; - // - // closeRemoteProcessComboBox - // - this.closeRemoteProcessComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.closeRemoteProcessComboBox.FormattingEnabled = true; - this.closeRemoteProcessComboBox.Location = new System.Drawing.Point(218, 157); - this.closeRemoteProcessComboBox.Name = "closeRemoteProcessComboBox"; - this.closeRemoteProcessComboBox.Size = new System.Drawing.Size(161, 21); - this.closeRemoteProcessComboBox.TabIndex = 9; - this.closeRemoteProcessComboBox.SelectionChangeCommitted += new System.EventHandler(this.NativeMethodComboBox_SelectionChangeCommitted); - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(6, 133); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(108, 13); - this.label5.TabIndex = 8; - this.label5.Text = "OpenRemoteProcess"; - // - // openRemoteProcessComboBox - // - this.openRemoteProcessComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.openRemoteProcessComboBox.FormattingEnabled = true; - this.openRemoteProcessComboBox.Location = new System.Drawing.Point(218, 130); - this.openRemoteProcessComboBox.Name = "openRemoteProcessComboBox"; - this.openRemoteProcessComboBox.Size = new System.Drawing.Size(161, 21); - this.openRemoteProcessComboBox.TabIndex = 7; - this.openRemoteProcessComboBox.SelectionChangeCommitted += new System.EventHandler(this.NativeMethodComboBox_SelectionChangeCommitted); - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(6, 106); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(76, 13); - this.label4.TabIndex = 6; - this.label4.Text = "IsProcessValid"; - // - // isProcessValidComboBox - // - this.isProcessValidComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.isProcessValidComboBox.FormattingEnabled = true; - this.isProcessValidComboBox.Location = new System.Drawing.Point(218, 103); - this.isProcessValidComboBox.Name = "isProcessValidComboBox"; - this.isProcessValidComboBox.Size = new System.Drawing.Size(161, 21); - this.isProcessValidComboBox.TabIndex = 5; - this.isProcessValidComboBox.SelectionChangeCommitted += new System.EventHandler(this.NativeMethodComboBox_SelectionChangeCommitted); - // - // enumerateProcessesComboBox - // - this.enumerateProcessesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.enumerateProcessesComboBox.FormattingEnabled = true; - this.enumerateProcessesComboBox.Location = new System.Drawing.Point(218, 49); - this.enumerateProcessesComboBox.Name = "enumerateProcessesComboBox"; - this.enumerateProcessesComboBox.Size = new System.Drawing.Size(161, 21); - this.enumerateProcessesComboBox.TabIndex = 4; - this.enumerateProcessesComboBox.SelectionChangeCommitted += new System.EventHandler(this.NativeMethodComboBox_SelectionChangeCommitted); - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(6, 79); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(195, 13); - this.label3.TabIndex = 3; - this.label3.Text = "EnumerateRemoteSectionsAndModules"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 52); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(107, 13); - this.label2.TabIndex = 2; - this.label2.Text = "EnumerateProcesses"; - // - // enumerateRemoteSectionsAndModulesComboBox - // - this.enumerateRemoteSectionsAndModulesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.enumerateRemoteSectionsAndModulesComboBox.FormattingEnabled = true; - this.enumerateRemoteSectionsAndModulesComboBox.Location = new System.Drawing.Point(218, 76); - this.enumerateRemoteSectionsAndModulesComboBox.Name = "enumerateRemoteSectionsAndModulesComboBox"; - this.enumerateRemoteSectionsAndModulesComboBox.Size = new System.Drawing.Size(161, 21); - this.enumerateRemoteSectionsAndModulesComboBox.TabIndex = 1; - this.enumerateRemoteSectionsAndModulesComboBox.SelectionChangeCommitted += new System.EventHandler(this.NativeMethodComboBox_SelectionChangeCommitted); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 6); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(409, 26); - this.label1.TabIndex = 0; - this.label1.Text = "Plugins can provide different methods how ReClass.NET accesses a remote process.\r" + - "\nYou can select these methods here:"; - // - // getMoreLinkLabel - // - this.getMoreLinkLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.getMoreLinkLabel.AutoSize = true; - this.getMoreLinkLabel.Location = new System.Drawing.Point(9, 396); - this.getMoreLinkLabel.Name = "getMoreLinkLabel"; - this.getMoreLinkLabel.Size = new System.Drawing.Size(95, 13); - this.getMoreLinkLabel.TabIndex = 1; - this.getMoreLinkLabel.TabStop = true; - this.getMoreLinkLabel.Text = "Get more plugins..."; - // - // closeButton - // - this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.closeButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.closeButton.Location = new System.Drawing.Point(653, 391); - this.closeButton.Name = "closeButton"; - this.closeButton.Size = new System.Drawing.Size(75, 23); - this.closeButton.TabIndex = 2; - this.closeButton.Text = "Close"; - this.closeButton.UseVisualStyleBackColor = true; - // - // bannerBox - // - this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; - this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B32x32_Plugin; - this.bannerBox.Location = new System.Drawing.Point(0, 0); - this.bannerBox.Name = "bannerBox"; - this.bannerBox.Size = new System.Drawing.Size(740, 48); - this.bannerBox.TabIndex = 3; - this.bannerBox.Text = "Here you can configure all loaded ReClass.NET plugins."; - this.bannerBox.Title = "Plugins"; - // - // PluginForm - // - this.AcceptButton = this.closeButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(740, 423); - this.Controls.Add(this.bannerBox); - this.Controls.Add(this.closeButton); - this.Controls.Add(this.getMoreLinkLabel); - this.Controls.Add(this.tabControl); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Name = "PluginForm"; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "ReClass.NET - Plugins"; - this.tabControl.ResumeLayout(false); - this.pluginsTabPage.ResumeLayout(false); - this.descriptionGroupBox.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.pluginsDataGridView)).EndInit(); - this.nativesTabPage.ResumeLayout(false); - this.nativesTabPage.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TabControl tabControl; - private System.Windows.Forms.TabPage pluginsTabPage; - private System.Windows.Forms.GroupBox descriptionGroupBox; - private System.Windows.Forms.DataGridView pluginsDataGridView; - private System.Windows.Forms.TabPage nativesTabPage; - private System.Windows.Forms.LinkLabel getMoreLinkLabel; - private System.Windows.Forms.Button closeButton; - private System.Windows.Forms.Label descriptionLabel; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.ComboBox disassembleRemoteCodeComboBox; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.ComboBox writeRemoteMemoryComboBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.ComboBox readRemoteMemoryComboBox; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.ComboBox closeRemoteProcessComboBox; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.ComboBox openRemoteProcessComboBox; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.ComboBox isProcessValidComboBox; - private System.Windows.Forms.ComboBox enumerateProcessesComboBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ComboBox enumerateRemoteSectionsAndModulesComboBox; - private System.Windows.Forms.DataGridViewImageColumn iconColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn nameColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn versionColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn authorColumn; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.ComboBox controlRemoteProcessComboBox; - private UI.BannerBox bannerBox; - } -} \ No newline at end of file diff --git a/Forms/PluginForm.cs b/Forms/PluginForm.cs deleted file mode 100644 index 57e68359..00000000 --- a/Forms/PluginForm.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using System.Data; -using System.Diagnostics.Contracts; -using System.Drawing; -using System.Linq; -using System.Windows.Forms; -using ReClassNET.Memory; -using ReClassNET.Plugins; -using ReClassNET.UI; - -namespace ReClassNET.Forms -{ - public partial class PluginForm : IconForm - { - private readonly PluginManager pluginManager; - private readonly NativeHelper nativeHelper; - - class PluginInfoRow - { - private readonly PluginInfo plugin; - - public Image Icon => plugin.Interface?.Icon ?? Properties.Resources.B16x16_Plugin; - public string Name => plugin.Name; - public string Version => plugin.FileVersion; - public string Author => plugin.Author; - public string Description => plugin.Description; - - public PluginInfoRow(PluginInfo plugin) - { - Contract.Requires(plugin != null); - - this.plugin = plugin; - } - } - - internal PluginForm(PluginManager pluginManager, NativeHelper nativeHelper) - { - Contract.Requires(pluginManager != null); - Contract.Requires(nativeHelper != null); - - this.pluginManager = pluginManager; - this.nativeHelper = nativeHelper; - - InitializeComponent(); - - // Plugins Tab - - pluginsDataGridView.AutoGenerateColumns = false; - pluginsDataGridView.DataSource = pluginManager.Select(p => new PluginInfoRow(p)).ToList(); - - UpdatePluginDescription(); - - // Native Methods Tab - - FillComboBox(enumerateProcessesComboBox, NativeHelper.RequestFunction.EnumerateProcesses); - FillComboBox(enumerateRemoteSectionsAndModulesComboBox, NativeHelper.RequestFunction.EnumerateRemoteSectionsAndModules); - FillComboBox(isProcessValidComboBox, NativeHelper.RequestFunction.IsProcessValid); - FillComboBox(openRemoteProcessComboBox, NativeHelper.RequestFunction.OpenRemoteProcess); - FillComboBox(closeRemoteProcessComboBox, NativeHelper.RequestFunction.CloseRemoteProcess); - FillComboBox(readRemoteMemoryComboBox, NativeHelper.RequestFunction.ReadRemoteMemory); - FillComboBox(writeRemoteMemoryComboBox, NativeHelper.RequestFunction.WriteRemoteMemory); - FillComboBox(disassembleRemoteCodeComboBox, NativeHelper.RequestFunction.DisassembleRemoteCode); - FillComboBox(controlRemoteProcessComboBox, NativeHelper.RequestFunction.ControlRemoteProcess); - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - GlobalWindowManager.AddWindow(this); - } - - protected override void OnFormClosed(FormClosedEventArgs e) - { - base.OnFormClosed(e); - - GlobalWindowManager.RemoveWindow(this); - } - - #region Event Handler - - private void pluginsDataGridView_SelectionChanged(object sender, EventArgs e) - { - UpdatePluginDescription(); - } - - private void NativeMethodComboBox_SelectionChangeCommitted(object sender, EventArgs e) - { - var cb = sender as ComboBox; - if (cb == null) - { - return; - } - - var methodInfo = cb.SelectedItem as NativeHelper.MethodInfo; - if (methodInfo != null) - { - nativeHelper.SetActiveNativeMethod(methodInfo); - } - } - - #endregion - - private void FillComboBox(ComboBox cb, NativeHelper.RequestFunction method) - { - Contract.Requires(cb != null); - - var methods = nativeHelper.MethodRegistry[method]; - - var selectedFnPtr = nativeHelper.RequestFunctionPtr(method); - - cb.DisplayMember = nameof(NativeHelper.MethodInfo.Provider); - cb.DataSource = methods; - cb.SelectedIndex = methods.FindIndex(m => m.FunctionPtr == selectedFnPtr); - } - - private void UpdatePluginDescription() - { - var row = pluginsDataGridView.SelectedRows.Cast().FirstOrDefault(); - if (row == null) - { - descriptionGroupBox.Text = string.Empty; - descriptionLabel.Text = string.Empty; - - return; - } - - var plugin = row.DataBoundItem as PluginInfoRow; - if (plugin != null) - { - descriptionGroupBox.Text = plugin.Name; - descriptionLabel.Text = plugin.Description; - } - } - } -} diff --git a/Forms/ProcessBrowserForm.cs b/Forms/ProcessBrowserForm.cs deleted file mode 100644 index 06e0ccce..00000000 --- a/Forms/ProcessBrowserForm.cs +++ /dev/null @@ -1,188 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Diagnostics.Contracts; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Windows.Forms; -using ReClassNET.Forms; -using ReClassNET.Memory; -using ReClassNET.UI; -using ReClassNET.Util; - -namespace ReClassNET -{ - public partial class ProcessBrowserForm : IconForm - { - private const string NoPreviousProcess = "No previous process"; - - private static readonly string[] CommonProcesses = new string[] - { - "[system process]", "system", "svchost.exe", "services.exe", "wininit.exe", - "smss.exe", "csrss.exe", "lsass.exe", "winlogon.exe", "wininit.exe", "dwm.exe" - }; - - private readonly NativeHelper nativeHelper; - - /// Gets the selected process. - public ProcessInfo SelectedProcess - { - get - { - var row = (processDataGridView.SelectedRows.Cast().FirstOrDefault()?.DataBoundItem as DataRowView)?.Row; - if (row != null) - { - return new ProcessInfo(nativeHelper, row.Field("id"), row.Field("name"), row.Field("path")); - } - return null; - } - } - - /// Gets if symbols should get loaded. - public bool LoadSymbols => loadSymbolsCheckBox.Checked; - - public ProcessBrowserForm(NativeHelper nativeHelper, string previousProcess) - { - Contract.Requires(nativeHelper != null); - - this.nativeHelper = nativeHelper; - - InitializeComponent(); - - processDataGridView.AutoGenerateColumns = false; - - previousProcessLinkLabel.Text = string.IsNullOrEmpty(previousProcess) ? NoPreviousProcess : previousProcess; - - RefreshProcessList(); - - foreach (var row in processDataGridView.Rows.Cast()) - { - if ((row.Cells[1].Value as string) == previousProcess) - { - processDataGridView.CurrentCell = row.Cells[1]; - break; - } - } - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - GlobalWindowManager.AddWindow(this); - } - - protected override void OnFormClosed(FormClosedEventArgs e) - { - base.OnFormClosed(e); - - GlobalWindowManager.RemoveWindow(this); - } - - #region Event Handler - - private void filterCheckBox_CheckedChanged(object sender, EventArgs e) - { - RefreshProcessList(); - } - - private void filterTextBox_TextChanged(object sender, EventArgs e) - { - ApplyFilter(); - } - - private void refreshButton_Click(object sender, EventArgs e) - { - RefreshProcessList(); - } - - private void previousProcessLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) - { - filterTextBox.Text = previousProcessLinkLabel.Text == NoPreviousProcess ? string.Empty : previousProcessLinkLabel.Text; - } - - private void processDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) - { - AcceptButton.PerformClick(); - } - - #endregion - - /// Queries all processes and displays them. - private void RefreshProcessList() - { - var dt = new DataTable(); - dt.Columns.Add("icon", typeof(Icon)); - dt.Columns.Add("name", typeof(string)); - dt.Columns.Add("id", typeof(int)); - dt.Columns.Add("path", typeof(string)); - dt.Columns.Add("create", typeof(DateTime)); - - nativeHelper.EnumerateProcesses((pid, path) => - { - var moduleName = Path.GetFileName(path); - if (!filterCheckBox.Checked || !CommonProcesses.Contains(moduleName.ToLower())) - { - var row = dt.NewRow(); - row["icon"] = ShellIcon.GetSmallIcon(path); - row["name"] = moduleName; - row["id"] = pid; - row["path"] = path; - row["create"] = GetProcessCreateTime((int)pid); - dt.Rows.Add(row); - } - }); - - dt.DefaultView.Sort = "create DESC"; - - processDataGridView.DataSource = dt; - - ApplyFilter(); - } - - /// Query the time the process was created. - /// The process id. - /// The time the process was created or if an error occurs. - private DateTime GetProcessCreateTime(int pid) - { - IntPtr handle = IntPtr.Zero; - try - { - handle = nativeHelper.OpenRemoteProcess((int)pid, NativeMethods.PROCESS_QUERY_LIMITED_INFORMATION); - if (!handle.IsNull()) - { - long dummy; - long create; - if (NativeMethods.GetProcessTimes(handle, out create, out dummy, out dummy, out dummy)) - { - return DateTime.FromFileTime(create); - } - } - } - catch - { - - } - finally - { - if (!handle.IsNull()) - { - nativeHelper.CloseRemoteProcess(handle); - } - } - - return DateTime.MinValue; - } - - private void ApplyFilter() - { - var filter = filterTextBox.Text; - if (!string.IsNullOrEmpty(filter)) - { - filter = $"name like '%{filter}%' or path like '%{filter}%'"; - } - (processDataGridView.DataSource as DataTable).DefaultView.RowFilter = filter; - } - } -} diff --git a/Forms/SettingsForm.Designer.cs b/Forms/SettingsForm.Designer.cs deleted file mode 100644 index e2d767d9..00000000 --- a/Forms/SettingsForm.Designer.cs +++ /dev/null @@ -1,1147 +0,0 @@ -namespace ReClassNET.Forms -{ - partial class SettingsForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.settingsTabControl = new System.Windows.Forms.TabControl(); - this.generalSettingsTabPage = new System.Windows.Forms.TabPage(); - this.commentsGroupBox = new System.Windows.Forms.GroupBox(); - this.showPluginInfoCheckBox = new ReClassNET.UI.SettingsCheckBox(); - this.showStringCheckBox = new ReClassNET.UI.SettingsCheckBox(); - this.showSymbolsCheckBox = new ReClassNET.UI.SettingsCheckBox(); - this.showRttiCheckBox = new ReClassNET.UI.SettingsCheckBox(); - this.showPointerCheckBox = new ReClassNET.UI.SettingsCheckBox(); - this.showIntegerCheckBox = new ReClassNET.UI.SettingsCheckBox(); - this.showFloatCheckBox = new ReClassNET.UI.SettingsCheckBox(); - this.displayGroupBox = new System.Windows.Forms.GroupBox(); - this.highlightChangedValuesCheckBox = new ReClassNET.UI.SettingsCheckBox(); - this.showTextCheckBox = new ReClassNET.UI.SettingsCheckBox(); - this.showNodeOffsetCheckBox = new ReClassNET.UI.SettingsCheckBox(); - this.showNodeAddressCheckBox = new ReClassNET.UI.SettingsCheckBox(); - this.stayOnTopCheckBox = new ReClassNET.UI.SettingsCheckBox(); - this.colorsSettingTabPage = new System.Windows.Forms.TabPage(); - this.nodeColorGroupBox = new System.Windows.Forms.GroupBox(); - this.nodeValueLabel = new System.Windows.Forms.Label(); - this.nodePluginLabel = new System.Windows.Forms.Label(); - this.nodeHexValueColorBox = new ReClassNET.UI.ColorBox(); - this.nodePluginColorBox = new ReClassNET.UI.ColorBox(); - this.nodeHexValueLabel = new System.Windows.Forms.Label(); - this.nodeVTableLabel = new System.Windows.Forms.Label(); - this.nodeOffsetColorBox = new ReClassNET.UI.ColorBox(); - this.nodeVTableColorBox = new ReClassNET.UI.ColorBox(); - this.nodeOffsetLabel = new System.Windows.Forms.Label(); - this.nodeTextLabel = new System.Windows.Forms.Label(); - this.nodeAddressColorBox = new ReClassNET.UI.ColorBox(); - this.nodeTextColorBox = new ReClassNET.UI.ColorBox(); - this.nodeAddressLabel = new System.Windows.Forms.Label(); - this.nodeCommentLabel = new System.Windows.Forms.Label(); - this.nodeHiddenColorBox = new ReClassNET.UI.ColorBox(); - this.nodeCommentColorBox = new ReClassNET.UI.ColorBox(); - this.nodeHiddenLabel = new System.Windows.Forms.Label(); - this.nodeIndexLabel = new System.Windows.Forms.Label(); - this.nodeSelectedColorBox = new ReClassNET.UI.ColorBox(); - this.nodeIndexColorBox = new ReClassNET.UI.ColorBox(); - this.nodeSelectedLabel = new System.Windows.Forms.Label(); - this.nodeTypeColorBox = new ReClassNET.UI.ColorBox(); - this.nodeValueColorBox = new ReClassNET.UI.ColorBox(); - this.nodeTypeLabel = new System.Windows.Forms.Label(); - this.nodeNameLabel = new System.Windows.Forms.Label(); - this.nodeNameColorBox = new ReClassNET.UI.ColorBox(); - this.backgroundLabel = new System.Windows.Forms.Label(); - this.backgroundColorBox = new ReClassNET.UI.ColorBox(); - this.typeDefinitionsSettingsTabPage = new System.Windows.Forms.TabPage(); - this.label1 = new System.Windows.Forms.Label(); - this.functionPtrLabel = new System.Windows.Forms.Label(); - this.functionPtrTextBox = new ReClassNET.UI.SettingsTextBox(); - this.utf16TextPtrLabel = new System.Windows.Forms.Label(); - this.utf16TextPtrTextBox = new ReClassNET.UI.SettingsTextBox(); - this.utf16TextLabel = new System.Windows.Forms.Label(); - this.utf16TextTextBox = new ReClassNET.UI.SettingsTextBox(); - this.utf8TextPtrLabel = new System.Windows.Forms.Label(); - this.utf8TextPtrTextBox = new ReClassNET.UI.SettingsTextBox(); - this.utf8TextLabel = new System.Windows.Forms.Label(); - this.utf8TextTextBox = new ReClassNET.UI.SettingsTextBox(); - this.matrix3x3Label = new System.Windows.Forms.Label(); - this.matrix3x3TextBox = new ReClassNET.UI.SettingsTextBox(); - this.matrix3x4Label = new System.Windows.Forms.Label(); - this.matrix3x4TextBox = new ReClassNET.UI.SettingsTextBox(); - this.matrix4x4Label = new System.Windows.Forms.Label(); - this.matrix4x4TextBox = new ReClassNET.UI.SettingsTextBox(); - this.vector2Label = new System.Windows.Forms.Label(); - this.vector2TextBox = new ReClassNET.UI.SettingsTextBox(); - this.vector3Label = new System.Windows.Forms.Label(); - this.vector3TextBox = new ReClassNET.UI.SettingsTextBox(); - this.vector4Label = new System.Windows.Forms.Label(); - this.vector4TextBox = new ReClassNET.UI.SettingsTextBox(); - this.doubleLabel = new System.Windows.Forms.Label(); - this.doubleTextBox = new ReClassNET.UI.SettingsTextBox(); - this.floatLabel = new System.Windows.Forms.Label(); - this.floatTextBox = new ReClassNET.UI.SettingsTextBox(); - this.uint64Label = new System.Windows.Forms.Label(); - this.uint64TextBox = new ReClassNET.UI.SettingsTextBox(); - this.uint32Label = new System.Windows.Forms.Label(); - this.uint32TextBox = new ReClassNET.UI.SettingsTextBox(); - this.uint16Label = new System.Windows.Forms.Label(); - this.uint16TextBox = new ReClassNET.UI.SettingsTextBox(); - this.uint8Label = new System.Windows.Forms.Label(); - this.uint8TextBox = new ReClassNET.UI.SettingsTextBox(); - this.int64Label = new System.Windows.Forms.Label(); - this.int64TextBox = new ReClassNET.UI.SettingsTextBox(); - this.int32Label = new System.Windows.Forms.Label(); - this.int32TextBox = new ReClassNET.UI.SettingsTextBox(); - this.int16Label = new System.Windows.Forms.Label(); - this.int16TextBox = new ReClassNET.UI.SettingsTextBox(); - this.int8Label = new System.Windows.Forms.Label(); - this.int8TextBox = new ReClassNET.UI.SettingsTextBox(); - this.paddingLabel = new System.Windows.Forms.Label(); - this.paddingTextBox = new ReClassNET.UI.SettingsTextBox(); - this.bannerBox = new ReClassNET.UI.BannerBox(); - this.settingsTabControl.SuspendLayout(); - this.generalSettingsTabPage.SuspendLayout(); - this.commentsGroupBox.SuspendLayout(); - this.displayGroupBox.SuspendLayout(); - this.colorsSettingTabPage.SuspendLayout(); - this.nodeColorGroupBox.SuspendLayout(); - this.typeDefinitionsSettingsTabPage.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); - this.SuspendLayout(); - // - // settingsTabControl - // - this.settingsTabControl.Controls.Add(this.generalSettingsTabPage); - this.settingsTabControl.Controls.Add(this.colorsSettingTabPage); - this.settingsTabControl.Controls.Add(this.typeDefinitionsSettingsTabPage); - this.settingsTabControl.Location = new System.Drawing.Point(12, 60); - this.settingsTabControl.Name = "settingsTabControl"; - this.settingsTabControl.SelectedIndex = 0; - this.settingsTabControl.Size = new System.Drawing.Size(562, 355); - this.settingsTabControl.TabIndex = 1; - // - // generalSettingsTabPage - // - this.generalSettingsTabPage.Controls.Add(this.commentsGroupBox); - this.generalSettingsTabPage.Controls.Add(this.displayGroupBox); - this.generalSettingsTabPage.Controls.Add(this.stayOnTopCheckBox); - this.generalSettingsTabPage.Location = new System.Drawing.Point(4, 22); - this.generalSettingsTabPage.Name = "generalSettingsTabPage"; - this.generalSettingsTabPage.Padding = new System.Windows.Forms.Padding(3); - this.generalSettingsTabPage.Size = new System.Drawing.Size(554, 329); - this.generalSettingsTabPage.TabIndex = 0; - this.generalSettingsTabPage.Text = "General"; - this.generalSettingsTabPage.UseVisualStyleBackColor = true; - // - // commentsGroupBox - // - this.commentsGroupBox.Controls.Add(this.showPluginInfoCheckBox); - this.commentsGroupBox.Controls.Add(this.showStringCheckBox); - this.commentsGroupBox.Controls.Add(this.showSymbolsCheckBox); - this.commentsGroupBox.Controls.Add(this.showRttiCheckBox); - this.commentsGroupBox.Controls.Add(this.showPointerCheckBox); - this.commentsGroupBox.Controls.Add(this.showIntegerCheckBox); - this.commentsGroupBox.Controls.Add(this.showFloatCheckBox); - this.commentsGroupBox.Location = new System.Drawing.Point(6, 39); - this.commentsGroupBox.Name = "commentsGroupBox"; - this.commentsGroupBox.Size = new System.Drawing.Size(265, 186); - this.commentsGroupBox.TabIndex = 3; - this.commentsGroupBox.TabStop = false; - this.commentsGroupBox.Text = "Node Comments"; - // - // showPluginInfoCheckBox - // - this.showPluginInfoCheckBox.AutoSize = true; - this.showPluginInfoCheckBox.Location = new System.Drawing.Point(6, 157); - this.showPluginInfoCheckBox.Name = "showPluginInfoCheckBox"; - this.showPluginInfoCheckBox.Size = new System.Drawing.Size(111, 17); - this.showPluginInfoCheckBox.TabIndex = 6; - this.showPluginInfoCheckBox.Text = "Show Plugin Infos"; - this.showPluginInfoCheckBox.UseVisualStyleBackColor = true; - // - // showStringCheckBox - // - this.showStringCheckBox.AutoSize = true; - this.showStringCheckBox.Location = new System.Drawing.Point(6, 134); - this.showStringCheckBox.Name = "showStringCheckBox"; - this.showStringCheckBox.Size = new System.Drawing.Size(88, 17); - this.showStringCheckBox.TabIndex = 5; - this.showStringCheckBox.Text = "Show Strings"; - this.showStringCheckBox.UseVisualStyleBackColor = true; - // - // showSymbolsCheckBox - // - this.showSymbolsCheckBox.AutoSize = true; - this.showSymbolsCheckBox.Location = new System.Drawing.Point(6, 111); - this.showSymbolsCheckBox.Name = "showSymbolsCheckBox"; - this.showSymbolsCheckBox.Size = new System.Drawing.Size(130, 17); - this.showSymbolsCheckBox.TabIndex = 4; - this.showSymbolsCheckBox.Text = "Show Debug Symbols"; - this.showSymbolsCheckBox.UseVisualStyleBackColor = true; - // - // showRttiCheckBox - // - this.showRttiCheckBox.AutoSize = true; - this.showRttiCheckBox.Location = new System.Drawing.Point(6, 88); - this.showRttiCheckBox.Name = "showRttiCheckBox"; - this.showRttiCheckBox.Size = new System.Drawing.Size(81, 17); - this.showRttiCheckBox.TabIndex = 3; - this.showRttiCheckBox.Text = "Show RTTI"; - this.showRttiCheckBox.UseVisualStyleBackColor = true; - // - // showPointerCheckBox - // - this.showPointerCheckBox.AutoSize = true; - this.showPointerCheckBox.Location = new System.Drawing.Point(6, 65); - this.showPointerCheckBox.Name = "showPointerCheckBox"; - this.showPointerCheckBox.Size = new System.Drawing.Size(94, 17); - this.showPointerCheckBox.TabIndex = 2; - this.showPointerCheckBox.Text = "Show Pointers"; - this.showPointerCheckBox.UseVisualStyleBackColor = true; - // - // showIntegerCheckBox - // - this.showIntegerCheckBox.AutoSize = true; - this.showIntegerCheckBox.Location = new System.Drawing.Point(6, 42); - this.showIntegerCheckBox.Name = "showIntegerCheckBox"; - this.showIntegerCheckBox.Size = new System.Drawing.Size(124, 17); - this.showIntegerCheckBox.TabIndex = 1; - this.showIntegerCheckBox.Text = "Show Integer Values"; - this.showIntegerCheckBox.UseVisualStyleBackColor = true; - // - // showFloatCheckBox - // - this.showFloatCheckBox.AutoSize = true; - this.showFloatCheckBox.Location = new System.Drawing.Point(6, 19); - this.showFloatCheckBox.Name = "showFloatCheckBox"; - this.showFloatCheckBox.Size = new System.Drawing.Size(114, 17); - this.showFloatCheckBox.TabIndex = 0; - this.showFloatCheckBox.Text = "Show Float Values"; - this.showFloatCheckBox.UseVisualStyleBackColor = true; - // - // displayGroupBox - // - this.displayGroupBox.Controls.Add(this.highlightChangedValuesCheckBox); - this.displayGroupBox.Controls.Add(this.showTextCheckBox); - this.displayGroupBox.Controls.Add(this.showNodeOffsetCheckBox); - this.displayGroupBox.Controls.Add(this.showNodeAddressCheckBox); - this.displayGroupBox.Location = new System.Drawing.Point(283, 39); - this.displayGroupBox.Name = "displayGroupBox"; - this.displayGroupBox.Size = new System.Drawing.Size(265, 113); - this.displayGroupBox.TabIndex = 2; - this.displayGroupBox.TabStop = false; - this.displayGroupBox.Text = "Display"; - // - // highlightChangedValuesCheckBox - // - this.highlightChangedValuesCheckBox.AutoSize = true; - this.highlightChangedValuesCheckBox.Location = new System.Drawing.Point(6, 88); - this.highlightChangedValuesCheckBox.Name = "highlightChangedValuesCheckBox"; - this.highlightChangedValuesCheckBox.Size = new System.Drawing.Size(148, 17); - this.highlightChangedValuesCheckBox.TabIndex = 3; - this.highlightChangedValuesCheckBox.Text = "Highlight Changed Values"; - this.highlightChangedValuesCheckBox.UseVisualStyleBackColor = true; - // - // showTextCheckBox - // - this.showTextCheckBox.AutoSize = true; - this.showTextCheckBox.Location = new System.Drawing.Point(6, 65); - this.showTextCheckBox.Name = "showTextCheckBox"; - this.showTextCheckBox.Size = new System.Drawing.Size(166, 17); - this.showTextCheckBox.TabIndex = 2; - this.showTextCheckBox.Text = "Show Textual Representation"; - this.showTextCheckBox.UseVisualStyleBackColor = true; - // - // showNodeOffsetCheckBox - // - this.showNodeOffsetCheckBox.AutoSize = true; - this.showNodeOffsetCheckBox.Location = new System.Drawing.Point(6, 42); - this.showNodeOffsetCheckBox.Name = "showNodeOffsetCheckBox"; - this.showNodeOffsetCheckBox.Size = new System.Drawing.Size(113, 17); - this.showNodeOffsetCheckBox.TabIndex = 1; - this.showNodeOffsetCheckBox.Text = "Show Node Offset"; - this.showNodeOffsetCheckBox.UseVisualStyleBackColor = true; - // - // showNodeAddressCheckBox - // - this.showNodeAddressCheckBox.AutoSize = true; - this.showNodeAddressCheckBox.Location = new System.Drawing.Point(6, 19); - this.showNodeAddressCheckBox.Name = "showNodeAddressCheckBox"; - this.showNodeAddressCheckBox.Size = new System.Drawing.Size(123, 17); - this.showNodeAddressCheckBox.TabIndex = 0; - this.showNodeAddressCheckBox.Text = "Show Node Address"; - this.showNodeAddressCheckBox.UseVisualStyleBackColor = true; - // - // stayOnTopCheckBox - // - this.stayOnTopCheckBox.AutoSize = true; - this.stayOnTopCheckBox.Location = new System.Drawing.Point(6, 6); - this.stayOnTopCheckBox.Name = "stayOnTopCheckBox"; - this.stayOnTopCheckBox.Size = new System.Drawing.Size(187, 17); - this.stayOnTopCheckBox.TabIndex = 1; - this.stayOnTopCheckBox.Text = "Force ReClass.NET to stay on top"; - this.stayOnTopCheckBox.UseVisualStyleBackColor = true; - // - // colorsSettingTabPage - // - this.colorsSettingTabPage.Controls.Add(this.nodeColorGroupBox); - this.colorsSettingTabPage.Controls.Add(this.backgroundLabel); - this.colorsSettingTabPage.Controls.Add(this.backgroundColorBox); - this.colorsSettingTabPage.Location = new System.Drawing.Point(4, 22); - this.colorsSettingTabPage.Name = "colorsSettingTabPage"; - this.colorsSettingTabPage.Padding = new System.Windows.Forms.Padding(3); - this.colorsSettingTabPage.Size = new System.Drawing.Size(554, 329); - this.colorsSettingTabPage.TabIndex = 1; - this.colorsSettingTabPage.Text = "Colors"; - this.colorsSettingTabPage.UseVisualStyleBackColor = true; - // - // nodeColorGroupBox - // - this.nodeColorGroupBox.Controls.Add(this.nodeValueLabel); - this.nodeColorGroupBox.Controls.Add(this.nodePluginLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeHexValueColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodePluginColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeHexValueLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeVTableLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeOffsetColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeVTableColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeOffsetLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeTextLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeAddressColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeTextColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeAddressLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeCommentLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeHiddenColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeCommentColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeHiddenLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeIndexLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeSelectedColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeIndexColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeSelectedLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeTypeColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeValueColorBox); - this.nodeColorGroupBox.Controls.Add(this.nodeTypeLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeNameLabel); - this.nodeColorGroupBox.Controls.Add(this.nodeNameColorBox); - this.nodeColorGroupBox.Location = new System.Drawing.Point(9, 43); - this.nodeColorGroupBox.Name = "nodeColorGroupBox"; - this.nodeColorGroupBox.Size = new System.Drawing.Size(539, 225); - this.nodeColorGroupBox.TabIndex = 28; - this.nodeColorGroupBox.TabStop = false; - this.nodeColorGroupBox.Text = "Node Colors"; - // - // nodeValueLabel - // - this.nodeValueLabel.AutoSize = true; - this.nodeValueLabel.Location = new System.Drawing.Point(9, 198); - this.nodeValueLabel.Name = "nodeValueLabel"; - this.nodeValueLabel.Size = new System.Drawing.Size(64, 13); - this.nodeValueLabel.TabIndex = 17; - this.nodeValueLabel.Text = "Value Color:"; - // - // nodePluginLabel - // - this.nodePluginLabel.AutoSize = true; - this.nodePluginLabel.Location = new System.Drawing.Point(286, 172); - this.nodePluginLabel.Name = "nodePluginLabel"; - this.nodePluginLabel.Size = new System.Drawing.Size(87, 13); - this.nodePluginLabel.TabIndex = 27; - this.nodePluginLabel.Text = "Plugin Info Color:"; - // - // nodeHexValueColorBox - // - this.nodeHexValueColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeHexValueColorBox.Location = new System.Drawing.Point(133, 117); - this.nodeHexValueColorBox.Name = "nodeHexValueColorBox"; - this.nodeHexValueColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeHexValueColorBox.TabIndex = 2; - // - // nodePluginColorBox - // - this.nodePluginColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodePluginColorBox.Location = new System.Drawing.Point(410, 169); - this.nodePluginColorBox.Name = "nodePluginColorBox"; - this.nodePluginColorBox.Size = new System.Drawing.Size(123, 20); - this.nodePluginColorBox.TabIndex = 26; - // - // nodeHexValueLabel - // - this.nodeHexValueLabel.AutoSize = true; - this.nodeHexValueLabel.Location = new System.Drawing.Point(9, 120); - this.nodeHexValueLabel.Name = "nodeHexValueLabel"; - this.nodeHexValueLabel.Size = new System.Drawing.Size(86, 13); - this.nodeHexValueLabel.TabIndex = 3; - this.nodeHexValueLabel.Text = "Hex Value Color:"; - // - // nodeVTableLabel - // - this.nodeVTableLabel.AutoSize = true; - this.nodeVTableLabel.Location = new System.Drawing.Point(286, 94); - this.nodeVTableLabel.Name = "nodeVTableLabel"; - this.nodeVTableLabel.Size = new System.Drawing.Size(71, 13); - this.nodeVTableLabel.TabIndex = 25; - this.nodeVTableLabel.Text = "VTable Color:"; - // - // nodeOffsetColorBox - // - this.nodeOffsetColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeOffsetColorBox.Location = new System.Drawing.Point(133, 91); - this.nodeOffsetColorBox.Name = "nodeOffsetColorBox"; - this.nodeOffsetColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeOffsetColorBox.TabIndex = 4; - // - // nodeVTableColorBox - // - this.nodeVTableColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeVTableColorBox.Location = new System.Drawing.Point(410, 91); - this.nodeVTableColorBox.Name = "nodeVTableColorBox"; - this.nodeVTableColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeVTableColorBox.TabIndex = 24; - // - // nodeOffsetLabel - // - this.nodeOffsetLabel.AutoSize = true; - this.nodeOffsetLabel.Location = new System.Drawing.Point(9, 94); - this.nodeOffsetLabel.Name = "nodeOffsetLabel"; - this.nodeOffsetLabel.Size = new System.Drawing.Size(65, 13); - this.nodeOffsetLabel.TabIndex = 5; - this.nodeOffsetLabel.Text = "Offset Color:"; - // - // nodeTextLabel - // - this.nodeTextLabel.AutoSize = true; - this.nodeTextLabel.Location = new System.Drawing.Point(286, 146); - this.nodeTextLabel.Name = "nodeTextLabel"; - this.nodeTextLabel.Size = new System.Drawing.Size(58, 13); - this.nodeTextLabel.TabIndex = 23; - this.nodeTextLabel.Text = "Text Color:"; - // - // nodeAddressColorBox - // - this.nodeAddressColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeAddressColorBox.Location = new System.Drawing.Point(133, 65); - this.nodeAddressColorBox.Name = "nodeAddressColorBox"; - this.nodeAddressColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeAddressColorBox.TabIndex = 6; - // - // nodeTextColorBox - // - this.nodeTextColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeTextColorBox.Location = new System.Drawing.Point(410, 143); - this.nodeTextColorBox.Name = "nodeTextColorBox"; - this.nodeTextColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeTextColorBox.TabIndex = 22; - // - // nodeAddressLabel - // - this.nodeAddressLabel.AutoSize = true; - this.nodeAddressLabel.Location = new System.Drawing.Point(9, 68); - this.nodeAddressLabel.Name = "nodeAddressLabel"; - this.nodeAddressLabel.Size = new System.Drawing.Size(75, 13); - this.nodeAddressLabel.TabIndex = 7; - this.nodeAddressLabel.Text = "Address Color:"; - // - // nodeCommentLabel - // - this.nodeCommentLabel.AutoSize = true; - this.nodeCommentLabel.Location = new System.Drawing.Point(286, 120); - this.nodeCommentLabel.Name = "nodeCommentLabel"; - this.nodeCommentLabel.Size = new System.Drawing.Size(81, 13); - this.nodeCommentLabel.TabIndex = 21; - this.nodeCommentLabel.Text = "Comment Color:"; - // - // nodeHiddenColorBox - // - this.nodeHiddenColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeHiddenColorBox.Location = new System.Drawing.Point(410, 18); - this.nodeHiddenColorBox.Name = "nodeHiddenColorBox"; - this.nodeHiddenColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeHiddenColorBox.TabIndex = 8; - // - // nodeCommentColorBox - // - this.nodeCommentColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeCommentColorBox.Location = new System.Drawing.Point(410, 117); - this.nodeCommentColorBox.Name = "nodeCommentColorBox"; - this.nodeCommentColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeCommentColorBox.TabIndex = 20; - // - // nodeHiddenLabel - // - this.nodeHiddenLabel.AutoSize = true; - this.nodeHiddenLabel.Location = new System.Drawing.Point(286, 21); - this.nodeHiddenLabel.Name = "nodeHiddenLabel"; - this.nodeHiddenLabel.Size = new System.Drawing.Size(71, 13); - this.nodeHiddenLabel.TabIndex = 9; - this.nodeHiddenLabel.Text = "Hidden Color:"; - // - // nodeIndexLabel - // - this.nodeIndexLabel.AutoSize = true; - this.nodeIndexLabel.Location = new System.Drawing.Point(286, 68); - this.nodeIndexLabel.Name = "nodeIndexLabel"; - this.nodeIndexLabel.Size = new System.Drawing.Size(63, 13); - this.nodeIndexLabel.TabIndex = 19; - this.nodeIndexLabel.Text = "Index Color:"; - // - // nodeSelectedColorBox - // - this.nodeSelectedColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeSelectedColorBox.Location = new System.Drawing.Point(133, 18); - this.nodeSelectedColorBox.Name = "nodeSelectedColorBox"; - this.nodeSelectedColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeSelectedColorBox.TabIndex = 10; - // - // nodeIndexColorBox - // - this.nodeIndexColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeIndexColorBox.Location = new System.Drawing.Point(410, 65); - this.nodeIndexColorBox.Name = "nodeIndexColorBox"; - this.nodeIndexColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeIndexColorBox.TabIndex = 18; - // - // nodeSelectedLabel - // - this.nodeSelectedLabel.AutoSize = true; - this.nodeSelectedLabel.Location = new System.Drawing.Point(9, 21); - this.nodeSelectedLabel.Name = "nodeSelectedLabel"; - this.nodeSelectedLabel.Size = new System.Drawing.Size(79, 13); - this.nodeSelectedLabel.TabIndex = 11; - this.nodeSelectedLabel.Text = "Selected Color:"; - // - // nodeTypeColorBox - // - this.nodeTypeColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeTypeColorBox.Location = new System.Drawing.Point(133, 143); - this.nodeTypeColorBox.Name = "nodeTypeColorBox"; - this.nodeTypeColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeTypeColorBox.TabIndex = 12; - // - // nodeValueColorBox - // - this.nodeValueColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeValueColorBox.Location = new System.Drawing.Point(133, 195); - this.nodeValueColorBox.Name = "nodeValueColorBox"; - this.nodeValueColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeValueColorBox.TabIndex = 16; - // - // nodeTypeLabel - // - this.nodeTypeLabel.AutoSize = true; - this.nodeTypeLabel.Location = new System.Drawing.Point(9, 146); - this.nodeTypeLabel.Name = "nodeTypeLabel"; - this.nodeTypeLabel.Size = new System.Drawing.Size(61, 13); - this.nodeTypeLabel.TabIndex = 13; - this.nodeTypeLabel.Text = "Type Color:"; - // - // nodeNameLabel - // - this.nodeNameLabel.AutoSize = true; - this.nodeNameLabel.Location = new System.Drawing.Point(9, 172); - this.nodeNameLabel.Name = "nodeNameLabel"; - this.nodeNameLabel.Size = new System.Drawing.Size(65, 13); - this.nodeNameLabel.TabIndex = 15; - this.nodeNameLabel.Text = "Name Color:"; - // - // nodeNameColorBox - // - this.nodeNameColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.nodeNameColorBox.Location = new System.Drawing.Point(133, 169); - this.nodeNameColorBox.Name = "nodeNameColorBox"; - this.nodeNameColorBox.Size = new System.Drawing.Size(123, 20); - this.nodeNameColorBox.TabIndex = 14; - // - // backgroundLabel - // - this.backgroundLabel.AutoSize = true; - this.backgroundLabel.Location = new System.Drawing.Point(6, 14); - this.backgroundLabel.Name = "backgroundLabel"; - this.backgroundLabel.Size = new System.Drawing.Size(161, 13); - this.backgroundLabel.TabIndex = 1; - this.backgroundLabel.Text = "Memory View Background Color:"; - // - // backgroundColorBox - // - this.backgroundColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - this.backgroundColorBox.Location = new System.Drawing.Point(175, 11); - this.backgroundColorBox.Name = "backgroundColorBox"; - this.backgroundColorBox.Size = new System.Drawing.Size(123, 20); - this.backgroundColorBox.TabIndex = 0; - // - // typeDefinitionsSettingsTabPage - // - this.typeDefinitionsSettingsTabPage.Controls.Add(this.label1); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.functionPtrLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.functionPtrTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf16TextPtrLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf16TextPtrTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf16TextLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf16TextTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf8TextPtrLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf8TextPtrTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf8TextLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf8TextTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x3Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x3TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x4Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x4TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix4x4Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix4x4TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector2Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector2TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector3Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector3TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector4Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector4TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.doubleLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.doubleTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.floatLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.floatTextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint64Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint64TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint32Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint32TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint16Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint16TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint8Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint8TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int64Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int64TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int32Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int32TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int16Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int16TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int8Label); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.int8TextBox); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.paddingLabel); - this.typeDefinitionsSettingsTabPage.Controls.Add(this.paddingTextBox); - this.typeDefinitionsSettingsTabPage.Location = new System.Drawing.Point(4, 22); - this.typeDefinitionsSettingsTabPage.Name = "typeDefinitionsSettingsTabPage"; - this.typeDefinitionsSettingsTabPage.Padding = new System.Windows.Forms.Padding(3); - this.typeDefinitionsSettingsTabPage.Size = new System.Drawing.Size(554, 329); - this.typeDefinitionsSettingsTabPage.TabIndex = 2; - this.typeDefinitionsSettingsTabPage.Text = "Type Definitions"; - this.typeDefinitionsSettingsTabPage.UseVisualStyleBackColor = true; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 6); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(214, 13); - this.label1.TabIndex = 44; - this.label1.Text = "These types are used to generate the code:"; - // - // functionPtrLabel - // - this.functionPtrLabel.AutoSize = true; - this.functionPtrLabel.Location = new System.Drawing.Point(254, 295); - this.functionPtrLabel.Name = "functionPtrLabel"; - this.functionPtrLabel.Size = new System.Drawing.Size(87, 13); - this.functionPtrLabel.TabIndex = 43; - this.functionPtrLabel.Text = "Function Pointer:"; - // - // functionPtrTextBox - // - this.functionPtrTextBox.Location = new System.Drawing.Point(346, 292); - this.functionPtrTextBox.Name = "functionPtrTextBox"; - this.functionPtrTextBox.Size = new System.Drawing.Size(120, 20); - this.functionPtrTextBox.TabIndex = 42; - // - // utf16TextPtrLabel - // - this.utf16TextPtrLabel.AutoSize = true; - this.utf16TextPtrLabel.Location = new System.Drawing.Point(254, 269); - this.utf16TextPtrLabel.Name = "utf16TextPtrLabel"; - this.utf16TextPtrLabel.Size = new System.Drawing.Size(79, 13); - this.utf16TextPtrLabel.TabIndex = 41; - this.utf16TextPtrLabel.Text = "UTF16 Pointer:"; - // - // utf16TextPtrTextBox - // - this.utf16TextPtrTextBox.Location = new System.Drawing.Point(346, 266); - this.utf16TextPtrTextBox.Name = "utf16TextPtrTextBox"; - this.utf16TextPtrTextBox.Size = new System.Drawing.Size(120, 20); - this.utf16TextPtrTextBox.TabIndex = 40; - // - // utf16TextLabel - // - this.utf16TextLabel.AutoSize = true; - this.utf16TextLabel.Location = new System.Drawing.Point(254, 243); - this.utf16TextLabel.Name = "utf16TextLabel"; - this.utf16TextLabel.Size = new System.Drawing.Size(43, 13); - this.utf16TextLabel.TabIndex = 39; - this.utf16TextLabel.Text = "UTF16:"; - // - // utf16TextTextBox - // - this.utf16TextTextBox.Location = new System.Drawing.Point(346, 240); - this.utf16TextTextBox.Name = "utf16TextTextBox"; - this.utf16TextTextBox.Size = new System.Drawing.Size(120, 20); - this.utf16TextTextBox.TabIndex = 38; - // - // utf8TextPtrLabel - // - this.utf8TextPtrLabel.AutoSize = true; - this.utf8TextPtrLabel.Location = new System.Drawing.Point(254, 217); - this.utf8TextPtrLabel.Name = "utf8TextPtrLabel"; - this.utf8TextPtrLabel.Size = new System.Drawing.Size(73, 13); - this.utf8TextPtrLabel.TabIndex = 37; - this.utf8TextPtrLabel.Text = "UTF8 Pointer:"; - // - // utf8TextPtrTextBox - // - this.utf8TextPtrTextBox.Location = new System.Drawing.Point(346, 214); - this.utf8TextPtrTextBox.Name = "utf8TextPtrTextBox"; - this.utf8TextPtrTextBox.Size = new System.Drawing.Size(120, 20); - this.utf8TextPtrTextBox.TabIndex = 36; - // - // utf8TextLabel - // - this.utf8TextLabel.AutoSize = true; - this.utf8TextLabel.Location = new System.Drawing.Point(254, 191); - this.utf8TextLabel.Name = "utf8TextLabel"; - this.utf8TextLabel.Size = new System.Drawing.Size(37, 13); - this.utf8TextLabel.TabIndex = 35; - this.utf8TextLabel.Text = "UTF8:"; - // - // utf8TextTextBox - // - this.utf8TextTextBox.Location = new System.Drawing.Point(346, 188); - this.utf8TextTextBox.Name = "utf8TextTextBox"; - this.utf8TextTextBox.Size = new System.Drawing.Size(120, 20); - this.utf8TextTextBox.TabIndex = 34; - // - // matrix3x3Label - // - this.matrix3x3Label.AutoSize = true; - this.matrix3x3Label.Location = new System.Drawing.Point(254, 113); - this.matrix3x3Label.Name = "matrix3x3Label"; - this.matrix3x3Label.Size = new System.Drawing.Size(64, 13); - this.matrix3x3Label.TabIndex = 33; - this.matrix3x3Label.Text = "Matrix (3x3):"; - // - // matrix3x3TextBox - // - this.matrix3x3TextBox.Location = new System.Drawing.Point(346, 110); - this.matrix3x3TextBox.Name = "matrix3x3TextBox"; - this.matrix3x3TextBox.Size = new System.Drawing.Size(120, 20); - this.matrix3x3TextBox.TabIndex = 32; - // - // matrix3x4Label - // - this.matrix3x4Label.AutoSize = true; - this.matrix3x4Label.Location = new System.Drawing.Point(254, 139); - this.matrix3x4Label.Name = "matrix3x4Label"; - this.matrix3x4Label.Size = new System.Drawing.Size(64, 13); - this.matrix3x4Label.TabIndex = 31; - this.matrix3x4Label.Text = "Matrix (3x4):"; - // - // matrix3x4TextBox - // - this.matrix3x4TextBox.Location = new System.Drawing.Point(346, 136); - this.matrix3x4TextBox.Name = "matrix3x4TextBox"; - this.matrix3x4TextBox.Size = new System.Drawing.Size(120, 20); - this.matrix3x4TextBox.TabIndex = 30; - // - // matrix4x4Label - // - this.matrix4x4Label.AutoSize = true; - this.matrix4x4Label.Location = new System.Drawing.Point(254, 165); - this.matrix4x4Label.Name = "matrix4x4Label"; - this.matrix4x4Label.Size = new System.Drawing.Size(64, 13); - this.matrix4x4Label.TabIndex = 29; - this.matrix4x4Label.Text = "Matrix (4x4):"; - // - // matrix4x4TextBox - // - this.matrix4x4TextBox.Location = new System.Drawing.Point(346, 162); - this.matrix4x4TextBox.Name = "matrix4x4TextBox"; - this.matrix4x4TextBox.Size = new System.Drawing.Size(120, 20); - this.matrix4x4TextBox.TabIndex = 28; - // - // vector2Label - // - this.vector2Label.AutoSize = true; - this.vector2Label.Location = new System.Drawing.Point(254, 35); - this.vector2Label.Name = "vector2Label"; - this.vector2Label.Size = new System.Drawing.Size(47, 13); - this.vector2Label.TabIndex = 27; - this.vector2Label.Text = "Vector2:"; - // - // vector2TextBox - // - this.vector2TextBox.Location = new System.Drawing.Point(346, 32); - this.vector2TextBox.Name = "vector2TextBox"; - this.vector2TextBox.Size = new System.Drawing.Size(120, 20); - this.vector2TextBox.TabIndex = 26; - // - // vector3Label - // - this.vector3Label.AutoSize = true; - this.vector3Label.Location = new System.Drawing.Point(254, 61); - this.vector3Label.Name = "vector3Label"; - this.vector3Label.Size = new System.Drawing.Size(47, 13); - this.vector3Label.TabIndex = 25; - this.vector3Label.Text = "Vector3:"; - // - // vector3TextBox - // - this.vector3TextBox.Location = new System.Drawing.Point(346, 58); - this.vector3TextBox.Name = "vector3TextBox"; - this.vector3TextBox.Size = new System.Drawing.Size(120, 20); - this.vector3TextBox.TabIndex = 24; - // - // vector4Label - // - this.vector4Label.AutoSize = true; - this.vector4Label.Location = new System.Drawing.Point(254, 87); - this.vector4Label.Name = "vector4Label"; - this.vector4Label.Size = new System.Drawing.Size(47, 13); - this.vector4Label.TabIndex = 23; - this.vector4Label.Text = "Vector4:"; - // - // vector4TextBox - // - this.vector4TextBox.Location = new System.Drawing.Point(346, 84); - this.vector4TextBox.Name = "vector4TextBox"; - this.vector4TextBox.Size = new System.Drawing.Size(120, 20); - this.vector4TextBox.TabIndex = 22; - // - // doubleLabel - // - this.doubleLabel.AutoSize = true; - this.doubleLabel.Location = new System.Drawing.Point(6, 295); - this.doubleLabel.Name = "doubleLabel"; - this.doubleLabel.Size = new System.Drawing.Size(44, 13); - this.doubleLabel.TabIndex = 21; - this.doubleLabel.Text = "Double:"; - // - // doubleTextBox - // - this.doubleTextBox.Location = new System.Drawing.Point(98, 292); - this.doubleTextBox.Name = "doubleTextBox"; - this.doubleTextBox.Size = new System.Drawing.Size(120, 20); - this.doubleTextBox.TabIndex = 20; - // - // floatLabel - // - this.floatLabel.AutoSize = true; - this.floatLabel.Location = new System.Drawing.Point(6, 269); - this.floatLabel.Name = "floatLabel"; - this.floatLabel.Size = new System.Drawing.Size(33, 13); - this.floatLabel.TabIndex = 19; - this.floatLabel.Text = "Float:"; - // - // floatTextBox - // - this.floatTextBox.Location = new System.Drawing.Point(98, 266); - this.floatTextBox.Name = "floatTextBox"; - this.floatTextBox.Size = new System.Drawing.Size(120, 20); - this.floatTextBox.TabIndex = 18; - // - // uint64Label - // - this.uint64Label.AutoSize = true; - this.uint64Label.Location = new System.Drawing.Point(6, 243); - this.uint64Label.Name = "uint64Label"; - this.uint64Label.Size = new System.Drawing.Size(42, 13); - this.uint64Label.TabIndex = 17; - this.uint64Label.Text = "UInt64:"; - // - // uint64TextBox - // - this.uint64TextBox.Location = new System.Drawing.Point(98, 240); - this.uint64TextBox.Name = "uint64TextBox"; - this.uint64TextBox.Size = new System.Drawing.Size(120, 20); - this.uint64TextBox.TabIndex = 16; - // - // uint32Label - // - this.uint32Label.AutoSize = true; - this.uint32Label.Location = new System.Drawing.Point(6, 217); - this.uint32Label.Name = "uint32Label"; - this.uint32Label.Size = new System.Drawing.Size(42, 13); - this.uint32Label.TabIndex = 15; - this.uint32Label.Text = "UInt32:"; - // - // uint32TextBox - // - this.uint32TextBox.Location = new System.Drawing.Point(98, 214); - this.uint32TextBox.Name = "uint32TextBox"; - this.uint32TextBox.Size = new System.Drawing.Size(120, 20); - this.uint32TextBox.TabIndex = 14; - // - // uint16Label - // - this.uint16Label.AutoSize = true; - this.uint16Label.Location = new System.Drawing.Point(6, 191); - this.uint16Label.Name = "uint16Label"; - this.uint16Label.Size = new System.Drawing.Size(42, 13); - this.uint16Label.TabIndex = 13; - this.uint16Label.Text = "UInt16:"; - // - // uint16TextBox - // - this.uint16TextBox.Location = new System.Drawing.Point(98, 188); - this.uint16TextBox.Name = "uint16TextBox"; - this.uint16TextBox.Size = new System.Drawing.Size(120, 20); - this.uint16TextBox.TabIndex = 12; - // - // uint8Label - // - this.uint8Label.AutoSize = true; - this.uint8Label.Location = new System.Drawing.Point(6, 165); - this.uint8Label.Name = "uint8Label"; - this.uint8Label.Size = new System.Drawing.Size(36, 13); - this.uint8Label.TabIndex = 11; - this.uint8Label.Text = "UInt8:"; - // - // uint8TextBox - // - this.uint8TextBox.Location = new System.Drawing.Point(98, 162); - this.uint8TextBox.Name = "uint8TextBox"; - this.uint8TextBox.Size = new System.Drawing.Size(120, 20); - this.uint8TextBox.TabIndex = 10; - // - // int64Label - // - this.int64Label.AutoSize = true; - this.int64Label.Location = new System.Drawing.Point(6, 139); - this.int64Label.Name = "int64Label"; - this.int64Label.Size = new System.Drawing.Size(34, 13); - this.int64Label.TabIndex = 9; - this.int64Label.Text = "Int64:"; - // - // int64TextBox - // - this.int64TextBox.Location = new System.Drawing.Point(98, 136); - this.int64TextBox.Name = "int64TextBox"; - this.int64TextBox.Size = new System.Drawing.Size(120, 20); - this.int64TextBox.TabIndex = 8; - // - // int32Label - // - this.int32Label.AutoSize = true; - this.int32Label.Location = new System.Drawing.Point(6, 113); - this.int32Label.Name = "int32Label"; - this.int32Label.Size = new System.Drawing.Size(34, 13); - this.int32Label.TabIndex = 7; - this.int32Label.Text = "Int32:"; - // - // int32TextBox - // - this.int32TextBox.Location = new System.Drawing.Point(98, 110); - this.int32TextBox.Name = "int32TextBox"; - this.int32TextBox.Size = new System.Drawing.Size(120, 20); - this.int32TextBox.TabIndex = 6; - // - // int16Label - // - this.int16Label.AutoSize = true; - this.int16Label.Location = new System.Drawing.Point(6, 87); - this.int16Label.Name = "int16Label"; - this.int16Label.Size = new System.Drawing.Size(34, 13); - this.int16Label.TabIndex = 5; - this.int16Label.Text = "Int16:"; - // - // int16TextBox - // - this.int16TextBox.Location = new System.Drawing.Point(98, 84); - this.int16TextBox.Name = "int16TextBox"; - this.int16TextBox.Size = new System.Drawing.Size(120, 20); - this.int16TextBox.TabIndex = 4; - // - // int8Label - // - this.int8Label.AutoSize = true; - this.int8Label.Location = new System.Drawing.Point(6, 61); - this.int8Label.Name = "int8Label"; - this.int8Label.Size = new System.Drawing.Size(28, 13); - this.int8Label.TabIndex = 3; - this.int8Label.Text = "Int8:"; - // - // int8TextBox - // - this.int8TextBox.Location = new System.Drawing.Point(98, 58); - this.int8TextBox.Name = "int8TextBox"; - this.int8TextBox.Size = new System.Drawing.Size(120, 20); - this.int8TextBox.TabIndex = 2; - // - // paddingLabel - // - this.paddingLabel.AutoSize = true; - this.paddingLabel.Location = new System.Drawing.Point(6, 35); - this.paddingLabel.Name = "paddingLabel"; - this.paddingLabel.Size = new System.Drawing.Size(49, 13); - this.paddingLabel.TabIndex = 1; - this.paddingLabel.Text = "Padding:"; - // - // paddingTextBox - // - this.paddingTextBox.Location = new System.Drawing.Point(98, 32); - this.paddingTextBox.Name = "paddingTextBox"; - this.paddingTextBox.Size = new System.Drawing.Size(120, 20); - this.paddingTextBox.TabIndex = 0; - // - // bannerBox - // - this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; - this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B32x32_Cogs; - this.bannerBox.Location = new System.Drawing.Point(0, 0); - this.bannerBox.Name = "bannerBox"; - this.bannerBox.Size = new System.Drawing.Size(586, 48); - this.bannerBox.TabIndex = 2; - this.bannerBox.Text = "Configure the global settings."; - this.bannerBox.Title = "Settings"; - // - // SettingsForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(586, 427); - this.Controls.Add(this.bannerBox); - this.Controls.Add(this.settingsTabControl); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "SettingsForm"; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "ReClass.NET - Settings"; - this.settingsTabControl.ResumeLayout(false); - this.generalSettingsTabPage.ResumeLayout(false); - this.generalSettingsTabPage.PerformLayout(); - this.commentsGroupBox.ResumeLayout(false); - this.commentsGroupBox.PerformLayout(); - this.displayGroupBox.ResumeLayout(false); - this.displayGroupBox.PerformLayout(); - this.colorsSettingTabPage.ResumeLayout(false); - this.colorsSettingTabPage.PerformLayout(); - this.nodeColorGroupBox.ResumeLayout(false); - this.nodeColorGroupBox.PerformLayout(); - this.typeDefinitionsSettingsTabPage.ResumeLayout(false); - this.typeDefinitionsSettingsTabPage.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - private System.Windows.Forms.TabControl settingsTabControl; - private System.Windows.Forms.TabPage generalSettingsTabPage; - private System.Windows.Forms.TabPage colorsSettingTabPage; - private System.Windows.Forms.TabPage typeDefinitionsSettingsTabPage; - private ReClassNET.UI.SettingsCheckBox stayOnTopCheckBox; - private System.Windows.Forms.GroupBox displayGroupBox; - private ReClassNET.UI.SettingsCheckBox showNodeAddressCheckBox; - private ReClassNET.UI.SettingsCheckBox showTextCheckBox; - private ReClassNET.UI.SettingsCheckBox showNodeOffsetCheckBox; - private ReClassNET.UI.SettingsCheckBox highlightChangedValuesCheckBox; - private System.Windows.Forms.GroupBox commentsGroupBox; - private ReClassNET.UI.SettingsCheckBox showRttiCheckBox; - private ReClassNET.UI.SettingsCheckBox showPointerCheckBox; - private ReClassNET.UI.SettingsCheckBox showIntegerCheckBox; - private ReClassNET.UI.SettingsCheckBox showFloatCheckBox; - private ReClassNET.UI.SettingsCheckBox showPluginInfoCheckBox; - private ReClassNET.UI.SettingsCheckBox showStringCheckBox; - private ReClassNET.UI.SettingsCheckBox showSymbolsCheckBox; - private UI.ColorBox backgroundColorBox; - private System.Windows.Forms.Label nodeSelectedLabel; - private UI.ColorBox nodeSelectedColorBox; - private System.Windows.Forms.Label nodeHiddenLabel; - private UI.ColorBox nodeHiddenColorBox; - private System.Windows.Forms.Label nodeAddressLabel; - private UI.ColorBox nodeAddressColorBox; - private System.Windows.Forms.Label nodeOffsetLabel; - private UI.ColorBox nodeOffsetColorBox; - private System.Windows.Forms.Label nodeHexValueLabel; - private UI.ColorBox nodeHexValueColorBox; - private System.Windows.Forms.Label backgroundLabel; - private System.Windows.Forms.Label nodeValueLabel; - private UI.ColorBox nodeValueColorBox; - private System.Windows.Forms.Label nodeNameLabel; - private UI.ColorBox nodeNameColorBox; - private System.Windows.Forms.Label nodeTypeLabel; - private UI.ColorBox nodeTypeColorBox; - private System.Windows.Forms.Label nodeVTableLabel; - private UI.ColorBox nodeVTableColorBox; - private System.Windows.Forms.Label nodeTextLabel; - private UI.ColorBox nodeTextColorBox; - private System.Windows.Forms.Label nodeCommentLabel; - private UI.ColorBox nodeCommentColorBox; - private System.Windows.Forms.Label nodeIndexLabel; - private UI.ColorBox nodeIndexColorBox; - private System.Windows.Forms.Label nodePluginLabel; - private UI.ColorBox nodePluginColorBox; - private System.Windows.Forms.Label floatLabel; - private UI.SettingsTextBox floatTextBox; - private System.Windows.Forms.Label uint64Label; - private UI.SettingsTextBox uint64TextBox; - private System.Windows.Forms.Label uint32Label; - private UI.SettingsTextBox uint32TextBox; - private System.Windows.Forms.Label uint16Label; - private UI.SettingsTextBox uint16TextBox; - private System.Windows.Forms.Label uint8Label; - private UI.SettingsTextBox uint8TextBox; - private System.Windows.Forms.Label int64Label; - private UI.SettingsTextBox int64TextBox; - private System.Windows.Forms.Label int32Label; - private UI.SettingsTextBox int32TextBox; - private System.Windows.Forms.Label int16Label; - private UI.SettingsTextBox int16TextBox; - private System.Windows.Forms.Label int8Label; - private UI.SettingsTextBox int8TextBox; - private System.Windows.Forms.Label paddingLabel; - private UI.SettingsTextBox paddingTextBox; - private System.Windows.Forms.Label functionPtrLabel; - private UI.SettingsTextBox functionPtrTextBox; - private System.Windows.Forms.Label utf16TextPtrLabel; - private UI.SettingsTextBox utf16TextPtrTextBox; - private System.Windows.Forms.Label utf16TextLabel; - private UI.SettingsTextBox utf16TextTextBox; - private System.Windows.Forms.Label utf8TextPtrLabel; - private UI.SettingsTextBox utf8TextPtrTextBox; - private System.Windows.Forms.Label utf8TextLabel; - private UI.SettingsTextBox utf8TextTextBox; - private System.Windows.Forms.Label matrix3x3Label; - private UI.SettingsTextBox matrix3x3TextBox; - private System.Windows.Forms.Label matrix3x4Label; - private UI.SettingsTextBox matrix3x4TextBox; - private System.Windows.Forms.Label matrix4x4Label; - private UI.SettingsTextBox matrix4x4TextBox; - private System.Windows.Forms.Label vector2Label; - private UI.SettingsTextBox vector2TextBox; - private System.Windows.Forms.Label vector3Label; - private UI.SettingsTextBox vector3TextBox; - private System.Windows.Forms.Label vector4Label; - private UI.SettingsTextBox vector4TextBox; - private System.Windows.Forms.Label doubleLabel; - private UI.SettingsTextBox doubleTextBox; - private System.Windows.Forms.GroupBox nodeColorGroupBox; - private System.Windows.Forms.Label label1; - private UI.BannerBox bannerBox; - } -} \ No newline at end of file diff --git a/Forms/SettingsForm.cs b/Forms/SettingsForm.cs deleted file mode 100644 index 55077e23..00000000 --- a/Forms/SettingsForm.cs +++ /dev/null @@ -1,172 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using System.Windows.Forms; -using ReClassNET.UI; -using ReClassNET.Util; - -namespace ReClassNET.Forms -{ - public partial class SettingsForm : IconForm - { - private readonly Settings settings; - - public SettingsForm(Settings settings) - { - Contract.Requires(settings != null); - - this.settings = settings; - - InitializeComponent(); - - var imageList = new ImageList(); - imageList.Images.Add(Properties.Resources.B16x16_Gear); - imageList.Images.Add(Properties.Resources.B16x16_Color_Wheel); - imageList.Images.Add(Properties.Resources.B16x16_Settings_Edit); - - settingsTabControl.ImageList = imageList; - generalSettingsTabPage.ImageIndex = 0; - colorsSettingTabPage.ImageIndex = 1; - typeDefinitionsSettingsTabPage.ImageIndex = 2; - - backgroundColorBox.Color = System.Drawing.Color.Red; - - SetBindings(); - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - GlobalWindowManager.AddWindow(this); - } - - protected override void OnFormClosed(FormClosedEventArgs e) - { - base.OnFormClosed(e); - - GlobalWindowManager.RemoveWindow(this); - } - - private void SetBindings() - { - SetGeneralBindings(); - SetColorBindings(); - SetTypedefinitionBindings(); - } - - private void SetGeneralBindings() - { - stayOnTopCheckBox.Source = settings; - stayOnTopCheckBox.SettingName = nameof(Settings.StayOnTop); - stayOnTopCheckBox.CheckedChanged += (sender, e) => - { - GlobalWindowManager.Windows.ForEach(w => w.TopMost = stayOnTopCheckBox.Checked); - }; - - showNodeAddressCheckBox.Source = settings; - showNodeAddressCheckBox.SettingName = nameof(Settings.ShowNodeAddress); - showNodeOffsetCheckBox.Source = settings; - showNodeOffsetCheckBox.SettingName = nameof(Settings.ShowNodeOffset); - showTextCheckBox.Source = settings; - showTextCheckBox.SettingName = nameof(Settings.ShowNodeText); - highlightChangedValuesCheckBox.Source = settings; - highlightChangedValuesCheckBox.SettingName = nameof(Settings.HighlightChangedValues); - - showFloatCheckBox.Source = settings; - showFloatCheckBox.SettingName = nameof(Settings.ShowCommentFloat); - showIntegerCheckBox.Source = settings; - showIntegerCheckBox.SettingName = nameof(Settings.ShowCommentInteger); - showPointerCheckBox.Source = settings; - showPointerCheckBox.SettingName = nameof(Settings.ShowCommentPointer); - showRttiCheckBox.Source = settings; - showRttiCheckBox.SettingName = nameof(Settings.ShowCommentRtti); - showSymbolsCheckBox.Source = settings; - showSymbolsCheckBox.SettingName = nameof(Settings.ShowCommentSymbol); - showStringCheckBox.Source = settings; - showStringCheckBox.SettingName = nameof(Settings.ShowCommentString); - showPluginInfoCheckBox.Source = settings; - showPluginInfoCheckBox.SettingName = nameof(Settings.ShowCommentPluginInfo); - } - - private void SetColorBindings() - { - backgroundColorBox.Source = settings; - backgroundColorBox.SettingName = nameof(Settings.BackgroundColor); - - nodeSelectedColorBox.Source = settings; - nodeSelectedColorBox.SettingName = nameof(Settings.SelectedColor); - nodeHiddenColorBox.Source = settings; - nodeHiddenColorBox.SettingName = nameof(Settings.HiddenColor); - nodeAddressColorBox.Source = settings; - nodeAddressColorBox.SettingName = nameof(Settings.AddressColor); - nodeOffsetColorBox.Source = settings; - nodeOffsetColorBox.SettingName = nameof(Settings.OffsetColor); - nodeHexValueColorBox.Source = settings; - nodeHexValueColorBox.SettingName = nameof(Settings.HexColor); - nodeTypeColorBox.Source = settings; - nodeTypeColorBox.SettingName = nameof(Settings.TypeColor); - nodeNameColorBox.Source = settings; - nodeNameColorBox.SettingName = nameof(Settings.NameColor); - nodeValueColorBox.Source = settings; - nodeValueColorBox.SettingName = nameof(Settings.ValueColor); - nodeIndexColorBox.Source = settings; - nodeIndexColorBox.SettingName = nameof(Settings.IndexColor); - nodeVTableColorBox.Source = settings; - nodeVTableColorBox.SettingName = nameof(Settings.VTableColor); - nodeCommentColorBox.Source = settings; - nodeCommentColorBox.SettingName = nameof(Settings.CommentColor); - nodeTextColorBox.Source = settings; - nodeTextColorBox.SettingName = nameof(Settings.TextColor); - nodePluginColorBox.Source = settings; - nodePluginColorBox.SettingName = nameof(Settings.PluginColor); - } - - private void SetTypedefinitionBindings() - { - paddingTextBox.Source = settings; - paddingTextBox.SettingName = nameof(Settings.TypePadding); - int8TextBox.Source = settings; - int8TextBox.SettingName = nameof(Settings.TypeInt8); - int16TextBox.Source = settings; - int16TextBox.SettingName = nameof(Settings.TypeInt16); - int32TextBox.Source = settings; - int32TextBox.SettingName = nameof(Settings.TypeInt32); - int64TextBox.Source = settings; - int64TextBox.SettingName = nameof(Settings.TypeInt64); - uint8TextBox.Source = settings; - uint8TextBox.SettingName = nameof(Settings.TypeUInt8); - uint16TextBox.Source = settings; - uint16TextBox.SettingName = nameof(Settings.TypeUInt16); - uint32TextBox.Source = settings; - uint32TextBox.SettingName = nameof(Settings.TypeUInt32); - uint64TextBox.Source = settings; - uint64TextBox.SettingName = nameof(Settings.TypeUInt64); - floatTextBox.Source = settings; - floatTextBox.SettingName = nameof(Settings.TypeFloat); - doubleTextBox.Source = settings; - doubleTextBox.SettingName = nameof(Settings.TypeDouble); - vector2TextBox.Source = settings; - vector2TextBox.SettingName = nameof(Settings.TypeVector2); - vector3TextBox.Source = settings; - vector3TextBox.SettingName = nameof(Settings.TypeVector3); - vector4TextBox.Source = settings; - vector4TextBox.SettingName = nameof(Settings.TypeVector4); - matrix3x3TextBox.Source = settings; - matrix3x3TextBox.SettingName = nameof(Settings.TypeMatrix3x3); - matrix3x4TextBox.Source = settings; - matrix3x4TextBox.SettingName = nameof(Settings.TypeMatrix3x4); - matrix4x4TextBox.Source = settings; - matrix4x4TextBox.SettingName = nameof(Settings.TypeMatrix4x4); - utf8TextTextBox.Source = settings; - utf8TextTextBox.SettingName = nameof(Settings.TypeUTF8Text); - utf8TextPtrTextBox.Source = settings; - utf8TextPtrTextBox.SettingName = nameof(Settings.TypeUTF8TextPtr); - utf16TextTextBox.Source = settings; - utf16TextTextBox.SettingName = nameof(Settings.TypeUTF16Text); - utf16TextPtrTextBox.Source = settings; - utf16TextPtrTextBox.SettingName = nameof(Settings.TypeUTF16TextPtr); - functionPtrTextBox.Source = settings; - functionPtrTextBox.SettingName = nameof(Settings.TypeFunctionPtr); - } - } -} diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..750027d5 --- /dev/null +++ b/Makefile @@ -0,0 +1,77 @@ +.PHONY: all clean debug clean_debug release clean_release update docker_all docker_debug docker_release podman_all podman_debug podman_release dist + +all: debug release dist + +clean: clean_debug clean_release + +debug: + cd ReClass.NET_Launcher && make debug + cd ReClass.NET && make debug + cd NativeCore/Unix && make debug + +clean_debug: + cd ReClass.NET_Launcher && make clean_debug + cd ReClass.NET && make clean_debug + cd NativeCore/Unix && make clean_debug + rm -rf build/Debug + +release: + cd ReClass.NET_Launcher && make release + cd ReClass.NET && make release + cd NativeCore/Unix && make release + +clean_release: + cd ReClass.NET_Launcher && make clean_release + cd ReClass.NET && make clean_release + cd NativeCore/Unix && make clean_release + rm -rf build/Release + +update: + cd ReClass.NET && make update + +docker_all: + make docker_debug + make docker_release + make dist + +docker_debug: + cd ReClass.NET_Launcher && make docker_debug + cd ReClass.NET && make docker_debug + docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) gcc_multilib:latest bash -c "cd NativeCore/Unix && make debug" + +docker_release: + cd ReClass.NET_Launcher && make docker_release + cd ReClass.NET && make docker_release + docker container run --rm -v ${PWD}:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) gcc_multilib:latest bash -c "cd NativeCore/Unix && make release" + +podman_all: + make podman_debug + make podman_release + make dist + +podman_debug: + cd ReClass.NET_Launcher && make podman_debug + cd ReClass.NET && make podman_debug + podman container run --rm -v ${PWD}:/build:z -w /build gcc_multilib:latest bash -c "cd NativeCore/Unix && make debug" + +podman_release: + cd ReClass.NET_Launcher && make podman_release + cd ReClass.NET && make podman_release + podman container run --rm -v ${PWD}:/build:z -w /build gcc_multilib:latest bash -c "cd NativeCore/Unix && make release" + +dist: + test -d build || mkdir -p build + cp -r ReClass.NET/bin/* build/ + cp -r ReClass.NET_Launcher/bin/* build/ + cp NativeCore/Unix/build/debug/x86/NativeCore.so build/Debug/x86 + cp NativeCore/Unix/build/debug/x64/NativeCore.so build/Debug/x64 + cp NativeCore/Unix/build/release/x86/NativeCore.so build/Release/x86 + cp NativeCore/Unix/build/release/x64/NativeCore.so build/Release/x64 + test -d build/Debug/x86/Plugins || mkdir build/Debug/x86/Plugins + test -d build/Debug/x64/Plugins || mkdir build/Debug/x64/Plugins + test -d build/Release/x86/Plugins || mkdir build/Release/x86/Plugins + test -d build/Release/x64/Plugins || mkdir build/Release/x64/Plugins + test -d build/Debug/x86 && cp -r Dependencies/x86/* build/Debug/x86 + test -d build/Debug/x64 && cp -r Dependencies/x64/* build/Debug/x64 + test -d build/Release/x86 && cp -r Dependencies/x86/* build/Release/x86 + test -d build/Release/x64 && cp -r Dependencies/x64/* build/Release/x64 diff --git a/Memory/Memory.cs b/Memory/Memory.cs deleted file mode 100644 index ae63155a..00000000 --- a/Memory/Memory.cs +++ /dev/null @@ -1,192 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using System.Runtime.InteropServices; -using System.Text; -using ReClassNET.Util; - -namespace ReClassNET.Memory -{ - public class MemoryBuffer - { - public RemoteProcess Process { get; set; } - - private byte[] data = new byte[0]; - - public int Size - { - get - { - return data.Length; - } - set - { - if (value != data.Length) - { - data = new byte[value]; - } - } - } - - public int Offset { get; set; } - - public MemoryBuffer() - { - Contract.Ensures(data != null); - - data = new byte[0]; - } - - public MemoryBuffer(MemoryBuffer other) - { - Contract.Requires(other != null); - Contract.Ensures(data != null); - - data = other.data; - } - - public MemoryBuffer Clone() - { - Contract.Ensures(Contract.Result() != null); - - return new MemoryBuffer(this) - { - Offset = Offset, - Process = Process - }; - } - - public void Update(IntPtr address) - { - Process.ReadRemoteMemoryIntoBuffer(address, ref data); - } - - public byte ReadByte(IntPtr offset) - { - return ReadByte(offset.ToInt32()); - } - - public byte ReadByte(int offset) - { - Contract.Requires(offset >= 0); - - if (Offset + offset > data.Length) - { - return 0; - } - - return data[Offset + offset]; - } - - public byte[] ReadBytes(int offset, int length) - { - Contract.Requires(offset >= 0); - Contract.Requires(length >= 0); - - var bytes = new byte[length]; - - if (Offset + offset + length > data.Length) - { - return bytes; - } - - Array.Copy(data, Offset + offset, bytes, 0, length); - return bytes; - } - - public T ReadObject(IntPtr offset) where T : struct - { - return ReadObject(offset.ToInt32()); - } - - public T ReadObject(int offset) where T : struct - { - Contract.Requires(offset >= 0); - - if (Offset + offset + Marshal.SizeOf(typeof(T)) > data.Length) - { - return default(T); - } - - var handle = GCHandle.Alloc(data, GCHandleType.Pinned); - var obj = (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject() + Offset + offset, typeof(T)); - handle.Free(); - - return obj; - } - - public string ReadPrintableASCIIString(IntPtr offset, int length) - { - Contract.Requires(length >= 0); - Contract.Ensures(Contract.Result() != null); - - return ReadPrintableASCIIString(offset.ToInt32(), length); - } - - public string ReadPrintableASCIIString(int offset, int length) - { - Contract.Requires(offset >= 0); - Contract.Requires(length >= 0); - Contract.Ensures(Contract.Result() != null); - - if (Offset + offset + length > data.Length) - { - length = data.Length - Offset - offset; - } - - var sb = new StringBuilder(length); - for (var i = 0; i < length; ++i) - { - var c = (char)data[Offset + offset + i]; - sb.Append(c.IsPrintable() ? c : '.'); - } - return sb.ToString(); - } - - private string ReadString(Encoding encoding, int offset, int length) - { - Contract.Requires(encoding != null); - Contract.Requires(offset >= 0); - Contract.Requires(length >= 0); - Contract.Ensures(Contract.Result() != null); - - if (Offset + offset + length > data.Length) - { - length = data.Length - Offset - offset; - } - - var sb = new StringBuilder(encoding.GetString(data, offset, length)); - for (var i = 0; i < sb.Length; ++i) - { - if (!sb[i].IsPrintable()) - { - sb[i] = '.'; - } - } - return sb.ToString(); - } - - public string ReadUTF8String(IntPtr offset, int length) - { - Contract.Requires(length >= 0); - Contract.Ensures(Contract.Result() != null); - - return ReadString(Encoding.UTF8, offset.ToInt32(), length); - } - - public string ReadUTF16String(IntPtr offset, int length) - { - Contract.Requires(length >= 0); - Contract.Ensures(Contract.Result() != null); - - return ReadString(Encoding.Unicode, offset.ToInt32(), length); - } - - public string ReadUTF32String(IntPtr offset, int length) - { - Contract.Requires(length >= 0); - Contract.Ensures(Contract.Result() != null); - - return ReadString(Encoding.UTF32, offset.ToInt32(), length); - } - } -} diff --git a/Memory/NativeHelper.cs b/Memory/NativeHelper.cs deleted file mode 100644 index 7e2d1db4..00000000 --- a/Memory/NativeHelper.cs +++ /dev/null @@ -1,357 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.Linq; -using System.Runtime.InteropServices; -using ReClassNET.Util; - -namespace ReClassNET.Memory -{ - public class NativeHelper : IDisposable - { - private const string NativeHelperDll = "NativeHelper.dll"; - - public enum RequestFunction - { - IsProcessValid, - OpenRemoteProcess, - CloseRemoteProcess, - ReadRemoteMemory, - WriteRemoteMemory, - EnumerateProcesses, - EnumerateRemoteSectionsAndModules, - DisassembleRemoteCode, - ControlRemoteProcess - } - - public class MethodInfo - { - public RequestFunction Method { get; set; } - public string Provider { get; set; } - public IntPtr FunctionPtr { get; set; } - - public T GetDelegate() - { - return Marshal.GetDelegateForFunctionPointer(FunctionPtr); - } - } - - private IntPtr nativeHelperHandle; - - private readonly Dictionary> methodRegistry = new Dictionary>(); - - public IReadOnlyDictionary> MethodRegistry => methodRegistry; - - #region Delegates - - public delegate IntPtr RequestFunctionPtrCallback(RequestFunction request); - private delegate void InitializeDelegate(RequestFunctionPtrCallback requestCallback); - - //private delegate int GetLastErrorDelegate(); - - private delegate bool IsProcessValidDelegate(IntPtr process); - - private delegate IntPtr OpenRemoteProcessDelegate(int pid, int desiredAccess); - - private delegate void CloseRemoteProcessDelegate(IntPtr process); - - private delegate bool ReadRemoteMemoryDelegate(IntPtr process, IntPtr address, IntPtr buffer, uint size); - - private delegate bool WriteRemoteMemoryDelegate(IntPtr process, IntPtr address, IntPtr buffer, uint size); - - public delegate void EnumerateProcessCallback(uint pid, [MarshalAs(UnmanagedType.LPWStr)]string modulePath); - private delegate void EnumerateProcessesDelegate(EnumerateProcessCallback callbackProcess); - - public delegate void EnumerateRemoteSectionCallback(IntPtr baseAddress, IntPtr regionSize, [MarshalAs(UnmanagedType.LPStr)]string name, NativeMethods.StateEnum state, NativeMethods.AllocationProtectEnum protection, NativeMethods.TypeEnum type, [MarshalAs(UnmanagedType.LPWStr)]string modulePath); - public delegate void EnumerateRemoteModuleCallback(IntPtr baseAddress, IntPtr regionSize, [MarshalAs(UnmanagedType.LPWStr)]string modulePath); - private delegate void EnumerateRemoteSectionsAndModulesDelegate(IntPtr process, EnumerateRemoteSectionCallback callbackSection, EnumerateRemoteModuleCallback callbackModule); - - public delegate void DisassembleRemoteCodeCallback(IntPtr address, int length, [MarshalAs(UnmanagedType.LPStr)]string instruction); - private delegate void DisassembleRemoteCodeDelegate(IntPtr process, IntPtr address, int length, DisassembleRemoteCodeCallback callbackDisassembledCode); - - public enum ControlRemoteProcessAction - { - Suspend, - Resume, - Terminate - } - private delegate void ControlRemoteProcessDelegate(IntPtr process, ControlRemoteProcessAction action); - - #endregion - - private IntPtr fnIsProcessValid; - private IsProcessValidDelegate isProcessValidDelegate; - private IntPtr fnOpenRemoteProcess; - private OpenRemoteProcessDelegate openRemoteProcessDelegate; - private IntPtr fnCloseRemoteProcess; - private CloseRemoteProcessDelegate closeRemoteProcessDelegate; - private IntPtr fnReadRemoteMemory; - private ReadRemoteMemoryDelegate readRemoteMemoryDelegate; - private IntPtr fnWriteRemoteMemory; - private WriteRemoteMemoryDelegate writeRemoteMemoryDelegate; - private IntPtr fnEnumerateProcesses; - private EnumerateProcessesDelegate enumerateProcessesDelegate; - private IntPtr fnEnumerateRemoteSectionsAndModules; - private EnumerateRemoteSectionsAndModulesDelegate enumerateRemoteSectionsAndModulesDelegate; - private IntPtr fnDisassembleRemoteCode; - private DisassembleRemoteCodeDelegate disassembleRemoteCodeDelegate; - private IntPtr fnControlRemoteProcess; - private ControlRemoteProcessDelegate controlRemoteProcessDelegate; - - private readonly RequestFunctionPtrCallback requestFunctionPtrReference; - - private bool disposedValue = false; - - public NativeHelper() - { - requestFunctionPtrReference = RequestFunctionPtr; - - nativeHelperHandle = NativeMethods.LoadLibrary(NativeHelperDll); - if (nativeHelperHandle.IsNull()) - { - throw new Exception(); - } - - InintializeNativeModule(nativeHelperHandle); - - RegisterProvidedNativeMethods(nativeHelperHandle, "Default"); - - SetActiveNativeMethod(methodRegistry[RequestFunction.IsProcessValid].First()); - SetActiveNativeMethod(methodRegistry[RequestFunction.OpenRemoteProcess].First()); - SetActiveNativeMethod(methodRegistry[RequestFunction.CloseRemoteProcess].First()); - SetActiveNativeMethod(methodRegistry[RequestFunction.ReadRemoteMemory].First()); - SetActiveNativeMethod(methodRegistry[RequestFunction.WriteRemoteMemory].First()); - SetActiveNativeMethod(methodRegistry[RequestFunction.EnumerateProcesses].First()); - SetActiveNativeMethod(methodRegistry[RequestFunction.EnumerateRemoteSectionsAndModules].First()); - SetActiveNativeMethod(methodRegistry[RequestFunction.DisassembleRemoteCode].First()); - SetActiveNativeMethod(methodRegistry[RequestFunction.ControlRemoteProcess].First()); - } - - #region IDisposable Support - - ~NativeHelper() - { - Dispose(false); - } - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) - { - - } - - if (!nativeHelperHandle.IsNull()) - { - NativeMethods.FreeLibrary(nativeHelperHandle); - - nativeHelperHandle = IntPtr.Zero; - } - - disposedValue = true; - } - } - - public void Dispose() - { - Dispose(true); - - GC.SuppressFinalize(this); - } - - #endregion - - public void InintializeNativeModule(IntPtr module) - { - Contract.Requires(!module.IsNull()); - - var fnInitialize = NativeMethods.GetProcAddress(module, "Initialize"); - if (fnInitialize.IsNull()) - { - throw new Exception(); - } - - var initializeDelegate = Marshal.GetDelegateForFunctionPointer(fnInitialize); - initializeDelegate(requestFunctionPtrReference); - } - - #region Registry - - public void RegisterProvidedNativeMethods(IntPtr module, string provider) - { - Contract.Requires(provider != null); - - foreach (var method in new RequestFunction[] - { - RequestFunction.IsProcessValid, - RequestFunction.OpenRemoteProcess, - RequestFunction.CloseRemoteProcess, - RequestFunction.ReadRemoteMemory, - RequestFunction.WriteRemoteMemory, - RequestFunction.EnumerateProcesses, - RequestFunction.EnumerateRemoteSectionsAndModules, - RequestFunction.DisassembleRemoteCode, - RequestFunction.ControlRemoteProcess - }) - { - var functionPtr = NativeMethods.GetProcAddress(module, method.ToString()); - if (!functionPtr.IsNull()) - { - RegisterMethod(method, new MethodInfo { Method = method, Provider = provider, FunctionPtr = functionPtr }); - } - } - } - - private void RegisterMethod(RequestFunction method, MethodInfo methodInfo) - { - Contract.Requires(methodInfo != null); - - List infos; - if (!methodRegistry.TryGetValue(method, out infos)) - { - infos = new List(); - - methodRegistry.Add(method, infos); - } - - infos.Add(methodInfo); - } - - public void SetActiveNativeMethod(MethodInfo methodInfo) - { - Contract.Requires(methodInfo != null); - - switch (methodInfo.Method) - { - case RequestFunction.EnumerateProcesses: - fnEnumerateProcesses = methodInfo.FunctionPtr; - enumerateProcessesDelegate = Marshal.GetDelegateForFunctionPointer(fnEnumerateProcesses); - break; - case RequestFunction.EnumerateRemoteSectionsAndModules: - fnEnumerateRemoteSectionsAndModules = methodInfo.FunctionPtr; - enumerateRemoteSectionsAndModulesDelegate = Marshal.GetDelegateForFunctionPointer(fnEnumerateRemoteSectionsAndModules); - break; - case RequestFunction.IsProcessValid: - fnIsProcessValid = methodInfo.FunctionPtr; - isProcessValidDelegate = Marshal.GetDelegateForFunctionPointer(fnIsProcessValid); - break; - case RequestFunction.OpenRemoteProcess: - fnOpenRemoteProcess = methodInfo.FunctionPtr; - openRemoteProcessDelegate = Marshal.GetDelegateForFunctionPointer(fnOpenRemoteProcess); - break; - case RequestFunction.CloseRemoteProcess: - fnCloseRemoteProcess = methodInfo.FunctionPtr; - closeRemoteProcessDelegate = Marshal.GetDelegateForFunctionPointer(fnCloseRemoteProcess); - break; - case RequestFunction.ReadRemoteMemory: - fnReadRemoteMemory = methodInfo.FunctionPtr; - readRemoteMemoryDelegate = Marshal.GetDelegateForFunctionPointer(fnReadRemoteMemory); - break; - case RequestFunction.WriteRemoteMemory: - fnWriteRemoteMemory = methodInfo.FunctionPtr; - writeRemoteMemoryDelegate = Marshal.GetDelegateForFunctionPointer(fnWriteRemoteMemory); - break; - case RequestFunction.DisassembleRemoteCode: - fnDisassembleRemoteCode = methodInfo.FunctionPtr; - disassembleRemoteCodeDelegate = Marshal.GetDelegateForFunctionPointer(fnDisassembleRemoteCode); - break; - case RequestFunction.ControlRemoteProcess: - fnControlRemoteProcess = methodInfo.FunctionPtr; - controlRemoteProcessDelegate = Marshal.GetDelegateForFunctionPointer(fnControlRemoteProcess); - break; - } - } - - #endregion - - public IntPtr RequestFunctionPtr(RequestFunction request) - { - switch (request) - { - case RequestFunction.IsProcessValid: - return fnIsProcessValid; - case RequestFunction.OpenRemoteProcess: - return fnOpenRemoteProcess; - case RequestFunction.CloseRemoteProcess: - return fnCloseRemoteProcess; - case RequestFunction.ReadRemoteMemory: - return fnReadRemoteMemory; - case RequestFunction.WriteRemoteMemory: - return fnWriteRemoteMemory; - case RequestFunction.EnumerateProcesses: - return fnEnumerateProcesses; - case RequestFunction.EnumerateRemoteSectionsAndModules: - return fnEnumerateRemoteSectionsAndModules; - case RequestFunction.DisassembleRemoteCode: - return fnDisassembleRemoteCode; - case RequestFunction.ControlRemoteProcess: - return fnControlRemoteProcess; - } - - throw new ArgumentException(nameof(request)); - } - - #region Delegate Wrapper - - public bool IsProcessValid(IntPtr process) - { - return isProcessValidDelegate(process); - } - - public IntPtr OpenRemoteProcess(int pid, int desiredAccess) - { - return openRemoteProcessDelegate(pid, desiredAccess); - } - - public void CloseRemoteProcess(IntPtr process) - { - closeRemoteProcessDelegate(process); - } - - public bool ReadRemoteMemory(IntPtr process, IntPtr address, byte[] buffer, uint size) - { - Contract.Requires(buffer != null); - - GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - var result = readRemoteMemoryDelegate(process, address, handle.AddrOfPinnedObject(), size); - handle.Free(); - - return result; - } - - public bool WriteRemoteMemory(IntPtr process, IntPtr address, byte[] buffer, uint size) - { - Contract.Requires(buffer != null); - - GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - var result = writeRemoteMemoryDelegate(process, address, handle.AddrOfPinnedObject(), size); - handle.Free(); - - return result; - } - - public void EnumerateProcesses(EnumerateProcessCallback callbackProcess) - { - enumerateProcessesDelegate(callbackProcess); - } - - public void EnumerateRemoteSectionsAndModules(IntPtr process, EnumerateRemoteSectionCallback callbackSection, EnumerateRemoteModuleCallback callbackModule) - { - enumerateRemoteSectionsAndModulesDelegate(process, callbackSection, callbackModule); - } - - public void DisassembleRemoteCode(IntPtr process, IntPtr address, int length, DisassembleRemoteCodeCallback remoteCodeCallback) - { - disassembleRemoteCodeDelegate(process, address, length, remoteCodeCallback); - } - - public void ControlRemoteProcess(IntPtr process, ControlRemoteProcessAction action) - { - controlRemoteProcessDelegate(process, action); - } - - #endregion - } -} diff --git a/Memory/NodeDissector.cs b/Memory/NodeDissector.cs deleted file mode 100644 index 41c7d419..00000000 --- a/Memory/NodeDissector.cs +++ /dev/null @@ -1,160 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.Linq; -using ReClassNET.Nodes; -using ReClassNET.Util; - -namespace ReClassNET.Memory -{ - public class NodeDissector - { - public static void DissectNodes(IEnumerable nodes, MemoryBuffer memory) - { - Contract.Requires(nodes != null); - Contract.Requires(memory != null); - - foreach (var node in nodes) - { - var type = GuessType(node, memory); - if (type != null) - { - node.ParentNode.ReplaceChildNode(node, type); - } - } - } - - public static Type GuessType(BaseHexNode node, MemoryBuffer memory) - { - Contract.Requires(node != null); - Contract.Requires(memory != null); - - var offset = node.Offset.ToInt32(); - var is4ByteAligned = offset % 4 == 0; - var is8ByteAligned = offset % 8 == 0; - - // The node is not aligned, skip it. - if (!is4ByteAligned) - { - return null; - } - - var data64 = memory.ReadObject(offset); - var data32 = memory.ReadObject(offset); - - var raw = memory.ReadBytes(offset, node.MemorySize); - if (raw.InterpretAsUTF8().IsLikelyPrintableData() >= 0.5f) - { - return typeof(UTF8TextNode); - } - else if (raw.InterpretAsUTF16().IsLikelyPrintableData() >= 0.5f) - { - return typeof(UTF16TextNode); - } - - if (is8ByteAligned) - { -#if WIN64 - var pointerType = GuessPointerType(data64.IntPtr, memory); - if (pointerType != null) - { - return pointerType; - } -#endif - } - - if (is4ByteAligned) - { -#if WIN32 - var pointerType = GuessPointerType(data32.IntPtr, memory); - if (pointerType != null) - { - return pointerType; - } -#endif - - // 0 could be anything. - if (data32.IntValue != 0) - { - // If the data represents a reasonable range, it could be a float. - if (-99999.0f <= data32.FloatValue && data32.FloatValue <= 99999.0f && !data32.FloatValue.IsNearlyEqual(0.0f, 0.001f)) - { - return typeof(FloatNode); - } - - if (-99999 <= data32.IntValue && data32.IntValue <= 99999) - { - return typeof(Int32Node); - } - } - } - - if (is8ByteAligned) - { - if (data64.LongValue != 0) - { - // If the data represents a reasonable range, it could be a double. - if (-99999.0 <= data64.DoubleValue && data64.DoubleValue <= 99999.0 && !data64.DoubleValue.IsNearlyEqual(0.0, 0.001)) - { - return typeof(DoubleNode); - } - } - } - - return null; - } - - private static Type GuessPointerType(IntPtr address, MemoryBuffer memory) - { - Contract.Requires(memory != null); - - if (address.IsNull()) - { - return null; - } - - var section = memory.Process.GetSectionToPointer(address); - if (section != null) // If the address points to a section it's valid memory. - { - if (section.Category == RemoteProcess.SectionCategory.Code) // If the section contains code, it should be a function pointer. - { - return typeof(FunctionPtrNode); - } - else if (section.Category == RemoteProcess.SectionCategory.Data) // If the section contains data, it is at least a pointer to a class or something. - { - // Check if it is a vtable. Check if the first 3 values are pointers to a code section. - bool valid = true; - for (var i = 0; i < 3; ++i) - { - var pointee = memory.Process.ReadRemoteObject(address); - if (memory.Process.GetSectionToPointer(pointee)?.Category != RemoteProcess.SectionCategory.Code) - { - valid = false; - break; - } - } - if (valid) - { - return typeof(VTableNode); - } - - // Check if it is a string. - var data = memory.Process.ReadRemoteMemory(address, IntPtr.Size * 2); - if (data.Take(IntPtr.Size).InterpretAsUTF8().IsLikelyPrintableData() >= 0.5f) - { - return typeof(UTF8TextPtrNode); - } - else if (data.InterpretAsUTF16().IsLikelyPrintableData() >= 0.5f) - { - return typeof(UTF16TextPtrNode); - } - - // Now it could be a pointer to something else but we can't tell. :( - //return typeof(ClassPtrNode); - } - } - - return null; - } - } -} diff --git a/Memory/ProcessInfo.cs b/Memory/ProcessInfo.cs deleted file mode 100644 index f57f4779..00000000 --- a/Memory/ProcessInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using ReClassNET.Util; - -namespace ReClassNET.Memory -{ - public class ProcessInfo : IDisposable - { - private readonly NativeHelper nativeHelper; - - private IntPtr handle; - - public int Id { get; } - public IntPtr Handle => Open(); - public string Name { get; } - public string Path { get; } - - public ProcessInfo(NativeHelper nativeHelper, int id, string name, string path) - { - Contract.Requires(nativeHelper != null); - Contract.Requires(name != null); - Contract.Requires(path != null); - - this.nativeHelper = nativeHelper; - - Id = id; - Name = name; - Path = path; - } - - public void Dispose() - { - Close(); - } - - public IntPtr Open() - { - if (handle.IsNull()) - { - handle = nativeHelper.OpenRemoteProcess(Id, NativeMethods.PROCESS_ALL_ACCESS); - } - return handle; - } - - public void Close() - { - if (!handle.IsNull()) - { - nativeHelper.CloseRemoteProcess(handle); - - handle = IntPtr.Zero; - } - } - } -} diff --git a/Memory/RemoteProcess.cs b/Memory/RemoteProcess.cs deleted file mode 100644 index 93cdf967..00000000 --- a/Memory/RemoteProcess.cs +++ /dev/null @@ -1,579 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using ReClassNET.AddressParser; -using ReClassNET.Symbols; -using ReClassNET.Util; - -namespace ReClassNET.Memory -{ - public class RemoteProcess - { - private readonly NativeHelper nativeHelper; - public NativeHelper NativeHelper => nativeHelper; - - private ProcessInfo process; - public ProcessInfo Process - { - get { return process; } - set { if (process != value) { process = value; rttiCache.Clear(); ProcessChanged?.Invoke(this); } } - } - - public delegate void RemoteProcessChangedEvent(RemoteProcess sender); - public event RemoteProcessChangedEvent ProcessChanged; - - private readonly Dictionary rttiCache = new Dictionary(); - - public class Module - { - public IntPtr Start; - public IntPtr End; - public string Name; - public string Path; - } - - public enum SectionCategory - { - Unknown, - Code, - Data - } - - public class Section - { - public IntPtr Start; - public IntPtr End; - public string Name; - public SectionCategory Category; - public NativeMethods.StateEnum State; - public NativeMethods.AllocationProtectEnum Protection; - public NativeMethods.TypeEnum Type; - public string ModuleName; - public string ModulePath; - } - - private readonly List modules = new List(); - - private readonly List
sections = new List
(); - - private readonly SymbolStore symbols = new SymbolStore(); - public SymbolStore Symbols => symbols; - - public bool IsValid => process != null && nativeHelper.IsProcessValid(process.Handle); - - public RemoteProcess(NativeHelper nativeHelper) - { - Contract.Requires(nativeHelper != null); - - this.nativeHelper = nativeHelper; - } - - #region ReadMemory - - /// Reads remote memory from the address into the buffer. - /// The address to read from. - /// [out] The data buffer to fill. If the remote process is not valid, the buffer will get filled with zeros. - public void ReadRemoteMemoryIntoBuffer(IntPtr address, ref byte[] data) - { - Contract.Requires(data != null); - - if (!IsValid) - { - Process = null; - - data.FillWithZero(); - - return; - } - - nativeHelper.ReadRemoteMemory(Process.Handle, address, data, (uint)data.Length); - } - - /// Reads bytes from the address in the remote process. - /// The address to read from. - /// The size in bytes to read. - /// An array of bytes. - public byte[] ReadRemoteMemory(IntPtr address, int size) - { - Contract.Requires(size >= 0); - Contract.Ensures(Contract.Result() != null); - - var data = new byte[size]; - ReadRemoteMemoryIntoBuffer(address, ref data); - return data; - } - - /// Reads the object from the address in the remote process. - /// Type of the value to read. - /// The address to read from. - /// The remote object. - public T ReadRemoteObject(IntPtr address) where T : struct - { - var data = ReadRemoteMemory(address, Marshal.SizeOf()); - - var handle = GCHandle.Alloc(data, GCHandleType.Pinned); - var obj = (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T)); - handle.Free(); - - return obj; - } - - /// Reads a string from the address in the remote process with the given length using the provided encoding. - /// The encoding used by the string. - /// The address of the string. - /// The length of the string. - /// The string. - public string ReadRemoteString(Encoding encoding, IntPtr address, int length) - { - Contract.Requires(encoding != null); - Contract.Requires(length >= 0); - Contract.Ensures(Contract.Result() != null); - - var data = ReadRemoteMemory(address, length); - - try - { - var sb = new StringBuilder(encoding.GetString(data)); - for (var i = 0; i < sb.Length; ++i) - { - if (sb[i] == 0) - { - sb.Length = i; - break; - } - if (!sb[i].IsPrintable()) - { - sb[i] = '.'; - } - } - return sb.ToString(); - } - catch - { - return string.Empty; - } - } - - /// Reads a string from the address in the remote process with the given length using UTF8 encoding. The string gets truncated at the first zero character. - /// The address of the string. - /// The length of the string. - /// The string. - public string ReadRemoteUTF8StringUntilFirstNullCharacter(IntPtr address, int length) - { - Contract.Requires(length >= 0); - - var data = ReadRemoteMemory(address, length); - - int index = 0; - for (; index < data.Length; ++index) - { - if (data[index] == 0) - { - break; - } - } - - try - { - return Encoding.UTF8.GetString(data, 0, Math.Min(index, data.Length)); - } - catch - { - return string.Empty; - } - } - - /// Reads remote runtime type information for the given address from the remote process. - /// The address. - /// A string containing the runtime type information or null if no information could get found. - public string ReadRemoteRuntimeTypeInformation(IntPtr address) - { - if (address.MayBeValid()) - { - string rtti = null; - if (!rttiCache.TryGetValue(address, out rtti)) - { - var objectLocatorPtr = ReadRemoteObject(address - IntPtr.Size); - if (objectLocatorPtr.MayBeValid()) - { - -#if WIN64 - rtti = ReadRemoteRuntimeTypeInformation64(objectLocatorPtr); -#else - rtti = ReadRemoteRuntimeTypeInformation32(objectLocatorPtr); -#endif - - rttiCache[address] = rtti; - } - } - return rtti; - } - - return null; - } - - private string ReadRemoteRuntimeTypeInformation32(IntPtr address) - { - var classHierarchyDescriptorPtr = ReadRemoteObject(address + 0x10); - if (classHierarchyDescriptorPtr.MayBeValid()) - { - var baseClassCount = ReadRemoteObject(classHierarchyDescriptorPtr + 8); - if (baseClassCount > 0 && baseClassCount < 25) - { - var baseClassArrayPtr = ReadRemoteObject(classHierarchyDescriptorPtr + 0xC); - if (baseClassArrayPtr.MayBeValid()) - { - var sb = new StringBuilder(); - for (var i = 0; i < baseClassCount; ++i) - { - var baseClassDescriptorPtr = ReadRemoteObject(baseClassArrayPtr + (4 * i)); - if (baseClassDescriptorPtr.MayBeValid()) - { - var typeDescriptorPtr = ReadRemoteObject(baseClassDescriptorPtr); - if (typeDescriptorPtr.MayBeValid()) - { - var name = ReadRemoteUTF8StringUntilFirstNullCharacter(typeDescriptorPtr + 0x0C, 60); - if (name.EndsWith("@@")) - { - name = NativeMethods.UnDecorateSymbolName("?" + name); - } - - sb.Append(name); - sb.Append(" : "); - - continue; - } - } - - break; - } - - if (sb.Length != 0) - { - sb.Length -= 3; - - return sb.ToString(); - } - } - } - } - - return null; - } - - private string ReadRemoteRuntimeTypeInformation64(IntPtr address) - { - int baseOffset = ReadRemoteObject(address + 0x14); - if (baseOffset != 0) - { - var baseAddress = address - baseOffset; - - var classHierarchyDescriptorOffset = ReadRemoteObject(address + 0x10); - if (classHierarchyDescriptorOffset != 0) - { - var classHierarchyDescriptorPtr = baseAddress + classHierarchyDescriptorOffset; - - var baseClassCount = ReadRemoteObject(classHierarchyDescriptorPtr + 0x08); - if (baseClassCount > 0 && baseClassCount < 25) - { - var baseClassArrayOffset = ReadRemoteObject(classHierarchyDescriptorPtr + 0x0C); - if (baseClassArrayOffset != 0) - { - var baseClassArrayPtr = baseAddress + baseClassArrayOffset; - - var sb = new StringBuilder(); - for (var i = 0; i < baseClassCount; ++i) - { - var baseClassDescriptorOffset = ReadRemoteObject(baseClassArrayPtr + (4 * i)); - if (baseClassDescriptorOffset != 0) - { - var baseClassDescriptorPtr = baseAddress + baseClassDescriptorOffset; - - var typeDescriptorOffset = ReadRemoteObject(baseClassDescriptorPtr); - if (typeDescriptorOffset != 0) - { - var typeDescriptorPtr = baseAddress + typeDescriptorOffset; - - var name = ReadRemoteUTF8StringUntilFirstNullCharacter(typeDescriptorPtr + 0x14, 60); - if (string.IsNullOrEmpty(name)) - { - break; - } - - if (name.EndsWith("@@")) - { - name = NativeMethods.UnDecorateSymbolName("?" + name); - } - - sb.Append(name); - sb.Append(" : "); - - continue; - } - } - - break; - } - - if (sb.Length != 0) - { - sb.Length -= 3; - - return sb.ToString(); - } - } - } - } - } - - return null; - } - - #endregion - - #region WriteMemory - - /// Writes the given to the in the remote process. - /// The address to write to. - /// The data to write. - /// True if it succeeds, false if it fails. - public bool WriteRemoteMemory(IntPtr address, byte[] data) - { - Contract.Requires(data != null); - - if (!IsValid) - { - return false; - } - - return nativeHelper.WriteRemoteMemory(Process.Handle, address, data, (uint)data.Length); - } - - /// Writes the given to the in the remote process. - /// Type of the value to write. - /// The address to write to. - /// The value to write. - /// True if it succeeds, false if it fails. - public bool WriteRemoteMemory(IntPtr address, T value) where T : struct - { - var data = new byte[Marshal.SizeOf()]; - - var handle = GCHandle.Alloc(data, GCHandleType.Pinned); - Marshal.StructureToPtr(value, handle.AddrOfPinnedObject(), false); - handle.Free(); - - return WriteRemoteMemory(address, data); - } - - #endregion - - public Section GetSectionToPointer(IntPtr address) - { - lock (sections) - { - return sections - .Where(s => s.Category != SectionCategory.Unknown) - .Where(s => address.InRange(s.Start, s.End)) - .FirstOrDefault(); - } - } - - public Module GetModuleToPointer(IntPtr address) - { - lock (modules) - { - return modules - .Where(m => address.InRange(m.Start, m.End)) - .FirstOrDefault(); - } - } - - public Module GetModuleByName(string name) - { - lock (modules) - { - return modules - .Where(m => m.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)) - .FirstOrDefault(); - } - } - - /// Tries to map the given address to a section or a module of the process. - /// The address to map. - /// The named address or null if no mapping exists. - public string GetNamedAddress(IntPtr address) - { - var section = GetSectionToPointer(address); - if (section != null) - { - return $"<{section.Category}>{section.ModuleName}.{address.ToString("X")}"; - } - var module = GetModuleToPointer(address); - if (module != null) - { - return $"{module.Name}.{address.ToString("X")}"; - } - return null; - } - - /// Updates the process informations. - public void UpdateProcessInformations() - { - UpdateProcessInformationsAsync().Wait(); - } - - /// Updates the process informations asynchronous. - /// The Task. - public Task UpdateProcessInformationsAsync() - { - if (!IsValid) - { - lock(modules) - { - modules.Clear(); - } - lock(sections) - { - sections.Clear(); - } - - return Task.CompletedTask; - } - - return Task.Run(() => - { - var newModules = new List(); - var newSections = new List
(); - - nativeHelper.EnumerateRemoteSectionsAndModules( - process.Handle, - delegate (IntPtr baseAddress, IntPtr regionSize, string name, NativeMethods.StateEnum state, NativeMethods.AllocationProtectEnum protection, NativeMethods.TypeEnum type, string modulePath) - { - var section = new Section - { - Start = baseAddress, - End = baseAddress.Add(regionSize), - Name = name, - State = state, - Protection = protection, - Type = type, - ModulePath = modulePath, - ModuleName = Path.GetFileName(modulePath) - }; - switch (section.Name) - { - case ".text": - case "code": - section.Category = SectionCategory.Code; - break; - case ".data": - case "data": - case ".rdata": - case ".idata": - section.Category = SectionCategory.Data; - break; - } - newSections.Add(section); - }, - delegate (IntPtr baseAddress, IntPtr regionSize, string modulePath) - { - newModules.Add(new Module - { - Start = baseAddress, - End = baseAddress.Add(regionSize), - Path = modulePath, - Name = Path.GetFileName(modulePath) - }); - } - ); - - lock (modules) - { - modules.Clear(); - modules.AddRange(newModules); - } - lock (sections) - { - sections.Clear(); - sections.AddRange(newSections); - } - }); - } - - /// Parse the address formula. - /// The address formula. - /// The result of the parsed address or . - public IntPtr ParseAddress(string addressFormula) - { - Contract.Requires(addressFormula != null); - - var reader = new TokenReader(); - var tokens = reader.Read(addressFormula); - - var astBuilder = new AstBuilder(); - var operation = astBuilder.Build(tokens); - - if (operation == null) - { - return IntPtr.Zero; - } - - var interpreter = new Interpreter(); - return interpreter.Execute(operation, this); - } - - /// Loads all symbols asynchronous. - /// The progress reporter is called for every module. Can be null. - /// The token used to cancel the task. - /// The task. - public Task LoadAllSymbolsAsync(IProgress>> progress, CancellationToken token) - { - var copy = modules.ToList(); - - // Try to resolve all symbols in a background thread. This can take a long time because symbols are downloaded from the internet. - // The COM objects can only be used in the thread they were created so we can't use them. - // Thats why an other task loads the real symbols afterwards in the UI thread context. - return Task.Run( - () => - { - foreach (var module in copy) - { - token.ThrowIfCancellationRequested(); - - progress?.Report(Tuple.Create>(module, copy)); - - Symbols.TryResolveSymbolsForModule(module); - } - }, - token - ) - .ContinueWith( - _ => - { - foreach (var module in copy) - { - token.ThrowIfCancellationRequested(); - - try - { - Symbols.LoadSymbolsForModule(module); - } - catch - { - //ignore - } - } - }, - token, - TaskContinuationOptions.None, - TaskScheduler.FromCurrentSynchronizationContext() - ); - } - } -} diff --git a/NativeCore/Dependencies/distorm/COPYING.txt b/NativeCore/Dependencies/distorm/COPYING.txt new file mode 100644 index 00000000..9046eba5 --- /dev/null +++ b/NativeCore/Dependencies/distorm/COPYING.txt @@ -0,0 +1,26 @@ +:[diStorm3}: +The ultimate disassembler library. +Copyright (c) 2003-2021, Gil Dabah +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Gil Dabah nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL GIL DABAH BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/NativeCore/Dependencies/distorm/include/distorm.h b/NativeCore/Dependencies/distorm/include/distorm.h new file mode 100644 index 00000000..b0467bae --- /dev/null +++ b/NativeCore/Dependencies/distorm/include/distorm.h @@ -0,0 +1,499 @@ +/* diStorm 3.5.3 */ + +/* +distorm.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef DISTORM_H +#define DISTORM_H + +/* + * 64 bit offsets support: + * If the diStorm library you use was compiled with 64 bits offsets, + * make sure you compile your own code with the following macro set: + * SUPPORT_64BIT_OFFSET + * Otherwise comment it out, or you will get a linker error of an unresolved symbol... + * Turned on by default! + */ + +#if !(defined(DISTORM_STATIC) || defined(DISTORM_DYNAMIC)) + /* Define this macro for outer projects by default. */ + #define SUPPORT_64BIT_OFFSET +#endif + +/* TINYC has a problem with some 64bits library functions, so ignore 64 bit offsets. */ +#ifdef __TINYC__ + #undef SUPPORT_64BIT_OFFSET +#endif + +#ifndef _MSC_VER +#include +#else +/* Since MSVC < 2010 isn't shipped with stdint.h, + * here are those from MSVC 2017, which also match + * those in tinycc/libc. */ +typedef signed char int8_t; +typedef short int16_t; +typedef int int32_t; +typedef long long int64_t; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; +#endif + +#ifdef SUPPORT_64BIT_OFFSET +#define OFFSET_INTEGER uint64_t +#else +/* 32 bit offsets are used. */ +#define OFFSET_INTEGER uint32_t +#endif + +/* Support C++ compilers */ +#ifdef __cplusplus + extern "C" { +#endif + + +/* *** Helper Macros *** */ + +/* Get the ISC of the instruction, used with the definitions below. */ +#define META_GET_ISC(meta) (((meta) >> 8) & 0x1f) +#define META_SET_ISC(di, isc) (((di)->meta) |= ((isc) << 8)) +/* Get the flow control flags of the instruction, see 'features for decompose' below. */ +#define META_GET_FC(meta) ((meta) & 0xf) + +/* Get the target address of a branching instruction. O_PC operand type. */ +#define INSTRUCTION_GET_TARGET(di) ((_OffsetType)(((di)->addr + (di)->imm.addr + (di)->size))) +/* Get the target address of a RIP-relative memory indirection. */ +#define INSTRUCTION_GET_RIP_TARGET(di) ((_OffsetType)(((di)->addr + (di)->disp + (di)->size))) + +/* + * Operand Size or Adderss size are stored inside the flags: + * 00 - 16 bits + * 01 - 32 bits + * 10 - 64 bits + * 11 - reserved + * + * If you call these set-macros more than once, you will have to clean the bits before doing so. + */ +#define FLAG_SET_OPSIZE(di, size) ((di->flags) |= (((size) & 3) << 8)) +#define FLAG_SET_ADDRSIZE(di, size) ((di->flags) |= (((size) & 3) << 10)) +#define FLAG_GET_OPSIZE(flags) (((flags) >> 8) & 3) +#define FLAG_GET_ADDRSIZE(flags) (((flags) >> 10) & 3) +/* To get the LOCK/REPNZ/REP prefixes. */ +#define FLAG_GET_PREFIX(flags) (((unsigned int)((int16_t)flags)) & 7) +/* Indicates whether the instruction is privileged. */ +#define FLAG_GET_PRIVILEGED(flags) (((flags) & FLAG_PRIVILEGED_INSTRUCTION) != 0) + +/* + * Macros to extract segment registers from 'segment': + */ +#define SEGMENT_DEFAULT 0x80 +#define SEGMENT_GET(segment) (((segment) == R_NONE) ? R_NONE : ((segment) & 0x7f)) +#define SEGMENT_GET_UNSAFE(segment) ((segment) & 0x7f) +#define SEGMENT_IS_DEFAULT(segment) (((int8_t)segment) < -1) /* Quick check it's a negative number that isn't -1, so it's (0x80 | SEGREG). */ +#define SEGMENT_IS_DEFAULT_OR_NONE(segment) (((uint8_t)(segment)) > 0x80) + +/* Decodes modes of the disassembler, 16 bits or 32 bits or 64 bits for AMD64, x86-64. */ +typedef enum { Decode16Bits = 0, Decode32Bits = 1, Decode64Bits = 2 } _DecodeType; + +typedef OFFSET_INTEGER _OffsetType; + +typedef struct { + _OffsetType codeOffset, addrMask; + _OffsetType nextOffset; /* nextOffset is OUT only. */ + const uint8_t* code; + int codeLen; /* Using signed integer makes it easier to detect an underflow. */ + _DecodeType dt; + unsigned int features; +} _CodeInfo; + +typedef enum { O_NONE, O_REG, O_IMM, O_IMM1, O_IMM2, O_DISP, O_SMEM, O_MEM, O_PC, O_PTR } _OperandType; + +typedef union { + /* Used by O_IMM: */ + int8_t sbyte; + uint8_t byte; + int16_t sword; + uint16_t word; + int32_t sdword; + uint32_t dword; + int64_t sqword; /* All immediates are SIGN-EXTENDED to 64 bits! */ + uint64_t qword; + + /* Used by O_PC: (Use GET_TARGET_ADDR).*/ + _OffsetType addr; /* It's a relative offset as for now. */ + + /* Used by O_PTR: */ + struct { + uint16_t seg; + /* Can be 16 or 32 bits, size is in ops[n].size. */ + uint32_t off; + } ptr; + + /* Used by O_IMM1 (i1) and O_IMM2 (i2). ENTER instruction only. */ + struct { + uint32_t i1; + uint32_t i2; + } ex; +} _Value; + +typedef struct { + /* Type of operand: + O_NONE: operand is to be ignored. + O_REG: index holds global register index. + O_IMM: instruction.imm. + O_IMM1: instruction.imm.ex.i1. + O_IMM2: instruction.imm.ex.i2. + O_DISP: memory dereference with displacement only, instruction.disp. + O_SMEM: simple memory dereference with optional displacement (a single register memory dereference). + O_MEM: complex memory dereference (optional fields: s/i/b/disp). + O_PC: the relative address of a branch instruction (instruction.imm.addr). + O_PTR: the absolute target address of a far branch instruction (instruction.imm.ptr.seg/off). + */ + uint8_t type; /* _OperandType */ + + /* Index of: + O_REG: holds global register index + O_SMEM: holds the 'base' register. E.G: [ECX], [EBX+0x1234] are both in operand.index. + O_MEM: holds the 'index' register. E.G: [EAX*4] is in operand.index. + */ + uint8_t index; + + /* Size in bits of: + O_REG: register + O_IMM: instruction.imm + O_IMM1: instruction.imm.ex.i1 + O_IMM2: instruction.imm.ex.i2 + O_DISP: instruction.disp + O_SMEM: size of indirection. + O_MEM: size of indirection. + O_PC: size of the relative offset + O_PTR: size of instruction.imm.ptr.off (16 or 32) + */ + uint16_t size; +} _Operand; + +#define OPCODE_ID_NONE 0 +/* Instruction could not be disassembled. */ +#define FLAG_NOT_DECODABLE ((uint16_t)-1) +/* The instruction locks memory access. */ +#define FLAG_LOCK (1 << 0) +/* The instruction is prefixed with a REPNZ. */ +#define FLAG_REPNZ (1 << 1) +/* The instruction is prefixed with a REP, this can be a REPZ, it depends on the specific instruction. */ +#define FLAG_REP (1 << 2) +/* Indicates there is a hint taken for Jcc instructions only. */ +#define FLAG_HINT_TAKEN (1 << 3) +/* Indicates there is a hint non-taken for Jcc instructions only. */ +#define FLAG_HINT_NOT_TAKEN (1 << 4) +/* The Imm value is signed extended (E.G in 64 bit decoding mode, a 32 bit imm is usually sign extended into 64 bit imm). */ +#define FLAG_IMM_SIGNED (1 << 5) +/* The destination operand is writable. */ +#define FLAG_DST_WR (1 << 6) +/* The instruction uses RIP-relative indirection. */ +#define FLAG_RIP_RELATIVE (1 << 7) + +/* See flag FLAG_GET_XXX macros above. */ + +/* The instruction is privileged and can only be used from Ring0. */ +#define FLAG_PRIVILEGED_INSTRUCTION (1 << 15) + +/* No register was defined. */ +#define R_NONE ((uint8_t)-1) + +#define REGS64_BASE 0 +#define REGS32_BASE 16 +#define REGS16_BASE 32 +#define REGS8_BASE 48 +#define REGS8_REX_BASE 64 +#define SREGS_BASE 68 +#define FPUREGS_BASE 75 +#define MMXREGS_BASE 83 +#define SSEREGS_BASE 91 +#define AVXREGS_BASE 107 +#define CREGS_BASE 123 +#define DREGS_BASE 132 + +#define OPERANDS_NO (4) + +typedef struct { + /* Used by ops[n].type == O_IMM/O_IMM1&O_IMM2/O_PTR/O_PC. Its size is ops[n].size. */ + _Value imm; + /* Used by ops[n].type == O_SMEM/O_MEM/O_DISP. Its size is dispSize. */ + uint64_t disp; + /* Virtual address of first byte of instruction. */ + _OffsetType addr; + /* General flags of instruction, holds prefixes and more, if FLAG_NOT_DECODABLE, instruction is invalid. */ + uint16_t flags; + /* Unused prefixes mask, for each bit that is set that prefix is not used (LSB is byte [addr + 0]). */ + uint16_t unusedPrefixesMask; + /* Mask of registers that were used in the operands, only used for quick look up, in order to know *some* operand uses that register class. */ + uint32_t usedRegistersMask; + /* ID of opcode in the global opcode table. Use for mnemonic look up. */ + uint16_t opcode; + /* Up to four operands per instruction, ignored if ops[n].type == O_NONE. */ + _Operand ops[OPERANDS_NO]; + /* Number of valid ops entries. */ + uint8_t opsNo; + /* Size of the whole instruction in bytes. */ + uint8_t size; + /* Segment information of memory indirection, default segment, or overriden one, can be -1. Use SEGMENT macros. */ + uint8_t segment; + /* Used by ops[n].type == O_MEM. Base global register index (might be R_NONE), scale size (2/4/8), ignored for 0 or 1. */ + uint8_t base, scale; + uint8_t dispSize; + /* Meta defines the instruction set class, and the flow control flags. Use META macros. */ + uint16_t meta; + /* The CPU flags that the instruction operates upon, set only with DF_FILL_EFLAGS enabled, otherwise 0. */ + uint16_t modifiedFlagsMask, testedFlagsMask, undefinedFlagsMask; +} _DInst; + +#ifndef DISTORM_LIGHT + +/* Static size of strings. Do not change this value. Keep Python wrapper in sync. */ +#define MAX_TEXT_SIZE (48) +typedef struct { + unsigned int length; + unsigned char p[MAX_TEXT_SIZE]; /* p is a null terminated string. */ +} _WString; + +/* + * Old decoded instruction structure in text format. + * Used only for backward compatibility with diStorm64. + * This structure holds all information the disassembler generates per instruction. + */ +typedef struct { + _OffsetType offset; /* Start offset of the decoded instruction. */ + unsigned int size; /* Size of decoded instruction in bytes. */ + _WString mnemonic; /* Mnemonic of decoded instruction, prefixed if required by REP, LOCK etc. */ + _WString operands; /* Operands of the decoded instruction, up to 3 operands, comma-seperated. */ + _WString instructionHex; /* Hex dump - little endian, including prefixes. */ +} _DecodedInst; + +#endif /* DISTORM_LIGHT */ + +/* Register masks for quick look up, each mask indicates one of a register-class that is being used in some operand. */ +#define RM_AX 1 /* AL, AH, AX, EAX, RAX */ +#define RM_CX 2 /* CL, CH, CX, ECX, RCX */ +#define RM_DX 4 /* DL, DH, DX, EDX, RDX */ +#define RM_BX 8 /* BL, BH, BX, EBX, RBX */ +#define RM_SP 0x10 /* SPL, SP, ESP, RSP */ +#define RM_BP 0x20 /* BPL, BP, EBP, RBP */ +#define RM_SI 0x40 /* SIL, SI, ESI, RSI */ +#define RM_DI 0x80 /* DIL, DI, EDI, RDI */ +#define RM_FPU 0x100 /* ST(0) - ST(7) */ +#define RM_MMX 0x200 /* MM0 - MM7 */ +#define RM_SSE 0x400 /* XMM0 - XMM15 */ +#define RM_AVX 0x800 /* YMM0 - YMM15 */ +#define RM_CR 0x1000 /* CR0, CR2, CR3, CR4, CR8 */ +#define RM_DR 0x2000 /* DR0, DR1, DR2, DR3, DR6, DR7 */ +#define RM_R8 0x4000 /* R8B, R8W, R8D, R8 */ +#define RM_R9 0x8000 /* R9B, R9W, R9D, R9 */ +#define RM_R10 0x10000 /* R10B, R10W, R10D, R10 */ +#define RM_R11 0x20000 /* R11B, R11W, R11D, R11 */ +#define RM_R12 0x40000 /* R12B, R12W, R12D, R12 */ +#define RM_R13 0x80000 /* R13B, R13W, R13D, R13 */ +#define RM_R14 0x100000 /* R14B, R14W, R14D, R14 */ +#define RM_R15 0x200000 /* R15B, R15W, R15D, R15 */ +#define RM_SEG 0x400000 /* CS, SS, DS, ES, FS, GS */ + +/* RIP should be checked using the 'flags' field and FLAG_RIP_RELATIVE. + * Segments should be checked using the segment macros. + * For now R8 - R15 are not supported and non general purpose registers map into same RM. + */ + +/* CPU flags that instructions modify, test or undefine (are EFLAGS compatible!). */ +#define D_CF 1 /* Carry */ +#define D_PF 4 /* Parity */ +#define D_AF 0x10 /* Auxiliary */ +#define D_ZF 0x40 /* Zero */ +#define D_SF 0x80 /* Sign */ +#define D_IF 0x200 /* Interrupt */ +#define D_DF 0x400 /* Direction */ +#define D_OF 0x800 /* Overflow */ + +/* + * Instructions Set classes: + * if you want a better understanding of the available classes, look at disOps project, file: x86sets.py. + */ +/* Indicates the instruction belongs to the General Integer set. */ +#define ISC_INTEGER 1 +/* Indicates the instruction belongs to the 387 FPU set. */ +#define ISC_FPU 2 +/* Indicates the instruction belongs to the P6 set. */ +#define ISC_P6 3 +/* Indicates the instruction belongs to the MMX set. */ +#define ISC_MMX 4 +/* Indicates the instruction belongs to the SSE set. */ +#define ISC_SSE 5 +/* Indicates the instruction belongs to the SSE2 set. */ +#define ISC_SSE2 6 +/* Indicates the instruction belongs to the SSE3 set. */ +#define ISC_SSE3 7 +/* Indicates the instruction belongs to the SSSE3 set. */ +#define ISC_SSSE3 8 +/* Indicates the instruction belongs to the SSE4.1 set. */ +#define ISC_SSE4_1 9 +/* Indicates the instruction belongs to the SSE4.2 set. */ +#define ISC_SSE4_2 10 +/* Indicates the instruction belongs to the AMD's SSE4.A set. */ +#define ISC_SSE4_A 11 +/* Indicates the instruction belongs to the 3DNow! set. */ +#define ISC_3DNOW 12 +/* Indicates the instruction belongs to the 3DNow! Extensions set. */ +#define ISC_3DNOWEXT 13 +/* Indicates the instruction belongs to the VMX (Intel) set. */ +#define ISC_VMX 14 +/* Indicates the instruction belongs to the SVM (AMD) set. */ +#define ISC_SVM 15 +/* Indicates the instruction belongs to the AVX (Intel) set. */ +#define ISC_AVX 16 +/* Indicates the instruction belongs to the FMA (Intel) set. */ +#define ISC_FMA 17 +/* Indicates the instruction belongs to the AES/AVX (Intel) set. */ +#define ISC_AES 18 +/* Indicates the instruction belongs to the CLMUL (Intel) set. */ +#define ISC_CLMUL 19 + +/* Features for decompose: */ +#define DF_NONE 0 +/* The decoder will limit addresses to a maximum of 16 bits. */ +#define DF_MAXIMUM_ADDR16 1 +/* The decoder will limit addresses to a maximum of 32 bits. */ +#define DF_MAXIMUM_ADDR32 2 +/* The decoder will return only flow control instructions (and filter the others internally). */ +#define DF_RETURN_FC_ONLY 4 +/* The decoder will stop and return to the caller when the instruction 'CALL' (near and far) was decoded. */ +#define DF_STOP_ON_CALL 8 +/* The decoder will stop and return to the caller when the instruction 'RET' (near and far) was decoded. */ +#define DF_STOP_ON_RET 0x10 +/* The decoder will stop and return to the caller when the instruction system-call/ret was decoded. */ +#define DF_STOP_ON_SYS 0x20 +/* The decoder will stop and return to the caller when any of the branch 'JMP', (near and far) instructions were decoded. */ +#define DF_STOP_ON_UNC_BRANCH 0x40 +/* The decoder will stop and return to the caller when any of the conditional branch instruction were decoded. */ +#define DF_STOP_ON_CND_BRANCH 0x80 +/* The decoder will stop and return to the caller when the instruction 'INT' (INT, INT1, INTO, INT 3) was decoded. */ +#define DF_STOP_ON_INT 0x100 +/* The decoder will stop and return to the caller when any of the 'CMOVxx' instruction was decoded. */ +#define DF_STOP_ON_CMOV 0x200 +/* The decoder will stop and return to the caller when it encounters the HLT instruction. */ +#define DF_STOP_ON_HLT 0x400 +/* The decoder will stop and return to the caller when it encounters a privileged instruction. */ +#define DF_STOP_ON_PRIVILEGED 0x800 +/* The decoder will stop and return to the caller when an instruction couldn't be decoded. */ +#define DF_STOP_ON_UNDECODEABLE 0x1000 +/* The decoder will not synchronize to the next byte after the previosuly decoded instruction, instead it will start decoding at the next byte. */ +#define DF_SINGLE_BYTE_STEP 0x2000 +/* The decoder will fill in the eflags fields for the decoded instruction. */ +#define DF_FILL_EFLAGS 0x4000 +/* The decoder will use the addrMask in CodeInfo structure instead of DF_MAXIMUM_ADDR16/32. */ +#define DF_USE_ADDR_MASK 0x8000 + +/* The decoder will stop and return to the caller when any flow control instruction was decoded. */ +#define DF_STOP_ON_FLOW_CONTROL (DF_STOP_ON_CALL | DF_STOP_ON_RET | DF_STOP_ON_SYS | DF_STOP_ON_UNC_BRANCH | DF_STOP_ON_CND_BRANCH | DF_STOP_ON_INT | DF_STOP_ON_CMOV | DF_STOP_ON_HLT) + +/* Indicates the instruction is not a flow-control instruction. */ +#define FC_NONE 0 +/* Indicates the instruction is one of: CALL, CALL FAR. */ +#define FC_CALL 1 +/* Indicates the instruction is one of: RET, IRET, RETF. */ +#define FC_RET 2 +/* Indicates the instruction is one of: SYSCALL, SYSRET, SYSENTER, SYSEXIT. */ +#define FC_SYS 3 +/* Indicates the instruction is one of: JMP, JMP FAR. */ +#define FC_UNC_BRANCH 4 +/* + * Indicates the instruction is one of: + * JCXZ, JO, JNO, JB, JAE, JZ, JNZ, JBE, JA, JS, JNS, JP, JNP, JL, JGE, JLE, JG, LOOP, LOOPZ, LOOPNZ. + */ +#define FC_CND_BRANCH 5 +/* Indiciates the instruction is one of: INT, INT1, INT 3, INTO, UD2. */ +#define FC_INT 6 +/* Indicates the instruction is one of: CMOVxx. */ +#define FC_CMOV 7 +/* Indicates the instruction is HLT. */ +#define FC_HLT 8 + +/* Return code of the decoding function. */ +typedef enum { DECRES_NONE, DECRES_SUCCESS, DECRES_MEMORYERR, DECRES_INPUTERR } _DecodeResult; + +/* Define the following interface functions only for outer projects. */ +#if !(defined(DISTORM_STATIC) || defined(DISTORM_DYNAMIC)) + +/* distorm_decode + * Input: + * offset - Origin of the given code (virtual address that is), NOT an offset in code. + * code - Pointer to the code buffer to be disassembled. + * length - Amount of bytes that should be decoded from the code buffer. + * dt - Decoding mode, 16 bits (Decode16Bits), 32 bits (Decode32Bits) or AMD64 (Decode64Bits). + * result - Array of type _DecodeInst which will be used by this function in order to return the disassembled instructions. + * maxInstructions - The maximum number of entries in the result array that you pass to this function, so it won't exceed its bound. + * usedInstructionsCount - Number of the instruction that successfully were disassembled and written to the result array. + * Output: usedInstructionsCount will hold the number of entries used in the result array + * and the result array itself will be filled with the disassembled instructions. + * Return: DECRES_SUCCESS on success (no more to disassemble), DECRES_INPUTERR on input error (null code buffer, invalid decoding mode, etc...), + * DECRES_MEMORYERR when there are not enough entries to use in the result array, BUT YOU STILL have to check for usedInstructionsCount! + * Side-Effects: Even if the return code is DECRES_MEMORYERR, there might STILL be data in the + * array you passed, this function will try to use as much entries as possible! + * Notes: 1)The minimal size of maxInstructions is 15. + * 2)You will have to synchronize the offset,code and length by yourself if you pass code fragments and not a complete code block! + */ + +/* distorm_decompose + * See more documentation online at the GitHub project's wiki. + * + */ +#ifdef SUPPORT_64BIT_OFFSET + + _DecodeResult distorm_decompose64(_CodeInfo* ci, _DInst result[], unsigned int maxInstructions, unsigned int* usedInstructionsCount); + #define distorm_decompose distorm_decompose64 + +#ifndef DISTORM_LIGHT + /* If distorm-light is defined, we won't export these text-formatting functionality. */ + _DecodeResult distorm_decode64(_OffsetType codeOffset, const unsigned char* code, int codeLen, _DecodeType dt, _DecodedInst result[], unsigned int maxInstructions, unsigned int* usedInstructionsCount); + void distorm_format64(const _CodeInfo* ci, const _DInst* di, _DecodedInst* result); + #define distorm_decode distorm_decode64 + #define distorm_format distorm_format64 +#endif /*DISTORM_LIGHT*/ + +#else /*SUPPORT_64BIT_OFFSET*/ + + _DecodeResult distorm_decompose32(_CodeInfo* ci, _DInst result[], unsigned int maxInstructions, unsigned int* usedInstructionsCount); + #define distorm_decompose distorm_decompose32 + +#ifndef DISTORM_LIGHT + /* If distorm-light is defined, we won't export these text-formatting functionality. */ + _DecodeResult distorm_decode32(_OffsetType codeOffset, const unsigned char* code, int codeLen, _DecodeType dt, _DecodedInst result[], unsigned int maxInstructions, unsigned int* usedInstructionsCount); + void distorm_format32(const _CodeInfo* ci, const _DInst* di, _DecodedInst* result); + #define distorm_decode distorm_decode32 + #define distorm_format distorm_format32 +#endif /*DISTORM_LIGHT*/ + +#endif + +/* + * distorm_version + * Input: + * none + * + * Output: unsigned int - version of compiled library. + */ +unsigned int distorm_version(void); + +#endif /* DISTORM_STATIC */ + +#ifdef __cplusplus +} /* End Of Extern */ +#endif + +#endif /* DISTORM_H */ diff --git a/NativeCore/Dependencies/distorm/include/mnemonics.h b/NativeCore/Dependencies/distorm/include/mnemonics.h new file mode 100644 index 00000000..3f982705 --- /dev/null +++ b/NativeCore/Dependencies/distorm/include/mnemonics.h @@ -0,0 +1,301 @@ +/* +mnemonics.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef MNEMONICS_H +#define MNEMONICS_H + +#ifdef __cplusplus + extern "C" { +#endif + +#ifndef DISTORM_LIGHT + +typedef struct WMnemonic { + unsigned char length; + unsigned char p[1]; /* p is a null terminated string, which contains 'length' characters. */ +} _WMnemonic; + +typedef struct WRegister { + unsigned int length; + unsigned char p[6]; /* p is a null terminated string. */ +} _WRegister; + +extern const unsigned char _MNEMONICS[]; +extern const _WRegister _REGISTERS[]; + +#endif /* DISTORM_LIGHT */ + +#ifdef __cplusplus +} /* End Of Extern */ +#endif + +#define GET_REGISTER_NAME(r) (unsigned char*)_REGISTERS[(r)].p +#define GET_MNEMONIC_NAME(m) ((_WMnemonic*)&_MNEMONICS[(m)])->p + + typedef enum { + I_UNDEFINED = 0, I_AAA = 66, I_AAD = 388, I_AAM = 383, I_AAS = 76, I_ADC = 31, I_ADD = 11, I_ADDPD = 3143, + I_ADDPS = 3136, I_ADDSD = 3157, I_ADDSS = 3150, I_ADDSUBPD = 6427, I_ADDSUBPS = 6437, + I_AESDEC = 9242, I_AESDECLAST = 9259, I_AESENC = 9200, I_AESENCLAST = 9217, + I_AESIMC = 9183, I_AESKEYGENASSIST = 9828, I_AND = 41, I_ANDNPD = 3054, I_ANDNPS = 3046, + I_ANDPD = 3023, I_ANDPS = 3016, I_ARPL = 111, I_BLENDPD = 9405, I_BLENDPS = 9386, + I_BLENDVPD = 7652, I_BLENDVPS = 7642, I_BOUND = 104, I_BSF = 4379, I_BSR = 4391, + I_BSWAP = 959, I_BT = 871, I_BTC = 933, I_BTR = 911, I_BTS = 886, I_CALL = 455, + I_CALL_FAR = 260, I_CBW = 228, I_CDQ = 250, I_CDQE = 239, I_CLAC = 1786, I_CLC = 491, + I_CLD = 511, I_CLFLUSH = 4362, I_CLGI = 1866, I_CLI = 501, I_CLTS = 540, I_CMC = 486, + I_CMOVA = 693, I_CMOVAE = 662, I_CMOVB = 655, I_CMOVBE = 685, I_CMOVG = 753, + I_CMOVGE = 737, I_CMOVL = 730, I_CMOVLE = 745, I_CMOVNO = 647, I_CMOVNP = 722, + I_CMOVNS = 707, I_CMOVNZ = 677, I_CMOVO = 640, I_CMOVP = 715, I_CMOVS = 700, + I_CMOVZ = 670, I_CMP = 71, I_CMPEQPD = 4482, I_CMPEQPS = 4403, I_CMPEQSD = 4640, + I_CMPEQSS = 4561, I_CMPLEPD = 4500, I_CMPLEPS = 4421, I_CMPLESD = 4658, I_CMPLESS = 4579, + I_CMPLTPD = 4491, I_CMPLTPS = 4412, I_CMPLTSD = 4649, I_CMPLTSS = 4570, I_CMPNEQPD = 4521, + I_CMPNEQPS = 4442, I_CMPNEQSD = 4679, I_CMPNEQSS = 4600, I_CMPNLEPD = 4541, + I_CMPNLEPS = 4462, I_CMPNLESD = 4699, I_CMPNLESS = 4620, I_CMPNLTPD = 4531, + I_CMPNLTPS = 4452, I_CMPNLTSD = 4689, I_CMPNLTSS = 4610, I_CMPORDPD = 4551, + I_CMPORDPS = 4472, I_CMPORDSD = 4709, I_CMPORDSS = 4630, I_CMPS = 301, I_CMPUNORDPD = 4509, + I_CMPUNORDPS = 4430, I_CMPUNORDSD = 4667, I_CMPUNORDSS = 4588, I_CMPXCHG = 897, + I_CMPXCHG16B = 6406, I_CMPXCHG8B = 6395, I_COMISD = 2812, I_COMISS = 2804, + I_CPUID = 864, I_CQO = 255, I_CRC32 = 9291, I_CVTDQ2PD = 6820, I_CVTDQ2PS = 3340, + I_CVTPD2DQ = 6830, I_CVTPD2PI = 2714, I_CVTPD2PS = 3266, I_CVTPH2PS = 4194, + I_CVTPI2PD = 2528, I_CVTPI2PS = 2518, I_CVTPS2DQ = 3350, I_CVTPS2PD = 3256, + I_CVTPS2PH = 4204, I_CVTPS2PI = 2704, I_CVTSD2SI = 2734, I_CVTSD2SS = 3286, + I_CVTSI2SD = 2548, I_CVTSI2SS = 2538, I_CVTSS2SD = 3276, I_CVTSS2SI = 2724, + I_CVTTPD2DQ = 6809, I_CVTTPD2PI = 2647, I_CVTTPS2DQ = 3360, I_CVTTPS2PI = 2636, + I_CVTTSD2SI = 2669, I_CVTTSS2SI = 2658, I_CWD = 245, I_CWDE = 233, I_DAA = 46, + I_DAS = 56, I_DEC = 86, I_DIV = 1645, I_DIVPD = 3532, I_DIVPS = 3525, I_DIVSD = 3546, + I_DIVSS = 3539, I_DPPD = 9648, I_DPPS = 9635, I_EMMS = 4133, I_ENTER = 340, + I_EXTRACTPS = 9513, I_EXTRQ = 4169, I_F2XM1 = 1191, I_FABS = 1122, I_FADD = 1022, + I_FADDP = 1548, I_FBLD = 1600, I_FBSTP = 1606, I_FCHS = 1116, I_FCLEX = 7322, + I_FCMOVB = 1375, I_FCMOVBE = 1391, I_FCMOVE = 1383, I_FCMOVNB = 1444, I_FCMOVNBE = 1462, + I_FCMOVNE = 1453, I_FCMOVNU = 1472, I_FCMOVU = 1400, I_FCOM = 1034, I_FCOMI = 1511, + I_FCOMIP = 1622, I_FCOMP = 1040, I_FCOMPP = 1562, I_FCOS = 1310, I_FDECSTP = 1237, + I_FDIV = 1060, I_FDIVP = 1593, I_FDIVR = 1066, I_FDIVRP = 1585, I_FEDISI = 1487, + I_FEMMS = 573, I_FENI = 1481, I_FFREE = 1526, I_FIADD = 1316, I_FICOM = 1330, + I_FICOMP = 1337, I_FIDIV = 1360, I_FIDIVR = 1367, I_FILD = 1417, I_FIMUL = 1323, + I_FINCSTP = 1246, I_FINIT = 7337, I_FIST = 1431, I_FISTP = 1437, I_FISTTP = 1423, + I_FISUB = 1345, I_FISUBR = 1352, I_FLD = 1073, I_FLD1 = 1140, I_FLDCW = 1097, + I_FLDENV = 1089, I_FLDL2E = 1154, I_FLDL2T = 1146, I_FLDLG2 = 1169, I_FLDLN2 = 1177, + I_FLDPI = 1162, I_FLDZ = 1185, I_FMUL = 1028, I_FMULP = 1555, I_FNCLEX = 7314, + I_FNINIT = 7329, I_FNOP = 1110, I_FNSAVE = 7344, I_FNSTCW = 7299, I_FNSTENV = 7282, + I_FNSTSW = 7359, I_FPATAN = 1212, I_FPREM = 1255, I_FPREM1 = 1229, I_FPTAN = 1205, + I_FRNDINT = 1287, I_FRSTOR = 1518, I_FSAVE = 7352, I_FSCALE = 1296, I_FSETPM = 1495, + I_FSIN = 1304, I_FSINCOS = 1278, I_FSQRT = 1271, I_FST = 1078, I_FSTCW = 7307, + I_FSTENV = 7291, I_FSTP = 1083, I_FSTSW = 7367, I_FSUB = 1047, I_FSUBP = 1578, + I_FSUBR = 1053, I_FSUBRP = 1570, I_FTST = 1128, I_FUCOM = 1533, I_FUCOMI = 1503, + I_FUCOMIP = 1613, I_FUCOMP = 1540, I_FUCOMPP = 1408, I_FXAM = 1134, I_FXCH = 1104, + I_FXRSTOR = 9925, I_FXRSTOR64 = 9934, I_FXSAVE = 9897, I_FXSAVE64 = 9905, + I_FXTRACT = 1220, I_FYL2X = 1198, I_FYL2XP1 = 1262, I_GETSEC = 632, I_HADDPD = 4214, + I_HADDPS = 4222, I_HLT = 481, I_HSUBPD = 4248, I_HSUBPS = 4256, I_IDIV = 1650, + I_IMUL = 117, I_IN = 446, I_INC = 81, I_INS = 123, I_INSERTPS = 9580, I_INSERTQ = 4176, + I_INT = 366, I_INT1 = 475, I_INT3 = 360, I_INTO = 371, I_INVD = 554, I_INVEPT = 8317, + I_INVLPG = 1726, I_INVLPGA = 1880, I_INVPCID = 8334, I_INVVPID = 8325, I_IRET = 377, + I_JA = 166, I_JAE = 147, I_JB = 143, I_JBE = 161, I_JCXZ = 426, I_JECXZ = 432, + I_JG = 202, I_JGE = 192, I_JL = 188, I_JLE = 197, I_JMP = 461, I_JMP_FAR = 466, + I_JNO = 138, I_JNP = 183, I_JNS = 174, I_JNZ = 156, I_JO = 134, I_JP = 179, + I_JRCXZ = 439, I_JS = 170, I_JZ = 152, I_LAHF = 289, I_LAR = 521, I_LDDQU = 7027, + I_LDMXCSR = 9955, I_LDS = 335, I_LEA = 223, I_LEAVE = 347, I_LES = 330, I_LFENCE = 4298, + I_LFS = 916, I_LGDT = 1702, I_LGS = 921, I_LIDT = 1708, I_LLDT = 1667, I_LMSW = 1720, + I_LODS = 313, I_LOOP = 420, I_LOOPNZ = 405, I_LOOPZ = 413, I_LSL = 526, I_LSS = 906, + I_LTR = 1673, I_LZCNT = 4396, I_MASKMOVDQU = 7152, I_MASKMOVQ = 7142, I_MAXPD = 3592, + I_MAXPS = 3585, I_MAXSD = 3606, I_MAXSS = 3599, I_MFENCE = 4324, I_MINPD = 3472, + I_MINPS = 3465, I_MINSD = 3486, I_MINSS = 3479, I_MONITOR = 1770, I_MOV = 218, + I_MOVAPD = 2492, I_MOVAPS = 2484, I_MOVBE = 9284, I_MOVD = 3953, I_MOVDDUP = 2219, + I_MOVDQ2Q = 6555, I_MOVDQA = 3979, I_MOVDQU = 3987, I_MOVHLPS = 2184, I_MOVHPD = 2378, + I_MOVHPS = 2370, I_MOVLHPS = 2361, I_MOVLPD = 2201, I_MOVLPS = 2193, I_MOVMSKPD = 2848, + I_MOVMSKPS = 2838, I_MOVNTDQ = 6882, I_MOVNTDQA = 7928, I_MOVNTI = 951, I_MOVNTPD = 2589, + I_MOVNTPS = 2580, I_MOVNTQ = 6874, I_MOVNTSD = 2607, I_MOVNTSS = 2598, I_MOVQ = 3959, + I_MOVQ2DQ = 6546, I_MOVS = 295, I_MOVSD = 2143, I_MOVSHDUP = 2386, I_MOVSLDUP = 2209, + I_MOVSS = 2136, I_MOVSX = 938, I_MOVSXD = 10038, I_MOVUPD = 2128, I_MOVUPS = 2120, + I_MOVZX = 926, I_MPSADBW = 9661, I_MUL = 1640, I_MULPD = 3203, I_MULPS = 3196, + I_MULSD = 3217, I_MULSS = 3210, I_MWAIT = 1779, I_NEG = 1635, I_NOP = 580, + I_NOT = 1630, I_OR = 27, I_ORPD = 3086, I_ORPS = 3080, I_OUT = 450, I_OUTS = 128, + I_PABSB = 7721, I_PABSD = 7751, I_PABSW = 7736, I_PACKSSDW = 3882, I_PACKSSWB = 3714, + I_PACKUSDW = 7949, I_PACKUSWB = 3792, I_PADDB = 7237, I_PADDD = 7267, I_PADDQ = 6514, + I_PADDSB = 6963, I_PADDSW = 6980, I_PADDUSB = 6653, I_PADDUSW = 6672, I_PADDW = 7252, + I_PALIGNR = 9443, I_PAND = 6640, I_PANDN = 6698, I_PAUSE = 10046, I_PAVGB = 6713, + I_PAVGUSB = 2111, I_PAVGW = 6758, I_PBLENDVB = 7632, I_PBLENDW = 9424, I_PCLMULQDQ = 9680, + I_PCMPEQB = 4076, I_PCMPEQD = 4114, I_PCMPEQQ = 7909, I_PCMPEQW = 4095, I_PCMPESTRI = 9759, + I_PCMPESTRM = 9736, I_PCMPGTB = 3735, I_PCMPGTD = 3773, I_PCMPGTQ = 8120, + I_PCMPGTW = 3754, I_PCMPISTRI = 9805, I_PCMPISTRM = 9782, I_PEXTRB = 9462, + I_PEXTRD = 9479, I_PEXTRQ = 9487, I_PEXTRW = 6344, I_PF2ID = 1947, I_PF2IW = 1940, + I_PFACC = 2061, I_PFADD = 2010, I_PFCMPEQ = 2068, I_PFCMPGE = 1971, I_PFCMPGT = 2017, + I_PFMAX = 2026, I_PFMIN = 1980, I_PFMUL = 2077, I_PFNACC = 1954, I_PFPNACC = 1962, + I_PFRCP = 1987, I_PFRCPIT1 = 2033, I_PFRCPIT2 = 2084, I_PFRSQIT1 = 2043, I_PFRSQRT = 1994, + I_PFSUB = 2003, I_PFSUBR = 2053, I_PHADDD = 7408, I_PHADDSW = 7425, I_PHADDW = 7391, + I_PHMINPOSUW = 8292, I_PHSUBD = 7484, I_PHSUBSW = 7501, I_PHSUBW = 7467, I_PI2FD = 1933, + I_PI2FW = 1926, I_PINSRB = 9563, I_PINSRD = 9601, I_PINSRQ = 9609, I_PINSRW = 6327, + I_PMADDUBSW = 7444, I_PMADDWD = 7106, I_PMAXSB = 8207, I_PMAXSD = 8224, I_PMAXSW = 6997, + I_PMAXUB = 6681, I_PMAXUD = 8258, I_PMAXUW = 8241, I_PMINSB = 8139, I_PMINSD = 8156, + I_PMINSW = 6935, I_PMINUB = 6623, I_PMINUD = 8190, I_PMINUW = 8173, I_PMOVMSKB = 6564, + I_PMOVSXBD = 7787, I_PMOVSXBQ = 7808, I_PMOVSXBW = 7766, I_PMOVSXDQ = 7871, + I_PMOVSXWD = 7829, I_PMOVSXWQ = 7850, I_PMOVZXBD = 8015, I_PMOVZXBQ = 8036, + I_PMOVZXBW = 7994, I_PMOVZXDQ = 8099, I_PMOVZXWD = 8057, I_PMOVZXWQ = 8078, + I_PMULDQ = 7892, I_PMULHRSW = 7571, I_PMULHRW = 2094, I_PMULHUW = 6773, I_PMULHW = 6792, + I_PMULLD = 8275, I_PMULLW = 6529, I_PMULUDQ = 7087, I_POP = 22, I_POPA = 98, + I_POPCNT = 4371, I_POPF = 277, I_POR = 6952, I_PREFETCH = 1905, I_PREFETCHNTA = 2435, + I_PREFETCHT0 = 2448, I_PREFETCHT1 = 2460, I_PREFETCHT2 = 2472, I_PREFETCHW = 1915, + I_PSADBW = 7125, I_PSHUFB = 7374, I_PSHUFD = 4021, I_PSHUFHW = 4029, I_PSHUFLW = 4038, + I_PSHUFW = 4013, I_PSIGNB = 7520, I_PSIGND = 7554, I_PSIGNW = 7537, I_PSLLD = 7057, + I_PSLLDQ = 9880, I_PSLLQ = 7072, I_PSLLW = 7042, I_PSRAD = 6743, I_PSRAW = 6728, + I_PSRLD = 6484, I_PSRLDQ = 9863, I_PSRLQ = 6499, I_PSRLW = 6469, I_PSUBB = 7177, + I_PSUBD = 7207, I_PSUBQ = 7222, I_PSUBSB = 6901, I_PSUBSW = 6918, I_PSUBUSB = 6585, + I_PSUBUSW = 6604, I_PSUBW = 7192, I_PSWAPD = 2103, I_PTEST = 7662, I_PUNPCKHBW = 3813, + I_PUNPCKHDQ = 3859, I_PUNPCKHQDQ = 3928, I_PUNPCKHWD = 3836, I_PUNPCKLBW = 3645, + I_PUNPCKLDQ = 3691, I_PUNPCKLQDQ = 3903, I_PUNPCKLWD = 3668, I_PUSH = 16, + I_PUSHA = 91, I_PUSHF = 270, I_PXOR = 7014, I_RCL = 976, I_RCPPS = 2986, I_RCPSS = 2993, + I_RCR = 981, I_RDFSBASE = 9915, I_RDGSBASE = 9945, I_RDMSR = 599, I_RDPMC = 606, + I_RDRAND = 10059, I_RDTSC = 592, I_RDTSCP = 1897, I_RET = 325, I_RETF = 354, + I_ROL = 966, I_ROR = 971, I_ROUNDPD = 9329, I_ROUNDPS = 9310, I_ROUNDSD = 9367, + I_ROUNDSS = 9348, I_RSM = 881, I_RSQRTPS = 2948, I_RSQRTSS = 2957, I_SAHF = 283, + I_SAL = 996, I_SALC = 393, I_SAR = 1001, I_SBB = 36, I_SCAS = 319, I_SETA = 806, + I_SETAE = 779, I_SETB = 773, I_SETBE = 799, I_SETG = 858, I_SETGE = 844, I_SETL = 838, + I_SETLE = 851, I_SETNO = 766, I_SETNP = 831, I_SETNS = 818, I_SETNZ = 792, + I_SETO = 760, I_SETP = 825, I_SETS = 812, I_SETZ = 786, I_SFENCE = 4354, I_SGDT = 1690, + I_SHL = 986, I_SHLD = 875, I_SHR = 991, I_SHRD = 891, I_SHUFPD = 6369, I_SHUFPS = 6361, + I_SIDT = 1696, I_SKINIT = 1872, I_SLDT = 1656, I_SMSW = 1714, I_SQRTPD = 2888, + I_SQRTPS = 2880, I_SQRTSD = 2904, I_SQRTSS = 2896, I_STAC = 1792, I_STC = 496, + I_STD = 516, I_STGI = 1860, I_STI = 506, I_STMXCSR = 9984, I_STOS = 307, I_STR = 1662, + I_SUB = 51, I_SUBPD = 3412, I_SUBPS = 3405, I_SUBSD = 3426, I_SUBSS = 3419, + I_SWAPGS = 1889, I_SYSCALL = 531, I_SYSENTER = 613, I_SYSEXIT = 623, I_SYSRET = 546, + I_TEST = 206, I_TZCNT = 4384, I_UCOMISD = 2775, I_UCOMISS = 2766, I_UD2 = 568, + I_UNPCKHPD = 2329, I_UNPCKHPS = 2319, I_UNPCKLPD = 2287, I_UNPCKLPS = 2277, + I_VADDPD = 3172, I_VADDPS = 3164, I_VADDSD = 3188, I_VADDSS = 3180, I_VADDSUBPD = 6447, + I_VADDSUBPS = 6458, I_VAESDEC = 9250, I_VAESDECLAST = 9271, I_VAESENC = 9208, + I_VAESENCLAST = 9229, I_VAESIMC = 9191, I_VAESKEYGENASSIST = 9845, I_VANDNPD = 3071, + I_VANDNPS = 3062, I_VANDPD = 3038, I_VANDPS = 3030, I_VBLENDPD = 9414, I_VBLENDPS = 9395, + I_VBLENDVPD = 9714, I_VBLENDVPS = 9703, I_VBROADCASTF128 = 7705, I_VBROADCASTSD = 7691, + I_VBROADCASTSS = 7677, I_VCMPEQPD = 5121, I_VCMPEQPS = 4719, I_VCMPEQSD = 5925, + I_VCMPEQSS = 5523, I_VCMPEQ_OSPD = 5302, I_VCMPEQ_OSPS = 4900, I_VCMPEQ_OSSD = 6106, + I_VCMPEQ_OSSS = 5704, I_VCMPEQ_UQPD = 5208, I_VCMPEQ_UQPS = 4806, I_VCMPEQ_UQSD = 6012, + I_VCMPEQ_UQSS = 5610, I_VCMPEQ_USPD = 5411, I_VCMPEQ_USPS = 5009, I_VCMPEQ_USSD = 6215, + I_VCMPEQ_USSS = 5813, I_VCMPFALSEPD = 5243, I_VCMPFALSEPS = 4841, I_VCMPFALSESD = 6047, + I_VCMPFALSESS = 5645, I_VCMPFALSE_OSPD = 5452, I_VCMPFALSE_OSPS = 5050, I_VCMPFALSE_OSSD = 6256, + I_VCMPFALSE_OSSS = 5854, I_VCMPGEPD = 5270, I_VCMPGEPS = 4868, I_VCMPGESD = 6074, + I_VCMPGESS = 5672, I_VCMPGE_OQPD = 5482, I_VCMPGE_OQPS = 5080, I_VCMPGE_OQSD = 6286, + I_VCMPGE_OQSS = 5884, I_VCMPGTPD = 5280, I_VCMPGTPS = 4878, I_VCMPGTSD = 6084, + I_VCMPGTSS = 5682, I_VCMPGT_OQPD = 5495, I_VCMPGT_OQPS = 5093, I_VCMPGT_OQSD = 6299, + I_VCMPGT_OQSS = 5897, I_VCMPLEPD = 5141, I_VCMPLEPS = 4739, I_VCMPLESD = 5945, + I_VCMPLESS = 5543, I_VCMPLE_OQPD = 5328, I_VCMPLE_OQPS = 4926, I_VCMPLE_OQSD = 6132, + I_VCMPLE_OQSS = 5730, I_VCMPLTPD = 5131, I_VCMPLTPS = 4729, I_VCMPLTSD = 5935, + I_VCMPLTSS = 5533, I_VCMPLT_OQPD = 5315, I_VCMPLT_OQPS = 4913, I_VCMPLT_OQSD = 6119, + I_VCMPLT_OQSS = 5717, I_VCMPNEQPD = 5164, I_VCMPNEQPS = 4762, I_VCMPNEQSD = 5968, + I_VCMPNEQSS = 5566, I_VCMPNEQ_OQPD = 5256, I_VCMPNEQ_OQPS = 4854, I_VCMPNEQ_OQSD = 6060, + I_VCMPNEQ_OQSS = 5658, I_VCMPNEQ_OSPD = 5468, I_VCMPNEQ_OSPS = 5066, I_VCMPNEQ_OSSD = 6272, + I_VCMPNEQ_OSSS = 5870, I_VCMPNEQ_USPD = 5356, I_VCMPNEQ_USPS = 4954, I_VCMPNEQ_USSD = 6160, + I_VCMPNEQ_USSS = 5758, I_VCMPNGEPD = 5221, I_VCMPNGEPS = 4819, I_VCMPNGESD = 6025, + I_VCMPNGESS = 5623, I_VCMPNGE_UQPD = 5424, I_VCMPNGE_UQPS = 5022, I_VCMPNGE_UQSD = 6228, + I_VCMPNGE_UQSS = 5826, I_VCMPNGTPD = 5232, I_VCMPNGTPS = 4830, I_VCMPNGTSD = 6036, + I_VCMPNGTSS = 5634, I_VCMPNGT_UQPD = 5438, I_VCMPNGT_UQPS = 5036, I_VCMPNGT_UQSD = 6242, + I_VCMPNGT_UQSS = 5840, I_VCMPNLEPD = 5186, I_VCMPNLEPS = 4784, I_VCMPNLESD = 5990, + I_VCMPNLESS = 5588, I_VCMPNLE_UQPD = 5384, I_VCMPNLE_UQPS = 4982, I_VCMPNLE_UQSD = 6188, + I_VCMPNLE_UQSS = 5786, I_VCMPNLTPD = 5175, I_VCMPNLTPS = 4773, I_VCMPNLTSD = 5979, + I_VCMPNLTSS = 5577, I_VCMPNLT_UQPD = 5370, I_VCMPNLT_UQPS = 4968, I_VCMPNLT_UQSD = 6174, + I_VCMPNLT_UQSS = 5772, I_VCMPORDPD = 5197, I_VCMPORDPS = 4795, I_VCMPORDSD = 6001, + I_VCMPORDSS = 5599, I_VCMPORD_SPD = 5398, I_VCMPORD_SPS = 4996, I_VCMPORD_SSD = 6202, + I_VCMPORD_SSS = 5800, I_VCMPTRUEPD = 5290, I_VCMPTRUEPS = 4888, I_VCMPTRUESD = 6094, + I_VCMPTRUESS = 5692, I_VCMPTRUE_USPD = 5508, I_VCMPTRUE_USPS = 5106, I_VCMPTRUE_USSD = 6312, + I_VCMPTRUE_USSS = 5910, I_VCMPUNORDPD = 5151, I_VCMPUNORDPS = 4749, I_VCMPUNORDSD = 5955, + I_VCMPUNORDSS = 5553, I_VCMPUNORD_SPD = 5341, I_VCMPUNORD_SPS = 4939, I_VCMPUNORD_SSD = 6145, + I_VCMPUNORD_SSS = 5743, I_VCOMISD = 2829, I_VCOMISS = 2820, I_VCVTDQ2PD = 6852, + I_VCVTDQ2PS = 3371, I_VCVTPD2DQ = 6863, I_VCVTPD2PS = 3307, I_VCVTPS2DQ = 3382, + I_VCVTPS2PD = 3296, I_VCVTSD2SI = 2755, I_VCVTSD2SS = 3329, I_VCVTSI2SD = 2569, + I_VCVTSI2SS = 2558, I_VCVTSS2SD = 3318, I_VCVTSS2SI = 2744, I_VCVTTPD2DQ = 6840, + I_VCVTTPS2DQ = 3393, I_VCVTTSD2SI = 2692, I_VCVTTSS2SI = 2680, I_VDIVPD = 3561, + I_VDIVPS = 3553, I_VDIVSD = 3577, I_VDIVSS = 3569, I_VDPPD = 9654, I_VDPPS = 9641, + I_VERR = 1678, I_VERW = 1684, I_VEXTRACTF128 = 9549, I_VEXTRACTPS = 9524, + I_VFMADD132PD = 8420, I_VFMADD132PS = 8407, I_VFMADD132SD = 8446, I_VFMADD132SS = 8433, + I_VFMADD213PD = 8700, I_VFMADD213PS = 8687, I_VFMADD213SD = 8726, I_VFMADD213SS = 8713, + I_VFMADD231PD = 8980, I_VFMADD231PS = 8967, I_VFMADD231SD = 9006, I_VFMADD231SS = 8993, + I_VFMADDSUB132PD = 8359, I_VFMADDSUB132PS = 8343, I_VFMADDSUB213PD = 8639, + I_VFMADDSUB213PS = 8623, I_VFMADDSUB231PD = 8919, I_VFMADDSUB231PS = 8903, + I_VFMSUB132PD = 8472, I_VFMSUB132PS = 8459, I_VFMSUB132SD = 8498, I_VFMSUB132SS = 8485, + I_VFMSUB213PD = 8752, I_VFMSUB213PS = 8739, I_VFMSUB213SD = 8778, I_VFMSUB213SS = 8765, + I_VFMSUB231PD = 9032, I_VFMSUB231PS = 9019, I_VFMSUB231SD = 9058, I_VFMSUB231SS = 9045, + I_VFMSUBADD132PD = 8391, I_VFMSUBADD132PS = 8375, I_VFMSUBADD213PD = 8671, + I_VFMSUBADD213PS = 8655, I_VFMSUBADD231PD = 8951, I_VFMSUBADD231PS = 8935, + I_VFNMADD132PD = 8525, I_VFNMADD132PS = 8511, I_VFNMADD132SD = 8553, I_VFNMADD132SS = 8539, + I_VFNMADD213PD = 8805, I_VFNMADD213PS = 8791, I_VFNMADD213SD = 8833, I_VFNMADD213SS = 8819, + I_VFNMADD231PD = 9085, I_VFNMADD231PS = 9071, I_VFNMADD231SD = 9113, I_VFNMADD231SS = 9099, + I_VFNMSUB132PD = 8581, I_VFNMSUB132PS = 8567, I_VFNMSUB132SD = 8609, I_VFNMSUB132SS = 8595, + I_VFNMSUB213PD = 8861, I_VFNMSUB213PS = 8847, I_VFNMSUB213SD = 8889, I_VFNMSUB213SS = 8875, + I_VFNMSUB231PD = 9141, I_VFNMSUB231PS = 9127, I_VFNMSUB231SD = 9169, I_VFNMSUB231SS = 9155, + I_VHADDPD = 4230, I_VHADDPS = 4239, I_VHSUBPD = 4264, I_VHSUBPS = 4273, I_VINSERTF128 = 9536, + I_VINSERTPS = 9590, I_VLDDQU = 7034, I_VLDMXCSR = 9974, I_VMASKMOVDQU = 7164, + I_VMASKMOVPD = 7982, I_VMASKMOVPS = 7970, I_VMAXPD = 3621, I_VMAXPS = 3613, + I_VMAXSD = 3637, I_VMAXSS = 3629, I_VMCALL = 1734, I_VMCLEAR = 10022, I_VMFUNC = 1814, + I_VMINPD = 3501, I_VMINPS = 3493, I_VMINSD = 3517, I_VMINSS = 3509, I_VMLAUNCH = 1742, + I_VMLOAD = 1844, I_VMMCALL = 1835, I_VMOVAPD = 2509, I_VMOVAPS = 2500, I_VMOVD = 3965, + I_VMOVDDUP = 2267, I_VMOVDQA = 3995, I_VMOVDQU = 4004, I_VMOVHLPS = 2228, + I_VMOVHPD = 2415, I_VMOVHPS = 2406, I_VMOVLHPS = 2396, I_VMOVLPD = 2247, I_VMOVLPS = 2238, + I_VMOVMSKPD = 2869, I_VMOVMSKPS = 2858, I_VMOVNTDQ = 6891, I_VMOVNTDQA = 7938, + I_VMOVNTPD = 2626, I_VMOVNTPS = 2616, I_VMOVQ = 3972, I_VMOVSD = 2176, I_VMOVSHDUP = 2424, + I_VMOVSLDUP = 2256, I_VMOVSS = 2168, I_VMOVUPD = 2159, I_VMOVUPS = 2150, I_VMPSADBW = 9670, + I_VMPTRLD = 10013, I_VMPTRST = 6418, I_VMREAD = 4161, I_VMRESUME = 1752, I_VMRUN = 1828, + I_VMSAVE = 1852, I_VMULPD = 3232, I_VMULPS = 3224, I_VMULSD = 3248, I_VMULSS = 3240, + I_VMWRITE = 4185, I_VMXOFF = 1762, I_VMXON = 10031, I_VORPD = 3099, I_VORPS = 3092, + I_VPABSB = 7728, I_VPABSD = 7758, I_VPABSW = 7743, I_VPACKSSDW = 3892, I_VPACKSSWB = 3724, + I_VPACKUSDW = 7959, I_VPACKUSWB = 3802, I_VPADDB = 7244, I_VPADDD = 7274, + I_VPADDQ = 6521, I_VPADDSB = 6971, I_VPADDSW = 6988, I_VPADDUSW = 6662, I_VPADDW = 7259, + I_VPALIGNR = 9452, I_VPAND = 6646, I_VPANDN = 6705, I_VPAVGB = 6720, I_VPAVGW = 6765, + I_VPBLENDVB = 9725, I_VPBLENDW = 9433, I_VPCLMULQDQ = 9691, I_VPCMPEQB = 4085, + I_VPCMPEQD = 4123, I_VPCMPEQQ = 7918, I_VPCMPEQW = 4104, I_VPCMPESTRI = 9770, + I_VPCMPESTRM = 9747, I_VPCMPGTB = 3744, I_VPCMPGTD = 3782, I_VPCMPGTQ = 8129, + I_VPCMPGTW = 3763, I_VPCMPISTRI = 9816, I_VPCMPISTRM = 9793, I_VPERM2F128 = 9298, + I_VPERMILPD = 7603, I_VPERMILPS = 7592, I_VPEXTRB = 9470, I_VPEXTRD = 9495, + I_VPEXTRQ = 9504, I_VPEXTRW = 6352, I_VPHADDD = 7416, I_VPHADDSW = 7434, I_VPHADDW = 7399, + I_VPHMINPOSUW = 8304, I_VPHSUBD = 7492, I_VPHSUBSW = 7510, I_VPHSUBW = 7475, + I_VPINSRB = 9571, I_VPINSRD = 9617, I_VPINSRQ = 9626, I_VPINSRW = 6335, I_VPMADDUBSW = 7455, + I_VPMADDWD = 7115, I_VPMAXSB = 8215, I_VPMAXSD = 8232, I_VPMAXSW = 7005, I_VPMAXUB = 6689, + I_VPMAXUD = 8266, I_VPMAXUW = 8249, I_VPMINSB = 8147, I_VPMINSD = 8164, I_VPMINSW = 6943, + I_VPMINUB = 6631, I_VPMINUD = 8198, I_VPMINUW = 8181, I_VPMOVMSKB = 6574, + I_VPMOVSXBD = 7797, I_VPMOVSXBQ = 7818, I_VPMOVSXBW = 7776, I_VPMOVSXDQ = 7881, + I_VPMOVSXWD = 7839, I_VPMOVSXWQ = 7860, I_VPMOVZXBD = 8025, I_VPMOVZXBQ = 8046, + I_VPMOVZXBW = 8004, I_VPMOVZXDQ = 8109, I_VPMOVZXWD = 8067, I_VPMOVZXWQ = 8088, + I_VPMULDQ = 7900, I_VPMULHRSW = 7581, I_VPMULHUW = 6782, I_VPMULHW = 6800, + I_VPMULLD = 8283, I_VPMULLW = 6537, I_VPMULUDQ = 7096, I_VPOR = 6957, I_VPSADBW = 7133, + I_VPSHUFB = 7382, I_VPSHUFD = 4047, I_VPSHUFHW = 4056, I_VPSHUFLW = 4066, + I_VPSIGNB = 7528, I_VPSIGND = 7562, I_VPSIGNW = 7545, I_VPSLLD = 7064, I_VPSLLDQ = 9888, + I_VPSLLQ = 7079, I_VPSLLW = 7049, I_VPSRAD = 6750, I_VPSRAW = 6735, I_VPSRLD = 6491, + I_VPSRLDQ = 9871, I_VPSRLQ = 6506, I_VPSRLW = 6476, I_VPSUBB = 7184, I_VPSUBD = 7214, + I_VPSUBQ = 7229, I_VPSUBSB = 6909, I_VPSUBSW = 6926, I_VPSUBUSB = 6594, I_VPSUBUSW = 6613, + I_VPSUBW = 7199, I_VPTEST = 7669, I_VPUNPCKHBW = 3824, I_VPUNPCKHDQ = 3870, + I_VPUNPCKHQDQ = 3940, I_VPUNPCKHWD = 3847, I_VPUNPCKLBW = 3656, I_VPUNPCKLDQ = 3702, + I_VPUNPCKLQDQ = 3915, I_VPUNPCKLWD = 3679, I_VPXOR = 7020, I_VRCPPS = 3000, + I_VRCPSS = 3008, I_VROUNDPD = 9338, I_VROUNDPS = 9319, I_VROUNDSD = 9376, + I_VROUNDSS = 9357, I_VRSQRTPS = 2966, I_VRSQRTSS = 2976, I_VSHUFPD = 6386, + I_VSHUFPS = 6377, I_VSQRTPD = 2921, I_VSQRTPS = 2912, I_VSQRTSD = 2939, I_VSQRTSS = 2930, + I_VSTMXCSR = 10003, I_VSUBPD = 3441, I_VSUBPS = 3433, I_VSUBSD = 3457, I_VSUBSS = 3449, + I_VTESTPD = 7623, I_VTESTPS = 7614, I_VUCOMISD = 2794, I_VUCOMISS = 2784, + I_VUNPCKHPD = 2350, I_VUNPCKHPS = 2339, I_VUNPCKLPD = 2308, I_VUNPCKLPS = 2297, + I_VXORPD = 3128, I_VXORPS = 3120, I_VZEROALL = 4151, I_VZEROUPPER = 4139, + I_WAIT = 10053, I_WBINVD = 560, I_WRFSBASE = 9964, I_WRGSBASE = 9993, I_WRMSR = 585, + I_XABORT = 1006, I_XADD = 945, I_XBEGIN = 1014, I_XCHG = 212, I_XEND = 1822, + I_XGETBV = 1798, I_XLAT = 399, I_XOR = 61, I_XORPD = 3113, I_XORPS = 3106, + I_XRSTOR = 4306, I_XRSTOR64 = 4314, I_XSAVE = 4282, I_XSAVE64 = 4289, I_XSAVEOPT = 4332, + I_XSAVEOPT64 = 4342, I_XSETBV = 1806, I__3DNOW = 10067 +} _InstructionType; + +typedef enum { + R_RAX, R_RCX, R_RDX, R_RBX, R_RSP, R_RBP, R_RSI, R_RDI, R_R8, R_R9, R_R10, R_R11, R_R12, R_R13, R_R14, R_R15, + R_EAX, R_ECX, R_EDX, R_EBX, R_ESP, R_EBP, R_ESI, R_EDI, R_R8D, R_R9D, R_R10D, R_R11D, R_R12D, R_R13D, R_R14D, R_R15D, + R_AX, R_CX, R_DX, R_BX, R_SP, R_BP, R_SI, R_DI, R_R8W, R_R9W, R_R10W, R_R11W, R_R12W, R_R13W, R_R14W, R_R15W, + R_AL, R_CL, R_DL, R_BL, R_AH, R_CH, R_DH, R_BH, R_R8B, R_R9B, R_R10B, R_R11B, R_R12B, R_R13B, R_R14B, R_R15B, + R_SPL, R_BPL, R_SIL, R_DIL, + R_ES, R_CS, R_SS, R_DS, R_FS, R_GS, + R_RIP, + R_ST0, R_ST1, R_ST2, R_ST3, R_ST4, R_ST5, R_ST6, R_ST7, + R_MM0, R_MM1, R_MM2, R_MM3, R_MM4, R_MM5, R_MM6, R_MM7, + R_XMM0, R_XMM1, R_XMM2, R_XMM3, R_XMM4, R_XMM5, R_XMM6, R_XMM7, R_XMM8, R_XMM9, R_XMM10, R_XMM11, R_XMM12, R_XMM13, R_XMM14, R_XMM15, + R_YMM0, R_YMM1, R_YMM2, R_YMM3, R_YMM4, R_YMM5, R_YMM6, R_YMM7, R_YMM8, R_YMM9, R_YMM10, R_YMM11, R_YMM12, R_YMM13, R_YMM14, R_YMM15, + R_CR0, R_UNUSED0, R_CR2, R_CR3, R_CR4, R_UNUSED1, R_UNUSED2, R_UNUSED3, R_CR8, + R_DR0, R_DR1, R_DR2, R_DR3, R_UNUSED4, R_UNUSED5, R_DR6, R_DR7 +} _RegisterType; + +#endif /* MNEMONICS_H */ diff --git a/NativeCore/Dependencies/distorm/src/config.h b/NativeCore/Dependencies/distorm/src/config.h new file mode 100644 index 00000000..6febad67 --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/config.h @@ -0,0 +1,181 @@ +/* +config.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef CONFIG_H +#define CONFIG_H + +/* diStorm version number. */ +#define __DISTORMV__ 0x030503 + +#include /* memset, memcpy - can be easily self implemented for libc independency. */ + +#include "../include/distorm.h" + + +/* + * 64 bit offsets support: + * This macro should be defined from compiler command line flags, e.g: -DSUPPORT_64BIT_OFFSET + * Note: make sure that the caller (library user) defines it too! + */ +/* #define SUPPORT_64BIT_OFFSET */ + +/* + * If you compile diStorm as a dynamic library (.dll or .so) file, make sure you uncomment the next line. + * So the interface functions will be exported, otherwise they are useable only for static library. + * For example, this macro is being set for compiling diStorm as a .dll for Python with CTypes. + */ +/* #define DISTORM_DYNAMIC */ + +/* + * If DISTORM_LIGHT is defined, everything involved in formatting the instructions + * as text will be excluded from compilation. + * distorm_decode(..) and distorm_format(..) will not be available. + * This will decrease the size of the executable and leave you with decomposition functionality only. + * + * Note: it should be either set in the preprocessor definitions manually or in command line -D switch. + * #define DISTORM_LIGHT + */ + +/* + * diStorm now supports little/big endian CPU's. + * It should detect the endianness according to predefined macro's of the compiler. + * If you don't use GCC/MSVC you will have to define it on your own. + */ + +/* These macros are used in order to make the code portable. */ +#ifdef __GNUC__ + +#include + +#define _DLLEXPORT_ +#define _FASTCALL_ +/* Keep inline as static (arrrrg) as it would break linux on some flavors otherwise. */ +#define _INLINE_ static +/* GCC ignores this directive... */ +/*#define _FASTCALL_ __attribute__((__fastcall__))*/ + +/* Set endianity (supposed to be LE though): */ +#ifdef __BIG_ENDIAN__ + #define BE_SYSTEM +#endif + +/* End of __GCC__ */ + +#elif __WATCOMC__ + +#include + +#define _DLLEXPORT_ +#define _FASTCALL_ +#define _INLINE_ __inline + +/* End of __WATCOMC__ */ + +#elif __DMC__ + +#include + +#define _DLLEXPORT_ +#define _FASTCALL_ +#define _INLINE_ __inline + +/* End of __DMC__ */ + +#elif __TINYC__ + +#include + +#define _DLLEXPORT_ +#define _FASTCALL_ +#define _INLINE_ static + +/* End of __TINYC__ */ + +#elif _MSC_VER + +/* stdint alternative is defined in distorm.h */ + +#define _DLLEXPORT_ __declspec(dllexport) +#define _FASTCALL_ __fastcall +#define _INLINE_ __inline + +/* Set endianity (supposed to be LE though): */ +#if !defined(_M_IX86) && !defined(_M_X64) + #define BE_SYSTEM +#endif + +#endif /* #elif _MSC_VER */ + +/* If the library isn't compiled as a dynamic library don't export any functions. */ +#ifndef DISTORM_DYNAMIC +#undef _DLLEXPORT_ +#define _DLLEXPORT_ +#endif + +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef TRUE +#define TRUE 1 +#endif + +/* Define stream read functions for big endian systems. */ +#ifdef BE_SYSTEM + +/* Avoid defining 'static static' for GCC. */ +#ifndef __GNUC__ +#define STATIC_INLINE static _INLINE_ +#else +#define STATIC_INLINE static +#endif + +/* + * Assumption: These functions can read from the stream safely! + * Swap endianity of input to little endian. + */ +STATIC_INLINE int16_t RSHORT(const uint8_t *s) +{ + return s[0] | (s[1] << 8); +} +STATIC_INLINE uint16_t RUSHORT(const uint8_t *s) +{ + return s[0] | (s[1] << 8); +} +STATIC_INLINE int32_t RLONG(const uint8_t *s) +{ + return s[0] | (s[1] << 8) | (s[2] << 16) | (s[3] << 24); +} +STATIC_INLINE uint32_t RULONG(const uint8_t *s) +{ + return s[0] | (s[1] << 8) | (s[2] << 16) | (s[3] << 24); +} +STATIC_INLINE int64_t RLLONG(const uint8_t *s) +{ + return s[0] | (s[1] << 8) | (s[2] << 16) | (s[3] << 24) | ((uint64_t)s[4] << 32) | ((uint64_t)s[5] << 40) | ((uint64_t)s[6] << 48) | ((uint64_t)s[7] << 56); +} +STATIC_INLINE uint64_t RULLONG(const uint8_t *s) +{ + return s[0] | (s[1] << 8) | (s[2] << 16) | (s[3] << 24) | ((uint64_t)s[4] << 32) | ((uint64_t)s[5] << 40) | ((uint64_t)s[6] << 48) | ((uint64_t)s[7] << 56); +} + +#undef STATIC_INLINE + +#else +/* Little endian macro's will just make the cast. */ +#define RSHORT(x) *(int16_t *)x +#define RUSHORT(x) *(uint16_t *)x +#define RLONG(x) *(int32_t *)x +#define RULONG(x) *(uint32_t *)x +#define RLLONG(x) *(int64_t *)x +#define RULLONG(x) *(uint64_t *)x +#endif + +#endif /* CONFIG_H */ diff --git a/NativeCore/Dependencies/distorm/src/decoder.c b/NativeCore/Dependencies/distorm/src/decoder.c new file mode 100644 index 00000000..29adcd43 --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/decoder.c @@ -0,0 +1,574 @@ +/* +decoder.c + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#include "decoder.h" +#include "instructions.h" +#include "insts.h" +#include "prefix.h" +#include "x86defs.h" +#include "operands.h" +#include "insts.h" +#include "../include/mnemonics.h" + + +/* Instruction Prefixes - Opcode - ModR/M - SIB - Displacement - Immediate */ + +static _DecodeType decode_get_effective_addr_size(_DecodeType dt, _iflags decodedPrefixes) +{ + /* + * Map from the current decoding mode to an effective address size: + * Decode16 -> Decode32 + * Decode32 -> Decode16 + * Decode64 -> Decode32 + */ + + /* Switch to non default mode if prefix exists, only for ADDRESS SIZE. */ + if (decodedPrefixes & INST_PRE_ADDR_SIZE) { + if (dt == Decode32Bits) return Decode16Bits; + return Decode32Bits; + } + return dt; +} + +static _DecodeType decode_get_effective_op_size(_DecodeType dt, _iflags decodedPrefixes, unsigned int rex, _iflags instFlags) +{ + /* + * Map from the current decoding mode to an effective operand size: + * Decode16 -> Decode32 + * Decode32 -> Decode16 + * Decode64 -> Decode16 + * Not that in 64bits it's a bit more complicated, because of REX and promoted instructions. + */ + + if (decodedPrefixes & INST_PRE_OP_SIZE) { + if (dt == Decode16Bits) return Decode32Bits; + return Decode16Bits; + } + + if (dt == Decode64Bits) { + /* + * REX Prefix toggles data size to 64 bits. + * Operand size prefix toggles data size to 16. + * Default data size is 32 bits. + * Promoted instructions are 64 bits if they don't require a REX perfix. + * Non promoted instructions are 64 bits if the REX prefix exists. + */ + /* Automatically promoted instructions have only INST_64BITS SET! */ + if (((instFlags & (INST_64BITS | INST_PRE_REX)) == INST_64BITS) || + /* Other instructions in 64 bits can be promoted only with a REX prefix. */ + ((decodedPrefixes & INST_PRE_REX) && (rex & PREFIX_EX_W))) return Decode64Bits; + return Decode32Bits; /* Default. */ + } + + return dt; +} + +/* + * A helper macro to convert from diStorm's CPU flags to EFLAGS. + * Copy eflags from compact version (8 bits) to eflags compatible (16 bits). + * From D_COMPACT_IF to D_IF, bit index 1 to 9. + * From D_COMPACT_DF to D_DF, bit index 3 to 10. + * From D_COMPACT_OF to D_OF, bit index 5 to 11. + */ +#define CONVERT_FLAGS_TO_EFLAGS(dst, src, field) dst->field = ((src->field & D_COMPACT_SAME_FLAGS) | \ + ((src->field & D_COMPACT_IF) << (9 - 1)) | \ + ((src->field & D_COMPACT_DF) << (10 - 3)) | \ + ((src->field & D_COMPACT_OF) << (11 - 5))); + +/* If DECRES_SUCCESS is returned, CI is in sync, otherwise it loses sync. */ +/* Important note: CI is keeping track only for code and codeLen, in case of a failure caller has to restart on their own. */ +static _DecodeResult decode_inst(_CodeInfo* ci, _PrefixState* ps, const uint8_t* startCode, _DInst* di) +{ + /* Holds the info about the current found instruction. */ + _InstInfo* ii; + _InstSharedInfo* isi; + + /* Calculate (and cache) effective-operand-size and effective-address-size only once. */ + _DecodeType effOpSz, effAdrSz; + _iflags instFlags; + + /* The ModR/M byte of the current instruction. */ + unsigned int modrm = 0; + int isPrefixed = 0; + + ii = inst_lookup(ci, ps, &isPrefixed); + if (ii == NULL) goto _Undecodable; + + isi = &InstSharedInfoTable[ii->sharedIndex]; + instFlags = FlagsTable[isi->flagsIndex]; + + /* Cache the effective operand-size and address-size. */ + if (isPrefixed) { + + /* + * If both REX and OpSize are available we will have to disable the OpSize, because REX has precedence. + * However, only if REX.W is set! + * We had to wait with this test, since the operand size may be a mandatory prefix, + * and we know it only after fetching opcode. + */ + if ((ps->decodedPrefixes & INST_PRE_OP_SIZE) && + (ps->prefixExtType == PET_REX) && + (ps->vrex & PREFIX_EX_W) && + (!ps->isOpSizeMandatory)) { + ps->decodedPrefixes &= ~INST_PRE_OP_SIZE; + prefixes_ignore(ps, PFXIDX_OP_SIZE); + } + + effAdrSz = decode_get_effective_addr_size(ci->dt, ps->decodedPrefixes); + effOpSz = decode_get_effective_op_size(ci->dt, ps->decodedPrefixes, ps->vrex, instFlags); + } + else + { + effAdrSz = ci->dt; /* Default is current decoding type since there's no prefix. */ + effOpSz = decode_get_effective_op_size(ci->dt, 0, 0, instFlags); + } + + /* + * In this point we know the instruction we are about to decode and its operands (unless, it's an invalid one!), + * so it makes it the right time for decoding-type suitability testing. + * Which practically means, don't allow 32 bits instructions in 16 bits decoding mode, but do allow + * 16 bits instructions in 32 bits decoding mode, of course... + + * NOTE: Make sure the instruction set for 32 bits has explicitly this specific flag set. + * NOTE2: Make sure the instruction set for 64 bits has explicitly this specific flag set. + + * If this is the case, drop what we've got and restart all over after DB'ing that byte. + + * Though, don't drop an instruction which is also supported in 16 and 32 bits. + */ + + /* ! ! ! DISABLED UNTIL FURTHER NOTICE ! ! ! Decode16Bits CAN NOW DECODE 32 BITS INSTRUCTIONS ! ! !*/ + /* if (ii && (dt == Decode16Bits) && (instFlags & INST_32BITS) && (~instFlags & INST_16BITS)) ii = NULL; */ + + memset(di, 0, sizeof(_DInst)); + + if (instFlags & INST_MODRM_REQUIRED) { + /* If the ModRM byte is not part of the opcode, skip the last byte code, so code points now to ModRM. */ + if (!(instFlags & INST_MODRM_INCLUDED)) { + ci->code++; + if (--ci->codeLen < 0) goto _Undecodable; + } + modrm = *ci->code; + } + + ci->code++; /* Skip the last byte we just read (either last opcode's byte code or a ModRM). */ + + di->addr = ci->codeOffset & ci->addrMask; + di->opcode = ii->opcodeId; + di->flags = isi->meta & META_INST_PRIVILEGED; + + /* + * Store the address size inside the flags. + * This is necessary for the caller to know the size of rSP when using PUSHA for example. + */ + di->base = R_NONE; + di->segment = R_NONE; + + FLAG_SET_ADDRSIZE(di, effAdrSz); + + /* Try to extract the next operand only if the latter exists. */ + if (isi->d != OT_NONE) { + unsigned int opsNo = 1; + _Operand* op = &di->ops[0]; + if (instFlags & (INST_MODRR_REQUIRED | INST_FORCE_REG0)) { + /* Some instructions enforce that mod=11, so validate that. */ + if ((modrm < INST_DIVIDED_MODRM) && (instFlags & INST_MODRR_REQUIRED)) goto _Undecodable; + /* Some instructions enforce that reg=000, so validate that. (Specifically EXTRQ). */ + if ((instFlags & INST_FORCE_REG0) && (((modrm >> 3) & 7) != 0)) goto _Undecodable; + } + if (!operands_extract(ci, di, ii, instFlags, (_OpType)isi->d, modrm, ps, effOpSz, effAdrSz, op++)) goto _Undecodable; + + if (isi->s != OT_NONE) { + if (!operands_extract(ci, di, ii, instFlags, (_OpType)isi->s, modrm, ps, effOpSz, effAdrSz, op++)) goto _Undecodable; + opsNo++; + /* Use third operand, only if the flags says this InstInfo requires it. */ + if (instFlags & INST_USE_OP3) { + if (!operands_extract(ci, di, ii, instFlags, (_OpType)((_InstInfoEx*)ii)->op3, modrm, ps, effOpSz, effAdrSz, op++)) goto _Undecodable; + opsNo++; + /* Support for a fourth operand is added for (e.g:) INSERTQ instruction. */ + if (instFlags & INST_USE_OP4) { + if (!operands_extract(ci, di, ii, instFlags, (_OpType)((_InstInfoEx*)ii)->op4, modrm, ps, effOpSz, effAdrSz, op++)) goto _Undecodable; + opsNo++; + } + } + } + + /* Copy DST_WR flag. */ + di->flags |= (instFlags & INST_DST_WR) >> (31 - 6); /* Copy bit from INST_DST_WR (bit 31) to FLAG_DST_WR (bit 6). */ + /* operands_extract may touched it for FPU operands, so add on top. */ + di->opsNo += (uint8_t)opsNo; + } + + if (instFlags & (INST_3DNOW_FETCH | + INST_PSEUDO_OPCODE | + INST_NATIVE | + INST_PRE_REPNZ | + INST_PRE_REP | + INST_PRE_ADDR_SIZE | + INST_INVALID_64BITS | + INST_64BITS_FETCH)) { /* 8 for 1! */ + + /* If it's a native instruction copy OpSize Prefix. */ + if (ps && instFlags & INST_NATIVE) ps->usedPrefixes |= (ps->decodedPrefixes & INST_PRE_OP_SIZE); + + if (ci->dt != Decode64Bits) { + /* If it's only a 64 bits instruction drop it in other decoding modes. */ + if (instFlags & INST_64BITS_FETCH) goto _Undecodable; + } + else { + /* Drop instructions which are invalid in 64 bits. */ + if (instFlags & INST_INVALID_64BITS) goto _Undecodable; + } + + /* If it were a 3DNow! instruction, we will have to find the instruction itself now that we got its operands extracted. */ + if (instFlags & INST_3DNOW_FETCH) { + ii = inst_lookup_3dnow(ci); + if (ii == NULL) goto _Undecodable; + isi = &InstSharedInfoTable[ii->sharedIndex]; + instFlags = FlagsTable[isi->flagsIndex]; + di->opcode = ii->opcodeId; + } + + /* Check whether pseudo opcode is needed, only for CMP instructions: */ + if (instFlags & INST_PSEUDO_OPCODE) { + /* Used only for special CMP instructions which have pseudo opcodes suffix. */ + unsigned int cmpType; + + if (--ci->codeLen < 0) goto _Undecodable; + cmpType = *ci->code; + ci->code++; + + /* + * The opcodeId is the offset to the FIRST pseudo compare mnemonic, + * we will have to fix it so it offsets into the corrected mnemonic. + * Therefore, we use another table to fix the offset. + */ + if (instFlags & INST_PRE_VEX) { + /* AVX Comparison type must be between 0 to 32, otherwise Reserved. */ + if (cmpType >= INST_VCMP_MAX_RANGE) goto _Undecodable; + + /* Use the AVX pseudo compare mnemonics table. */ + di->opcode = ii->opcodeId + VCmpMnemonicOffsets[cmpType]; + } + else { + /* SSE Comparison type must be between 0 to 8, otherwise Reserved. */ + if (cmpType >= INST_CMP_MAX_RANGE) goto _Undecodable; + di->opcode = ii->opcodeId + CmpMnemonicOffsets[cmpType]; + } + + goto _SkipOpcoding; + } + + /* Start with prefix REP/N/Z. */ + if (isPrefixed && (instFlags & (INST_PRE_REPNZ | INST_PRE_REP))) { + if ((instFlags & INST_PRE_REPNZ) && (ps->decodedPrefixes & INST_PRE_REPNZ)) { + ps->usedPrefixes |= INST_PRE_REPNZ; + di->flags |= FLAG_REPNZ; + } + else if ((instFlags & INST_PRE_REP) && (ps->decodedPrefixes & INST_PRE_REP)) { + ps->usedPrefixes |= INST_PRE_REP; + di->flags |= FLAG_REP; + } + } + + if (instFlags & INST_PRE_ADDR_SIZE) { + /* If it's JeCXZ the ADDR_SIZE prefix affects them. */ + if (instFlags & INST_USE_EXMNEMONIC) { + ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + if (effAdrSz == Decode16Bits) di->opcode = ii->opcodeId; + else if (effAdrSz == Decode32Bits) di->opcode = ((_InstInfoEx*)ii)->opcodeId2; + /* Ignore REX.W in 64bits, JECXZ is promoted. */ + else /* Decode64Bits */ di->opcode = ((_InstInfoEx*)ii)->opcodeId3; + } + + /* LOOPxx instructions are also native instruction, but they are special case ones, ADDR_SIZE prefix affects them. */ + else if (instFlags & INST_NATIVE) { + di->opcode = ii->opcodeId; + + /* If LOOPxx gets here from 64bits, it must be Decode32Bits because Address Size prefix is set. */ + ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + } + + goto _SkipOpcoding; + } + } + + /* + * If we reached here the instruction was fully decoded, we located the instruction in the DB and extracted operands. + * Use the correct mnemonic according to the DT. + * If we are in 32 bits decoding mode it doesn't necessarily mean we will choose mnemonic2, alas, + * it means that if there is a mnemonic2, it will be used. + * Note: + * If the instruction is prefixed by operand size we will format it in the non-default decoding mode! + * So there might be a situation that an instruction of 32 bit gets formatted in 16 bits decoding mode. + * Both ways should end up with a correct and expected formatting of the text. + */ + if (effOpSz == Decode32Bits) { /* Decode32Bits */ + + /* Set operand size. */ + FLAG_SET_OPSIZE(di, Decode32Bits); + + /* Give a chance for special mnemonic instruction in 32 bits decoding. */ + if (instFlags & INST_USE_EXMNEMONIC) { + /* Is it a special instruction which has another mnemonic for mod=11 ? */ + if (instFlags & INST_MNEMONIC_MODRM_BASED) { + if (modrm < INST_DIVIDED_MODRM) di->opcode = ((_InstInfoEx*)ii)->opcodeId2; + } + else di->opcode = ((_InstInfoEx*)ii)->opcodeId2; + ps->usedPrefixes |= INST_PRE_OP_SIZE; + } + } + else if (effOpSz == Decode64Bits) { /* Decode64Bits, note that some instructions might be decoded in Decode32Bits above. */ + + /* Set operand size. */ + FLAG_SET_OPSIZE(di, Decode64Bits); + + if (instFlags & (INST_USE_EXMNEMONIC | INST_USE_EXMNEMONIC2)) { + /* + * We shouldn't be here for MODRM based mnemonics with a MOD=11, + * because they must not use REX (otherwise it will get to the wrong instruction which share same opcode). + * See XRSTOR and XSAVEOPT. + */ + if ((modrm >= INST_DIVIDED_MODRM) && (instFlags & INST_MNEMONIC_MODRM_BASED)) goto _Undecodable; + + /* Use third mnemonic, for 64 bits. */ + if ((instFlags & INST_USE_EXMNEMONIC2) && (ps->vrex & PREFIX_EX_W)) { + ps->usedPrefixes |= INST_PRE_REX; + di->opcode = ((_InstInfoEx*)ii)->opcodeId3; + } + else di->opcode = ((_InstInfoEx*)ii)->opcodeId2; /* Use second mnemonic. */ + } + } + else { /* Decode16Bits */ + + /* Set operand size. */ + FLAG_SET_OPSIZE(di, Decode16Bits); + + /* + * If it's a special instruction which has two mnemonics, then use the 16 bits one + update usedPrefixes. + * Note: use 16 bits mnemonic if that instruction supports 32 bit or 64 bit explicitly. + */ + if ((instFlags & (INST_USE_EXMNEMONIC | INST_32BITS | INST_64BITS)) == INST_USE_EXMNEMONIC) ps->usedPrefixes |= INST_PRE_OP_SIZE; + } + +_SkipOpcoding: + + /* Check VEX mnemonics: */ + if (isPrefixed && (instFlags & INST_PRE_VEX) && + (((((_InstInfoEx*)ii)->flagsEx & INST_MNEMONIC_VEXW_BASED) && (ps->vrex & PREFIX_EX_W)) || + ((((_InstInfoEx*)ii)->flagsEx & INST_MNEMONIC_VEXL_BASED) && (ps->vrex & PREFIX_EX_L)))) { + di->opcode = ((_InstInfoEx*)ii)->opcodeId2; + } + + /* Instruction's size should include prefixes too if exist. */ + di->size = (uint8_t)(ci->code - startCode); + /* + * There's a limit of 15 bytes on instruction length. The only way to violate + * this limit is by putting redundant prefixes before an instruction. + * start points to first prefix if any, otherwise it points to instruction first byte. + */ + if (di->size > INST_MAXIMUM_SIZE) goto _Undecodable; + + /* Set the unused prefixes mask, if any prefixes (not) used at all. */ + if (isPrefixed) di->unusedPrefixesMask = prefixes_set_unused_mask(ps); + + /* Copy instruction meta. */ + di->meta = isi->meta; + + if (ci->features & DF_FILL_EFLAGS) { + /* Copy CPU affected flags. */ + if (isi->testedFlagsMask) CONVERT_FLAGS_TO_EFLAGS(di, isi, testedFlagsMask); + if (isi->modifiedFlagsMask) CONVERT_FLAGS_TO_EFLAGS(di, isi, modifiedFlagsMask); + if (isi->undefinedFlagsMask) CONVERT_FLAGS_TO_EFLAGS(di, isi, undefinedFlagsMask); + } + + /* + * Instruction can still be invalid if it's total length is over 15 bytes with prefixes. + * Up to the caller to check that. + */ + return DECRES_SUCCESS; + +_Undecodable: /* If the instruction couldn't be decoded for some reason, fail. */ + /* Special case for WAIT instruction: If it's dropped as a prefix, we have to return a valid instruction! */ + if (*startCode == INST_WAIT_INDEX) { + int delta; + memset(di, 0, sizeof(_DInst)); + di->addr = ci->codeOffset & ci->addrMask; + di->imm.byte = INST_WAIT_INDEX; + di->segment = R_NONE; + di->base = R_NONE; + di->size = 1; + di->opcode = I_WAIT; + META_SET_ISC(di, ISC_INTEGER); + + /* Fix ci because WAIT could be a prefix that failed, and ci->code is now out of sync. */ + delta = (int)(ci->code - startCode); /* How many bytes we read so far. */ + ci->codeLen += delta - 1; + ci->code = startCode + 1; + /* codeOffset is fixed outside. */ + + return DECRES_SUCCESS; + } + + /* Mark that we didn't manage to decode the instruction well, caller will drop it. */ + return DECRES_INPUTERR; +} + +/* + * decode_internal + * + * supportOldIntr - Since now we work with new structure instead of the old _DecodedInst, we are still interested in backward compatibility. + * So although, the array is now of type _DInst, we want to read it in jumps of the old array element's size. + * This is in order to save memory allocation for conversion between the new and the old structures. + * It really means we can do the conversion in-place now. + */ +_DecodeResult decode_internal(_CodeInfo* _ci, int supportOldIntr, _DInst result[], unsigned int maxResultCount, unsigned int* usedInstructionsCount) +{ + _CodeInfo ci = *_ci; /* A working copy, we don't touch user's _ci except OUT params. */ + _PrefixState ps; + /* Bookkeep these from ci below, as it makes things way simpler. */ + const uint8_t* code; + int codeLen; + _OffsetType codeOffset; + + _DecodeResult ret = DECRES_SUCCESS; + + /* Current working decoded instruction in results. */ + _DInst* pdi = (_DInst*)&result[0]; /* There's always a room for at least one slot, checked earlier. */ + _DInst* maxResultAddr; + + unsigned int features = ci.features; + + unsigned int diStructSize; + /* Use next entry. */ +#ifndef DISTORM_LIGHT + if (supportOldIntr) { + diStructSize = sizeof(_DecodedInst); + maxResultAddr = (_DInst*)((size_t)&result[0] + (maxResultCount * sizeof(_DecodedInst))); + } + else +#endif /* DISTORM_LIGHT */ + { + diStructSize = sizeof(_DInst); + maxResultAddr = &result[maxResultCount]; + } + + ci.addrMask = (_OffsetType)-1; + +#ifdef DISTORM_LIGHT + supportOldIntr; /* Unreferenced. */ + + /* + * Only truncate address if we are using the decompose interface. + * Otherwise, we use the textual interface which needs full addresses for formatting bytes output. + * So distorm_format will truncate later. + */ + if (features & DF_MAXIMUM_ADDR32) ci.addrMask = 0xffffffff; + else if (features & DF_MAXIMUM_ADDR16) ci.addrMask = 0xffff; +#endif + + ps.count = 1; /* Force zero'ing ps below. */ + + /* Decode instructions as long as we have what to decode/enough room in entries. */ + while (ci.codeLen > 0) { + code = ci.code; + codeLen = ci.codeLen; + codeOffset = ci.codeOffset; + + if (ps.count) memset(&ps, 0, sizeof(ps)); + + /**** INSTRUCTION DECODING NEXT: ****/ + + /* Make sure we didn't run out of output entries. */ + if (pdi >= maxResultAddr) { + ret = DECRES_MEMORYERR; + break; + } + + ret = decode_inst(&ci, &ps, code, pdi); + /* decode_inst keeps track (only if successful!) for code and codeLen but ignores codeOffset, fix it here. */ + ci.codeOffset += pdi->size; + + if (ret == DECRES_SUCCESS) { + + if (features & (DF_SINGLE_BYTE_STEP | DF_RETURN_FC_ONLY | DF_STOP_ON_PRIVILEGED | DF_STOP_ON_FLOW_CONTROL)) { + + /* Sync codeinfo, remember that currently it points to beginning of the instruction and prefixes if any. */ + if (features & DF_SINGLE_BYTE_STEP) { + ci.code = code + 1; + ci.codeLen = codeLen - 1; + ci.codeOffset = codeOffset + 1; + } + + /* See if we need to filter this instruction. */ + if ((features & DF_RETURN_FC_ONLY) && (META_GET_FC(pdi->meta) == FC_NONE)) { + continue; + } + + /* Check whether we need to stop on any feature. */ + if ((features & DF_STOP_ON_PRIVILEGED) && (FLAG_GET_PRIVILEGED(pdi->flags))) { + pdi = (_DInst*)((char*)pdi + diStructSize); + break; /* ret = DECRES_SUCCESS; */ + } + + if (features & DF_STOP_ON_FLOW_CONTROL) { + unsigned int mfc = META_GET_FC(pdi->meta); + if (mfc && (((features & DF_STOP_ON_CALL) && (mfc == FC_CALL)) || + ((features & DF_STOP_ON_RET) && (mfc == FC_RET)) || + ((features & DF_STOP_ON_SYS) && (mfc == FC_SYS)) || + ((features & DF_STOP_ON_UNC_BRANCH) && (mfc == FC_UNC_BRANCH)) || + ((features & DF_STOP_ON_CND_BRANCH) && (mfc == FC_CND_BRANCH)) || + ((features & DF_STOP_ON_INT) && (mfc == FC_INT)) || + ((features & DF_STOP_ON_CMOV) && (mfc == FC_CMOV)) || + ((features & DF_STOP_ON_HLT) && (mfc == FC_HLT)))) { + pdi = (_DInst*)((char*)pdi + diStructSize); + break; /* ret = DECRES_SUCCESS; */ + } + } + } + + /* Allocate at least one more entry to use, for the next instruction. */ + pdi = (_DInst*)((char*)pdi + diStructSize); + } + else { /* ret == DECRES_INPUTERR */ + + /* Handle failure of decoding last instruction. */ + if ((!(features & DF_RETURN_FC_ONLY))) { + memset(pdi, 0, sizeof(_DInst)); + pdi->flags = FLAG_NOT_DECODABLE; + pdi->imm.byte = *code; + pdi->size = 1; + pdi->addr = codeOffset & ci.addrMask; + pdi = (_DInst*)((char*)pdi + diStructSize); + + /* If an instruction wasn't decoded then stop on undecodeable if set. */ + if (features & DF_STOP_ON_UNDECODEABLE) { + ret = DECRES_SUCCESS; + break; + } + } + + /* Skip a single byte in case of a failure and retry instruction. */ + ci.code = code + 1; + ci.codeLen = codeLen - 1; + ci.codeOffset = codeOffset + 1; + + /* Reset return value. */ + ret = DECRES_SUCCESS; + } + } + + /* Set OUT params. */ + *usedInstructionsCount = (unsigned int)(((size_t)pdi - (size_t)result) / (size_t)diStructSize); + _ci->nextOffset = ci.codeOffset; + + return ret; +} diff --git a/NativeCore/Dependencies/distorm/src/decoder.h b/NativeCore/Dependencies/distorm/src/decoder.h new file mode 100644 index 00000000..c40cb646 --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/decoder.h @@ -0,0 +1,21 @@ +/* +decoder.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef DECODER_H +#define DECODER_H + +#include "config.h" + +typedef unsigned int _iflags; + +_DecodeResult decode_internal(_CodeInfo* _ci, int supportOldIntr, _DInst result[], unsigned int maxResultCount, unsigned int* usedInstructionsCount); + +#endif /* DECODER_H */ diff --git a/NativeCore/Dependencies/distorm/src/distorm.c b/NativeCore/Dependencies/distorm/src/distorm.c new file mode 100644 index 00000000..e54c28bb --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/distorm.c @@ -0,0 +1,419 @@ +/* +distorm.c + +diStorm3 C Library Interface +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#include "../include/distorm.h" +#include "config.h" +#include "decoder.h" +#include "x86defs.h" +#include "textdefs.h" +#include "wstring.h" +#include "../include/mnemonics.h" + +/* C DLL EXPORTS */ +#ifdef SUPPORT_64BIT_OFFSET + _DLLEXPORT_ _DecodeResult distorm_decompose64(_CodeInfo* ci, _DInst result[], unsigned int maxInstructions, unsigned int* usedInstructionsCount) +#else + _DLLEXPORT_ _DecodeResult distorm_decompose32(_CodeInfo* ci, _DInst result[], unsigned int maxInstructions, unsigned int* usedInstructionsCount) +#endif +{ + if (usedInstructionsCount == NULL) { + return DECRES_SUCCESS; + } + + if ((ci == NULL) || + (ci->codeLen < 0) || + ((unsigned)ci->dt > (unsigned)Decode64Bits) || + (ci->code == NULL) || + (result == NULL) || + (maxInstructions == 0) || + ((ci->features & (DF_MAXIMUM_ADDR16 | DF_MAXIMUM_ADDR32)) == (DF_MAXIMUM_ADDR16 | DF_MAXIMUM_ADDR32))) + { + return DECRES_INPUTERR; + } + + return decode_internal(ci, FALSE, result, maxInstructions, usedInstructionsCount); +} + +#ifndef DISTORM_LIGHT + +/* Helper function to concatenate an explicit size when it's unknown from the operands. */ +static void distorm_format_size(unsigned char** str, const _DInst* di, int opNum) +{ + int isSizingRequired = 0; + /* + * We only have to output the size explicitly if it's not clear from the operands. + * For example: + * mov al, [0x1234] -> The size is 8, we know it from the AL register operand. + * mov [0x1234], 0x11 -> Now we don't know the size. Pam pam pam + * + * If given operand number is higher than 2, then output the size anyways. + */ + isSizingRequired = ((opNum >= 2) || ((opNum == 0) && (di->ops[0].type != O_REG) && (di->ops[1].type != O_REG))); + + /* Still not sure? Try some special instructions. */ + if (!isSizingRequired) { + /* + * INS/OUTS are exception, because DX is a port specifier and not a real src/dst register. + * A few exceptions that always requires sizing: + * MOVZX, MOVSX, MOVSXD. + * ROL, ROR, RCL, RCR, SHL, SHR, SAL, SAR. + * SHLD, SHRD. + * CVTSI2SS is also an exception. + */ + switch (di->opcode) + { + case I_INS: + case I_OUTS: + case I_MOVZX: + case I_MOVSX: + case I_MOVSXD: + case I_ROL: + case I_ROR: + case I_RCL: + case I_RCR: + case I_SHL: + case I_SHR: + case I_SAL: + case I_SAR: + case I_SHLD: + case I_SHRD: + case I_CVTSI2SS: + isSizingRequired = 1; + break; + default: /* Instruction doesn't require sizing. */ break; + } + } + + if (isSizingRequired) + { + /*case 0: break; OT_MEM's unknown size. */ + switch (di->ops[opNum].size / 8) + { + case 1: strcat_WS(*str, "BYTE ", 8, 5); break; + case 2: strcat_WS(*str, "WORD ", 8, 5); break; + case 4: strcat_WS(*str, "DWORD ", 8, 6); break; + case 8: strcat_WS(*str, "QWORD ", 8, 6); break; + case 10: strcat_WS(*str, "TBYTE ", 8, 6); break; + case 16: strcat_WS(*str, "DQWORD ", 8, 7); break; + case 32: strcat_WS(*str, "YWORD ", 8, 6); break; + } + } +} + +static void distorm_format_signed_disp(unsigned char** str, const _DInst* di, uint64_t addrMask) +{ + int64_t tmpDisp64; + + if (di->dispSize) { + if (((int64_t)di->disp < 0)) { + chrcat_WS(*str, MINUS_DISP_CHR); + tmpDisp64 = -(int64_t)di->disp; + tmpDisp64 &= addrMask; /* Verify only for neg numbers. */ + } + else { + chrcat_WS(*str, PLUS_DISP_CHR); + tmpDisp64 = di->disp; + } + str_int(str, tmpDisp64); + } +} + +static uint8_t prefixTable[6][8] = { "", "LOCK ", "REPNZ ", "REPNZ ", "REP ", "REPZ " }; +static unsigned int prefixSizesTable[6] = { 0, 5, 6, 6, 4, 5 }; +static uint8_t suffixTable[10] = { 0, 'B', 'W', 0, 'D', 0, 0, 0, 'Q' }; + +/* WARNING: This function is written carefully to be able to work with same input and output buffer in-place! */ +#ifdef SUPPORT_64BIT_OFFSET + _DLLEXPORT_ void distorm_format64(const _CodeInfo* ci, const _DInst* di, _DecodedInst* result) +#else + _DLLEXPORT_ void distorm_format32(const _CodeInfo* ci, const _DInst* di, _DecodedInst* result) +#endif +{ + unsigned char* str; + int64_t tmpDisp64; + uint64_t addrMask = (uint64_t)-1; + const _WMnemonic* mnemonic; + int suffixSize = -1; + unsigned int i; + + /* Set address mask, when default is for 64bits addresses. */ + if (ci->features & DF_USE_ADDR_MASK) addrMask = ci->addrMask; + else { + if (ci->features & DF_MAXIMUM_ADDR32) addrMask = 0xffffffff; + else if (ci->features & DF_MAXIMUM_ADDR16) addrMask = 0xffff; + } + + /* Gotta have full address for (di->addr - ci->codeOffset) to work in all modes. */ + str_hex(&result->instructionHex, (const uint8_t*)&ci->code[(unsigned int)(di->addr - ci->codeOffset)], di->size); + + if ((int)((int16_t)di->flags) == -1) { + /* In-place considerations: DI is RESULT. Deref fields first. */ + unsigned int size = di->size; + unsigned int byte = di->imm.byte; + _OffsetType offset = di->addr & addrMask; + + result->offset = offset; + result->size = size; + str = (unsigned char*)&result->mnemonic.p; + strcat_WS(str, "DB ", 4, 3); + str_int(&str, byte); + strfinalize_WS(result->mnemonic, str); + *(uint64_t*)&result->operands = 0; /* Clears length and the string at once. */ + return; /* Skip to next instruction. */ + } + + str = (unsigned char*)&result->operands.p; + + /* Special treatment for String (movs, cmps, stos, lods, scas) instructions. */ + if ((di->opcode >= I_MOVS) && (di->opcode <= I_SCAS)) { + /* + * No operands are needed if the address size is the default one, + * and no segment is overridden, so add the suffix letter, + * to indicate size of operation and continue to next instruction. + */ + if ((SEGMENT_IS_DEFAULT_OR_NONE(di->segment)) && (FLAG_GET_ADDRSIZE(di->flags) == ci->dt)) { + suffixSize = di->ops[0].size / 8; + goto skipOperands; + } + suffixSize = 0; /* Marks it's a string instruction. */ + } + + for (i = 0; i < di->opsNo; i++) { + unsigned int type = di->ops[i].type; + if (i > 0) strcat_WS(str, ", ", 2, 2); + if (type == O_REG) { + strcat_WSR(&str, &_REGISTERS[di->ops[i].index]); + } + else if (type == O_IMM) { + /* If the instruction is 'push', show explicit size (except byte imm). */ + if ((di->opcode == I_PUSH) && (di->ops[i].size != 8)) distorm_format_size(&str, di, i); + /* Special fix for negative sign extended immediates. */ + if ((di->flags & FLAG_IMM_SIGNED) && (di->ops[i].size == 8) && (di->imm.sbyte < 0)) { + chrcat_WS(str, MINUS_DISP_CHR); + tmpDisp64 = -di->imm.sbyte; + str_int(&str, tmpDisp64); + } + else { + /* Notice signedness and size of the immediate. */ + if (di->ops[i].size == 0x20) str_int(&str, di->imm.dword); + else str_int(&str, di->imm.qword); + } + } + else if (type == O_PC) { +#ifdef SUPPORT_64BIT_OFFSET + str_int(&str, (di->size + di->imm.sqword + di->addr) & addrMask); +#else + tmpDisp64 = ((_OffsetType)di->imm.sdword + di->addr + di->size) & (uint32_t)addrMask; + str_int(&str, tmpDisp64); +#endif + } + else if (type == O_DISP) { + distorm_format_size(&str, di, i); + chrcat_WS(str, OPEN_CHR); + if (!SEGMENT_IS_DEFAULT_OR_NONE(di->segment)) { + strcat_WSR(&str, &_REGISTERS[SEGMENT_GET_UNSAFE(di->segment)]); + chrcat_WS(str, SEG_OFF_CHR); + } + tmpDisp64 = di->disp & addrMask; + str_int(&str, tmpDisp64); + chrcat_WS(str, CLOSE_CHR); + } + else if (type == O_SMEM) { + int isDefault; + int segment; + distorm_format_size(&str, di, i); + chrcat_WS(str, OPEN_CHR); + + segment = SEGMENT_GET(di->segment); + isDefault = SEGMENT_IS_DEFAULT(di->segment); + + /* + * This is where we need to take special care for String instructions. + * If we got here, it means we need to explicitly show their operands. + * The problem with CMPS and MOVS is that they have two(!) memory operands. + * So we have to complement(!) them ourselves, since the isntruction structure supplies only the segment that can be overridden. + * And make the rest of the String operations explicit. + * We ignore default ES/DS in 64 bits. + * ["MOVS"], [OPT.REGI_EDI, OPT.REGI_ESI] -- DS can be overridden. + * ["CMPS"], [OPT.REGI_ESI, OPT.REGI_EDI] -- DS can be overriden. + * + * suffixSize == 0 was set above for string opcode already. + */ + if (suffixSize == 0) { + if (((di->opcode == I_MOVS) && (i == 0)) || ((di->opcode == I_CMPS) && (i == 1))) { + if (ci->dt != Decode64Bits) { + segment = R_ES; + isDefault = FALSE; + } + else isDefault = TRUE; + } + else if (isDefault && ((di->opcode == I_MOVS) || (di->opcode == I_CMPS))) { + if (ci->dt != Decode64Bits) { + segment = R_DS; + isDefault = FALSE; + } + } + } + if (!isDefault && (segment != R_NONE)) { + strcat_WSR(&str, &_REGISTERS[segment]); + chrcat_WS(str, SEG_OFF_CHR); + } + + strcat_WSR(&str, &_REGISTERS[di->ops[i].index]); + + distorm_format_signed_disp(&str, di, addrMask); + chrcat_WS(str, CLOSE_CHR); + } + else if (type == O_MEM) { + distorm_format_size(&str, di, i); + chrcat_WS(str, OPEN_CHR); + if (!SEGMENT_IS_DEFAULT_OR_NONE(di->segment)) { + strcat_WSR(&str, &_REGISTERS[SEGMENT_GET_UNSAFE(di->segment)]); + chrcat_WS(str, SEG_OFF_CHR); + } + if (di->base != R_NONE) { + strcat_WSR(&str, &_REGISTERS[di->base]); + chrcat_WS(str, PLUS_DISP_CHR); + } + strcat_WSR(&str, &_REGISTERS[di->ops[i].index]); + if (di->scale != 0) { + switch (di->scale) + { + case 2: strcat_WS(str, "*2", 2, 2); break; + case 4: strcat_WS(str, "*4", 2, 2); break; + case 8: strcat_WS(str, "*8", 2, 2); break; + } + } + distorm_format_signed_disp(&str, di, addrMask); + chrcat_WS(str, CLOSE_CHR); + } + else if (type == O_PTR) { + str_int(&str, di->imm.ptr.seg); + chrcat_WS(str, SEG_OFF_CHR); + str_int(&str, di->imm.ptr.off); + } + else if (type == O_IMM1) { + str_int(&str, di->imm.ex.i1); + } + else if (type == O_IMM2) { + str_int(&str, di->imm.ex.i2); + } + } + +skipOperands: + + /* Finalize the operands string. */ + strfinalize_WS(result->operands, str); + + /* Not used anymore. + if (di->flags & FLAG_HINT_TAKEN) strcat_WSN(str, " ;TAKEN"); + else if (di->flags & FLAG_HINT_NOT_TAKEN) strcat_WSN(str, " ;NOT TAKEN"); + */ + { + /* In-place considerations: DI is RESULT. Deref fields first. */ + unsigned int opcode = di->opcode; + unsigned int prefix = FLAG_GET_PREFIX(di->flags); + unsigned int size = di->size; + _OffsetType offset = di->addr & addrMask; + str = (unsigned char*)&result->mnemonic.p; + mnemonic = (const _WMnemonic*)&_MNEMONICS[opcode]; + + if (prefix) { + /* REP prefix for CMPS and SCAS is really a REPZ. */ + prefix += (opcode == I_CMPS); + prefix += (opcode == I_SCAS); + memcpy(str, &prefixTable[prefix][0], 8); + str += prefixSizesTable[prefix]; + } + + /* + * Always copy 16 bytes from the mnemonic, we have a sentinel padding so we can read past. + * This helps the compiler to remove the call to memcpy and therefore makes this copying much faster. + * The longest instruction is exactly 16 chars long, so we null terminate the string below. + */ + memcpy((int8_t*)str, mnemonic->p, 16); + str += mnemonic->length; + + if (suffixSize > 0) { + *str++ = suffixTable[suffixSize]; + } + strfinalize_WS(result->mnemonic, str); + + result->offset = offset; + result->size = size; + } +} + +#ifdef SUPPORT_64BIT_OFFSET + _DLLEXPORT_ _DecodeResult distorm_decode64(_OffsetType codeOffset, const unsigned char* code, int codeLen, _DecodeType dt, _DecodedInst result[], unsigned int maxInstructions, unsigned int* usedInstructionsCount) +#else + _DLLEXPORT_ _DecodeResult distorm_decode32(_OffsetType codeOffset, const unsigned char* code, int codeLen, _DecodeType dt, _DecodedInst result[], unsigned int maxInstructions, unsigned int* usedInstructionsCount) +#endif +{ + _DecodeResult res; + _CodeInfo ci; + unsigned int i, instsCount; + + *usedInstructionsCount = 0; + + /* I use codeLen as a signed variable in order to ease detection of underflow... and besides - */ + if (codeLen < 0) { + return DECRES_INPUTERR; + } + + if ((unsigned)dt > (unsigned)Decode64Bits) { + return DECRES_INPUTERR; + } + + /* Make sure there's at least one instruction in the result buffer. */ + if ((code == NULL) || (result == NULL) || (maxInstructions == 0)) { + return DECRES_INPUTERR; + } + + /* + * We have to format the result into text. But the interal decoder works with the new structure of _DInst. + * Therefore, we will pass the result array(!) from the caller and the interal decoder will fill it in with _DInst's. + * Then we will copy each result to a temporary structure, and use it to reformat that specific result. + * + * This is all done to save memory allocation and to work on the same result array in-place!!! + * It's a bit ugly, I have to admit, but worth it. + */ + + ci.codeOffset = codeOffset; + ci.code = code; + ci.codeLen = codeLen; + ci.dt = dt; + ci.features = DF_USE_ADDR_MASK; + if (dt == Decode16Bits) ci.addrMask = 0xffff; + else if (dt == Decode32Bits) ci.addrMask = 0xffffffff; + else ci.addrMask = (_OffsetType)-1; + + res = decode_internal(&ci, TRUE, (_DInst*)result, maxInstructions, usedInstructionsCount); + instsCount = *usedInstructionsCount; + for (i = 0; i < instsCount; i++) { + /* distorm_format is optimized and can work with same input/output buffer in-place. */ +#ifdef SUPPORT_64BIT_OFFSET + distorm_format64(&ci, (_DInst*)&result[i], &result[i]); +#else + distorm_format32(&ci, (_DInst*)&result[i], &result[i]); +#endif + } + + return res; +} + +#endif /* DISTORM_LIGHT */ + +_DLLEXPORT_ unsigned int distorm_version(void) +{ + return __DISTORMV__; +} diff --git a/NativeCore/Dependencies/distorm/src/instructions.c b/NativeCore/Dependencies/distorm/src/instructions.c new file mode 100644 index 00000000..ff1c43cd --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/instructions.c @@ -0,0 +1,611 @@ +/* +instructions.c + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#include "instructions.h" + +#include "insts.h" +#include "prefix.h" +#include "x86defs.h" +#include "../include/mnemonics.h" + + +/* Helper macros to extract the type or index from an inst-node value. */ +#define INST_NODE_INDEX(n) ((n) & 0x1fff) +#define INST_NODE_TYPE(n) ((n) >> 13) + +/* Helper macro to read the actual flags that are associated with an inst-info. */ +#define INST_INFO_FLAGS(ii) (FlagsTable[InstSharedInfoTable[(ii)->sharedIndex].flagsIndex]) + +/* +I use the trie data structure as I found it most fitting to a disassembler mechanism. +When you read a byte and have to decide if it's enough or you should read more bytes, 'till you get to the instruction information. +It's really fast because you POP the instruction info in top 3 iterates on the DB, because an instruction can be formed from two bytes + 3 bits reg from the ModR/M byte. +For a simple explanation, check this out: +http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Tree/Trie/ +Further reading: http://en.wikipedia.org/wiki/Trie + +The first GATE (array you read off a trie data structure), as I call them, is statically allocated by the compiler. +The second and third gates if used are being allocated dynamically by the instructions-insertion functionality. + +How would such a thing look in memory, say we support 4 instructions with 3 bytes top (means 2 dynamically allocated gates). + +-> +|-------| 0, +|0| -------------------------------> |-------| +|1|RET | 1, |0|AND | +|2| -----> |-------| |1|XOR | +|3|INT3 | |0|PUSH | |2|OR | 0,3, +|-------| |1|POP | |3| --------->|-------| + |2|PUSHF| |-------| |0|ROR | + |3|POPF | |1|ROL | + |-------| |2|SHR | + |3|SHL | + |-------| + +Of course, this is NOT how Intel instructions set looks!!! +but I just wanted to give a small demonstration. +Now the instructions you get from such a trie DB goes like this: + +0, 0 - AND +0, 1 - XOR +0, 2 - OR +0, 3, 0, ROR +0, 3, 1, ROL +0, 3, 2, SHR +0, 3, 3, SHL +1 - RET +2, 0 - PUSH +2, 1 - POP +2, 2 - PUSHF +2, 3 - POPF +3 - INT3 + +I guess it's clear by now. +So now, if you read 0, you know that you have to enter the second gate(list) with the second byte specifying the index. +But if you read 1, you know that you go to an instruction (in this case, a RET). +That's why there's an Instruction-Node structure, it tells you whether you got to an instruction or another list +so you should keep on reading byte). + +In Intel, you could go through 4 gates at top, because there are instructions which are built from 2 bytes and another smaller list +for the REG part, or newest SSE4 instructions which use 4 bytes for opcode. +Therefore, Intel's first gate is 256 long, and other gates are 256 (/72) or 8 long, yes, it costs pretty much a lot of memory +for non-used defined instructions, but I think that it still rocks. +*/ + +/* + * A helper function to look up the correct inst-info structure. + * It does one fetch from the index-table, and then another to get the inst-info. + * Note that it takes care about basic inst-info or inst-info-ex. + * The caller should worry about boundary checks and whether it accesses a last-level table. + */ +static _InstInfo* inst_get_info(_InstNode in, int index) +{ + int instIndex = 0; + + in = InstructionsTree[INST_NODE_INDEX(in) + index]; + if (in == INT_NOTEXISTS) return NULL; + + instIndex = INST_NODE_INDEX(in); + return INST_NODE_TYPE(in) == INT_INFO ? &InstInfos[instIndex] : (_InstInfo*)&InstInfosEx[instIndex]; +} + +/* + * This function is responsible to return the instruction information of the first found in code. + * It returns the _InstInfo of the found instruction, otherwise NULL. + * code should point to the ModR/M byte upon exit (if used), or after the instruction binary code itself. + * This function is NOT decoding-type dependant, it is up to the caller to see whether the instruction is valid. + * Get the instruction info, using a Trie data structure. + * + * Sometimes normal prefixes become mandatory prefixes, which means they are now part of the instruction opcode bytes. + + * This is a bit tricky now, + * if the first byte is a REP (F3) prefix, we will have to give a chance to an SSE instruction. + * If an instruction doesn't exist, we will make it as a prefix and re-locateinst. + * A case such that a REP prefix is being changed into an instruction byte and also an SSE instruction will not be found can't happen, + * simply because there are no collisions between string instruction and SSE instructions (they are escaped). + + * As for S/SSE2/3, check for F2 and 66 as well. + + * In 64 bits, we have to make sure that we will skip the REX prefix, if it exists. + * There's a specific case, where a 66 is mandatory but it was dropped because REG.W was used, + * but it doesn't behave as an operand size prefix but as a mandatory, so we will have to take it into account. + + * For example (64 bits decoding mode): + * 66 98 CBW + * 48 98 CDQE + * 66 48 98: db 0x66; CDQE + * Shows that operand size is dropped. + + * Now, it's a mandatory prefix and NOT an operand size one. + * 66480f2dc0 db 0x48; CVTPD2PI XMM0, XMM0 + * Although this instruction doesn't require a REX.W, it just shows, that even if it did - it doesn't matter. + * REX.W is dropped because it's not required, but the decode function disabled the operand size even so. + */ +static _InstInfo* inst_lookup_prefixed(_InstNode in, _PrefixState* ps) +{ + int checkOpSize = FALSE; + int index = 0; + _InstInfo* ii = NULL; + + /* Check prefixes of current decoded instruction (None, 0x66, 0xf3, 0xf2). */ + switch (ps->decodedPrefixes & (INST_PRE_OP_SIZE | INST_PRE_REPS)) + { + case 0: + /* Non-prefixed, index = 0. */ + index = 0; + break; + case INST_PRE_OP_SIZE: + /* 0x66, index = 1. */ + index = 1; + /* Mark that we used it as a mandatory prefix. */ + ps->isOpSizeMandatory = TRUE; + ps->decodedPrefixes &= ~INST_PRE_OP_SIZE; + break; + case INST_PRE_REP: + /* 0xf3, index = 2. */ + index = 2; + ps->decodedPrefixes &= ~INST_PRE_REP; + break; + case INST_PRE_REPNZ: + /* 0xf2, index = 3. */ + index = 3; + ps->decodedPrefixes &= ~INST_PRE_REPNZ; + break; + default: + /* + * Now we got a problem, since there are a few mandatory prefixes at once. + * There is only one case when it's ok, when the operand size prefix is for real (not mandatory). + * Otherwise we will have to return NULL, since the instruction is illegal. + * Therefore we will start with REPNZ and REP prefixes, + * try to get the instruction and only then check for the operand size prefix. + */ + + /* If both REPNZ and REP are together, it's illegal for sure. */ + if ((ps->decodedPrefixes & INST_PRE_REPS) == INST_PRE_REPS) return NULL; + + /* Now we know it's either REPNZ+OPSIZE or REP+OPSIZE, so examine the instruction. */ + if (ps->decodedPrefixes & INST_PRE_REPNZ) { + index = 3; + ps->decodedPrefixes &= ~INST_PRE_REPNZ; + } + else if (ps->decodedPrefixes & INST_PRE_REP) { + index = 2; + ps->decodedPrefixes &= ~INST_PRE_REP; + } + /* Mark to verify the operand-size prefix of the fetched instruction below. */ + checkOpSize = TRUE; + break; + } + + /* Fetch the inst-info from the index. */ + ii = inst_get_info(in, index); + + if (checkOpSize) { + /* If the instruction doesn't support operand size prefix, then it's illegal. */ + if ((ii == NULL) || (~INST_INFO_FLAGS(ii) & INST_PRE_OP_SIZE)) return NULL; + } + + /* If there was a prefix, but the instruction wasn't found. Try to fall back to use the normal instruction. */ + if (ii == NULL) ii = inst_get_info(in, 0); + return ii; +} + +/* A helper function to look up special VEX instructions. + * See if it's a MOD based instruction and fix index if required. + * Only after a first lookup (that was done by caller), we can tell if we need to fix the index. + * Because these are coupled instructions + * (which means that the base instruction hints about the other instruction). + * Note that caller should check if it's a MOD dependent instruction before getting in here. + */ +static _InstInfo* inst_vex_mod_lookup(_CodeInfo* ci, _InstNode in, _InstInfo* ii, unsigned int index) +{ + /* Advance to read the MOD from ModRM byte. */ + ci->code += 1; + ci->codeLen -= 1; + if (ci->codeLen < 0) return NULL; + if (*ci->code < INST_DIVIDED_MODRM) { + /* MOD is not 11, therefore change the index to 8 - 12 range in the prefixed table. */ + index += 4; + /* Make a second lookup for this special instruction. */ + return inst_get_info(in, index); + } + /* Return the original one, in case we didn't find a suited instruction. */ + return ii; +} + +static _InstInfo* inst_vex_lookup(_CodeInfo* ci, _PrefixState* ps) +{ + _InstNode in = 0; + unsigned int pp = 0, start = 0; + unsigned int index = 4; /* VEX instructions start at index 4 in the Prefixed table. */ + uint8_t vex = *ps->vexPos, vex2 = 0, v = 0; + int instType = 0, instIndex = 0; + + /* The VEX instruction will #ud if any of 66, f0, f2, f3, REX prefixes precede. */ + _iflags illegal = (INST_PRE_OP_SIZE | INST_PRE_LOCK | INST_PRE_REP | INST_PRE_REPNZ | INST_PRE_REX); + if ((ps->decodedPrefixes & illegal) != 0) return NULL; + + /* Read the some fields from the VEX prefix we need to extract the instruction. */ + if (ps->prefixExtType == PET_VEX2BYTES) { + ps->vexV = v = (~vex >> 3) & 0xf; + pp = vex & 3; + /* Implied leading 0x0f byte by default for 2 bytes VEX prefix. */ + start = 1; + } + else { /* PET_VEX3BYTES */ + start = vex & 0x1f; + vex2 = *(ps->vexPos + 1); + ps->vexV = v = (~vex2 >> 3) & 0xf; + pp = vex2 & 3; + } + + /* start can be either 1 (0x0f), 2 (0x0f, 0x038) or 3 (0x0f, 0x3a), otherwise it's illegal. */ + switch (start) + { + case 1: in = Table_0F; break; + case 2: in = Table_0F_38; break; + case 3: in = Table_0F_3A; break; + default: return NULL; + } + + /* pp is actually the implied mandatory prefix, apply it to the index. */ + index += pp; /* (None, 0x66, 0xf3, 0xf2) */ + + /* Read a byte from the stream. */ + ci->codeLen -= 1; + if (ci->codeLen < 0) return NULL; + + in = InstructionsTree[INST_NODE_INDEX(in) + *ci->code]; + if (in == INT_NOTEXISTS) return NULL; + + instType = INST_NODE_TYPE(in); + instIndex = INST_NODE_INDEX(in); + + /* + * If we started with 0f38 or 0f3a so it's a prefixed table, + * therefore it's surely a VEXed instruction (because of a high index). + * However, starting with 0f, could also lead immediately to a prefixed table for some bytes. + * it might return NULL, if the index is invalid. + */ + if (instType == INT_LIST_PREFIXED) { + _InstInfo* ii = inst_get_info(in, index); + /* See if the instruction is dependent on MOD. */ + if ((ii != NULL) && (((_InstInfoEx*)ii)->flagsEx & INST_MODRR_BASED)) { + ii = inst_vex_mod_lookup(ci, in, ii, index); + } + return ii; + } + + /* + * If we reached here, obviously we started with 0f. VEXed instructions must be nodes of a prefixed table. + * But since we found an instruction (or divided one), just return NULL. + * They cannot lead to a VEXed instruction. + */ + if ((instType == INT_INFO) || (instType == INT_INFOEX) || (instType == INT_LIST_DIVIDED)) return NULL; + + /* Now we are left with handling either GROUP or FULL tables, therefore we will read another byte from the stream. */ + ci->code += 1; + ci->codeLen -= 1; + if (ci->codeLen < 0) return NULL; + + if (instType == INT_LIST_GROUP) { + in = InstructionsTree[instIndex + ((*ci->code >> 3) & 7)]; + /* Continue below to check prefixed table. */ + } + else if (instType == INT_LIST_FULL) { + in = InstructionsTree[instIndex + *ci->code]; + /* Continue below to check prefixed table. */ + } + + /* Now that we got to the last table in the trie, check for a prefixed table. */ + if (INST_NODE_TYPE(in) == INT_LIST_PREFIXED) { + _InstInfo* ii = inst_get_info(in, index); + /* See if the instruction is dependent on MOD. */ + if ((ii != NULL) && (((_InstInfoEx*)ii)->flagsEx & INST_MODRR_BASED)) { + ii = inst_vex_mod_lookup(ci, in, ii, index); + } + return ii; + } + + /* No VEXed instruction was found. */ + return NULL; +} + +_InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps, int* isPrefixed) +{ + unsigned int tmpIndex0, tmpIndex1, tmpIndex2; + int instType; + _InstNode in; + _InstInfo* ii = NULL; + int isWaitIncluded = FALSE; + + /* Always safe to read first byte codeLen > 0. */ + tmpIndex0 = *ci->code; + + if (prefixes_is_valid((unsigned char)tmpIndex0, ci->dt)) { + *isPrefixed = TRUE; + prefixes_decode(ci, ps); + if (ci->codeLen < 1) return NULL; /* No more bytes for opcode, halt. */ + tmpIndex0 = *ci->code; /* Reload. */ + + /* If there are too many prefixes, it will be checked later in decode_inst. */ + + /* See whether we have to handle a VEX prefixed instruction. */ + if (ps->decodedPrefixes & INST_PRE_VEX) { + ii = inst_vex_lookup(ci, ps); + if (ii != NULL) { + /* Make sure that VEX.L exists when forced. */ + if ((((_InstInfoEx*)ii)->flagsEx & INST_FORCE_VEXL) && (~ps->vrex & PREFIX_EX_L)) return NULL; + /* If the instruction doesn't use VEX.vvvv it must be zero. */ + if ((((_InstInfoEx*)ii)->flagsEx & INST_VEX_V_UNUSED) && ps->vexV) return NULL; + } + return ii; + } + } + + /* Account first byte, we know it's safe to read. */ + ci->codeLen -= 1; + + /* Check for special 0x9b, WAIT instruction, which can be part of some instructions(x87). */ + if (tmpIndex0 == INST_WAIT_INDEX) { + /* Only OCST_1dBYTES get a chance to include this byte as part of the opcode. */ + isWaitIncluded = TRUE; + + /* Ignore all prefixes, since they are useless and operate on the WAIT instruction itself. */ + prefixes_ignore_all(ps); + + /* Move to next code byte as a new whole instruction. */ + ci->code += 1; + ci->codeLen -= 1; + if (ci->codeLen < 0) return NULL; /* Faster to return NULL, it will be detected as WAIT later anyway. */ + /* Since we got a WAIT prefix, we re-read the first byte. */ + tmpIndex0 = *ci->code; + } + + /* Walk first byte in InstructionsTree root. */ + in = InstructionsTree[tmpIndex0]; + if ((uint32_t)in == INT_NOTEXISTS) return NULL; + instType = INST_NODE_TYPE(in); + + /* Single byte instruction (OCST_1BYTE). */ + if ((instType < INT_INFOS) && (!isWaitIncluded)) { + /* Some single byte instructions need extra treatment. */ + if (instType == INT_INFO_TREAT) { + if (tmpIndex0 == INST_NOP_INDEX) { /* Nopnopnop */ + /* Check for Pause, since it's prefixed with 0xf3, which is not a real mandatory prefix. */ + if (ps->decodedPrefixes & INST_PRE_REP) { + /* Flag this prefix as used. */ + ps->usedPrefixes |= INST_PRE_REP; + return &II_PAUSE; + } + + /* + * Treat NOP/XCHG specially. + * If we're not in 64bits restore XCHG to NOP, since in the DB it's XCHG. + * Else if we're in 64bits examine REX, if exists, and decide which instruction should go to output. + * 48 90 XCHG RAX, RAX is a true NOP (eat REX in this case because it's valid). + * 90 XCHG EAX, EAX is a true NOP (and not high dword of RAX = 0 although it should be a 32 bits operation). + * Note that if the REX.B is used, then the register is not RAX anymore but R8, which means it's not a NOP. + */ + if (ps->vrex & PREFIX_EX_W) ps->usedPrefixes |= INST_PRE_REX; + if ((ci->dt != Decode64Bits) || (~ps->vrex & PREFIX_EX_B)) return &II_NOP; + } + else if (tmpIndex0 == INST_LEA_INDEX) { + /* Ignore segment override prefixes for LEA instruction. */ + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; + /* Update unused mask for ignoring segment prefix. */ + prefixes_ignore(ps, PFXIDX_SEG); + } + else if (tmpIndex0 == INST_ARPL_INDEX) { + /* + * ARPL/MOVSXD share the same opcode, and both have different operands and mnemonics, of course. + * Practically, I couldn't come up with a comfortable way to merge the operands' types of ARPL/MOVSXD. + * And since the DB can't be patched dynamically, because the DB has to be multi-threaded compliant, + * I have no choice but to check for ARPL/MOVSXD right here - "right about now, the funk soul brother, check it out now, the funk soul brother...", fatboy slim + */ + if (ci->dt == Decode64Bits) { + return &II_MOVSXD; + } /* else ARPL will be returned because its defined in the DB already. */ + } + } + /* + * Return the 1 byte instruction we found. + * We can have three node types here: infoex, info_treat and info. + * The latter two are really the same basic structure. + */ + return instType == INT_INFOEX ? (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in)] : &InstInfos[INST_NODE_INDEX(in)]; + } + + /* Read second byte, still doesn't mean all of its bits are used (I.E: ModRM). */ + ci->code += 1; + ci->codeLen -= 1; + if (ci->codeLen < 0) return NULL; + tmpIndex1 = *ci->code; + + /* Try single byte instruction + reg bits (OCST_13BYTES). */ + if ((instType == INT_LIST_GROUP) && (!isWaitIncluded)) return inst_get_info(in, (tmpIndex1 >> 3) & 7); + + /* Try single byte instruction + reg byte OR one whole byte (OCST_1dBYTES). */ + if (instType == INT_LIST_DIVIDED) { + + /* Checking for inst by REG bits is higher priority if it's found not to be divided instruction. */ + { + _InstNode in2 = InstructionsTree[INST_NODE_INDEX(in) + ((tmpIndex1 >> 3) & 7)]; + /* + * Do NOT check for NULL here, since we do a bit of a guess work, + * hence we don't override 'in', cause we might still need it. + */ + instType = INST_NODE_TYPE(in2); + + if (instType == INT_INFO) ii = &InstInfos[INST_NODE_INDEX(in2)]; + else if (instType == INT_INFOEX) ii = (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in2)]; + if ((ii != NULL) && (INST_INFO_FLAGS(ii) & INST_NOT_DIVIDED)) return ii; + /* ii is reset below. */ + } + + /* Continue normally because of wait prefix. */ + if (tmpIndex1 < INST_DIVIDED_MODRM) { + /* An instruction which requires a ModR/M byte. Thus it's 1.3 bytes long instruction. */ + tmpIndex1 = (tmpIndex1 >> 3) & 7; /* Isolate the 3 REG/OPCODE bits. */ + } + else { /* Normal 2 bytes instruction. */ + /* + * Divided instructions can't be in the range of 0x8-0xc0. + * That's because 0-8 are used for 3 bits group. + * And 0xc0-0xff are used for not-divided instruction. + * So the in between range is omitted, thus saving some more place in the tables. + */ + tmpIndex1 -= INST_DIVIDED_MODRM - 8; + } + + in = InstructionsTree[INST_NODE_INDEX(in) + tmpIndex1]; + if (in == INT_NOTEXISTS) return NULL; + instType = INST_NODE_TYPE(in); + + if (instType < INT_INFOS) { + /* If the instruction doesn't support the wait (marked as opsize) as part of the opcode, it's illegal. */ + ii = instType == INT_INFO ? &InstInfos[INST_NODE_INDEX(in)] : (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in)]; + if ((~INST_INFO_FLAGS(ii) & INST_PRE_OP_SIZE) && (isWaitIncluded)) return NULL; + return ii; + } + /* + * If we got here the instruction can support the wait prefix, so see if it was part of the stream. + * Examine prefixed table, specially used for 0x9b, since it's optional. + * No Wait: index = 0. + * Wait Exists, index = 1. + */ + return inst_get_info(in, isWaitIncluded); + } + + /* Don't allow to continue if WAIT is part of the opcode, because there are no instructions that include it. */ + if (isWaitIncluded) return NULL; + + /* Try 2 bytes long instruction (doesn't include ModRM byte). */ + if (instType == INT_LIST_FULL) { + in = InstructionsTree[INST_NODE_INDEX(in) + tmpIndex1]; + if (in == INT_NOTEXISTS) return NULL; + instType = INST_NODE_TYPE(in); + + /* This is where we check if we just read two escape bytes in a row, which means it is a 3DNow! instruction. */ + if ((tmpIndex0 == _3DNOW_ESCAPE_BYTE) && (tmpIndex1 == _3DNOW_ESCAPE_BYTE)) return &II_3DNOW; + + /* 2 bytes instruction (OCST_2BYTES). */ + if (instType < INT_INFOS) + return instType == INT_INFO ? &InstInfos[INST_NODE_INDEX(in)] : (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in)]; + + /* + * 2 bytes + mandatory prefix. + * Mandatory prefixes can be anywhere in the prefixes. + * There cannot be more than one mandatory prefix, unless it's a normal operand size prefix. + */ + if (instType == INT_LIST_PREFIXED) return inst_lookup_prefixed(in, ps); + } + + /* Read third byte, still doesn't mean all of its bits are used (I.E: ModRM). */ + ci->code += 1; + ci->codeLen -= 1; + if (ci->codeLen < 0) return NULL; + tmpIndex2 = *ci->code; + + /* Try 2 bytes + reg instruction (OCST_23BYTES). */ + if (instType == INT_LIST_GROUP) { + in = InstructionsTree[INST_NODE_INDEX(in) + ((tmpIndex2 >> 3) & 7)]; + if (in == INT_NOTEXISTS) return NULL; + instType = INST_NODE_TYPE(in); + + if (instType < INT_INFOS) + return instType == INT_INFO ? &InstInfos[INST_NODE_INDEX(in)] : (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in)]; + + /* It has to be a prefixed table then. */ + ii = inst_lookup_prefixed(in, ps); + /* RDRAND and VMPTRLD share same 2.3 bytes opcode, and alternate on the MOD bits. See insts.h for more info. */ + if ((ii != NULL) && (ii->opcodeId == I_VMPTRLD) && (tmpIndex1 >= INST_DIVIDED_MODRM)) return &II_RDRAND; + return ii; + } + + /* Try 2 bytes + divided range (OCST_2dBYTES). */ + if (instType == INT_LIST_DIVIDED) { + _InstNode in2 = InstructionsTree[INST_NODE_INDEX(in) + ((tmpIndex2 >> 3) & 7)]; + /* + * Do NOT check for NULL here, since we do a bit of a guess work, + * hence we don't override 'in', cause we might still need it. + */ + instType = INST_NODE_TYPE(in2); + + if (instType == INT_INFO) ii = &InstInfos[INST_NODE_INDEX(in2)]; + else if (instType == INT_INFOEX) ii = (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in2)]; + + /* + * OCST_2dBYTES is complex, because there are a few instructions which are not divided in some special cases. + * If the instruction wasn't divided (but still it must be a 2.3 because we are in divided category) + * or it was an official 2.3 (because its index was less than 0xc0) - + * Then it means the instruction should be using the REG bits, otherwise give a chance to range 0xc0-0xff. + */ + /* If we found an instruction only by its REG bits, AND it is not divided, then return it. */ + if ((ii != NULL) && (INST_INFO_FLAGS(ii) & INST_NOT_DIVIDED)) return ii; + /* Otherwise, if the range is above 0xc0, try the special divided range (range 0x8-0xc0 is omitted). */ + if (tmpIndex2 >= INST_DIVIDED_MODRM) return inst_get_info(in, tmpIndex2 - INST_DIVIDED_MODRM + 8); + + /* It might be that we got here without touching ii in the above if statements, then it becomes an invalid instruction prolly. */ + return ii; + } + + /* Try 3 full bytes (OCST_3BYTES - no ModRM byte). */ + if (instType == INT_LIST_FULL) { + /* OCST_3BYTES. */ + in = InstructionsTree[INST_NODE_INDEX(in) + tmpIndex2]; + if (in == INT_NOTEXISTS) return NULL; + instType = INST_NODE_TYPE(in); + + if (instType < INT_INFOS) + return instType == INT_INFO ? &InstInfos[INST_NODE_INDEX(in)] : (_InstInfo*)&InstInfosEx[INST_NODE_INDEX(in)]; + + if (instType == INT_LIST_PREFIXED) return inst_lookup_prefixed(in, ps); + } + + /* Kahtchinggg, damn. */ + return NULL; +} + +/* +* 3DNow! instruction handling: + +* This is used when we encounter a 3DNow! instruction. +* We can't really locate a 3DNow! instruction before we see two escaped bytes, +* 0x0f, 0x0f. Then we have to extract operands which are, dest=mmx register, src=mmx register or quadword indirection. +* When we are finished with the extraction of operands we can resume to locate the instruction by reading another byte +* which tells us which 3DNow instruction we really tracked down... +* So in order to tell the extract operands function which operands the 3DNow! instruction require, we need to set up some +* generic instruction info for 3DNow! instructions. + +* In the inst_lookup itself, when we read an OCST_3BYTES which the two first bytes are 0x0f and 0x0f. +* we will return this special generic II for the specific operands we are interested in (MM, MM64). +* Then after extracting the operand, we'll call a completion routine for locating the instruction +* which will be called only for 3DNow! instructions, distinguished by a flag, and it will read the last byte of the 3 bytes. +* +* The id of this opcode should not be used, the following function should change it anyway. +*/ +_InstInfo* inst_lookup_3dnow(_CodeInfo* ci) +{ + /* Start off from the two escape bytes gates... which is 3DNow! table.*/ + _InstNode in = Table_0F_0F; + + int index; + + /* Make sure we can read a byte off the stream. */ + if (ci->codeLen < 1) return NULL; + + index = *ci->code; + + ci->codeLen -= 1; + ci->code += 1; + return inst_get_info(in, index); +} diff --git a/NativeCore/Dependencies/distorm/src/instructions.h b/NativeCore/Dependencies/distorm/src/instructions.h new file mode 100644 index 00000000..4902c99a --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/instructions.h @@ -0,0 +1,479 @@ +/* +instructions.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef INSTRUCTIONS_H +#define INSTRUCTIONS_H + +#include "config.h" +#include "prefix.h" + + +/* + * Operand type possibilities: + * Note "_FULL" suffix indicates to decode the operand as 16 bits or 32 bits depends on DecodeType - + * actually, it depends on the decoding mode, unless there's an operand/address size prefix. + * For example, the code: 33 c0 could be decoded/executed as XOR AX, AX or XOR EAX, EAX. + */ + +typedef enum OpType { + /* No operand is set */ + OT_NONE = 0, + + /* Read a byte(8 bits) immediate */ + OT_IMM8, + /* Force a read of a word(16 bits) immediate, used by ret only */ + OT_IMM16, + /* Read a word/dword immediate */ + OT_IMM_FULL, + /* Read a double-word(32 bits) immediate */ + OT_IMM32, + + /* Read a signed extended byte(8 bits) immediate */ + OT_SEIMM8, + + /* Use a 8bit register */ + OT_REG8, + /* Use a 16bit register */ + OT_REG16, + /* Use a 16/32/64bit register */ + OT_REG_FULL, + /* Use a 32bit register */ + OT_REG32, + /* + * If used with REX the reg operand size becomes 64 bits, otherwise 32 bits. + * VMX instructions are promoted automatically without a REX prefix. + */ + OT_REG32_64, + + /* Use AL */ + OT_ACC8, + /* Use AX (FSTSW) */ + OT_ACC16, + /* Use AX/EAX/RAX */ + OT_ACC_FULL, + /* Use AX/EAX, no REX is possible for RAX, used only with IN/OUT which don't support 64 bit registers */ + OT_ACC_FULL_NOT64, + + /* Read a byte(8 bits) immediate and calculate it relatively to the current offset of the instruction being decoded */ + OT_RELCB, + /* Read a word/dword immediate and calculate it relatively to the current offset of the instruction being decoded */ + OT_RELC_FULL, + + /* + * Instruction-Block for one byte long instructions, used by INC/DEC/PUSH/POP/XCHG, + * REG is extracted from the value of opcode + * Use a 8bit register + */ + OT_IB_RB, + /* Use a 16/32/64bit register */ + OT_IB_R_FULL, + + /* Read an immediate as an absolute address, size is known by instruction, used by MOV (memory offset) only */ + OT_MOFFS8, + OT_MOFFS_FULL, + /* Use [(r)SI] as INDIRECTION, for repeatable instructions */ + OT_REGI_ESI, + /* Use [(r)DI] as INDIRECTION, for repeatable instructions */ + OT_REGI_EDI, + /* Use [(r)BX + AL] as INDIRECTIOM, used by XLAT only */ + OT_REGI_EBXAL, + /* Use [(r)AX] as INDIRECTION, used by AMD's SVM instructions */ + OT_REGI_EAX, + /* Use DX, as for OUTS DX, BYTE [SI] */ + OT_REGDX, + /* Use ECX in INVLPGA instruction */ + OT_REGECX, + + /* FPU registers: */ + OT_FPU_SI, /* ST(i) */ + OT_FPU_SSI, /* ST(0), ST(i) */ + OT_FPU_SIS, /* ST(i), ST(0) */ + + /* SSE registers: */ + OT_XMM, + /* Extract the SSE register from the RM bits this time (used when the REG bits are used for opcode extension) */ + OT_XMM_RM, + /* Implied XMM0 register as operand, used in SSE4. */ + OT_REGXMM0, + /* Reg32/Reg 64 depends on prefix width only. */ + OT_WREG32_64, + + /* XMM is encoded in VEX.VVVV. */ + OT_VXMM, + /* XMM is encoded in the high nibble of an immediate byte. */ + OT_XMM_IMM, + /* YMM/XMM is dependent on VEX.L. */ + OT_YXMM, + /* YMM/XMM (depends on prefix length) is encoded in the high nibble of an immediate byte. */ + OT_YXMM_IMM, + /* YMM is encoded in reg. */ + OT_YMM, + /* YMM is encoded in VEX.VVVV. */ + OT_VYMM, + /* YMM/XMM is dependent on VEX.L, and encoded in VEX.VVVV. */ + OT_VYXMM, + + /* Use an immediate of 1, as for SHR R/M, 1 */ + OT_CONST1, + /* Use CL, as for SHR R/M, CL */ + OT_REGCL, + + /* Use a control register */ + OT_CREG, + /* Use a debug register */ + OT_DREG, + /* Use a segment register */ + OT_SREG, + /* + * SEG is encoded in the flags of the opcode itself! + * This is used for specific "push SS" where SS is a segment where + * each "push SS" has an absolutely different opcode byte. + * We need this to detect whether an operand size prefix is used. + */ + OT_SEG, + + /* + * Special immediates for instructions which have more than one immediate, + * which is an exception from standard instruction format. + * As to version v1.0: ENTER, INSERTQ, EXTRQ are the only problematic ones. + */ + /* 16 bits immediate using the first imm-slot */ + OT_IMM16_1, + /* 8 bits immediate using the first imm-slot */ + OT_IMM8_1, + /* 8 bits immediate using the second imm-slot */ + OT_IMM8_2, + + /* Read one word (seg) and a word/dword/qword (depends on operand size), usually SEG:OFF, JMP 1234:1234 */ + OT_PTR16_FULL, + + /* Used only by MOV CR/DR(n). Promoted with REX onlly. */ + OT_FREG32_64_RM, + + /* MMX registers: */ + OT_MM, + /* Extract the MMX register from the RM bits this time (used when the REG bits are used for opcode extension) */ + OT_MM_RM, + + + /**** MEMORY only operands: ****/ + + /* Use general memory indirection, with varying sizes: */ + OT_MEM, + OT_MEM32, + /* Memory dereference for MOVNTI, either 32 or 64 bits (with REX). */ + OT_MEM32_64, + OT_MEM64, + /* Used for cmpxchg8b/16b. */ + OT_MEM64_128, + OT_MEM128, + /* + * Read one word (seg), and a word/dword/qword (depends on operand size) from memory. + * JMP FAR [EBX] means EBX point to 16:32 ptr. + */ + OT_MEM16_FULL, + /* Read one word (limit) and a dword/qword (limit) (depends on operand size), used by SGDT, SIDT, LGDT, LIDT. */ + OT_MEM16_3264, + /* Used when a memory indirection is required, but if the mod field is 11, this operand will be ignored. */ + OT_MEM_OPT, + + /* Same as OT_RMXX but POINTS to 16 bits [cannot use GENERAL-PURPOSE REG!] */ + OT_FPUM16, + /* Same as OT_RMXX but POINTS to 32 bits (single precision) [cannot use GENERAL-PURPOSE REG!] */ + OT_FPUM32, + /* Same as OT_RMXX but POINTS to 64 bits (double precision) [cannot use GENERAL-PURPOSE REG!] */ + OT_FPUM64, + /* Same as OT_RMXX but POINTS to 80 bits (extended precision) [cannot use GENERAL-PURPOSE REG!] */ + OT_FPUM80, + + /* Mem128/Mem256 is dependent on VEX.L. */ + OT_LMEM128_256, + + + /**** MEMORY & REGISTER only operands: ****/ + + /* Use or read (indirection) a 8bit register or immediate byte */ + OT_RM8, + /* Some instructions force 16 bits (mov sreg, rm16) */ + OT_RM16, + /* ModR/M for 32 bits. */ + OT_RM32, + /* + * Special operand type for MOV reg16/32/64/mem16, segReg 8C /r. and SMSW. + * It supports all decoding modes, but if used as a memory indirection it's a 16 bit ModR/M indirection. + */ + OT_RFULL_M16, + /* Use or read a 16/32/64bit register or immediate word/dword/qword */ + OT_RM_FULL, + + /* RM32/RM64 depends on prefix width only. */ + OT_WRM32_64, + /* + * Special type for SSE4, ModR/M might be a 32 bits or 64 bits (with REX) register or + * a 8 bits memory indirection operand. + */ + OT_R32_64_M8, + /* + * Special type for SSE4, ModR/M might be a 32 bits or 64 bits (with REX) register or + * a 16 bits memory indirection operand. + */ + OT_R32_64_M16, + + /* + * 32 or 64 bits (with REX) operand size indirection memory operand. + * Some instructions are promoted automatically without a REX prefix. + */ + OT_RM32_64, + /* 16 or 32 bits RM. This is used only with MOVZXD instruction in 64bits. */ + OT_RM16_32, + + /* + * Special operand type for SSE4 where the ModR/M might + * be a 32 bits register or 8 bits memory indirection operand. + */ + OT_R32_M8, + /* + * Special ModR/M for PINSRW, which need a 16 bits memory operand or 32 bits register. + * In 16 bits decoding mode R32 becomes R16, operand size cannot affect this. + */ + OT_R32_M16, + /* Reg32/Reg64 (prefix width) or Mem8. */ + OT_REG32_64_M8, + /* Reg32/Reg64 (prefix width) or Mem16. */ + OT_REG32_64_M16, + + /* ModR/M points to 32 bits MMX variable */ + OT_MM32, + /* ModR/M points to 32 bits MMX variable */ + OT_MM64, + + /* ModR/M points to 16 bits SSE variable */ + OT_XMM16, + /* ModR/M points to 32 bits SSE variable */ + OT_XMM32, + /* ModR/M points to 64 bits SSE variable */ + OT_XMM64, + /* ModR/M points to 128 bits SSE variable */ + OT_XMM128, + + /* AVX operands: */ + /* XMM or Mem32/Mem64 depends on perfix width only. */ + OT_WXMM32_64, + /* YMM or Mem256. */ + OT_YMM256, + /* YMM/XMM or Mem64/Mem256 is dependent on VEX.L. */ + OT_YXMM64_256, + /* YMM/XMM or Mem128/Mem256 is dependent on VEX.L. */ + OT_YXMM128_256, + /* XMM or Mem64/Mem256 is dependent on VEX.L. */ + OT_LXMM64_128 +} _OpType; + +/* Flags for instruction: */ + +/* Empty flags indicator: */ +#define INST_FLAGS_NONE (0) +/* The instruction we are going to decode requires ModR/M encoding. */ +#define INST_MODRM_REQUIRED (1) +/* Special treatment for instructions which are in the divided-category but still needs the whole byte for ModR/M... */ +#define INST_NOT_DIVIDED (1 << 1) +/* + * Used explicitly in repeatable instructions, + * which needs a suffix letter in their mnemonic to specify operation-size (depend on operands). + */ +#define INST_16BITS (1 << 2) +/* If the opcode is supported by 80286 and upper models (16/32 bits). */ +#define INST_32BITS (1 << 3) +/* + * Prefix flags (6 types: lock/rep, seg override, addr-size, oper-size, REX, VEX) + * There are several specific instructions that can follow LOCK prefix, + * note that they must be using a memory operand form, otherwise they generate an exception. + */ +#define INST_PRE_LOCK (1 << 4) +/* REPNZ prefix for string instructions only - means an instruction can follow it. */ +#define INST_PRE_REPNZ (1 << 5) +/* REP prefix for string instructions only - means an instruction can follow it. */ +#define INST_PRE_REP (1 << 6) +/* CS override prefix. */ +#define INST_PRE_CS (1 << 7) +/* SS override prefix. */ +#define INST_PRE_SS (1 << 8) +/* DS override prefix. */ +#define INST_PRE_DS (1 << 9) +/* ES override prefix. */ +#define INST_PRE_ES (1 << 10) +/* FS override prefix. Funky Segment :) */ +#define INST_PRE_FS (1 << 11) +/* GS override prefix. Groovy Segment, of course not, duh ! */ +#define INST_PRE_GS (1 << 12) +/* Switch operand size from 32 to 16 and vice versa. */ +#define INST_PRE_OP_SIZE (1 << 13) +/* Switch address size from 32 to 16 and vice versa. */ +#define INST_PRE_ADDR_SIZE (1 << 14) +/* Native instructions which needs suffix letter to indicate their operation-size (and don't depend on operands). */ +#define INST_NATIVE (1 << 15) +/* Use extended mnemonic, means it's an _InstInfoEx structure, which contains another mnemonic for 32 bits specifically. */ +#define INST_USE_EXMNEMONIC (1 << 16) +/* Use third operand, means it's an _InstInfoEx structure, which contains another operand for special instructions. */ +#define INST_USE_OP3 (1 << 17) +/* Use fourth operand, means it's an _InstInfoEx structure, which contains another operand for special instructions. */ +#define INST_USE_OP4 (1 << 18) +/* The instruction's mnemonic depends on the mod value of the ModR/M byte (mod=11, mod!=11). */ +#define INST_MNEMONIC_MODRM_BASED (1 << 19) +/* The instruction uses a ModR/M byte which the MOD must be 11 (for registers operands only). */ +#define INST_MODRR_REQUIRED (1 << 20) +/* The way of 3DNow! instructions are built, we have to handle their locating specially. Suffix imm8 tells which instruction it is. */ +#define INST_3DNOW_FETCH (1 << 21) +/* The instruction needs two suffixes, one for the comparison type (imm8) and the second for its operation size indication (second mnemonic). */ +#define INST_PSEUDO_OPCODE (1 << 22) +/* Invalid instruction at 64 bits decoding mode. */ +#define INST_INVALID_64BITS (1 << 23) +/* Specific instruction can be promoted to 64 bits (without REX, it is promoted automatically). */ +#define INST_64BITS (1 << 24) +/* Indicates the instruction must be REX prefixed in order to use 64 bits operands. */ +#define INST_PRE_REX (1 << 25) +/* Third mnemonic is set. */ +#define INST_USE_EXMNEMONIC2 (1 << 26) +/* Instruction is only valid in 64 bits decoding mode. */ +#define INST_64BITS_FETCH (1 << 27) +/* Forces that the ModRM-REG/Opcode field will be 0. (For EXTRQ). */ +#define INST_FORCE_REG0 (1 << 28) +/* Indicates that instruction is encoded with a VEX prefix. */ +#define INST_PRE_VEX (1 << 29) +/* Indicates that the instruction is encoded with a ModRM byte (REG field specifically). */ +#define INST_MODRM_INCLUDED (1 << 30) +/* Indicates that the first (/destination) operand of the instruction is writable. */ +#define INST_DST_WR (1 << 31) + +#define INST_PRE_REPS (INST_PRE_REPNZ | INST_PRE_REP) +#define INST_PRE_LOKREP_MASK (INST_PRE_LOCK | INST_PRE_REPNZ | INST_PRE_REP) +#define INST_PRE_SEGOVRD_MASK32 (INST_PRE_CS | INST_PRE_SS | INST_PRE_DS | INST_PRE_ES) +#define INST_PRE_SEGOVRD_MASK64 (INST_PRE_FS | INST_PRE_GS) +#define INST_PRE_SEGOVRD_MASK (INST_PRE_SEGOVRD_MASK32 | INST_PRE_SEGOVRD_MASK64) + +/* Extended flags for VEX: */ +/* Indicates that the instruction might have VEX.L encoded. */ +#define INST_VEX_L (1) +/* Indicates that the instruction might have VEX.W encoded. */ +#define INST_VEX_W (1 << 1) +/* Indicates that the mnemonic of the instruction is based on the VEX.W bit. */ +#define INST_MNEMONIC_VEXW_BASED (1 << 2) +/* Indicates that the mnemonic of the instruction is based on the VEX.L bit. */ +#define INST_MNEMONIC_VEXL_BASED (1 << 3) +/* Forces the instruction to be encoded with VEX.L, otherwise it's undefined. */ +#define INST_FORCE_VEXL (1 << 4) +/* + * Indicates that the instruction is based on the MOD field of the ModRM byte. + * (MOD==11: got the right instruction, else skip +4 in prefixed table for the correct instruction). + */ +#define INST_MODRR_BASED (1 << 5) +/* Indicates that the instruction doesn't use the VVVV field of the VEX prefix, if it does then it's undecodable. */ +#define INST_VEX_V_UNUSED (1 << 6) + +/* Indication that the instruction is privileged (Ring 0), this should be checked on the opcodeId field. */ +#define META_INST_PRIVILEGED ((uint16_t)0x8000) + +/* + * Indicates which operand is being decoded. + * Destination (1st), Source (2nd), op3 (3rd), op4 (4th). + * Used to set the operands' fields in the _DInst structure! + */ +typedef enum {ONT_NONE = -1, ONT_1 = 0, ONT_2 = 1, ONT_3 = 2, ONT_4 = 3} _OperandNumberType; + +/* CPU Flags that instructions modify, test or undefine, in compacted form (CF,PF,AF,ZF,SF are 1:1 map to EFLAGS). */ +#define D_COMPACT_CF 1 /* Carry */ +#define D_COMPACT_PF 4 /* Parity */ +#define D_COMPACT_AF 0x10 /* Auxiliary */ +#define D_COMPACT_ZF 0x40 /* Zero */ +#define D_COMPACT_SF 0x80 /* Sign */ +/* The following flags have to be translated to EFLAGS. */ +#define D_COMPACT_IF 2 /* Interrupt */ +#define D_COMPACT_DF 8 /* Direction */ +#define D_COMPACT_OF 0x20 /* Overflow */ + +/* The mask of flags that are already compatible with EFLAGS. */ +#define D_COMPACT_SAME_FLAGS (D_COMPACT_CF | D_COMPACT_PF | D_COMPACT_AF | D_COMPACT_ZF | D_COMPACT_SF) + +/* + * In order to save more space for storing the DB statically, + * I came up with another level of shared info. + * Because I saw that most of the information that instructions use repeats itself. + * + * Info about the instruction, source/dest types, meta and flags. + * _InstInfo points to a table of _InstSharedInfo. + */ +typedef struct { + uint8_t flagsIndex; /* An index into FlagsTables */ + uint8_t s, d; /* OpType. */ + /* + * The following are CPU flag masks that the instruction changes. + * The flags are compacted so 8 bits representation is enough. + * They will be expanded in runtime to be compatible to EFLAGS. + */ + uint8_t modifiedFlagsMask; + uint8_t testedFlagsMask; + uint8_t undefinedFlagsMask; + uint16_t meta; /* High byte = Instruction set class | Low byte = flow control flags. */ +} _InstSharedInfo; + +/* + * This structure is used for the instructions DB and NOT for the disassembled result code! + * This is the BASE structure, there are extensions to this structure below. + */ +typedef struct { + uint16_t sharedIndex; /* An index into the SharedInfoTable. */ + uint16_t opcodeId; /* The opcodeId is really a byte-offset into the mnemonics table. MSB is a privileged indication. */ +} _InstInfo; + +/* + * There are merely few instructions which need a second mnemonic for 32 bits. + * Or a third for 64 bits. Therefore sometimes the second mnemonic is empty but not the third. + * In all decoding modes the first mnemonic is the default. + * A flag will indicate it uses another mnemonic. + * + * There are a couple of (SSE4) instructions in the whole DB which need both op3 and 3rd mnemonic for 64bits, + * therefore, I decided to make the extended structure contain all extra info in the same structure. + * There are a few instructions (SHLD/SHRD/IMUL and SSE too) which use third operand (or a fourth). + * A flag will indicate it uses a third/fourth operand. + */ +typedef struct { + /* Base structure (doesn't get accessed directly from code). */ + _InstInfo BASE; + + /* Extended starts here. */ + uint8_t flagsEx; /* 8 bits are enough, in the future we might make it a bigger integer. */ + uint8_t op3, op4; /* OpType. */ + uint16_t opcodeId2, opcodeId3; +} _InstInfoEx; + +/* Trie data structure node type: */ +typedef enum { + INT_NOTEXISTS = 0, /* Not exists. */ + INT_INFO = 1, /* It's an instruction info. */ + INT_INFOEX, + INT_INFO_TREAT, /* Extra intervention is required by inst_lookup. */ + INT_LIST_GROUP, + INT_LIST_FULL, + INT_LIST_DIVIDED, + INT_LIST_PREFIXED +} _InstNodeType; + +/* Used to check instType < INT_INFOS, means we got an inst-info. Cause it has to be only one of them. */ +#define INT_INFOS (INT_LIST_GROUP) + +/* Instruction node is treated as { int index:13; int type:3; } */ +typedef uint16_t _InstNode; + +_InstInfo* inst_lookup(_CodeInfo* ci, _PrefixState* ps, int* isPrefixed); +_InstInfo* inst_lookup_3dnow(_CodeInfo* ci); + +#endif /* INSTRUCTIONS_H */ + diff --git a/NativeCore/Dependencies/distorm/src/insts.c b/NativeCore/Dependencies/distorm/src/insts.c new file mode 100644 index 00000000..688558c1 --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/insts.c @@ -0,0 +1,7945 @@ +/* +insts.c + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#include "config.h" +#include "insts.h" +#include "instructions.h" + + +/* + * GENERATED BY disOps at Fri Dec 17 10:22:38 2021 + */ + +_InstInfo II_MOVSXD = /*II*/ {0x1d7, 10038}; +_InstInfo II_NOP = /*II*/ {0x53, 580}; +_InstInfo II_PAUSE = /*II*/ {0x91, 10046}; +_InstInfo II_WAIT = /*II*/ {0x53, 10053}; +_InstInfo II_RDRAND = /*II*/ {0x1d8, 10059}; +_InstInfo II_3DNOW = /*II*/ {0x1d9, 10067}; + +_iflags FlagsTable[101] = { +0x80000011, +0x80000000, +0x800400, +0x80800400, +0x800080, +0x800100, +0x80800100, +0x800200, +0x80800200, +0x800000, +0x1, +0x0, +0x80800000, +0x1000000, +0x81000000, +0x808000, +0x800001, +0x80020001, +0x1002000, +0x60, +0x64, +0x80000001, +0x4010000, +0x1008000, +0x80000060, +0x83000064, +0x3000064, +0x83000000, +0x3008000, +0x200, +0xc000, +0x4014000, +0x8, +0x81000009, +0x80000009, +0x1000808, +0x81000808, +0x80020009, +0x1001008, +0x81001008, +0x80000019, +0x3000009, +0x83000009, +0x83000008, +0xc0000011, +0x40000001, +0xc0800011, +0x40800001, +0xc0000019, +0xc1000001, +0xc0000001, +0xc0000003, +0x41000000, +0x40000000, +0x40000008, +0x40000009, +0x41000001, +0x43000001, +0x40000003, +0x48000000, +0x200009, +0x20000009, +0x60020009, +0x60000009, +0x80090009, +0x200b0009, +0x20020009, +0x9, +0x80100009, +0x21100009, +0x87000009, +0x20009, +0x20000008, +0x1000009, +0x10020009, +0x160009, +0x100009, +0x47000009, +0x47090009, +0x40090009, +0x80002009, +0xc0000009, +0x2001, +0x80002001, +0x410009, +0x20420009, +0x20060009, +0x120009, +0x21020009, +0xc7000019, +0x20100009, +0xc0002009, +0x40002008, +0xc0000000, +0xc0002008, +0x4020009, +0x40100009, +0x60120009, +0x41000009, +0x83000001, +0x200001 +}; + +_InstNode Table_0F = 256; +_InstNode Table_0F_0F = 1440; +_InstNode Table_0F_38 = 1896; +_InstNode Table_0F_3A = 2152; + +_InstInfo InstInfos[1248] = { + /*II_00*/ {0x0, 11}, + /*II_01*/ {0x1, 11}, + /*II_02*/ {0x2, 11}, + /*II_03*/ {0x3, 11}, + /*II_04*/ {0x4, 11}, + /*II_05*/ {0x5, 11}, + /*II_06*/ {0x6, 16}, + /*II_07*/ {0x7, 22}, + /*II_08*/ {0x8, 27}, + /*II_09*/ {0x9, 27}, + /*II_0A*/ {0xa, 27}, + /*II_0B*/ {0xb, 27}, + /*II_0C*/ {0xc, 27}, + /*II_0D*/ {0xd, 27}, + /*II_0E*/ {0xe, 16}, + /*II_10*/ {0xf, 31}, + /*II_11*/ {0x10, 31}, + /*II_12*/ {0x11, 31}, + /*II_13*/ {0x12, 31}, + /*II_14*/ {0x13, 31}, + /*II_15*/ {0x14, 31}, + /*II_16*/ {0x15, 16}, + /*II_17*/ {0x16, 22}, + /*II_18*/ {0xf, 36}, + /*II_19*/ {0x10, 36}, + /*II_1A*/ {0x11, 36}, + /*II_1B*/ {0x12, 36}, + /*II_1C*/ {0x13, 36}, + /*II_1D*/ {0x14, 36}, + /*II_1E*/ {0x17, 16}, + /*II_1F*/ {0x18, 22}, + /*II_20*/ {0x19, 41}, + /*II_21*/ {0x1a, 41}, + /*II_22*/ {0x1b, 41}, + /*II_23*/ {0x1c, 41}, + /*II_24*/ {0x1d, 41}, + /*II_25*/ {0x1e, 41}, + /*II_27*/ {0x1f, 46}, + /*II_28*/ {0x0, 51}, + /*II_29*/ {0x1, 51}, + /*II_2A*/ {0x2, 51}, + /*II_2B*/ {0x3, 51}, + /*II_2C*/ {0x4, 51}, + /*II_2D*/ {0x5, 51}, + /*II_2F*/ {0x1f, 56}, + /*II_30*/ {0x20, 61}, + /*II_31*/ {0x21, 61}, + /*II_32*/ {0x22, 61}, + /*II_33*/ {0x23, 61}, + /*II_34*/ {0x24, 61}, + /*II_35*/ {0x25, 61}, + /*II_37*/ {0x26, 66}, + /*II_38*/ {0x27, 71}, + /*II_39*/ {0x28, 71}, + /*II_3A*/ {0x29, 71}, + /*II_3B*/ {0x2a, 71}, + /*II_3C*/ {0x2b, 71}, + /*II_3D*/ {0x2c, 71}, + /*II_3F*/ {0x26, 76}, + /*II_40*/ {0x2d, 81}, + /*II_40*/ {0x2d, 81}, + /*II_40*/ {0x2d, 81}, + /*II_40*/ {0x2d, 81}, + /*II_40*/ {0x2d, 81}, + /*II_40*/ {0x2d, 81}, + /*II_40*/ {0x2d, 81}, + /*II_40*/ {0x2d, 81}, + /*II_48*/ {0x2d, 86}, + /*II_48*/ {0x2d, 86}, + /*II_48*/ {0x2d, 86}, + /*II_48*/ {0x2d, 86}, + /*II_48*/ {0x2d, 86}, + /*II_48*/ {0x2d, 86}, + /*II_48*/ {0x2d, 86}, + /*II_48*/ {0x2d, 86}, + /*II_50*/ {0x2e, 16}, + /*II_50*/ {0x2e, 16}, + /*II_50*/ {0x2e, 16}, + /*II_50*/ {0x2e, 16}, + /*II_50*/ {0x2e, 16}, + /*II_50*/ {0x2e, 16}, + /*II_50*/ {0x2e, 16}, + /*II_50*/ {0x2e, 16}, + /*II_58*/ {0x2f, 22}, + /*II_58*/ {0x2f, 22}, + /*II_58*/ {0x2f, 22}, + /*II_58*/ {0x2f, 22}, + /*II_58*/ {0x2f, 22}, + /*II_58*/ {0x2f, 22}, + /*II_58*/ {0x2f, 22}, + /*II_58*/ {0x2f, 22}, + /*II_60*/ {0x30, 91}, + /*II_61*/ {0x30, 98}, + /*II_62*/ {0x31, 104}, + /*II_63*/ {0x32, 111}, + /*II_68*/ {0x33, 16}, + /*II_6A*/ {0x35, 16}, + /*II_6C*/ {0x36, 123}, + /*II_6D*/ {0x37, 123}, + /*II_6E*/ {0x38, 128}, + /*II_6F*/ {0x39, 128}, + /*II_70*/ {0x3a, 134}, + /*II_71*/ {0x3a, 138}, + /*II_72*/ {0x3b, 143}, + /*II_73*/ {0x3b, 147}, + /*II_74*/ {0x3c, 152}, + /*II_75*/ {0x3c, 156}, + /*II_76*/ {0x3d, 161}, + /*II_77*/ {0x3d, 166}, + /*II_78*/ {0x3e, 170}, + /*II_79*/ {0x3e, 174}, + /*II_7A*/ {0x3f, 179}, + /*II_7B*/ {0x3f, 183}, + /*II_7C*/ {0x40, 188}, + /*II_7D*/ {0x40, 192}, + /*II_7E*/ {0x41, 197}, + /*II_7F*/ {0x41, 202}, + /*II_84*/ {0x42, 206}, + /*II_85*/ {0x43, 206}, + /*II_86*/ {0x44, 212}, + /*II_87*/ {0x45, 212}, + /*II_88*/ {0x46, 218}, + /*II_89*/ {0x47, 218}, + /*II_8A*/ {0x48, 218}, + /*II_8B*/ {0x49, 218}, + /*II_8C*/ {0x4a, 218}, + /*II_8D*/ {0x4b, 223}, + /*II_8E*/ {0x4c, 218}, + /*II_90*/ {0x4d, 212}, + /*II_91*/ {0x4d, 212}, + /*II_92*/ {0x4d, 212}, + /*II_93*/ {0x4d, 212}, + /*II_94*/ {0x4d, 212}, + /*II_95*/ {0x4d, 212}, + /*II_96*/ {0x4d, 212}, + /*II_97*/ {0x4d, 212}, + /*II_9A*/ {0x4f, 260}, + /*II_9C*/ {0x50, 270}, + /*II_9D*/ {0x51, 277}, + /*II_9E*/ {0x52, 283}, + /*II_9F*/ {0x53, 289}, + /*II_A0*/ {0x54, 218}, + /*II_A1*/ {0x55, 218}, + /*II_A2*/ {0x56, 218}, + /*II_A3*/ {0x57, 218}, + /*II_A4*/ {0x58, 295}, + /*II_A5*/ {0x59, 295}, + /*II_A6*/ {0x5a, 301}, + /*II_A7*/ {0x5b, 301}, + /*II_A8*/ {0x5c, 206}, + /*II_A9*/ {0x5d, 206}, + /*II_AA*/ {0x5e, 307}, + /*II_AB*/ {0x5f, 307}, + /*II_AC*/ {0x60, 313}, + /*II_AD*/ {0x61, 313}, + /*II_AE*/ {0x62, 319}, + /*II_AF*/ {0x63, 319}, + /*II_B0*/ {0x64, 218}, + /*II_B0*/ {0x64, 218}, + /*II_B0*/ {0x64, 218}, + /*II_B0*/ {0x64, 218}, + /*II_B0*/ {0x64, 218}, + /*II_B0*/ {0x64, 218}, + /*II_B0*/ {0x64, 218}, + /*II_B0*/ {0x64, 218}, + /*II_B8*/ {0x65, 218}, + /*II_B8*/ {0x65, 218}, + /*II_B8*/ {0x65, 218}, + /*II_B8*/ {0x65, 218}, + /*II_B8*/ {0x65, 218}, + /*II_B8*/ {0x65, 218}, + /*II_B8*/ {0x65, 218}, + /*II_B8*/ {0x65, 218}, + /*II_C2*/ {0x66, 325}, + /*II_C3*/ {0x67, 325}, + /*II_C4*/ {0x68, 330}, + /*II_C5*/ {0x68, 335}, + /*II_C8*/ {0x69, 340}, + /*II_C9*/ {0x6a, 347}, + /*II_CA*/ {0x6b, 354}, + /*II_CB*/ {0x6c, 354}, + /*II_CC*/ {0x53, 360}, + /*II_CD*/ {0x6d, 366}, + /*II_CE*/ {0x6e, 371}, + /*II_CF*/ {0x6f, 377}, + /*II_D4*/ {0x70, 383}, + /*II_D5*/ {0x70, 388}, + /*II_D6*/ {0x71, 393}, + /*II_D7*/ {0x72, 399}, + /*II_E0*/ {0x73, 405}, + /*II_E1*/ {0x73, 413}, + /*II_E2*/ {0x74, 420}, + /*II_E4*/ {0x76, 446}, + /*II_E5*/ {0x77, 446}, + /*II_E6*/ {0x78, 450}, + /*II_E7*/ {0x79, 450}, + /*II_E8*/ {0x7a, 455}, + /*II_E9*/ {0x7b, 461}, + /*II_EA*/ {0x7c, 466}, + /*II_EB*/ {0x7d, 461}, + /*II_EC*/ {0x7e, 446}, + /*II_ED*/ {0x7f, 446}, + /*II_EE*/ {0x80, 450}, + /*II_EF*/ {0x81, 450}, + /*II_F1*/ {0x82, 475}, + /*II_F4*/ {0x83, 481}, + /*II_F5*/ {0x84, 486}, + /*II_F8*/ {0x84, 491}, + /*II_F9*/ {0x84, 496}, + /*II_FA*/ {0x85, 501}, + /*II_FB*/ {0x85, 506}, + /*II_FC*/ {0x86, 511}, + /*II_FD*/ {0x86, 516}, + /*II_0F_02*/ {0x87, 521}, + /*II_0F_03*/ {0x87, 526}, + /*II_0F_05*/ {0x88, 531}, + /*II_0F_06*/ {0x89, 540}, + /*II_0F_07*/ {0x88, 546}, + /*II_0F_08*/ {0x89, 554}, + /*II_0F_09*/ {0x89, 560}, + /*II_0F_0B*/ {0x8a, 568}, + /*II_0F_0E*/ {0x8b, 573}, + /*II_0F_1F*/ {0x8c, 580}, + /*II_0F_20*/ {0x8d, 218}, + /*II_0F_21*/ {0x8e, 218}, + /*II_0F_22*/ {0x8f, 218}, + /*II_0F_23*/ {0x90, 218}, + /*II_0F_30*/ {0x89, 585}, + /*II_0F_31*/ {0x89, 592}, + /*II_0F_32*/ {0x89, 599}, + /*II_0F_33*/ {0x89, 606}, + /*II_0F_34*/ {0x88, 613}, + /*II_0F_35*/ {0x88, 623}, + /*II_0F_37*/ {0x91, 632}, + /*II_0F_40*/ {0x92, 640}, + /*II_0F_41*/ {0x92, 647}, + /*II_0F_42*/ {0x93, 655}, + /*II_0F_43*/ {0x93, 662}, + /*II_0F_44*/ {0x94, 670}, + /*II_0F_45*/ {0x94, 677}, + /*II_0F_46*/ {0x95, 685}, + /*II_0F_47*/ {0x95, 693}, + /*II_0F_48*/ {0x96, 700}, + /*II_0F_49*/ {0x96, 707}, + /*II_0F_4A*/ {0x97, 715}, + /*II_0F_4B*/ {0x97, 722}, + /*II_0F_4C*/ {0x98, 730}, + /*II_0F_4D*/ {0x98, 737}, + /*II_0F_4E*/ {0x99, 745}, + /*II_0F_4F*/ {0x99, 753}, + /*II_0F_80*/ {0x9a, 134}, + /*II_0F_81*/ {0x9a, 138}, + /*II_0F_82*/ {0x9b, 143}, + /*II_0F_83*/ {0x9b, 147}, + /*II_0F_84*/ {0x9c, 152}, + /*II_0F_85*/ {0x9c, 156}, + /*II_0F_86*/ {0x9d, 161}, + /*II_0F_87*/ {0x9d, 166}, + /*II_0F_88*/ {0x9e, 170}, + /*II_0F_89*/ {0x9e, 174}, + /*II_0F_8A*/ {0x9f, 179}, + /*II_0F_8B*/ {0x9f, 183}, + /*II_0F_8C*/ {0xa0, 188}, + /*II_0F_8D*/ {0xa0, 192}, + /*II_0F_8E*/ {0xa1, 197}, + /*II_0F_8F*/ {0xa1, 202}, + /*II_0F_90*/ {0xa2, 760}, + /*II_0F_91*/ {0xa2, 766}, + /*II_0F_92*/ {0xa3, 773}, + /*II_0F_93*/ {0xa3, 779}, + /*II_0F_94*/ {0xa4, 786}, + /*II_0F_95*/ {0xa4, 792}, + /*II_0F_96*/ {0xa5, 799}, + /*II_0F_97*/ {0xa5, 806}, + /*II_0F_98*/ {0xa6, 812}, + /*II_0F_99*/ {0xa6, 818}, + /*II_0F_9A*/ {0xa7, 825}, + /*II_0F_9B*/ {0xa7, 831}, + /*II_0F_9C*/ {0xa8, 838}, + /*II_0F_9D*/ {0xa8, 844}, + /*II_0F_9E*/ {0xa9, 851}, + /*II_0F_9F*/ {0xa9, 858}, + /*II_0F_A0*/ {0xaa, 16}, + /*II_0F_A1*/ {0xab, 22}, + /*II_0F_A2*/ {0x91, 864}, + /*II_0F_A3*/ {0xac, 871}, + /*II_0F_A8*/ {0xae, 16}, + /*II_0F_A9*/ {0xaf, 22}, + /*II_0F_AA*/ {0xb0, 881}, + /*II_0F_AB*/ {0xb1, 886}, + /*II_0F_AF*/ {0xb2, 117}, + /*II_0F_B0*/ {0xb3, 897}, + /*II_0F_B1*/ {0xb4, 897}, + /*II_0F_B2*/ {0xb5, 906}, + /*II_0F_B3*/ {0xb1, 911}, + /*II_0F_B4*/ {0xb5, 916}, + /*II_0F_B5*/ {0xb5, 921}, + /*II_0F_B6*/ {0xb6, 926}, + /*II_0F_B7*/ {0xb7, 926}, + /*II_0F_B9*/ {0x8a, 568}, + /*II_0F_BB*/ {0xb1, 933}, + /*II_0F_BE*/ {0xb6, 938}, + /*II_0F_BF*/ {0xb7, 938}, + /*II_0F_C0*/ {0xb3, 945}, + /*II_0F_C1*/ {0xb4, 945}, + /*II_0F_C3*/ {0xb8, 951}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_0F_C8*/ {0xb9, 959}, + /*II_80_00*/ {0xba, 11}, + /*II_80_01*/ {0xbb, 27}, + /*II_80_02*/ {0xbc, 31}, + /*II_80_03*/ {0xbc, 36}, + /*II_80_04*/ {0xbd, 41}, + /*II_80_05*/ {0xba, 51}, + /*II_80_06*/ {0xbe, 61}, + /*II_80_07*/ {0xbf, 71}, + /*II_81_00*/ {0xc0, 11}, + /*II_81_01*/ {0xc1, 27}, + /*II_81_02*/ {0xc2, 31}, + /*II_81_03*/ {0xc2, 36}, + /*II_81_04*/ {0xc3, 41}, + /*II_81_05*/ {0xc0, 51}, + /*II_81_06*/ {0xc4, 61}, + /*II_81_07*/ {0xc5, 71}, + /*II_82_00*/ {0xc6, 11}, + /*II_82_01*/ {0xc7, 27}, + /*II_82_02*/ {0xc8, 31}, + /*II_82_03*/ {0xc8, 36}, + /*II_82_04*/ {0xc9, 41}, + /*II_82_05*/ {0xc6, 51}, + /*II_82_06*/ {0xca, 61}, + /*II_82_07*/ {0xcb, 71}, + /*II_83_00*/ {0xcc, 11}, + /*II_83_01*/ {0xcd, 27}, + /*II_83_02*/ {0xce, 31}, + /*II_83_03*/ {0xce, 36}, + /*II_83_04*/ {0xcf, 41}, + /*II_83_05*/ {0xcc, 51}, + /*II_83_06*/ {0xd0, 61}, + /*II_83_07*/ {0xd1, 71}, + /*II_8F_00*/ {0xd2, 22}, + /*II_C0_00*/ {0xd3, 966}, + /*II_C0_01*/ {0xd3, 971}, + /*II_C0_02*/ {0xd4, 976}, + /*II_C0_03*/ {0xd4, 981}, + /*II_C0_04*/ {0xd5, 986}, + /*II_C0_05*/ {0xd5, 991}, + /*II_C0_06*/ {0xd5, 996}, + /*II_C0_07*/ {0xd5, 1001}, + /*II_C1_00*/ {0xd6, 966}, + /*II_C1_01*/ {0xd6, 971}, + /*II_C1_02*/ {0xd7, 976}, + /*II_C1_03*/ {0xd7, 981}, + /*II_C1_04*/ {0xd8, 986}, + /*II_C1_05*/ {0xd8, 991}, + /*II_C1_06*/ {0xd8, 996}, + /*II_C1_07*/ {0xd8, 1001}, + /*II_C6_00*/ {0xd9, 218}, + /*II_C6_F8*/ {0xda, 1006}, + /*II_C7_00*/ {0xdb, 218}, + /*II_C7_F8*/ {0xdc, 1014}, + /*II_D0_00*/ {0xdd, 966}, + /*II_D0_01*/ {0xdd, 971}, + /*II_D0_02*/ {0xde, 976}, + /*II_D0_03*/ {0xde, 981}, + /*II_D0_04*/ {0xdf, 986}, + /*II_D0_05*/ {0xdf, 991}, + /*II_D0_06*/ {0xdf, 996}, + /*II_D0_07*/ {0xdf, 1001}, + /*II_D1_00*/ {0xe0, 966}, + /*II_D1_01*/ {0xe0, 971}, + /*II_D1_02*/ {0xe1, 976}, + /*II_D1_03*/ {0xe1, 981}, + /*II_D1_04*/ {0xe2, 986}, + /*II_D1_05*/ {0xe2, 991}, + /*II_D1_06*/ {0xe2, 996}, + /*II_D1_07*/ {0xe2, 1001}, + /*II_D2_00*/ {0xe3, 966}, + /*II_D2_01*/ {0xe3, 971}, + /*II_D2_02*/ {0xe4, 976}, + /*II_D2_03*/ {0xe4, 981}, + /*II_D2_04*/ {0xe5, 986}, + /*II_D2_05*/ {0xe5, 991}, + /*II_D2_06*/ {0xe5, 996}, + /*II_D2_07*/ {0xe5, 1001}, + /*II_D3_00*/ {0xe6, 966}, + /*II_D3_01*/ {0xe6, 971}, + /*II_D3_02*/ {0xe7, 976}, + /*II_D3_03*/ {0xe7, 981}, + /*II_D3_04*/ {0xe8, 986}, + /*II_D3_05*/ {0xe8, 991}, + /*II_D3_06*/ {0xe8, 996}, + /*II_D3_07*/ {0xe8, 1001}, + /*II_D8_00*/ {0xe9, 1022}, + /*II_D8_01*/ {0xe9, 1028}, + /*II_D8_02*/ {0xe9, 1034}, + /*II_D8_03*/ {0xe9, 1040}, + /*II_D8_04*/ {0xe9, 1047}, + /*II_D8_05*/ {0xe9, 1053}, + /*II_D8_06*/ {0xe9, 1060}, + /*II_D8_07*/ {0xe9, 1066}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C0*/ {0xea, 1022}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_C8*/ {0xea, 1028}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D0*/ {0xeb, 1034}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_D9*/ {0xec, 1040}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_D8*/ {0xeb, 1040}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E0*/ {0xea, 1047}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_E8*/ {0xea, 1053}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F0*/ {0xea, 1060}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D8_F8*/ {0xea, 1066}, + /*II_D9_00*/ {0xe9, 1073}, + /*II_D9_02*/ {0xed, 1078}, + /*II_D9_03*/ {0xed, 1083}, + /*II_D9_04*/ {0xee, 1089}, + /*II_D9_05*/ {0xef, 1097}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C0*/ {0xeb, 1073}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_C9*/ {0xec, 1104}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_C8*/ {0xeb, 1104}, + /*II_D9_D0*/ {0xec, 1110}, + /*II_D9_E0*/ {0xec, 1116}, + /*II_D9_E1*/ {0xec, 1122}, + /*II_D9_E4*/ {0xec, 1128}, + /*II_D9_E5*/ {0xec, 1134}, + /*II_D9_E8*/ {0xec, 1140}, + /*II_D9_E9*/ {0xec, 1146}, + /*II_D9_EA*/ {0xec, 1154}, + /*II_D9_EB*/ {0xec, 1162}, + /*II_D9_EC*/ {0xec, 1169}, + /*II_D9_ED*/ {0xec, 1177}, + /*II_D9_EE*/ {0xec, 1185}, + /*II_D9_F0*/ {0xec, 1191}, + /*II_D9_F1*/ {0xec, 1198}, + /*II_D9_F2*/ {0xec, 1205}, + /*II_D9_F3*/ {0xec, 1212}, + /*II_D9_F4*/ {0xec, 1220}, + /*II_D9_F5*/ {0xec, 1229}, + /*II_D9_F6*/ {0xec, 1237}, + /*II_D9_F7*/ {0xec, 1246}, + /*II_D9_F8*/ {0xec, 1255}, + /*II_D9_F9*/ {0xec, 1262}, + /*II_D9_FA*/ {0xec, 1271}, + /*II_D9_FB*/ {0xec, 1278}, + /*II_D9_FC*/ {0xec, 1287}, + /*II_D9_FD*/ {0xec, 1296}, + /*II_D9_FE*/ {0xec, 1304}, + /*II_D9_FF*/ {0xec, 1310}, + /*II_DA_00*/ {0xe9, 1316}, + /*II_DA_01*/ {0xe9, 1323}, + /*II_DA_02*/ {0xe9, 1330}, + /*II_DA_03*/ {0xe9, 1337}, + /*II_DA_04*/ {0xe9, 1345}, + /*II_DA_05*/ {0xe9, 1352}, + /*II_DA_06*/ {0xe9, 1360}, + /*II_DA_07*/ {0xe9, 1367}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C0*/ {0xf0, 1375}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_C8*/ {0xf1, 1383}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D0*/ {0xf2, 1391}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_D8*/ {0xf3, 1400}, + /*II_DA_E9*/ {0xec, 1408}, + /*II_DB_00*/ {0xe9, 1417}, + /*II_DB_01*/ {0xf4, 1423}, + /*II_DB_02*/ {0xed, 1431}, + /*II_DB_03*/ {0xed, 1437}, + /*II_DB_05*/ {0xf5, 1073}, + /*II_DB_07*/ {0xf6, 1083}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C0*/ {0xf0, 1444}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_C8*/ {0xf1, 1453}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D0*/ {0xf2, 1462}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_D8*/ {0xf3, 1472}, + /*II_DB_E0*/ {0xec, 1481}, + /*II_DB_E1*/ {0xec, 1487}, + /*II_DB_E4*/ {0xec, 1495}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_E8*/ {0xf7, 1503}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DB_F0*/ {0xf8, 1511}, + /*II_DC_00*/ {0xf9, 1022}, + /*II_DC_01*/ {0xf9, 1028}, + /*II_DC_02*/ {0xf9, 1034}, + /*II_DC_03*/ {0xf9, 1040}, + /*II_DC_04*/ {0xf9, 1047}, + /*II_DC_05*/ {0xf9, 1053}, + /*II_DC_06*/ {0xf9, 1060}, + /*II_DC_07*/ {0xf9, 1066}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C0*/ {0xfa, 1022}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_C8*/ {0xfa, 1028}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E0*/ {0xfa, 1053}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_E8*/ {0xfa, 1047}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F0*/ {0xfa, 1066}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DC_F8*/ {0xfa, 1060}, + /*II_DD_00*/ {0xf9, 1073}, + /*II_DD_01*/ {0xfb, 1423}, + /*II_DD_02*/ {0xfc, 1078}, + /*II_DD_03*/ {0xfc, 1083}, + /*II_DD_04*/ {0xee, 1518}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_C0*/ {0xeb, 1526}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D0*/ {0xeb, 1078}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_D8*/ {0xeb, 1083}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E1*/ {0xec, 1533}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E0*/ {0xfa, 1533}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DD_E9*/ {0xec, 1540}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DD_E8*/ {0xeb, 1540}, + /*II_DE_00*/ {0xef, 1316}, + /*II_DE_01*/ {0xef, 1323}, + /*II_DE_02*/ {0xef, 1330}, + /*II_DE_03*/ {0xef, 1337}, + /*II_DE_04*/ {0xef, 1345}, + /*II_DE_05*/ {0xef, 1352}, + /*II_DE_06*/ {0xef, 1360}, + /*II_DE_07*/ {0xef, 1367}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C1*/ {0xec, 1548}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C0*/ {0xfa, 1548}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_C9*/ {0xec, 1555}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_C8*/ {0xfa, 1555}, + /*II_DE_D9*/ {0xec, 1562}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E1*/ {0xec, 1570}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E0*/ {0xfa, 1570}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_E9*/ {0xec, 1578}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_E8*/ {0xfa, 1578}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F1*/ {0xec, 1585}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F0*/ {0xfa, 1585}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DE_F9*/ {0xec, 1593}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DE_F8*/ {0xfa, 1593}, + /*II_DF_00*/ {0xef, 1417}, + /*II_DF_01*/ {0xfd, 1423}, + /*II_DF_02*/ {0xfe, 1431}, + /*II_DF_03*/ {0xfe, 1437}, + /*II_DF_04*/ {0xf5, 1600}, + /*II_DF_05*/ {0xf9, 1417}, + /*II_DF_06*/ {0xf6, 1606}, + /*II_DF_07*/ {0xfc, 1437}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_E8*/ {0xf7, 1613}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_DF_F0*/ {0xf7, 1622}, + /*II_F6_00*/ {0xff, 206}, + /*II_F6_02*/ {0x100, 1630}, + /*II_F6_03*/ {0x101, 1635}, + /*II_F6_04*/ {0x102, 1640}, + /*II_F6_05*/ {0x102, 117}, + /*II_F6_06*/ {0x103, 1645}, + /*II_F6_07*/ {0x103, 1650}, + /*II_F7_00*/ {0x104, 206}, + /*II_F7_02*/ {0x105, 1630}, + /*II_F7_03*/ {0x106, 1635}, + /*II_F7_04*/ {0x107, 1640}, + /*II_F7_05*/ {0x107, 117}, + /*II_F7_06*/ {0x108, 1645}, + /*II_F7_07*/ {0x108, 1650}, + /*II_FE_00*/ {0x109, 81}, + /*II_FE_01*/ {0x109, 86}, + /*II_FF_00*/ {0x10a, 81}, + /*II_FF_01*/ {0x10a, 86}, + /*II_FF_02*/ {0x10b, 455}, + /*II_FF_03*/ {0x10c, 260}, + /*II_FF_04*/ {0x10d, 461}, + /*II_FF_05*/ {0x10e, 466}, + /*II_FF_06*/ {0x10f, 16}, + /*II_0F_00_00*/ {0x110, 1656}, + /*II_0F_00_01*/ {0x111, 1662}, + /*II_0F_00_02*/ {0x112, 1667}, + /*II_0F_00_03*/ {0x113, 1673}, + /*II_0F_00_04*/ {0x114, 1678}, + /*II_0F_00_05*/ {0x114, 1684}, + /*II_0F_01_00*/ {0x115, 1690}, + /*II_0F_01_01*/ {0x115, 1696}, + /*II_0F_01_02*/ {0x116, 1702}, + /*II_0F_01_03*/ {0x116, 1708}, + /*II_0F_01_04*/ {0x117, 1714}, + /*II_0F_01_06*/ {0x118, 1720}, + /*II_0F_01_07*/ {0x119, 1726}, + /*II_0F_01_C1*/ {0x11a, 1734}, + /*II_0F_01_C2*/ {0x11a, 1742}, + /*II_0F_01_C3*/ {0x11a, 1752}, + /*II_0F_01_C4*/ {0x11a, 1762}, + /*II_0F_01_C8*/ {0x11b, 1770}, + /*II_0F_01_C9*/ {0x11b, 1779}, + /*II_0F_01_CA*/ {0x11b, 1786}, + /*II_0F_01_CB*/ {0x11b, 1792}, + /*II_0F_01_D0*/ {0x91, 1798}, + /*II_0F_01_D1*/ {0x91, 1806}, + /*II_0F_01_D4*/ {0x11a, 1814}, + /*II_0F_01_D5*/ {0x11c, 1822}, + /*II_0F_01_D8*/ {0x11d, 1828}, + /*II_0F_01_D9*/ {0x11e, 1835}, + /*II_0F_01_DA*/ {0x11f, 1844}, + /*II_0F_01_DB*/ {0x11f, 1852}, + /*II_0F_01_DC*/ {0x11e, 1860}, + /*II_0F_01_DD*/ {0x11e, 1866}, + /*II_0F_01_DE*/ {0x11f, 1872}, + /*II_0F_01_DF*/ {0x120, 1880}, + /*II_0F_01_F8*/ {0x121, 1889}, + /*II_0F_01_F9*/ {0x121, 1897}, + /*II_0F_0D_00*/ {0x122, 1905}, + /*II_0F_0D_01*/ {0x122, 1915}, + /*II_0F_0F_0C*/ {0x123, 1926}, + /*II_0F_0F_0D*/ {0x124, 1933}, + /*II_0F_0F_1C*/ {0x123, 1940}, + /*II_0F_0F_1D*/ {0x124, 1947}, + /*II_0F_0F_8A*/ {0x123, 1954}, + /*II_0F_0F_8E*/ {0x123, 1962}, + /*II_0F_0F_90*/ {0x124, 1971}, + /*II_0F_0F_94*/ {0x124, 1980}, + /*II_0F_0F_96*/ {0x124, 1987}, + /*II_0F_0F_97*/ {0x124, 1994}, + /*II_0F_0F_9A*/ {0x124, 2003}, + /*II_0F_0F_9E*/ {0x124, 2010}, + /*II_0F_0F_A0*/ {0x124, 2017}, + /*II_0F_0F_A4*/ {0x124, 2026}, + /*II_0F_0F_A6*/ {0x124, 2033}, + /*II_0F_0F_A7*/ {0x124, 2043}, + /*II_0F_0F_AA*/ {0x124, 2053}, + /*II_0F_0F_AE*/ {0x124, 2061}, + /*II_0F_0F_B0*/ {0x124, 2068}, + /*II_0F_0F_B4*/ {0x124, 2077}, + /*II_0F_0F_B6*/ {0x124, 2084}, + /*II_0F_0F_B7*/ {0x124, 2094}, + /*II_0F_0F_BB*/ {0x123, 2103}, + /*II_0F_0F_BF*/ {0x124, 2111}, + /*II_0F_10*/ {0x125, 2120}, + /*II_66_0F_10*/ {0x126, 2128}, + /*II_F3_0F_10*/ {0x127, 2136}, + /*II_F2_0F_10*/ {0x128, 2143}, + /*II_0F_11*/ {0x12d, 2120}, + /*II_66_0F_11*/ {0x12e, 2128}, + /*II_F3_0F_11*/ {0x12f, 2136}, + /*II_F2_0F_11*/ {0x130, 2143}, + /*II_66_0F_12*/ {0x135, 2201}, + /*II_F3_0F_12*/ {0x136, 2209}, + /*II_F2_0F_12*/ {0x136, 2219}, + /*II_0F_13*/ {0x13a, 2193}, + /*II_66_0F_13*/ {0x13b, 2201}, + /*II_0F_14*/ {0x13d, 2277}, + /*II_66_0F_14*/ {0x13e, 2287}, + /*II_0F_15*/ {0x13d, 2319}, + /*II_66_0F_15*/ {0x13e, 2329}, + /*II_66_0F_16*/ {0x135, 2378}, + /*II_F3_0F_16*/ {0x140, 2386}, + /*II_0F_17*/ {0x13a, 2370}, + /*II_66_0F_17*/ {0x13b, 2378}, + /*II_0F_18_00*/ {0x141, 2435}, + /*II_0F_18_01*/ {0x141, 2448}, + /*II_0F_18_02*/ {0x141, 2460}, + /*II_0F_18_03*/ {0x141, 2472}, + /*II_0F_28*/ {0x125, 2484}, + /*II_66_0F_28*/ {0x126, 2492}, + /*II_0F_29*/ {0x12d, 2484}, + /*II_66_0F_29*/ {0x12e, 2492}, + /*II_0F_2A*/ {0x142, 2518}, + /*II_66_0F_2A*/ {0x143, 2528}, + /*II_F3_0F_2A*/ {0x144, 2538}, + /*II_F2_0F_2A*/ {0x145, 2548}, + /*II_0F_2B*/ {0x146, 2580}, + /*II_66_0F_2B*/ {0x147, 2589}, + /*II_F3_0F_2B*/ {0x148, 2598}, + /*II_F2_0F_2B*/ {0x149, 2607}, + /*II_0F_2C*/ {0x14b, 2636}, + /*II_66_0F_2C*/ {0x14c, 2647}, + /*II_F3_0F_2C*/ {0x14d, 2658}, + /*II_F2_0F_2C*/ {0x14e, 2669}, + /*II_0F_2D*/ {0x14b, 2704}, + /*II_66_0F_2D*/ {0x13e, 2714}, + /*II_F3_0F_2D*/ {0x14d, 2724}, + /*II_F2_0F_2D*/ {0x14e, 2734}, + /*II_0F_2E*/ {0x150, 2766}, + /*II_66_0F_2E*/ {0x151, 2775}, + /*II_0F_2F*/ {0x150, 2804}, + /*II_66_0F_2F*/ {0x151, 2812}, + /*II_0F_50*/ {0x154, 2838}, + /*II_66_0F_50*/ {0x155, 2848}, + /*II_0F_51*/ {0x13d, 2880}, + /*II_66_0F_51*/ {0x13e, 2888}, + /*II_F3_0F_51*/ {0x157, 2896}, + /*II_F2_0F_51*/ {0x151, 2904}, + /*II_0F_52*/ {0x13d, 2948}, + /*II_F3_0F_52*/ {0x157, 2957}, + /*II_0F_53*/ {0x13d, 2986}, + /*II_F3_0F_53*/ {0x157, 2993}, + /*II_0F_54*/ {0x13d, 3016}, + /*II_66_0F_54*/ {0x13e, 3023}, + /*II_0F_55*/ {0x13d, 3046}, + /*II_66_0F_55*/ {0x13e, 3054}, + /*II_0F_56*/ {0x13d, 3080}, + /*II_66_0F_56*/ {0x13e, 3086}, + /*II_0F_57*/ {0x13d, 3106}, + /*II_66_0F_57*/ {0x13e, 3113}, + /*II_0F_58*/ {0x13d, 3136}, + /*II_66_0F_58*/ {0x13e, 3143}, + /*II_F3_0F_58*/ {0x157, 3150}, + /*II_F2_0F_58*/ {0x151, 3157}, + /*II_0F_59*/ {0x13d, 3196}, + /*II_66_0F_59*/ {0x13e, 3203}, + /*II_F3_0F_59*/ {0x157, 3210}, + /*II_F2_0F_59*/ {0x151, 3217}, + /*II_0F_5A*/ {0x151, 3256}, + /*II_66_0F_5A*/ {0x13e, 3266}, + /*II_F3_0F_5A*/ {0x158, 3276}, + /*II_F2_0F_5A*/ {0x151, 3286}, + /*II_0F_5B*/ {0x13e, 3340}, + /*II_66_0F_5B*/ {0x13e, 3350}, + /*II_F3_0F_5B*/ {0x13e, 3360}, + /*II_0F_5C*/ {0x13d, 3405}, + /*II_66_0F_5C*/ {0x13e, 3412}, + /*II_F3_0F_5C*/ {0x157, 3419}, + /*II_F2_0F_5C*/ {0x151, 3426}, + /*II_0F_5D*/ {0x13d, 3465}, + /*II_66_0F_5D*/ {0x13e, 3472}, + /*II_F3_0F_5D*/ {0x157, 3479}, + /*II_F2_0F_5D*/ {0x151, 3486}, + /*II_0F_5E*/ {0x13d, 3525}, + /*II_66_0F_5E*/ {0x13e, 3532}, + /*II_F3_0F_5E*/ {0x157, 3539}, + /*II_F2_0F_5E*/ {0x151, 3546}, + /*II_0F_5F*/ {0x13d, 3585}, + /*II_66_0F_5F*/ {0x13e, 3592}, + /*II_F3_0F_5F*/ {0x157, 3599}, + /*II_F2_0F_5F*/ {0x151, 3606}, + /*II_0F_60*/ {0x15b, 3645}, + /*II_66_0F_60*/ {0x13e, 3645}, + /*II_0F_61*/ {0x15b, 3668}, + /*II_66_0F_61*/ {0x13e, 3668}, + /*II_0F_62*/ {0x15b, 3691}, + /*II_66_0F_62*/ {0x13e, 3691}, + /*II_0F_63*/ {0x15c, 3714}, + /*II_66_0F_63*/ {0x13e, 3714}, + /*II_0F_64*/ {0x15c, 3735}, + /*II_66_0F_64*/ {0x13e, 3735}, + /*II_0F_65*/ {0x15c, 3754}, + /*II_66_0F_65*/ {0x13e, 3754}, + /*II_0F_66*/ {0x15c, 3773}, + /*II_66_0F_66*/ {0x13e, 3773}, + /*II_0F_67*/ {0x15c, 3792}, + /*II_66_0F_67*/ {0x13e, 3792}, + /*II_0F_68*/ {0x15c, 3813}, + /*II_66_0F_68*/ {0x13e, 3813}, + /*II_0F_69*/ {0x15c, 3836}, + /*II_66_0F_69*/ {0x13e, 3836}, + /*II_0F_6A*/ {0x15c, 3859}, + /*II_66_0F_6A*/ {0x13e, 3859}, + /*II_0F_6B*/ {0x15c, 3882}, + /*II_66_0F_6B*/ {0x13e, 3882}, + /*II_66_0F_6C*/ {0x13e, 3903}, + /*II_66_0F_6D*/ {0x13e, 3928}, + /*II_0F_6F*/ {0x160, 3959}, + /*II_66_0F_6F*/ {0x126, 3979}, + /*II_F3_0F_6F*/ {0x126, 3987}, + /*II_0F_74*/ {0x15c, 4076}, + /*II_66_0F_74*/ {0x13e, 4076}, + /*II_0F_75*/ {0x15c, 4095}, + /*II_66_0F_75*/ {0x13e, 4095}, + /*II_0F_76*/ {0x15c, 4114}, + /*II_66_0F_76*/ {0x13e, 4114}, + /*II_0F_77*/ {0x164, 4133}, + /*II_0F_78*/ {0x166, 4161}, + /*II_0F_79*/ {0x169, 4185}, + /*II_66_0F_79*/ {0x16a, 4169}, + /*II_F2_0F_79*/ {0x16b, 4176}, + /*II_0F_7A_30*/ {0x16c, 4194}, + /*II_0F_7A_31*/ {0x16d, 4204}, + /*II_66_0F_7C*/ {0x16e, 4214}, + /*II_F2_0F_7C*/ {0x16e, 4222}, + /*II_66_0F_7D*/ {0x16e, 4248}, + /*II_F2_0F_7D*/ {0x16e, 4256}, + /*II_F3_0F_7E*/ {0x128, 3959}, + /*II_0F_7F*/ {0x172, 3959}, + /*II_66_0F_7F*/ {0x12e, 3979}, + /*II_F3_0F_7F*/ {0x12e, 3987}, + /*II_F3_0F_B8*/ {0x176, 4371}, + /*II_0F_BA_04*/ {0x177, 871}, + /*II_0F_BA_05*/ {0x178, 886}, + /*II_0F_BA_06*/ {0x178, 911}, + /*II_0F_BA_07*/ {0x178, 933}, + /*II_0F_BC*/ {0x179, 4379}, + /*II_F3_0F_BC*/ {0x17a, 4384}, + /*II_0F_BD*/ {0x179, 4391}, + /*II_F3_0F_BD*/ {0x17b, 4396}, + /*II_0F_C7_07*/ {0x18b, 6418}, + /*II_66_0F_D0*/ {0x16e, 6427}, + /*II_F2_0F_D0*/ {0x16e, 6437}, + /*II_0F_D1*/ {0x15c, 6469}, + /*II_66_0F_D1*/ {0x13e, 6469}, + /*II_0F_D2*/ {0x15c, 6484}, + /*II_66_0F_D2*/ {0x13e, 6484}, + /*II_0F_D3*/ {0x15c, 6499}, + /*II_66_0F_D3*/ {0x13e, 6499}, + /*II_0F_D4*/ {0x151, 6514}, + /*II_66_0F_D4*/ {0x13e, 6514}, + /*II_0F_D5*/ {0x15c, 6529}, + /*II_66_0F_D5*/ {0x13e, 6529}, + /*II_66_0F_D6*/ {0x130, 3959}, + /*II_F3_0F_D6*/ {0x18c, 6546}, + /*II_F2_0F_D6*/ {0x18d, 6555}, + /*II_0F_D7*/ {0x18f, 6564}, + /*II_66_0F_D7*/ {0x190, 6564}, + /*II_0F_D8*/ {0x15c, 6585}, + /*II_66_0F_D8*/ {0x13e, 6585}, + /*II_0F_D9*/ {0x15c, 6604}, + /*II_66_0F_D9*/ {0x13e, 6604}, + /*II_0F_DA*/ {0x192, 6623}, + /*II_66_0F_DA*/ {0x13e, 6623}, + /*II_0F_DB*/ {0x15c, 6640}, + /*II_66_0F_DB*/ {0x13e, 6640}, + /*II_0F_DC*/ {0x15c, 6653}, + /*II_66_0F_DC*/ {0x13e, 6653}, + /*II_0F_DD*/ {0x15c, 6672}, + /*II_66_0F_DD*/ {0x13e, 6672}, + /*II_0F_DE*/ {0x192, 6681}, + /*II_66_0F_DE*/ {0x13e, 6681}, + /*II_0F_DF*/ {0x15c, 6698}, + /*II_66_0F_DF*/ {0x13e, 6698}, + /*II_0F_E0*/ {0x192, 6713}, + /*II_66_0F_E0*/ {0x13e, 6713}, + /*II_0F_E1*/ {0x15c, 6728}, + /*II_66_0F_E1*/ {0x13e, 6728}, + /*II_0F_E2*/ {0x15c, 6743}, + /*II_66_0F_E2*/ {0x13e, 6743}, + /*II_0F_E3*/ {0x192, 6758}, + /*II_66_0F_E3*/ {0x13e, 6758}, + /*II_0F_E4*/ {0x192, 6773}, + /*II_66_0F_E4*/ {0x13e, 6773}, + /*II_0F_E5*/ {0x15c, 6792}, + /*II_66_0F_E5*/ {0x13e, 6792}, + /*II_66_0F_E6*/ {0x13e, 6809}, + /*II_F3_0F_E6*/ {0x151, 6820}, + /*II_F2_0F_E6*/ {0x13e, 6830}, + /*II_0F_E7*/ {0x193, 6874}, + /*II_66_0F_E7*/ {0x147, 6882}, + /*II_0F_E8*/ {0x15c, 6901}, + /*II_66_0F_E8*/ {0x13e, 6901}, + /*II_0F_E9*/ {0x15c, 6918}, + /*II_66_0F_E9*/ {0x13e, 6918}, + /*II_0F_EA*/ {0x192, 6935}, + /*II_66_0F_EA*/ {0x13e, 6935}, + /*II_0F_EB*/ {0x15c, 6952}, + /*II_66_0F_EB*/ {0x13e, 6952}, + /*II_0F_EC*/ {0x15c, 6963}, + /*II_66_0F_EC*/ {0x13e, 6963}, + /*II_0F_ED*/ {0x15c, 6980}, + /*II_66_0F_ED*/ {0x13e, 6980}, + /*II_0F_EE*/ {0x192, 6997}, + /*II_66_0F_EE*/ {0x13e, 6997}, + /*II_0F_EF*/ {0x15c, 7014}, + /*II_66_0F_EF*/ {0x13e, 7014}, + /*II_F2_0F_F0*/ {0x194, 7027}, + /*II_0F_F1*/ {0x15c, 7042}, + /*II_66_0F_F1*/ {0x13e, 7042}, + /*II_0F_F2*/ {0x15c, 7057}, + /*II_66_0F_F2*/ {0x13e, 7057}, + /*II_0F_F3*/ {0x15c, 7072}, + /*II_66_0F_F3*/ {0x13e, 7072}, + /*II_0F_F4*/ {0x196, 7087}, + /*II_66_0F_F4*/ {0x13e, 7087}, + /*II_0F_F5*/ {0x15c, 7106}, + /*II_66_0F_F5*/ {0x13e, 7106}, + /*II_0F_F6*/ {0x192, 7125}, + /*II_66_0F_F6*/ {0x13e, 7125}, + /*II_0F_F7*/ {0x197, 7142}, + /*II_66_0F_F7*/ {0x198, 7152}, + /*II_0F_F8*/ {0x15c, 7177}, + /*II_66_0F_F8*/ {0x13e, 7177}, + /*II_0F_F9*/ {0x15c, 7192}, + /*II_66_0F_F9*/ {0x13e, 7192}, + /*II_0F_FA*/ {0x15c, 7207}, + /*II_66_0F_FA*/ {0x13e, 7207}, + /*II_0F_FB*/ {0x196, 7222}, + /*II_66_0F_FB*/ {0x13e, 7222}, + /*II_0F_FC*/ {0x15c, 7237}, + /*II_66_0F_FC*/ {0x13e, 7237}, + /*II_0F_FD*/ {0x15c, 7252}, + /*II_66_0F_FD*/ {0x13e, 7252}, + /*II_0F_FE*/ {0x15c, 7267}, + /*II_66_0F_FE*/ {0x13e, 7267}, + /*II_D9_06*/ {0x19a, 7282}, + /*II_9B_D9_06*/ {0x19b, 7291}, + /*II_D9_07*/ {0xfe, 7299}, + /*II_9B_D9_07*/ {0x19c, 7307}, + /*II_DB_E2*/ {0xec, 7314}, + /*II_9B_DB_E2*/ {0x19d, 7322}, + /*II_DB_E3*/ {0xec, 7329}, + /*II_9B_DB_E3*/ {0x19d, 7337}, + /*II_DD_06*/ {0x19a, 7344}, + /*II_9B_DD_06*/ {0x19b, 7352}, + /*II_DD_07*/ {0xfe, 7359}, + /*II_9B_DD_07*/ {0x19c, 7367}, + /*II_DF_E0*/ {0x19e, 7359}, + /*II_9B_DF_E0*/ {0x19f, 7367}, + /*II_0F_38_00*/ {0x1a0, 7374}, + /*II_66_0F_38_00*/ {0x1a1, 7374}, + /*II_0F_38_01*/ {0x1a0, 7391}, + /*II_66_0F_38_01*/ {0x1a1, 7391}, + /*II_0F_38_02*/ {0x1a0, 7408}, + /*II_66_0F_38_02*/ {0x1a1, 7408}, + /*II_0F_38_03*/ {0x1a0, 7425}, + /*II_66_0F_38_03*/ {0x1a1, 7425}, + /*II_0F_38_04*/ {0x1a0, 7444}, + /*II_66_0F_38_04*/ {0x1a1, 7444}, + /*II_0F_38_05*/ {0x1a0, 7467}, + /*II_66_0F_38_05*/ {0x1a1, 7467}, + /*II_0F_38_06*/ {0x1a0, 7484}, + /*II_66_0F_38_06*/ {0x1a1, 7484}, + /*II_0F_38_07*/ {0x1a0, 7501}, + /*II_66_0F_38_07*/ {0x1a1, 7501}, + /*II_0F_38_08*/ {0x1a0, 7520}, + /*II_66_0F_38_08*/ {0x1a1, 7520}, + /*II_0F_38_09*/ {0x1a0, 7537}, + /*II_66_0F_38_09*/ {0x1a1, 7537}, + /*II_0F_38_0A*/ {0x1a0, 7554}, + /*II_66_0F_38_0A*/ {0x1a1, 7554}, + /*II_0F_38_0B*/ {0x1a0, 7571}, + /*II_66_0F_38_0B*/ {0x1a1, 7571}, + /*II_66_0F_38_17*/ {0x1a3, 7662}, + /*II_0F_38_1C*/ {0x1a0, 7721}, + /*II_66_0F_38_1C*/ {0x1a1, 7721}, + /*II_0F_38_1D*/ {0x1a0, 7736}, + /*II_66_0F_38_1D*/ {0x1a1, 7736}, + /*II_0F_38_1E*/ {0x1a0, 7751}, + /*II_66_0F_38_1E*/ {0x1a1, 7751}, + /*II_66_0F_38_20*/ {0x1a8, 7766}, + /*II_66_0F_38_21*/ {0x1a9, 7787}, + /*II_66_0F_38_22*/ {0x1aa, 7808}, + /*II_66_0F_38_23*/ {0x1a8, 7829}, + /*II_66_0F_38_24*/ {0x1a9, 7850}, + /*II_66_0F_38_25*/ {0x1a8, 7871}, + /*II_66_0F_38_28*/ {0x1ac, 7892}, + /*II_66_0F_38_29*/ {0x1ac, 7909}, + /*II_66_0F_38_2A*/ {0x1ad, 7928}, + /*II_66_0F_38_2B*/ {0x1ac, 7949}, + /*II_66_0F_38_30*/ {0x1a8, 7994}, + /*II_66_0F_38_31*/ {0x1a9, 8015}, + /*II_66_0F_38_32*/ {0x1aa, 8036}, + /*II_66_0F_38_33*/ {0x1a8, 8057}, + /*II_66_0F_38_34*/ {0x1a9, 8078}, + /*II_66_0F_38_35*/ {0x1a8, 8099}, + /*II_66_0F_38_37*/ {0x1a3, 8120}, + /*II_66_0F_38_38*/ {0x1ac, 8139}, + /*II_66_0F_38_39*/ {0x1ac, 8156}, + /*II_66_0F_38_3A*/ {0x1ac, 8173}, + /*II_66_0F_38_3B*/ {0x1ac, 8190}, + /*II_66_0F_38_3C*/ {0x1ac, 8207}, + /*II_66_0F_38_3D*/ {0x1ac, 8224}, + /*II_66_0F_38_3E*/ {0x1ac, 8241}, + /*II_66_0F_38_3F*/ {0x1ac, 8258}, + /*II_66_0F_38_40*/ {0x1ac, 8275}, + /*II_66_0F_38_41*/ {0x1ac, 8292}, + /*II_66_0F_38_80*/ {0x1b0, 8317}, + /*II_66_0F_38_81*/ {0x1b0, 8325}, + /*II_66_0F_38_82*/ {0x1b0, 8334}, + /*II_66_0F_38_DB*/ {0x1b3, 9183}, + /*II_66_0F_38_DC*/ {0x1b3, 9200}, + /*II_66_0F_38_DD*/ {0x1b3, 9217}, + /*II_66_0F_38_DE*/ {0x1b3, 9242}, + /*II_66_0F_38_DF*/ {0x1b3, 9259}, + /*II_0F_38_F0*/ {0x1b6, 9284}, + /*II_F2_0F_38_F0*/ {0x1b7, 9291}, + /*II_0F_38_F1*/ {0x1b8, 9284}, + /*II_F2_0F_38_F1*/ {0x1b9, 9291}, + /*II_0F_71_02*/ {0x1d0, 6469}, + /*II_66_0F_71_02*/ {0x1d1, 6469}, + /*II_0F_71_04*/ {0x1d0, 6728}, + /*II_66_0F_71_04*/ {0x1d1, 6728}, + /*II_0F_71_06*/ {0x1d0, 7042}, + /*II_66_0F_71_06*/ {0x1d1, 7042}, + /*II_0F_72_02*/ {0x1d0, 6484}, + /*II_66_0F_72_02*/ {0x1d1, 6484}, + /*II_0F_72_04*/ {0x1d0, 6743}, + /*II_66_0F_72_04*/ {0x1d1, 6743}, + /*II_0F_72_06*/ {0x1d0, 7057}, + /*II_66_0F_72_06*/ {0x1d1, 7057}, + /*II_0F_73_02*/ {0x1d0, 6499}, + /*II_66_0F_73_02*/ {0x1d1, 6499}, + /*II_66_0F_73_03*/ {0x1d1, 9863}, + /*II_0F_73_06*/ {0x1d0, 7072}, + /*II_66_0F_73_06*/ {0x1d1, 7072}, + /*II_66_0F_73_07*/ {0x1d1, 9880}, + /*II_F3_0F_AE_00*/ {0x1d3, 9915}, + /*II_F3_0F_AE_01*/ {0x1d3, 9945}, + /*II_0F_AE_02*/ {0x1d4, 9955}, + /*II_F3_0F_AE_02*/ {0x1d3, 9964}, + /*II_0F_AE_03*/ {0x1d4, 9984}, + /*II_F3_0F_AE_03*/ {0x1d3, 9993}, + /*II_0F_C7_06*/ {0x1d6, 10013}, + /*II_66_0F_C7_06*/ {0x18b, 10022}, + /*II_F3_0F_C7_06*/ {0x18b, 10031} +}; + +_InstInfoEx InstInfosEx[381] = { + /*II_69*/ {{0x34, 117}, 0x0, 3, 0, 0, 0}, + /*II_6B*/ {{0x34, 117}, 0x0, 5, 0, 0, 0}, + /*II_98*/ {{0x4e, 228}, 0x0, 0, 0, 233, 239}, + /*II_99*/ {{0x4e, 245}, 0x0, 0, 0, 250, 255}, + /*II_E3*/ {{0x75, 426}, 0x0, 0, 0, 432, 439}, + /*II_0F_A4*/ {{0xad, 875}, 0x0, 1, 0, 0, 0}, + /*II_0F_A5*/ {{0xad, 875}, 0x0, 42, 0, 0, 0}, + /*II_0F_AC*/ {{0xad, 891}, 0x0, 1, 0, 0, 0}, + /*II_0F_AD*/ {{0xad, 891}, 0x0, 42, 0, 0, 0}, + /*II_V_0F_10*/ {{0x129, 2150}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_10*/ {{0x129, 2159}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_10*/ {{0x12a, 2168}, 0x20, 31, 0, 0, 0}, + /*II_V_F2_0F_10*/ {{0x12a, 2176}, 0x20, 31, 0, 0, 0}, + /*II_VRR_F3_0F_10*/ {{0x12b, 2168}, 0x60, 0, 0, 0, 0}, + /*II_VRR_F2_0F_10*/ {{0x12c, 2176}, 0x60, 0, 0, 0, 0}, + /*II_V_0F_11*/ {{0x131, 2150}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_11*/ {{0x131, 2159}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_11*/ {{0x12a, 2168}, 0x20, 31, 0, 0, 0}, + /*II_V_F2_0F_11*/ {{0x12a, 2176}, 0x20, 31, 0, 0, 0}, + /*II_VRR_F3_0F_11*/ {{0x132, 2168}, 0x60, 0, 0, 0, 0}, + /*II_VRR_F2_0F_11*/ {{0x133, 2176}, 0x60, 0, 0, 0, 0}, + /*II_0F_12*/ {{0x134, 2184}, 0x0, 0, 0, 2193, 0}, + /*II_V_0F_12*/ {{0x137, 2228}, 0x0, 86, 0, 2238, 0}, + /*II_V_66_0F_12*/ {{0x138, 2247}, 0x0, 57, 0, 0, 0}, + /*II_V_F3_0F_12*/ {{0x129, 2256}, 0x41, 0, 0, 0, 0}, + /*II_V_F2_0F_12*/ {{0x139, 2267}, 0x41, 0, 0, 0, 0}, + /*II_V_0F_13*/ {{0x13c, 2238}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_13*/ {{0x13c, 2247}, 0x40, 0, 0, 0, 0}, + /*II_V_0F_14*/ {{0x13f, 2297}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_14*/ {{0x13f, 2308}, 0x1, 91, 0, 0, 0}, + /*II_V_0F_15*/ {{0x13f, 2339}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_15*/ {{0x13f, 2350}, 0x1, 91, 0, 0, 0}, + /*II_0F_16*/ {{0x134, 2361}, 0x0, 0, 0, 2370, 0}, + /*II_V_0F_16*/ {{0x137, 2396}, 0x0, 86, 0, 2406, 0}, + /*II_V_66_0F_16*/ {{0x138, 2415}, 0x0, 57, 0, 0, 0}, + /*II_V_F3_0F_16*/ {{0x129, 2424}, 0x41, 0, 0, 0, 0}, + /*II_V_0F_17*/ {{0x13c, 2406}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_17*/ {{0x13c, 2415}, 0x40, 0, 0, 0, 0}, + /*II_V_0F_28*/ {{0x129, 2500}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_28*/ {{0x129, 2509}, 0x41, 0, 0, 0, 0}, + /*II_V_0F_29*/ {{0x131, 2500}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_29*/ {{0x131, 2509}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_2A*/ {{0x138, 2558}, 0x2, 73, 0, 0, 0}, + /*II_V_F2_0F_2A*/ {{0x138, 2569}, 0x2, 73, 0, 0, 0}, + /*II_V_0F_2B*/ {{0x14a, 2616}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_2B*/ {{0x14a, 2626}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_2C*/ {{0x14f, 2680}, 0x42, 0, 0, 0, 0}, + /*II_V_F2_0F_2C*/ {{0x14f, 2692}, 0x42, 0, 0, 0, 0}, + /*II_V_F3_0F_2D*/ {{0x14f, 2744}, 0x42, 0, 0, 0, 0}, + /*II_V_F2_0F_2D*/ {{0x14f, 2755}, 0x42, 0, 0, 0, 0}, + /*II_V_0F_2E*/ {{0x152, 2784}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_2E*/ {{0x153, 2794}, 0x40, 0, 0, 0, 0}, + /*II_V_0F_2F*/ {{0x152, 2820}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_2F*/ {{0x153, 2829}, 0x40, 0, 0, 0, 0}, + /*II_V_0F_50*/ {{0x156, 2858}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_50*/ {{0x156, 2869}, 0x41, 0, 0, 0, 0}, + /*II_V_0F_51*/ {{0x129, 2912}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_51*/ {{0x129, 2921}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_51*/ {{0x138, 2930}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_51*/ {{0x138, 2939}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_52*/ {{0x129, 2966}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_52*/ {{0x138, 2976}, 0x0, 85, 0, 0, 0}, + /*II_V_0F_53*/ {{0x129, 3000}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_53*/ {{0x138, 3008}, 0x0, 85, 0, 0, 0}, + /*II_V_0F_54*/ {{0x13f, 3030}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_54*/ {{0x13f, 3038}, 0x1, 91, 0, 0, 0}, + /*II_V_0F_55*/ {{0x13f, 3062}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_55*/ {{0x13f, 3071}, 0x1, 91, 0, 0, 0}, + /*II_V_0F_56*/ {{0x13f, 3092}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_56*/ {{0x13f, 3099}, 0x1, 91, 0, 0, 0}, + /*II_V_0F_57*/ {{0x13f, 3120}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_57*/ {{0x13f, 3128}, 0x1, 91, 0, 0, 0}, + /*II_V_0F_58*/ {{0x13f, 3164}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_58*/ {{0x13f, 3172}, 0x1, 91, 0, 0, 0}, + /*II_V_F3_0F_58*/ {{0x138, 3180}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_58*/ {{0x138, 3188}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_59*/ {{0x13f, 3224}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_59*/ {{0x13f, 3232}, 0x1, 91, 0, 0, 0}, + /*II_V_F3_0F_59*/ {{0x138, 3240}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_59*/ {{0x138, 3248}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_5A*/ {{0x159, 3296}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_5A*/ {{0x15a, 3307}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_5A*/ {{0x138, 3318}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_5A*/ {{0x138, 3329}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_5B*/ {{0x129, 3371}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_5B*/ {{0x129, 3382}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_5B*/ {{0x129, 3393}, 0x41, 0, 0, 0, 0}, + /*II_V_0F_5C*/ {{0x13f, 3433}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_5C*/ {{0x13f, 3441}, 0x1, 91, 0, 0, 0}, + /*II_V_F3_0F_5C*/ {{0x138, 3449}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_5C*/ {{0x138, 3457}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_5D*/ {{0x13f, 3493}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_5D*/ {{0x13f, 3501}, 0x1, 91, 0, 0, 0}, + /*II_V_F3_0F_5D*/ {{0x138, 3509}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_5D*/ {{0x138, 3517}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_5E*/ {{0x13f, 3553}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_5E*/ {{0x13f, 3561}, 0x1, 91, 0, 0, 0}, + /*II_V_F3_0F_5E*/ {{0x138, 3569}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_5E*/ {{0x138, 3577}, 0x0, 86, 0, 0, 0}, + /*II_V_0F_5F*/ {{0x13f, 3613}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_5F*/ {{0x13f, 3621}, 0x1, 91, 0, 0, 0}, + /*II_V_F3_0F_5F*/ {{0x138, 3629}, 0x0, 85, 0, 0, 0}, + /*II_V_F2_0F_5F*/ {{0x138, 3637}, 0x0, 86, 0, 0, 0}, + /*II_V_66_0F_60*/ {{0x138, 3656}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_61*/ {{0x138, 3679}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_62*/ {{0x138, 3702}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_63*/ {{0x138, 3724}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_64*/ {{0x138, 3744}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_65*/ {{0x138, 3763}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_66*/ {{0x138, 3782}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_67*/ {{0x138, 3802}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_68*/ {{0x138, 3824}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_69*/ {{0x138, 3847}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_6A*/ {{0x138, 3870}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_6B*/ {{0x138, 3892}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_6C*/ {{0x138, 3915}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_6D*/ {{0x138, 3940}, 0x0, 87, 0, 0, 0}, + /*II_0F_6E*/ {{0x15d, 3953}, 0x0, 0, 0, 0, 3959}, + /*II_66_0F_6E*/ {{0x15e, 3953}, 0x0, 0, 0, 0, 3959}, + /*II_V_66_0F_6E*/ {{0x15f, 3965}, 0x46, 0, 0, 3972, 0}, + /*II_V_66_0F_6F*/ {{0x129, 3995}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_6F*/ {{0x129, 4004}, 0x41, 0, 0, 0, 0}, + /*II_0F_70*/ {{0x161, 4013}, 0x0, 1, 0, 0, 0}, + /*II_66_0F_70*/ {{0x162, 4021}, 0x0, 1, 0, 0, 0}, + /*II_F3_0F_70*/ {{0x162, 4029}, 0x0, 1, 0, 0, 0}, + /*II_F2_0F_70*/ {{0x162, 4038}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_70*/ {{0x163, 4047}, 0x40, 1, 0, 0, 0}, + /*II_V_F3_0F_70*/ {{0x163, 4056}, 0x40, 1, 0, 0, 0}, + /*II_V_F2_0F_70*/ {{0x163, 4066}, 0x40, 1, 0, 0, 0}, + /*II_V_66_0F_74*/ {{0x138, 4085}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_75*/ {{0x138, 4104}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_76*/ {{0x138, 4123}, 0x0, 87, 0, 0, 0}, + /*II_V_0F_77*/ {{0x165, 4139}, 0x49, 0, 0, 4151, 0}, + /*II_66_0F_78*/ {{0x167, 4169}, 0x0, 49, 0, 0, 0}, + /*II_F2_0F_78*/ {{0x168, 4176}, 0x0, 48, 49, 0, 0}, + /*II_V_66_0F_7C*/ {{0x13f, 4230}, 0x1, 91, 0, 0, 0}, + /*II_V_F2_0F_7C*/ {{0x13f, 4239}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_7D*/ {{0x13f, 4264}, 0x1, 91, 0, 0, 0}, + /*II_V_F2_0F_7D*/ {{0x13f, 4273}, 0x1, 91, 0, 0, 0}, + /*II_0F_7E*/ {{0x16f, 3953}, 0x0, 0, 0, 0, 3959}, + /*II_66_0F_7E*/ {{0x170, 3953}, 0x0, 0, 0, 0, 3959}, + /*II_V_66_0F_7E*/ {{0x171, 3965}, 0x46, 0, 0, 3972, 0}, + /*II_V_F3_0F_7E*/ {{0x153, 3972}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_7F*/ {{0x131, 3995}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_7F*/ {{0x131, 4004}, 0x41, 0, 0, 0, 0}, + /*II_0F_AE_04*/ {{0x173, 4282}, 0x0, 0, 0, 0, 4289}, + /*II_0F_AE_05*/ {{0x174, 4298}, 0x0, 0, 0, 4306, 4314}, + /*II_0F_AE_06*/ {{0x174, 4324}, 0x0, 0, 0, 4332, 4342}, + /*II_0F_AE_07*/ {{0x175, 4354}, 0x0, 0, 0, 4362, 0}, + /*II_0F_C2*/ {{0x17c, 4403}, 0x0, 0, 0, 4412, 4421}, + /*II_66_0F_C2*/ {{0x17d, 4482}, 0x0, 0, 0, 4491, 4500}, + /*II_F3_0F_C2*/ {{0x17e, 4561}, 0x0, 0, 0, 4570, 4579}, + /*II_F2_0F_C2*/ {{0x17f, 4640}, 0x0, 0, 0, 4649, 4658}, + /*II_V_0F_C2*/ {{0x180, 4719}, 0x1, 91, 0, 4729, 4739}, + /*II_V_66_0F_C2*/ {{0x180, 5121}, 0x1, 91, 0, 5131, 5141}, + /*II_V_F3_0F_C2*/ {{0x181, 5523}, 0x0, 85, 0, 5533, 5543}, + /*II_V_F2_0F_C2*/ {{0x181, 5925}, 0x0, 86, 0, 5935, 5945}, + /*II_0F_C4*/ {{0x182, 6327}, 0x0, 1, 0, 0, 0}, + /*II_66_0F_C4*/ {{0x183, 6327}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_C4*/ {{0x184, 6335}, 0x0, 79, 1, 0, 0}, + /*II_0F_C5*/ {{0x185, 6344}, 0x0, 1, 0, 0, 0}, + /*II_66_0F_C5*/ {{0x186, 6344}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_C5*/ {{0x187, 6352}, 0x40, 1, 0, 0, 0}, + /*II_0F_C6*/ {{0x188, 6361}, 0x0, 1, 0, 0, 0}, + /*II_66_0F_C6*/ {{0x162, 6369}, 0x0, 1, 0, 0, 0}, + /*II_V_0F_C6*/ {{0x189, 6377}, 0x1, 91, 1, 0, 0}, + /*II_V_66_0F_C6*/ {{0x189, 6386}, 0x1, 91, 1, 0, 0}, + /*II_0F_C7_01*/ {{0x18a, 6395}, 0x0, 0, 0, 0, 6406}, + /*II_V_66_0F_D0*/ {{0x13f, 6447}, 0x1, 91, 0, 0, 0}, + /*II_V_F2_0F_D0*/ {{0x13f, 6458}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_D1*/ {{0x138, 6476}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_D2*/ {{0x138, 6491}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_D3*/ {{0x138, 6506}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_D4*/ {{0x138, 6521}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_D5*/ {{0x138, 6537}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_D6*/ {{0x18e, 3972}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_D7*/ {{0x191, 6574}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_D8*/ {{0x138, 6594}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_D9*/ {{0x138, 6613}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_DA*/ {{0x138, 6631}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_DB*/ {{0x138, 6646}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_DC*/ {{0x138, 6662}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_DD*/ {{0x138, 6662}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_DE*/ {{0x138, 6689}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_DF*/ {{0x138, 6705}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E0*/ {{0x138, 6720}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E1*/ {{0x138, 6735}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E2*/ {{0x138, 6750}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E3*/ {{0x138, 6765}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E4*/ {{0x138, 6782}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E5*/ {{0x138, 6800}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E6*/ {{0x15a, 6840}, 0x41, 0, 0, 0, 0}, + /*II_V_F3_0F_E6*/ {{0x159, 6852}, 0x41, 0, 0, 0, 0}, + /*II_V_F2_0F_E6*/ {{0x15a, 6863}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_E7*/ {{0x14a, 6891}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_E8*/ {{0x138, 6909}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_E9*/ {{0x138, 6926}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_EA*/ {{0x138, 6943}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_EB*/ {{0x138, 6957}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_EC*/ {{0x138, 6971}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_ED*/ {{0x138, 6988}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_EE*/ {{0x138, 7005}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_EF*/ {{0x138, 7020}, 0x0, 87, 0, 0, 0}, + /*II_V_F2_0F_F0*/ {{0x195, 7034}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_F1*/ {{0x138, 7049}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F2*/ {{0x138, 7064}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F3*/ {{0x138, 7079}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F4*/ {{0x138, 7096}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F5*/ {{0x138, 7115}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F6*/ {{0x138, 7133}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F7*/ {{0x199, 7164}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_F8*/ {{0x138, 7184}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_F9*/ {{0x138, 7199}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_FA*/ {{0x138, 7214}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_FB*/ {{0x138, 7229}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_FC*/ {{0x138, 7244}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_FD*/ {{0x138, 7259}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_FE*/ {{0x138, 7274}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_00*/ {{0x138, 7382}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_01*/ {{0x138, 7399}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_02*/ {{0x138, 7416}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_03*/ {{0x138, 7434}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_04*/ {{0x138, 7455}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_05*/ {{0x138, 7475}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_06*/ {{0x138, 7492}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_07*/ {{0x138, 7510}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_08*/ {{0x138, 7528}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_09*/ {{0x138, 7545}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_0A*/ {{0x138, 7562}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_0B*/ {{0x138, 7581}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_0C*/ {{0x13f, 7592}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_38_0D*/ {{0x13f, 7603}, 0x1, 91, 0, 0, 0}, + /*II_V_66_0F_38_0E*/ {{0x129, 7614}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_38_0F*/ {{0x129, 7623}, 0x41, 0, 0, 0, 0}, + /*II_66_0F_38_10*/ {{0x1a2, 7632}, 0x0, 32, 0, 0, 0}, + /*II_66_0F_38_14*/ {{0x1a2, 7642}, 0x0, 32, 0, 0, 0}, + /*II_66_0F_38_15*/ {{0x1a2, 7652}, 0x0, 32, 0, 0, 0}, + /*II_V_66_0F_38_17*/ {{0x129, 7669}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_38_18*/ {{0x1a4, 7677}, 0x41, 0, 0, 0, 0}, + /*II_V_66_0F_38_19*/ {{0x1a5, 7691}, 0x50, 0, 0, 0, 0}, + /*II_V_66_0F_38_1A*/ {{0x1a6, 7705}, 0x50, 0, 0, 0, 0}, + /*II_V_66_0F_38_1C*/ {{0x1a7, 7728}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_1D*/ {{0x1a7, 7743}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_1E*/ {{0x1a7, 7758}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_20*/ {{0x153, 7776}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_21*/ {{0x152, 7797}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_22*/ {{0x1ab, 7818}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_23*/ {{0x153, 7839}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_24*/ {{0x152, 7860}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_25*/ {{0x153, 7881}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_28*/ {{0x138, 7900}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_29*/ {{0x138, 7918}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_2A*/ {{0x1ae, 7938}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_2B*/ {{0x138, 7959}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_2C*/ {{0x13f, 7970}, 0x1, 67, 0, 0, 0}, + /*II_V_66_0F_38_2D*/ {{0x13f, 7982}, 0x1, 67, 0, 0, 0}, + /*II_V_66_0F_38_2E*/ {{0x1af, 7970}, 0x1, 36, 0, 0, 0}, + /*II_V_66_0F_38_2F*/ {{0x1af, 7982}, 0x1, 36, 0, 0, 0}, + /*II_V_66_0F_38_30*/ {{0x153, 8004}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_31*/ {{0x152, 8025}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_32*/ {{0x1ab, 8046}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_33*/ {{0x153, 8067}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_34*/ {{0x152, 8088}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_35*/ {{0x153, 8109}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_37*/ {{0x138, 8129}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_38*/ {{0x138, 8147}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_39*/ {{0x138, 8164}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_3A*/ {{0x138, 8181}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_3B*/ {{0x138, 8198}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_3C*/ {{0x138, 8215}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_3D*/ {{0x138, 8232}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_3E*/ {{0x138, 8249}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_3F*/ {{0x138, 8266}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_40*/ {{0x138, 8283}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_41*/ {{0x1a7, 8304}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_96*/ {{0x1b1, 8343}, 0x7, 91, 0, 8359, 0}, + /*II_V_66_0F_38_97*/ {{0x1b1, 8375}, 0x7, 91, 0, 8391, 0}, + /*II_V_66_0F_38_98*/ {{0x1b1, 8407}, 0x7, 91, 0, 8420, 0}, + /*II_V_66_0F_38_99*/ {{0x1b2, 8433}, 0x6, 88, 0, 8446, 0}, + /*II_V_66_0F_38_9A*/ {{0x1b1, 8459}, 0x7, 91, 0, 8472, 0}, + /*II_V_66_0F_38_9B*/ {{0x1b2, 8485}, 0x6, 88, 0, 8498, 0}, + /*II_V_66_0F_38_9C*/ {{0x1b1, 8511}, 0x7, 91, 0, 8525, 0}, + /*II_V_66_0F_38_9D*/ {{0x1b2, 8539}, 0x6, 88, 0, 8553, 0}, + /*II_V_66_0F_38_9E*/ {{0x1b1, 8567}, 0x7, 91, 0, 8581, 0}, + /*II_V_66_0F_38_9F*/ {{0x1b2, 8595}, 0x6, 88, 0, 8609, 0}, + /*II_V_66_0F_38_A6*/ {{0x1b1, 8623}, 0x7, 91, 0, 8639, 0}, + /*II_V_66_0F_38_A7*/ {{0x1b1, 8655}, 0x7, 91, 0, 8671, 0}, + /*II_V_66_0F_38_A8*/ {{0x1b1, 8687}, 0x7, 91, 0, 8700, 0}, + /*II_V_66_0F_38_A9*/ {{0x1b2, 8713}, 0x6, 88, 0, 8726, 0}, + /*II_V_66_0F_38_AA*/ {{0x1b1, 8739}, 0x7, 91, 0, 8752, 0}, + /*II_V_66_0F_38_AB*/ {{0x1b2, 8765}, 0x6, 88, 0, 8778, 0}, + /*II_V_66_0F_38_AC*/ {{0x1b1, 8791}, 0x7, 91, 0, 8805, 0}, + /*II_V_66_0F_38_AD*/ {{0x1b2, 8819}, 0x6, 88, 0, 8833, 0}, + /*II_V_66_0F_38_AE*/ {{0x1b1, 8847}, 0x7, 91, 0, 8861, 0}, + /*II_V_66_0F_38_AF*/ {{0x1b2, 8875}, 0x6, 88, 0, 8889, 0}, + /*II_V_66_0F_38_B6*/ {{0x1b1, 8903}, 0x7, 91, 0, 8919, 0}, + /*II_V_66_0F_38_B7*/ {{0x1b1, 8935}, 0x7, 91, 0, 8951, 0}, + /*II_V_66_0F_38_B8*/ {{0x1b1, 8967}, 0x7, 91, 0, 8980, 0}, + /*II_V_66_0F_38_B9*/ {{0x1b2, 8993}, 0x6, 88, 0, 9006, 0}, + /*II_V_66_0F_38_BA*/ {{0x1b1, 9019}, 0x7, 91, 0, 9032, 0}, + /*II_V_66_0F_38_BB*/ {{0x1b2, 9045}, 0x6, 88, 0, 9058, 0}, + /*II_V_66_0F_38_BC*/ {{0x1b1, 9071}, 0x7, 91, 0, 9085, 0}, + /*II_V_66_0F_38_BD*/ {{0x1b2, 9099}, 0x6, 88, 0, 9113, 0}, + /*II_V_66_0F_38_BE*/ {{0x1b1, 9127}, 0x7, 91, 0, 9141, 0}, + /*II_V_66_0F_38_BF*/ {{0x1b2, 9155}, 0x6, 88, 0, 9169, 0}, + /*II_V_66_0F_38_DB*/ {{0x1b4, 9191}, 0x40, 0, 0, 0, 0}, + /*II_V_66_0F_38_DC*/ {{0x1b5, 9208}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_DD*/ {{0x1b5, 9229}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_DE*/ {{0x1b5, 9250}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_38_DF*/ {{0x1b5, 9271}, 0x0, 87, 0, 0, 0}, + /*II_V_66_0F_3A_04*/ {{0x1ba, 7592}, 0x41, 1, 0, 0, 0}, + /*II_V_66_0F_3A_05*/ {{0x1ba, 7603}, 0x41, 1, 0, 0, 0}, + /*II_V_66_0F_3A_06*/ {{0x1bb, 9298}, 0x10, 89, 1, 0, 0}, + /*II_66_0F_3A_08*/ {{0x1a2, 9310}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_08*/ {{0x1ba, 9319}, 0x41, 1, 0, 0, 0}, + /*II_66_0F_3A_09*/ {{0x1a2, 9329}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_09*/ {{0x1ba, 9338}, 0x41, 1, 0, 0, 0}, + /*II_66_0F_3A_0A*/ {{0x1bc, 9348}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_0A*/ {{0x184, 9357}, 0x0, 85, 1, 0, 0}, + /*II_66_0F_3A_0B*/ {{0x1bd, 9367}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_0B*/ {{0x184, 9376}, 0x0, 86, 1, 0, 0}, + /*II_66_0F_3A_0C*/ {{0x1a2, 9386}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_0C*/ {{0x189, 9395}, 0x1, 91, 1, 0, 0}, + /*II_66_0F_3A_0D*/ {{0x1a2, 9405}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_0D*/ {{0x189, 9414}, 0x1, 91, 1, 0, 0}, + /*II_66_0F_3A_0E*/ {{0x1a2, 9424}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_0E*/ {{0x184, 9433}, 0x0, 87, 1, 0, 0}, + /*II_0F_3A_0F*/ {{0x1be, 9443}, 0x0, 1, 0, 0, 0}, + /*II_66_0F_3A_0F*/ {{0x1bf, 9443}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_0F*/ {{0x184, 9452}, 0x0, 87, 1, 0, 0}, + /*II_66_0F_3A_14*/ {{0x1c0, 9462}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_14*/ {{0x1c1, 9470}, 0x40, 1, 0, 0, 0}, + /*II_66_0F_3A_15*/ {{0x1c2, 6344}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_15*/ {{0x1c3, 6352}, 0x40, 1, 0, 0, 0}, + /*II_66_0F_3A_16*/ {{0x1c4, 9479}, 0x0, 1, 0, 0, 9487}, + /*II_V_66_0F_3A_16*/ {{0x1c5, 9495}, 0x46, 1, 0, 9504, 0}, + /*II_66_0F_3A_17*/ {{0x1c6, 9513}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_17*/ {{0x1c7, 9524}, 0x40, 1, 0, 0, 0}, + /*II_V_66_0F_3A_18*/ {{0x1bb, 9536}, 0x10, 87, 1, 0, 0}, + /*II_V_66_0F_3A_19*/ {{0x1c8, 9549}, 0x50, 1, 0, 0, 0}, + /*II_66_0F_3A_20*/ {{0x1c9, 9563}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_20*/ {{0x184, 9571}, 0x0, 80, 1, 0, 0}, + /*II_66_0F_3A_21*/ {{0x1bc, 9580}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_21*/ {{0x184, 9590}, 0x0, 85, 1, 0, 0}, + /*II_66_0F_3A_22*/ {{0x1ca, 9601}, 0x0, 1, 0, 0, 9609}, + /*II_V_66_0F_3A_22*/ {{0x184, 9617}, 0x6, 73, 1, 9626, 0}, + /*II_66_0F_3A_40*/ {{0x1a2, 9635}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_40*/ {{0x189, 9641}, 0x1, 91, 1, 0, 0}, + /*II_66_0F_3A_41*/ {{0x1a2, 9648}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_41*/ {{0x184, 9654}, 0x0, 87, 1, 0, 0}, + /*II_66_0F_3A_42*/ {{0x1a2, 9661}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_42*/ {{0x184, 9670}, 0x0, 87, 1, 0, 0}, + /*II_66_0F_3A_44*/ {{0x1cb, 9680}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_44*/ {{0x1cc, 9691}, 0x0, 87, 1, 0, 0}, + /*II_V_66_0F_3A_4A*/ {{0x189, 9703}, 0x1, 91, 37, 0, 0}, + /*II_V_66_0F_3A_4B*/ {{0x189, 9714}, 0x1, 91, 37, 0, 0}, + /*II_V_66_0F_3A_4C*/ {{0x184, 9725}, 0x0, 87, 35, 0, 0}, + /*II_66_0F_3A_60*/ {{0x1cd, 9736}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_60*/ {{0x163, 9747}, 0x40, 1, 0, 0, 0}, + /*II_66_0F_3A_61*/ {{0x1cd, 9759}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_61*/ {{0x163, 9770}, 0x40, 1, 0, 0, 0}, + /*II_66_0F_3A_62*/ {{0x1cd, 9782}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_62*/ {{0x163, 9793}, 0x40, 1, 0, 0, 0}, + /*II_66_0F_3A_63*/ {{0x1cd, 9805}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_63*/ {{0x163, 9816}, 0x40, 1, 0, 0, 0}, + /*II_66_0F_3A_DF*/ {{0x1ce, 9828}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_3A_DF*/ {{0x1cf, 9845}, 0x40, 1, 0, 0, 0}, + /*II_V_66_0F_71_02*/ {{0x1d2, 6476}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_71_04*/ {{0x1d2, 6735}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_71_06*/ {{0x1d2, 7049}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_72_02*/ {{0x1d2, 6491}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_72_04*/ {{0x1d2, 6750}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_72_06*/ {{0x1d2, 7064}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_73_02*/ {{0x1d2, 6506}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_73_03*/ {{0x1d2, 9871}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_73_06*/ {{0x1d2, 7079}, 0x0, 1, 0, 0, 0}, + /*II_V_66_0F_73_07*/ {{0x1d2, 9888}, 0x0, 1, 0, 0, 0}, + /*II_0F_AE_00*/ {{0x173, 9897}, 0x0, 0, 0, 0, 9905}, + /*II_0F_AE_01*/ {{0x173, 9925}, 0x0, 0, 0, 0, 9934}, + /*II_V_0F_AE_02*/ {{0x1d5, 9974}, 0x40, 0, 0, 0, 0}, + /*II_V_0F_AE_03*/ {{0x1d5, 10003}, 0x40, 0, 0, 0, 0} +}; + +_InstNode InstructionsTree[5688] = { +/* 0 - _00 */ 0x2000, +/* 1 - _01 */ 0x2001, +/* 2 - _02 */ 0x2002, +/* 3 - _03 */ 0x2003, +/* 4 - _04 */ 0x2004, +/* 5 - _05 */ 0x2005, +/* 6 - _06 */ 0x2006, +/* 7 - _07 */ 0x2007, +/* 8 - _08 */ 0x2008, +/* 9 - _09 */ 0x2009, +/* a - _0A */ 0x200a, +/* b - _0B */ 0x200b, +/* c - _0C */ 0x200c, +/* d - _0D */ 0x200d, +/* e - _0E */ 0x200e, +/* f - _0F */ 0xa100, +/* 10 - _10 */ 0x200f, +/* 11 - _11 */ 0x2010, +/* 12 - _12 */ 0x2011, +/* 13 - _13 */ 0x2012, +/* 14 - _14 */ 0x2013, +/* 15 - _15 */ 0x2014, +/* 16 - _16 */ 0x2015, +/* 17 - _17 */ 0x2016, +/* 18 - _18 */ 0x2017, +/* 19 - _19 */ 0x2018, +/* 1a - _1A */ 0x2019, +/* 1b - _1B */ 0x201a, +/* 1c - _1C */ 0x201b, +/* 1d - _1D */ 0x201c, +/* 1e - _1E */ 0x201d, +/* 1f - _1F */ 0x201e, +/* 20 - _20 */ 0x201f, +/* 21 - _21 */ 0x2020, +/* 22 - _22 */ 0x2021, +/* 23 - _23 */ 0x2022, +/* 24 - _24 */ 0x2023, +/* 25 - _25 */ 0x2024, +/* 26 - */ 0, +/* 27 - _27 */ 0x2025, +/* 28 - _28 */ 0x2026, +/* 29 - _29 */ 0x2027, +/* 2a - _2A */ 0x2028, +/* 2b - _2B */ 0x2029, +/* 2c - _2C */ 0x202a, +/* 2d - _2D */ 0x202b, +/* 2e - */ 0, +/* 2f - _2F */ 0x202c, +/* 30 - _30 */ 0x202d, +/* 31 - _31 */ 0x202e, +/* 32 - _32 */ 0x202f, +/* 33 - _33 */ 0x2030, +/* 34 - _34 */ 0x2031, +/* 35 - _35 */ 0x2032, +/* 36 - */ 0, +/* 37 - _37 */ 0x2033, +/* 38 - _38 */ 0x2034, +/* 39 - _39 */ 0x2035, +/* 3a - _3A */ 0x2036, +/* 3b - _3B */ 0x2037, +/* 3c - _3C */ 0x2038, +/* 3d - _3D */ 0x2039, +/* 3e - */ 0, +/* 3f - _3F */ 0x203a, +/* 40 - _40 */ 0x203b, +/* 41 - _40 */ 0x203c, +/* 42 - _40 */ 0x203d, +/* 43 - _40 */ 0x203e, +/* 44 - _40 */ 0x203f, +/* 45 - _40 */ 0x2040, +/* 46 - _40 */ 0x2041, +/* 47 - _40 */ 0x2042, +/* 48 - _48 */ 0x2043, +/* 49 - _48 */ 0x2044, +/* 4a - _48 */ 0x2045, +/* 4b - _48 */ 0x2046, +/* 4c - _48 */ 0x2047, +/* 4d - _48 */ 0x2048, +/* 4e - _48 */ 0x2049, +/* 4f - _48 */ 0x204a, +/* 50 - _50 */ 0x204b, +/* 51 - _50 */ 0x204c, +/* 52 - _50 */ 0x204d, +/* 53 - _50 */ 0x204e, +/* 54 - _50 */ 0x204f, +/* 55 - _50 */ 0x2050, +/* 56 - _50 */ 0x2051, +/* 57 - _50 */ 0x2052, +/* 58 - _58 */ 0x2053, +/* 59 - _58 */ 0x2054, +/* 5a - _58 */ 0x2055, +/* 5b - _58 */ 0x2056, +/* 5c - _58 */ 0x2057, +/* 5d - _58 */ 0x2058, +/* 5e - _58 */ 0x2059, +/* 5f - _58 */ 0x205a, +/* 60 - _60 */ 0x205b, +/* 61 - _61 */ 0x205c, +/* 62 - _62 */ 0x205d, +/* 63 - _63 */ 0x605e, +/* 64 - */ 0, +/* 65 - */ 0, +/* 66 - */ 0, +/* 67 - */ 0, +/* 68 - _68 */ 0x205f, +/* 69 - _69 */ 0x4000, +/* 6a - _6A */ 0x2060, +/* 6b - _6B */ 0x4001, +/* 6c - _6C */ 0x2061, +/* 6d - _6D */ 0x2062, +/* 6e - _6E */ 0x2063, +/* 6f - _6F */ 0x2064, +/* 70 - _70 */ 0x2065, +/* 71 - _71 */ 0x2066, +/* 72 - _72 */ 0x2067, +/* 73 - _73 */ 0x2068, +/* 74 - _74 */ 0x2069, +/* 75 - _75 */ 0x206a, +/* 76 - _76 */ 0x206b, +/* 77 - _77 */ 0x206c, +/* 78 - _78 */ 0x206d, +/* 79 - _79 */ 0x206e, +/* 7a - _7A */ 0x206f, +/* 7b - _7B */ 0x2070, +/* 7c - _7C */ 0x2071, +/* 7d - _7D */ 0x2072, +/* 7e - _7E */ 0x2073, +/* 7f - _7F */ 0x2074, +/* 80 - _80 */ 0x8200, +/* 81 - _81 */ 0x8208, +/* 82 - _82 */ 0x8210, +/* 83 - _83 */ 0x8218, +/* 84 - _84 */ 0x2075, +/* 85 - _85 */ 0x2076, +/* 86 - _86 */ 0x2077, +/* 87 - _87 */ 0x2078, +/* 88 - _88 */ 0x2079, +/* 89 - _89 */ 0x207a, +/* 8a - _8A */ 0x207b, +/* 8b - _8B */ 0x207c, +/* 8c - _8C */ 0x207d, +/* 8d - _8D */ 0x607e, +/* 8e - _8E */ 0x207f, +/* 8f - _8F */ 0x8220, +/* 90 - _90 */ 0x6080, +/* 91 - _91 */ 0x2081, +/* 92 - _92 */ 0x2082, +/* 93 - _93 */ 0x2083, +/* 94 - _94 */ 0x2084, +/* 95 - _95 */ 0x2085, +/* 96 - _96 */ 0x2086, +/* 97 - _97 */ 0x2087, +/* 98 - _98 */ 0x4002, +/* 99 - _99 */ 0x4003, +/* 9a - _9A */ 0x2088, +/* 9b - */ 0, +/* 9c - _9C */ 0x2089, +/* 9d - _9D */ 0x208a, +/* 9e - _9E */ 0x208b, +/* 9f - _9F */ 0x208c, +/* a0 - _A0 */ 0x208d, +/* a1 - _A1 */ 0x208e, +/* a2 - _A2 */ 0x208f, +/* a3 - _A3 */ 0x2090, +/* a4 - _A4 */ 0x2091, +/* a5 - _A5 */ 0x2092, +/* a6 - _A6 */ 0x2093, +/* a7 - _A7 */ 0x2094, +/* a8 - _A8 */ 0x2095, +/* a9 - _A9 */ 0x2096, +/* aa - _AA */ 0x2097, +/* ab - _AB */ 0x2098, +/* ac - _AC */ 0x2099, +/* ad - _AD */ 0x209a, +/* ae - _AE */ 0x209b, +/* af - _AF */ 0x209c, +/* b0 - _B0 */ 0x209d, +/* b1 - _B0 */ 0x209e, +/* b2 - _B0 */ 0x209f, +/* b3 - _B0 */ 0x20a0, +/* b4 - _B0 */ 0x20a1, +/* b5 - _B0 */ 0x20a2, +/* b6 - _B0 */ 0x20a3, +/* b7 - _B0 */ 0x20a4, +/* b8 - _B8 */ 0x20a5, +/* b9 - _B8 */ 0x20a6, +/* ba - _B8 */ 0x20a7, +/* bb - _B8 */ 0x20a8, +/* bc - _B8 */ 0x20a9, +/* bd - _B8 */ 0x20aa, +/* be - _B8 */ 0x20ab, +/* bf - _B8 */ 0x20ac, +/* c0 - _C0 */ 0x8228, +/* c1 - _C1 */ 0x8230, +/* c2 - _C2 */ 0x20ad, +/* c3 - _C3 */ 0x20ae, +/* c4 - _C4 */ 0x20af, +/* c5 - _C5 */ 0x20b0, +/* c6 - _C6 */ 0xc238, +/* c7 - _C7 */ 0xc280, +/* c8 - _C8 */ 0x20b1, +/* c9 - _C9 */ 0x20b2, +/* ca - _CA */ 0x20b3, +/* cb - _CB */ 0x20b4, +/* cc - _CC */ 0x20b5, +/* cd - _CD */ 0x20b6, +/* ce - _CE */ 0x20b7, +/* cf - _CF */ 0x20b8, +/* d0 - _D0 */ 0x82c8, +/* d1 - _D1 */ 0x82d0, +/* d2 - _D2 */ 0x82d8, +/* d3 - _D3 */ 0x82e0, +/* d4 - _D4 */ 0x20b9, +/* d5 - _D5 */ 0x20ba, +/* d6 - _D6 */ 0x20bb, +/* d7 - _D7 */ 0x20bc, +/* d8 - _D8 */ 0xc2e8, +/* d9 - _D9 */ 0xc330, +/* da - _DA */ 0xc378, +/* db - _DB */ 0xc3c0, +/* dc - _DC */ 0xc408, +/* dd - _DD */ 0xc450, +/* de - _DE */ 0xc498, +/* df - _DF */ 0xc4e0, +/* e0 - _E0 */ 0x20bd, +/* e1 - _E1 */ 0x20be, +/* e2 - _E2 */ 0x20bf, +/* e3 - _E3 */ 0x4004, +/* e4 - _E4 */ 0x20c0, +/* e5 - _E5 */ 0x20c1, +/* e6 - _E6 */ 0x20c2, +/* e7 - _E7 */ 0x20c3, +/* e8 - _E8 */ 0x20c4, +/* e9 - _E9 */ 0x20c5, +/* ea - _EA */ 0x20c6, +/* eb - _EB */ 0x20c7, +/* ec - _EC */ 0x20c8, +/* ed - _ED */ 0x20c9, +/* ee - _EE */ 0x20ca, +/* ef - _EF */ 0x20cb, +/* f0 - */ 0, +/* f1 - _F1 */ 0x20cc, +/* f2 - */ 0, +/* f3 - */ 0, +/* f4 - _F4 */ 0x20cd, +/* f5 - _F5 */ 0x20ce, +/* f6 - _F6 */ 0x8528, +/* f7 - _F7 */ 0x8530, +/* f8 - _F8 */ 0x20cf, +/* f9 - _F9 */ 0x20d0, +/* fa - _FA */ 0x20d1, +/* fb - _FB */ 0x20d2, +/* fc - _FC */ 0x20d3, +/* fd - _FD */ 0x20d4, +/* fe - _FE */ 0x8538, +/* ff - _FF */ 0x8540, +/* 100 - _0F_00 */ 0x8548, +/* 101 - _0F_01 */ 0xc550, +/* 102 - _0F_02 */ 0x20d5, +/* 103 - _0F_03 */ 0x20d6, +/* 104 - */ 0, +/* 105 - _0F_05 */ 0x20d7, +/* 106 - _0F_06 */ 0x20d8, +/* 107 - _0F_07 */ 0x20d9, +/* 108 - _0F_08 */ 0x20da, +/* 109 - _0F_09 */ 0x20db, +/* 10a - */ 0, +/* 10b - _0F_0B */ 0x20dc, +/* 10c - */ 0, +/* 10d - _0F_0D */ 0x8598, +/* 10e - _0F_0E */ 0x20dd, +/* 10f - _0F_0F */ 0xa5a0, +/* 110 - _0F_10 */ 0xe6a0, +/* 111 - _0F_11 */ 0xe6ac, +/* 112 - _0F_12 */ 0xe6b8, +/* 113 - _0F_13 */ 0xe6c4, +/* 114 - _0F_14 */ 0xe6d0, +/* 115 - _0F_15 */ 0xe6dc, +/* 116 - _0F_16 */ 0xe6e8, +/* 117 - _0F_17 */ 0xe6f4, +/* 118 - _0F_18 */ 0x8700, +/* 119 - */ 0, +/* 11a - */ 0, +/* 11b - */ 0, +/* 11c - */ 0, +/* 11d - */ 0, +/* 11e - */ 0, +/* 11f - _0F_1F */ 0x20de, +/* 120 - _0F_20 */ 0x20df, +/* 121 - _0F_21 */ 0x20e0, +/* 122 - _0F_22 */ 0x20e1, +/* 123 - _0F_23 */ 0x20e2, +/* 124 - */ 0, +/* 125 - */ 0, +/* 126 - */ 0, +/* 127 - */ 0, +/* 128 - _0F_28 */ 0xe708, +/* 129 - _0F_29 */ 0xe714, +/* 12a - _0F_2A */ 0xe720, +/* 12b - _0F_2B */ 0xe72c, +/* 12c - _0F_2C */ 0xe738, +/* 12d - _0F_2D */ 0xe744, +/* 12e - _0F_2E */ 0xe750, +/* 12f - _0F_2F */ 0xe75c, +/* 130 - _0F_30 */ 0x20e3, +/* 131 - _0F_31 */ 0x20e4, +/* 132 - _0F_32 */ 0x20e5, +/* 133 - _0F_33 */ 0x20e6, +/* 134 - _0F_34 */ 0x20e7, +/* 135 - _0F_35 */ 0x20e8, +/* 136 - */ 0, +/* 137 - _0F_37 */ 0x20e9, +/* 138 - _0F_38 */ 0xa768, +/* 139 - */ 0, +/* 13a - _0F_3A */ 0xa868, +/* 13b - */ 0, +/* 13c - */ 0, +/* 13d - */ 0, +/* 13e - */ 0, +/* 13f - */ 0, +/* 140 - _0F_40 */ 0x20ea, +/* 141 - _0F_41 */ 0x20eb, +/* 142 - _0F_42 */ 0x20ec, +/* 143 - _0F_43 */ 0x20ed, +/* 144 - _0F_44 */ 0x20ee, +/* 145 - _0F_45 */ 0x20ef, +/* 146 - _0F_46 */ 0x20f0, +/* 147 - _0F_47 */ 0x20f1, +/* 148 - _0F_48 */ 0x20f2, +/* 149 - _0F_49 */ 0x20f3, +/* 14a - _0F_4A */ 0x20f4, +/* 14b - _0F_4B */ 0x20f5, +/* 14c - _0F_4C */ 0x20f6, +/* 14d - _0F_4D */ 0x20f7, +/* 14e - _0F_4E */ 0x20f8, +/* 14f - _0F_4F */ 0x20f9, +/* 150 - _0F_50 */ 0xe968, +/* 151 - _0F_51 */ 0xe974, +/* 152 - _0F_52 */ 0xe980, +/* 153 - _0F_53 */ 0xe98c, +/* 154 - _0F_54 */ 0xe998, +/* 155 - _0F_55 */ 0xe9a4, +/* 156 - _0F_56 */ 0xe9b0, +/* 157 - _0F_57 */ 0xe9bc, +/* 158 - _0F_58 */ 0xe9c8, +/* 159 - _0F_59 */ 0xe9d4, +/* 15a - _0F_5A */ 0xe9e0, +/* 15b - _0F_5B */ 0xe9ec, +/* 15c - _0F_5C */ 0xe9f8, +/* 15d - _0F_5D */ 0xea04, +/* 15e - _0F_5E */ 0xea10, +/* 15f - _0F_5F */ 0xea1c, +/* 160 - _0F_60 */ 0xea28, +/* 161 - _0F_61 */ 0xea34, +/* 162 - _0F_62 */ 0xea40, +/* 163 - _0F_63 */ 0xea4c, +/* 164 - _0F_64 */ 0xea58, +/* 165 - _0F_65 */ 0xea64, +/* 166 - _0F_66 */ 0xea70, +/* 167 - _0F_67 */ 0xea7c, +/* 168 - _0F_68 */ 0xea88, +/* 169 - _0F_69 */ 0xea94, +/* 16a - _0F_6A */ 0xeaa0, +/* 16b - _0F_6B */ 0xeaac, +/* 16c - _0F_6C */ 0xeab8, +/* 16d - _0F_6D */ 0xeac4, +/* 16e - _0F_6E */ 0xead0, +/* 16f - _0F_6F */ 0xeadc, +/* 170 - _0F_70 */ 0xeae8, +/* 171 - _0F_71 */ 0x8af4, +/* 172 - _0F_72 */ 0x8afc, +/* 173 - _0F_73 */ 0x8b04, +/* 174 - _0F_74 */ 0xeb0c, +/* 175 - _0F_75 */ 0xeb18, +/* 176 - _0F_76 */ 0xeb24, +/* 177 - _0F_77 */ 0xeb30, +/* 178 - _0F_78 */ 0xeb3c, +/* 179 - _0F_79 */ 0xeb48, +/* 17a - _0F_7A */ 0xab54, +/* 17b - */ 0, +/* 17c - _0F_7C */ 0xec54, +/* 17d - _0F_7D */ 0xec60, +/* 17e - _0F_7E */ 0xec6c, +/* 17f - _0F_7F */ 0xec78, +/* 180 - _0F_80 */ 0x20fa, +/* 181 - _0F_81 */ 0x20fb, +/* 182 - _0F_82 */ 0x20fc, +/* 183 - _0F_83 */ 0x20fd, +/* 184 - _0F_84 */ 0x20fe, +/* 185 - _0F_85 */ 0x20ff, +/* 186 - _0F_86 */ 0x2100, +/* 187 - _0F_87 */ 0x2101, +/* 188 - _0F_88 */ 0x2102, +/* 189 - _0F_89 */ 0x2103, +/* 18a - _0F_8A */ 0x2104, +/* 18b - _0F_8B */ 0x2105, +/* 18c - _0F_8C */ 0x2106, +/* 18d - _0F_8D */ 0x2107, +/* 18e - _0F_8E */ 0x2108, +/* 18f - _0F_8F */ 0x2109, +/* 190 - _0F_90 */ 0x210a, +/* 191 - _0F_91 */ 0x210b, +/* 192 - _0F_92 */ 0x210c, +/* 193 - _0F_93 */ 0x210d, +/* 194 - _0F_94 */ 0x210e, +/* 195 - _0F_95 */ 0x210f, +/* 196 - _0F_96 */ 0x2110, +/* 197 - _0F_97 */ 0x2111, +/* 198 - _0F_98 */ 0x2112, +/* 199 - _0F_99 */ 0x2113, +/* 19a - _0F_9A */ 0x2114, +/* 19b - _0F_9B */ 0x2115, +/* 19c - _0F_9C */ 0x2116, +/* 19d - _0F_9D */ 0x2117, +/* 19e - _0F_9E */ 0x2118, +/* 19f - _0F_9F */ 0x2119, +/* 1a0 - _0F_A0 */ 0x211a, +/* 1a1 - _0F_A1 */ 0x211b, +/* 1a2 - _0F_A2 */ 0x211c, +/* 1a3 - _0F_A3 */ 0x211d, +/* 1a4 - _0F_A4 */ 0x4005, +/* 1a5 - _0F_A5 */ 0x4006, +/* 1a6 - */ 0, +/* 1a7 - */ 0, +/* 1a8 - _0F_A8 */ 0x211e, +/* 1a9 - _0F_A9 */ 0x211f, +/* 1aa - _0F_AA */ 0x2120, +/* 1ab - _0F_AB */ 0x2121, +/* 1ac - _0F_AC */ 0x4007, +/* 1ad - _0F_AD */ 0x4008, +/* 1ae - _0F_AE */ 0x8c84, +/* 1af - _0F_AF */ 0x2122, +/* 1b0 - _0F_B0 */ 0x2123, +/* 1b1 - _0F_B1 */ 0x2124, +/* 1b2 - _0F_B2 */ 0x2125, +/* 1b3 - _0F_B3 */ 0x2126, +/* 1b4 - _0F_B4 */ 0x2127, +/* 1b5 - _0F_B5 */ 0x2128, +/* 1b6 - _0F_B6 */ 0x2129, +/* 1b7 - _0F_B7 */ 0x212a, +/* 1b8 - _0F_B8 */ 0xec8c, +/* 1b9 - _0F_B9 */ 0x212b, +/* 1ba - _0F_BA */ 0x8c98, +/* 1bb - _0F_BB */ 0x212c, +/* 1bc - _0F_BC */ 0xeca0, +/* 1bd - _0F_BD */ 0xecac, +/* 1be - _0F_BE */ 0x212d, +/* 1bf - _0F_BF */ 0x212e, +/* 1c0 - _0F_C0 */ 0x212f, +/* 1c1 - _0F_C1 */ 0x2130, +/* 1c2 - _0F_C2 */ 0xecb8, +/* 1c3 - _0F_C3 */ 0x2131, +/* 1c4 - _0F_C4 */ 0xecc4, +/* 1c5 - _0F_C5 */ 0xecd0, +/* 1c6 - _0F_C6 */ 0xecdc, +/* 1c7 - _0F_C7 */ 0x8ce8, +/* 1c8 - _0F_C8 */ 0x2132, +/* 1c9 - _0F_C8 */ 0x2133, +/* 1ca - _0F_C8 */ 0x2134, +/* 1cb - _0F_C8 */ 0x2135, +/* 1cc - _0F_C8 */ 0x2136, +/* 1cd - _0F_C8 */ 0x2137, +/* 1ce - _0F_C8 */ 0x2138, +/* 1cf - _0F_C8 */ 0x2139, +/* 1d0 - _0F_D0 */ 0xecf0, +/* 1d1 - _0F_D1 */ 0xecfc, +/* 1d2 - _0F_D2 */ 0xed08, +/* 1d3 - _0F_D3 */ 0xed14, +/* 1d4 - _0F_D4 */ 0xed20, +/* 1d5 - _0F_D5 */ 0xed2c, +/* 1d6 - _0F_D6 */ 0xed38, +/* 1d7 - _0F_D7 */ 0xed44, +/* 1d8 - _0F_D8 */ 0xed50, +/* 1d9 - _0F_D9 */ 0xed5c, +/* 1da - _0F_DA */ 0xed68, +/* 1db - _0F_DB */ 0xed74, +/* 1dc - _0F_DC */ 0xed80, +/* 1dd - _0F_DD */ 0xed8c, +/* 1de - _0F_DE */ 0xed98, +/* 1df - _0F_DF */ 0xeda4, +/* 1e0 - _0F_E0 */ 0xedb0, +/* 1e1 - _0F_E1 */ 0xedbc, +/* 1e2 - _0F_E2 */ 0xedc8, +/* 1e3 - _0F_E3 */ 0xedd4, +/* 1e4 - _0F_E4 */ 0xede0, +/* 1e5 - _0F_E5 */ 0xedec, +/* 1e6 - _0F_E6 */ 0xedf8, +/* 1e7 - _0F_E7 */ 0xee04, +/* 1e8 - _0F_E8 */ 0xee10, +/* 1e9 - _0F_E9 */ 0xee1c, +/* 1ea - _0F_EA */ 0xee28, +/* 1eb - _0F_EB */ 0xee34, +/* 1ec - _0F_EC */ 0xee40, +/* 1ed - _0F_ED */ 0xee4c, +/* 1ee - _0F_EE */ 0xee58, +/* 1ef - _0F_EF */ 0xee64, +/* 1f0 - _0F_F0 */ 0xee70, +/* 1f1 - _0F_F1 */ 0xee7c, +/* 1f2 - _0F_F2 */ 0xee88, +/* 1f3 - _0F_F3 */ 0xee94, +/* 1f4 - _0F_F4 */ 0xeea0, +/* 1f5 - _0F_F5 */ 0xeeac, +/* 1f6 - _0F_F6 */ 0xeeb8, +/* 1f7 - _0F_F7 */ 0xeec4, +/* 1f8 - _0F_F8 */ 0xeed0, +/* 1f9 - _0F_F9 */ 0xeedc, +/* 1fa - _0F_FA */ 0xeee8, +/* 1fb - _0F_FB */ 0xeef4, +/* 1fc - _0F_FC */ 0xef00, +/* 1fd - _0F_FD */ 0xef0c, +/* 1fe - _0F_FE */ 0xef18, +/* 1ff - */ 0, +/* 200 - _80_00 */ 0x213a, +/* 201 - _80_01 */ 0x213b, +/* 202 - _80_02 */ 0x213c, +/* 203 - _80_03 */ 0x213d, +/* 204 - _80_04 */ 0x213e, +/* 205 - _80_05 */ 0x213f, +/* 206 - _80_06 */ 0x2140, +/* 207 - _80_07 */ 0x2141, +/* 208 - _81_00 */ 0x2142, +/* 209 - _81_01 */ 0x2143, +/* 20a - _81_02 */ 0x2144, +/* 20b - _81_03 */ 0x2145, +/* 20c - _81_04 */ 0x2146, +/* 20d - _81_05 */ 0x2147, +/* 20e - _81_06 */ 0x2148, +/* 20f - _81_07 */ 0x2149, +/* 210 - _82_00 */ 0x214a, +/* 211 - _82_01 */ 0x214b, +/* 212 - _82_02 */ 0x214c, +/* 213 - _82_03 */ 0x214d, +/* 214 - _82_04 */ 0x214e, +/* 215 - _82_05 */ 0x214f, +/* 216 - _82_06 */ 0x2150, +/* 217 - _82_07 */ 0x2151, +/* 218 - _83_00 */ 0x2152, +/* 219 - _83_01 */ 0x2153, +/* 21a - _83_02 */ 0x2154, +/* 21b - _83_03 */ 0x2155, +/* 21c - _83_04 */ 0x2156, +/* 21d - _83_05 */ 0x2157, +/* 21e - _83_06 */ 0x2158, +/* 21f - _83_07 */ 0x2159, +/* 220 - _8F_00 */ 0x215a, +/* 221 - */ 0, +/* 222 - */ 0, +/* 223 - */ 0, +/* 224 - */ 0, +/* 225 - */ 0, +/* 226 - */ 0, +/* 227 - */ 0, +/* 228 - _C0_00 */ 0x215b, +/* 229 - _C0_01 */ 0x215c, +/* 22a - _C0_02 */ 0x215d, +/* 22b - _C0_03 */ 0x215e, +/* 22c - _C0_04 */ 0x215f, +/* 22d - _C0_05 */ 0x2160, +/* 22e - _C0_06 */ 0x2161, +/* 22f - _C0_07 */ 0x2162, +/* 230 - _C1_00 */ 0x2163, +/* 231 - _C1_01 */ 0x2164, +/* 232 - _C1_02 */ 0x2165, +/* 233 - _C1_03 */ 0x2166, +/* 234 - _C1_04 */ 0x2167, +/* 235 - _C1_05 */ 0x2168, +/* 236 - _C1_06 */ 0x2169, +/* 237 - _C1_07 */ 0x216a, +/* 238 - _C6_00 */ 0x216b, +/* 239 - */ 0, +/* 23a - */ 0, +/* 23b - */ 0, +/* 23c - */ 0, +/* 23d - */ 0, +/* 23e - */ 0, +/* 23f - */ 0, +/* 240 - */ 0, +/* 241 - */ 0, +/* 242 - */ 0, +/* 243 - */ 0, +/* 244 - */ 0, +/* 245 - */ 0, +/* 246 - */ 0, +/* 247 - */ 0, +/* 248 - */ 0, +/* 249 - */ 0, +/* 24a - */ 0, +/* 24b - */ 0, +/* 24c - */ 0, +/* 24d - */ 0, +/* 24e - */ 0, +/* 24f - */ 0, +/* 250 - */ 0, +/* 251 - */ 0, +/* 252 - */ 0, +/* 253 - */ 0, +/* 254 - */ 0, +/* 255 - */ 0, +/* 256 - */ 0, +/* 257 - */ 0, +/* 258 - */ 0, +/* 259 - */ 0, +/* 25a - */ 0, +/* 25b - */ 0, +/* 25c - */ 0, +/* 25d - */ 0, +/* 25e - */ 0, +/* 25f - */ 0, +/* 260 - */ 0, +/* 261 - */ 0, +/* 262 - */ 0, +/* 263 - */ 0, +/* 264 - */ 0, +/* 265 - */ 0, +/* 266 - */ 0, +/* 267 - */ 0, +/* 268 - */ 0, +/* 269 - */ 0, +/* 26a - */ 0, +/* 26b - */ 0, +/* 26c - */ 0, +/* 26d - */ 0, +/* 26e - */ 0, +/* 26f - */ 0, +/* 270 - */ 0, +/* 271 - */ 0, +/* 272 - */ 0, +/* 273 - */ 0, +/* 274 - */ 0, +/* 275 - */ 0, +/* 276 - */ 0, +/* 277 - */ 0, +/* 278 - _C6_F8 */ 0x216c, +/* 279 - */ 0, +/* 27a - */ 0, +/* 27b - */ 0, +/* 27c - */ 0, +/* 27d - */ 0, +/* 27e - */ 0, +/* 27f - */ 0, +/* 280 - _C7_00 */ 0x216d, +/* 281 - */ 0, +/* 282 - */ 0, +/* 283 - */ 0, +/* 284 - */ 0, +/* 285 - */ 0, +/* 286 - */ 0, +/* 287 - */ 0, +/* 288 - */ 0, +/* 289 - */ 0, +/* 28a - */ 0, +/* 28b - */ 0, +/* 28c - */ 0, +/* 28d - */ 0, +/* 28e - */ 0, +/* 28f - */ 0, +/* 290 - */ 0, +/* 291 - */ 0, +/* 292 - */ 0, +/* 293 - */ 0, +/* 294 - */ 0, +/* 295 - */ 0, +/* 296 - */ 0, +/* 297 - */ 0, +/* 298 - */ 0, +/* 299 - */ 0, +/* 29a - */ 0, +/* 29b - */ 0, +/* 29c - */ 0, +/* 29d - */ 0, +/* 29e - */ 0, +/* 29f - */ 0, +/* 2a0 - */ 0, +/* 2a1 - */ 0, +/* 2a2 - */ 0, +/* 2a3 - */ 0, +/* 2a4 - */ 0, +/* 2a5 - */ 0, +/* 2a6 - */ 0, +/* 2a7 - */ 0, +/* 2a8 - */ 0, +/* 2a9 - */ 0, +/* 2aa - */ 0, +/* 2ab - */ 0, +/* 2ac - */ 0, +/* 2ad - */ 0, +/* 2ae - */ 0, +/* 2af - */ 0, +/* 2b0 - */ 0, +/* 2b1 - */ 0, +/* 2b2 - */ 0, +/* 2b3 - */ 0, +/* 2b4 - */ 0, +/* 2b5 - */ 0, +/* 2b6 - */ 0, +/* 2b7 - */ 0, +/* 2b8 - */ 0, +/* 2b9 - */ 0, +/* 2ba - */ 0, +/* 2bb - */ 0, +/* 2bc - */ 0, +/* 2bd - */ 0, +/* 2be - */ 0, +/* 2bf - */ 0, +/* 2c0 - _C7_F8 */ 0x216e, +/* 2c1 - */ 0, +/* 2c2 - */ 0, +/* 2c3 - */ 0, +/* 2c4 - */ 0, +/* 2c5 - */ 0, +/* 2c6 - */ 0, +/* 2c7 - */ 0, +/* 2c8 - _D0_00 */ 0x216f, +/* 2c9 - _D0_01 */ 0x2170, +/* 2ca - _D0_02 */ 0x2171, +/* 2cb - _D0_03 */ 0x2172, +/* 2cc - _D0_04 */ 0x2173, +/* 2cd - _D0_05 */ 0x2174, +/* 2ce - _D0_06 */ 0x2175, +/* 2cf - _D0_07 */ 0x2176, +/* 2d0 - _D1_00 */ 0x2177, +/* 2d1 - _D1_01 */ 0x2178, +/* 2d2 - _D1_02 */ 0x2179, +/* 2d3 - _D1_03 */ 0x217a, +/* 2d4 - _D1_04 */ 0x217b, +/* 2d5 - _D1_05 */ 0x217c, +/* 2d6 - _D1_06 */ 0x217d, +/* 2d7 - _D1_07 */ 0x217e, +/* 2d8 - _D2_00 */ 0x217f, +/* 2d9 - _D2_01 */ 0x2180, +/* 2da - _D2_02 */ 0x2181, +/* 2db - _D2_03 */ 0x2182, +/* 2dc - _D2_04 */ 0x2183, +/* 2dd - _D2_05 */ 0x2184, +/* 2de - _D2_06 */ 0x2185, +/* 2df - _D2_07 */ 0x2186, +/* 2e0 - _D3_00 */ 0x2187, +/* 2e1 - _D3_01 */ 0x2188, +/* 2e2 - _D3_02 */ 0x2189, +/* 2e3 - _D3_03 */ 0x218a, +/* 2e4 - _D3_04 */ 0x218b, +/* 2e5 - _D3_05 */ 0x218c, +/* 2e6 - _D3_06 */ 0x218d, +/* 2e7 - _D3_07 */ 0x218e, +/* 2e8 - _D8_00 */ 0x218f, +/* 2e9 - _D8_01 */ 0x2190, +/* 2ea - _D8_02 */ 0x2191, +/* 2eb - _D8_03 */ 0x2192, +/* 2ec - _D8_04 */ 0x2193, +/* 2ed - _D8_05 */ 0x2194, +/* 2ee - _D8_06 */ 0x2195, +/* 2ef - _D8_07 */ 0x2196, +/* 2f0 - _D8_C0 */ 0x2197, +/* 2f1 - _D8_C0 */ 0x2198, +/* 2f2 - _D8_C0 */ 0x2199, +/* 2f3 - _D8_C0 */ 0x219a, +/* 2f4 - _D8_C0 */ 0x219b, +/* 2f5 - _D8_C0 */ 0x219c, +/* 2f6 - _D8_C0 */ 0x219d, +/* 2f7 - _D8_C0 */ 0x219e, +/* 2f8 - _D8_C8 */ 0x219f, +/* 2f9 - _D8_C8 */ 0x21a0, +/* 2fa - _D8_C8 */ 0x21a1, +/* 2fb - _D8_C8 */ 0x21a2, +/* 2fc - _D8_C8 */ 0x21a3, +/* 2fd - _D8_C8 */ 0x21a4, +/* 2fe - _D8_C8 */ 0x21a5, +/* 2ff - _D8_C8 */ 0x21a6, +/* 300 - _D8_D0 */ 0x21a7, +/* 301 - _D8_D0 */ 0x21a8, +/* 302 - _D8_D0 */ 0x21a9, +/* 303 - _D8_D0 */ 0x21aa, +/* 304 - _D8_D0 */ 0x21ab, +/* 305 - _D8_D0 */ 0x21ac, +/* 306 - _D8_D0 */ 0x21ad, +/* 307 - _D8_D0 */ 0x21ae, +/* 308 - _D8_D8 */ 0x21af, +/* 309 - _D8_D9 */ 0x21b0, +/* 30a - _D8_D8 */ 0x21b1, +/* 30b - _D8_D8 */ 0x21b2, +/* 30c - _D8_D8 */ 0x21b3, +/* 30d - _D8_D8 */ 0x21b4, +/* 30e - _D8_D8 */ 0x21b5, +/* 30f - _D8_D8 */ 0x21b6, +/* 310 - _D8_E0 */ 0x21b7, +/* 311 - _D8_E0 */ 0x21b8, +/* 312 - _D8_E0 */ 0x21b9, +/* 313 - _D8_E0 */ 0x21ba, +/* 314 - _D8_E0 */ 0x21bb, +/* 315 - _D8_E0 */ 0x21bc, +/* 316 - _D8_E0 */ 0x21bd, +/* 317 - _D8_E0 */ 0x21be, +/* 318 - _D8_E8 */ 0x21bf, +/* 319 - _D8_E8 */ 0x21c0, +/* 31a - _D8_E8 */ 0x21c1, +/* 31b - _D8_E8 */ 0x21c2, +/* 31c - _D8_E8 */ 0x21c3, +/* 31d - _D8_E8 */ 0x21c4, +/* 31e - _D8_E8 */ 0x21c5, +/* 31f - _D8_E8 */ 0x21c6, +/* 320 - _D8_F0 */ 0x21c7, +/* 321 - _D8_F0 */ 0x21c8, +/* 322 - _D8_F0 */ 0x21c9, +/* 323 - _D8_F0 */ 0x21ca, +/* 324 - _D8_F0 */ 0x21cb, +/* 325 - _D8_F0 */ 0x21cc, +/* 326 - _D8_F0 */ 0x21cd, +/* 327 - _D8_F0 */ 0x21ce, +/* 328 - _D8_F8 */ 0x21cf, +/* 329 - _D8_F8 */ 0x21d0, +/* 32a - _D8_F8 */ 0x21d1, +/* 32b - _D8_F8 */ 0x21d2, +/* 32c - _D8_F8 */ 0x21d3, +/* 32d - _D8_F8 */ 0x21d4, +/* 32e - _D8_F8 */ 0x21d5, +/* 32f - _D8_F8 */ 0x21d6, +/* 330 - _D9_00 */ 0x21d7, +/* 331 - */ 0, +/* 332 - _D9_02 */ 0x21d8, +/* 333 - _D9_03 */ 0x21d9, +/* 334 - _D9_04 */ 0x21da, +/* 335 - _D9_05 */ 0x21db, +/* 336 - _D9_06 */ 0xef24, +/* 337 - _D9_07 */ 0xef30, +/* 338 - _D9_C0 */ 0x21dc, +/* 339 - _D9_C0 */ 0x21dd, +/* 33a - _D9_C0 */ 0x21de, +/* 33b - _D9_C0 */ 0x21df, +/* 33c - _D9_C0 */ 0x21e0, +/* 33d - _D9_C0 */ 0x21e1, +/* 33e - _D9_C0 */ 0x21e2, +/* 33f - _D9_C0 */ 0x21e3, +/* 340 - _D9_C8 */ 0x21e4, +/* 341 - _D9_C9 */ 0x21e5, +/* 342 - _D9_C8 */ 0x21e6, +/* 343 - _D9_C8 */ 0x21e7, +/* 344 - _D9_C8 */ 0x21e8, +/* 345 - _D9_C8 */ 0x21e9, +/* 346 - _D9_C8 */ 0x21ea, +/* 347 - _D9_C8 */ 0x21eb, +/* 348 - _D9_D0 */ 0x21ec, +/* 349 - */ 0, +/* 34a - */ 0, +/* 34b - */ 0, +/* 34c - */ 0, +/* 34d - */ 0, +/* 34e - */ 0, +/* 34f - */ 0, +/* 350 - */ 0, +/* 351 - */ 0, +/* 352 - */ 0, +/* 353 - */ 0, +/* 354 - */ 0, +/* 355 - */ 0, +/* 356 - */ 0, +/* 357 - */ 0, +/* 358 - _D9_E0 */ 0x21ed, +/* 359 - _D9_E1 */ 0x21ee, +/* 35a - */ 0, +/* 35b - */ 0, +/* 35c - _D9_E4 */ 0x21ef, +/* 35d - _D9_E5 */ 0x21f0, +/* 35e - */ 0, +/* 35f - */ 0, +/* 360 - _D9_E8 */ 0x21f1, +/* 361 - _D9_E9 */ 0x21f2, +/* 362 - _D9_EA */ 0x21f3, +/* 363 - _D9_EB */ 0x21f4, +/* 364 - _D9_EC */ 0x21f5, +/* 365 - _D9_ED */ 0x21f6, +/* 366 - _D9_EE */ 0x21f7, +/* 367 - */ 0, +/* 368 - _D9_F0 */ 0x21f8, +/* 369 - _D9_F1 */ 0x21f9, +/* 36a - _D9_F2 */ 0x21fa, +/* 36b - _D9_F3 */ 0x21fb, +/* 36c - _D9_F4 */ 0x21fc, +/* 36d - _D9_F5 */ 0x21fd, +/* 36e - _D9_F6 */ 0x21fe, +/* 36f - _D9_F7 */ 0x21ff, +/* 370 - _D9_F8 */ 0x2200, +/* 371 - _D9_F9 */ 0x2201, +/* 372 - _D9_FA */ 0x2202, +/* 373 - _D9_FB */ 0x2203, +/* 374 - _D9_FC */ 0x2204, +/* 375 - _D9_FD */ 0x2205, +/* 376 - _D9_FE */ 0x2206, +/* 377 - _D9_FF */ 0x2207, +/* 378 - _DA_00 */ 0x2208, +/* 379 - _DA_01 */ 0x2209, +/* 37a - _DA_02 */ 0x220a, +/* 37b - _DA_03 */ 0x220b, +/* 37c - _DA_04 */ 0x220c, +/* 37d - _DA_05 */ 0x220d, +/* 37e - _DA_06 */ 0x220e, +/* 37f - _DA_07 */ 0x220f, +/* 380 - _DA_C0 */ 0x2210, +/* 381 - _DA_C0 */ 0x2211, +/* 382 - _DA_C0 */ 0x2212, +/* 383 - _DA_C0 */ 0x2213, +/* 384 - _DA_C0 */ 0x2214, +/* 385 - _DA_C0 */ 0x2215, +/* 386 - _DA_C0 */ 0x2216, +/* 387 - _DA_C0 */ 0x2217, +/* 388 - _DA_C8 */ 0x2218, +/* 389 - _DA_C8 */ 0x2219, +/* 38a - _DA_C8 */ 0x221a, +/* 38b - _DA_C8 */ 0x221b, +/* 38c - _DA_C8 */ 0x221c, +/* 38d - _DA_C8 */ 0x221d, +/* 38e - _DA_C8 */ 0x221e, +/* 38f - _DA_C8 */ 0x221f, +/* 390 - _DA_D0 */ 0x2220, +/* 391 - _DA_D0 */ 0x2221, +/* 392 - _DA_D0 */ 0x2222, +/* 393 - _DA_D0 */ 0x2223, +/* 394 - _DA_D0 */ 0x2224, +/* 395 - _DA_D0 */ 0x2225, +/* 396 - _DA_D0 */ 0x2226, +/* 397 - _DA_D0 */ 0x2227, +/* 398 - _DA_D8 */ 0x2228, +/* 399 - _DA_D8 */ 0x2229, +/* 39a - _DA_D8 */ 0x222a, +/* 39b - _DA_D8 */ 0x222b, +/* 39c - _DA_D8 */ 0x222c, +/* 39d - _DA_D8 */ 0x222d, +/* 39e - _DA_D8 */ 0x222e, +/* 39f - _DA_D8 */ 0x222f, +/* 3a0 - */ 0, +/* 3a1 - */ 0, +/* 3a2 - */ 0, +/* 3a3 - */ 0, +/* 3a4 - */ 0, +/* 3a5 - */ 0, +/* 3a6 - */ 0, +/* 3a7 - */ 0, +/* 3a8 - */ 0, +/* 3a9 - _DA_E9 */ 0x2230, +/* 3aa - */ 0, +/* 3ab - */ 0, +/* 3ac - */ 0, +/* 3ad - */ 0, +/* 3ae - */ 0, +/* 3af - */ 0, +/* 3b0 - */ 0, +/* 3b1 - */ 0, +/* 3b2 - */ 0, +/* 3b3 - */ 0, +/* 3b4 - */ 0, +/* 3b5 - */ 0, +/* 3b6 - */ 0, +/* 3b7 - */ 0, +/* 3b8 - */ 0, +/* 3b9 - */ 0, +/* 3ba - */ 0, +/* 3bb - */ 0, +/* 3bc - */ 0, +/* 3bd - */ 0, +/* 3be - */ 0, +/* 3bf - */ 0, +/* 3c0 - _DB_00 */ 0x2231, +/* 3c1 - _DB_01 */ 0x2232, +/* 3c2 - _DB_02 */ 0x2233, +/* 3c3 - _DB_03 */ 0x2234, +/* 3c4 - */ 0, +/* 3c5 - _DB_05 */ 0x2235, +/* 3c6 - */ 0, +/* 3c7 - _DB_07 */ 0x2236, +/* 3c8 - _DB_C0 */ 0x2237, +/* 3c9 - _DB_C0 */ 0x2238, +/* 3ca - _DB_C0 */ 0x2239, +/* 3cb - _DB_C0 */ 0x223a, +/* 3cc - _DB_C0 */ 0x223b, +/* 3cd - _DB_C0 */ 0x223c, +/* 3ce - _DB_C0 */ 0x223d, +/* 3cf - _DB_C0 */ 0x223e, +/* 3d0 - _DB_C8 */ 0x223f, +/* 3d1 - _DB_C8 */ 0x2240, +/* 3d2 - _DB_C8 */ 0x2241, +/* 3d3 - _DB_C8 */ 0x2242, +/* 3d4 - _DB_C8 */ 0x2243, +/* 3d5 - _DB_C8 */ 0x2244, +/* 3d6 - _DB_C8 */ 0x2245, +/* 3d7 - _DB_C8 */ 0x2246, +/* 3d8 - _DB_D0 */ 0x2247, +/* 3d9 - _DB_D0 */ 0x2248, +/* 3da - _DB_D0 */ 0x2249, +/* 3db - _DB_D0 */ 0x224a, +/* 3dc - _DB_D0 */ 0x224b, +/* 3dd - _DB_D0 */ 0x224c, +/* 3de - _DB_D0 */ 0x224d, +/* 3df - _DB_D0 */ 0x224e, +/* 3e0 - _DB_D8 */ 0x224f, +/* 3e1 - _DB_D8 */ 0x2250, +/* 3e2 - _DB_D8 */ 0x2251, +/* 3e3 - _DB_D8 */ 0x2252, +/* 3e4 - _DB_D8 */ 0x2253, +/* 3e5 - _DB_D8 */ 0x2254, +/* 3e6 - _DB_D8 */ 0x2255, +/* 3e7 - _DB_D8 */ 0x2256, +/* 3e8 - _DB_E0 */ 0x2257, +/* 3e9 - _DB_E1 */ 0x2258, +/* 3ea - _DB_E2 */ 0xef3c, +/* 3eb - _DB_E3 */ 0xef48, +/* 3ec - _DB_E4 */ 0x2259, +/* 3ed - */ 0, +/* 3ee - */ 0, +/* 3ef - */ 0, +/* 3f0 - _DB_E8 */ 0x225a, +/* 3f1 - _DB_E8 */ 0x225b, +/* 3f2 - _DB_E8 */ 0x225c, +/* 3f3 - _DB_E8 */ 0x225d, +/* 3f4 - _DB_E8 */ 0x225e, +/* 3f5 - _DB_E8 */ 0x225f, +/* 3f6 - _DB_E8 */ 0x2260, +/* 3f7 - _DB_E8 */ 0x2261, +/* 3f8 - _DB_F0 */ 0x2262, +/* 3f9 - _DB_F0 */ 0x2263, +/* 3fa - _DB_F0 */ 0x2264, +/* 3fb - _DB_F0 */ 0x2265, +/* 3fc - _DB_F0 */ 0x2266, +/* 3fd - _DB_F0 */ 0x2267, +/* 3fe - _DB_F0 */ 0x2268, +/* 3ff - _DB_F0 */ 0x2269, +/* 400 - */ 0, +/* 401 - */ 0, +/* 402 - */ 0, +/* 403 - */ 0, +/* 404 - */ 0, +/* 405 - */ 0, +/* 406 - */ 0, +/* 407 - */ 0, +/* 408 - _DC_00 */ 0x226a, +/* 409 - _DC_01 */ 0x226b, +/* 40a - _DC_02 */ 0x226c, +/* 40b - _DC_03 */ 0x226d, +/* 40c - _DC_04 */ 0x226e, +/* 40d - _DC_05 */ 0x226f, +/* 40e - _DC_06 */ 0x2270, +/* 40f - _DC_07 */ 0x2271, +/* 410 - _DC_C0 */ 0x2272, +/* 411 - _DC_C0 */ 0x2273, +/* 412 - _DC_C0 */ 0x2274, +/* 413 - _DC_C0 */ 0x2275, +/* 414 - _DC_C0 */ 0x2276, +/* 415 - _DC_C0 */ 0x2277, +/* 416 - _DC_C0 */ 0x2278, +/* 417 - _DC_C0 */ 0x2279, +/* 418 - _DC_C8 */ 0x227a, +/* 419 - _DC_C8 */ 0x227b, +/* 41a - _DC_C8 */ 0x227c, +/* 41b - _DC_C8 */ 0x227d, +/* 41c - _DC_C8 */ 0x227e, +/* 41d - _DC_C8 */ 0x227f, +/* 41e - _DC_C8 */ 0x2280, +/* 41f - _DC_C8 */ 0x2281, +/* 420 - */ 0, +/* 421 - */ 0, +/* 422 - */ 0, +/* 423 - */ 0, +/* 424 - */ 0, +/* 425 - */ 0, +/* 426 - */ 0, +/* 427 - */ 0, +/* 428 - */ 0, +/* 429 - */ 0, +/* 42a - */ 0, +/* 42b - */ 0, +/* 42c - */ 0, +/* 42d - */ 0, +/* 42e - */ 0, +/* 42f - */ 0, +/* 430 - _DC_E0 */ 0x2282, +/* 431 - _DC_E0 */ 0x2283, +/* 432 - _DC_E0 */ 0x2284, +/* 433 - _DC_E0 */ 0x2285, +/* 434 - _DC_E0 */ 0x2286, +/* 435 - _DC_E0 */ 0x2287, +/* 436 - _DC_E0 */ 0x2288, +/* 437 - _DC_E0 */ 0x2289, +/* 438 - _DC_E8 */ 0x228a, +/* 439 - _DC_E8 */ 0x228b, +/* 43a - _DC_E8 */ 0x228c, +/* 43b - _DC_E8 */ 0x228d, +/* 43c - _DC_E8 */ 0x228e, +/* 43d - _DC_E8 */ 0x228f, +/* 43e - _DC_E8 */ 0x2290, +/* 43f - _DC_E8 */ 0x2291, +/* 440 - _DC_F0 */ 0x2292, +/* 441 - _DC_F0 */ 0x2293, +/* 442 - _DC_F0 */ 0x2294, +/* 443 - _DC_F0 */ 0x2295, +/* 444 - _DC_F0 */ 0x2296, +/* 445 - _DC_F0 */ 0x2297, +/* 446 - _DC_F0 */ 0x2298, +/* 447 - _DC_F0 */ 0x2299, +/* 448 - _DC_F8 */ 0x229a, +/* 449 - _DC_F8 */ 0x229b, +/* 44a - _DC_F8 */ 0x229c, +/* 44b - _DC_F8 */ 0x229d, +/* 44c - _DC_F8 */ 0x229e, +/* 44d - _DC_F8 */ 0x229f, +/* 44e - _DC_F8 */ 0x22a0, +/* 44f - _DC_F8 */ 0x22a1, +/* 450 - _DD_00 */ 0x22a2, +/* 451 - _DD_01 */ 0x22a3, +/* 452 - _DD_02 */ 0x22a4, +/* 453 - _DD_03 */ 0x22a5, +/* 454 - _DD_04 */ 0x22a6, +/* 455 - */ 0, +/* 456 - _DD_06 */ 0xef54, +/* 457 - _DD_07 */ 0xef60, +/* 458 - _DD_C0 */ 0x22a7, +/* 459 - _DD_C0 */ 0x22a8, +/* 45a - _DD_C0 */ 0x22a9, +/* 45b - _DD_C0 */ 0x22aa, +/* 45c - _DD_C0 */ 0x22ab, +/* 45d - _DD_C0 */ 0x22ac, +/* 45e - _DD_C0 */ 0x22ad, +/* 45f - _DD_C0 */ 0x22ae, +/* 460 - */ 0, +/* 461 - */ 0, +/* 462 - */ 0, +/* 463 - */ 0, +/* 464 - */ 0, +/* 465 - */ 0, +/* 466 - */ 0, +/* 467 - */ 0, +/* 468 - _DD_D0 */ 0x22af, +/* 469 - _DD_D0 */ 0x22b0, +/* 46a - _DD_D0 */ 0x22b1, +/* 46b - _DD_D0 */ 0x22b2, +/* 46c - _DD_D0 */ 0x22b3, +/* 46d - _DD_D0 */ 0x22b4, +/* 46e - _DD_D0 */ 0x22b5, +/* 46f - _DD_D0 */ 0x22b6, +/* 470 - _DD_D8 */ 0x22b7, +/* 471 - _DD_D8 */ 0x22b8, +/* 472 - _DD_D8 */ 0x22b9, +/* 473 - _DD_D8 */ 0x22ba, +/* 474 - _DD_D8 */ 0x22bb, +/* 475 - _DD_D8 */ 0x22bc, +/* 476 - _DD_D8 */ 0x22bd, +/* 477 - _DD_D8 */ 0x22be, +/* 478 - _DD_E0 */ 0x22bf, +/* 479 - _DD_E1 */ 0x22c0, +/* 47a - _DD_E0 */ 0x22c1, +/* 47b - _DD_E0 */ 0x22c2, +/* 47c - _DD_E0 */ 0x22c3, +/* 47d - _DD_E0 */ 0x22c4, +/* 47e - _DD_E0 */ 0x22c5, +/* 47f - _DD_E0 */ 0x22c6, +/* 480 - _DD_E8 */ 0x22c7, +/* 481 - _DD_E9 */ 0x22c8, +/* 482 - _DD_E8 */ 0x22c9, +/* 483 - _DD_E8 */ 0x22ca, +/* 484 - _DD_E8 */ 0x22cb, +/* 485 - _DD_E8 */ 0x22cc, +/* 486 - _DD_E8 */ 0x22cd, +/* 487 - _DD_E8 */ 0x22ce, +/* 488 - */ 0, +/* 489 - */ 0, +/* 48a - */ 0, +/* 48b - */ 0, +/* 48c - */ 0, +/* 48d - */ 0, +/* 48e - */ 0, +/* 48f - */ 0, +/* 490 - */ 0, +/* 491 - */ 0, +/* 492 - */ 0, +/* 493 - */ 0, +/* 494 - */ 0, +/* 495 - */ 0, +/* 496 - */ 0, +/* 497 - */ 0, +/* 498 - _DE_00 */ 0x22cf, +/* 499 - _DE_01 */ 0x22d0, +/* 49a - _DE_02 */ 0x22d1, +/* 49b - _DE_03 */ 0x22d2, +/* 49c - _DE_04 */ 0x22d3, +/* 49d - _DE_05 */ 0x22d4, +/* 49e - _DE_06 */ 0x22d5, +/* 49f - _DE_07 */ 0x22d6, +/* 4a0 - _DE_C0 */ 0x22d7, +/* 4a1 - _DE_C1 */ 0x22d8, +/* 4a2 - _DE_C0 */ 0x22d9, +/* 4a3 - _DE_C0 */ 0x22da, +/* 4a4 - _DE_C0 */ 0x22db, +/* 4a5 - _DE_C0 */ 0x22dc, +/* 4a6 - _DE_C0 */ 0x22dd, +/* 4a7 - _DE_C0 */ 0x22de, +/* 4a8 - _DE_C8 */ 0x22df, +/* 4a9 - _DE_C9 */ 0x22e0, +/* 4aa - _DE_C8 */ 0x22e1, +/* 4ab - _DE_C8 */ 0x22e2, +/* 4ac - _DE_C8 */ 0x22e3, +/* 4ad - _DE_C8 */ 0x22e4, +/* 4ae - _DE_C8 */ 0x22e5, +/* 4af - _DE_C8 */ 0x22e6, +/* 4b0 - */ 0, +/* 4b1 - */ 0, +/* 4b2 - */ 0, +/* 4b3 - */ 0, +/* 4b4 - */ 0, +/* 4b5 - */ 0, +/* 4b6 - */ 0, +/* 4b7 - */ 0, +/* 4b8 - */ 0, +/* 4b9 - _DE_D9 */ 0x22e7, +/* 4ba - */ 0, +/* 4bb - */ 0, +/* 4bc - */ 0, +/* 4bd - */ 0, +/* 4be - */ 0, +/* 4bf - */ 0, +/* 4c0 - _DE_E0 */ 0x22e8, +/* 4c1 - _DE_E1 */ 0x22e9, +/* 4c2 - _DE_E0 */ 0x22ea, +/* 4c3 - _DE_E0 */ 0x22eb, +/* 4c4 - _DE_E0 */ 0x22ec, +/* 4c5 - _DE_E0 */ 0x22ed, +/* 4c6 - _DE_E0 */ 0x22ee, +/* 4c7 - _DE_E0 */ 0x22ef, +/* 4c8 - _DE_E8 */ 0x22f0, +/* 4c9 - _DE_E9 */ 0x22f1, +/* 4ca - _DE_E8 */ 0x22f2, +/* 4cb - _DE_E8 */ 0x22f3, +/* 4cc - _DE_E8 */ 0x22f4, +/* 4cd - _DE_E8 */ 0x22f5, +/* 4ce - _DE_E8 */ 0x22f6, +/* 4cf - _DE_E8 */ 0x22f7, +/* 4d0 - _DE_F0 */ 0x22f8, +/* 4d1 - _DE_F1 */ 0x22f9, +/* 4d2 - _DE_F0 */ 0x22fa, +/* 4d3 - _DE_F0 */ 0x22fb, +/* 4d4 - _DE_F0 */ 0x22fc, +/* 4d5 - _DE_F0 */ 0x22fd, +/* 4d6 - _DE_F0 */ 0x22fe, +/* 4d7 - _DE_F0 */ 0x22ff, +/* 4d8 - _DE_F8 */ 0x2300, +/* 4d9 - _DE_F9 */ 0x2301, +/* 4da - _DE_F8 */ 0x2302, +/* 4db - _DE_F8 */ 0x2303, +/* 4dc - _DE_F8 */ 0x2304, +/* 4dd - _DE_F8 */ 0x2305, +/* 4de - _DE_F8 */ 0x2306, +/* 4df - _DE_F8 */ 0x2307, +/* 4e0 - _DF_00 */ 0x2308, +/* 4e1 - _DF_01 */ 0x2309, +/* 4e2 - _DF_02 */ 0x230a, +/* 4e3 - _DF_03 */ 0x230b, +/* 4e4 - _DF_04 */ 0x230c, +/* 4e5 - _DF_05 */ 0x230d, +/* 4e6 - _DF_06 */ 0x230e, +/* 4e7 - _DF_07 */ 0x230f, +/* 4e8 - */ 0, +/* 4e9 - */ 0, +/* 4ea - */ 0, +/* 4eb - */ 0, +/* 4ec - */ 0, +/* 4ed - */ 0, +/* 4ee - */ 0, +/* 4ef - */ 0, +/* 4f0 - */ 0, +/* 4f1 - */ 0, +/* 4f2 - */ 0, +/* 4f3 - */ 0, +/* 4f4 - */ 0, +/* 4f5 - */ 0, +/* 4f6 - */ 0, +/* 4f7 - */ 0, +/* 4f8 - */ 0, +/* 4f9 - */ 0, +/* 4fa - */ 0, +/* 4fb - */ 0, +/* 4fc - */ 0, +/* 4fd - */ 0, +/* 4fe - */ 0, +/* 4ff - */ 0, +/* 500 - */ 0, +/* 501 - */ 0, +/* 502 - */ 0, +/* 503 - */ 0, +/* 504 - */ 0, +/* 505 - */ 0, +/* 506 - */ 0, +/* 507 - */ 0, +/* 508 - _DF_E0 */ 0xef6c, +/* 509 - */ 0, +/* 50a - */ 0, +/* 50b - */ 0, +/* 50c - */ 0, +/* 50d - */ 0, +/* 50e - */ 0, +/* 50f - */ 0, +/* 510 - _DF_E8 */ 0x2310, +/* 511 - _DF_E8 */ 0x2311, +/* 512 - _DF_E8 */ 0x2312, +/* 513 - _DF_E8 */ 0x2313, +/* 514 - _DF_E8 */ 0x2314, +/* 515 - _DF_E8 */ 0x2315, +/* 516 - _DF_E8 */ 0x2316, +/* 517 - _DF_E8 */ 0x2317, +/* 518 - _DF_F0 */ 0x2318, +/* 519 - _DF_F0 */ 0x2319, +/* 51a - _DF_F0 */ 0x231a, +/* 51b - _DF_F0 */ 0x231b, +/* 51c - _DF_F0 */ 0x231c, +/* 51d - _DF_F0 */ 0x231d, +/* 51e - _DF_F0 */ 0x231e, +/* 51f - _DF_F0 */ 0x231f, +/* 520 - */ 0, +/* 521 - */ 0, +/* 522 - */ 0, +/* 523 - */ 0, +/* 524 - */ 0, +/* 525 - */ 0, +/* 526 - */ 0, +/* 527 - */ 0, +/* 528 - _F6_00 */ 0x2320, +/* 529 - */ 0, +/* 52a - _F6_02 */ 0x2321, +/* 52b - _F6_03 */ 0x2322, +/* 52c - _F6_04 */ 0x2323, +/* 52d - _F6_05 */ 0x2324, +/* 52e - _F6_06 */ 0x2325, +/* 52f - _F6_07 */ 0x2326, +/* 530 - _F7_00 */ 0x2327, +/* 531 - */ 0, +/* 532 - _F7_02 */ 0x2328, +/* 533 - _F7_03 */ 0x2329, +/* 534 - _F7_04 */ 0x232a, +/* 535 - _F7_05 */ 0x232b, +/* 536 - _F7_06 */ 0x232c, +/* 537 - _F7_07 */ 0x232d, +/* 538 - _FE_00 */ 0x232e, +/* 539 - _FE_01 */ 0x232f, +/* 53a - */ 0, +/* 53b - */ 0, +/* 53c - */ 0, +/* 53d - */ 0, +/* 53e - */ 0, +/* 53f - */ 0, +/* 540 - _FF_00 */ 0x2330, +/* 541 - _FF_01 */ 0x2331, +/* 542 - _FF_02 */ 0x2332, +/* 543 - _FF_03 */ 0x2333, +/* 544 - _FF_04 */ 0x2334, +/* 545 - _FF_05 */ 0x2335, +/* 546 - _FF_06 */ 0x2336, +/* 547 - */ 0, +/* 548 - _0F_00_00 */ 0x2337, +/* 549 - _0F_00_01 */ 0x2338, +/* 54a - _0F_00_02 */ 0x2339, +/* 54b - _0F_00_03 */ 0x233a, +/* 54c - _0F_00_04 */ 0x233b, +/* 54d - _0F_00_05 */ 0x233c, +/* 54e - */ 0, +/* 54f - */ 0, +/* 550 - _0F_01_00 */ 0x233d, +/* 551 - _0F_01_01 */ 0x233e, +/* 552 - _0F_01_02 */ 0x233f, +/* 553 - _0F_01_03 */ 0x2340, +/* 554 - _0F_01_04 */ 0x2341, +/* 555 - */ 0, +/* 556 - _0F_01_06 */ 0x2342, +/* 557 - _0F_01_07 */ 0x2343, +/* 558 - */ 0, +/* 559 - _0F_01_C1 */ 0x2344, +/* 55a - _0F_01_C2 */ 0x2345, +/* 55b - _0F_01_C3 */ 0x2346, +/* 55c - _0F_01_C4 */ 0x2347, +/* 55d - */ 0, +/* 55e - */ 0, +/* 55f - */ 0, +/* 560 - _0F_01_C8 */ 0x2348, +/* 561 - _0F_01_C9 */ 0x2349, +/* 562 - _0F_01_CA */ 0x234a, +/* 563 - _0F_01_CB */ 0x234b, +/* 564 - */ 0, +/* 565 - */ 0, +/* 566 - */ 0, +/* 567 - */ 0, +/* 568 - _0F_01_D0 */ 0x234c, +/* 569 - _0F_01_D1 */ 0x234d, +/* 56a - */ 0, +/* 56b - */ 0, +/* 56c - _0F_01_D4 */ 0x234e, +/* 56d - _0F_01_D5 */ 0x234f, +/* 56e - */ 0, +/* 56f - */ 0, +/* 570 - _0F_01_D8 */ 0x2350, +/* 571 - _0F_01_D9 */ 0x2351, +/* 572 - _0F_01_DA */ 0x2352, +/* 573 - _0F_01_DB */ 0x2353, +/* 574 - _0F_01_DC */ 0x2354, +/* 575 - _0F_01_DD */ 0x2355, +/* 576 - _0F_01_DE */ 0x2356, +/* 577 - _0F_01_DF */ 0x2357, +/* 578 - */ 0, +/* 579 - */ 0, +/* 57a - */ 0, +/* 57b - */ 0, +/* 57c - */ 0, +/* 57d - */ 0, +/* 57e - */ 0, +/* 57f - */ 0, +/* 580 - */ 0, +/* 581 - */ 0, +/* 582 - */ 0, +/* 583 - */ 0, +/* 584 - */ 0, +/* 585 - */ 0, +/* 586 - */ 0, +/* 587 - */ 0, +/* 588 - */ 0, +/* 589 - */ 0, +/* 58a - */ 0, +/* 58b - */ 0, +/* 58c - */ 0, +/* 58d - */ 0, +/* 58e - */ 0, +/* 58f - */ 0, +/* 590 - _0F_01_F8 */ 0x2358, +/* 591 - _0F_01_F9 */ 0x2359, +/* 592 - */ 0, +/* 593 - */ 0, +/* 594 - */ 0, +/* 595 - */ 0, +/* 596 - */ 0, +/* 597 - */ 0, +/* 598 - _0F_0D_00 */ 0x235a, +/* 599 - _0F_0D_01 */ 0x235b, +/* 59a - */ 0, +/* 59b - */ 0, +/* 59c - */ 0, +/* 59d - */ 0, +/* 59e - */ 0, +/* 59f - */ 0, +/* 5a0 - */ 0, +/* 5a1 - */ 0, +/* 5a2 - */ 0, +/* 5a3 - */ 0, +/* 5a4 - */ 0, +/* 5a5 - */ 0, +/* 5a6 - */ 0, +/* 5a7 - */ 0, +/* 5a8 - */ 0, +/* 5a9 - */ 0, +/* 5aa - */ 0, +/* 5ab - */ 0, +/* 5ac - _0F_0F_0C */ 0x235c, +/* 5ad - _0F_0F_0D */ 0x235d, +/* 5ae - */ 0, +/* 5af - */ 0, +/* 5b0 - */ 0, +/* 5b1 - */ 0, +/* 5b2 - */ 0, +/* 5b3 - */ 0, +/* 5b4 - */ 0, +/* 5b5 - */ 0, +/* 5b6 - */ 0, +/* 5b7 - */ 0, +/* 5b8 - */ 0, +/* 5b9 - */ 0, +/* 5ba - */ 0, +/* 5bb - */ 0, +/* 5bc - _0F_0F_1C */ 0x235e, +/* 5bd - _0F_0F_1D */ 0x235f, +/* 5be - */ 0, +/* 5bf - */ 0, +/* 5c0 - */ 0, +/* 5c1 - */ 0, +/* 5c2 - */ 0, +/* 5c3 - */ 0, +/* 5c4 - */ 0, +/* 5c5 - */ 0, +/* 5c6 - */ 0, +/* 5c7 - */ 0, +/* 5c8 - */ 0, +/* 5c9 - */ 0, +/* 5ca - */ 0, +/* 5cb - */ 0, +/* 5cc - */ 0, +/* 5cd - */ 0, +/* 5ce - */ 0, +/* 5cf - */ 0, +/* 5d0 - */ 0, +/* 5d1 - */ 0, +/* 5d2 - */ 0, +/* 5d3 - */ 0, +/* 5d4 - */ 0, +/* 5d5 - */ 0, +/* 5d6 - */ 0, +/* 5d7 - */ 0, +/* 5d8 - */ 0, +/* 5d9 - */ 0, +/* 5da - */ 0, +/* 5db - */ 0, +/* 5dc - */ 0, +/* 5dd - */ 0, +/* 5de - */ 0, +/* 5df - */ 0, +/* 5e0 - */ 0, +/* 5e1 - */ 0, +/* 5e2 - */ 0, +/* 5e3 - */ 0, +/* 5e4 - */ 0, +/* 5e5 - */ 0, +/* 5e6 - */ 0, +/* 5e7 - */ 0, +/* 5e8 - */ 0, +/* 5e9 - */ 0, +/* 5ea - */ 0, +/* 5eb - */ 0, +/* 5ec - */ 0, +/* 5ed - */ 0, +/* 5ee - */ 0, +/* 5ef - */ 0, +/* 5f0 - */ 0, +/* 5f1 - */ 0, +/* 5f2 - */ 0, +/* 5f3 - */ 0, +/* 5f4 - */ 0, +/* 5f5 - */ 0, +/* 5f6 - */ 0, +/* 5f7 - */ 0, +/* 5f8 - */ 0, +/* 5f9 - */ 0, +/* 5fa - */ 0, +/* 5fb - */ 0, +/* 5fc - */ 0, +/* 5fd - */ 0, +/* 5fe - */ 0, +/* 5ff - */ 0, +/* 600 - */ 0, +/* 601 - */ 0, +/* 602 - */ 0, +/* 603 - */ 0, +/* 604 - */ 0, +/* 605 - */ 0, +/* 606 - */ 0, +/* 607 - */ 0, +/* 608 - */ 0, +/* 609 - */ 0, +/* 60a - */ 0, +/* 60b - */ 0, +/* 60c - */ 0, +/* 60d - */ 0, +/* 60e - */ 0, +/* 60f - */ 0, +/* 610 - */ 0, +/* 611 - */ 0, +/* 612 - */ 0, +/* 613 - */ 0, +/* 614 - */ 0, +/* 615 - */ 0, +/* 616 - */ 0, +/* 617 - */ 0, +/* 618 - */ 0, +/* 619 - */ 0, +/* 61a - */ 0, +/* 61b - */ 0, +/* 61c - */ 0, +/* 61d - */ 0, +/* 61e - */ 0, +/* 61f - */ 0, +/* 620 - */ 0, +/* 621 - */ 0, +/* 622 - */ 0, +/* 623 - */ 0, +/* 624 - */ 0, +/* 625 - */ 0, +/* 626 - */ 0, +/* 627 - */ 0, +/* 628 - */ 0, +/* 629 - */ 0, +/* 62a - _0F_0F_8A */ 0x2360, +/* 62b - */ 0, +/* 62c - */ 0, +/* 62d - */ 0, +/* 62e - _0F_0F_8E */ 0x2361, +/* 62f - */ 0, +/* 630 - _0F_0F_90 */ 0x2362, +/* 631 - */ 0, +/* 632 - */ 0, +/* 633 - */ 0, +/* 634 - _0F_0F_94 */ 0x2363, +/* 635 - */ 0, +/* 636 - _0F_0F_96 */ 0x2364, +/* 637 - _0F_0F_97 */ 0x2365, +/* 638 - */ 0, +/* 639 - */ 0, +/* 63a - _0F_0F_9A */ 0x2366, +/* 63b - */ 0, +/* 63c - */ 0, +/* 63d - */ 0, +/* 63e - _0F_0F_9E */ 0x2367, +/* 63f - */ 0, +/* 640 - _0F_0F_A0 */ 0x2368, +/* 641 - */ 0, +/* 642 - */ 0, +/* 643 - */ 0, +/* 644 - _0F_0F_A4 */ 0x2369, +/* 645 - */ 0, +/* 646 - _0F_0F_A6 */ 0x236a, +/* 647 - _0F_0F_A7 */ 0x236b, +/* 648 - */ 0, +/* 649 - */ 0, +/* 64a - _0F_0F_AA */ 0x236c, +/* 64b - */ 0, +/* 64c - */ 0, +/* 64d - */ 0, +/* 64e - _0F_0F_AE */ 0x236d, +/* 64f - */ 0, +/* 650 - _0F_0F_B0 */ 0x236e, +/* 651 - */ 0, +/* 652 - */ 0, +/* 653 - */ 0, +/* 654 - _0F_0F_B4 */ 0x236f, +/* 655 - */ 0, +/* 656 - _0F_0F_B6 */ 0x2370, +/* 657 - _0F_0F_B7 */ 0x2371, +/* 658 - */ 0, +/* 659 - */ 0, +/* 65a - */ 0, +/* 65b - _0F_0F_BB */ 0x2372, +/* 65c - */ 0, +/* 65d - */ 0, +/* 65e - */ 0, +/* 65f - _0F_0F_BF */ 0x2373, +/* 660 - */ 0, +/* 661 - */ 0, +/* 662 - */ 0, +/* 663 - */ 0, +/* 664 - */ 0, +/* 665 - */ 0, +/* 666 - */ 0, +/* 667 - */ 0, +/* 668 - */ 0, +/* 669 - */ 0, +/* 66a - */ 0, +/* 66b - */ 0, +/* 66c - */ 0, +/* 66d - */ 0, +/* 66e - */ 0, +/* 66f - */ 0, +/* 670 - */ 0, +/* 671 - */ 0, +/* 672 - */ 0, +/* 673 - */ 0, +/* 674 - */ 0, +/* 675 - */ 0, +/* 676 - */ 0, +/* 677 - */ 0, +/* 678 - */ 0, +/* 679 - */ 0, +/* 67a - */ 0, +/* 67b - */ 0, +/* 67c - */ 0, +/* 67d - */ 0, +/* 67e - */ 0, +/* 67f - */ 0, +/* 680 - */ 0, +/* 681 - */ 0, +/* 682 - */ 0, +/* 683 - */ 0, +/* 684 - */ 0, +/* 685 - */ 0, +/* 686 - */ 0, +/* 687 - */ 0, +/* 688 - */ 0, +/* 689 - */ 0, +/* 68a - */ 0, +/* 68b - */ 0, +/* 68c - */ 0, +/* 68d - */ 0, +/* 68e - */ 0, +/* 68f - */ 0, +/* 690 - */ 0, +/* 691 - */ 0, +/* 692 - */ 0, +/* 693 - */ 0, +/* 694 - */ 0, +/* 695 - */ 0, +/* 696 - */ 0, +/* 697 - */ 0, +/* 698 - */ 0, +/* 699 - */ 0, +/* 69a - */ 0, +/* 69b - */ 0, +/* 69c - */ 0, +/* 69d - */ 0, +/* 69e - */ 0, +/* 69f - */ 0, +/* 6a0 - _0F_10 */ 0x2374, +/* 6a1 - _66_0F_10 */ 0x2375, +/* 6a2 - _F3_0F_10 */ 0x2376, +/* 6a3 - _F2_0F_10 */ 0x2377, +/* 6a4 - _V_0F_10 */ 0x4009, +/* 6a5 - _V_66_0F_10 */ 0x400a, +/* 6a6 - _V_F3_0F_10 */ 0x400b, +/* 6a7 - _V_F2_0F_10 */ 0x400c, +/* 6a8 - */ 0, +/* 6a9 - */ 0, +/* 6aa - _VRR_F3_0F_10 */ 0x400d, +/* 6ab - _VRR_F2_0F_10 */ 0x400e, +/* 6ac - _0F_11 */ 0x2378, +/* 6ad - _66_0F_11 */ 0x2379, +/* 6ae - _F3_0F_11 */ 0x237a, +/* 6af - _F2_0F_11 */ 0x237b, +/* 6b0 - _V_0F_11 */ 0x400f, +/* 6b1 - _V_66_0F_11 */ 0x4010, +/* 6b2 - _V_F3_0F_11 */ 0x4011, +/* 6b3 - _V_F2_0F_11 */ 0x4012, +/* 6b4 - */ 0, +/* 6b5 - */ 0, +/* 6b6 - _VRR_F3_0F_11 */ 0x4013, +/* 6b7 - _VRR_F2_0F_11 */ 0x4014, +/* 6b8 - _0F_12 */ 0x4015, +/* 6b9 - _66_0F_12 */ 0x237c, +/* 6ba - _F3_0F_12 */ 0x237d, +/* 6bb - _F2_0F_12 */ 0x237e, +/* 6bc - _V_0F_12 */ 0x4016, +/* 6bd - _V_66_0F_12 */ 0x4017, +/* 6be - _V_F3_0F_12 */ 0x4018, +/* 6bf - _V_F2_0F_12 */ 0x4019, +/* 6c0 - */ 0, +/* 6c1 - */ 0, +/* 6c2 - */ 0, +/* 6c3 - */ 0, +/* 6c4 - _0F_13 */ 0x237f, +/* 6c5 - _66_0F_13 */ 0x2380, +/* 6c6 - */ 0, +/* 6c7 - */ 0, +/* 6c8 - _V_0F_13 */ 0x401a, +/* 6c9 - _V_66_0F_13 */ 0x401b, +/* 6ca - */ 0, +/* 6cb - */ 0, +/* 6cc - */ 0, +/* 6cd - */ 0, +/* 6ce - */ 0, +/* 6cf - */ 0, +/* 6d0 - _0F_14 */ 0x2381, +/* 6d1 - _66_0F_14 */ 0x2382, +/* 6d2 - */ 0, +/* 6d3 - */ 0, +/* 6d4 - _V_0F_14 */ 0x401c, +/* 6d5 - _V_66_0F_14 */ 0x401d, +/* 6d6 - */ 0, +/* 6d7 - */ 0, +/* 6d8 - */ 0, +/* 6d9 - */ 0, +/* 6da - */ 0, +/* 6db - */ 0, +/* 6dc - _0F_15 */ 0x2383, +/* 6dd - _66_0F_15 */ 0x2384, +/* 6de - */ 0, +/* 6df - */ 0, +/* 6e0 - _V_0F_15 */ 0x401e, +/* 6e1 - _V_66_0F_15 */ 0x401f, +/* 6e2 - */ 0, +/* 6e3 - */ 0, +/* 6e4 - */ 0, +/* 6e5 - */ 0, +/* 6e6 - */ 0, +/* 6e7 - */ 0, +/* 6e8 - _0F_16 */ 0x4020, +/* 6e9 - _66_0F_16 */ 0x2385, +/* 6ea - _F3_0F_16 */ 0x2386, +/* 6eb - */ 0, +/* 6ec - _V_0F_16 */ 0x4021, +/* 6ed - _V_66_0F_16 */ 0x4022, +/* 6ee - _V_F3_0F_16 */ 0x4023, +/* 6ef - */ 0, +/* 6f0 - */ 0, +/* 6f1 - */ 0, +/* 6f2 - */ 0, +/* 6f3 - */ 0, +/* 6f4 - _0F_17 */ 0x2387, +/* 6f5 - _66_0F_17 */ 0x2388, +/* 6f6 - */ 0, +/* 6f7 - */ 0, +/* 6f8 - _V_0F_17 */ 0x4024, +/* 6f9 - _V_66_0F_17 */ 0x4025, +/* 6fa - */ 0, +/* 6fb - */ 0, +/* 6fc - */ 0, +/* 6fd - */ 0, +/* 6fe - */ 0, +/* 6ff - */ 0, +/* 700 - _0F_18_00 */ 0x2389, +/* 701 - _0F_18_01 */ 0x238a, +/* 702 - _0F_18_02 */ 0x238b, +/* 703 - _0F_18_03 */ 0x238c, +/* 704 - */ 0, +/* 705 - */ 0, +/* 706 - */ 0, +/* 707 - */ 0, +/* 708 - _0F_28 */ 0x238d, +/* 709 - _66_0F_28 */ 0x238e, +/* 70a - */ 0, +/* 70b - */ 0, +/* 70c - _V_0F_28 */ 0x4026, +/* 70d - _V_66_0F_28 */ 0x4027, +/* 70e - */ 0, +/* 70f - */ 0, +/* 710 - */ 0, +/* 711 - */ 0, +/* 712 - */ 0, +/* 713 - */ 0, +/* 714 - _0F_29 */ 0x238f, +/* 715 - _66_0F_29 */ 0x2390, +/* 716 - */ 0, +/* 717 - */ 0, +/* 718 - _V_0F_29 */ 0x4028, +/* 719 - _V_66_0F_29 */ 0x4029, +/* 71a - */ 0, +/* 71b - */ 0, +/* 71c - */ 0, +/* 71d - */ 0, +/* 71e - */ 0, +/* 71f - */ 0, +/* 720 - _0F_2A */ 0x2391, +/* 721 - _66_0F_2A */ 0x2392, +/* 722 - _F3_0F_2A */ 0x2393, +/* 723 - _F2_0F_2A */ 0x2394, +/* 724 - */ 0, +/* 725 - */ 0, +/* 726 - _V_F3_0F_2A */ 0x402a, +/* 727 - _V_F2_0F_2A */ 0x402b, +/* 728 - */ 0, +/* 729 - */ 0, +/* 72a - */ 0, +/* 72b - */ 0, +/* 72c - _0F_2B */ 0x2395, +/* 72d - _66_0F_2B */ 0x2396, +/* 72e - _F3_0F_2B */ 0x2397, +/* 72f - _F2_0F_2B */ 0x2398, +/* 730 - _V_0F_2B */ 0x402c, +/* 731 - _V_66_0F_2B */ 0x402d, +/* 732 - */ 0, +/* 733 - */ 0, +/* 734 - */ 0, +/* 735 - */ 0, +/* 736 - */ 0, +/* 737 - */ 0, +/* 738 - _0F_2C */ 0x2399, +/* 739 - _66_0F_2C */ 0x239a, +/* 73a - _F3_0F_2C */ 0x239b, +/* 73b - _F2_0F_2C */ 0x239c, +/* 73c - */ 0, +/* 73d - */ 0, +/* 73e - _V_F3_0F_2C */ 0x402e, +/* 73f - _V_F2_0F_2C */ 0x402f, +/* 740 - */ 0, +/* 741 - */ 0, +/* 742 - */ 0, +/* 743 - */ 0, +/* 744 - _0F_2D */ 0x239d, +/* 745 - _66_0F_2D */ 0x239e, +/* 746 - _F3_0F_2D */ 0x239f, +/* 747 - _F2_0F_2D */ 0x23a0, +/* 748 - */ 0, +/* 749 - */ 0, +/* 74a - _V_F3_0F_2D */ 0x4030, +/* 74b - _V_F2_0F_2D */ 0x4031, +/* 74c - */ 0, +/* 74d - */ 0, +/* 74e - */ 0, +/* 74f - */ 0, +/* 750 - _0F_2E */ 0x23a1, +/* 751 - _66_0F_2E */ 0x23a2, +/* 752 - */ 0, +/* 753 - */ 0, +/* 754 - _V_0F_2E */ 0x4032, +/* 755 - _V_66_0F_2E */ 0x4033, +/* 756 - */ 0, +/* 757 - */ 0, +/* 758 - */ 0, +/* 759 - */ 0, +/* 75a - */ 0, +/* 75b - */ 0, +/* 75c - _0F_2F */ 0x23a3, +/* 75d - _66_0F_2F */ 0x23a4, +/* 75e - */ 0, +/* 75f - */ 0, +/* 760 - _V_0F_2F */ 0x4034, +/* 761 - _V_66_0F_2F */ 0x4035, +/* 762 - */ 0, +/* 763 - */ 0, +/* 764 - */ 0, +/* 765 - */ 0, +/* 766 - */ 0, +/* 767 - */ 0, +/* 768 - _0F_38_00 */ 0xef78, +/* 769 - _0F_38_01 */ 0xef84, +/* 76a - _0F_38_02 */ 0xef90, +/* 76b - _0F_38_03 */ 0xef9c, +/* 76c - _0F_38_04 */ 0xefa8, +/* 76d - _0F_38_05 */ 0xefb4, +/* 76e - _0F_38_06 */ 0xefc0, +/* 76f - _0F_38_07 */ 0xefcc, +/* 770 - _0F_38_08 */ 0xefd8, +/* 771 - _0F_38_09 */ 0xefe4, +/* 772 - _0F_38_0A */ 0xeff0, +/* 773 - _0F_38_0B */ 0xeffc, +/* 774 - _0F_38_0C */ 0xf008, +/* 775 - _0F_38_0D */ 0xf014, +/* 776 - _0F_38_0E */ 0xf020, +/* 777 - _0F_38_0F */ 0xf02c, +/* 778 - _0F_38_10 */ 0xf038, +/* 779 - */ 0, +/* 77a - */ 0, +/* 77b - */ 0, +/* 77c - _0F_38_14 */ 0xf044, +/* 77d - _0F_38_15 */ 0xf050, +/* 77e - */ 0, +/* 77f - _0F_38_17 */ 0xf05c, +/* 780 - _0F_38_18 */ 0xf068, +/* 781 - _0F_38_19 */ 0xf074, +/* 782 - _0F_38_1A */ 0xf080, +/* 783 - */ 0, +/* 784 - _0F_38_1C */ 0xf08c, +/* 785 - _0F_38_1D */ 0xf098, +/* 786 - _0F_38_1E */ 0xf0a4, +/* 787 - */ 0, +/* 788 - _0F_38_20 */ 0xf0b0, +/* 789 - _0F_38_21 */ 0xf0bc, +/* 78a - _0F_38_22 */ 0xf0c8, +/* 78b - _0F_38_23 */ 0xf0d4, +/* 78c - _0F_38_24 */ 0xf0e0, +/* 78d - _0F_38_25 */ 0xf0ec, +/* 78e - */ 0, +/* 78f - */ 0, +/* 790 - _0F_38_28 */ 0xf0f8, +/* 791 - _0F_38_29 */ 0xf104, +/* 792 - _0F_38_2A */ 0xf110, +/* 793 - _0F_38_2B */ 0xf11c, +/* 794 - _0F_38_2C */ 0xf128, +/* 795 - _0F_38_2D */ 0xf134, +/* 796 - _0F_38_2E */ 0xf140, +/* 797 - _0F_38_2F */ 0xf14c, +/* 798 - _0F_38_30 */ 0xf158, +/* 799 - _0F_38_31 */ 0xf164, +/* 79a - _0F_38_32 */ 0xf170, +/* 79b - _0F_38_33 */ 0xf17c, +/* 79c - _0F_38_34 */ 0xf188, +/* 79d - _0F_38_35 */ 0xf194, +/* 79e - */ 0, +/* 79f - _0F_38_37 */ 0xf1a0, +/* 7a0 - _0F_38_38 */ 0xf1ac, +/* 7a1 - _0F_38_39 */ 0xf1b8, +/* 7a2 - _0F_38_3A */ 0xf1c4, +/* 7a3 - _0F_38_3B */ 0xf1d0, +/* 7a4 - _0F_38_3C */ 0xf1dc, +/* 7a5 - _0F_38_3D */ 0xf1e8, +/* 7a6 - _0F_38_3E */ 0xf1f4, +/* 7a7 - _0F_38_3F */ 0xf200, +/* 7a8 - _0F_38_40 */ 0xf20c, +/* 7a9 - _0F_38_41 */ 0xf218, +/* 7aa - */ 0, +/* 7ab - */ 0, +/* 7ac - */ 0, +/* 7ad - */ 0, +/* 7ae - */ 0, +/* 7af - */ 0, +/* 7b0 - */ 0, +/* 7b1 - */ 0, +/* 7b2 - */ 0, +/* 7b3 - */ 0, +/* 7b4 - */ 0, +/* 7b5 - */ 0, +/* 7b6 - */ 0, +/* 7b7 - */ 0, +/* 7b8 - */ 0, +/* 7b9 - */ 0, +/* 7ba - */ 0, +/* 7bb - */ 0, +/* 7bc - */ 0, +/* 7bd - */ 0, +/* 7be - */ 0, +/* 7bf - */ 0, +/* 7c0 - */ 0, +/* 7c1 - */ 0, +/* 7c2 - */ 0, +/* 7c3 - */ 0, +/* 7c4 - */ 0, +/* 7c5 - */ 0, +/* 7c6 - */ 0, +/* 7c7 - */ 0, +/* 7c8 - */ 0, +/* 7c9 - */ 0, +/* 7ca - */ 0, +/* 7cb - */ 0, +/* 7cc - */ 0, +/* 7cd - */ 0, +/* 7ce - */ 0, +/* 7cf - */ 0, +/* 7d0 - */ 0, +/* 7d1 - */ 0, +/* 7d2 - */ 0, +/* 7d3 - */ 0, +/* 7d4 - */ 0, +/* 7d5 - */ 0, +/* 7d6 - */ 0, +/* 7d7 - */ 0, +/* 7d8 - */ 0, +/* 7d9 - */ 0, +/* 7da - */ 0, +/* 7db - */ 0, +/* 7dc - */ 0, +/* 7dd - */ 0, +/* 7de - */ 0, +/* 7df - */ 0, +/* 7e0 - */ 0, +/* 7e1 - */ 0, +/* 7e2 - */ 0, +/* 7e3 - */ 0, +/* 7e4 - */ 0, +/* 7e5 - */ 0, +/* 7e6 - */ 0, +/* 7e7 - */ 0, +/* 7e8 - _0F_38_80 */ 0xf224, +/* 7e9 - _0F_38_81 */ 0xf230, +/* 7ea - _0F_38_82 */ 0xf23c, +/* 7eb - */ 0, +/* 7ec - */ 0, +/* 7ed - */ 0, +/* 7ee - */ 0, +/* 7ef - */ 0, +/* 7f0 - */ 0, +/* 7f1 - */ 0, +/* 7f2 - */ 0, +/* 7f3 - */ 0, +/* 7f4 - */ 0, +/* 7f5 - */ 0, +/* 7f6 - */ 0, +/* 7f7 - */ 0, +/* 7f8 - */ 0, +/* 7f9 - */ 0, +/* 7fa - */ 0, +/* 7fb - */ 0, +/* 7fc - */ 0, +/* 7fd - */ 0, +/* 7fe - _0F_38_96 */ 0xf248, +/* 7ff - _0F_38_97 */ 0xf254, +/* 800 - _0F_38_98 */ 0xf260, +/* 801 - _0F_38_99 */ 0xf26c, +/* 802 - _0F_38_9A */ 0xf278, +/* 803 - _0F_38_9B */ 0xf284, +/* 804 - _0F_38_9C */ 0xf290, +/* 805 - _0F_38_9D */ 0xf29c, +/* 806 - _0F_38_9E */ 0xf2a8, +/* 807 - _0F_38_9F */ 0xf2b4, +/* 808 - */ 0, +/* 809 - */ 0, +/* 80a - */ 0, +/* 80b - */ 0, +/* 80c - */ 0, +/* 80d - */ 0, +/* 80e - _0F_38_A6 */ 0xf2c0, +/* 80f - _0F_38_A7 */ 0xf2cc, +/* 810 - _0F_38_A8 */ 0xf2d8, +/* 811 - _0F_38_A9 */ 0xf2e4, +/* 812 - _0F_38_AA */ 0xf2f0, +/* 813 - _0F_38_AB */ 0xf2fc, +/* 814 - _0F_38_AC */ 0xf308, +/* 815 - _0F_38_AD */ 0xf314, +/* 816 - _0F_38_AE */ 0xf320, +/* 817 - _0F_38_AF */ 0xf32c, +/* 818 - */ 0, +/* 819 - */ 0, +/* 81a - */ 0, +/* 81b - */ 0, +/* 81c - */ 0, +/* 81d - */ 0, +/* 81e - _0F_38_B6 */ 0xf338, +/* 81f - _0F_38_B7 */ 0xf344, +/* 820 - _0F_38_B8 */ 0xf350, +/* 821 - _0F_38_B9 */ 0xf35c, +/* 822 - _0F_38_BA */ 0xf368, +/* 823 - _0F_38_BB */ 0xf374, +/* 824 - _0F_38_BC */ 0xf380, +/* 825 - _0F_38_BD */ 0xf38c, +/* 826 - _0F_38_BE */ 0xf398, +/* 827 - _0F_38_BF */ 0xf3a4, +/* 828 - */ 0, +/* 829 - */ 0, +/* 82a - */ 0, +/* 82b - */ 0, +/* 82c - */ 0, +/* 82d - */ 0, +/* 82e - */ 0, +/* 82f - */ 0, +/* 830 - */ 0, +/* 831 - */ 0, +/* 832 - */ 0, +/* 833 - */ 0, +/* 834 - */ 0, +/* 835 - */ 0, +/* 836 - */ 0, +/* 837 - */ 0, +/* 838 - */ 0, +/* 839 - */ 0, +/* 83a - */ 0, +/* 83b - */ 0, +/* 83c - */ 0, +/* 83d - */ 0, +/* 83e - */ 0, +/* 83f - */ 0, +/* 840 - */ 0, +/* 841 - */ 0, +/* 842 - */ 0, +/* 843 - _0F_38_DB */ 0xf3b0, +/* 844 - _0F_38_DC */ 0xf3bc, +/* 845 - _0F_38_DD */ 0xf3c8, +/* 846 - _0F_38_DE */ 0xf3d4, +/* 847 - _0F_38_DF */ 0xf3e0, +/* 848 - */ 0, +/* 849 - */ 0, +/* 84a - */ 0, +/* 84b - */ 0, +/* 84c - */ 0, +/* 84d - */ 0, +/* 84e - */ 0, +/* 84f - */ 0, +/* 850 - */ 0, +/* 851 - */ 0, +/* 852 - */ 0, +/* 853 - */ 0, +/* 854 - */ 0, +/* 855 - */ 0, +/* 856 - */ 0, +/* 857 - */ 0, +/* 858 - _0F_38_F0 */ 0xf3ec, +/* 859 - _0F_38_F1 */ 0xf3f8, +/* 85a - */ 0, +/* 85b - */ 0, +/* 85c - */ 0, +/* 85d - */ 0, +/* 85e - */ 0, +/* 85f - */ 0, +/* 860 - */ 0, +/* 861 - */ 0, +/* 862 - */ 0, +/* 863 - */ 0, +/* 864 - */ 0, +/* 865 - */ 0, +/* 866 - */ 0, +/* 867 - */ 0, +/* 868 - */ 0, +/* 869 - */ 0, +/* 86a - */ 0, +/* 86b - */ 0, +/* 86c - _0F_3A_04 */ 0xf404, +/* 86d - _0F_3A_05 */ 0xf410, +/* 86e - _0F_3A_06 */ 0xf41c, +/* 86f - */ 0, +/* 870 - _0F_3A_08 */ 0xf428, +/* 871 - _0F_3A_09 */ 0xf434, +/* 872 - _0F_3A_0A */ 0xf440, +/* 873 - _0F_3A_0B */ 0xf44c, +/* 874 - _0F_3A_0C */ 0xf458, +/* 875 - _0F_3A_0D */ 0xf464, +/* 876 - _0F_3A_0E */ 0xf470, +/* 877 - _0F_3A_0F */ 0xf47c, +/* 878 - */ 0, +/* 879 - */ 0, +/* 87a - */ 0, +/* 87b - */ 0, +/* 87c - _0F_3A_14 */ 0xf488, +/* 87d - _0F_3A_15 */ 0xf494, +/* 87e - _0F_3A_16 */ 0xf4a0, +/* 87f - _0F_3A_17 */ 0xf4ac, +/* 880 - _0F_3A_18 */ 0xf4b8, +/* 881 - _0F_3A_19 */ 0xf4c4, +/* 882 - */ 0, +/* 883 - */ 0, +/* 884 - */ 0, +/* 885 - */ 0, +/* 886 - */ 0, +/* 887 - */ 0, +/* 888 - _0F_3A_20 */ 0xf4d0, +/* 889 - _0F_3A_21 */ 0xf4dc, +/* 88a - _0F_3A_22 */ 0xf4e8, +/* 88b - */ 0, +/* 88c - */ 0, +/* 88d - */ 0, +/* 88e - */ 0, +/* 88f - */ 0, +/* 890 - */ 0, +/* 891 - */ 0, +/* 892 - */ 0, +/* 893 - */ 0, +/* 894 - */ 0, +/* 895 - */ 0, +/* 896 - */ 0, +/* 897 - */ 0, +/* 898 - */ 0, +/* 899 - */ 0, +/* 89a - */ 0, +/* 89b - */ 0, +/* 89c - */ 0, +/* 89d - */ 0, +/* 89e - */ 0, +/* 89f - */ 0, +/* 8a0 - */ 0, +/* 8a1 - */ 0, +/* 8a2 - */ 0, +/* 8a3 - */ 0, +/* 8a4 - */ 0, +/* 8a5 - */ 0, +/* 8a6 - */ 0, +/* 8a7 - */ 0, +/* 8a8 - _0F_3A_40 */ 0xf4f4, +/* 8a9 - _0F_3A_41 */ 0xf500, +/* 8aa - _0F_3A_42 */ 0xf50c, +/* 8ab - */ 0, +/* 8ac - _0F_3A_44 */ 0xf518, +/* 8ad - */ 0, +/* 8ae - */ 0, +/* 8af - */ 0, +/* 8b0 - */ 0, +/* 8b1 - */ 0, +/* 8b2 - _0F_3A_4A */ 0xf524, +/* 8b3 - _0F_3A_4B */ 0xf530, +/* 8b4 - _0F_3A_4C */ 0xf53c, +/* 8b5 - */ 0, +/* 8b6 - */ 0, +/* 8b7 - */ 0, +/* 8b8 - */ 0, +/* 8b9 - */ 0, +/* 8ba - */ 0, +/* 8bb - */ 0, +/* 8bc - */ 0, +/* 8bd - */ 0, +/* 8be - */ 0, +/* 8bf - */ 0, +/* 8c0 - */ 0, +/* 8c1 - */ 0, +/* 8c2 - */ 0, +/* 8c3 - */ 0, +/* 8c4 - */ 0, +/* 8c5 - */ 0, +/* 8c6 - */ 0, +/* 8c7 - */ 0, +/* 8c8 - _0F_3A_60 */ 0xf548, +/* 8c9 - _0F_3A_61 */ 0xf554, +/* 8ca - _0F_3A_62 */ 0xf560, +/* 8cb - _0F_3A_63 */ 0xf56c, +/* 8cc - */ 0, +/* 8cd - */ 0, +/* 8ce - */ 0, +/* 8cf - */ 0, +/* 8d0 - */ 0, +/* 8d1 - */ 0, +/* 8d2 - */ 0, +/* 8d3 - */ 0, +/* 8d4 - */ 0, +/* 8d5 - */ 0, +/* 8d6 - */ 0, +/* 8d7 - */ 0, +/* 8d8 - */ 0, +/* 8d9 - */ 0, +/* 8da - */ 0, +/* 8db - */ 0, +/* 8dc - */ 0, +/* 8dd - */ 0, +/* 8de - */ 0, +/* 8df - */ 0, +/* 8e0 - */ 0, +/* 8e1 - */ 0, +/* 8e2 - */ 0, +/* 8e3 - */ 0, +/* 8e4 - */ 0, +/* 8e5 - */ 0, +/* 8e6 - */ 0, +/* 8e7 - */ 0, +/* 8e8 - */ 0, +/* 8e9 - */ 0, +/* 8ea - */ 0, +/* 8eb - */ 0, +/* 8ec - */ 0, +/* 8ed - */ 0, +/* 8ee - */ 0, +/* 8ef - */ 0, +/* 8f0 - */ 0, +/* 8f1 - */ 0, +/* 8f2 - */ 0, +/* 8f3 - */ 0, +/* 8f4 - */ 0, +/* 8f5 - */ 0, +/* 8f6 - */ 0, +/* 8f7 - */ 0, +/* 8f8 - */ 0, +/* 8f9 - */ 0, +/* 8fa - */ 0, +/* 8fb - */ 0, +/* 8fc - */ 0, +/* 8fd - */ 0, +/* 8fe - */ 0, +/* 8ff - */ 0, +/* 900 - */ 0, +/* 901 - */ 0, +/* 902 - */ 0, +/* 903 - */ 0, +/* 904 - */ 0, +/* 905 - */ 0, +/* 906 - */ 0, +/* 907 - */ 0, +/* 908 - */ 0, +/* 909 - */ 0, +/* 90a - */ 0, +/* 90b - */ 0, +/* 90c - */ 0, +/* 90d - */ 0, +/* 90e - */ 0, +/* 90f - */ 0, +/* 910 - */ 0, +/* 911 - */ 0, +/* 912 - */ 0, +/* 913 - */ 0, +/* 914 - */ 0, +/* 915 - */ 0, +/* 916 - */ 0, +/* 917 - */ 0, +/* 918 - */ 0, +/* 919 - */ 0, +/* 91a - */ 0, +/* 91b - */ 0, +/* 91c - */ 0, +/* 91d - */ 0, +/* 91e - */ 0, +/* 91f - */ 0, +/* 920 - */ 0, +/* 921 - */ 0, +/* 922 - */ 0, +/* 923 - */ 0, +/* 924 - */ 0, +/* 925 - */ 0, +/* 926 - */ 0, +/* 927 - */ 0, +/* 928 - */ 0, +/* 929 - */ 0, +/* 92a - */ 0, +/* 92b - */ 0, +/* 92c - */ 0, +/* 92d - */ 0, +/* 92e - */ 0, +/* 92f - */ 0, +/* 930 - */ 0, +/* 931 - */ 0, +/* 932 - */ 0, +/* 933 - */ 0, +/* 934 - */ 0, +/* 935 - */ 0, +/* 936 - */ 0, +/* 937 - */ 0, +/* 938 - */ 0, +/* 939 - */ 0, +/* 93a - */ 0, +/* 93b - */ 0, +/* 93c - */ 0, +/* 93d - */ 0, +/* 93e - */ 0, +/* 93f - */ 0, +/* 940 - */ 0, +/* 941 - */ 0, +/* 942 - */ 0, +/* 943 - */ 0, +/* 944 - */ 0, +/* 945 - */ 0, +/* 946 - */ 0, +/* 947 - _0F_3A_DF */ 0xf578, +/* 948 - */ 0, +/* 949 - */ 0, +/* 94a - */ 0, +/* 94b - */ 0, +/* 94c - */ 0, +/* 94d - */ 0, +/* 94e - */ 0, +/* 94f - */ 0, +/* 950 - */ 0, +/* 951 - */ 0, +/* 952 - */ 0, +/* 953 - */ 0, +/* 954 - */ 0, +/* 955 - */ 0, +/* 956 - */ 0, +/* 957 - */ 0, +/* 958 - */ 0, +/* 959 - */ 0, +/* 95a - */ 0, +/* 95b - */ 0, +/* 95c - */ 0, +/* 95d - */ 0, +/* 95e - */ 0, +/* 95f - */ 0, +/* 960 - */ 0, +/* 961 - */ 0, +/* 962 - */ 0, +/* 963 - */ 0, +/* 964 - */ 0, +/* 965 - */ 0, +/* 966 - */ 0, +/* 967 - */ 0, +/* 968 - _0F_50 */ 0x23a5, +/* 969 - _66_0F_50 */ 0x23a6, +/* 96a - */ 0, +/* 96b - */ 0, +/* 96c - _V_0F_50 */ 0x4036, +/* 96d - _V_66_0F_50 */ 0x4037, +/* 96e - */ 0, +/* 96f - */ 0, +/* 970 - */ 0, +/* 971 - */ 0, +/* 972 - */ 0, +/* 973 - */ 0, +/* 974 - _0F_51 */ 0x23a7, +/* 975 - _66_0F_51 */ 0x23a8, +/* 976 - _F3_0F_51 */ 0x23a9, +/* 977 - _F2_0F_51 */ 0x23aa, +/* 978 - _V_0F_51 */ 0x4038, +/* 979 - _V_66_0F_51 */ 0x4039, +/* 97a - _V_F3_0F_51 */ 0x403a, +/* 97b - _V_F2_0F_51 */ 0x403b, +/* 97c - */ 0, +/* 97d - */ 0, +/* 97e - */ 0, +/* 97f - */ 0, +/* 980 - _0F_52 */ 0x23ab, +/* 981 - */ 0, +/* 982 - _F3_0F_52 */ 0x23ac, +/* 983 - */ 0, +/* 984 - _V_0F_52 */ 0x403c, +/* 985 - */ 0, +/* 986 - _V_F3_0F_52 */ 0x403d, +/* 987 - */ 0, +/* 988 - */ 0, +/* 989 - */ 0, +/* 98a - */ 0, +/* 98b - */ 0, +/* 98c - _0F_53 */ 0x23ad, +/* 98d - */ 0, +/* 98e - _F3_0F_53 */ 0x23ae, +/* 98f - */ 0, +/* 990 - _V_0F_53 */ 0x403e, +/* 991 - */ 0, +/* 992 - _V_F3_0F_53 */ 0x403f, +/* 993 - */ 0, +/* 994 - */ 0, +/* 995 - */ 0, +/* 996 - */ 0, +/* 997 - */ 0, +/* 998 - _0F_54 */ 0x23af, +/* 999 - _66_0F_54 */ 0x23b0, +/* 99a - */ 0, +/* 99b - */ 0, +/* 99c - _V_0F_54 */ 0x4040, +/* 99d - _V_66_0F_54 */ 0x4041, +/* 99e - */ 0, +/* 99f - */ 0, +/* 9a0 - */ 0, +/* 9a1 - */ 0, +/* 9a2 - */ 0, +/* 9a3 - */ 0, +/* 9a4 - _0F_55 */ 0x23b1, +/* 9a5 - _66_0F_55 */ 0x23b2, +/* 9a6 - */ 0, +/* 9a7 - */ 0, +/* 9a8 - _V_0F_55 */ 0x4042, +/* 9a9 - _V_66_0F_55 */ 0x4043, +/* 9aa - */ 0, +/* 9ab - */ 0, +/* 9ac - */ 0, +/* 9ad - */ 0, +/* 9ae - */ 0, +/* 9af - */ 0, +/* 9b0 - _0F_56 */ 0x23b3, +/* 9b1 - _66_0F_56 */ 0x23b4, +/* 9b2 - */ 0, +/* 9b3 - */ 0, +/* 9b4 - _V_0F_56 */ 0x4044, +/* 9b5 - _V_66_0F_56 */ 0x4045, +/* 9b6 - */ 0, +/* 9b7 - */ 0, +/* 9b8 - */ 0, +/* 9b9 - */ 0, +/* 9ba - */ 0, +/* 9bb - */ 0, +/* 9bc - _0F_57 */ 0x23b5, +/* 9bd - _66_0F_57 */ 0x23b6, +/* 9be - */ 0, +/* 9bf - */ 0, +/* 9c0 - _V_0F_57 */ 0x4046, +/* 9c1 - _V_66_0F_57 */ 0x4047, +/* 9c2 - */ 0, +/* 9c3 - */ 0, +/* 9c4 - */ 0, +/* 9c5 - */ 0, +/* 9c6 - */ 0, +/* 9c7 - */ 0, +/* 9c8 - _0F_58 */ 0x23b7, +/* 9c9 - _66_0F_58 */ 0x23b8, +/* 9ca - _F3_0F_58 */ 0x23b9, +/* 9cb - _F2_0F_58 */ 0x23ba, +/* 9cc - _V_0F_58 */ 0x4048, +/* 9cd - _V_66_0F_58 */ 0x4049, +/* 9ce - _V_F3_0F_58 */ 0x404a, +/* 9cf - _V_F2_0F_58 */ 0x404b, +/* 9d0 - */ 0, +/* 9d1 - */ 0, +/* 9d2 - */ 0, +/* 9d3 - */ 0, +/* 9d4 - _0F_59 */ 0x23bb, +/* 9d5 - _66_0F_59 */ 0x23bc, +/* 9d6 - _F3_0F_59 */ 0x23bd, +/* 9d7 - _F2_0F_59 */ 0x23be, +/* 9d8 - _V_0F_59 */ 0x404c, +/* 9d9 - _V_66_0F_59 */ 0x404d, +/* 9da - _V_F3_0F_59 */ 0x404e, +/* 9db - _V_F2_0F_59 */ 0x404f, +/* 9dc - */ 0, +/* 9dd - */ 0, +/* 9de - */ 0, +/* 9df - */ 0, +/* 9e0 - _0F_5A */ 0x23bf, +/* 9e1 - _66_0F_5A */ 0x23c0, +/* 9e2 - _F3_0F_5A */ 0x23c1, +/* 9e3 - _F2_0F_5A */ 0x23c2, +/* 9e4 - _V_0F_5A */ 0x4050, +/* 9e5 - _V_66_0F_5A */ 0x4051, +/* 9e6 - _V_F3_0F_5A */ 0x4052, +/* 9e7 - _V_F2_0F_5A */ 0x4053, +/* 9e8 - */ 0, +/* 9e9 - */ 0, +/* 9ea - */ 0, +/* 9eb - */ 0, +/* 9ec - _0F_5B */ 0x23c3, +/* 9ed - _66_0F_5B */ 0x23c4, +/* 9ee - _F3_0F_5B */ 0x23c5, +/* 9ef - */ 0, +/* 9f0 - _V_0F_5B */ 0x4054, +/* 9f1 - _V_66_0F_5B */ 0x4055, +/* 9f2 - _V_F3_0F_5B */ 0x4056, +/* 9f3 - */ 0, +/* 9f4 - */ 0, +/* 9f5 - */ 0, +/* 9f6 - */ 0, +/* 9f7 - */ 0, +/* 9f8 - _0F_5C */ 0x23c6, +/* 9f9 - _66_0F_5C */ 0x23c7, +/* 9fa - _F3_0F_5C */ 0x23c8, +/* 9fb - _F2_0F_5C */ 0x23c9, +/* 9fc - _V_0F_5C */ 0x4057, +/* 9fd - _V_66_0F_5C */ 0x4058, +/* 9fe - _V_F3_0F_5C */ 0x4059, +/* 9ff - _V_F2_0F_5C */ 0x405a, +/* a00 - */ 0, +/* a01 - */ 0, +/* a02 - */ 0, +/* a03 - */ 0, +/* a04 - _0F_5D */ 0x23ca, +/* a05 - _66_0F_5D */ 0x23cb, +/* a06 - _F3_0F_5D */ 0x23cc, +/* a07 - _F2_0F_5D */ 0x23cd, +/* a08 - _V_0F_5D */ 0x405b, +/* a09 - _V_66_0F_5D */ 0x405c, +/* a0a - _V_F3_0F_5D */ 0x405d, +/* a0b - _V_F2_0F_5D */ 0x405e, +/* a0c - */ 0, +/* a0d - */ 0, +/* a0e - */ 0, +/* a0f - */ 0, +/* a10 - _0F_5E */ 0x23ce, +/* a11 - _66_0F_5E */ 0x23cf, +/* a12 - _F3_0F_5E */ 0x23d0, +/* a13 - _F2_0F_5E */ 0x23d1, +/* a14 - _V_0F_5E */ 0x405f, +/* a15 - _V_66_0F_5E */ 0x4060, +/* a16 - _V_F3_0F_5E */ 0x4061, +/* a17 - _V_F2_0F_5E */ 0x4062, +/* a18 - */ 0, +/* a19 - */ 0, +/* a1a - */ 0, +/* a1b - */ 0, +/* a1c - _0F_5F */ 0x23d2, +/* a1d - _66_0F_5F */ 0x23d3, +/* a1e - _F3_0F_5F */ 0x23d4, +/* a1f - _F2_0F_5F */ 0x23d5, +/* a20 - _V_0F_5F */ 0x4063, +/* a21 - _V_66_0F_5F */ 0x4064, +/* a22 - _V_F3_0F_5F */ 0x4065, +/* a23 - _V_F2_0F_5F */ 0x4066, +/* a24 - */ 0, +/* a25 - */ 0, +/* a26 - */ 0, +/* a27 - */ 0, +/* a28 - _0F_60 */ 0x23d6, +/* a29 - _66_0F_60 */ 0x23d7, +/* a2a - */ 0, +/* a2b - */ 0, +/* a2c - */ 0, +/* a2d - _V_66_0F_60 */ 0x4067, +/* a2e - */ 0, +/* a2f - */ 0, +/* a30 - */ 0, +/* a31 - */ 0, +/* a32 - */ 0, +/* a33 - */ 0, +/* a34 - _0F_61 */ 0x23d8, +/* a35 - _66_0F_61 */ 0x23d9, +/* a36 - */ 0, +/* a37 - */ 0, +/* a38 - */ 0, +/* a39 - _V_66_0F_61 */ 0x4068, +/* a3a - */ 0, +/* a3b - */ 0, +/* a3c - */ 0, +/* a3d - */ 0, +/* a3e - */ 0, +/* a3f - */ 0, +/* a40 - _0F_62 */ 0x23da, +/* a41 - _66_0F_62 */ 0x23db, +/* a42 - */ 0, +/* a43 - */ 0, +/* a44 - */ 0, +/* a45 - _V_66_0F_62 */ 0x4069, +/* a46 - */ 0, +/* a47 - */ 0, +/* a48 - */ 0, +/* a49 - */ 0, +/* a4a - */ 0, +/* a4b - */ 0, +/* a4c - _0F_63 */ 0x23dc, +/* a4d - _66_0F_63 */ 0x23dd, +/* a4e - */ 0, +/* a4f - */ 0, +/* a50 - */ 0, +/* a51 - _V_66_0F_63 */ 0x406a, +/* a52 - */ 0, +/* a53 - */ 0, +/* a54 - */ 0, +/* a55 - */ 0, +/* a56 - */ 0, +/* a57 - */ 0, +/* a58 - _0F_64 */ 0x23de, +/* a59 - _66_0F_64 */ 0x23df, +/* a5a - */ 0, +/* a5b - */ 0, +/* a5c - */ 0, +/* a5d - _V_66_0F_64 */ 0x406b, +/* a5e - */ 0, +/* a5f - */ 0, +/* a60 - */ 0, +/* a61 - */ 0, +/* a62 - */ 0, +/* a63 - */ 0, +/* a64 - _0F_65 */ 0x23e0, +/* a65 - _66_0F_65 */ 0x23e1, +/* a66 - */ 0, +/* a67 - */ 0, +/* a68 - */ 0, +/* a69 - _V_66_0F_65 */ 0x406c, +/* a6a - */ 0, +/* a6b - */ 0, +/* a6c - */ 0, +/* a6d - */ 0, +/* a6e - */ 0, +/* a6f - */ 0, +/* a70 - _0F_66 */ 0x23e2, +/* a71 - _66_0F_66 */ 0x23e3, +/* a72 - */ 0, +/* a73 - */ 0, +/* a74 - */ 0, +/* a75 - _V_66_0F_66 */ 0x406d, +/* a76 - */ 0, +/* a77 - */ 0, +/* a78 - */ 0, +/* a79 - */ 0, +/* a7a - */ 0, +/* a7b - */ 0, +/* a7c - _0F_67 */ 0x23e4, +/* a7d - _66_0F_67 */ 0x23e5, +/* a7e - */ 0, +/* a7f - */ 0, +/* a80 - */ 0, +/* a81 - _V_66_0F_67 */ 0x406e, +/* a82 - */ 0, +/* a83 - */ 0, +/* a84 - */ 0, +/* a85 - */ 0, +/* a86 - */ 0, +/* a87 - */ 0, +/* a88 - _0F_68 */ 0x23e6, +/* a89 - _66_0F_68 */ 0x23e7, +/* a8a - */ 0, +/* a8b - */ 0, +/* a8c - */ 0, +/* a8d - _V_66_0F_68 */ 0x406f, +/* a8e - */ 0, +/* a8f - */ 0, +/* a90 - */ 0, +/* a91 - */ 0, +/* a92 - */ 0, +/* a93 - */ 0, +/* a94 - _0F_69 */ 0x23e8, +/* a95 - _66_0F_69 */ 0x23e9, +/* a96 - */ 0, +/* a97 - */ 0, +/* a98 - */ 0, +/* a99 - _V_66_0F_69 */ 0x4070, +/* a9a - */ 0, +/* a9b - */ 0, +/* a9c - */ 0, +/* a9d - */ 0, +/* a9e - */ 0, +/* a9f - */ 0, +/* aa0 - _0F_6A */ 0x23ea, +/* aa1 - _66_0F_6A */ 0x23eb, +/* aa2 - */ 0, +/* aa3 - */ 0, +/* aa4 - */ 0, +/* aa5 - _V_66_0F_6A */ 0x4071, +/* aa6 - */ 0, +/* aa7 - */ 0, +/* aa8 - */ 0, +/* aa9 - */ 0, +/* aaa - */ 0, +/* aab - */ 0, +/* aac - _0F_6B */ 0x23ec, +/* aad - _66_0F_6B */ 0x23ed, +/* aae - */ 0, +/* aaf - */ 0, +/* ab0 - */ 0, +/* ab1 - _V_66_0F_6B */ 0x4072, +/* ab2 - */ 0, +/* ab3 - */ 0, +/* ab4 - */ 0, +/* ab5 - */ 0, +/* ab6 - */ 0, +/* ab7 - */ 0, +/* ab8 - */ 0, +/* ab9 - _66_0F_6C */ 0x23ee, +/* aba - */ 0, +/* abb - */ 0, +/* abc - */ 0, +/* abd - _V_66_0F_6C */ 0x4073, +/* abe - */ 0, +/* abf - */ 0, +/* ac0 - */ 0, +/* ac1 - */ 0, +/* ac2 - */ 0, +/* ac3 - */ 0, +/* ac4 - */ 0, +/* ac5 - _66_0F_6D */ 0x23ef, +/* ac6 - */ 0, +/* ac7 - */ 0, +/* ac8 - */ 0, +/* ac9 - _V_66_0F_6D */ 0x4074, +/* aca - */ 0, +/* acb - */ 0, +/* acc - */ 0, +/* acd - */ 0, +/* ace - */ 0, +/* acf - */ 0, +/* ad0 - _0F_6E */ 0x4075, +/* ad1 - _66_0F_6E */ 0x4076, +/* ad2 - */ 0, +/* ad3 - */ 0, +/* ad4 - */ 0, +/* ad5 - _V_66_0F_6E */ 0x4077, +/* ad6 - */ 0, +/* ad7 - */ 0, +/* ad8 - */ 0, +/* ad9 - */ 0, +/* ada - */ 0, +/* adb - */ 0, +/* adc - _0F_6F */ 0x23f0, +/* add - _66_0F_6F */ 0x23f1, +/* ade - _F3_0F_6F */ 0x23f2, +/* adf - */ 0, +/* ae0 - */ 0, +/* ae1 - _V_66_0F_6F */ 0x4078, +/* ae2 - _V_F3_0F_6F */ 0x4079, +/* ae3 - */ 0, +/* ae4 - */ 0, +/* ae5 - */ 0, +/* ae6 - */ 0, +/* ae7 - */ 0, +/* ae8 - _0F_70 */ 0x407a, +/* ae9 - _66_0F_70 */ 0x407b, +/* aea - _F3_0F_70 */ 0x407c, +/* aeb - _F2_0F_70 */ 0x407d, +/* aec - */ 0, +/* aed - _V_66_0F_70 */ 0x407e, +/* aee - _V_F3_0F_70 */ 0x407f, +/* aef - _V_F2_0F_70 */ 0x4080, +/* af0 - */ 0, +/* af1 - */ 0, +/* af2 - */ 0, +/* af3 - */ 0, +/* af4 - */ 0, +/* af5 - */ 0, +/* af6 - _0F_71_02 */ 0xf584, +/* af7 - */ 0, +/* af8 - _0F_71_04 */ 0xf590, +/* af9 - */ 0, +/* afa - _0F_71_06 */ 0xf59c, +/* afb - */ 0, +/* afc - */ 0, +/* afd - */ 0, +/* afe - _0F_72_02 */ 0xf5a8, +/* aff - */ 0, +/* b00 - _0F_72_04 */ 0xf5b4, +/* b01 - */ 0, +/* b02 - _0F_72_06 */ 0xf5c0, +/* b03 - */ 0, +/* b04 - */ 0, +/* b05 - */ 0, +/* b06 - _0F_73_02 */ 0xf5cc, +/* b07 - _0F_73_03 */ 0xf5d8, +/* b08 - */ 0, +/* b09 - */ 0, +/* b0a - _0F_73_06 */ 0xf5e4, +/* b0b - _0F_73_07 */ 0xf5f0, +/* b0c - _0F_74 */ 0x23f3, +/* b0d - _66_0F_74 */ 0x23f4, +/* b0e - */ 0, +/* b0f - */ 0, +/* b10 - */ 0, +/* b11 - _V_66_0F_74 */ 0x4081, +/* b12 - */ 0, +/* b13 - */ 0, +/* b14 - */ 0, +/* b15 - */ 0, +/* b16 - */ 0, +/* b17 - */ 0, +/* b18 - _0F_75 */ 0x23f5, +/* b19 - _66_0F_75 */ 0x23f6, +/* b1a - */ 0, +/* b1b - */ 0, +/* b1c - */ 0, +/* b1d - _V_66_0F_75 */ 0x4082, +/* b1e - */ 0, +/* b1f - */ 0, +/* b20 - */ 0, +/* b21 - */ 0, +/* b22 - */ 0, +/* b23 - */ 0, +/* b24 - _0F_76 */ 0x23f7, +/* b25 - _66_0F_76 */ 0x23f8, +/* b26 - */ 0, +/* b27 - */ 0, +/* b28 - */ 0, +/* b29 - _V_66_0F_76 */ 0x4083, +/* b2a - */ 0, +/* b2b - */ 0, +/* b2c - */ 0, +/* b2d - */ 0, +/* b2e - */ 0, +/* b2f - */ 0, +/* b30 - _0F_77 */ 0x23f9, +/* b31 - */ 0, +/* b32 - */ 0, +/* b33 - */ 0, +/* b34 - _V_0F_77 */ 0x4084, +/* b35 - */ 0, +/* b36 - */ 0, +/* b37 - */ 0, +/* b38 - */ 0, +/* b39 - */ 0, +/* b3a - */ 0, +/* b3b - */ 0, +/* b3c - _0F_78 */ 0x23fa, +/* b3d - _66_0F_78 */ 0x4085, +/* b3e - */ 0, +/* b3f - _F2_0F_78 */ 0x4086, +/* b40 - */ 0, +/* b41 - */ 0, +/* b42 - */ 0, +/* b43 - */ 0, +/* b44 - */ 0, +/* b45 - */ 0, +/* b46 - */ 0, +/* b47 - */ 0, +/* b48 - _0F_79 */ 0x23fb, +/* b49 - _66_0F_79 */ 0x23fc, +/* b4a - */ 0, +/* b4b - _F2_0F_79 */ 0x23fd, +/* b4c - */ 0, +/* b4d - */ 0, +/* b4e - */ 0, +/* b4f - */ 0, +/* b50 - */ 0, +/* b51 - */ 0, +/* b52 - */ 0, +/* b53 - */ 0, +/* b54 - */ 0, +/* b55 - */ 0, +/* b56 - */ 0, +/* b57 - */ 0, +/* b58 - */ 0, +/* b59 - */ 0, +/* b5a - */ 0, +/* b5b - */ 0, +/* b5c - */ 0, +/* b5d - */ 0, +/* b5e - */ 0, +/* b5f - */ 0, +/* b60 - */ 0, +/* b61 - */ 0, +/* b62 - */ 0, +/* b63 - */ 0, +/* b64 - */ 0, +/* b65 - */ 0, +/* b66 - */ 0, +/* b67 - */ 0, +/* b68 - */ 0, +/* b69 - */ 0, +/* b6a - */ 0, +/* b6b - */ 0, +/* b6c - */ 0, +/* b6d - */ 0, +/* b6e - */ 0, +/* b6f - */ 0, +/* b70 - */ 0, +/* b71 - */ 0, +/* b72 - */ 0, +/* b73 - */ 0, +/* b74 - */ 0, +/* b75 - */ 0, +/* b76 - */ 0, +/* b77 - */ 0, +/* b78 - */ 0, +/* b79 - */ 0, +/* b7a - */ 0, +/* b7b - */ 0, +/* b7c - */ 0, +/* b7d - */ 0, +/* b7e - */ 0, +/* b7f - */ 0, +/* b80 - */ 0, +/* b81 - */ 0, +/* b82 - */ 0, +/* b83 - */ 0, +/* b84 - _0F_7A_30 */ 0x23fe, +/* b85 - _0F_7A_31 */ 0x23ff, +/* b86 - */ 0, +/* b87 - */ 0, +/* b88 - */ 0, +/* b89 - */ 0, +/* b8a - */ 0, +/* b8b - */ 0, +/* b8c - */ 0, +/* b8d - */ 0, +/* b8e - */ 0, +/* b8f - */ 0, +/* b90 - */ 0, +/* b91 - */ 0, +/* b92 - */ 0, +/* b93 - */ 0, +/* b94 - */ 0, +/* b95 - */ 0, +/* b96 - */ 0, +/* b97 - */ 0, +/* b98 - */ 0, +/* b99 - */ 0, +/* b9a - */ 0, +/* b9b - */ 0, +/* b9c - */ 0, +/* b9d - */ 0, +/* b9e - */ 0, +/* b9f - */ 0, +/* ba0 - */ 0, +/* ba1 - */ 0, +/* ba2 - */ 0, +/* ba3 - */ 0, +/* ba4 - */ 0, +/* ba5 - */ 0, +/* ba6 - */ 0, +/* ba7 - */ 0, +/* ba8 - */ 0, +/* ba9 - */ 0, +/* baa - */ 0, +/* bab - */ 0, +/* bac - */ 0, +/* bad - */ 0, +/* bae - */ 0, +/* baf - */ 0, +/* bb0 - */ 0, +/* bb1 - */ 0, +/* bb2 - */ 0, +/* bb3 - */ 0, +/* bb4 - */ 0, +/* bb5 - */ 0, +/* bb6 - */ 0, +/* bb7 - */ 0, +/* bb8 - */ 0, +/* bb9 - */ 0, +/* bba - */ 0, +/* bbb - */ 0, +/* bbc - */ 0, +/* bbd - */ 0, +/* bbe - */ 0, +/* bbf - */ 0, +/* bc0 - */ 0, +/* bc1 - */ 0, +/* bc2 - */ 0, +/* bc3 - */ 0, +/* bc4 - */ 0, +/* bc5 - */ 0, +/* bc6 - */ 0, +/* bc7 - */ 0, +/* bc8 - */ 0, +/* bc9 - */ 0, +/* bca - */ 0, +/* bcb - */ 0, +/* bcc - */ 0, +/* bcd - */ 0, +/* bce - */ 0, +/* bcf - */ 0, +/* bd0 - */ 0, +/* bd1 - */ 0, +/* bd2 - */ 0, +/* bd3 - */ 0, +/* bd4 - */ 0, +/* bd5 - */ 0, +/* bd6 - */ 0, +/* bd7 - */ 0, +/* bd8 - */ 0, +/* bd9 - */ 0, +/* bda - */ 0, +/* bdb - */ 0, +/* bdc - */ 0, +/* bdd - */ 0, +/* bde - */ 0, +/* bdf - */ 0, +/* be0 - */ 0, +/* be1 - */ 0, +/* be2 - */ 0, +/* be3 - */ 0, +/* be4 - */ 0, +/* be5 - */ 0, +/* be6 - */ 0, +/* be7 - */ 0, +/* be8 - */ 0, +/* be9 - */ 0, +/* bea - */ 0, +/* beb - */ 0, +/* bec - */ 0, +/* bed - */ 0, +/* bee - */ 0, +/* bef - */ 0, +/* bf0 - */ 0, +/* bf1 - */ 0, +/* bf2 - */ 0, +/* bf3 - */ 0, +/* bf4 - */ 0, +/* bf5 - */ 0, +/* bf6 - */ 0, +/* bf7 - */ 0, +/* bf8 - */ 0, +/* bf9 - */ 0, +/* bfa - */ 0, +/* bfb - */ 0, +/* bfc - */ 0, +/* bfd - */ 0, +/* bfe - */ 0, +/* bff - */ 0, +/* c00 - */ 0, +/* c01 - */ 0, +/* c02 - */ 0, +/* c03 - */ 0, +/* c04 - */ 0, +/* c05 - */ 0, +/* c06 - */ 0, +/* c07 - */ 0, +/* c08 - */ 0, +/* c09 - */ 0, +/* c0a - */ 0, +/* c0b - */ 0, +/* c0c - */ 0, +/* c0d - */ 0, +/* c0e - */ 0, +/* c0f - */ 0, +/* c10 - */ 0, +/* c11 - */ 0, +/* c12 - */ 0, +/* c13 - */ 0, +/* c14 - */ 0, +/* c15 - */ 0, +/* c16 - */ 0, +/* c17 - */ 0, +/* c18 - */ 0, +/* c19 - */ 0, +/* c1a - */ 0, +/* c1b - */ 0, +/* c1c - */ 0, +/* c1d - */ 0, +/* c1e - */ 0, +/* c1f - */ 0, +/* c20 - */ 0, +/* c21 - */ 0, +/* c22 - */ 0, +/* c23 - */ 0, +/* c24 - */ 0, +/* c25 - */ 0, +/* c26 - */ 0, +/* c27 - */ 0, +/* c28 - */ 0, +/* c29 - */ 0, +/* c2a - */ 0, +/* c2b - */ 0, +/* c2c - */ 0, +/* c2d - */ 0, +/* c2e - */ 0, +/* c2f - */ 0, +/* c30 - */ 0, +/* c31 - */ 0, +/* c32 - */ 0, +/* c33 - */ 0, +/* c34 - */ 0, +/* c35 - */ 0, +/* c36 - */ 0, +/* c37 - */ 0, +/* c38 - */ 0, +/* c39 - */ 0, +/* c3a - */ 0, +/* c3b - */ 0, +/* c3c - */ 0, +/* c3d - */ 0, +/* c3e - */ 0, +/* c3f - */ 0, +/* c40 - */ 0, +/* c41 - */ 0, +/* c42 - */ 0, +/* c43 - */ 0, +/* c44 - */ 0, +/* c45 - */ 0, +/* c46 - */ 0, +/* c47 - */ 0, +/* c48 - */ 0, +/* c49 - */ 0, +/* c4a - */ 0, +/* c4b - */ 0, +/* c4c - */ 0, +/* c4d - */ 0, +/* c4e - */ 0, +/* c4f - */ 0, +/* c50 - */ 0, +/* c51 - */ 0, +/* c52 - */ 0, +/* c53 - */ 0, +/* c54 - */ 0, +/* c55 - _66_0F_7C */ 0x2400, +/* c56 - */ 0, +/* c57 - _F2_0F_7C */ 0x2401, +/* c58 - */ 0, +/* c59 - _V_66_0F_7C */ 0x4087, +/* c5a - */ 0, +/* c5b - _V_F2_0F_7C */ 0x4088, +/* c5c - */ 0, +/* c5d - */ 0, +/* c5e - */ 0, +/* c5f - */ 0, +/* c60 - */ 0, +/* c61 - _66_0F_7D */ 0x2402, +/* c62 - */ 0, +/* c63 - _F2_0F_7D */ 0x2403, +/* c64 - */ 0, +/* c65 - _V_66_0F_7D */ 0x4089, +/* c66 - */ 0, +/* c67 - _V_F2_0F_7D */ 0x408a, +/* c68 - */ 0, +/* c69 - */ 0, +/* c6a - */ 0, +/* c6b - */ 0, +/* c6c - _0F_7E */ 0x408b, +/* c6d - _66_0F_7E */ 0x408c, +/* c6e - _F3_0F_7E */ 0x2404, +/* c6f - */ 0, +/* c70 - */ 0, +/* c71 - _V_66_0F_7E */ 0x408d, +/* c72 - _V_F3_0F_7E */ 0x408e, +/* c73 - */ 0, +/* c74 - */ 0, +/* c75 - */ 0, +/* c76 - */ 0, +/* c77 - */ 0, +/* c78 - _0F_7F */ 0x2405, +/* c79 - _66_0F_7F */ 0x2406, +/* c7a - _F3_0F_7F */ 0x2407, +/* c7b - */ 0, +/* c7c - */ 0, +/* c7d - _V_66_0F_7F */ 0x408f, +/* c7e - _V_F3_0F_7F */ 0x4090, +/* c7f - */ 0, +/* c80 - */ 0, +/* c81 - */ 0, +/* c82 - */ 0, +/* c83 - */ 0, +/* c84 - _0F_AE_00 */ 0xf5fc, +/* c85 - _0F_AE_01 */ 0xf608, +/* c86 - _0F_AE_02 */ 0xf614, +/* c87 - _0F_AE_03 */ 0xf620, +/* c88 - _0F_AE_04 */ 0x4091, +/* c89 - _0F_AE_05 */ 0x4092, +/* c8a - _0F_AE_06 */ 0x4093, +/* c8b - _0F_AE_07 */ 0x4094, +/* c8c - */ 0, +/* c8d - */ 0, +/* c8e - _F3_0F_B8 */ 0x2408, +/* c8f - */ 0, +/* c90 - */ 0, +/* c91 - */ 0, +/* c92 - */ 0, +/* c93 - */ 0, +/* c94 - */ 0, +/* c95 - */ 0, +/* c96 - */ 0, +/* c97 - */ 0, +/* c98 - */ 0, +/* c99 - */ 0, +/* c9a - */ 0, +/* c9b - */ 0, +/* c9c - _0F_BA_04 */ 0x2409, +/* c9d - _0F_BA_05 */ 0x240a, +/* c9e - _0F_BA_06 */ 0x240b, +/* c9f - _0F_BA_07 */ 0x240c, +/* ca0 - _0F_BC */ 0x240d, +/* ca1 - */ 0, +/* ca2 - _F3_0F_BC */ 0x240e, +/* ca3 - */ 0, +/* ca4 - */ 0, +/* ca5 - */ 0, +/* ca6 - */ 0, +/* ca7 - */ 0, +/* ca8 - */ 0, +/* ca9 - */ 0, +/* caa - */ 0, +/* cab - */ 0, +/* cac - _0F_BD */ 0x240f, +/* cad - */ 0, +/* cae - _F3_0F_BD */ 0x2410, +/* caf - */ 0, +/* cb0 - */ 0, +/* cb1 - */ 0, +/* cb2 - */ 0, +/* cb3 - */ 0, +/* cb4 - */ 0, +/* cb5 - */ 0, +/* cb6 - */ 0, +/* cb7 - */ 0, +/* cb8 - _0F_C2 */ 0x4095, +/* cb9 - _66_0F_C2 */ 0x4096, +/* cba - _F3_0F_C2 */ 0x4097, +/* cbb - _F2_0F_C2 */ 0x4098, +/* cbc - _V_0F_C2 */ 0x4099, +/* cbd - _V_66_0F_C2 */ 0x409a, +/* cbe - _V_F3_0F_C2 */ 0x409b, +/* cbf - _V_F2_0F_C2 */ 0x409c, +/* cc0 - */ 0, +/* cc1 - */ 0, +/* cc2 - */ 0, +/* cc3 - */ 0, +/* cc4 - _0F_C4 */ 0x409d, +/* cc5 - _66_0F_C4 */ 0x409e, +/* cc6 - */ 0, +/* cc7 - */ 0, +/* cc8 - */ 0, +/* cc9 - _V_66_0F_C4 */ 0x409f, +/* cca - */ 0, +/* ccb - */ 0, +/* ccc - */ 0, +/* ccd - */ 0, +/* cce - */ 0, +/* ccf - */ 0, +/* cd0 - _0F_C5 */ 0x40a0, +/* cd1 - _66_0F_C5 */ 0x40a1, +/* cd2 - */ 0, +/* cd3 - */ 0, +/* cd4 - */ 0, +/* cd5 - _V_66_0F_C5 */ 0x40a2, +/* cd6 - */ 0, +/* cd7 - */ 0, +/* cd8 - */ 0, +/* cd9 - */ 0, +/* cda - */ 0, +/* cdb - */ 0, +/* cdc - _0F_C6 */ 0x40a3, +/* cdd - _66_0F_C6 */ 0x40a4, +/* cde - */ 0, +/* cdf - */ 0, +/* ce0 - _V_0F_C6 */ 0x40a5, +/* ce1 - _V_66_0F_C6 */ 0x40a6, +/* ce2 - */ 0, +/* ce3 - */ 0, +/* ce4 - */ 0, +/* ce5 - */ 0, +/* ce6 - */ 0, +/* ce7 - */ 0, +/* ce8 - */ 0, +/* ce9 - _0F_C7_01 */ 0x40a7, +/* cea - */ 0, +/* ceb - */ 0, +/* cec - */ 0, +/* ced - */ 0, +/* cee - _0F_C7_06 */ 0xf62c, +/* cef - _0F_C7_07 */ 0x2411, +/* cf0 - */ 0, +/* cf1 - _66_0F_D0 */ 0x2412, +/* cf2 - */ 0, +/* cf3 - _F2_0F_D0 */ 0x2413, +/* cf4 - */ 0, +/* cf5 - _V_66_0F_D0 */ 0x40a8, +/* cf6 - */ 0, +/* cf7 - _V_F2_0F_D0 */ 0x40a9, +/* cf8 - */ 0, +/* cf9 - */ 0, +/* cfa - */ 0, +/* cfb - */ 0, +/* cfc - _0F_D1 */ 0x2414, +/* cfd - _66_0F_D1 */ 0x2415, +/* cfe - */ 0, +/* cff - */ 0, +/* d00 - */ 0, +/* d01 - _V_66_0F_D1 */ 0x40aa, +/* d02 - */ 0, +/* d03 - */ 0, +/* d04 - */ 0, +/* d05 - */ 0, +/* d06 - */ 0, +/* d07 - */ 0, +/* d08 - _0F_D2 */ 0x2416, +/* d09 - _66_0F_D2 */ 0x2417, +/* d0a - */ 0, +/* d0b - */ 0, +/* d0c - */ 0, +/* d0d - _V_66_0F_D2 */ 0x40ab, +/* d0e - */ 0, +/* d0f - */ 0, +/* d10 - */ 0, +/* d11 - */ 0, +/* d12 - */ 0, +/* d13 - */ 0, +/* d14 - _0F_D3 */ 0x2418, +/* d15 - _66_0F_D3 */ 0x2419, +/* d16 - */ 0, +/* d17 - */ 0, +/* d18 - */ 0, +/* d19 - _V_66_0F_D3 */ 0x40ac, +/* d1a - */ 0, +/* d1b - */ 0, +/* d1c - */ 0, +/* d1d - */ 0, +/* d1e - */ 0, +/* d1f - */ 0, +/* d20 - _0F_D4 */ 0x241a, +/* d21 - _66_0F_D4 */ 0x241b, +/* d22 - */ 0, +/* d23 - */ 0, +/* d24 - */ 0, +/* d25 - _V_66_0F_D4 */ 0x40ad, +/* d26 - */ 0, +/* d27 - */ 0, +/* d28 - */ 0, +/* d29 - */ 0, +/* d2a - */ 0, +/* d2b - */ 0, +/* d2c - _0F_D5 */ 0x241c, +/* d2d - _66_0F_D5 */ 0x241d, +/* d2e - */ 0, +/* d2f - */ 0, +/* d30 - */ 0, +/* d31 - _V_66_0F_D5 */ 0x40ae, +/* d32 - */ 0, +/* d33 - */ 0, +/* d34 - */ 0, +/* d35 - */ 0, +/* d36 - */ 0, +/* d37 - */ 0, +/* d38 - */ 0, +/* d39 - _66_0F_D6 */ 0x241e, +/* d3a - _F3_0F_D6 */ 0x241f, +/* d3b - _F2_0F_D6 */ 0x2420, +/* d3c - */ 0, +/* d3d - _V_66_0F_D6 */ 0x40af, +/* d3e - */ 0, +/* d3f - */ 0, +/* d40 - */ 0, +/* d41 - */ 0, +/* d42 - */ 0, +/* d43 - */ 0, +/* d44 - _0F_D7 */ 0x2421, +/* d45 - _66_0F_D7 */ 0x2422, +/* d46 - */ 0, +/* d47 - */ 0, +/* d48 - */ 0, +/* d49 - _V_66_0F_D7 */ 0x40b0, +/* d4a - */ 0, +/* d4b - */ 0, +/* d4c - */ 0, +/* d4d - */ 0, +/* d4e - */ 0, +/* d4f - */ 0, +/* d50 - _0F_D8 */ 0x2423, +/* d51 - _66_0F_D8 */ 0x2424, +/* d52 - */ 0, +/* d53 - */ 0, +/* d54 - */ 0, +/* d55 - _V_66_0F_D8 */ 0x40b1, +/* d56 - */ 0, +/* d57 - */ 0, +/* d58 - */ 0, +/* d59 - */ 0, +/* d5a - */ 0, +/* d5b - */ 0, +/* d5c - _0F_D9 */ 0x2425, +/* d5d - _66_0F_D9 */ 0x2426, +/* d5e - */ 0, +/* d5f - */ 0, +/* d60 - */ 0, +/* d61 - _V_66_0F_D9 */ 0x40b2, +/* d62 - */ 0, +/* d63 - */ 0, +/* d64 - */ 0, +/* d65 - */ 0, +/* d66 - */ 0, +/* d67 - */ 0, +/* d68 - _0F_DA */ 0x2427, +/* d69 - _66_0F_DA */ 0x2428, +/* d6a - */ 0, +/* d6b - */ 0, +/* d6c - */ 0, +/* d6d - _V_66_0F_DA */ 0x40b3, +/* d6e - */ 0, +/* d6f - */ 0, +/* d70 - */ 0, +/* d71 - */ 0, +/* d72 - */ 0, +/* d73 - */ 0, +/* d74 - _0F_DB */ 0x2429, +/* d75 - _66_0F_DB */ 0x242a, +/* d76 - */ 0, +/* d77 - */ 0, +/* d78 - */ 0, +/* d79 - _V_66_0F_DB */ 0x40b4, +/* d7a - */ 0, +/* d7b - */ 0, +/* d7c - */ 0, +/* d7d - */ 0, +/* d7e - */ 0, +/* d7f - */ 0, +/* d80 - _0F_DC */ 0x242b, +/* d81 - _66_0F_DC */ 0x242c, +/* d82 - */ 0, +/* d83 - */ 0, +/* d84 - */ 0, +/* d85 - _V_66_0F_DC */ 0x40b5, +/* d86 - */ 0, +/* d87 - */ 0, +/* d88 - */ 0, +/* d89 - */ 0, +/* d8a - */ 0, +/* d8b - */ 0, +/* d8c - _0F_DD */ 0x242d, +/* d8d - _66_0F_DD */ 0x242e, +/* d8e - */ 0, +/* d8f - */ 0, +/* d90 - */ 0, +/* d91 - _V_66_0F_DD */ 0x40b6, +/* d92 - */ 0, +/* d93 - */ 0, +/* d94 - */ 0, +/* d95 - */ 0, +/* d96 - */ 0, +/* d97 - */ 0, +/* d98 - _0F_DE */ 0x242f, +/* d99 - _66_0F_DE */ 0x2430, +/* d9a - */ 0, +/* d9b - */ 0, +/* d9c - */ 0, +/* d9d - _V_66_0F_DE */ 0x40b7, +/* d9e - */ 0, +/* d9f - */ 0, +/* da0 - */ 0, +/* da1 - */ 0, +/* da2 - */ 0, +/* da3 - */ 0, +/* da4 - _0F_DF */ 0x2431, +/* da5 - _66_0F_DF */ 0x2432, +/* da6 - */ 0, +/* da7 - */ 0, +/* da8 - */ 0, +/* da9 - _V_66_0F_DF */ 0x40b8, +/* daa - */ 0, +/* dab - */ 0, +/* dac - */ 0, +/* dad - */ 0, +/* dae - */ 0, +/* daf - */ 0, +/* db0 - _0F_E0 */ 0x2433, +/* db1 - _66_0F_E0 */ 0x2434, +/* db2 - */ 0, +/* db3 - */ 0, +/* db4 - */ 0, +/* db5 - _V_66_0F_E0 */ 0x40b9, +/* db6 - */ 0, +/* db7 - */ 0, +/* db8 - */ 0, +/* db9 - */ 0, +/* dba - */ 0, +/* dbb - */ 0, +/* dbc - _0F_E1 */ 0x2435, +/* dbd - _66_0F_E1 */ 0x2436, +/* dbe - */ 0, +/* dbf - */ 0, +/* dc0 - */ 0, +/* dc1 - _V_66_0F_E1 */ 0x40ba, +/* dc2 - */ 0, +/* dc3 - */ 0, +/* dc4 - */ 0, +/* dc5 - */ 0, +/* dc6 - */ 0, +/* dc7 - */ 0, +/* dc8 - _0F_E2 */ 0x2437, +/* dc9 - _66_0F_E2 */ 0x2438, +/* dca - */ 0, +/* dcb - */ 0, +/* dcc - */ 0, +/* dcd - _V_66_0F_E2 */ 0x40bb, +/* dce - */ 0, +/* dcf - */ 0, +/* dd0 - */ 0, +/* dd1 - */ 0, +/* dd2 - */ 0, +/* dd3 - */ 0, +/* dd4 - _0F_E3 */ 0x2439, +/* dd5 - _66_0F_E3 */ 0x243a, +/* dd6 - */ 0, +/* dd7 - */ 0, +/* dd8 - */ 0, +/* dd9 - _V_66_0F_E3 */ 0x40bc, +/* dda - */ 0, +/* ddb - */ 0, +/* ddc - */ 0, +/* ddd - */ 0, +/* dde - */ 0, +/* ddf - */ 0, +/* de0 - _0F_E4 */ 0x243b, +/* de1 - _66_0F_E4 */ 0x243c, +/* de2 - */ 0, +/* de3 - */ 0, +/* de4 - */ 0, +/* de5 - _V_66_0F_E4 */ 0x40bd, +/* de6 - */ 0, +/* de7 - */ 0, +/* de8 - */ 0, +/* de9 - */ 0, +/* dea - */ 0, +/* deb - */ 0, +/* dec - _0F_E5 */ 0x243d, +/* ded - _66_0F_E5 */ 0x243e, +/* dee - */ 0, +/* def - */ 0, +/* df0 - */ 0, +/* df1 - _V_66_0F_E5 */ 0x40be, +/* df2 - */ 0, +/* df3 - */ 0, +/* df4 - */ 0, +/* df5 - */ 0, +/* df6 - */ 0, +/* df7 - */ 0, +/* df8 - */ 0, +/* df9 - _66_0F_E6 */ 0x243f, +/* dfa - _F3_0F_E6 */ 0x2440, +/* dfb - _F2_0F_E6 */ 0x2441, +/* dfc - */ 0, +/* dfd - _V_66_0F_E6 */ 0x40bf, +/* dfe - _V_F3_0F_E6 */ 0x40c0, +/* dff - _V_F2_0F_E6 */ 0x40c1, +/* e00 - */ 0, +/* e01 - */ 0, +/* e02 - */ 0, +/* e03 - */ 0, +/* e04 - _0F_E7 */ 0x2442, +/* e05 - _66_0F_E7 */ 0x2443, +/* e06 - */ 0, +/* e07 - */ 0, +/* e08 - */ 0, +/* e09 - _V_66_0F_E7 */ 0x40c2, +/* e0a - */ 0, +/* e0b - */ 0, +/* e0c - */ 0, +/* e0d - */ 0, +/* e0e - */ 0, +/* e0f - */ 0, +/* e10 - _0F_E8 */ 0x2444, +/* e11 - _66_0F_E8 */ 0x2445, +/* e12 - */ 0, +/* e13 - */ 0, +/* e14 - */ 0, +/* e15 - _V_66_0F_E8 */ 0x40c3, +/* e16 - */ 0, +/* e17 - */ 0, +/* e18 - */ 0, +/* e19 - */ 0, +/* e1a - */ 0, +/* e1b - */ 0, +/* e1c - _0F_E9 */ 0x2446, +/* e1d - _66_0F_E9 */ 0x2447, +/* e1e - */ 0, +/* e1f - */ 0, +/* e20 - */ 0, +/* e21 - _V_66_0F_E9 */ 0x40c4, +/* e22 - */ 0, +/* e23 - */ 0, +/* e24 - */ 0, +/* e25 - */ 0, +/* e26 - */ 0, +/* e27 - */ 0, +/* e28 - _0F_EA */ 0x2448, +/* e29 - _66_0F_EA */ 0x2449, +/* e2a - */ 0, +/* e2b - */ 0, +/* e2c - */ 0, +/* e2d - _V_66_0F_EA */ 0x40c5, +/* e2e - */ 0, +/* e2f - */ 0, +/* e30 - */ 0, +/* e31 - */ 0, +/* e32 - */ 0, +/* e33 - */ 0, +/* e34 - _0F_EB */ 0x244a, +/* e35 - _66_0F_EB */ 0x244b, +/* e36 - */ 0, +/* e37 - */ 0, +/* e38 - */ 0, +/* e39 - _V_66_0F_EB */ 0x40c6, +/* e3a - */ 0, +/* e3b - */ 0, +/* e3c - */ 0, +/* e3d - */ 0, +/* e3e - */ 0, +/* e3f - */ 0, +/* e40 - _0F_EC */ 0x244c, +/* e41 - _66_0F_EC */ 0x244d, +/* e42 - */ 0, +/* e43 - */ 0, +/* e44 - */ 0, +/* e45 - _V_66_0F_EC */ 0x40c7, +/* e46 - */ 0, +/* e47 - */ 0, +/* e48 - */ 0, +/* e49 - */ 0, +/* e4a - */ 0, +/* e4b - */ 0, +/* e4c - _0F_ED */ 0x244e, +/* e4d - _66_0F_ED */ 0x244f, +/* e4e - */ 0, +/* e4f - */ 0, +/* e50 - */ 0, +/* e51 - _V_66_0F_ED */ 0x40c8, +/* e52 - */ 0, +/* e53 - */ 0, +/* e54 - */ 0, +/* e55 - */ 0, +/* e56 - */ 0, +/* e57 - */ 0, +/* e58 - _0F_EE */ 0x2450, +/* e59 - _66_0F_EE */ 0x2451, +/* e5a - */ 0, +/* e5b - */ 0, +/* e5c - */ 0, +/* e5d - _V_66_0F_EE */ 0x40c9, +/* e5e - */ 0, +/* e5f - */ 0, +/* e60 - */ 0, +/* e61 - */ 0, +/* e62 - */ 0, +/* e63 - */ 0, +/* e64 - _0F_EF */ 0x2452, +/* e65 - _66_0F_EF */ 0x2453, +/* e66 - */ 0, +/* e67 - */ 0, +/* e68 - */ 0, +/* e69 - _V_66_0F_EF */ 0x40ca, +/* e6a - */ 0, +/* e6b - */ 0, +/* e6c - */ 0, +/* e6d - */ 0, +/* e6e - */ 0, +/* e6f - */ 0, +/* e70 - */ 0, +/* e71 - */ 0, +/* e72 - */ 0, +/* e73 - _F2_0F_F0 */ 0x2454, +/* e74 - */ 0, +/* e75 - */ 0, +/* e76 - */ 0, +/* e77 - _V_F2_0F_F0 */ 0x40cb, +/* e78 - */ 0, +/* e79 - */ 0, +/* e7a - */ 0, +/* e7b - */ 0, +/* e7c - _0F_F1 */ 0x2455, +/* e7d - _66_0F_F1 */ 0x2456, +/* e7e - */ 0, +/* e7f - */ 0, +/* e80 - */ 0, +/* e81 - _V_66_0F_F1 */ 0x40cc, +/* e82 - */ 0, +/* e83 - */ 0, +/* e84 - */ 0, +/* e85 - */ 0, +/* e86 - */ 0, +/* e87 - */ 0, +/* e88 - _0F_F2 */ 0x2457, +/* e89 - _66_0F_F2 */ 0x2458, +/* e8a - */ 0, +/* e8b - */ 0, +/* e8c - */ 0, +/* e8d - _V_66_0F_F2 */ 0x40cd, +/* e8e - */ 0, +/* e8f - */ 0, +/* e90 - */ 0, +/* e91 - */ 0, +/* e92 - */ 0, +/* e93 - */ 0, +/* e94 - _0F_F3 */ 0x2459, +/* e95 - _66_0F_F3 */ 0x245a, +/* e96 - */ 0, +/* e97 - */ 0, +/* e98 - */ 0, +/* e99 - _V_66_0F_F3 */ 0x40ce, +/* e9a - */ 0, +/* e9b - */ 0, +/* e9c - */ 0, +/* e9d - */ 0, +/* e9e - */ 0, +/* e9f - */ 0, +/* ea0 - _0F_F4 */ 0x245b, +/* ea1 - _66_0F_F4 */ 0x245c, +/* ea2 - */ 0, +/* ea3 - */ 0, +/* ea4 - */ 0, +/* ea5 - _V_66_0F_F4 */ 0x40cf, +/* ea6 - */ 0, +/* ea7 - */ 0, +/* ea8 - */ 0, +/* ea9 - */ 0, +/* eaa - */ 0, +/* eab - */ 0, +/* eac - _0F_F5 */ 0x245d, +/* ead - _66_0F_F5 */ 0x245e, +/* eae - */ 0, +/* eaf - */ 0, +/* eb0 - */ 0, +/* eb1 - _V_66_0F_F5 */ 0x40d0, +/* eb2 - */ 0, +/* eb3 - */ 0, +/* eb4 - */ 0, +/* eb5 - */ 0, +/* eb6 - */ 0, +/* eb7 - */ 0, +/* eb8 - _0F_F6 */ 0x245f, +/* eb9 - _66_0F_F6 */ 0x2460, +/* eba - */ 0, +/* ebb - */ 0, +/* ebc - */ 0, +/* ebd - _V_66_0F_F6 */ 0x40d1, +/* ebe - */ 0, +/* ebf - */ 0, +/* ec0 - */ 0, +/* ec1 - */ 0, +/* ec2 - */ 0, +/* ec3 - */ 0, +/* ec4 - _0F_F7 */ 0x2461, +/* ec5 - _66_0F_F7 */ 0x2462, +/* ec6 - */ 0, +/* ec7 - */ 0, +/* ec8 - */ 0, +/* ec9 - _V_66_0F_F7 */ 0x40d2, +/* eca - */ 0, +/* ecb - */ 0, +/* ecc - */ 0, +/* ecd - */ 0, +/* ece - */ 0, +/* ecf - */ 0, +/* ed0 - _0F_F8 */ 0x2463, +/* ed1 - _66_0F_F8 */ 0x2464, +/* ed2 - */ 0, +/* ed3 - */ 0, +/* ed4 - */ 0, +/* ed5 - _V_66_0F_F8 */ 0x40d3, +/* ed6 - */ 0, +/* ed7 - */ 0, +/* ed8 - */ 0, +/* ed9 - */ 0, +/* eda - */ 0, +/* edb - */ 0, +/* edc - _0F_F9 */ 0x2465, +/* edd - _66_0F_F9 */ 0x2466, +/* ede - */ 0, +/* edf - */ 0, +/* ee0 - */ 0, +/* ee1 - _V_66_0F_F9 */ 0x40d4, +/* ee2 - */ 0, +/* ee3 - */ 0, +/* ee4 - */ 0, +/* ee5 - */ 0, +/* ee6 - */ 0, +/* ee7 - */ 0, +/* ee8 - _0F_FA */ 0x2467, +/* ee9 - _66_0F_FA */ 0x2468, +/* eea - */ 0, +/* eeb - */ 0, +/* eec - */ 0, +/* eed - _V_66_0F_FA */ 0x40d5, +/* eee - */ 0, +/* eef - */ 0, +/* ef0 - */ 0, +/* ef1 - */ 0, +/* ef2 - */ 0, +/* ef3 - */ 0, +/* ef4 - _0F_FB */ 0x2469, +/* ef5 - _66_0F_FB */ 0x246a, +/* ef6 - */ 0, +/* ef7 - */ 0, +/* ef8 - */ 0, +/* ef9 - _V_66_0F_FB */ 0x40d6, +/* efa - */ 0, +/* efb - */ 0, +/* efc - */ 0, +/* efd - */ 0, +/* efe - */ 0, +/* eff - */ 0, +/* f00 - _0F_FC */ 0x246b, +/* f01 - _66_0F_FC */ 0x246c, +/* f02 - */ 0, +/* f03 - */ 0, +/* f04 - */ 0, +/* f05 - _V_66_0F_FC */ 0x40d7, +/* f06 - */ 0, +/* f07 - */ 0, +/* f08 - */ 0, +/* f09 - */ 0, +/* f0a - */ 0, +/* f0b - */ 0, +/* f0c - _0F_FD */ 0x246d, +/* f0d - _66_0F_FD */ 0x246e, +/* f0e - */ 0, +/* f0f - */ 0, +/* f10 - */ 0, +/* f11 - _V_66_0F_FD */ 0x40d8, +/* f12 - */ 0, +/* f13 - */ 0, +/* f14 - */ 0, +/* f15 - */ 0, +/* f16 - */ 0, +/* f17 - */ 0, +/* f18 - _0F_FE */ 0x246f, +/* f19 - _66_0F_FE */ 0x2470, +/* f1a - */ 0, +/* f1b - */ 0, +/* f1c - */ 0, +/* f1d - _V_66_0F_FE */ 0x40d9, +/* f1e - */ 0, +/* f1f - */ 0, +/* f20 - */ 0, +/* f21 - */ 0, +/* f22 - */ 0, +/* f23 - */ 0, +/* f24 - _D9_06 */ 0x2471, +/* f25 - _9B_D9_06 */ 0x2472, +/* f26 - */ 0, +/* f27 - */ 0, +/* f28 - */ 0, +/* f29 - */ 0, +/* f2a - */ 0, +/* f2b - */ 0, +/* f2c - */ 0, +/* f2d - */ 0, +/* f2e - */ 0, +/* f2f - */ 0, +/* f30 - _D9_07 */ 0x2473, +/* f31 - _9B_D9_07 */ 0x2474, +/* f32 - */ 0, +/* f33 - */ 0, +/* f34 - */ 0, +/* f35 - */ 0, +/* f36 - */ 0, +/* f37 - */ 0, +/* f38 - */ 0, +/* f39 - */ 0, +/* f3a - */ 0, +/* f3b - */ 0, +/* f3c - _DB_E2 */ 0x2475, +/* f3d - _9B_DB_E2 */ 0x2476, +/* f3e - */ 0, +/* f3f - */ 0, +/* f40 - */ 0, +/* f41 - */ 0, +/* f42 - */ 0, +/* f43 - */ 0, +/* f44 - */ 0, +/* f45 - */ 0, +/* f46 - */ 0, +/* f47 - */ 0, +/* f48 - _DB_E3 */ 0x2477, +/* f49 - _9B_DB_E3 */ 0x2478, +/* f4a - */ 0, +/* f4b - */ 0, +/* f4c - */ 0, +/* f4d - */ 0, +/* f4e - */ 0, +/* f4f - */ 0, +/* f50 - */ 0, +/* f51 - */ 0, +/* f52 - */ 0, +/* f53 - */ 0, +/* f54 - _DD_06 */ 0x2479, +/* f55 - _9B_DD_06 */ 0x247a, +/* f56 - */ 0, +/* f57 - */ 0, +/* f58 - */ 0, +/* f59 - */ 0, +/* f5a - */ 0, +/* f5b - */ 0, +/* f5c - */ 0, +/* f5d - */ 0, +/* f5e - */ 0, +/* f5f - */ 0, +/* f60 - _DD_07 */ 0x247b, +/* f61 - _9B_DD_07 */ 0x247c, +/* f62 - */ 0, +/* f63 - */ 0, +/* f64 - */ 0, +/* f65 - */ 0, +/* f66 - */ 0, +/* f67 - */ 0, +/* f68 - */ 0, +/* f69 - */ 0, +/* f6a - */ 0, +/* f6b - */ 0, +/* f6c - _DF_E0 */ 0x247d, +/* f6d - _9B_DF_E0 */ 0x247e, +/* f6e - */ 0, +/* f6f - */ 0, +/* f70 - */ 0, +/* f71 - */ 0, +/* f72 - */ 0, +/* f73 - */ 0, +/* f74 - */ 0, +/* f75 - */ 0, +/* f76 - */ 0, +/* f77 - */ 0, +/* f78 - _0F_38_00 */ 0x247f, +/* f79 - _66_0F_38_00 */ 0x2480, +/* f7a - */ 0, +/* f7b - */ 0, +/* f7c - */ 0, +/* f7d - _V_66_0F_38_00 */ 0x40da, +/* f7e - */ 0, +/* f7f - */ 0, +/* f80 - */ 0, +/* f81 - */ 0, +/* f82 - */ 0, +/* f83 - */ 0, +/* f84 - _0F_38_01 */ 0x2481, +/* f85 - _66_0F_38_01 */ 0x2482, +/* f86 - */ 0, +/* f87 - */ 0, +/* f88 - */ 0, +/* f89 - _V_66_0F_38_01 */ 0x40db, +/* f8a - */ 0, +/* f8b - */ 0, +/* f8c - */ 0, +/* f8d - */ 0, +/* f8e - */ 0, +/* f8f - */ 0, +/* f90 - _0F_38_02 */ 0x2483, +/* f91 - _66_0F_38_02 */ 0x2484, +/* f92 - */ 0, +/* f93 - */ 0, +/* f94 - */ 0, +/* f95 - _V_66_0F_38_02 */ 0x40dc, +/* f96 - */ 0, +/* f97 - */ 0, +/* f98 - */ 0, +/* f99 - */ 0, +/* f9a - */ 0, +/* f9b - */ 0, +/* f9c - _0F_38_03 */ 0x2485, +/* f9d - _66_0F_38_03 */ 0x2486, +/* f9e - */ 0, +/* f9f - */ 0, +/* fa0 - */ 0, +/* fa1 - _V_66_0F_38_03 */ 0x40dd, +/* fa2 - */ 0, +/* fa3 - */ 0, +/* fa4 - */ 0, +/* fa5 - */ 0, +/* fa6 - */ 0, +/* fa7 - */ 0, +/* fa8 - _0F_38_04 */ 0x2487, +/* fa9 - _66_0F_38_04 */ 0x2488, +/* faa - */ 0, +/* fab - */ 0, +/* fac - */ 0, +/* fad - _V_66_0F_38_04 */ 0x40de, +/* fae - */ 0, +/* faf - */ 0, +/* fb0 - */ 0, +/* fb1 - */ 0, +/* fb2 - */ 0, +/* fb3 - */ 0, +/* fb4 - _0F_38_05 */ 0x2489, +/* fb5 - _66_0F_38_05 */ 0x248a, +/* fb6 - */ 0, +/* fb7 - */ 0, +/* fb8 - */ 0, +/* fb9 - _V_66_0F_38_05 */ 0x40df, +/* fba - */ 0, +/* fbb - */ 0, +/* fbc - */ 0, +/* fbd - */ 0, +/* fbe - */ 0, +/* fbf - */ 0, +/* fc0 - _0F_38_06 */ 0x248b, +/* fc1 - _66_0F_38_06 */ 0x248c, +/* fc2 - */ 0, +/* fc3 - */ 0, +/* fc4 - */ 0, +/* fc5 - _V_66_0F_38_06 */ 0x40e0, +/* fc6 - */ 0, +/* fc7 - */ 0, +/* fc8 - */ 0, +/* fc9 - */ 0, +/* fca - */ 0, +/* fcb - */ 0, +/* fcc - _0F_38_07 */ 0x248d, +/* fcd - _66_0F_38_07 */ 0x248e, +/* fce - */ 0, +/* fcf - */ 0, +/* fd0 - */ 0, +/* fd1 - _V_66_0F_38_07 */ 0x40e1, +/* fd2 - */ 0, +/* fd3 - */ 0, +/* fd4 - */ 0, +/* fd5 - */ 0, +/* fd6 - */ 0, +/* fd7 - */ 0, +/* fd8 - _0F_38_08 */ 0x248f, +/* fd9 - _66_0F_38_08 */ 0x2490, +/* fda - */ 0, +/* fdb - */ 0, +/* fdc - */ 0, +/* fdd - _V_66_0F_38_08 */ 0x40e2, +/* fde - */ 0, +/* fdf - */ 0, +/* fe0 - */ 0, +/* fe1 - */ 0, +/* fe2 - */ 0, +/* fe3 - */ 0, +/* fe4 - _0F_38_09 */ 0x2491, +/* fe5 - _66_0F_38_09 */ 0x2492, +/* fe6 - */ 0, +/* fe7 - */ 0, +/* fe8 - */ 0, +/* fe9 - _V_66_0F_38_09 */ 0x40e3, +/* fea - */ 0, +/* feb - */ 0, +/* fec - */ 0, +/* fed - */ 0, +/* fee - */ 0, +/* fef - */ 0, +/* ff0 - _0F_38_0A */ 0x2493, +/* ff1 - _66_0F_38_0A */ 0x2494, +/* ff2 - */ 0, +/* ff3 - */ 0, +/* ff4 - */ 0, +/* ff5 - _V_66_0F_38_0A */ 0x40e4, +/* ff6 - */ 0, +/* ff7 - */ 0, +/* ff8 - */ 0, +/* ff9 - */ 0, +/* ffa - */ 0, +/* ffb - */ 0, +/* ffc - _0F_38_0B */ 0x2495, +/* ffd - _66_0F_38_0B */ 0x2496, +/* ffe - */ 0, +/* fff - */ 0, +/* 1000 - */ 0, +/* 1001 - _V_66_0F_38_0B */ 0x40e5, +/* 1002 - */ 0, +/* 1003 - */ 0, +/* 1004 - */ 0, +/* 1005 - */ 0, +/* 1006 - */ 0, +/* 1007 - */ 0, +/* 1008 - */ 0, +/* 1009 - */ 0, +/* 100a - */ 0, +/* 100b - */ 0, +/* 100c - */ 0, +/* 100d - _V_66_0F_38_0C */ 0x40e6, +/* 100e - */ 0, +/* 100f - */ 0, +/* 1010 - */ 0, +/* 1011 - */ 0, +/* 1012 - */ 0, +/* 1013 - */ 0, +/* 1014 - */ 0, +/* 1015 - */ 0, +/* 1016 - */ 0, +/* 1017 - */ 0, +/* 1018 - */ 0, +/* 1019 - _V_66_0F_38_0D */ 0x40e7, +/* 101a - */ 0, +/* 101b - */ 0, +/* 101c - */ 0, +/* 101d - */ 0, +/* 101e - */ 0, +/* 101f - */ 0, +/* 1020 - */ 0, +/* 1021 - */ 0, +/* 1022 - */ 0, +/* 1023 - */ 0, +/* 1024 - */ 0, +/* 1025 - _V_66_0F_38_0E */ 0x40e8, +/* 1026 - */ 0, +/* 1027 - */ 0, +/* 1028 - */ 0, +/* 1029 - */ 0, +/* 102a - */ 0, +/* 102b - */ 0, +/* 102c - */ 0, +/* 102d - */ 0, +/* 102e - */ 0, +/* 102f - */ 0, +/* 1030 - */ 0, +/* 1031 - _V_66_0F_38_0F */ 0x40e9, +/* 1032 - */ 0, +/* 1033 - */ 0, +/* 1034 - */ 0, +/* 1035 - */ 0, +/* 1036 - */ 0, +/* 1037 - */ 0, +/* 1038 - */ 0, +/* 1039 - _66_0F_38_10 */ 0x40ea, +/* 103a - */ 0, +/* 103b - */ 0, +/* 103c - */ 0, +/* 103d - */ 0, +/* 103e - */ 0, +/* 103f - */ 0, +/* 1040 - */ 0, +/* 1041 - */ 0, +/* 1042 - */ 0, +/* 1043 - */ 0, +/* 1044 - */ 0, +/* 1045 - _66_0F_38_14 */ 0x40eb, +/* 1046 - */ 0, +/* 1047 - */ 0, +/* 1048 - */ 0, +/* 1049 - */ 0, +/* 104a - */ 0, +/* 104b - */ 0, +/* 104c - */ 0, +/* 104d - */ 0, +/* 104e - */ 0, +/* 104f - */ 0, +/* 1050 - */ 0, +/* 1051 - _66_0F_38_15 */ 0x40ec, +/* 1052 - */ 0, +/* 1053 - */ 0, +/* 1054 - */ 0, +/* 1055 - */ 0, +/* 1056 - */ 0, +/* 1057 - */ 0, +/* 1058 - */ 0, +/* 1059 - */ 0, +/* 105a - */ 0, +/* 105b - */ 0, +/* 105c - */ 0, +/* 105d - _66_0F_38_17 */ 0x2497, +/* 105e - */ 0, +/* 105f - */ 0, +/* 1060 - */ 0, +/* 1061 - _V_66_0F_38_17 */ 0x40ed, +/* 1062 - */ 0, +/* 1063 - */ 0, +/* 1064 - */ 0, +/* 1065 - */ 0, +/* 1066 - */ 0, +/* 1067 - */ 0, +/* 1068 - */ 0, +/* 1069 - */ 0, +/* 106a - */ 0, +/* 106b - */ 0, +/* 106c - */ 0, +/* 106d - _V_66_0F_38_18 */ 0x40ee, +/* 106e - */ 0, +/* 106f - */ 0, +/* 1070 - */ 0, +/* 1071 - */ 0, +/* 1072 - */ 0, +/* 1073 - */ 0, +/* 1074 - */ 0, +/* 1075 - */ 0, +/* 1076 - */ 0, +/* 1077 - */ 0, +/* 1078 - */ 0, +/* 1079 - _V_66_0F_38_19 */ 0x40ef, +/* 107a - */ 0, +/* 107b - */ 0, +/* 107c - */ 0, +/* 107d - */ 0, +/* 107e - */ 0, +/* 107f - */ 0, +/* 1080 - */ 0, +/* 1081 - */ 0, +/* 1082 - */ 0, +/* 1083 - */ 0, +/* 1084 - */ 0, +/* 1085 - _V_66_0F_38_1A */ 0x40f0, +/* 1086 - */ 0, +/* 1087 - */ 0, +/* 1088 - */ 0, +/* 1089 - */ 0, +/* 108a - */ 0, +/* 108b - */ 0, +/* 108c - _0F_38_1C */ 0x2498, +/* 108d - _66_0F_38_1C */ 0x2499, +/* 108e - */ 0, +/* 108f - */ 0, +/* 1090 - */ 0, +/* 1091 - _V_66_0F_38_1C */ 0x40f1, +/* 1092 - */ 0, +/* 1093 - */ 0, +/* 1094 - */ 0, +/* 1095 - */ 0, +/* 1096 - */ 0, +/* 1097 - */ 0, +/* 1098 - _0F_38_1D */ 0x249a, +/* 1099 - _66_0F_38_1D */ 0x249b, +/* 109a - */ 0, +/* 109b - */ 0, +/* 109c - */ 0, +/* 109d - _V_66_0F_38_1D */ 0x40f2, +/* 109e - */ 0, +/* 109f - */ 0, +/* 10a0 - */ 0, +/* 10a1 - */ 0, +/* 10a2 - */ 0, +/* 10a3 - */ 0, +/* 10a4 - _0F_38_1E */ 0x249c, +/* 10a5 - _66_0F_38_1E */ 0x249d, +/* 10a6 - */ 0, +/* 10a7 - */ 0, +/* 10a8 - */ 0, +/* 10a9 - _V_66_0F_38_1E */ 0x40f3, +/* 10aa - */ 0, +/* 10ab - */ 0, +/* 10ac - */ 0, +/* 10ad - */ 0, +/* 10ae - */ 0, +/* 10af - */ 0, +/* 10b0 - */ 0, +/* 10b1 - _66_0F_38_20 */ 0x249e, +/* 10b2 - */ 0, +/* 10b3 - */ 0, +/* 10b4 - */ 0, +/* 10b5 - _V_66_0F_38_20 */ 0x40f4, +/* 10b6 - */ 0, +/* 10b7 - */ 0, +/* 10b8 - */ 0, +/* 10b9 - */ 0, +/* 10ba - */ 0, +/* 10bb - */ 0, +/* 10bc - */ 0, +/* 10bd - _66_0F_38_21 */ 0x249f, +/* 10be - */ 0, +/* 10bf - */ 0, +/* 10c0 - */ 0, +/* 10c1 - _V_66_0F_38_21 */ 0x40f5, +/* 10c2 - */ 0, +/* 10c3 - */ 0, +/* 10c4 - */ 0, +/* 10c5 - */ 0, +/* 10c6 - */ 0, +/* 10c7 - */ 0, +/* 10c8 - */ 0, +/* 10c9 - _66_0F_38_22 */ 0x24a0, +/* 10ca - */ 0, +/* 10cb - */ 0, +/* 10cc - */ 0, +/* 10cd - _V_66_0F_38_22 */ 0x40f6, +/* 10ce - */ 0, +/* 10cf - */ 0, +/* 10d0 - */ 0, +/* 10d1 - */ 0, +/* 10d2 - */ 0, +/* 10d3 - */ 0, +/* 10d4 - */ 0, +/* 10d5 - _66_0F_38_23 */ 0x24a1, +/* 10d6 - */ 0, +/* 10d7 - */ 0, +/* 10d8 - */ 0, +/* 10d9 - _V_66_0F_38_23 */ 0x40f7, +/* 10da - */ 0, +/* 10db - */ 0, +/* 10dc - */ 0, +/* 10dd - */ 0, +/* 10de - */ 0, +/* 10df - */ 0, +/* 10e0 - */ 0, +/* 10e1 - _66_0F_38_24 */ 0x24a2, +/* 10e2 - */ 0, +/* 10e3 - */ 0, +/* 10e4 - */ 0, +/* 10e5 - _V_66_0F_38_24 */ 0x40f8, +/* 10e6 - */ 0, +/* 10e7 - */ 0, +/* 10e8 - */ 0, +/* 10e9 - */ 0, +/* 10ea - */ 0, +/* 10eb - */ 0, +/* 10ec - */ 0, +/* 10ed - _66_0F_38_25 */ 0x24a3, +/* 10ee - */ 0, +/* 10ef - */ 0, +/* 10f0 - */ 0, +/* 10f1 - _V_66_0F_38_25 */ 0x40f9, +/* 10f2 - */ 0, +/* 10f3 - */ 0, +/* 10f4 - */ 0, +/* 10f5 - */ 0, +/* 10f6 - */ 0, +/* 10f7 - */ 0, +/* 10f8 - */ 0, +/* 10f9 - _66_0F_38_28 */ 0x24a4, +/* 10fa - */ 0, +/* 10fb - */ 0, +/* 10fc - */ 0, +/* 10fd - _V_66_0F_38_28 */ 0x40fa, +/* 10fe - */ 0, +/* 10ff - */ 0, +/* 1100 - */ 0, +/* 1101 - */ 0, +/* 1102 - */ 0, +/* 1103 - */ 0, +/* 1104 - */ 0, +/* 1105 - _66_0F_38_29 */ 0x24a5, +/* 1106 - */ 0, +/* 1107 - */ 0, +/* 1108 - */ 0, +/* 1109 - _V_66_0F_38_29 */ 0x40fb, +/* 110a - */ 0, +/* 110b - */ 0, +/* 110c - */ 0, +/* 110d - */ 0, +/* 110e - */ 0, +/* 110f - */ 0, +/* 1110 - */ 0, +/* 1111 - _66_0F_38_2A */ 0x24a6, +/* 1112 - */ 0, +/* 1113 - */ 0, +/* 1114 - */ 0, +/* 1115 - _V_66_0F_38_2A */ 0x40fc, +/* 1116 - */ 0, +/* 1117 - */ 0, +/* 1118 - */ 0, +/* 1119 - */ 0, +/* 111a - */ 0, +/* 111b - */ 0, +/* 111c - */ 0, +/* 111d - _66_0F_38_2B */ 0x24a7, +/* 111e - */ 0, +/* 111f - */ 0, +/* 1120 - */ 0, +/* 1121 - _V_66_0F_38_2B */ 0x40fd, +/* 1122 - */ 0, +/* 1123 - */ 0, +/* 1124 - */ 0, +/* 1125 - */ 0, +/* 1126 - */ 0, +/* 1127 - */ 0, +/* 1128 - */ 0, +/* 1129 - */ 0, +/* 112a - */ 0, +/* 112b - */ 0, +/* 112c - */ 0, +/* 112d - _V_66_0F_38_2C */ 0x40fe, +/* 112e - */ 0, +/* 112f - */ 0, +/* 1130 - */ 0, +/* 1131 - */ 0, +/* 1132 - */ 0, +/* 1133 - */ 0, +/* 1134 - */ 0, +/* 1135 - */ 0, +/* 1136 - */ 0, +/* 1137 - */ 0, +/* 1138 - */ 0, +/* 1139 - _V_66_0F_38_2D */ 0x40ff, +/* 113a - */ 0, +/* 113b - */ 0, +/* 113c - */ 0, +/* 113d - */ 0, +/* 113e - */ 0, +/* 113f - */ 0, +/* 1140 - */ 0, +/* 1141 - */ 0, +/* 1142 - */ 0, +/* 1143 - */ 0, +/* 1144 - */ 0, +/* 1145 - _V_66_0F_38_2E */ 0x4100, +/* 1146 - */ 0, +/* 1147 - */ 0, +/* 1148 - */ 0, +/* 1149 - */ 0, +/* 114a - */ 0, +/* 114b - */ 0, +/* 114c - */ 0, +/* 114d - */ 0, +/* 114e - */ 0, +/* 114f - */ 0, +/* 1150 - */ 0, +/* 1151 - _V_66_0F_38_2F */ 0x4101, +/* 1152 - */ 0, +/* 1153 - */ 0, +/* 1154 - */ 0, +/* 1155 - */ 0, +/* 1156 - */ 0, +/* 1157 - */ 0, +/* 1158 - */ 0, +/* 1159 - _66_0F_38_30 */ 0x24a8, +/* 115a - */ 0, +/* 115b - */ 0, +/* 115c - */ 0, +/* 115d - _V_66_0F_38_30 */ 0x4102, +/* 115e - */ 0, +/* 115f - */ 0, +/* 1160 - */ 0, +/* 1161 - */ 0, +/* 1162 - */ 0, +/* 1163 - */ 0, +/* 1164 - */ 0, +/* 1165 - _66_0F_38_31 */ 0x24a9, +/* 1166 - */ 0, +/* 1167 - */ 0, +/* 1168 - */ 0, +/* 1169 - _V_66_0F_38_31 */ 0x4103, +/* 116a - */ 0, +/* 116b - */ 0, +/* 116c - */ 0, +/* 116d - */ 0, +/* 116e - */ 0, +/* 116f - */ 0, +/* 1170 - */ 0, +/* 1171 - _66_0F_38_32 */ 0x24aa, +/* 1172 - */ 0, +/* 1173 - */ 0, +/* 1174 - */ 0, +/* 1175 - _V_66_0F_38_32 */ 0x4104, +/* 1176 - */ 0, +/* 1177 - */ 0, +/* 1178 - */ 0, +/* 1179 - */ 0, +/* 117a - */ 0, +/* 117b - */ 0, +/* 117c - */ 0, +/* 117d - _66_0F_38_33 */ 0x24ab, +/* 117e - */ 0, +/* 117f - */ 0, +/* 1180 - */ 0, +/* 1181 - _V_66_0F_38_33 */ 0x4105, +/* 1182 - */ 0, +/* 1183 - */ 0, +/* 1184 - */ 0, +/* 1185 - */ 0, +/* 1186 - */ 0, +/* 1187 - */ 0, +/* 1188 - */ 0, +/* 1189 - _66_0F_38_34 */ 0x24ac, +/* 118a - */ 0, +/* 118b - */ 0, +/* 118c - */ 0, +/* 118d - _V_66_0F_38_34 */ 0x4106, +/* 118e - */ 0, +/* 118f - */ 0, +/* 1190 - */ 0, +/* 1191 - */ 0, +/* 1192 - */ 0, +/* 1193 - */ 0, +/* 1194 - */ 0, +/* 1195 - _66_0F_38_35 */ 0x24ad, +/* 1196 - */ 0, +/* 1197 - */ 0, +/* 1198 - */ 0, +/* 1199 - _V_66_0F_38_35 */ 0x4107, +/* 119a - */ 0, +/* 119b - */ 0, +/* 119c - */ 0, +/* 119d - */ 0, +/* 119e - */ 0, +/* 119f - */ 0, +/* 11a0 - */ 0, +/* 11a1 - _66_0F_38_37 */ 0x24ae, +/* 11a2 - */ 0, +/* 11a3 - */ 0, +/* 11a4 - */ 0, +/* 11a5 - _V_66_0F_38_37 */ 0x4108, +/* 11a6 - */ 0, +/* 11a7 - */ 0, +/* 11a8 - */ 0, +/* 11a9 - */ 0, +/* 11aa - */ 0, +/* 11ab - */ 0, +/* 11ac - */ 0, +/* 11ad - _66_0F_38_38 */ 0x24af, +/* 11ae - */ 0, +/* 11af - */ 0, +/* 11b0 - */ 0, +/* 11b1 - _V_66_0F_38_38 */ 0x4109, +/* 11b2 - */ 0, +/* 11b3 - */ 0, +/* 11b4 - */ 0, +/* 11b5 - */ 0, +/* 11b6 - */ 0, +/* 11b7 - */ 0, +/* 11b8 - */ 0, +/* 11b9 - _66_0F_38_39 */ 0x24b0, +/* 11ba - */ 0, +/* 11bb - */ 0, +/* 11bc - */ 0, +/* 11bd - _V_66_0F_38_39 */ 0x410a, +/* 11be - */ 0, +/* 11bf - */ 0, +/* 11c0 - */ 0, +/* 11c1 - */ 0, +/* 11c2 - */ 0, +/* 11c3 - */ 0, +/* 11c4 - */ 0, +/* 11c5 - _66_0F_38_3A */ 0x24b1, +/* 11c6 - */ 0, +/* 11c7 - */ 0, +/* 11c8 - */ 0, +/* 11c9 - _V_66_0F_38_3A */ 0x410b, +/* 11ca - */ 0, +/* 11cb - */ 0, +/* 11cc - */ 0, +/* 11cd - */ 0, +/* 11ce - */ 0, +/* 11cf - */ 0, +/* 11d0 - */ 0, +/* 11d1 - _66_0F_38_3B */ 0x24b2, +/* 11d2 - */ 0, +/* 11d3 - */ 0, +/* 11d4 - */ 0, +/* 11d5 - _V_66_0F_38_3B */ 0x410c, +/* 11d6 - */ 0, +/* 11d7 - */ 0, +/* 11d8 - */ 0, +/* 11d9 - */ 0, +/* 11da - */ 0, +/* 11db - */ 0, +/* 11dc - */ 0, +/* 11dd - _66_0F_38_3C */ 0x24b3, +/* 11de - */ 0, +/* 11df - */ 0, +/* 11e0 - */ 0, +/* 11e1 - _V_66_0F_38_3C */ 0x410d, +/* 11e2 - */ 0, +/* 11e3 - */ 0, +/* 11e4 - */ 0, +/* 11e5 - */ 0, +/* 11e6 - */ 0, +/* 11e7 - */ 0, +/* 11e8 - */ 0, +/* 11e9 - _66_0F_38_3D */ 0x24b4, +/* 11ea - */ 0, +/* 11eb - */ 0, +/* 11ec - */ 0, +/* 11ed - _V_66_0F_38_3D */ 0x410e, +/* 11ee - */ 0, +/* 11ef - */ 0, +/* 11f0 - */ 0, +/* 11f1 - */ 0, +/* 11f2 - */ 0, +/* 11f3 - */ 0, +/* 11f4 - */ 0, +/* 11f5 - _66_0F_38_3E */ 0x24b5, +/* 11f6 - */ 0, +/* 11f7 - */ 0, +/* 11f8 - */ 0, +/* 11f9 - _V_66_0F_38_3E */ 0x410f, +/* 11fa - */ 0, +/* 11fb - */ 0, +/* 11fc - */ 0, +/* 11fd - */ 0, +/* 11fe - */ 0, +/* 11ff - */ 0, +/* 1200 - */ 0, +/* 1201 - _66_0F_38_3F */ 0x24b6, +/* 1202 - */ 0, +/* 1203 - */ 0, +/* 1204 - */ 0, +/* 1205 - _V_66_0F_38_3F */ 0x4110, +/* 1206 - */ 0, +/* 1207 - */ 0, +/* 1208 - */ 0, +/* 1209 - */ 0, +/* 120a - */ 0, +/* 120b - */ 0, +/* 120c - */ 0, +/* 120d - _66_0F_38_40 */ 0x24b7, +/* 120e - */ 0, +/* 120f - */ 0, +/* 1210 - */ 0, +/* 1211 - _V_66_0F_38_40 */ 0x4111, +/* 1212 - */ 0, +/* 1213 - */ 0, +/* 1214 - */ 0, +/* 1215 - */ 0, +/* 1216 - */ 0, +/* 1217 - */ 0, +/* 1218 - */ 0, +/* 1219 - _66_0F_38_41 */ 0x24b8, +/* 121a - */ 0, +/* 121b - */ 0, +/* 121c - */ 0, +/* 121d - _V_66_0F_38_41 */ 0x4112, +/* 121e - */ 0, +/* 121f - */ 0, +/* 1220 - */ 0, +/* 1221 - */ 0, +/* 1222 - */ 0, +/* 1223 - */ 0, +/* 1224 - */ 0, +/* 1225 - _66_0F_38_80 */ 0x24b9, +/* 1226 - */ 0, +/* 1227 - */ 0, +/* 1228 - */ 0, +/* 1229 - */ 0, +/* 122a - */ 0, +/* 122b - */ 0, +/* 122c - */ 0, +/* 122d - */ 0, +/* 122e - */ 0, +/* 122f - */ 0, +/* 1230 - */ 0, +/* 1231 - _66_0F_38_81 */ 0x24ba, +/* 1232 - */ 0, +/* 1233 - */ 0, +/* 1234 - */ 0, +/* 1235 - */ 0, +/* 1236 - */ 0, +/* 1237 - */ 0, +/* 1238 - */ 0, +/* 1239 - */ 0, +/* 123a - */ 0, +/* 123b - */ 0, +/* 123c - */ 0, +/* 123d - _66_0F_38_82 */ 0x24bb, +/* 123e - */ 0, +/* 123f - */ 0, +/* 1240 - */ 0, +/* 1241 - */ 0, +/* 1242 - */ 0, +/* 1243 - */ 0, +/* 1244 - */ 0, +/* 1245 - */ 0, +/* 1246 - */ 0, +/* 1247 - */ 0, +/* 1248 - */ 0, +/* 1249 - */ 0, +/* 124a - */ 0, +/* 124b - */ 0, +/* 124c - */ 0, +/* 124d - _V_66_0F_38_96 */ 0x4113, +/* 124e - */ 0, +/* 124f - */ 0, +/* 1250 - */ 0, +/* 1251 - */ 0, +/* 1252 - */ 0, +/* 1253 - */ 0, +/* 1254 - */ 0, +/* 1255 - */ 0, +/* 1256 - */ 0, +/* 1257 - */ 0, +/* 1258 - */ 0, +/* 1259 - _V_66_0F_38_97 */ 0x4114, +/* 125a - */ 0, +/* 125b - */ 0, +/* 125c - */ 0, +/* 125d - */ 0, +/* 125e - */ 0, +/* 125f - */ 0, +/* 1260 - */ 0, +/* 1261 - */ 0, +/* 1262 - */ 0, +/* 1263 - */ 0, +/* 1264 - */ 0, +/* 1265 - _V_66_0F_38_98 */ 0x4115, +/* 1266 - */ 0, +/* 1267 - */ 0, +/* 1268 - */ 0, +/* 1269 - */ 0, +/* 126a - */ 0, +/* 126b - */ 0, +/* 126c - */ 0, +/* 126d - */ 0, +/* 126e - */ 0, +/* 126f - */ 0, +/* 1270 - */ 0, +/* 1271 - _V_66_0F_38_99 */ 0x4116, +/* 1272 - */ 0, +/* 1273 - */ 0, +/* 1274 - */ 0, +/* 1275 - */ 0, +/* 1276 - */ 0, +/* 1277 - */ 0, +/* 1278 - */ 0, +/* 1279 - */ 0, +/* 127a - */ 0, +/* 127b - */ 0, +/* 127c - */ 0, +/* 127d - _V_66_0F_38_9A */ 0x4117, +/* 127e - */ 0, +/* 127f - */ 0, +/* 1280 - */ 0, +/* 1281 - */ 0, +/* 1282 - */ 0, +/* 1283 - */ 0, +/* 1284 - */ 0, +/* 1285 - */ 0, +/* 1286 - */ 0, +/* 1287 - */ 0, +/* 1288 - */ 0, +/* 1289 - _V_66_0F_38_9B */ 0x4118, +/* 128a - */ 0, +/* 128b - */ 0, +/* 128c - */ 0, +/* 128d - */ 0, +/* 128e - */ 0, +/* 128f - */ 0, +/* 1290 - */ 0, +/* 1291 - */ 0, +/* 1292 - */ 0, +/* 1293 - */ 0, +/* 1294 - */ 0, +/* 1295 - _V_66_0F_38_9C */ 0x4119, +/* 1296 - */ 0, +/* 1297 - */ 0, +/* 1298 - */ 0, +/* 1299 - */ 0, +/* 129a - */ 0, +/* 129b - */ 0, +/* 129c - */ 0, +/* 129d - */ 0, +/* 129e - */ 0, +/* 129f - */ 0, +/* 12a0 - */ 0, +/* 12a1 - _V_66_0F_38_9D */ 0x411a, +/* 12a2 - */ 0, +/* 12a3 - */ 0, +/* 12a4 - */ 0, +/* 12a5 - */ 0, +/* 12a6 - */ 0, +/* 12a7 - */ 0, +/* 12a8 - */ 0, +/* 12a9 - */ 0, +/* 12aa - */ 0, +/* 12ab - */ 0, +/* 12ac - */ 0, +/* 12ad - _V_66_0F_38_9E */ 0x411b, +/* 12ae - */ 0, +/* 12af - */ 0, +/* 12b0 - */ 0, +/* 12b1 - */ 0, +/* 12b2 - */ 0, +/* 12b3 - */ 0, +/* 12b4 - */ 0, +/* 12b5 - */ 0, +/* 12b6 - */ 0, +/* 12b7 - */ 0, +/* 12b8 - */ 0, +/* 12b9 - _V_66_0F_38_9F */ 0x411c, +/* 12ba - */ 0, +/* 12bb - */ 0, +/* 12bc - */ 0, +/* 12bd - */ 0, +/* 12be - */ 0, +/* 12bf - */ 0, +/* 12c0 - */ 0, +/* 12c1 - */ 0, +/* 12c2 - */ 0, +/* 12c3 - */ 0, +/* 12c4 - */ 0, +/* 12c5 - _V_66_0F_38_A6 */ 0x411d, +/* 12c6 - */ 0, +/* 12c7 - */ 0, +/* 12c8 - */ 0, +/* 12c9 - */ 0, +/* 12ca - */ 0, +/* 12cb - */ 0, +/* 12cc - */ 0, +/* 12cd - */ 0, +/* 12ce - */ 0, +/* 12cf - */ 0, +/* 12d0 - */ 0, +/* 12d1 - _V_66_0F_38_A7 */ 0x411e, +/* 12d2 - */ 0, +/* 12d3 - */ 0, +/* 12d4 - */ 0, +/* 12d5 - */ 0, +/* 12d6 - */ 0, +/* 12d7 - */ 0, +/* 12d8 - */ 0, +/* 12d9 - */ 0, +/* 12da - */ 0, +/* 12db - */ 0, +/* 12dc - */ 0, +/* 12dd - _V_66_0F_38_A8 */ 0x411f, +/* 12de - */ 0, +/* 12df - */ 0, +/* 12e0 - */ 0, +/* 12e1 - */ 0, +/* 12e2 - */ 0, +/* 12e3 - */ 0, +/* 12e4 - */ 0, +/* 12e5 - */ 0, +/* 12e6 - */ 0, +/* 12e7 - */ 0, +/* 12e8 - */ 0, +/* 12e9 - _V_66_0F_38_A9 */ 0x4120, +/* 12ea - */ 0, +/* 12eb - */ 0, +/* 12ec - */ 0, +/* 12ed - */ 0, +/* 12ee - */ 0, +/* 12ef - */ 0, +/* 12f0 - */ 0, +/* 12f1 - */ 0, +/* 12f2 - */ 0, +/* 12f3 - */ 0, +/* 12f4 - */ 0, +/* 12f5 - _V_66_0F_38_AA */ 0x4121, +/* 12f6 - */ 0, +/* 12f7 - */ 0, +/* 12f8 - */ 0, +/* 12f9 - */ 0, +/* 12fa - */ 0, +/* 12fb - */ 0, +/* 12fc - */ 0, +/* 12fd - */ 0, +/* 12fe - */ 0, +/* 12ff - */ 0, +/* 1300 - */ 0, +/* 1301 - _V_66_0F_38_AB */ 0x4122, +/* 1302 - */ 0, +/* 1303 - */ 0, +/* 1304 - */ 0, +/* 1305 - */ 0, +/* 1306 - */ 0, +/* 1307 - */ 0, +/* 1308 - */ 0, +/* 1309 - */ 0, +/* 130a - */ 0, +/* 130b - */ 0, +/* 130c - */ 0, +/* 130d - _V_66_0F_38_AC */ 0x4123, +/* 130e - */ 0, +/* 130f - */ 0, +/* 1310 - */ 0, +/* 1311 - */ 0, +/* 1312 - */ 0, +/* 1313 - */ 0, +/* 1314 - */ 0, +/* 1315 - */ 0, +/* 1316 - */ 0, +/* 1317 - */ 0, +/* 1318 - */ 0, +/* 1319 - _V_66_0F_38_AD */ 0x4124, +/* 131a - */ 0, +/* 131b - */ 0, +/* 131c - */ 0, +/* 131d - */ 0, +/* 131e - */ 0, +/* 131f - */ 0, +/* 1320 - */ 0, +/* 1321 - */ 0, +/* 1322 - */ 0, +/* 1323 - */ 0, +/* 1324 - */ 0, +/* 1325 - _V_66_0F_38_AE */ 0x4125, +/* 1326 - */ 0, +/* 1327 - */ 0, +/* 1328 - */ 0, +/* 1329 - */ 0, +/* 132a - */ 0, +/* 132b - */ 0, +/* 132c - */ 0, +/* 132d - */ 0, +/* 132e - */ 0, +/* 132f - */ 0, +/* 1330 - */ 0, +/* 1331 - _V_66_0F_38_AF */ 0x4126, +/* 1332 - */ 0, +/* 1333 - */ 0, +/* 1334 - */ 0, +/* 1335 - */ 0, +/* 1336 - */ 0, +/* 1337 - */ 0, +/* 1338 - */ 0, +/* 1339 - */ 0, +/* 133a - */ 0, +/* 133b - */ 0, +/* 133c - */ 0, +/* 133d - _V_66_0F_38_B6 */ 0x4127, +/* 133e - */ 0, +/* 133f - */ 0, +/* 1340 - */ 0, +/* 1341 - */ 0, +/* 1342 - */ 0, +/* 1343 - */ 0, +/* 1344 - */ 0, +/* 1345 - */ 0, +/* 1346 - */ 0, +/* 1347 - */ 0, +/* 1348 - */ 0, +/* 1349 - _V_66_0F_38_B7 */ 0x4128, +/* 134a - */ 0, +/* 134b - */ 0, +/* 134c - */ 0, +/* 134d - */ 0, +/* 134e - */ 0, +/* 134f - */ 0, +/* 1350 - */ 0, +/* 1351 - */ 0, +/* 1352 - */ 0, +/* 1353 - */ 0, +/* 1354 - */ 0, +/* 1355 - _V_66_0F_38_B8 */ 0x4129, +/* 1356 - */ 0, +/* 1357 - */ 0, +/* 1358 - */ 0, +/* 1359 - */ 0, +/* 135a - */ 0, +/* 135b - */ 0, +/* 135c - */ 0, +/* 135d - */ 0, +/* 135e - */ 0, +/* 135f - */ 0, +/* 1360 - */ 0, +/* 1361 - _V_66_0F_38_B9 */ 0x412a, +/* 1362 - */ 0, +/* 1363 - */ 0, +/* 1364 - */ 0, +/* 1365 - */ 0, +/* 1366 - */ 0, +/* 1367 - */ 0, +/* 1368 - */ 0, +/* 1369 - */ 0, +/* 136a - */ 0, +/* 136b - */ 0, +/* 136c - */ 0, +/* 136d - _V_66_0F_38_BA */ 0x412b, +/* 136e - */ 0, +/* 136f - */ 0, +/* 1370 - */ 0, +/* 1371 - */ 0, +/* 1372 - */ 0, +/* 1373 - */ 0, +/* 1374 - */ 0, +/* 1375 - */ 0, +/* 1376 - */ 0, +/* 1377 - */ 0, +/* 1378 - */ 0, +/* 1379 - _V_66_0F_38_BB */ 0x412c, +/* 137a - */ 0, +/* 137b - */ 0, +/* 137c - */ 0, +/* 137d - */ 0, +/* 137e - */ 0, +/* 137f - */ 0, +/* 1380 - */ 0, +/* 1381 - */ 0, +/* 1382 - */ 0, +/* 1383 - */ 0, +/* 1384 - */ 0, +/* 1385 - _V_66_0F_38_BC */ 0x412d, +/* 1386 - */ 0, +/* 1387 - */ 0, +/* 1388 - */ 0, +/* 1389 - */ 0, +/* 138a - */ 0, +/* 138b - */ 0, +/* 138c - */ 0, +/* 138d - */ 0, +/* 138e - */ 0, +/* 138f - */ 0, +/* 1390 - */ 0, +/* 1391 - _V_66_0F_38_BD */ 0x412e, +/* 1392 - */ 0, +/* 1393 - */ 0, +/* 1394 - */ 0, +/* 1395 - */ 0, +/* 1396 - */ 0, +/* 1397 - */ 0, +/* 1398 - */ 0, +/* 1399 - */ 0, +/* 139a - */ 0, +/* 139b - */ 0, +/* 139c - */ 0, +/* 139d - _V_66_0F_38_BE */ 0x412f, +/* 139e - */ 0, +/* 139f - */ 0, +/* 13a0 - */ 0, +/* 13a1 - */ 0, +/* 13a2 - */ 0, +/* 13a3 - */ 0, +/* 13a4 - */ 0, +/* 13a5 - */ 0, +/* 13a6 - */ 0, +/* 13a7 - */ 0, +/* 13a8 - */ 0, +/* 13a9 - _V_66_0F_38_BF */ 0x4130, +/* 13aa - */ 0, +/* 13ab - */ 0, +/* 13ac - */ 0, +/* 13ad - */ 0, +/* 13ae - */ 0, +/* 13af - */ 0, +/* 13b0 - */ 0, +/* 13b1 - _66_0F_38_DB */ 0x24bc, +/* 13b2 - */ 0, +/* 13b3 - */ 0, +/* 13b4 - */ 0, +/* 13b5 - _V_66_0F_38_DB */ 0x4131, +/* 13b6 - */ 0, +/* 13b7 - */ 0, +/* 13b8 - */ 0, +/* 13b9 - */ 0, +/* 13ba - */ 0, +/* 13bb - */ 0, +/* 13bc - */ 0, +/* 13bd - _66_0F_38_DC */ 0x24bd, +/* 13be - */ 0, +/* 13bf - */ 0, +/* 13c0 - */ 0, +/* 13c1 - _V_66_0F_38_DC */ 0x4132, +/* 13c2 - */ 0, +/* 13c3 - */ 0, +/* 13c4 - */ 0, +/* 13c5 - */ 0, +/* 13c6 - */ 0, +/* 13c7 - */ 0, +/* 13c8 - */ 0, +/* 13c9 - _66_0F_38_DD */ 0x24be, +/* 13ca - */ 0, +/* 13cb - */ 0, +/* 13cc - */ 0, +/* 13cd - _V_66_0F_38_DD */ 0x4133, +/* 13ce - */ 0, +/* 13cf - */ 0, +/* 13d0 - */ 0, +/* 13d1 - */ 0, +/* 13d2 - */ 0, +/* 13d3 - */ 0, +/* 13d4 - */ 0, +/* 13d5 - _66_0F_38_DE */ 0x24bf, +/* 13d6 - */ 0, +/* 13d7 - */ 0, +/* 13d8 - */ 0, +/* 13d9 - _V_66_0F_38_DE */ 0x4134, +/* 13da - */ 0, +/* 13db - */ 0, +/* 13dc - */ 0, +/* 13dd - */ 0, +/* 13de - */ 0, +/* 13df - */ 0, +/* 13e0 - */ 0, +/* 13e1 - _66_0F_38_DF */ 0x24c0, +/* 13e2 - */ 0, +/* 13e3 - */ 0, +/* 13e4 - */ 0, +/* 13e5 - _V_66_0F_38_DF */ 0x4135, +/* 13e6 - */ 0, +/* 13e7 - */ 0, +/* 13e8 - */ 0, +/* 13e9 - */ 0, +/* 13ea - */ 0, +/* 13eb - */ 0, +/* 13ec - _0F_38_F0 */ 0x24c1, +/* 13ed - */ 0, +/* 13ee - */ 0, +/* 13ef - _F2_0F_38_F0 */ 0x24c2, +/* 13f0 - */ 0, +/* 13f1 - */ 0, +/* 13f2 - */ 0, +/* 13f3 - */ 0, +/* 13f4 - */ 0, +/* 13f5 - */ 0, +/* 13f6 - */ 0, +/* 13f7 - */ 0, +/* 13f8 - _0F_38_F1 */ 0x24c3, +/* 13f9 - */ 0, +/* 13fa - */ 0, +/* 13fb - _F2_0F_38_F1 */ 0x24c4, +/* 13fc - */ 0, +/* 13fd - */ 0, +/* 13fe - */ 0, +/* 13ff - */ 0, +/* 1400 - */ 0, +/* 1401 - */ 0, +/* 1402 - */ 0, +/* 1403 - */ 0, +/* 1404 - */ 0, +/* 1405 - */ 0, +/* 1406 - */ 0, +/* 1407 - */ 0, +/* 1408 - */ 0, +/* 1409 - _V_66_0F_3A_04 */ 0x4136, +/* 140a - */ 0, +/* 140b - */ 0, +/* 140c - */ 0, +/* 140d - */ 0, +/* 140e - */ 0, +/* 140f - */ 0, +/* 1410 - */ 0, +/* 1411 - */ 0, +/* 1412 - */ 0, +/* 1413 - */ 0, +/* 1414 - */ 0, +/* 1415 - _V_66_0F_3A_05 */ 0x4137, +/* 1416 - */ 0, +/* 1417 - */ 0, +/* 1418 - */ 0, +/* 1419 - */ 0, +/* 141a - */ 0, +/* 141b - */ 0, +/* 141c - */ 0, +/* 141d - */ 0, +/* 141e - */ 0, +/* 141f - */ 0, +/* 1420 - */ 0, +/* 1421 - _V_66_0F_3A_06 */ 0x4138, +/* 1422 - */ 0, +/* 1423 - */ 0, +/* 1424 - */ 0, +/* 1425 - */ 0, +/* 1426 - */ 0, +/* 1427 - */ 0, +/* 1428 - */ 0, +/* 1429 - _66_0F_3A_08 */ 0x4139, +/* 142a - */ 0, +/* 142b - */ 0, +/* 142c - */ 0, +/* 142d - _V_66_0F_3A_08 */ 0x413a, +/* 142e - */ 0, +/* 142f - */ 0, +/* 1430 - */ 0, +/* 1431 - */ 0, +/* 1432 - */ 0, +/* 1433 - */ 0, +/* 1434 - */ 0, +/* 1435 - _66_0F_3A_09 */ 0x413b, +/* 1436 - */ 0, +/* 1437 - */ 0, +/* 1438 - */ 0, +/* 1439 - _V_66_0F_3A_09 */ 0x413c, +/* 143a - */ 0, +/* 143b - */ 0, +/* 143c - */ 0, +/* 143d - */ 0, +/* 143e - */ 0, +/* 143f - */ 0, +/* 1440 - */ 0, +/* 1441 - _66_0F_3A_0A */ 0x413d, +/* 1442 - */ 0, +/* 1443 - */ 0, +/* 1444 - */ 0, +/* 1445 - _V_66_0F_3A_0A */ 0x413e, +/* 1446 - */ 0, +/* 1447 - */ 0, +/* 1448 - */ 0, +/* 1449 - */ 0, +/* 144a - */ 0, +/* 144b - */ 0, +/* 144c - */ 0, +/* 144d - _66_0F_3A_0B */ 0x413f, +/* 144e - */ 0, +/* 144f - */ 0, +/* 1450 - */ 0, +/* 1451 - _V_66_0F_3A_0B */ 0x4140, +/* 1452 - */ 0, +/* 1453 - */ 0, +/* 1454 - */ 0, +/* 1455 - */ 0, +/* 1456 - */ 0, +/* 1457 - */ 0, +/* 1458 - */ 0, +/* 1459 - _66_0F_3A_0C */ 0x4141, +/* 145a - */ 0, +/* 145b - */ 0, +/* 145c - */ 0, +/* 145d - _V_66_0F_3A_0C */ 0x4142, +/* 145e - */ 0, +/* 145f - */ 0, +/* 1460 - */ 0, +/* 1461 - */ 0, +/* 1462 - */ 0, +/* 1463 - */ 0, +/* 1464 - */ 0, +/* 1465 - _66_0F_3A_0D */ 0x4143, +/* 1466 - */ 0, +/* 1467 - */ 0, +/* 1468 - */ 0, +/* 1469 - _V_66_0F_3A_0D */ 0x4144, +/* 146a - */ 0, +/* 146b - */ 0, +/* 146c - */ 0, +/* 146d - */ 0, +/* 146e - */ 0, +/* 146f - */ 0, +/* 1470 - */ 0, +/* 1471 - _66_0F_3A_0E */ 0x4145, +/* 1472 - */ 0, +/* 1473 - */ 0, +/* 1474 - */ 0, +/* 1475 - _V_66_0F_3A_0E */ 0x4146, +/* 1476 - */ 0, +/* 1477 - */ 0, +/* 1478 - */ 0, +/* 1479 - */ 0, +/* 147a - */ 0, +/* 147b - */ 0, +/* 147c - _0F_3A_0F */ 0x4147, +/* 147d - _66_0F_3A_0F */ 0x4148, +/* 147e - */ 0, +/* 147f - */ 0, +/* 1480 - */ 0, +/* 1481 - _V_66_0F_3A_0F */ 0x4149, +/* 1482 - */ 0, +/* 1483 - */ 0, +/* 1484 - */ 0, +/* 1485 - */ 0, +/* 1486 - */ 0, +/* 1487 - */ 0, +/* 1488 - */ 0, +/* 1489 - _66_0F_3A_14 */ 0x414a, +/* 148a - */ 0, +/* 148b - */ 0, +/* 148c - */ 0, +/* 148d - _V_66_0F_3A_14 */ 0x414b, +/* 148e - */ 0, +/* 148f - */ 0, +/* 1490 - */ 0, +/* 1491 - */ 0, +/* 1492 - */ 0, +/* 1493 - */ 0, +/* 1494 - */ 0, +/* 1495 - _66_0F_3A_15 */ 0x414c, +/* 1496 - */ 0, +/* 1497 - */ 0, +/* 1498 - */ 0, +/* 1499 - _V_66_0F_3A_15 */ 0x414d, +/* 149a - */ 0, +/* 149b - */ 0, +/* 149c - */ 0, +/* 149d - */ 0, +/* 149e - */ 0, +/* 149f - */ 0, +/* 14a0 - */ 0, +/* 14a1 - _66_0F_3A_16 */ 0x414e, +/* 14a2 - */ 0, +/* 14a3 - */ 0, +/* 14a4 - */ 0, +/* 14a5 - _V_66_0F_3A_16 */ 0x414f, +/* 14a6 - */ 0, +/* 14a7 - */ 0, +/* 14a8 - */ 0, +/* 14a9 - */ 0, +/* 14aa - */ 0, +/* 14ab - */ 0, +/* 14ac - */ 0, +/* 14ad - _66_0F_3A_17 */ 0x4150, +/* 14ae - */ 0, +/* 14af - */ 0, +/* 14b0 - */ 0, +/* 14b1 - _V_66_0F_3A_17 */ 0x4151, +/* 14b2 - */ 0, +/* 14b3 - */ 0, +/* 14b4 - */ 0, +/* 14b5 - */ 0, +/* 14b6 - */ 0, +/* 14b7 - */ 0, +/* 14b8 - */ 0, +/* 14b9 - */ 0, +/* 14ba - */ 0, +/* 14bb - */ 0, +/* 14bc - */ 0, +/* 14bd - _V_66_0F_3A_18 */ 0x4152, +/* 14be - */ 0, +/* 14bf - */ 0, +/* 14c0 - */ 0, +/* 14c1 - */ 0, +/* 14c2 - */ 0, +/* 14c3 - */ 0, +/* 14c4 - */ 0, +/* 14c5 - */ 0, +/* 14c6 - */ 0, +/* 14c7 - */ 0, +/* 14c8 - */ 0, +/* 14c9 - _V_66_0F_3A_19 */ 0x4153, +/* 14ca - */ 0, +/* 14cb - */ 0, +/* 14cc - */ 0, +/* 14cd - */ 0, +/* 14ce - */ 0, +/* 14cf - */ 0, +/* 14d0 - */ 0, +/* 14d1 - _66_0F_3A_20 */ 0x4154, +/* 14d2 - */ 0, +/* 14d3 - */ 0, +/* 14d4 - */ 0, +/* 14d5 - _V_66_0F_3A_20 */ 0x4155, +/* 14d6 - */ 0, +/* 14d7 - */ 0, +/* 14d8 - */ 0, +/* 14d9 - */ 0, +/* 14da - */ 0, +/* 14db - */ 0, +/* 14dc - */ 0, +/* 14dd - _66_0F_3A_21 */ 0x4156, +/* 14de - */ 0, +/* 14df - */ 0, +/* 14e0 - */ 0, +/* 14e1 - _V_66_0F_3A_21 */ 0x4157, +/* 14e2 - */ 0, +/* 14e3 - */ 0, +/* 14e4 - */ 0, +/* 14e5 - */ 0, +/* 14e6 - */ 0, +/* 14e7 - */ 0, +/* 14e8 - */ 0, +/* 14e9 - _66_0F_3A_22 */ 0x4158, +/* 14ea - */ 0, +/* 14eb - */ 0, +/* 14ec - */ 0, +/* 14ed - _V_66_0F_3A_22 */ 0x4159, +/* 14ee - */ 0, +/* 14ef - */ 0, +/* 14f0 - */ 0, +/* 14f1 - */ 0, +/* 14f2 - */ 0, +/* 14f3 - */ 0, +/* 14f4 - */ 0, +/* 14f5 - _66_0F_3A_40 */ 0x415a, +/* 14f6 - */ 0, +/* 14f7 - */ 0, +/* 14f8 - */ 0, +/* 14f9 - _V_66_0F_3A_40 */ 0x415b, +/* 14fa - */ 0, +/* 14fb - */ 0, +/* 14fc - */ 0, +/* 14fd - */ 0, +/* 14fe - */ 0, +/* 14ff - */ 0, +/* 1500 - */ 0, +/* 1501 - _66_0F_3A_41 */ 0x415c, +/* 1502 - */ 0, +/* 1503 - */ 0, +/* 1504 - */ 0, +/* 1505 - _V_66_0F_3A_41 */ 0x415d, +/* 1506 - */ 0, +/* 1507 - */ 0, +/* 1508 - */ 0, +/* 1509 - */ 0, +/* 150a - */ 0, +/* 150b - */ 0, +/* 150c - */ 0, +/* 150d - _66_0F_3A_42 */ 0x415e, +/* 150e - */ 0, +/* 150f - */ 0, +/* 1510 - */ 0, +/* 1511 - _V_66_0F_3A_42 */ 0x415f, +/* 1512 - */ 0, +/* 1513 - */ 0, +/* 1514 - */ 0, +/* 1515 - */ 0, +/* 1516 - */ 0, +/* 1517 - */ 0, +/* 1518 - */ 0, +/* 1519 - _66_0F_3A_44 */ 0x4160, +/* 151a - */ 0, +/* 151b - */ 0, +/* 151c - */ 0, +/* 151d - _V_66_0F_3A_44 */ 0x4161, +/* 151e - */ 0, +/* 151f - */ 0, +/* 1520 - */ 0, +/* 1521 - */ 0, +/* 1522 - */ 0, +/* 1523 - */ 0, +/* 1524 - */ 0, +/* 1525 - */ 0, +/* 1526 - */ 0, +/* 1527 - */ 0, +/* 1528 - */ 0, +/* 1529 - _V_66_0F_3A_4A */ 0x4162, +/* 152a - */ 0, +/* 152b - */ 0, +/* 152c - */ 0, +/* 152d - */ 0, +/* 152e - */ 0, +/* 152f - */ 0, +/* 1530 - */ 0, +/* 1531 - */ 0, +/* 1532 - */ 0, +/* 1533 - */ 0, +/* 1534 - */ 0, +/* 1535 - _V_66_0F_3A_4B */ 0x4163, +/* 1536 - */ 0, +/* 1537 - */ 0, +/* 1538 - */ 0, +/* 1539 - */ 0, +/* 153a - */ 0, +/* 153b - */ 0, +/* 153c - */ 0, +/* 153d - */ 0, +/* 153e - */ 0, +/* 153f - */ 0, +/* 1540 - */ 0, +/* 1541 - _V_66_0F_3A_4C */ 0x4164, +/* 1542 - */ 0, +/* 1543 - */ 0, +/* 1544 - */ 0, +/* 1545 - */ 0, +/* 1546 - */ 0, +/* 1547 - */ 0, +/* 1548 - */ 0, +/* 1549 - _66_0F_3A_60 */ 0x4165, +/* 154a - */ 0, +/* 154b - */ 0, +/* 154c - */ 0, +/* 154d - _V_66_0F_3A_60 */ 0x4166, +/* 154e - */ 0, +/* 154f - */ 0, +/* 1550 - */ 0, +/* 1551 - */ 0, +/* 1552 - */ 0, +/* 1553 - */ 0, +/* 1554 - */ 0, +/* 1555 - _66_0F_3A_61 */ 0x4167, +/* 1556 - */ 0, +/* 1557 - */ 0, +/* 1558 - */ 0, +/* 1559 - _V_66_0F_3A_61 */ 0x4168, +/* 155a - */ 0, +/* 155b - */ 0, +/* 155c - */ 0, +/* 155d - */ 0, +/* 155e - */ 0, +/* 155f - */ 0, +/* 1560 - */ 0, +/* 1561 - _66_0F_3A_62 */ 0x4169, +/* 1562 - */ 0, +/* 1563 - */ 0, +/* 1564 - */ 0, +/* 1565 - _V_66_0F_3A_62 */ 0x416a, +/* 1566 - */ 0, +/* 1567 - */ 0, +/* 1568 - */ 0, +/* 1569 - */ 0, +/* 156a - */ 0, +/* 156b - */ 0, +/* 156c - */ 0, +/* 156d - _66_0F_3A_63 */ 0x416b, +/* 156e - */ 0, +/* 156f - */ 0, +/* 1570 - */ 0, +/* 1571 - _V_66_0F_3A_63 */ 0x416c, +/* 1572 - */ 0, +/* 1573 - */ 0, +/* 1574 - */ 0, +/* 1575 - */ 0, +/* 1576 - */ 0, +/* 1577 - */ 0, +/* 1578 - */ 0, +/* 1579 - _66_0F_3A_DF */ 0x416d, +/* 157a - */ 0, +/* 157b - */ 0, +/* 157c - */ 0, +/* 157d - _V_66_0F_3A_DF */ 0x416e, +/* 157e - */ 0, +/* 157f - */ 0, +/* 1580 - */ 0, +/* 1581 - */ 0, +/* 1582 - */ 0, +/* 1583 - */ 0, +/* 1584 - _0F_71_02 */ 0x24c5, +/* 1585 - _66_0F_71_02 */ 0x24c6, +/* 1586 - */ 0, +/* 1587 - */ 0, +/* 1588 - */ 0, +/* 1589 - _V_66_0F_71_02 */ 0x416f, +/* 158a - */ 0, +/* 158b - */ 0, +/* 158c - */ 0, +/* 158d - */ 0, +/* 158e - */ 0, +/* 158f - */ 0, +/* 1590 - _0F_71_04 */ 0x24c7, +/* 1591 - _66_0F_71_04 */ 0x24c8, +/* 1592 - */ 0, +/* 1593 - */ 0, +/* 1594 - */ 0, +/* 1595 - _V_66_0F_71_04 */ 0x4170, +/* 1596 - */ 0, +/* 1597 - */ 0, +/* 1598 - */ 0, +/* 1599 - */ 0, +/* 159a - */ 0, +/* 159b - */ 0, +/* 159c - _0F_71_06 */ 0x24c9, +/* 159d - _66_0F_71_06 */ 0x24ca, +/* 159e - */ 0, +/* 159f - */ 0, +/* 15a0 - */ 0, +/* 15a1 - _V_66_0F_71_06 */ 0x4171, +/* 15a2 - */ 0, +/* 15a3 - */ 0, +/* 15a4 - */ 0, +/* 15a5 - */ 0, +/* 15a6 - */ 0, +/* 15a7 - */ 0, +/* 15a8 - _0F_72_02 */ 0x24cb, +/* 15a9 - _66_0F_72_02 */ 0x24cc, +/* 15aa - */ 0, +/* 15ab - */ 0, +/* 15ac - */ 0, +/* 15ad - _V_66_0F_72_02 */ 0x4172, +/* 15ae - */ 0, +/* 15af - */ 0, +/* 15b0 - */ 0, +/* 15b1 - */ 0, +/* 15b2 - */ 0, +/* 15b3 - */ 0, +/* 15b4 - _0F_72_04 */ 0x24cd, +/* 15b5 - _66_0F_72_04 */ 0x24ce, +/* 15b6 - */ 0, +/* 15b7 - */ 0, +/* 15b8 - */ 0, +/* 15b9 - _V_66_0F_72_04 */ 0x4173, +/* 15ba - */ 0, +/* 15bb - */ 0, +/* 15bc - */ 0, +/* 15bd - */ 0, +/* 15be - */ 0, +/* 15bf - */ 0, +/* 15c0 - _0F_72_06 */ 0x24cf, +/* 15c1 - _66_0F_72_06 */ 0x24d0, +/* 15c2 - */ 0, +/* 15c3 - */ 0, +/* 15c4 - */ 0, +/* 15c5 - _V_66_0F_72_06 */ 0x4174, +/* 15c6 - */ 0, +/* 15c7 - */ 0, +/* 15c8 - */ 0, +/* 15c9 - */ 0, +/* 15ca - */ 0, +/* 15cb - */ 0, +/* 15cc - _0F_73_02 */ 0x24d1, +/* 15cd - _66_0F_73_02 */ 0x24d2, +/* 15ce - */ 0, +/* 15cf - */ 0, +/* 15d0 - */ 0, +/* 15d1 - _V_66_0F_73_02 */ 0x4175, +/* 15d2 - */ 0, +/* 15d3 - */ 0, +/* 15d4 - */ 0, +/* 15d5 - */ 0, +/* 15d6 - */ 0, +/* 15d7 - */ 0, +/* 15d8 - */ 0, +/* 15d9 - _66_0F_73_03 */ 0x24d3, +/* 15da - */ 0, +/* 15db - */ 0, +/* 15dc - */ 0, +/* 15dd - _V_66_0F_73_03 */ 0x4176, +/* 15de - */ 0, +/* 15df - */ 0, +/* 15e0 - */ 0, +/* 15e1 - */ 0, +/* 15e2 - */ 0, +/* 15e3 - */ 0, +/* 15e4 - _0F_73_06 */ 0x24d4, +/* 15e5 - _66_0F_73_06 */ 0x24d5, +/* 15e6 - */ 0, +/* 15e7 - */ 0, +/* 15e8 - */ 0, +/* 15e9 - _V_66_0F_73_06 */ 0x4177, +/* 15ea - */ 0, +/* 15eb - */ 0, +/* 15ec - */ 0, +/* 15ed - */ 0, +/* 15ee - */ 0, +/* 15ef - */ 0, +/* 15f0 - */ 0, +/* 15f1 - _66_0F_73_07 */ 0x24d6, +/* 15f2 - */ 0, +/* 15f3 - */ 0, +/* 15f4 - */ 0, +/* 15f5 - _V_66_0F_73_07 */ 0x4178, +/* 15f6 - */ 0, +/* 15f7 - */ 0, +/* 15f8 - */ 0, +/* 15f9 - */ 0, +/* 15fa - */ 0, +/* 15fb - */ 0, +/* 15fc - _0F_AE_00 */ 0x4179, +/* 15fd - */ 0, +/* 15fe - _F3_0F_AE_00 */ 0x24d7, +/* 15ff - */ 0, +/* 1600 - */ 0, +/* 1601 - */ 0, +/* 1602 - */ 0, +/* 1603 - */ 0, +/* 1604 - */ 0, +/* 1605 - */ 0, +/* 1606 - */ 0, +/* 1607 - */ 0, +/* 1608 - _0F_AE_01 */ 0x417a, +/* 1609 - */ 0, +/* 160a - _F3_0F_AE_01 */ 0x24d8, +/* 160b - */ 0, +/* 160c - */ 0, +/* 160d - */ 0, +/* 160e - */ 0, +/* 160f - */ 0, +/* 1610 - */ 0, +/* 1611 - */ 0, +/* 1612 - */ 0, +/* 1613 - */ 0, +/* 1614 - _0F_AE_02 */ 0x24d9, +/* 1615 - */ 0, +/* 1616 - _F3_0F_AE_02 */ 0x24da, +/* 1617 - */ 0, +/* 1618 - _V_0F_AE_02 */ 0x417b, +/* 1619 - */ 0, +/* 161a - */ 0, +/* 161b - */ 0, +/* 161c - */ 0, +/* 161d - */ 0, +/* 161e - */ 0, +/* 161f - */ 0, +/* 1620 - _0F_AE_03 */ 0x24db, +/* 1621 - */ 0, +/* 1622 - _F3_0F_AE_03 */ 0x24dc, +/* 1623 - */ 0, +/* 1624 - _V_0F_AE_03 */ 0x417c, +/* 1625 - */ 0, +/* 1626 - */ 0, +/* 1627 - */ 0, +/* 1628 - */ 0, +/* 1629 - */ 0, +/* 162a - */ 0, +/* 162b - */ 0, +/* 162c - _0F_C7_06 */ 0x24dd, +/* 162d - _66_0F_C7_06 */ 0x24de, +/* 162e - _F3_0F_C7_06 */ 0x24df, +/* 162f - */ 0, +/* 1630 - */ 0, +/* 1631 - */ 0, +/* 1632 - */ 0, +/* 1633 - */ 0, +/* 1634 - */ 0, +/* 1635 - */ 0, +/* 1636 - */ 0, +/* 1637 - */ 0 +}; + +_InstSharedInfo InstSharedInfoTable[474] = { +{0, 6, 68, 245, 0, 0, 256}, +{0, 8, 72, 245, 0, 0, 256}, +{0, 68, 6, 245, 0, 0, 256}, +{0, 72, 8, 245, 0, 0, 256}, +{1, 1, 11, 245, 0, 0, 256}, +{1, 3, 13, 245, 0, 0, 256}, +{2, 0, 46, 0, 0, 0, 256}, +{3, 0, 46, 0, 0, 0, 256}, +{0, 6, 68, 196, 16, 0, 256}, +{0, 8, 72, 196, 16, 0, 256}, +{0, 68, 6, 196, 16, 0, 256}, +{0, 72, 8, 196, 16, 0, 256}, +{1, 1, 11, 196, 16, 0, 256}, +{1, 3, 13, 196, 16, 0, 256}, +{4, 0, 46, 0, 0, 0, 256}, +{0, 6, 68, 245, 1, 0, 256}, +{0, 8, 72, 245, 1, 0, 256}, +{0, 68, 6, 245, 1, 0, 256}, +{0, 72, 8, 245, 1, 0, 256}, +{1, 1, 11, 245, 1, 0, 256}, +{1, 3, 13, 245, 1, 0, 256}, +{5, 0, 46, 0, 0, 0, 256}, +{6, 0, 46, 0, 0, 0, 256}, +{7, 0, 46, 0, 0, 0, 256}, +{8, 0, 46, 0, 0, 0, 256}, +{0, 6, 68, 229, 0, 16, 256}, +{0, 8, 72, 229, 0, 16, 256}, +{0, 68, 6, 229, 0, 16, 256}, +{0, 72, 8, 229, 0, 16, 256}, +{1, 1, 11, 229, 0, 16, 256}, +{1, 3, 13, 229, 0, 16, 256}, +{9, 0, 0, 213, 17, 32, 256}, +{0, 6, 68, 196, 0, 16, 256}, +{0, 8, 72, 196, 0, 16, 256}, +{0, 68, 6, 196, 0, 16, 256}, +{0, 72, 8, 196, 0, 16, 256}, +{1, 1, 11, 196, 0, 16, 256}, +{1, 3, 13, 196, 0, 16, 256}, +{9, 0, 0, 17, 16, 228, 256}, +{10, 6, 68, 245, 0, 0, 256}, +{10, 8, 72, 245, 0, 0, 256}, +{10, 68, 6, 245, 0, 0, 256}, +{10, 72, 8, 245, 0, 0, 256}, +{11, 1, 11, 245, 0, 0, 256}, +{11, 3, 13, 245, 0, 0, 256}, +{12, 0, 18, 244, 0, 0, 256}, +{13, 0, 18, 0, 0, 0, 256}, +{14, 0, 18, 0, 0, 0, 256}, +{15, 0, 0, 0, 0, 0, 256}, +{16, 54, 8, 0, 0, 0, 256}, +{10, 7, 69, 64, 0, 0, 256}, +{13, 0, 3, 0, 0, 0, 256}, +{17, 72, 8, 33, 0, 212, 256}, +{18, 0, 5, 0, 0, 0, 256}, +{19, 25, 22, 0, 8, 0, 33024}, +{20, 25, 22, 0, 8, 0, 33024}, +{19, 21, 25, 0, 8, 0, 33024}, +{20, 21, 25, 0, 8, 0, 33024}, +{13, 0, 15, 0, 32, 0, 261}, +{13, 0, 15, 0, 1, 0, 261}, +{13, 0, 15, 0, 64, 0, 261}, +{13, 0, 15, 0, 65, 0, 261}, +{13, 0, 15, 0, 128, 0, 261}, +{13, 0, 15, 0, 4, 0, 261}, +{13, 0, 15, 0, 160, 0, 261}, +{13, 0, 15, 0, 224, 0, 261}, +{10, 6, 68, 196, 0, 16, 256}, +{10, 8, 72, 196, 0, 16, 256}, +{0, 6, 68, 0, 0, 0, 256}, +{0, 8, 72, 0, 0, 0, 256}, +{21, 6, 68, 0, 0, 0, 256}, +{21, 8, 72, 0, 0, 0, 256}, +{21, 68, 6, 0, 0, 0, 256}, +{21, 72, 8, 0, 0, 0, 256}, +{21, 45, 71, 0, 0, 0, 256}, +{21, 54, 8, 0, 0, 0, 256}, +{21, 71, 45, 0, 0, 0, 256}, +{1, 13, 18, 0, 0, 0, 256}, +{22, 0, 0, 0, 0, 0, 256}, +{9, 0, 50, 0, 0, 0, 257}, +{23, 0, 0, 0, 0, 0, 256}, +{23, 0, 0, 255, 0, 0, 256}, +{11, 0, 0, 213, 0, 0, 256}, +{11, 0, 0, 0, 0, 0, 256}, +{1, 19, 11, 0, 0, 0, 256}, +{1, 20, 13, 0, 0, 0, 256}, +{1, 11, 19, 0, 0, 0, 256}, +{1, 13, 20, 0, 0, 0, 256}, +{24, 21, 22, 0, 8, 0, 256}, +{25, 21, 22, 0, 8, 0, 256}, +{19, 22, 21, 245, 8, 0, 256}, +{26, 22, 21, 245, 8, 0, 256}, +{11, 1, 11, 196, 0, 16, 256}, +{11, 3, 13, 196, 0, 16, 256}, +{19, 11, 22, 0, 8, 0, 256}, +{26, 13, 22, 0, 8, 0, 256}, +{19, 21, 11, 0, 8, 0, 256}, +{26, 21, 13, 0, 8, 0, 256}, +{19, 11, 22, 245, 8, 0, 256}, +{26, 13, 22, 245, 8, 0, 256}, +{1, 1, 17, 0, 0, 0, 256}, +{27, 3, 18, 0, 0, 0, 256}, +{13, 0, 2, 0, 0, 0, 258}, +{13, 0, 0, 0, 0, 0, 258}, +{16, 60, 8, 0, 0, 0, 256}, +{13, 49, 47, 0, 0, 0, 256}, +{13, 0, 0, 0, 0, 0, 256}, +{28, 0, 2, 0, 0, 0, 258}, +{28, 0, 0, 0, 0, 0, 258}, +{11, 0, 1, 0, 0, 0, 262}, +{9, 0, 0, 0, 0, 0, 262}, +{28, 0, 0, 255, 0, 0, 33026}, +{9, 0, 1, 196, 0, 49, 256}, +{9, 0, 0, 0, 0, 0, 256}, +{29, 0, 23, 0, 0, 0, 256}, +{30, 0, 15, 0, 64, 0, 261}, +{30, 0, 15, 0, 0, 0, 261}, +{31, 0, 15, 0, 0, 0, 261}, +{1, 1, 11, 0, 0, 0, 33024}, +{1, 1, 14, 0, 0, 0, 33024}, +{11, 11, 1, 0, 0, 0, 33024}, +{11, 14, 1, 0, 0, 0, 33024}, +{13, 0, 16, 0, 0, 0, 257}, +{13, 0, 16, 0, 0, 0, 260}, +{9, 0, 50, 0, 0, 0, 260}, +{13, 0, 15, 0, 0, 0, 260}, +{1, 25, 11, 0, 0, 0, 33024}, +{1, 25, 14, 0, 0, 0, 33024}, +{11, 11, 25, 0, 0, 0, 33024}, +{11, 14, 25, 0, 0, 0, 33024}, +{11, 0, 0, 0, 0, 0, 262}, +{11, 0, 0, 0, 0, 0, 33032}, +{11, 0, 0, 1, 0, 0, 256}, +{11, 0, 0, 2, 0, 0, 33024}, +{11, 0, 0, 8, 0, 0, 256}, +{10, 69, 8, 64, 0, 0, 256}, +{32, 0, 0, 0, 0, 0, 771}, +{32, 0, 0, 0, 0, 0, 33024}, +{32, 0, 0, 0, 0, 0, 262}, +{11, 0, 0, 0, 0, 0, 3072}, +{10, 0, 72, 0, 0, 0, 256}, +{33, 43, 51, 0, 0, 0, 33024}, +{33, 44, 51, 0, 0, 0, 33024}, +{33, 51, 43, 0, 0, 0, 33024}, +{33, 51, 44, 0, 0, 0, 33024}, +{32, 0, 0, 0, 0, 0, 256}, +{34, 72, 8, 0, 32, 0, 775}, +{34, 72, 8, 0, 1, 0, 775}, +{34, 72, 8, 0, 64, 0, 775}, +{34, 72, 8, 0, 65, 0, 775}, +{34, 72, 8, 0, 128, 0, 775}, +{34, 72, 8, 0, 4, 0, 775}, +{34, 72, 8, 0, 160, 0, 775}, +{34, 72, 8, 0, 224, 0, 775}, +{32, 0, 16, 0, 32, 0, 261}, +{32, 0, 16, 0, 1, 0, 261}, +{32, 0, 16, 0, 64, 0, 261}, +{32, 0, 16, 0, 65, 0, 261}, +{32, 0, 16, 0, 128, 0, 261}, +{32, 0, 16, 0, 4, 0, 261}, +{32, 0, 16, 0, 160, 0, 261}, +{32, 0, 16, 0, 224, 0, 261}, +{34, 0, 68, 0, 32, 0, 256}, +{34, 0, 68, 0, 1, 0, 256}, +{34, 0, 68, 0, 64, 0, 256}, +{34, 0, 68, 0, 65, 0, 256}, +{34, 0, 68, 0, 128, 0, 256}, +{34, 0, 68, 0, 4, 0, 256}, +{34, 0, 68, 0, 160, 0, 256}, +{34, 0, 68, 0, 224, 0, 256}, +{35, 0, 46, 0, 0, 0, 256}, +{36, 0, 46, 0, 0, 0, 256}, +{34, 8, 72, 1, 0, 244, 256}, +{37, 8, 72, 197, 0, 48, 256}, +{38, 0, 46, 0, 0, 0, 256}, +{39, 0, 46, 0, 0, 0, 256}, +{32, 0, 0, 255, 0, 0, 256}, +{40, 8, 72, 1, 0, 244, 256}, +{34, 72, 8, 33, 0, 212, 256}, +{40, 6, 68, 245, 0, 0, 256}, +{40, 8, 72, 245, 0, 0, 256}, +{41, 60, 8, 0, 0, 0, 256}, +{34, 68, 8, 0, 0, 0, 256}, +{42, 69, 8, 0, 0, 0, 256}, +{42, 10, 56, 0, 0, 0, 1536}, +{43, 0, 18, 0, 0, 0, 256}, +{44, 1, 68, 245, 0, 0, 256}, +{44, 1, 68, 196, 16, 0, 256}, +{44, 1, 68, 245, 1, 0, 256}, +{44, 1, 68, 229, 0, 16, 256}, +{44, 1, 68, 196, 0, 16, 256}, +{45, 1, 68, 245, 0, 0, 256}, +{44, 3, 72, 245, 0, 0, 256}, +{44, 3, 72, 196, 16, 0, 256}, +{44, 3, 72, 245, 1, 0, 256}, +{44, 3, 72, 229, 0, 16, 256}, +{44, 3, 72, 196, 0, 16, 256}, +{45, 3, 72, 245, 0, 0, 256}, +{46, 1, 68, 245, 0, 0, 256}, +{46, 1, 68, 196, 16, 0, 256}, +{46, 1, 68, 245, 1, 0, 256}, +{46, 1, 68, 229, 0, 16, 256}, +{46, 1, 68, 196, 0, 16, 256}, +{47, 1, 68, 245, 0, 0, 256}, +{44, 5, 72, 245, 0, 0, 256}, +{48, 5, 72, 196, 16, 0, 256}, +{44, 5, 72, 245, 1, 0, 256}, +{48, 5, 72, 229, 0, 16, 256}, +{48, 5, 72, 196, 0, 16, 256}, +{45, 5, 72, 245, 0, 0, 256}, +{49, 0, 72, 0, 0, 0, 256}, +{50, 1, 68, 1, 0, 32, 256}, +{50, 1, 68, 1, 1, 32, 256}, +{50, 1, 68, 197, 0, 48, 256}, +{50, 1, 72, 1, 0, 32, 256}, +{50, 1, 72, 1, 1, 32, 256}, +{50, 1, 72, 197, 0, 48, 256}, +{51, 1, 68, 0, 0, 0, 256}, +{52, 0, 1, 0, 0, 0, 768}, +{51, 3, 72, 0, 0, 0, 256}, +{52, 0, 16, 0, 0, 0, 768}, +{50, 41, 68, 33, 0, 0, 256}, +{50, 41, 68, 33, 1, 0, 256}, +{50, 41, 68, 229, 0, 16, 256}, +{50, 41, 72, 33, 0, 0, 256}, +{50, 41, 72, 33, 1, 0, 256}, +{50, 41, 72, 229, 0, 16, 256}, +{50, 42, 68, 1, 0, 32, 256}, +{50, 42, 68, 1, 1, 32, 256}, +{50, 42, 68, 197, 0, 48, 256}, +{50, 42, 72, 1, 0, 32, 256}, +{50, 42, 72, 1, 1, 32, 256}, +{50, 42, 72, 197, 0, 48, 256}, +{45, 0, 64, 0, 0, 0, 512}, +{53, 0, 28, 0, 0, 0, 512}, +{53, 0, 27, 0, 0, 0, 512}, +{53, 0, 0, 0, 0, 0, 512}, +{50, 0, 64, 0, 0, 0, 512}, +{45, 0, 54, 0, 0, 0, 512}, +{45, 0, 63, 0, 0, 0, 512}, +{54, 0, 28, 0, 1, 0, 768}, +{54, 0, 28, 0, 64, 0, 768}, +{54, 0, 28, 0, 65, 0, 768}, +{54, 0, 28, 0, 4, 0, 768}, +{55, 0, 64, 0, 0, 0, 1792}, +{45, 0, 66, 0, 0, 0, 512}, +{50, 0, 66, 0, 0, 0, 512}, +{54, 0, 28, 69, 0, 0, 512}, +{54, 0, 28, 69, 0, 0, 768}, +{45, 0, 65, 0, 0, 0, 512}, +{53, 0, 29, 0, 0, 0, 512}, +{55, 0, 65, 0, 0, 0, 1792}, +{50, 0, 65, 0, 0, 0, 512}, +{55, 0, 63, 0, 0, 0, 1792}, +{50, 0, 63, 0, 0, 0, 512}, +{45, 1, 68, 196, 0, 16, 256}, +{44, 0, 68, 0, 0, 0, 256}, +{44, 0, 68, 245, 0, 0, 256}, +{50, 0, 68, 33, 0, 212, 256}, +{50, 0, 68, 0, 0, 245, 256}, +{45, 3, 72, 196, 0, 16, 256}, +{44, 0, 72, 0, 0, 0, 256}, +{44, 0, 72, 245, 0, 0, 256}, +{50, 0, 72, 33, 0, 212, 256}, +{50, 0, 72, 0, 0, 245, 256}, +{44, 0, 68, 244, 0, 0, 256}, +{44, 0, 72, 244, 0, 0, 256}, +{56, 0, 72, 0, 0, 0, 257}, +{57, 0, 60, 0, 0, 0, 257}, +{56, 0, 72, 0, 0, 0, 260}, +{57, 0, 60, 0, 0, 0, 260}, +{56, 0, 72, 0, 0, 0, 256}, +{45, 0, 72, 0, 0, 0, 256}, +{45, 0, 69, 0, 0, 0, 256}, +{45, 0, 69, 0, 0, 0, 33024}, +{55, 0, 69, 0, 0, 0, 33024}, +{45, 0, 69, 64, 0, 0, 256}, +{56, 0, 61, 0, 0, 0, 256}, +{56, 0, 61, 0, 0, 0, 33024}, +{51, 0, 71, 0, 0, 0, 256}, +{58, 0, 69, 0, 0, 0, 33024}, +{55, 0, 54, 0, 0, 0, 33024}, +{54, 0, 0, 0, 0, 0, 3584}, +{54, 0, 0, 0, 0, 0, 256}, +{13, 0, 0, 0, 0, 0, 768}, +{55, 0, 24, 0, 0, 0, 3840}, +{54, 0, 0, 0, 0, 0, 3840}, +{54, 0, 24, 0, 0, 0, 3840}, +{54, 26, 24, 0, 0, 0, 3840}, +{59, 0, 0, 0, 0, 0, 256}, +{55, 0, 54, 0, 0, 0, 3072}, +{60, 83, 52, 0, 0, 0, 3328}, +{60, 83, 52, 0, 0, 0, 3072}, +{34, 87, 30, 0, 0, 0, 1280}, +{34, 87, 30, 0, 0, 0, 1536}, +{34, 85, 30, 0, 0, 0, 1280}, +{34, 86, 30, 0, 0, 0, 1536}, +{61, 91, 36, 0, 0, 0, 4096}, +{62, 34, 30, 0, 0, 0, 4096}, +{63, 55, 30, 0, 0, 0, 4096}, +{63, 57, 30, 0, 0, 0, 4096}, +{34, 30, 87, 0, 0, 0, 1280}, +{34, 30, 87, 0, 0, 0, 1536}, +{34, 30, 85, 0, 0, 0, 1280}, +{34, 30, 86, 0, 0, 0, 1536}, +{61, 36, 91, 0, 0, 0, 4096}, +{63, 30, 55, 0, 0, 0, 4096}, +{63, 30, 57, 0, 0, 0, 4096}, +{64, 86, 30, 0, 0, 0, 1280}, +{34, 57, 30, 0, 0, 0, 1536}, +{34, 86, 30, 0, 0, 0, 1792}, +{65, 34, 30, 0, 0, 0, 4096}, +{66, 34, 30, 0, 0, 0, 4096}, +{61, 90, 36, 0, 0, 0, 4096}, +{34, 30, 57, 0, 0, 0, 1280}, +{34, 30, 57, 0, 0, 0, 1536}, +{61, 30, 57, 0, 0, 0, 4096}, +{67, 87, 30, 0, 0, 0, 1280}, +{67, 87, 30, 0, 0, 0, 1536}, +{66, 40, 36, 0, 0, 0, 4096}, +{34, 87, 30, 0, 0, 0, 1792}, +{55, 0, 54, 0, 0, 0, 1280}, +{67, 83, 30, 0, 0, 0, 1280}, +{67, 83, 30, 0, 0, 0, 1536}, +{41, 76, 30, 0, 0, 0, 1280}, +{41, 76, 30, 0, 0, 0, 1536}, +{34, 30, 59, 0, 0, 0, 1280}, +{34, 30, 59, 0, 0, 0, 1536}, +{34, 30, 55, 0, 0, 0, 2816}, +{34, 30, 57, 0, 0, 0, 2816}, +{61, 36, 67, 0, 0, 0, 4096}, +{67, 86, 52, 0, 0, 0, 1280}, +{67, 87, 52, 0, 0, 0, 1536}, +{41, 85, 10, 0, 0, 0, 1280}, +{41, 86, 10, 0, 0, 0, 1536}, +{61, 88, 33, 0, 0, 0, 4096}, +{67, 85, 30, 69, 0, 0, 1280}, +{67, 86, 30, 0, 0, 0, 1536}, +{61, 85, 30, 0, 0, 0, 4096}, +{61, 86, 30, 0, 0, 0, 4096}, +{68, 31, 9, 0, 0, 0, 1280}, +{68, 31, 9, 0, 0, 0, 1536}, +{69, 36, 10, 0, 0, 0, 4096}, +{67, 85, 30, 0, 0, 0, 1280}, +{67, 85, 30, 0, 0, 0, 1536}, +{61, 92, 36, 0, 0, 0, 4096}, +{61, 91, 30, 0, 0, 0, 4096}, +{67, 82, 52, 0, 0, 0, 1024}, +{67, 83, 52, 0, 0, 0, 1024}, +{70, 76, 52, 0, 0, 0, 1024}, +{70, 76, 30, 0, 0, 0, 1536}, +{61, 73, 30, 0, 0, 0, 4096}, +{34, 83, 52, 0, 0, 0, 1024}, +{71, 83, 52, 0, 0, 0, 1280}, +{71, 87, 30, 0, 0, 0, 1536}, +{66, 87, 30, 0, 0, 0, 4096}, +{32, 0, 0, 0, 0, 0, 1024}, +{72, 0, 0, 0, 0, 0, 4096}, +{73, 10, 76, 0, 0, 0, 3584}, +{74, 48, 31, 0, 0, 0, 2816}, +{75, 31, 30, 0, 0, 0, 2816}, +{73, 76, 10, 0, 0, 0, 3584}, +{67, 31, 30, 0, 0, 0, 2816}, +{76, 31, 30, 0, 0, 0, 2816}, +{32, 86, 30, 0, 0, 0, 3584}, +{32, 30, 86, 0, 0, 0, 3584}, +{67, 87, 30, 0, 0, 0, 1792}, +{70, 52, 76, 0, 0, 0, 1024}, +{70, 30, 76, 0, 0, 0, 1536}, +{61, 30, 73, 0, 0, 0, 4096}, +{34, 52, 83, 0, 0, 0, 1024}, +{77, 0, 54, 0, 0, 0, 256}, +{78, 0, 62, 0, 0, 0, 256}, +{79, 0, 62, 0, 0, 0, 256}, +{80, 72, 8, 64, 0, 0, 2560}, +{81, 1, 72, 1, 0, 244, 256}, +{48, 1, 72, 1, 0, 244, 256}, +{67, 72, 8, 64, 0, 245, 256}, +{82, 72, 8, 0, 0, 0, 3584}, +{83, 72, 8, 65, 0, 180, 256}, +{84, 87, 30, 0, 0, 0, 1280}, +{84, 87, 30, 0, 0, 0, 1536}, +{84, 85, 30, 0, 0, 0, 1280}, +{84, 86, 30, 0, 0, 0, 1536}, +{85, 40, 36, 0, 0, 0, 4096}, +{85, 34, 30, 0, 0, 0, 4096}, +{71, 79, 52, 0, 0, 0, 1280}, +{71, 79, 30, 0, 0, 0, 1536}, +{86, 34, 30, 0, 0, 0, 4096}, +{87, 53, 9, 0, 0, 0, 1280}, +{71, 31, 9, 0, 0, 0, 1536}, +{88, 30, 10, 0, 0, 0, 4096}, +{71, 87, 30, 0, 0, 0, 1280}, +{86, 40, 36, 0, 0, 0, 4096}, +{89, 0, 58, 64, 0, 0, 256}, +{55, 0, 57, 0, 0, 0, 3584}, +{68, 53, 30, 0, 0, 0, 1536}, +{68, 31, 52, 0, 0, 0, 1536}, +{61, 30, 86, 0, 0, 0, 4096}, +{76, 53, 9, 0, 0, 0, 1280}, +{76, 31, 9, 0, 0, 0, 1536}, +{69, 30, 10, 0, 0, 0, 4096}, +{67, 83, 52, 0, 0, 0, 1280}, +{34, 52, 57, 0, 0, 0, 1280}, +{67, 54, 30, 0, 0, 0, 1792}, +{61, 67, 36, 0, 0, 0, 4096}, +{67, 83, 52, 0, 0, 0, 1536}, +{76, 53, 52, 0, 0, 0, 1280}, +{76, 31, 30, 0, 0, 0, 1536}, +{90, 31, 30, 0, 0, 0, 4096}, +{50, 0, 54, 0, 0, 0, 512}, +{91, 0, 54, 0, 0, 0, 512}, +{91, 0, 63, 0, 0, 0, 512}, +{92, 0, 0, 0, 0, 0, 512}, +{93, 0, 12, 0, 0, 0, 512}, +{94, 0, 12, 0, 0, 0, 512}, +{67, 83, 52, 0, 0, 0, 2048}, +{67, 87, 30, 0, 0, 0, 2048}, +{71, 87, 30, 0, 0, 0, 2304}, +{67, 87, 30, 0, 0, 0, 2560}, +{61, 55, 36, 0, 0, 0, 4096}, +{61, 57, 38, 0, 0, 0, 4096}, +{61, 59, 38, 0, 0, 0, 4096}, +{61, 87, 30, 0, 0, 0, 4096}, +{67, 86, 30, 0, 0, 0, 2304}, +{67, 85, 30, 0, 0, 0, 2304}, +{67, 84, 30, 0, 0, 0, 2304}, +{61, 84, 30, 0, 0, 0, 4096}, +{67, 87, 30, 0, 0, 0, 2304}, +{34, 59, 30, 0, 0, 0, 2304}, +{61, 59, 30, 0, 0, 0, 4096}, +{66, 40, 67, 0, 0, 0, 4096}, +{73, 59, 10, 0, 0, 0, 3584}, +{66, 40, 36, 0, 0, 0, 4352}, +{66, 34, 30, 0, 0, 0, 4352}, +{67, 87, 30, 0, 0, 0, 4864}, +{61, 87, 30, 0, 0, 0, 4864}, +{66, 34, 30, 0, 0, 0, 4864}, +{34, 72, 8, 0, 0, 0, 256}, +{34, 68, 10, 0, 0, 0, 2560}, +{34, 8, 72, 0, 0, 0, 256}, +{34, 72, 10, 0, 0, 0, 2560}, +{66, 91, 36, 0, 0, 0, 4096}, +{86, 39, 38, 0, 0, 0, 4096}, +{71, 85, 30, 0, 0, 0, 2304}, +{71, 86, 30, 0, 0, 0, 2304}, +{71, 83, 52, 0, 0, 0, 2048}, +{71, 87, 30, 0, 0, 0, 2048}, +{71, 30, 74, 0, 0, 0, 2304}, +{88, 30, 80, 0, 0, 0, 4096}, +{71, 30, 75, 0, 0, 0, 2304}, +{88, 30, 81, 0, 0, 0, 4096}, +{95, 30, 76, 0, 0, 0, 2304}, +{66, 30, 73, 0, 0, 0, 4096}, +{71, 30, 76, 0, 0, 0, 2304}, +{66, 30, 70, 0, 0, 0, 4096}, +{66, 38, 87, 0, 0, 0, 4096}, +{71, 78, 30, 0, 0, 0, 2304}, +{95, 76, 30, 0, 0, 0, 2304}, +{71, 87, 30, 0, 0, 0, 4608}, +{86, 34, 30, 0, 0, 0, 4608}, +{71, 87, 30, 0, 0, 0, 2560}, +{71, 87, 30, 0, 0, 0, 4864}, +{66, 87, 30, 0, 0, 0, 4864}, +{96, 1, 53, 0, 0, 0, 1024}, +{55, 1, 31, 0, 0, 0, 1536}, +{97, 31, 34, 0, 0, 0, 4096}, +{98, 0, 10, 0, 0, 0, 3584}, +{55, 0, 55, 0, 0, 0, 256}, +{63, 0, 55, 0, 0, 0, 4096}, +{55, 0, 54, 0, 0, 0, 3584}, +{99, 70, 10, 0, 0, 0, 256}, +{98, 0, 72, 0, 0, 0, 256}, +{100, 83, 52, 0, 0, 0, 3072} +}; + +uint16_t CmpMnemonicOffsets[8] = { +0, 9, 18, 27, 39, 49, 59, 69 +}; +uint16_t VCmpMnemonicOffsets[32] = { +0, 10, 20, 30, 43, 54, 65, 76, 87, 100, 111, 122, 135, 149, 159, 169, 181, 194, 207, 220, 235, 249, 263, 277, 290, 303, 317, 331, 347, 361, 374, 387 +}; \ No newline at end of file diff --git a/NativeCore/Dependencies/distorm/src/insts.h b/NativeCore/Dependencies/distorm/src/insts.h new file mode 100644 index 00000000..675ecf96 --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/insts.h @@ -0,0 +1,64 @@ +/* +insts.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef INSTS_H +#define INSTS_H + +#include "instructions.h" + + +/* Flags Table */ +extern _iflags FlagsTable[]; + +/* Root Trie DB */ +extern _InstSharedInfo InstSharedInfoTable[]; +extern _InstInfo InstInfos[]; +extern _InstInfoEx InstInfosEx[]; +extern _InstNode InstructionsTree[]; + +/* 3DNow! Trie DB */ +extern _InstNode Table_0F_0F; +/* AVX related: */ +extern _InstNode Table_0F, Table_0F_38, Table_0F_3A; + +/* + * The inst_lookup will return on of these two instructions according to the specified decoding mode. + * ARPL or MOVSXD on 64 bits is one byte instruction at index 0x63. + */ +extern _InstInfo II_MOVSXD; + +/* + * The NOP instruction can be prefixed by REX in 64bits, therefore we have to decide in runtime whether it's an XCHG or NOP instruction. + * If 0x90 is prefixed by a usable REX it will become XCHG, otherwise it will become a NOP. + * Also note that if it's prefixed by 0xf3, it becomes a Pause. + */ +extern _InstInfo II_NOP; +extern _InstInfo II_PAUSE; + +/* + * RDRAND and VMPTRLD share same 2.3 bytes opcode, and then alternates on the MOD bits, + * RDRAND is OT_FULL_REG while VMPTRLD is OT_MEM, and there's no such mixed type. + * So a hack into the inst_lookup was added for this decision, the DB isn't flexible enough. :( + */ +extern _InstInfo II_RDRAND; + +/* + * Used for letting the extract operand know the type of operands without knowing the + * instruction itself yet, because of the way those instructions work. + * See function instructions.c!inst_lookup_3dnow. + */ +extern _InstInfo II_3DNOW; + +/* Helper tables for pseudo compare mnemonics. */ +extern uint16_t CmpMnemonicOffsets[8]; /* SSE */ +extern uint16_t VCmpMnemonicOffsets[32]; /* AVX */ + +#endif /* INSTS_H */ diff --git a/NativeCore/Dependencies/distorm/src/mnemonics.c b/NativeCore/Dependencies/distorm/src/mnemonics.c new file mode 100644 index 00000000..91be7a8e --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/mnemonics.c @@ -0,0 +1,315 @@ +/* +mnemonics.c + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#include "../include/mnemonics.h" + +#ifndef DISTORM_LIGHT + +const unsigned char _MNEMONICS[] = +"\x09" "undefined\0" "\x03" "add\0" "\x04" "push\0" "\x03" "pop\0" \ +"\x02" "or\0" "\x03" "adc\0" "\x03" "sbb\0" "\x03" "and\0" "\x03" "daa\0" \ +"\x03" "sub\0" "\x03" "das\0" "\x03" "xor\0" "\x03" "aaa\0" "\x03" "cmp\0" \ +"\x03" "aas\0" "\x03" "inc\0" "\x03" "dec\0" "\x05" "pusha\0" "\x04" "popa\0" \ +"\x05" "bound\0" "\x04" "arpl\0" "\x04" "imul\0" "\x03" "ins\0" "\x04" "outs\0" \ +"\x02" "jo\0" "\x03" "jno\0" "\x02" "jb\0" "\x03" "jae\0" "\x02" "jz\0" \ +"\x03" "jnz\0" "\x03" "jbe\0" "\x02" "ja\0" "\x02" "js\0" "\x03" "jns\0" \ +"\x02" "jp\0" "\x03" "jnp\0" "\x02" "jl\0" "\x03" "jge\0" "\x03" "jle\0" \ +"\x02" "jg\0" "\x04" "test\0" "\x04" "xchg\0" "\x03" "mov\0" "\x03" "lea\0" \ +"\x03" "cbw\0" "\x04" "cwde\0" "\x04" "cdqe\0" "\x03" "cwd\0" "\x03" "cdq\0" \ +"\x03" "cqo\0" "\x08" "call far\0" "\x05" "pushf\0" "\x04" "popf\0" \ +"\x04" "sahf\0" "\x04" "lahf\0" "\x04" "movs\0" "\x04" "cmps\0" "\x04" "stos\0" \ +"\x04" "lods\0" "\x04" "scas\0" "\x03" "ret\0" "\x03" "les\0" "\x03" "lds\0" \ +"\x05" "enter\0" "\x05" "leave\0" "\x04" "retf\0" "\x04" "int3\0" "\x03" "int\0" \ +"\x04" "into\0" "\x04" "iret\0" "\x03" "aam\0" "\x03" "aad\0" "\x04" "salc\0" \ +"\x04" "xlat\0" "\x06" "loopnz\0" "\x05" "loopz\0" "\x04" "loop\0" \ +"\x04" "jcxz\0" "\x05" "jecxz\0" "\x05" "jrcxz\0" "\x02" "in\0" "\x03" "out\0" \ +"\x04" "call\0" "\x03" "jmp\0" "\x07" "jmp far\0" "\x04" "int1\0" "\x03" "hlt\0" \ +"\x03" "cmc\0" "\x03" "clc\0" "\x03" "stc\0" "\x03" "cli\0" "\x03" "sti\0" \ +"\x03" "cld\0" "\x03" "std\0" "\x03" "lar\0" "\x03" "lsl\0" "\x07" "syscall\0" \ +"\x04" "clts\0" "\x06" "sysret\0" "\x04" "invd\0" "\x06" "wbinvd\0" \ +"\x03" "ud2\0" "\x05" "femms\0" "\x03" "nop\0" "\x05" "wrmsr\0" "\x05" "rdtsc\0" \ +"\x05" "rdmsr\0" "\x05" "rdpmc\0" "\x08" "sysenter\0" "\x07" "sysexit\0" \ +"\x06" "getsec\0" "\x05" "cmovo\0" "\x06" "cmovno\0" "\x05" "cmovb\0" \ +"\x06" "cmovae\0" "\x05" "cmovz\0" "\x06" "cmovnz\0" "\x06" "cmovbe\0" \ +"\x05" "cmova\0" "\x05" "cmovs\0" "\x06" "cmovns\0" "\x05" "cmovp\0" \ +"\x06" "cmovnp\0" "\x05" "cmovl\0" "\x06" "cmovge\0" "\x06" "cmovle\0" \ +"\x05" "cmovg\0" "\x04" "seto\0" "\x05" "setno\0" "\x04" "setb\0" "\x05" "setae\0" \ +"\x04" "setz\0" "\x05" "setnz\0" "\x05" "setbe\0" "\x04" "seta\0" "\x04" "sets\0" \ +"\x05" "setns\0" "\x04" "setp\0" "\x05" "setnp\0" "\x04" "setl\0" "\x05" "setge\0" \ +"\x05" "setle\0" "\x04" "setg\0" "\x05" "cpuid\0" "\x02" "bt\0" "\x04" "shld\0" \ +"\x03" "rsm\0" "\x03" "bts\0" "\x04" "shrd\0" "\x07" "cmpxchg\0" "\x03" "lss\0" \ +"\x03" "btr\0" "\x03" "lfs\0" "\x03" "lgs\0" "\x05" "movzx\0" "\x03" "btc\0" \ +"\x05" "movsx\0" "\x04" "xadd\0" "\x06" "movnti\0" "\x05" "bswap\0" \ +"\x03" "rol\0" "\x03" "ror\0" "\x03" "rcl\0" "\x03" "rcr\0" "\x03" "shl\0" \ +"\x03" "shr\0" "\x03" "sal\0" "\x03" "sar\0" "\x06" "xabort\0" "\x06" "xbegin\0" \ +"\x04" "fadd\0" "\x04" "fmul\0" "\x04" "fcom\0" "\x05" "fcomp\0" "\x04" "fsub\0" \ +"\x05" "fsubr\0" "\x04" "fdiv\0" "\x05" "fdivr\0" "\x03" "fld\0" "\x03" "fst\0" \ +"\x04" "fstp\0" "\x06" "fldenv\0" "\x05" "fldcw\0" "\x04" "fxch\0" \ +"\x04" "fnop\0" "\x04" "fchs\0" "\x04" "fabs\0" "\x04" "ftst\0" "\x04" "fxam\0" \ +"\x04" "fld1\0" "\x06" "fldl2t\0" "\x06" "fldl2e\0" "\x05" "fldpi\0" \ +"\x06" "fldlg2\0" "\x06" "fldln2\0" "\x04" "fldz\0" "\x05" "f2xm1\0" \ +"\x05" "fyl2x\0" "\x05" "fptan\0" "\x06" "fpatan\0" "\x07" "fxtract\0" \ +"\x06" "fprem1\0" "\x07" "fdecstp\0" "\x07" "fincstp\0" "\x05" "fprem\0" \ +"\x07" "fyl2xp1\0" "\x05" "fsqrt\0" "\x07" "fsincos\0" "\x07" "frndint\0" \ +"\x06" "fscale\0" "\x04" "fsin\0" "\x04" "fcos\0" "\x05" "fiadd\0" \ +"\x05" "fimul\0" "\x05" "ficom\0" "\x06" "ficomp\0" "\x05" "fisub\0" \ +"\x06" "fisubr\0" "\x05" "fidiv\0" "\x06" "fidivr\0" "\x06" "fcmovb\0" \ +"\x06" "fcmove\0" "\x07" "fcmovbe\0" "\x06" "fcmovu\0" "\x07" "fucompp\0" \ +"\x04" "fild\0" "\x06" "fisttp\0" "\x04" "fist\0" "\x05" "fistp\0" \ +"\x07" "fcmovnb\0" "\x07" "fcmovne\0" "\x08" "fcmovnbe\0" "\x07" "fcmovnu\0" \ +"\x04" "feni\0" "\x06" "fedisi\0" "\x06" "fsetpm\0" "\x06" "fucomi\0" \ +"\x05" "fcomi\0" "\x06" "frstor\0" "\x05" "ffree\0" "\x05" "fucom\0" \ +"\x06" "fucomp\0" "\x05" "faddp\0" "\x05" "fmulp\0" "\x06" "fcompp\0" \ +"\x06" "fsubrp\0" "\x05" "fsubp\0" "\x06" "fdivrp\0" "\x05" "fdivp\0" \ +"\x04" "fbld\0" "\x05" "fbstp\0" "\x07" "fucomip\0" "\x06" "fcomip\0" \ +"\x03" "not\0" "\x03" "neg\0" "\x03" "mul\0" "\x03" "div\0" "\x04" "idiv\0" \ +"\x04" "sldt\0" "\x03" "str\0" "\x04" "lldt\0" "\x03" "ltr\0" "\x04" "verr\0" \ +"\x04" "verw\0" "\x04" "sgdt\0" "\x04" "sidt\0" "\x04" "lgdt\0" "\x04" "lidt\0" \ +"\x04" "smsw\0" "\x04" "lmsw\0" "\x06" "invlpg\0" "\x06" "vmcall\0" \ +"\x08" "vmlaunch\0" "\x08" "vmresume\0" "\x06" "vmxoff\0" "\x07" "monitor\0" \ +"\x05" "mwait\0" "\x04" "clac\0" "\x04" "stac\0" "\x06" "xgetbv\0" \ +"\x06" "xsetbv\0" "\x06" "vmfunc\0" "\x04" "xend\0" "\x05" "vmrun\0" \ +"\x07" "vmmcall\0" "\x06" "vmload\0" "\x06" "vmsave\0" "\x04" "stgi\0" \ +"\x04" "clgi\0" "\x06" "skinit\0" "\x07" "invlpga\0" "\x06" "swapgs\0" \ +"\x06" "rdtscp\0" "\x08" "prefetch\0" "\x09" "prefetchw\0" "\x05" "pi2fw\0" \ +"\x05" "pi2fd\0" "\x05" "pf2iw\0" "\x05" "pf2id\0" "\x06" "pfnacc\0" \ +"\x07" "pfpnacc\0" "\x07" "pfcmpge\0" "\x05" "pfmin\0" "\x05" "pfrcp\0" \ +"\x07" "pfrsqrt\0" "\x05" "pfsub\0" "\x05" "pfadd\0" "\x07" "pfcmpgt\0" \ +"\x05" "pfmax\0" "\x08" "pfrcpit1\0" "\x08" "pfrsqit1\0" "\x06" "pfsubr\0" \ +"\x05" "pfacc\0" "\x07" "pfcmpeq\0" "\x05" "pfmul\0" "\x08" "pfrcpit2\0" \ +"\x07" "pmulhrw\0" "\x06" "pswapd\0" "\x07" "pavgusb\0" "\x06" "movups\0" \ +"\x06" "movupd\0" "\x05" "movss\0" "\x05" "movsd\0" "\x07" "vmovups\0" \ +"\x07" "vmovupd\0" "\x06" "vmovss\0" "\x06" "vmovsd\0" "\x07" "movhlps\0" \ +"\x06" "movlps\0" "\x06" "movlpd\0" "\x08" "movsldup\0" "\x07" "movddup\0" \ +"\x08" "vmovhlps\0" "\x07" "vmovlps\0" "\x07" "vmovlpd\0" "\x09" "vmovsldup\0" \ +"\x08" "vmovddup\0" "\x08" "unpcklps\0" "\x08" "unpcklpd\0" "\x09" "vunpcklps\0" \ +"\x09" "vunpcklpd\0" "\x08" "unpckhps\0" "\x08" "unpckhpd\0" "\x09" "vunpckhps\0" \ +"\x09" "vunpckhpd\0" "\x07" "movlhps\0" "\x06" "movhps\0" "\x06" "movhpd\0" \ +"\x08" "movshdup\0" "\x08" "vmovlhps\0" "\x07" "vmovhps\0" "\x07" "vmovhpd\0" \ +"\x09" "vmovshdup\0" "\x0b" "prefetchnta\0" "\x0a" "prefetcht0\0" "\x0a" "prefetcht1\0" \ +"\x0a" "prefetcht2\0" "\x06" "movaps\0" "\x06" "movapd\0" "\x07" "vmovaps\0" \ +"\x07" "vmovapd\0" "\x08" "cvtpi2ps\0" "\x08" "cvtpi2pd\0" "\x08" "cvtsi2ss\0" \ +"\x08" "cvtsi2sd\0" "\x09" "vcvtsi2ss\0" "\x09" "vcvtsi2sd\0" "\x07" "movntps\0" \ +"\x07" "movntpd\0" "\x07" "movntss\0" "\x07" "movntsd\0" "\x08" "vmovntps\0" \ +"\x08" "vmovntpd\0" "\x09" "cvttps2pi\0" "\x09" "cvttpd2pi\0" "\x09" "cvttss2si\0" \ +"\x09" "cvttsd2si\0" "\x0a" "vcvttss2si\0" "\x0a" "vcvttsd2si\0" "\x08" "cvtps2pi\0" \ +"\x08" "cvtpd2pi\0" "\x08" "cvtss2si\0" "\x08" "cvtsd2si\0" "\x09" "vcvtss2si\0" \ +"\x09" "vcvtsd2si\0" "\x07" "ucomiss\0" "\x07" "ucomisd\0" "\x08" "vucomiss\0" \ +"\x08" "vucomisd\0" "\x06" "comiss\0" "\x06" "comisd\0" "\x07" "vcomiss\0" \ +"\x07" "vcomisd\0" "\x08" "movmskps\0" "\x08" "movmskpd\0" "\x09" "vmovmskps\0" \ +"\x09" "vmovmskpd\0" "\x06" "sqrtps\0" "\x06" "sqrtpd\0" "\x06" "sqrtss\0" \ +"\x06" "sqrtsd\0" "\x07" "vsqrtps\0" "\x07" "vsqrtpd\0" "\x07" "vsqrtss\0" \ +"\x07" "vsqrtsd\0" "\x07" "rsqrtps\0" "\x07" "rsqrtss\0" "\x08" "vrsqrtps\0" \ +"\x08" "vrsqrtss\0" "\x05" "rcpps\0" "\x05" "rcpss\0" "\x06" "vrcpps\0" \ +"\x06" "vrcpss\0" "\x05" "andps\0" "\x05" "andpd\0" "\x06" "vandps\0" \ +"\x06" "vandpd\0" "\x06" "andnps\0" "\x06" "andnpd\0" "\x07" "vandnps\0" \ +"\x07" "vandnpd\0" "\x04" "orps\0" "\x04" "orpd\0" "\x05" "vorps\0" \ +"\x05" "vorpd\0" "\x05" "xorps\0" "\x05" "xorpd\0" "\x06" "vxorps\0" \ +"\x06" "vxorpd\0" "\x05" "addps\0" "\x05" "addpd\0" "\x05" "addss\0" \ +"\x05" "addsd\0" "\x06" "vaddps\0" "\x06" "vaddpd\0" "\x06" "vaddss\0" \ +"\x06" "vaddsd\0" "\x05" "mulps\0" "\x05" "mulpd\0" "\x05" "mulss\0" \ +"\x05" "mulsd\0" "\x06" "vmulps\0" "\x06" "vmulpd\0" "\x06" "vmulss\0" \ +"\x06" "vmulsd\0" "\x08" "cvtps2pd\0" "\x08" "cvtpd2ps\0" "\x08" "cvtss2sd\0" \ +"\x08" "cvtsd2ss\0" "\x09" "vcvtps2pd\0" "\x09" "vcvtpd2ps\0" "\x09" "vcvtss2sd\0" \ +"\x09" "vcvtsd2ss\0" "\x08" "cvtdq2ps\0" "\x08" "cvtps2dq\0" "\x09" "cvttps2dq\0" \ +"\x09" "vcvtdq2ps\0" "\x09" "vcvtps2dq\0" "\x0a" "vcvttps2dq\0" "\x05" "subps\0" \ +"\x05" "subpd\0" "\x05" "subss\0" "\x05" "subsd\0" "\x06" "vsubps\0" \ +"\x06" "vsubpd\0" "\x06" "vsubss\0" "\x06" "vsubsd\0" "\x05" "minps\0" \ +"\x05" "minpd\0" "\x05" "minss\0" "\x05" "minsd\0" "\x06" "vminps\0" \ +"\x06" "vminpd\0" "\x06" "vminss\0" "\x06" "vminsd\0" "\x05" "divps\0" \ +"\x05" "divpd\0" "\x05" "divss\0" "\x05" "divsd\0" "\x06" "vdivps\0" \ +"\x06" "vdivpd\0" "\x06" "vdivss\0" "\x06" "vdivsd\0" "\x05" "maxps\0" \ +"\x05" "maxpd\0" "\x05" "maxss\0" "\x05" "maxsd\0" "\x06" "vmaxps\0" \ +"\x06" "vmaxpd\0" "\x06" "vmaxss\0" "\x06" "vmaxsd\0" "\x09" "punpcklbw\0" \ +"\x0a" "vpunpcklbw\0" "\x09" "punpcklwd\0" "\x0a" "vpunpcklwd\0" "\x09" "punpckldq\0" \ +"\x0a" "vpunpckldq\0" "\x08" "packsswb\0" "\x09" "vpacksswb\0" "\x07" "pcmpgtb\0" \ +"\x08" "vpcmpgtb\0" "\x07" "pcmpgtw\0" "\x08" "vpcmpgtw\0" "\x07" "pcmpgtd\0" \ +"\x08" "vpcmpgtd\0" "\x08" "packuswb\0" "\x09" "vpackuswb\0" "\x09" "punpckhbw\0" \ +"\x0a" "vpunpckhbw\0" "\x09" "punpckhwd\0" "\x0a" "vpunpckhwd\0" "\x09" "punpckhdq\0" \ +"\x0a" "vpunpckhdq\0" "\x08" "packssdw\0" "\x09" "vpackssdw\0" "\x0a" "punpcklqdq\0" \ +"\x0b" "vpunpcklqdq\0" "\x0a" "punpckhqdq\0" "\x0b" "vpunpckhqdq\0" "\x04" "movd\0" \ +"\x04" "movq\0" "\x05" "vmovd\0" "\x05" "vmovq\0" "\x06" "movdqa\0" \ +"\x06" "movdqu\0" "\x07" "vmovdqa\0" "\x07" "vmovdqu\0" "\x06" "pshufw\0" \ +"\x06" "pshufd\0" "\x07" "pshufhw\0" "\x07" "pshuflw\0" "\x07" "vpshufd\0" \ +"\x08" "vpshufhw\0" "\x08" "vpshuflw\0" "\x07" "pcmpeqb\0" "\x08" "vpcmpeqb\0" \ +"\x07" "pcmpeqw\0" "\x08" "vpcmpeqw\0" "\x07" "pcmpeqd\0" "\x08" "vpcmpeqd\0" \ +"\x04" "emms\0" "\x0a" "vzeroupper\0" "\x08" "vzeroall\0" "\x06" "vmread\0" \ +"\x05" "extrq\0" "\x07" "insertq\0" "\x07" "vmwrite\0" "\x08" "cvtph2ps\0" \ +"\x08" "cvtps2ph\0" "\x06" "haddpd\0" "\x06" "haddps\0" "\x07" "vhaddpd\0" \ +"\x07" "vhaddps\0" "\x06" "hsubpd\0" "\x06" "hsubps\0" "\x07" "vhsubpd\0" \ +"\x07" "vhsubps\0" "\x05" "xsave\0" "\x07" "xsave64\0" "\x06" "lfence\0" \ +"\x06" "xrstor\0" "\x08" "xrstor64\0" "\x06" "mfence\0" "\x08" "xsaveopt\0" \ +"\x0a" "xsaveopt64\0" "\x06" "sfence\0" "\x07" "clflush\0" "\x06" "popcnt\0" \ +"\x03" "bsf\0" "\x05" "tzcnt\0" "\x03" "bsr\0" "\x05" "lzcnt\0" "\x07" "cmpeqps\0" \ +"\x07" "cmpltps\0" "\x07" "cmpleps\0" "\x0a" "cmpunordps\0" "\x08" "cmpneqps\0" \ +"\x08" "cmpnltps\0" "\x08" "cmpnleps\0" "\x08" "cmpordps\0" "\x07" "cmpeqpd\0" \ +"\x07" "cmpltpd\0" "\x07" "cmplepd\0" "\x0a" "cmpunordpd\0" "\x08" "cmpneqpd\0" \ +"\x08" "cmpnltpd\0" "\x08" "cmpnlepd\0" "\x08" "cmpordpd\0" "\x07" "cmpeqss\0" \ +"\x07" "cmpltss\0" "\x07" "cmpless\0" "\x0a" "cmpunordss\0" "\x08" "cmpneqss\0" \ +"\x08" "cmpnltss\0" "\x08" "cmpnless\0" "\x08" "cmpordss\0" "\x07" "cmpeqsd\0" \ +"\x07" "cmpltsd\0" "\x07" "cmplesd\0" "\x0a" "cmpunordsd\0" "\x08" "cmpneqsd\0" \ +"\x08" "cmpnltsd\0" "\x08" "cmpnlesd\0" "\x08" "cmpordsd\0" "\x08" "vcmpeqps\0" \ +"\x08" "vcmpltps\0" "\x08" "vcmpleps\0" "\x0b" "vcmpunordps\0" "\x09" "vcmpneqps\0" \ +"\x09" "vcmpnltps\0" "\x09" "vcmpnleps\0" "\x09" "vcmpordps\0" "\x0b" "vcmpeq_uqps\0" \ +"\x09" "vcmpngeps\0" "\x09" "vcmpngtps\0" "\x0b" "vcmpfalseps\0" "\x0c" "vcmpneq_oqps\0" \ +"\x08" "vcmpgeps\0" "\x08" "vcmpgtps\0" "\x0a" "vcmptrueps\0" "\x0b" "vcmpeq_osps\0" \ +"\x0b" "vcmplt_oqps\0" "\x0b" "vcmple_oqps\0" "\x0d" "vcmpunord_sps\0" \ +"\x0c" "vcmpneq_usps\0" "\x0c" "vcmpnlt_uqps\0" "\x0c" "vcmpnle_uqps\0" \ +"\x0b" "vcmpord_sps\0" "\x0b" "vcmpeq_usps\0" "\x0c" "vcmpnge_uqps\0" \ +"\x0c" "vcmpngt_uqps\0" "\x0e" "vcmpfalse_osps\0" "\x0c" "vcmpneq_osps\0" \ +"\x0b" "vcmpge_oqps\0" "\x0b" "vcmpgt_oqps\0" "\x0d" "vcmptrue_usps\0" \ +"\x08" "vcmpeqpd\0" "\x08" "vcmpltpd\0" "\x08" "vcmplepd\0" "\x0b" "vcmpunordpd\0" \ +"\x09" "vcmpneqpd\0" "\x09" "vcmpnltpd\0" "\x09" "vcmpnlepd\0" "\x09" "vcmpordpd\0" \ +"\x0b" "vcmpeq_uqpd\0" "\x09" "vcmpngepd\0" "\x09" "vcmpngtpd\0" "\x0b" "vcmpfalsepd\0" \ +"\x0c" "vcmpneq_oqpd\0" "\x08" "vcmpgepd\0" "\x08" "vcmpgtpd\0" "\x0a" "vcmptruepd\0" \ +"\x0b" "vcmpeq_ospd\0" "\x0b" "vcmplt_oqpd\0" "\x0b" "vcmple_oqpd\0" \ +"\x0d" "vcmpunord_spd\0" "\x0c" "vcmpneq_uspd\0" "\x0c" "vcmpnlt_uqpd\0" \ +"\x0c" "vcmpnle_uqpd\0" "\x0b" "vcmpord_spd\0" "\x0b" "vcmpeq_uspd\0" \ +"\x0c" "vcmpnge_uqpd\0" "\x0c" "vcmpngt_uqpd\0" "\x0e" "vcmpfalse_ospd\0" \ +"\x0c" "vcmpneq_ospd\0" "\x0b" "vcmpge_oqpd\0" "\x0b" "vcmpgt_oqpd\0" \ +"\x0d" "vcmptrue_uspd\0" "\x08" "vcmpeqss\0" "\x08" "vcmpltss\0" "\x08" "vcmpless\0" \ +"\x0b" "vcmpunordss\0" "\x09" "vcmpneqss\0" "\x09" "vcmpnltss\0" "\x09" "vcmpnless\0" \ +"\x09" "vcmpordss\0" "\x0b" "vcmpeq_uqss\0" "\x09" "vcmpngess\0" "\x09" "vcmpngtss\0" \ +"\x0b" "vcmpfalsess\0" "\x0c" "vcmpneq_oqss\0" "\x08" "vcmpgess\0" "\x08" "vcmpgtss\0" \ +"\x0a" "vcmptruess\0" "\x0b" "vcmpeq_osss\0" "\x0b" "vcmplt_oqss\0" "\x0b" "vcmple_oqss\0" \ +"\x0d" "vcmpunord_sss\0" "\x0c" "vcmpneq_usss\0" "\x0c" "vcmpnlt_uqss\0" \ +"\x0c" "vcmpnle_uqss\0" "\x0b" "vcmpord_sss\0" "\x0b" "vcmpeq_usss\0" \ +"\x0c" "vcmpnge_uqss\0" "\x0c" "vcmpngt_uqss\0" "\x0e" "vcmpfalse_osss\0" \ +"\x0c" "vcmpneq_osss\0" "\x0b" "vcmpge_oqss\0" "\x0b" "vcmpgt_oqss\0" \ +"\x0d" "vcmptrue_usss\0" "\x08" "vcmpeqsd\0" "\x08" "vcmpltsd\0" "\x08" "vcmplesd\0" \ +"\x0b" "vcmpunordsd\0" "\x09" "vcmpneqsd\0" "\x09" "vcmpnltsd\0" "\x09" "vcmpnlesd\0" \ +"\x09" "vcmpordsd\0" "\x0b" "vcmpeq_uqsd\0" "\x09" "vcmpngesd\0" "\x09" "vcmpngtsd\0" \ +"\x0b" "vcmpfalsesd\0" "\x0c" "vcmpneq_oqsd\0" "\x08" "vcmpgesd\0" "\x08" "vcmpgtsd\0" \ +"\x0a" "vcmptruesd\0" "\x0b" "vcmpeq_ossd\0" "\x0b" "vcmplt_oqsd\0" "\x0b" "vcmple_oqsd\0" \ +"\x0d" "vcmpunord_ssd\0" "\x0c" "vcmpneq_ussd\0" "\x0c" "vcmpnlt_uqsd\0" \ +"\x0c" "vcmpnle_uqsd\0" "\x0b" "vcmpord_ssd\0" "\x0b" "vcmpeq_ussd\0" \ +"\x0c" "vcmpnge_uqsd\0" "\x0c" "vcmpngt_uqsd\0" "\x0e" "vcmpfalse_ossd\0" \ +"\x0c" "vcmpneq_ossd\0" "\x0b" "vcmpge_oqsd\0" "\x0b" "vcmpgt_oqsd\0" \ +"\x0d" "vcmptrue_ussd\0" "\x06" "pinsrw\0" "\x07" "vpinsrw\0" "\x06" "pextrw\0" \ +"\x07" "vpextrw\0" "\x06" "shufps\0" "\x06" "shufpd\0" "\x07" "vshufps\0" \ +"\x07" "vshufpd\0" "\x09" "cmpxchg8b\0" "\x0a" "cmpxchg16b\0" "\x07" "vmptrst\0" \ +"\x08" "addsubpd\0" "\x08" "addsubps\0" "\x09" "vaddsubpd\0" "\x09" "vaddsubps\0" \ +"\x05" "psrlw\0" "\x06" "vpsrlw\0" "\x05" "psrld\0" "\x06" "vpsrld\0" \ +"\x05" "psrlq\0" "\x06" "vpsrlq\0" "\x05" "paddq\0" "\x06" "vpaddq\0" \ +"\x06" "pmullw\0" "\x07" "vpmullw\0" "\x07" "movq2dq\0" "\x07" "movdq2q\0" \ +"\x08" "pmovmskb\0" "\x09" "vpmovmskb\0" "\x07" "psubusb\0" "\x08" "vpsubusb\0" \ +"\x07" "psubusw\0" "\x08" "vpsubusw\0" "\x06" "pminub\0" "\x07" "vpminub\0" \ +"\x04" "pand\0" "\x05" "vpand\0" "\x07" "paddusb\0" "\x08" "vpaddusw\0" \ +"\x07" "paddusw\0" "\x06" "pmaxub\0" "\x07" "vpmaxub\0" "\x05" "pandn\0" \ +"\x06" "vpandn\0" "\x05" "pavgb\0" "\x06" "vpavgb\0" "\x05" "psraw\0" \ +"\x06" "vpsraw\0" "\x05" "psrad\0" "\x06" "vpsrad\0" "\x05" "pavgw\0" \ +"\x06" "vpavgw\0" "\x07" "pmulhuw\0" "\x08" "vpmulhuw\0" "\x06" "pmulhw\0" \ +"\x07" "vpmulhw\0" "\x09" "cvttpd2dq\0" "\x08" "cvtdq2pd\0" "\x08" "cvtpd2dq\0" \ +"\x0a" "vcvttpd2dq\0" "\x09" "vcvtdq2pd\0" "\x09" "vcvtpd2dq\0" "\x06" "movntq\0" \ +"\x07" "movntdq\0" "\x08" "vmovntdq\0" "\x06" "psubsb\0" "\x07" "vpsubsb\0" \ +"\x06" "psubsw\0" "\x07" "vpsubsw\0" "\x06" "pminsw\0" "\x07" "vpminsw\0" \ +"\x03" "por\0" "\x04" "vpor\0" "\x06" "paddsb\0" "\x07" "vpaddsb\0" \ +"\x06" "paddsw\0" "\x07" "vpaddsw\0" "\x06" "pmaxsw\0" "\x07" "vpmaxsw\0" \ +"\x04" "pxor\0" "\x05" "vpxor\0" "\x05" "lddqu\0" "\x06" "vlddqu\0" \ +"\x05" "psllw\0" "\x06" "vpsllw\0" "\x05" "pslld\0" "\x06" "vpslld\0" \ +"\x05" "psllq\0" "\x06" "vpsllq\0" "\x07" "pmuludq\0" "\x08" "vpmuludq\0" \ +"\x07" "pmaddwd\0" "\x08" "vpmaddwd\0" "\x06" "psadbw\0" "\x07" "vpsadbw\0" \ +"\x08" "maskmovq\0" "\x0a" "maskmovdqu\0" "\x0b" "vmaskmovdqu\0" "\x05" "psubb\0" \ +"\x06" "vpsubb\0" "\x05" "psubw\0" "\x06" "vpsubw\0" "\x05" "psubd\0" \ +"\x06" "vpsubd\0" "\x05" "psubq\0" "\x06" "vpsubq\0" "\x05" "paddb\0" \ +"\x06" "vpaddb\0" "\x05" "paddw\0" "\x06" "vpaddw\0" "\x05" "paddd\0" \ +"\x06" "vpaddd\0" "\x07" "fnstenv\0" "\x06" "fstenv\0" "\x06" "fnstcw\0" \ +"\x05" "fstcw\0" "\x06" "fnclex\0" "\x05" "fclex\0" "\x06" "fninit\0" \ +"\x05" "finit\0" "\x06" "fnsave\0" "\x05" "fsave\0" "\x06" "fnstsw\0" \ +"\x05" "fstsw\0" "\x06" "pshufb\0" "\x07" "vpshufb\0" "\x06" "phaddw\0" \ +"\x07" "vphaddw\0" "\x06" "phaddd\0" "\x07" "vphaddd\0" "\x07" "phaddsw\0" \ +"\x08" "vphaddsw\0" "\x09" "pmaddubsw\0" "\x0a" "vpmaddubsw\0" "\x06" "phsubw\0" \ +"\x07" "vphsubw\0" "\x06" "phsubd\0" "\x07" "vphsubd\0" "\x07" "phsubsw\0" \ +"\x08" "vphsubsw\0" "\x06" "psignb\0" "\x07" "vpsignb\0" "\x06" "psignw\0" \ +"\x07" "vpsignw\0" "\x06" "psignd\0" "\x07" "vpsignd\0" "\x08" "pmulhrsw\0" \ +"\x09" "vpmulhrsw\0" "\x09" "vpermilps\0" "\x09" "vpermilpd\0" "\x07" "vtestps\0" \ +"\x07" "vtestpd\0" "\x08" "pblendvb\0" "\x08" "blendvps\0" "\x08" "blendvpd\0" \ +"\x05" "ptest\0" "\x06" "vptest\0" "\x0c" "vbroadcastss\0" "\x0c" "vbroadcastsd\0" \ +"\x0e" "vbroadcastf128\0" "\x05" "pabsb\0" "\x06" "vpabsb\0" "\x05" "pabsw\0" \ +"\x06" "vpabsw\0" "\x05" "pabsd\0" "\x06" "vpabsd\0" "\x08" "pmovsxbw\0" \ +"\x09" "vpmovsxbw\0" "\x08" "pmovsxbd\0" "\x09" "vpmovsxbd\0" "\x08" "pmovsxbq\0" \ +"\x09" "vpmovsxbq\0" "\x08" "pmovsxwd\0" "\x09" "vpmovsxwd\0" "\x08" "pmovsxwq\0" \ +"\x09" "vpmovsxwq\0" "\x08" "pmovsxdq\0" "\x09" "vpmovsxdq\0" "\x06" "pmuldq\0" \ +"\x07" "vpmuldq\0" "\x07" "pcmpeqq\0" "\x08" "vpcmpeqq\0" "\x08" "movntdqa\0" \ +"\x09" "vmovntdqa\0" "\x08" "packusdw\0" "\x09" "vpackusdw\0" "\x0a" "vmaskmovps\0" \ +"\x0a" "vmaskmovpd\0" "\x08" "pmovzxbw\0" "\x09" "vpmovzxbw\0" "\x08" "pmovzxbd\0" \ +"\x09" "vpmovzxbd\0" "\x08" "pmovzxbq\0" "\x09" "vpmovzxbq\0" "\x08" "pmovzxwd\0" \ +"\x09" "vpmovzxwd\0" "\x08" "pmovzxwq\0" "\x09" "vpmovzxwq\0" "\x08" "pmovzxdq\0" \ +"\x09" "vpmovzxdq\0" "\x07" "pcmpgtq\0" "\x08" "vpcmpgtq\0" "\x06" "pminsb\0" \ +"\x07" "vpminsb\0" "\x06" "pminsd\0" "\x07" "vpminsd\0" "\x06" "pminuw\0" \ +"\x07" "vpminuw\0" "\x06" "pminud\0" "\x07" "vpminud\0" "\x06" "pmaxsb\0" \ +"\x07" "vpmaxsb\0" "\x06" "pmaxsd\0" "\x07" "vpmaxsd\0" "\x06" "pmaxuw\0" \ +"\x07" "vpmaxuw\0" "\x06" "pmaxud\0" "\x07" "vpmaxud\0" "\x06" "pmulld\0" \ +"\x07" "vpmulld\0" "\x0a" "phminposuw\0" "\x0b" "vphminposuw\0" "\x06" "invept\0" \ +"\x07" "invvpid\0" "\x07" "invpcid\0" "\x0e" "vfmaddsub132ps\0" "\x0e" "vfmaddsub132pd\0" \ +"\x0e" "vfmsubadd132ps\0" "\x0e" "vfmsubadd132pd\0" "\x0b" "vfmadd132ps\0" \ +"\x0b" "vfmadd132pd\0" "\x0b" "vfmadd132ss\0" "\x0b" "vfmadd132sd\0" \ +"\x0b" "vfmsub132ps\0" "\x0b" "vfmsub132pd\0" "\x0b" "vfmsub132ss\0" \ +"\x0b" "vfmsub132sd\0" "\x0c" "vfnmadd132ps\0" "\x0c" "vfnmadd132pd\0" \ +"\x0c" "vfnmadd132ss\0" "\x0c" "vfnmadd132sd\0" "\x0c" "vfnmsub132ps\0" \ +"\x0c" "vfnmsub132pd\0" "\x0c" "vfnmsub132ss\0" "\x0c" "vfnmsub132sd\0" \ +"\x0e" "vfmaddsub213ps\0" "\x0e" "vfmaddsub213pd\0" "\x0e" "vfmsubadd213ps\0" \ +"\x0e" "vfmsubadd213pd\0" "\x0b" "vfmadd213ps\0" "\x0b" "vfmadd213pd\0" \ +"\x0b" "vfmadd213ss\0" "\x0b" "vfmadd213sd\0" "\x0b" "vfmsub213ps\0" \ +"\x0b" "vfmsub213pd\0" "\x0b" "vfmsub213ss\0" "\x0b" "vfmsub213sd\0" \ +"\x0c" "vfnmadd213ps\0" "\x0c" "vfnmadd213pd\0" "\x0c" "vfnmadd213ss\0" \ +"\x0c" "vfnmadd213sd\0" "\x0c" "vfnmsub213ps\0" "\x0c" "vfnmsub213pd\0" \ +"\x0c" "vfnmsub213ss\0" "\x0c" "vfnmsub213sd\0" "\x0e" "vfmaddsub231ps\0" \ +"\x0e" "vfmaddsub231pd\0" "\x0e" "vfmsubadd231ps\0" "\x0e" "vfmsubadd231pd\0" \ +"\x0b" "vfmadd231ps\0" "\x0b" "vfmadd231pd\0" "\x0b" "vfmadd231ss\0" \ +"\x0b" "vfmadd231sd\0" "\x0b" "vfmsub231ps\0" "\x0b" "vfmsub231pd\0" \ +"\x0b" "vfmsub231ss\0" "\x0b" "vfmsub231sd\0" "\x0c" "vfnmadd231ps\0" \ +"\x0c" "vfnmadd231pd\0" "\x0c" "vfnmadd231ss\0" "\x0c" "vfnmadd231sd\0" \ +"\x0c" "vfnmsub231ps\0" "\x0c" "vfnmsub231pd\0" "\x0c" "vfnmsub231ss\0" \ +"\x0c" "vfnmsub231sd\0" "\x06" "aesimc\0" "\x07" "vaesimc\0" "\x06" "aesenc\0" \ +"\x07" "vaesenc\0" "\x0a" "aesenclast\0" "\x0b" "vaesenclast\0" "\x06" "aesdec\0" \ +"\x07" "vaesdec\0" "\x0a" "aesdeclast\0" "\x0b" "vaesdeclast\0" "\x05" "movbe\0" \ +"\x05" "crc32\0" "\x0a" "vperm2f128\0" "\x07" "roundps\0" "\x08" "vroundps\0" \ +"\x07" "roundpd\0" "\x08" "vroundpd\0" "\x07" "roundss\0" "\x08" "vroundss\0" \ +"\x07" "roundsd\0" "\x08" "vroundsd\0" "\x07" "blendps\0" "\x08" "vblendps\0" \ +"\x07" "blendpd\0" "\x08" "vblendpd\0" "\x07" "pblendw\0" "\x08" "vpblendw\0" \ +"\x07" "palignr\0" "\x08" "vpalignr\0" "\x06" "pextrb\0" "\x07" "vpextrb\0" \ +"\x06" "pextrd\0" "\x06" "pextrq\0" "\x07" "vpextrd\0" "\x07" "vpextrq\0" \ +"\x09" "extractps\0" "\x0a" "vextractps\0" "\x0b" "vinsertf128\0" "\x0c" "vextractf128\0" \ +"\x06" "pinsrb\0" "\x07" "vpinsrb\0" "\x08" "insertps\0" "\x09" "vinsertps\0" \ +"\x06" "pinsrd\0" "\x06" "pinsrq\0" "\x07" "vpinsrd\0" "\x07" "vpinsrq\0" \ +"\x04" "dpps\0" "\x05" "vdpps\0" "\x04" "dppd\0" "\x05" "vdppd\0" "\x07" "mpsadbw\0" \ +"\x08" "vmpsadbw\0" "\x09" "pclmulqdq\0" "\x0a" "vpclmulqdq\0" "\x09" "vblendvps\0" \ +"\x09" "vblendvpd\0" "\x09" "vpblendvb\0" "\x09" "pcmpestrm\0" "\x0a" "vpcmpestrm\0" \ +"\x09" "pcmpestri\0" "\x0a" "vpcmpestri\0" "\x09" "pcmpistrm\0" "\x0a" "vpcmpistrm\0" \ +"\x09" "pcmpistri\0" "\x0a" "vpcmpistri\0" "\x0f" "aeskeygenassist\0" \ +"\x10" "vaeskeygenassist\0" "\x06" "psrldq\0" "\x07" "vpsrldq\0" "\x06" "pslldq\0" \ +"\x07" "vpslldq\0" "\x06" "fxsave\0" "\x08" "fxsave64\0" "\x08" "rdfsbase\0" \ +"\x07" "fxrstor\0" "\x09" "fxrstor64\0" "\x08" "rdgsbase\0" "\x07" "ldmxcsr\0" \ +"\x08" "wrfsbase\0" "\x08" "vldmxcsr\0" "\x07" "stmxcsr\0" "\x08" "wrgsbase\0" \ +"\x08" "vstmxcsr\0" "\x07" "vmptrld\0" "\x07" "vmclear\0" "\x05" "vmxon\0" \ +"\x06" "movsxd\0" "\x05" "pause\0" "\x04" "wait\0" "\x06" "rdrand\0" \ +"\x06" "_3dnow\0" \ +"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; /* Sentinel mnemonic. */ + +const _WRegister _REGISTERS[] = { + {3, "rax"}, {3, "rcx"}, {3, "rdx"}, {3, "rbx"}, {3, "rsp"}, {3, "rbp"}, {3, "rsi"}, {3, "rdi"}, {2, "r8"}, {2, "r9"}, {3, "r10"}, {3, "r11"}, {3, "r12"}, {3, "r13"}, {3, "r14"}, {3, "r15"}, + {3, "eax"}, {3, "ecx"}, {3, "edx"}, {3, "ebx"}, {3, "esp"}, {3, "ebp"}, {3, "esi"}, {3, "edi"}, {3, "r8d"}, {3, "r9d"}, {4, "r10d"}, {4, "r11d"}, {4, "r12d"}, {4, "r13d"}, {4, "r14d"}, {4, "r15d"}, + {2, "ax"}, {2, "cx"}, {2, "dx"}, {2, "bx"}, {2, "sp"}, {2, "bp"}, {2, "si"}, {2, "di"}, {3, "r8w"}, {3, "r9w"}, {4, "r10w"}, {4, "r11w"}, {4, "r12w"}, {4, "r13w"}, {4, "r14w"}, {4, "r15w"}, + {2, "al"}, {2, "cl"}, {2, "dl"}, {2, "bl"}, {2, "ah"}, {2, "ch"}, {2, "dh"}, {2, "bh"}, {3, "r8b"}, {3, "r9b"}, {4, "r10b"}, {4, "r11b"}, {4, "r12b"}, {4, "r13b"}, {4, "r14b"}, {4, "r15b"}, + {3, "spl"}, {3, "bpl"}, {3, "sil"}, {3, "dil"}, + {2, "es"}, {2, "cs"}, {2, "ss"}, {2, "ds"}, {2, "fs"}, {2, "gs"}, + {3, "rip"}, + {3, "st0"}, {3, "st1"}, {3, "st2"}, {3, "st3"}, {3, "st4"}, {3, "st5"}, {3, "st6"}, {3, "st7"}, + {3, "mm0"}, {3, "mm1"}, {3, "mm2"}, {3, "mm3"}, {3, "mm4"}, {3, "mm5"}, {3, "mm6"}, {3, "mm7"}, + {4, "xmm0"}, {4, "xmm1"}, {4, "xmm2"}, {4, "xmm3"}, {4, "xmm4"}, {4, "xmm5"}, {4, "xmm6"}, {4, "xmm7"}, {4, "xmm8"}, {4, "xmm9"}, {5, "xmm10"}, {5, "xmm11"}, {5, "xmm12"}, {5, "xmm13"}, {5, "xmm14"}, {5, "xmm15"}, + {4, "ymm0"}, {4, "ymm1"}, {4, "ymm2"}, {4, "ymm3"}, {4, "ymm4"}, {4, "ymm5"}, {4, "ymm6"}, {4, "ymm7"}, {4, "ymm8"}, {4, "ymm9"}, {5, "ymm10"}, {5, "ymm11"}, {5, "ymm12"}, {5, "ymm13"}, {5, "ymm14"}, {5, "ymm15"}, + {3, "cr0"}, {0, ""}, {3, "cr2"}, {3, "cr3"}, {3, "cr4"}, {0, ""}, {0, ""}, {0, ""}, {3, "cr8"}, + {3, "dr0"}, {3, "dr1"}, {3, "dr2"}, {3, "dr3"}, {0, ""}, {0, ""}, {3, "dr6"}, {3, "dr7"}, + {0, ""} /* There must be an empty last reg, see strcat_WSR. */ +}; + +#endif /* DISTORM_LIGHT */ diff --git a/NativeCore/Dependencies/distorm/src/operands.c b/NativeCore/Dependencies/distorm/src/operands.c new file mode 100644 index 00000000..b5da260b --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/operands.c @@ -0,0 +1,1365 @@ +/* +operands.c + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#include "config.h" +#include "operands.h" +#include "x86defs.h" +#include "insts.h" +#include "../include/mnemonics.h" + + +/* Maps a register to its register-class mask. */ +uint32_t _REGISTERTORCLASS[] = /* Based on _RegisterType enumeration! */ +{RM_AX, RM_CX, RM_DX, RM_BX, RM_SP, RM_BP, RM_SI, RM_DI, RM_R8, RM_R9, RM_R10, RM_R11, RM_R12, RM_R13, RM_R14, RM_R15, + RM_AX, RM_CX, RM_DX, RM_BX, RM_SP, RM_BP, RM_SI, RM_DI, RM_R8, RM_R9, RM_R10, RM_R11, RM_R12, RM_R13, RM_R14, RM_R15, + RM_AX, RM_CX, RM_DX, RM_BX, RM_SP, RM_BP, RM_SI, RM_DI, RM_R8, RM_R9, RM_R10, RM_R11, RM_R12, RM_R13, RM_R14, RM_R15, + RM_AX, RM_CX, RM_DX, RM_BX, RM_AX, RM_CX, RM_DX, RM_BX, RM_R8, RM_R9, RM_R10, RM_R11, RM_R12, RM_R13, RM_R14, RM_R15, + RM_SP, RM_BP, RM_SI, RM_DI, + RM_SEG, RM_SEG, RM_SEG, RM_SEG, RM_SEG, RM_SEG, + 0, + RM_FPU, RM_FPU, RM_FPU, RM_FPU, RM_FPU, RM_FPU, RM_FPU, RM_FPU, + RM_MMX, RM_MMX, RM_MMX, RM_MMX, RM_MMX, RM_MMX, RM_MMX, RM_MMX, + RM_SSE, RM_SSE, RM_SSE, RM_SSE, RM_SSE, RM_SSE, RM_SSE, RM_SSE, RM_SSE, RM_SSE, RM_SSE, RM_SSE, RM_SSE, RM_SSE, RM_SSE, RM_SSE, + RM_AVX, RM_AVX, RM_AVX, RM_AVX, RM_AVX, RM_AVX, RM_AVX, RM_AVX, RM_AVX, RM_AVX, RM_AVX, RM_AVX, RM_AVX, RM_AVX, RM_AVX, RM_AVX, + RM_CR, 0, RM_CR, RM_CR, RM_CR, 0, 0, 0, RM_CR, + RM_DR, RM_DR, RM_DR, RM_DR, 0, 0, RM_DR, RM_DR +}; + +/* A helper function to fix the 8 bits register if REX is used (to support SIL, DIL, etc). */ +_INLINE_ unsigned int _FASTCALL_ operands_fix_8bit_rex_base(unsigned int reg) +{ + if ((reg >= 4) && (reg < 8)) return reg + REGS8_REX_BASE - 4; + return reg + REGS8_BASE; +} + +/* A helper function to set operand's type and size. */ +_INLINE_ void operands_set_ts(_Operand* op, _OperandType type, uint16_t size) +{ + op->type = type; + op->size = size; +} + +/* A helper function to set operand's type, size and index. */ +_INLINE_ void operands_set_tsi(_DInst* di, _Operand* op, _OperandType type, uint16_t size, unsigned int index) +{ + op->type = type; + op->index = (uint8_t)index; + op->size = size; + di->usedRegistersMask |= _REGISTERTORCLASS[index]; +} + +/* A helper function to read an unsigned integer from the stream safely. */ +_INLINE_ int read_stream_safe_uint8(_CodeInfo* ci, void* result) +{ + ci->codeLen -= 1; + if (ci->codeLen < 0) return FALSE; + *(uint8_t*)result = *(uint8_t*)ci->code; + ci->code += 1; + return TRUE; +} + +/* A helper function to read an unsigned integer from the stream safely. */ +_INLINE_ int read_stream_safe_uint16(_CodeInfo* ci, void* result) +{ + ci->codeLen -= 2; + if (ci->codeLen < 0) return FALSE; + *(uint16_t*)result = RUSHORT(ci->code); + ci->code += 2; + return TRUE; +} + +/* A helper function to read an unsigned integer from the stream safely. */ +_INLINE_ int read_stream_safe_uint32(_CodeInfo* ci, void* result) +{ + ci->codeLen -= 4; + if (ci->codeLen < 0) return FALSE; + *(uint32_t*)result = RULONG(ci->code); + ci->code += 4; + return TRUE; +} + +/* A helper function to read an unsigned integer from the stream safely. */ +_INLINE_ int read_stream_safe_uint64(_CodeInfo* ci, void* result) +{ + ci->codeLen -= 8; + if (ci->codeLen < 0) return FALSE; + *(uint64_t*)result = RULLONG(ci->code); + ci->code += 8; + return TRUE; +} + +/* A helper function to read a signed integer from the stream safely. */ +_INLINE_ int read_stream_safe_sint8(_CodeInfo* ci, int64_t* result) +{ + ci->codeLen -= 1; + if (ci->codeLen < 0) return FALSE; + *result = *(int8_t*)ci->code; + ci->code += 1; + return TRUE; +} + +/* A helper function to read a signed integer from the stream safely. */ +_INLINE_ int read_stream_safe_sint16(_CodeInfo* ci, int64_t* result) +{ + ci->codeLen -= 2; + if (ci->codeLen < 0) return FALSE; + *result = RSHORT(ci->code); + ci->code += 2; + return TRUE; +} + +/* A helper function to read a signed integer from the stream safely. */ +_INLINE_ int read_stream_safe_sint32(_CodeInfo* ci, int64_t* result) +{ + ci->codeLen -= 4; + if (ci->codeLen < 0) return FALSE; + *result = RLONG(ci->code); + ci->code += 4; + return TRUE; +} + +/* + * SIB decoding is the most confusing part when decoding IA-32 instructions. + * This explanation should clear up some stuff. + * + * ! When base == 5, use EBP as the base register ! + * if (rm == 4) { + * if mod == 01, decode SIB byte and ALSO read a 8 bits displacement. + * if mod == 10, decode SIB byte and ALSO read a 32 bits displacement. + * if mod == 11 <-- EXCEPTION, this is a general-purpose register and mustn't lead to SIB decoding! + * ; So far so good, now the confusing part comes in with mod == 0 and base=5, but no worry. + * if (mod == 00) { + * decode SIB byte WITHOUT any displacement. + * EXCEPTION!!! when base == 5, read a 32 bits displacement, but this time DO NOT use (EBP) BASE at all! + * } + * + * NOTE: base could specify None (no base register) if base==5 and mod==0, but then you also need DISP32. + * } + */ +static void operands_extract_sib(_DInst* di, + _PrefixState* ps, _DecodeType effAdrSz, + unsigned int sib, unsigned int mod, _Operand* op) +{ + unsigned char scale, index, base; + unsigned int vrex = ps->vrex; + uint8_t* pIndex = NULL; + + /* + * SIB bits: + * |7---6-5----3-2---0| + * |SCALE| INDEX| BASE| + * |------------------| + */ + index = (sib >> 3) & 7; + base = sib & 7; + + /* + * The following fields: base/index/scale/disp8/32 are ALL optional by specific rules! + * The idea here is to keep the indirection as a simple-memory type. + * Because the base is optional, and we might be left with only one index. + * So even if there's a base but no index, or vice versa, we end up with one index register. + */ + + /* In 64 bits the REX prefix might affect the index of the SIB byte. */ + if (vrex & PREFIX_EX_X) { + ps->usedPrefixes |= INST_PRE_REX; + index += EX_GPR_BASE; + } + + if (index == 4) { /* No index is used. Use SMEM. */ + op->type = O_SMEM; + pIndex = &op->index; + } else { + op->type = O_MEM; + pIndex = &di->base; + /* No base, unless it is updated below. E.G: [EAX*4] has no base reg. */ + } + + if (base != 5) { + if (vrex & PREFIX_EX_B) ps->usedPrefixes |= INST_PRE_REX; + *pIndex = effAdrSz == Decode64Bits ? REGS64_BASE : REGS32_BASE; + *pIndex += (uint8_t)(base + ((vrex & PREFIX_EX_B) ? EX_GPR_BASE : 0)); + + if (di->base != R_NONE) di->usedRegistersMask |= _REGISTERTORCLASS[di->base]; + } else if (mod != 0) { + /* + * if base == 5 then you have to decode according to MOD. + * mod(00) - disp32. + * mod(01) - disp8 + rBP + * mod(10) - disp32 + rBP + * mod(11) - not possible, it's a general-purpose register. + */ + + if (vrex & PREFIX_EX_B) ps->usedPrefixes |= INST_PRE_REX; + if (effAdrSz == Decode64Bits) *pIndex = REGS64_BASE + 5 + ((vrex & PREFIX_EX_B) ? EX_GPR_BASE : 0); + else *pIndex = REGS32_BASE + 5 + ((vrex & PREFIX_EX_B) ? EX_GPR_BASE : 0); + + if (di->base != R_NONE) di->usedRegistersMask |= _REGISTERTORCLASS[di->base]; + } else if (index == 4) { + /* 32bits displacement only. */ + op->type = O_DISP; + return; + } + + if (index != 4) { /* In 64 bits decoding mode, if index == R12, it's valid! */ + scale = (sib >> 6) & 3; + if (effAdrSz == Decode64Bits) op->index = (uint8_t)(REGS64_BASE + index); + else op->index = (uint8_t)(REGS32_BASE + index); + di->scale = scale != 0 ? (1 << scale) : 0; + } +} + +/* + * This seems to be the hardest part in decoding the operands. + * If you take a look carefully at Table 2-2. 32-Bit Addressing Forms with the ModR/M Byte, + * you will understand it's easy to decode the operands. + + * First we check the DT, so we can decide according to which Table in the documentation we are supposed to decode. + * Then we follow the specific table whether it's 16 bits or 32/64 bits. + + * Don't forget that Operand Size AND Address Size prefixes may change the decoding! + + * Some instructions force the use of RM16 or other specific types, so take it into account. + */ +static int operands_extract_modrm(_CodeInfo* ci, _PrefixState* ps, _DInst* di, + _DecodeType effAdrSz, unsigned int mod, unsigned int rm, + _iflags instFlags, _Operand* op) +{ + unsigned char sib = 0, base = 0; + + /* Memory indirection decoding ahead:) */ + + ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + if ((instFlags & INST_PRE_LOCK) && (ps->decodedPrefixes & INST_PRE_LOCK)) { + ps->usedPrefixes |= INST_PRE_LOCK; + di->flags |= FLAG_LOCK; + } + + if (effAdrSz != Decode16Bits) { /* Decode32Bits or Decode64Bits! */ + /* Remember that from a 32/64 bits ModR/M byte a SIB byte could follow! */ + if ((rm == 5) && (mod == 0)) { + /* 5 is a special case - only 32 bits displacement, or RIP relative. */ + di->dispSize = 32; + if (!read_stream_safe_sint32(ci, (int64_t*)&di->disp)) return FALSE; + + /* Absolute address: */ + op->type = O_DISP; + + if (ci->dt == Decode64Bits) { + /* In 64 bits decoding mode depsite of the address size, a RIP-relative address it is. */ + op->type = O_SMEM; + op->index = R_RIP; + di->flags |= FLAG_RIP_RELATIVE; + } + + prefixes_use_segment(INST_PRE_DS, ps, ci->dt, di); + } + else { + if (rm == 4) { + /* 4 is a special case - SIB byte + disp8/32 follows! */ + /* Read SIB byte. */ + if (!read_stream_safe_uint8(ci, &sib)) return FALSE; + operands_extract_sib(di, ps, effAdrSz, sib, mod, op); + } + else { + op->type = O_SMEM; + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + + if (effAdrSz == Decode64Bits) op->index = (uint8_t)(REGS64_BASE + rm); + else op->index = (uint8_t)(REGS32_BASE + rm); + } + + if (mod == 1) { + di->dispSize = 8; + if (!read_stream_safe_sint8(ci, (int64_t*)&di->disp)) return FALSE; + } + else if ((mod == 2) || ((sib & 7) == 5)) { /* If there is no BASE, read DISP32! */ + di->dispSize = 32; + if (!read_stream_safe_sint32(ci, (int64_t*)&di->disp)) return FALSE; + } + + /* Get the base register. */ + base = op->index; + if (di->base != R_NONE) base = di->base; + else if (di->scale >= 2) base = 0; /* If it's only an index but got scale, it's still DS. */ + /* Default for EBP/ESP is SS segment. 64 bits mode ignores DS anyway. */ + if ((base == R_EBP) || (base == R_ESP)) prefixes_use_segment(INST_PRE_SS, ps, ci->dt, di); + else prefixes_use_segment(INST_PRE_DS, ps, ci->dt, di); + } + } + else { /* Decode16Bits */ + /* Decoding according to Table 2-1. (16 bits) */ + if ((mod == 0) && (rm == 6)) { + /* 6 is a special case - only 16 bits displacement. */ + op->type = O_DISP; + di->dispSize = 16; + if (!read_stream_safe_sint16(ci, (int64_t*)&di->disp)) return FALSE; + } + else { + /* + * Create the O_MEM for 16 bits indirection that requires 2 registers, E.G: [BS+SI]. + * or create O_SMEM for a single register indirection, E.G: [BP]. + */ + static uint8_t MODS[] = { R_BX, R_BX, R_BP, R_BP, R_SI, R_DI, R_BP, R_BX }; + static uint8_t MODS2[] = { R_SI, R_DI, R_SI, R_DI }; + if (rm < 4) { + op->type = O_MEM; + di->base = MODS[rm]; + di->usedRegistersMask |= _REGISTERTORCLASS[MODS[rm]]; + op->index = MODS2[rm]; + } + else { + op->type = O_SMEM; + op->index = MODS[rm]; + } + + if (mod == 1) { /* 8 bits displacement + indirection */ + di->dispSize = 8; + if (!read_stream_safe_sint8(ci, (int64_t*)&di->disp)) return FALSE; + } + else if (mod == 2) { /* 16 bits displacement + indirection */ + di->dispSize = 16; + if (!read_stream_safe_sint16(ci, (int64_t*)&di->disp)) return FALSE; + } + } + + if ((rm == 2) || (rm == 3) || ((rm == 6) && (mod != 0))) { + /* BP's default segment is SS, so ignore it. */ + prefixes_use_segment(INST_PRE_SS, ps, ci->dt, di); + } + else { + /* Ignore default DS segment. */ + prefixes_use_segment(INST_PRE_DS, ps, ci->dt, di); + } + } + + return TRUE; +} + + +/* + * This function is reponsible to textually format a required operand according to its type. + * It is vital to understand that there are other operands than what the ModR/M byte specifies. + + * Only by decoding the operands of an instruction which got a LOCK prefix, we could tell whether it may use the LOCK prefix. + * According to Intel, LOCK prefix must precede some specific instructions AND in their memory destination operand form (which means first operand). + * LOCK INC EAX, would generate an exception, but LOCK INC [EAX] is alright. + * Also LOCK ADD BX, [BP] would generate an exception. + + * Return code: + * TRUE - continue parsing the instruction and its operands, everything went right 'till now. + * FALSE - not enough bytes, or invalid operands. + */ + +int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, + _iflags instFlags, _OpType type, + unsigned int modrm, _PrefixState* ps, _DecodeType effOpSz, + _DecodeType effAdrSz, _Operand* op) +{ + int ret = 0; + unsigned int mod, reg, rm; + unsigned int size = 0; + + /* + * ModRM bits: + * |7-6-5--------3-2-0| + * |MOD|REG/OPCODE|RM | + * |------------------| + */ + /* mod = (modrm >> 6) & 3; */ /* Mode(register-indirection, disp8+reg+indirection, disp16+reg+indirection, general-purpose register) */ + /* reg = (modrm >> 3) & 7; */ /* Register(could be part of the opcode itself or general-purpose register) */ + /* rm = modrm & 7; */ /* Specifies which general-purpose register or disp+reg to use. */ + + /* -- Memory Indirection Operands (that cannot be a general purpose register) -- */ + if ((type >= OT_MEM) && (type <= OT_LMEM128_256)) { + /* All of the above types can't use a general-purpose register (a MOD of 3)!. */ + mod = (modrm >> 6) & 3; + + if (mod == 3) { + if (type == OT_MEM_OPT) { + /* Since the MEM is optional, only when mod != 3, then return true as if the operand was alright. */ + return TRUE; + } + return FALSE; + } + + switch (type) + { + case OT_MEM64_128: /* Used only by CMPXCHG8/16B. */ + if (effOpSz == Decode64Bits) { + ps->usedPrefixes |= INST_PRE_REX; + size = 128; + } + else size = 64; + break; + case OT_MEM32: size = 32; break; + case OT_MEM32_64: + /* Used by MOVNTI. Default size is 32bits, 64bits with REX. */ + if (effOpSz == Decode64Bits) { + ps->usedPrefixes |= INST_PRE_REX; + size = 64; + } + else size = 32; + break; + case OT_MEM64: size = 64; break; + case OT_MEM128: size = 128; break; + case OT_MEM16_FULL: /* The size indicates about the second item of the pair. */ + switch (effOpSz) + { + case Decode16Bits: + ps->usedPrefixes |= INST_PRE_OP_SIZE; + size = 16; + break; + case Decode32Bits: + ps->usedPrefixes |= INST_PRE_OP_SIZE; + size = 32; + break; + case Decode64Bits: + /* Mark usage of REX only if it was required. */ + if ((instFlags & (INST_64BITS | INST_PRE_REX)) == (INST_64BITS | INST_PRE_REX)) ps->usedPrefixes |= INST_PRE_REX; + size = 64; + break; + } + break; + case OT_MEM16_3264: /* The size indicates about the second item of the pair. */ + if (ci->dt == Decode64Bits) size = 64; + else size = 32; + break; + case OT_FPUM16: size = 16; break; + case OT_FPUM32: size = 32; break; + case OT_FPUM64: size = 64; break; + case OT_FPUM80: size = 80; break; + case OT_LMEM128_256: + if (ps->vrex & PREFIX_EX_L) size = 256; + else size = 128; + break; + case OT_MEM_OPT: /* Here we know it's not optional. */ + case OT_MEM: size = 0; /* Size is unknown, but still handled. */ break; + default: return FALSE; + } + rm = modrm & 7; + ret = operands_extract_modrm(ci, ps, di, effAdrSz, mod, rm, instFlags, op); + op->size = (uint16_t)size; + if ((op->type == O_SMEM) || (op->type == O_MEM)) { + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; + } + return ret; + } + + /* -- Memory Indirection Operands (that can be a register) -- */ + if ((type >= OT_RM8) && (type <= OT_LXMM64_128)) { + mod = (modrm >> 6) & 3; + if (mod != 3) { + switch (type) + { + case OT_RM_FULL: + ps->usedPrefixes |= INST_PRE_OP_SIZE; + /* PUSH/JMP/CALL are automatically promoted to 64 bits! */ + if (effOpSz == Decode32Bits) { + size = 32; + break; + } + else if (effOpSz == Decode64Bits) { + /* Mark usage of REX only if it was required. */ + if ((instFlags & INST_64BITS) == 0) ps->usedPrefixes |= INST_PRE_REX; + size = 64; + break; + } + /* FALL THROUGH BECAUSE dt==Decoded16Bits @-<----*/ + case OT_RM16: + /* If we got here not from OT_RM16, then the prefix was used. */ + if (type != OT_RM16) ps->usedPrefixes |= INST_PRE_OP_SIZE; + size = 16; + break; + case OT_RM32_64: + /* The default size is 32, which can be 64 with a REX only. */ + if (effOpSz == Decode64Bits) { + size = 64; + /* Mark REX prefix as used if non-promoted instruction. */ + if ((instFlags & (INST_64BITS | INST_PRE_REX)) == (INST_64BITS | INST_PRE_REX)) { + ps->usedPrefixes |= INST_PRE_REX; + } + } + else size = 32; + break; + case OT_RM16_32: + /* Ignore REX, it's either 32 or 16 bits RM. */ + if (ps->decodedPrefixes & INST_PRE_OP_SIZE) { + ps->usedPrefixes |= INST_PRE_OP_SIZE; + /* Assume: We are in 64bits when we have this operand used. */ + size = 16; + } + else size = 32; + break; + case OT_WXMM32_64: + case OT_WRM32_64: + if (ps->vrex & PREFIX_EX_W) size = 64; + else size = 32; + break; + case OT_YXMM64_256: + if (ps->vrex & PREFIX_EX_L) size = 256; + else size = 64; + break; + case OT_YXMM128_256: + if (ps->vrex & PREFIX_EX_L) size = 256; + else size = 128; + break; + case OT_LXMM64_128: + if (ps->vrex & PREFIX_EX_L) size = 128; + else size = 64; + break; + case OT_RFULL_M16: + ps->usedPrefixes |= INST_PRE_OP_SIZE; + size = 16; + break; + + case OT_RM8: + case OT_R32_M8: + case OT_R32_64_M8: + case OT_REG32_64_M8: + size = 8; + break; + + case OT_XMM16: + case OT_R32_M16: + case OT_R32_64_M16: + case OT_REG32_64_M16: + size = 16; + break; + + case OT_RM32: + case OT_MM32: + case OT_XMM32: + size = 32; + break; + + case OT_MM64: + case OT_XMM64: + size = 64; + break; + + case OT_XMM128: size = 128; break; + case OT_YMM256: size = 256; break; + default: return FALSE; + } + /* Fill size of memory dereference for operand. */ + rm = modrm & 7; + ret = operands_extract_modrm(ci, ps, di, effAdrSz, mod, rm, instFlags, op); + op->size = (uint16_t)size; + if ((op->type == O_SMEM) || (op->type == O_MEM)) { + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; + } + return ret; + } + else { + /* + * General-purpose register is handled the same way in 16/32/64 bits decoding modes. + * NOTE!! that we have to override the size of the register, since it was set earlier as Memory and not Register! + */ + rm = modrm & 7; + size = 0; + switch (type) + { + case OT_RFULL_M16: + case OT_RM_FULL: + switch (effOpSz) + { + case Decode16Bits: + ps->usedPrefixes |= INST_PRE_OP_SIZE; + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + size = 16; + rm += REGS16_BASE; + break; + case Decode32Bits: + ps->usedPrefixes |= INST_PRE_OP_SIZE; + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + size = 32; + rm += REGS32_BASE; + break; + case Decode64Bits: + /* A fix for SMSW RAX which use the REX prefix. */ + if (type == OT_RFULL_M16) ps->usedPrefixes |= INST_PRE_REX; + /* CALL NEAR/PUSH/POP defaults to 64 bits. --> INST_64BITS, REX isn't required, thus ignored anyways. */ + if (instFlags & INST_PRE_REX) ps->usedPrefixes |= INST_PRE_REX; + /* Mark usage of REX only if it was required. */ + if ((instFlags & INST_64BITS) == 0) ps->usedPrefixes |= INST_PRE_REX; + /* Include REX if used for REX.B. */ + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + size = 64; + rm += REGS64_BASE; + break; + } + break; + case OT_R32_64_M8: + /* FALL THROUGH, decode 32 or 64 bits register. */ + case OT_R32_64_M16: + /* FALL THROUGH, decode 32 or 64 bits register. */ + case OT_RM32_64: /* Take care specifically in MOVNTI/MOVD/CVT's instructions, making it _REG64 with REX or if they are promoted. */ + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + /* Is it a promoted instruction? (only INST_64BITS is set and REX isn't required.) */ + if ((ci->dt == Decode64Bits) && ((instFlags & (INST_64BITS | INST_PRE_REX)) == INST_64BITS)) { + size = 64; + rm += REGS64_BASE; + break; + } + /* Give a chance to REX.W. Because if it was a promoted instruction we don't care about REX.W anyways. */ + if (ps->vrex & PREFIX_EX_W) { + ps->usedPrefixes |= INST_PRE_REX; + size = 64; + rm += REGS64_BASE; + } + else { + size = 32; + rm += REGS32_BASE; + } + break; + case OT_RM16_32: /* Used only with MOVZXD instruction to support 16 bits operand. */ + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + /* Is it 16 bits operand size? */ + if (ps->decodedPrefixes & INST_PRE_OP_SIZE) { + ps->usedPrefixes |= INST_PRE_OP_SIZE; + size = 16; + rm += REGS16_BASE; + } + else { + size = 32; + rm += REGS32_BASE; + } + break; + case OT_RM16: + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + rm += REGS16_BASE; + size = 16; + break; + case OT_RM8: + if (ps->prefixExtType == PET_REX) { + ps->usedPrefixes |= INST_PRE_REX; + rm = operands_fix_8bit_rex_base(rm + ((ps->vrex & PREFIX_EX_B) ? EX_GPR_BASE : 0)); + } + else rm += REGS8_BASE; + size = 8; + break; + case OT_MM32: + case OT_MM64: + /* MMX doesn't support extended registers. */ + size = 64; + rm += MMXREGS_BASE; + break; + + case OT_XMM16: + case OT_XMM32: + case OT_XMM64: + case OT_XMM128: + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + size = 128; + rm += SSEREGS_BASE; + break; + + case OT_RM32: + case OT_R32_M8: + case OT_R32_M16: + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + size = 32; + rm += REGS32_BASE; + break; + + case OT_YMM256: + if (ps->vrex & PREFIX_EX_B) rm += EX_GPR_BASE; + rm += AVXREGS_BASE; + size = 256; + break; + case OT_YXMM64_256: + case OT_YXMM128_256: + if (ps->vrex & PREFIX_EX_B) rm += EX_GPR_BASE; + if (ps->vrex & PREFIX_EX_L) { + size = 256; + rm += AVXREGS_BASE; + } + else { + size = 128; + rm += SSEREGS_BASE; + } + break; + case OT_WXMM32_64: + case OT_LXMM64_128: + if (ps->vrex & PREFIX_EX_B) rm += EX_GPR_BASE; + size = 128; + rm += SSEREGS_BASE; + break; + + case OT_WRM32_64: + case OT_REG32_64_M8: + case OT_REG32_64_M16: + if (ps->vrex & PREFIX_EX_B) rm += EX_GPR_BASE; + if (ps->vrex & PREFIX_EX_W) { + size = 64; + rm += REGS64_BASE; + } + else { + size = 32; + rm += REGS32_BASE; + } + break; + + default: return FALSE; + } + op->size = (uint16_t)size; + op->index = (uint8_t)rm; + op->type = O_REG; + di->usedRegistersMask |= _REGISTERTORCLASS[rm]; + return TRUE; + } + } + + /* Simple operand type (ModRM reg). */ + reg = (modrm >> 3) & 7; + switch (type) + { + case OT_IMM8: + operands_set_ts(op, O_IMM, 8); + if (!read_stream_safe_uint8(ci, &di->imm.byte)) return FALSE; + break; + case OT_IMM_FULL: /* 16, 32 or 64, depends on prefixes. */ + if (effOpSz == Decode16Bits) { + ps->usedPrefixes |= INST_PRE_OP_SIZE; + /* FALL THROUGH */ + case OT_IMM16: /* Force 16 bits imm. */ + operands_set_ts(op, O_IMM, 16); + if (!read_stream_safe_uint16(ci, &di->imm.word)) return FALSE; + break; + /* + * Extension: MOV imm64, requires REX. + * Make sure it needs the REX. + * REX must be present because op size function takes it into consideration. + */ + } else if ((effOpSz == Decode64Bits) && + ((instFlags & (INST_64BITS | INST_PRE_REX)) == (INST_64BITS | INST_PRE_REX))) { + ps->usedPrefixes |= INST_PRE_REX; + + operands_set_ts(op, O_IMM, 64); + if (!read_stream_safe_uint64(ci, &di->imm.qword)) return FALSE; + break; + } else ps->usedPrefixes |= INST_PRE_OP_SIZE; + /* FALL THROUGH BECAUSE dt==Decoded32Bits @-<----*/ + case OT_IMM32: + op->type = O_IMM; + if (ci->dt == Decode64Bits) { + /* + * Imm32 is sign extended to 64 bits! + * Originally the op size was 64, but later was changed to reflect real size of imm. + */ + op->size = 32; + /* Use this as an indicator that it should be signed extended. */ + di->flags |= FLAG_IMM_SIGNED; + if (!read_stream_safe_sint32(ci, &di->imm.sqword)) return FALSE; + } else { + op->size = 32; + if (!read_stream_safe_uint32(ci, &di->imm.dword)) return FALSE; + } + break; + case OT_SEIMM8: /* Sign extended immediate. */ + /* + * PUSH SEIMM8 can be prefixed by operand size: + * Input stream: 66, 6a, 55 + * 64bits DT: push small 55 + * 32bits DT: push small 55 + * 16bits DT: push large 55 + * small/large indicates the size of the eSP pointer advancement. + * Check the instFlags (ii->flags) if it can be operand-size-prefixed and if the prefix exists. + */ + op->type = O_IMM; + if ((instFlags & INST_PRE_OP_SIZE) && (ps->decodedPrefixes & INST_PRE_OP_SIZE)) { + ps->usedPrefixes |= INST_PRE_OP_SIZE; + switch (ci->dt) + { + case Decode16Bits: op->size = 32; break; + case Decode32Bits: + case Decode64Bits: + op->size = 16; + break; + } + } else op->size = 8; + di->flags |= FLAG_IMM_SIGNED; + if (!read_stream_safe_sint8(ci, &di->imm.sqword)) return FALSE; + break; + case OT_IMM16_1: + operands_set_ts(op, O_IMM1, 16); + if (!read_stream_safe_uint16(ci, &di->imm.ex.i1)) return FALSE; + break; + case OT_IMM8_1: + operands_set_ts(op, O_IMM1, 8); + if (!read_stream_safe_uint8(ci, &di->imm.ex.i1)) return FALSE; + break; + case OT_IMM8_2: + operands_set_ts(op, O_IMM2, 8); + if (!read_stream_safe_uint8(ci, &di->imm.ex.i2)) return FALSE; + break; + case OT_REG8: + operands_set_ts(op, O_REG, 8); + if (ps->prefixExtType) { + /* + * If REX prefix is valid then we will have to use low bytes. + * This is a PASSIVE behavior changer of REX prefix, it affects operands even if its value is 0x40 ! + */ + ps->usedPrefixes |= INST_PRE_REX; + op->index = (uint8_t)operands_fix_8bit_rex_base(reg + ((ps->vrex & PREFIX_EX_R) ? EX_GPR_BASE : 0)); + } else op->index = (uint8_t)(REGS8_BASE + reg); + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; + break; + case OT_REG16: + operands_set_tsi(di, op, O_REG, 16, REGS16_BASE + reg); + break; + case OT_REG_FULL: + switch (effOpSz) + { + case Decode16Bits: + ps->usedPrefixes |= INST_PRE_OP_SIZE; + if (ps->vrex & PREFIX_EX_R) { + ps->usedPrefixes |= INST_PRE_REX; + reg += EX_GPR_BASE; + } + operands_set_tsi(di, op, O_REG, 16, REGS16_BASE + reg); + break; + case Decode32Bits: + if (ps->vrex & PREFIX_EX_R) { + ps->usedPrefixes |= INST_PRE_REX; + reg += EX_GPR_BASE; + } else ps->usedPrefixes |= INST_PRE_OP_SIZE; + operands_set_tsi(di, op, O_REG, 32, REGS32_BASE + reg); + break; + case Decode64Bits: /* rex must be presented. */ + ps->usedPrefixes |= INST_PRE_REX; + operands_set_tsi(di, op, O_REG, 64, REGS64_BASE + reg + ((ps->vrex & PREFIX_EX_R) ? EX_GPR_BASE : 0)); + break; + } + break; + case OT_REG32: + if (ps->vrex & PREFIX_EX_R) { + ps->usedPrefixes |= INST_PRE_REX; + reg += EX_GPR_BASE; + } + operands_set_tsi(di, op, O_REG, 32, REGS32_BASE + reg); + break; + case OT_REG32_64: /* Handle CVT's, MOVxX and MOVNTI instructions which could be extended to 64 bits registers with REX. */ + if (ps->vrex & PREFIX_EX_R) { + ps->usedPrefixes |= INST_PRE_REX; + reg += EX_GPR_BASE; + } + + /* Is it a promoted instruction? (only INST_64BITS is set and REX isn't required.) */ + if ((ci->dt == Decode64Bits) && ((instFlags & (INST_64BITS | INST_PRE_REX)) == INST_64BITS)) { + operands_set_tsi(di, op, O_REG, 64, REGS64_BASE + reg); + break; + } + /* Give a chance to REX.W. Because if it was a promoted instruction we don't care about REX.W anyways. */ + if (ps->vrex & PREFIX_EX_W) { + ps->usedPrefixes |= INST_PRE_REX; + operands_set_tsi(di, op, O_REG, 64, REGS64_BASE + reg); + } else operands_set_tsi(di, op, O_REG, 32, REGS32_BASE + reg); + break; + case OT_FREG32_64_RM: /* Force decoding mode. Used for MOV CR(n)/DR(n) which defaults to 64 bits operand size in 64 bits. */ + rm = modrm & 7; + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + + if (ci->dt == Decode64Bits) operands_set_tsi(di, op, O_REG, 64, REGS64_BASE + rm); + else operands_set_tsi(di, op, O_REG, 32, REGS32_BASE + rm); + break; + case OT_MM: /* MMX register */ + operands_set_tsi(di, op, O_REG, 64, MMXREGS_BASE + reg); + break; + case OT_MM_RM: /* MMX register, this time from the RM field */ + rm = modrm & 7; + operands_set_tsi(di, op, O_REG, 64, MMXREGS_BASE + rm); + break; + case OT_REGXMM0: /* Implicit XMM0 operand. */ + operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + 0); + break; + case OT_XMM: /* SSE register */ + if (ps->vrex & PREFIX_EX_R) { + ps->usedPrefixes |= INST_PRE_REX; + reg += EX_GPR_BASE; + } + operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + reg); + break; + case OT_XMM_RM: /* SSE register, this time from the RM field */ + rm = modrm & 7; + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + rm += EX_GPR_BASE; + } + operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + rm); + break; + case OT_CREG: + /* + * Don't parse if the reg exceeds the bounds of the array. + * Most of the CR's are not implemented, so if there's no matching string, the operand is invalid. + */ + if (ps->vrex & PREFIX_EX_R) { + ps->usedPrefixes |= INST_PRE_REX; + reg += EX_GPR_BASE; + } else if ((ci->dt == Decode32Bits) && (ps->decodedPrefixes & INST_PRE_LOCK)) { + /* + * NOTE: In 32 bits decoding mode, + * if the lock prefix is set before MOV CR(n) it will become the 4th bit of the REG field like REX.R in 64 bits. + */ + reg += EX_GPR_BASE; + ps->usedPrefixes |= INST_PRE_LOCK; + } + /* Ignore some registers which do not exist. */ + if ((reg >= CREGS_MAX) || (reg == 1) || ((reg >= 5) && (reg <= 7))) return FALSE; + + op->type = O_REG; + if (ci->dt == Decode64Bits) op->size = 64; + else op->size = 32; + op->index = (uint8_t)(CREGS_BASE + reg); + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; + break; + case OT_DREG: + /* + * In 64 bits there are 16 debug registers. + * but accessing any of dr8-15 which aren't implemented will cause an #ud. + */ + if ((reg == 4) || (reg == 5) || (ps->vrex & PREFIX_EX_R)) return FALSE; + + op->type = O_REG; + if (ci->dt == Decode64Bits) op->size = 64; + else op->size = 32; + op->index = (uint8_t)(DREGS_BASE + reg); + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; + break; + case OT_SREG: /* Works with REG16 only! */ + if ((&di->ops[0] == op) && (reg == 1)) return FALSE; /* Can't MOV CS, . */ + /*Don't parse if the reg exceeds the bounds of the array. */ + if (reg <= SEG_REGS_MAX - 1) operands_set_tsi(di, op, O_REG, 16, SREGS_BASE + reg); + else return FALSE; + break; + case OT_SEG: + op->type = O_REG; + /* Size of reg is always 16, it's up to caller to zero extend it to operand size. */ + op->size = 16; + ps->usedPrefixes |= INST_PRE_OP_SIZE; + /* + * Extract the SEG from ii->flags this time!!! + * Check whether an operand size prefix is used. + */ + switch (instFlags & INST_PRE_SEGOVRD_MASK) + { + case INST_PRE_ES: op->index = R_ES; break; + case INST_PRE_CS: op->index = R_CS; break; + case INST_PRE_SS: op->index = R_SS; break; + case INST_PRE_DS: op->index = R_DS; break; + case INST_PRE_FS: op->index = R_FS; break; + case INST_PRE_GS: op->index = R_GS; break; + } + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; + break; + case OT_ACC8: + operands_set_tsi(di, op, O_REG, 8, R_AL); + break; + case OT_ACC16: + operands_set_tsi(di, op, O_REG, 16, R_AX); + break; + case OT_ACC_FULL_NOT64: + /* No REX.W support for IN/OUT. */ + /* FALL THROUGH */ + case OT_ACC_FULL: + if (effOpSz == Decode16Bits) { + ps->usedPrefixes |= INST_PRE_OP_SIZE; + operands_set_tsi(di, op, O_REG, 16, R_AX); + } else if ((effOpSz == Decode32Bits) || (type == OT_ACC_FULL_NOT64)) { + ps->usedPrefixes |= INST_PRE_OP_SIZE; + operands_set_tsi(di, op, O_REG, 32, R_EAX); + } else { /* Decode64Bits */ + /* Only non-promoted instructions need REX in order to decode in 64 bits. */ + /* MEM-OFFSET MOV's are NOT automatically promoted to 64 bits. */ + if (!(instFlags & INST_64BITS)) { + ps->usedPrefixes |= INST_PRE_REX; + } + operands_set_tsi(di, op, O_REG, 64, R_RAX); + } + break; + case OT_PTR16_FULL: + /* ptr16:full - full is size of operand size to read, therefore Operand Size Prefix affects this. So we need to handle it. */ + if (effOpSz == Decode16Bits) { + ps->usedPrefixes |= INST_PRE_OP_SIZE; + ci->codeLen -= sizeof(int16_t)*2; + if (ci->codeLen < 0) return FALSE; + + operands_set_ts(op, O_PTR, 16); + di->imm.ptr.off = RUSHORT(ci->code); /* Read offset first. */ + di->imm.ptr.seg = RUSHORT((ci->code + sizeof(int16_t))); /* And read segment. */ + + ci->code += sizeof(int16_t)*2; + } else { /* Decode32Bits, for Decode64Bits this instruction is invalid. */ + ps->usedPrefixes |= INST_PRE_OP_SIZE; + ci->codeLen -= sizeof(int32_t) + sizeof(int16_t); + if (ci->codeLen < 0) return FALSE; + + operands_set_ts(op, O_PTR, 32); + di->imm.ptr.off = RULONG(ci->code); /* Read 32bits offset this time. */ + di->imm.ptr.seg = RUSHORT((ci->code + sizeof(int32_t))); /* And read segment, 16 bits. */ + + ci->code += sizeof(int32_t) + sizeof(int16_t); + } + break; + case OT_RELCB: + case OT_RELC_FULL: + + if (type == OT_RELCB) { + operands_set_ts(op, O_PC, 8); + if (!read_stream_safe_sint8(ci, &di->imm.sqword)) return FALSE; + } else { /* OT_RELC_FULL */ + + /* Yep, operand size prefix affects relc also. */ + ps->usedPrefixes |= INST_PRE_OP_SIZE; + if (effOpSz == Decode16Bits) { + operands_set_ts(op, O_PC, 16); + if (!read_stream_safe_sint16(ci, &di->imm.sqword)) return FALSE; + } else { /* Decode32Bits or Decode64Bits = for now they are the same */ + operands_set_ts(op, O_PC, 32); + if (!read_stream_safe_sint32(ci, &di->imm.sqword)) return FALSE; + } + } + + /* Support for hint, see if there's a segment override. */ + if ((ii->opcodeId >= I_JO) && (ii->opcodeId <= I_JG)) { + if (ps->decodedPrefixes & INST_PRE_CS) { + ps->usedPrefixes |= INST_PRE_CS; + di->flags |= FLAG_HINT_NOT_TAKEN; + } else if (ps->decodedPrefixes & INST_PRE_DS) { + ps->usedPrefixes |= INST_PRE_DS; + di->flags |= FLAG_HINT_TAKEN; + } + } + break; + case OT_MOFFS8: + op->size = 8; + /* FALL THROUGH, size won't be changed. */ + case OT_MOFFS_FULL: + op->type = O_DISP; + if (op->size == 0) { + /* Calculate size of operand (same as ACC size). */ + switch (effOpSz) + { + case Decode16Bits: op->size = 16; break; + case Decode32Bits: op->size = 32; break; + case Decode64Bits: op->size = 64; break; + } + } + + prefixes_use_segment(INST_PRE_DS, ps, ci->dt, di); + + /* + * Just a pointer to a BYTE, WORD, DWORD, QWORD. Works only with ACC8/16/32/64 respectively. + * MOV [0x1234], AL ; MOV AX, [0x1234] ; MOV EAX, [0x1234], note that R/E/AX will be chosen by OT_ACC_FULL. + */ + if (effAdrSz == Decode16Bits) { + ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + + di->dispSize = 16; + if (!read_stream_safe_uint16(ci, &di->disp)) return FALSE; + } else if (effAdrSz == Decode32Bits) { + ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + + di->dispSize = 32; + if (!read_stream_safe_uint32(ci, &di->disp)) return FALSE; + } else { /* Decode64Bits */ + di->dispSize = 64; + if (!read_stream_safe_uint64(ci, &di->disp)) return FALSE; + } + break; + case OT_CONST1: + operands_set_ts(op, O_IMM, 8); + di->imm.byte = 1; + break; + case OT_REGCL: + operands_set_tsi(di, op, O_REG, 8, R_CL); + break; + + case OT_FPU_SI: + /* Low 3 bits specify the REG, similar to the MODR/M byte reg. */ + operands_set_tsi(di, op, O_REG, 32, FPUREGS_BASE + (*(ci->code-1) & 7)); + break; + case OT_FPU_SSI: + operands_set_tsi(di, op, O_REG, 32, R_ST0); + operands_set_tsi(di, op + 1, O_REG, 32, FPUREGS_BASE + (*(ci->code-1) & 7)); + di->opsNo++; + break; + case OT_FPU_SIS: + operands_set_tsi(di, op, O_REG, 32, FPUREGS_BASE + (*(ci->code-1) & 7)); + operands_set_tsi(di, op + 1, O_REG, 32, R_ST0); + di->opsNo++; + break; + + /* + * Special treatment for Instructions-Block: + * INC/DEC (only 16/32 bits) /PUSH/POP/XCHG instructions, which get their REG from their own binary code. + + * Notice these instructions are 1 or 2 byte long, + * code points after the byte which represents the instruction itself, + * thus, even if the instructions are 2 bytes long it will read its last byte which contains the REG info. + */ + case OT_IB_RB: + /* Low 3 bits specify the REG, similar to the MODR/M byte reg. */ + operands_set_ts(op, O_REG, 8); + reg = *(ci->code-1) & 7; + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + op->index = (uint8_t)operands_fix_8bit_rex_base(reg + EX_GPR_BASE); + } else if (ps->prefixExtType == PET_REX) { + ps->usedPrefixes |= INST_PRE_REX; + op->index = (uint8_t)operands_fix_8bit_rex_base(reg); + } else op->index = (uint8_t)(REGS8_BASE + reg); + + di->usedRegistersMask |= _REGISTERTORCLASS[op->index]; + break; + case OT_IB_R_FULL: + reg = *(ci->code-1) & 7; + switch (effOpSz) + { + case Decode16Bits: + ps->usedPrefixes |= INST_PRE_OP_SIZE; + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + reg += EX_GPR_BASE; + } + operands_set_tsi(di, op, O_REG, 16, REGS16_BASE + reg); + break; + case Decode32Bits: + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + reg += EX_GPR_BASE; + } else ps->usedPrefixes |= INST_PRE_OP_SIZE; + operands_set_tsi(di, op, O_REG, 32, REGS32_BASE + reg); + break; + case Decode64Bits: + /* + * Automatically promoted instruction can drop REX prefix if not required. + * PUSH/POP defaults to 64 bits. --> INST_64BITS + * MOV imm64 / BSWAP requires REX.W to be 64 bits --> INST_64BITS | INST_PRE_REX + */ + if ((instFlags & INST_64BITS) && ((instFlags & INST_PRE_REX) == 0)) { + if (ps->vrex & PREFIX_EX_B) { + ps->usedPrefixes |= INST_PRE_REX; + reg += EX_GPR_BASE; + } + } else { + ps->usedPrefixes |= INST_PRE_REX; + reg += (ps->vrex & PREFIX_EX_B) ? EX_GPR_BASE : 0; + } + operands_set_tsi(di, op, O_REG, 64, REGS64_BASE + reg); + break; + } + break; + + /* + * Special treatment for repeatable instructions. + + * We want the following output: + * If there's only the REP/NZ prefix, we won't output anything (All operands are implicit). + * If there's an operand size prefix, we will change the suffix letter of the mnemonic, which specifies the size of operand to the required one. + * If there's a segment override prefix, we will output the segment and the used index register (EDI/ESI). + * If there's an address size prefix, we will output the (segment if needed and) the used and inverted index register (DI/SI). + + * Example: + * :: Decoding in 16 bits mode! :: + * AD ~ LODSW + * 66 AD ~ LODSD + * F3 AC ~ REP LODSB + * F3 66 AD ~ REP LODSD + * F3 3E AC ~ REP LODS BYTE DS:[SI] + * F3 67 AD ~ REP LODS WORD [ESI] + + * The basic form of a repeatable instruction has its operands hidden and has a suffix letter + * which implies on the size of operation being done. + * Therefore, we cannot change the mnemonic here when we encounter another prefix and its not the decoder's responsibility to do so. + * That's why the caller is responsible to add the suffix letter if no other prefixes are used. + * And all we are doing here is formatting the operand correctly. + */ + case OT_REGI_ESI: + ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + + op->type = O_SMEM; + + /* This might be a 16, 32 or 64 bits instruction, depends on the decoding mode. */ + if (instFlags & INST_16BITS) { + ps->usedPrefixes |= INST_PRE_OP_SIZE; + + if (effOpSz == Decode16Bits) op->size = 16; + else if ((effOpSz == Decode64Bits) && (instFlags & INST_64BITS)) { + ps->usedPrefixes |= INST_PRE_REX; + op->size = 64; + } else op->size = 32; + } else op->size = 8; + + /* + * Clear segment in case OT_REGI_EDI was parsed earlier, + * DS can be overridden and therefore has precedence. + */ + di->segment = R_NONE; + prefixes_use_segment(INST_PRE_DS, ps, ci->dt, di); + + if (effAdrSz == Decode16Bits) op->index = R_SI; + else if (effAdrSz == Decode32Bits) op->index = R_ESI; + else op->index = R_RSI; + + di->usedRegistersMask |= _REGISTERTORCLASS[R_RSI]; /* Maps to RM_SI. */ + break; + case OT_REGI_EDI: + ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + + op->type = O_SMEM; + + /* This might be a 16 or 32 bits instruction, depends on the decoding mode. */ + if (instFlags & INST_16BITS) { + ps->usedPrefixes |= INST_PRE_OP_SIZE; + + if (effOpSz == Decode16Bits) op->size = 16; + else if ((effOpSz == Decode64Bits) && (instFlags & INST_64BITS)) { + ps->usedPrefixes |= INST_PRE_REX; + op->size = 64; + } else op->size = 32; + } else op->size = 8; + + /* Note: The [rDI] operand can't be prefixed by a segment override, therefore we don't set usedPrefixes. */ + if ((di->segment == R_NONE) && (ci->dt != Decode64Bits)) di->segment = R_ES | SEGMENT_DEFAULT; /* No ES in 64 bits mode. */ + + if (effAdrSz == Decode16Bits) op->index = R_DI; + else if (effAdrSz == Decode32Bits) op->index = R_EDI; + else op->index = R_RDI; + + di->usedRegistersMask |= _REGISTERTORCLASS[R_RDI]; /* Maps to RM_DI. */ + break; + + /* Used for In/Out instructions varying forms. */ + case OT_REGDX: + /* Simple single IN/OUT instruction. */ + operands_set_tsi(di, op, O_REG, 16, R_DX); + break; + + /* Used for INVLPGA instruction. */ + case OT_REGECX: + operands_set_tsi(di, op, O_REG, 32, R_ECX); + break; + case OT_REGI_EBXAL: + /* XLAT BYTE [rBX + AL] */ + ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + + prefixes_use_segment(INST_PRE_DS, ps, ci->dt, di); + + /* Size of deref is always 8 for xlat. */ + operands_set_tsi(di, op, O_MEM, 8, R_AL); + + if (effAdrSz == Decode16Bits) di->base = R_BX; + else if (effAdrSz == Decode32Bits) di->base = R_EBX; + else { + ps->usedPrefixes |= INST_PRE_REX; + di->base = R_RBX; + } + + di->usedRegistersMask |= _REGISTERTORCLASS[di->base]; + break; + case OT_REGI_EAX: + /* + * Implicit rAX as memory indirection operand. Used by AMD's SVM instructions. + * Since this is a memory indirection, the default address size in 64bits decoding mode is 64. + */ + + if (effAdrSz == Decode64Bits) operands_set_tsi(di, op, O_SMEM, 64, R_RAX); + else if (effAdrSz == Decode32Bits) { + ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + operands_set_tsi(di, op, O_SMEM, 32, R_EAX); + } + else { + ps->usedPrefixes |= INST_PRE_ADDR_SIZE; + operands_set_tsi(di, op, O_SMEM, 16, R_AX); + } + break; + case OT_VXMM: + operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + ps->vexV); + break; + case OT_XMM_IMM: + ci->codeLen -= sizeof(int8_t); + if (ci->codeLen < 0) return FALSE; + + if (ci->dt == Decode32Bits) reg = (*ci->code >> 4) & 0x7; + else reg = (*ci->code >> 4) & 0xf; + operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + reg); + + ci->code += sizeof(int8_t); + break; + case OT_YXMM: + if (ps->vrex & PREFIX_EX_R) reg += EX_GPR_BASE; + if (ps->vrex & PREFIX_EX_L) operands_set_tsi(di, op, O_REG, 256, AVXREGS_BASE + reg); + else operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + reg); + break; + case OT_YXMM_IMM: + ci->codeLen -= sizeof(int8_t); + if (ci->codeLen < 0) return FALSE; + + if (ci->dt == Decode32Bits) reg = (*ci->code >> 4) & 0x7; + else reg = (*ci->code >> 4) & 0xf; + + if (ps->vrex & PREFIX_EX_L) operands_set_tsi(di, op, O_REG, 256, AVXREGS_BASE + reg); + else operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + reg); + + ci->code += sizeof(int8_t); + break; + case OT_YMM: + if (ps->vrex & PREFIX_EX_R) reg += EX_GPR_BASE; + operands_set_tsi(di, op, O_REG, 256, AVXREGS_BASE + reg); + break; + case OT_VYMM: + operands_set_tsi(di, op, O_REG, 256, AVXREGS_BASE + ps->vexV); + break; + case OT_VYXMM: + if (ps->vrex & PREFIX_EX_L) operands_set_tsi(di, op, O_REG, 256, AVXREGS_BASE + ps->vexV); + else operands_set_tsi(di, op, O_REG, 128, SSEREGS_BASE + ps->vexV); + break; + case OT_WREG32_64: + if (ps->vrex & PREFIX_EX_R) reg += EX_GPR_BASE; + if (ps->vrex & PREFIX_EX_W) operands_set_tsi(di, op, O_REG, 64, REGS64_BASE + reg); + else operands_set_tsi(di, op, O_REG, 32, REGS32_BASE + reg); + break; + default: return FALSE; + } + return TRUE; +} diff --git a/NativeCore/Dependencies/distorm/src/operands.h b/NativeCore/Dependencies/distorm/src/operands.h new file mode 100644 index 00000000..c4e48224 --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/operands.h @@ -0,0 +1,25 @@ +/* +operands.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef OPERANDS_H +#define OPERANDS_H + +#include "config.h" +#include "decoder.h" +#include "prefix.h" +#include "instructions.h" + +int operands_extract(_CodeInfo* ci, _DInst* di, _InstInfo* ii, + _iflags instFlags, _OpType type, + unsigned int modrm, _PrefixState* ps, _DecodeType effOpSz, + _DecodeType effAdrSz, _Operand* op); + +#endif /* OPERANDS_H */ diff --git a/NativeCore/Dependencies/distorm/src/prefix.c b/NativeCore/Dependencies/distorm/src/prefix.c new file mode 100644 index 00000000..40b0ac2b --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/prefix.c @@ -0,0 +1,381 @@ +/* +prefix.c + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#include "prefix.h" + +#include "x86defs.h" +#include "instructions.h" +#include "../include/mnemonics.h" + + +/* + * The main purpose of this module is to keep track of all kind of prefixes a single instruction may have. + * The problem is that a single instruction may have up to six different prefix-types. + * That's why I have to detect such cases and drop those excess prefixes. + */ + + +int PrefixTables[256 * 2] = { + /* Decode 16/32 Bits */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, /* ES (0x26) CS (0x2e) */ + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, /* DS (0x3e) SS (0x36) */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, /* FS(0x64) GS(0x65) OP_SIZE(0x66) ADDR_SIZE(0x67) */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* VEX2b (0xc5) VEX3b (0xc4) */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* LOCK (0xf0) REPNZ (0xf2) REP (0xf3) */ + /* Decode64Bits */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* REX: 0x40 - 0x4f */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* Ignore all prefix. */ +void prefixes_ignore_all(_PrefixState* ps) +{ + int i; + for (i = 0; i < PFXIDX_MAX; i++) + prefixes_ignore(ps, i); +} + +/* Calculates which prefixes weren't used and accordingly sets the bits in the unusedPrefixesMask. */ +uint16_t prefixes_set_unused_mask(_PrefixState* ps) +{ + /* + * The decodedPrefixes represents the prefixes that were *read* from the binary stream for the instruction. + * The usedPrefixes represents the prefixes that were actually used by the instruction in the *decode* phase. + * Xoring between the two will result in a 'diff' which returns the prefixes that were read + * from the stream *and* that were never used in the actual decoding. + * + * Only one prefix per type can be set in decodedPrefixes from the stream. + * Therefore it's enough to check each type once and set the flag accordingly. + * That's why we had to book-keep each prefix type and its position. + * So now we know which bits we need to set exactly in the mask. + */ + _iflags unusedPrefixesDiff = ps->decodedPrefixes ^ ps->usedPrefixes; + uint16_t unusedPrefixesMask = ps->unusedPrefixesMask; + + /* Examine unused prefixes by type: */ + /* + * About REX: it might be set in the diff although it was never in the stream itself. + * This is because the vrex is shared between VEX and REX and some places flag it as REX usage, while + * we were really decoding an AVX instruction. + * It's not a big problem, because the prefixes_ignore func will ignore it anyway, + * since it wasn't seen earlier. But it's important to know this. + */ + if (unusedPrefixesDiff) { + if (unusedPrefixesDiff & INST_PRE_REX) unusedPrefixesMask |= ps->pfxIndexer[PFXIDX_REX]; + if (unusedPrefixesDiff & INST_PRE_SEGOVRD_MASK) unusedPrefixesMask |= ps->pfxIndexer[PFXIDX_SEG]; + if (unusedPrefixesDiff & INST_PRE_LOKREP_MASK) unusedPrefixesMask |= ps->pfxIndexer[PFXIDX_LOREP]; + if (unusedPrefixesDiff & INST_PRE_OP_SIZE) unusedPrefixesMask |= ps->pfxIndexer[PFXIDX_OP_SIZE]; + if (unusedPrefixesDiff & INST_PRE_ADDR_SIZE) unusedPrefixesMask |= ps->pfxIndexer[PFXIDX_ADRS]; + /* If a VEX instruction was found, its prefix is considered as used, therefore no point for checking for it. */ + } + + return unusedPrefixesMask; +} + +/* + * Mark a prefix as unused, and bookkeep where we last saw this same type, + * because in the future we might want to disable it too. + */ +_INLINE_ void prefixes_track_unused(_PrefixState* ps, int index, _PrefixIndexer pi) +{ + /* Mark the previously used prefix (if exists) in the unused mask. */ + prefixes_ignore(ps, pi); + /* Book-keep the current index for this type. */ + ps->pfxIndexer[pi] = 1 << index; +} + +/* + * Read as many prefixes as possible, up to 15 bytes, and halt when we encounter non-prefix byte. + * This algorithm tries to imitate a real processor, where the same prefix can appear a few times, etc. + * The tiny complexity is that we want to know when a prefix was superfluous and mark any copy of it as unused. + * Note that the last prefix of its type will be considered as used, and all the others (of same type) before it as unused. + */ +void prefixes_decode(_CodeInfo* ci, _PrefixState* ps) +{ + const uint8_t* rexPos = NULL; + const uint8_t* start = ci->code; + uint8_t byte, vex; + unsigned int index; + /* + * First thing to do, scan for prefixes, there are six types of prefixes. + * There may be up to six prefixes before a single instruction, not the same type, no special order, + * except REX/VEX must precede immediately the first opcode byte. + * BTW - This is the reason why I didn't make the REP prefixes part of the instructions (STOS/SCAS/etc). + * + * Another thing, the instruction maximum size is 15 bytes, thus if we read more than 15 bytes, we will halt. + * + * We attach all prefixes to the next instruction, there might be two or more occurrences from the same prefix. + * Also, since VEX can be allowed only once we will test it separately. + */ + for (index = 0; + (ci->codeLen > 0) && (index < INST_MAXIMUM_SIZE); + ci->code++, ci->codeLen--, index++) { + /* + NOTE: AMD treat lock/rep as two different groups... But I am based on Intel. + + - Lock and Repeat: + - 0xF0 — LOCK + - 0xF2 — REPNE/REPNZ + - 0xF3 - REP/REPE/REPZ + - Segment Override: + - 0x2E - CS + - 0x36 - SS + - 0x3E - DS + - 0x26 - ES + - 0x64 - FS + - 0x65 - GS + - Operand-Size Override: 0x66, switching default size. + - Address-Size Override: 0x67, switching default size. + + 64 Bits: + - REX: 0x40 - 0x4f, extends register access. + - 2 Bytes VEX: 0xc4 + - 3 Bytes VEX: 0xc5 + 32 Bits: + - 2 Bytes VEX: 0xc4 11xx-xxxx + - 3 Bytes VEX: 0xc5 11xx-xxxx + */ + + /* Examine what type of prefix we got. */ + byte = *ci->code; + switch (byte) + { + case PREFIX_OP_SIZE: {/* Op Size type: */ + ps->decodedPrefixes |= INST_PRE_OP_SIZE; + prefixes_track_unused(ps, index, PFXIDX_OP_SIZE); + } break; + /* Look for both common arch prefixes. */ + case PREFIX_LOCK: { + /* LOCK and REPx type: */ + ps->decodedPrefixes |= INST_PRE_LOCK; + prefixes_track_unused(ps, index, PFXIDX_LOREP); + } break; + case PREFIX_REPNZ: { + ps->decodedPrefixes |= INST_PRE_REPNZ; + prefixes_track_unused(ps, index, PFXIDX_LOREP); + } break; + case PREFIX_REP: { + ps->decodedPrefixes |= INST_PRE_REP; + prefixes_track_unused(ps, index, PFXIDX_LOREP); + } break; + case PREFIX_CS: { + /* Seg Overide type: */ + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; + ps->decodedPrefixes |= INST_PRE_CS; + prefixes_track_unused(ps, index, PFXIDX_SEG); + } break; + case PREFIX_SS: { + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; + ps->decodedPrefixes |= INST_PRE_SS; + prefixes_track_unused(ps, index, PFXIDX_SEG); + } break; + case PREFIX_DS: { + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; + ps->decodedPrefixes |= INST_PRE_DS; + prefixes_track_unused(ps, index, PFXIDX_SEG); + } break; + case PREFIX_ES: { + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; + ps->decodedPrefixes |= INST_PRE_ES; + prefixes_track_unused(ps, index, PFXIDX_SEG); + } break; + case PREFIX_FS: { + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; + ps->decodedPrefixes |= INST_PRE_FS; + prefixes_track_unused(ps, index, PFXIDX_SEG); + } break; + case PREFIX_GS: { + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK; + ps->decodedPrefixes |= INST_PRE_GS; + prefixes_track_unused(ps, index, PFXIDX_SEG); + } break; + case PREFIX_ADDR_SIZE: { + /* Addr Size type: */ + ps->decodedPrefixes |= INST_PRE_ADDR_SIZE; + prefixes_track_unused(ps, index, PFXIDX_ADRS); + } break; + default: + if (ci->dt == Decode64Bits) { + /* REX type, 64 bits decoding mode only: */ + if ((byte & 0xf0) == 0x40) { + ps->decodedPrefixes |= INST_PRE_REX; + rexPos = ci->code; + ps->vrex = byte & 0xf; /* Keep only BXRW. */ + ps->prefixExtType = PET_REX; + prefixes_track_unused(ps, index, PFXIDX_REX); + continue; + } + } + goto _Break2; + } + } +_Break2: + + /* 2 Bytes VEX: */ + if ((ci->codeLen >= 2) && + (*ci->code == PREFIX_VEX2b) && + ((ci->code - start) <= INST_MAXIMUM_SIZE - 2)) { + /* + * In 32 bits the second byte has to be in the special range of Mod=11. + * Otherwise it might be a normal LDS instruction. + */ + if ((ci->dt == Decode64Bits) || (*(ci->code + 1) >= INST_DIVIDED_MODRM)) { + ps->vexPos = ci->code + 1; + ps->decodedPrefixes |= INST_PRE_VEX; + ps->prefixExtType = PET_VEX2BYTES; + + /* + * VEX 1 byte bits: + * |7-6--3-2-10| + * |R|vvvv|L|pp| + * |-----------| + */ + + /* -- Convert from VEX prefix to VREX flags -- */ + vex = *ps->vexPos; + if (!(vex & 0x80) && (ci->dt == Decode64Bits)) ps->vrex |= PREFIX_EX_R; /* Convert VEX.R. */ + if (vex & 4) ps->vrex |= PREFIX_EX_L; /* Convert VEX.L. */ + + ci->code += 2; + ci->codeLen -= 2; + } + } + + /* 3 Bytes VEX: */ + if ((ci->codeLen >= 3) && + (*ci->code == PREFIX_VEX3b) && + ((ci->code - start) <= INST_MAXIMUM_SIZE - 3) && + (!(ps->decodedPrefixes & INST_PRE_VEX))) { + /* + * In 32 bits the second byte has to be in the special range of Mod=11. + * Otherwise it might be a normal LES instruction. + * And we don't care now about the 3rd byte. + */ + if ((ci->dt == Decode64Bits) || (*(ci->code + 1) >= INST_DIVIDED_MODRM)) { + ps->vexPos = ci->code + 1; + ps->decodedPrefixes |= INST_PRE_VEX; + ps->prefixExtType = PET_VEX3BYTES; + + /* + * VEX first and second bytes: + * |7-6-5-4----0| |7-6--3-2-10| + * |R|X|B|m-mmmm| |W|vvvv|L|pp| + * |------------| |-----------| + */ + + /* -- Convert from VEX prefix to VREX flags -- */ + vex = *ps->vexPos; + ps->vrex |= ((~vex >> 5) & 0x7); /* Shift and invert VEX.R/X/B to their place */ + vex = *(ps->vexPos + 1); + if (vex & 4) ps->vrex |= PREFIX_EX_L; /* Convert VEX.L. */ + if (vex & 0x80) ps->vrex |= PREFIX_EX_W; /* Convert VEX.W. */ + + /* Clear some flags if the mode isn't 64 bits. */ + if (ci->dt != Decode64Bits) ps->vrex &= ~(PREFIX_EX_B | PREFIX_EX_X | PREFIX_EX_R | PREFIX_EX_W); + + ci->code += 3; + ci->codeLen -= 3; + } + } + + if (ci->dt == Decode64Bits) { + if (ps->decodedPrefixes & INST_PRE_REX) { + /* REX prefix must precede first byte of instruction. */ + if (rexPos != (ci->code - 1)) { + ps->decodedPrefixes &= ~INST_PRE_REX; + if (ps->prefixExtType == PET_REX) ps->prefixExtType = PET_NONE; /* It might be a VEX by now, keep it that way. */ + prefixes_ignore(ps, PFXIDX_REX); + } + /* + * We will disable operand size prefix, + * if it exists only after decoding the instruction, since it might be a mandatory prefix. + * This will be done after calling inst_lookup in decode_inst. + */ + } + /* In 64 bits, segment overrides of CS, DS, ES and SS are ignored. So don't take'em into account. */ + if (ps->decodedPrefixes & INST_PRE_SEGOVRD_MASK32) { + ps->decodedPrefixes &= ~INST_PRE_SEGOVRD_MASK32; + prefixes_ignore(ps, PFXIDX_SEG); + } + } + + /* Store number of prefixes scanned. */ + ps->count = (uint8_t)(ci->code - start); +} + +/* + * For every memory-indirection operand we want to set a used segment. + * If the segment is being overrided with a prefix, we will need to check if it's a default. + * Defaults don't use their prefix, e.g "mov [rsp]" can ignore a given SS: prefix, + * but still set the used segment as SS. + * This function is called only with SS and DS as defaults. + * If there's a segment prefix used, it will override the default one. + * And If the prefix is a default seg in 64 bits, it will be ignored. + */ +void prefixes_use_segment(_iflags defaultSeg, _PrefixState* ps, _DecodeType dt, _DInst* di) +{ + /* Extract given segment prefix from the decoded prefixes. */ + _iflags flags; + + if (dt == Decode64Bits) { + if (ps->decodedPrefixes & INST_PRE_SEGOVRD_MASK64) { /* Either GS or FS. */ + di->segment = ps->decodedPrefixes & INST_PRE_GS ? R_GS : R_FS; + } + + return; + } + + flags = ps->decodedPrefixes & INST_PRE_SEGOVRD_MASK; + + /* Use the given prefix only if it's not the default. */ + if (flags && (flags != defaultSeg)) { + ps->usedPrefixes |= flags; + + switch (flags >> 7) /* INST_PRE_CS is 1 << 7. And the rest of the prefixes follow as bit fields. */ + { + case 1: di->segment = R_CS; break; + case 2: di->segment = R_SS; break; + case 4: di->segment = R_DS; break; + case 8: di->segment = R_ES; break; + case 0x10: di->segment = R_FS; break; + case 0x20: di->segment = R_GS; break; + } + } + else { + if (defaultSeg == INST_PRE_SS) di->segment = SEGMENT_DEFAULT | R_SS; + else di->segment = SEGMENT_DEFAULT | R_DS; + } +} diff --git a/NativeCore/Dependencies/distorm/src/prefix.h b/NativeCore/Dependencies/distorm/src/prefix.h new file mode 100644 index 00000000..bc9b6e7d --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/prefix.h @@ -0,0 +1,79 @@ +/* +prefix.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef PREFIX_H +#define PREFIX_H + +#include "config.h" +#include "decoder.h" + + +/* Specifies the type of the extension prefix, such as: REX, 2 bytes VEX, 3 bytes VEX. */ +typedef enum {PET_NONE = 0, PET_REX, PET_VEX2BYTES, PET_VEX3BYTES} _PrefixExtType; + +/* Specifies an index into a table of prefixes by their type. */ +typedef enum {PFXIDX_NONE = -1, PFXIDX_REX, PFXIDX_LOREP, PFXIDX_SEG, PFXIDX_OP_SIZE, PFXIDX_ADRS, PFXIDX_MAX} _PrefixIndexer; + +/* +* This holds the prefixes state for the current instruction we decode. +* decodedPrefixes includes all specific prefixes that the instruction got. +* start is a pointer to the first prefix to take into account. +* last is a pointer to the last byte we scanned. +* Other pointers are used to keep track of prefixes positions and help us know if they appeared already and where. +*/ +typedef struct { + _iflags decodedPrefixes, usedPrefixes; + /* Number of prefixes scanned for current instruction, including VEX! */ + unsigned int count; + uint16_t unusedPrefixesMask; + /* Holds the offset to the prefix byte by its type. */ + uint16_t pfxIndexer[PFXIDX_MAX]; + _PrefixExtType prefixExtType; + /* Indicates whether the operand size prefix (0x66) was used as a mandatory prefix. */ + int isOpSizeMandatory; + /* If VEX prefix is used, store the VEX.vvvv field. */ + unsigned int vexV; + /* The fields B/X/R/W/L of REX and VEX are stored together in this byte. */ + unsigned int vrex; + const uint8_t* vexPos; +} _PrefixState; + +/* +* Intel supports 6 types of prefixes, whereas AMD supports 5 types (lock is seperated from rep/nz). +* REX is the fifth prefix type, this time I'm based on AMD64. +* VEX is the 6th, though it can't be repeated. +*/ +#define MAX_PREFIXES (5) + +extern int PrefixTables[256 * 2]; + +_INLINE_ int prefixes_is_valid(unsigned char ch, _DecodeType dt) +{ + /* The predicate selects (branchlessly) second half table for 64 bits otherwise selects first half. */ + return PrefixTables[ch + ((dt >> 1) << 8)]; +} + +/* Ignore a specific prefix type. */ +_INLINE_ void prefixes_ignore(_PrefixState* ps, _PrefixIndexer pi) +{ + /* + * If that type of prefix appeared already, set the bit of that *former* prefix. + * Anyway, set the new index of that prefix type to the current index, so next time we know its position. + */ + ps->unusedPrefixesMask |= ps->pfxIndexer[pi]; +} + +void prefixes_ignore_all(_PrefixState* ps); +uint16_t prefixes_set_unused_mask(_PrefixState* ps); +void prefixes_decode(_CodeInfo* ci, _PrefixState* ps); +void prefixes_use_segment(_iflags defaultSeg, _PrefixState* ps, _DecodeType dt, _DInst* di); + +#endif /* PREFIX_H */ diff --git a/NativeCore/Dependencies/distorm/src/textdefs.c b/NativeCore/Dependencies/distorm/src/textdefs.c new file mode 100644 index 00000000..cf56a8f6 --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/textdefs.c @@ -0,0 +1,116 @@ +/* +textdefs.c + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#include "textdefs.h" + +#ifndef DISTORM_LIGHT + +static uint8_t Nibble2ChrTable[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; +#define NIBBLE_TO_CHR Nibble2ChrTable[t] + +void str_hex(_WString* s, const uint8_t* buf, unsigned int len) +{ + /* 256 * 2 : 2 chars per byte value. */ + static const char* TextBTable = + "000102030405060708090a0b0c0d0e0f" \ + "101112131415161718191a1b1c1d1e1f" \ + "202122232425262728292a2b2c2d2e2f" \ + "303132333435363738393a3b3c3d3e3f" \ + "404142434445464748494a4b4c4d4e4f" \ + "505152535455565758595a5b5c5d5e5f" \ + "606162636465666768696a6b6c6d6e6f" \ + "707172737475767778797a7b7c7d7e7f" \ + "808182838485868788898a8b8c8d8e8f" \ + "909192939495969798999a9b9c9d9e9f" \ + "a0a1a2a3a4a5a6a7a8a9aaabacadaeaf" \ + "b0b1b2b3b4b5b6b7b8b9babbbcbdbebf" \ + "c0c1c2c3c4c5c6c7c8c9cacbcccdcecf" \ + "d0d1d2d3d4d5d6d7d8d9dadbdcdddedf" \ + "e0e1e2e3e4e5e6e7e8e9eaebecedeeef" \ + "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"; + + unsigned int i = 0; + /* Length is at least 1, enter loop. */ + s->length = len * 2; + s->p[len * 2] = 0; + do { + RSHORT(&s->p[i]) = RSHORT(&TextBTable[(*buf) * 2]); + buf++; + i += 2; + } while (i < len * 2); +} + +#ifdef SUPPORT_64BIT_OFFSET + +void str_int_impl(unsigned char** s, uint64_t x) +{ + int8_t* buf; + int shift = 0; + OFFSET_INTEGER t = x; + + buf = (int8_t*)*s; + + *buf++ = '0'; + *buf++ = 'x'; + + if (x == 0) { + *buf = '0'; + *s += 3; + return; + } + + do { + t >>= 4; + shift += 4; + } while (t); + + do { + shift -= 4; + t = (x >> shift) & 0xf; + *buf++ = NIBBLE_TO_CHR; + } while (shift > 0); + + *s = (unsigned char*)buf; +} + +#else + +void str_int_impl(unsigned char** s, uint8_t src[8]) +{ + int8_t* buf; + int i = 0, shift = 0; + uint32_t x = RULONG(&src[sizeof(int32_t)]); + int t; + + buf = (int8_t*)*s; + buf[0] = '0'; + buf[1] = 'x'; + buf += 2; + + for (shift = 28; shift != -4; shift -= 4) { + t = (x >> shift) & 0xf; + if (i | t) buf[i++] = NIBBLE_TO_CHR; + } + + x = RULONG(src); + for (shift = 28; shift != 0; shift -= 4) { + t = (x >> shift) & 0xf; + if (i | t) buf[i++] = NIBBLE_TO_CHR; + } + t = x & 0xf; + buf[i++] = NIBBLE_TO_CHR; + + *s += (size_t)(i + 2); +} + +#endif /* SUPPORT_64BIT_OFFSET */ + +#endif /* DISTORM_LIGHT */ diff --git a/NativeCore/Dependencies/distorm/src/textdefs.h b/NativeCore/Dependencies/distorm/src/textdefs.h new file mode 100644 index 00000000..27170bb3 --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/textdefs.h @@ -0,0 +1,58 @@ +/* +textdefs.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef TEXTDEFS_H +#define TEXTDEFS_H + +#include "config.h" +#include "wstring.h" + +#ifndef DISTORM_LIGHT + +#define PLUS_DISP_CHR '+' +#define MINUS_DISP_CHR '-' +#define OPEN_CHR '[' +#define CLOSE_CHR ']' +#define SP_CHR ' ' +#define SEG_OFF_CHR ':' + +/* +Naming Convention: + +* get - returns a pointer to a string. +* str - concatenates to string. + +* hex - means the function is used for hex dump (number is padded to required size) - Little Endian output. +* code - means the function is used for disassembled instruction - Big Endian output. +* off - means the function is used for 64bit offset - Big Endian output. + +* h - '0x' in front of the string. + +* b - byte +* dw - double word (can be used for word also) +* qw - quad word + +* all numbers are in HEX. +*/ + +void str_hex(_WString* s, const uint8_t* buf, unsigned int len); + +#ifdef SUPPORT_64BIT_OFFSET +#define str_int(s, x) str_int_impl((s), (x)) +void str_int_impl(unsigned char** s, uint64_t x); +#else +#define str_int(s, x) str_int_impl((s), (uint8_t*)&(x)) +void str_int_impl(unsigned char** s, uint8_t src[8]); +#endif + +#endif /* DISTORM_LIGHT */ + +#endif /* TEXTDEFS_H */ diff --git a/NativeCore/Dependencies/distorm/src/wstring.h b/NativeCore/Dependencies/distorm/src/wstring.h new file mode 100644 index 00000000..6303f90d --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/wstring.h @@ -0,0 +1,38 @@ +/* +wstring.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef WSTRING_H +#define WSTRING_H + +#include "config.h" +#include "../include/mnemonics.h" + +#ifndef DISTORM_LIGHT + +_INLINE_ void strcat_WSR(unsigned char** str, const _WRegister* reg) +{ + /* + * Longest register name is YMM15 - 5 characters, + * Copy 8 so compiler can do a QWORD move. + * We copy nul termination and fix the length, so it's okay to copy more to the output buffer. + * There's a sentinel register to make sure we don't read past the end of the registers table. + */ + memcpy((int8_t*)*str, (const int8_t*)reg->p, 8); + *str += reg->length; +} + +#define strfinalize_WS(s, end) do { *end = 0; s.length = (unsigned int)((size_t)end - (size_t)s.p); } while (0) +#define chrcat_WS(s, ch) do { *s = ch; s += 1; } while (0) +#define strcat_WS(s, buf, copylen, advancelen) do { memcpy((int8_t*)s, buf, copylen); s += advancelen; } while(0) + +#endif /* DISTORM_LIGHT */ + +#endif /* WSTRING_H */ diff --git a/NativeCore/Dependencies/distorm/src/x86defs.h b/NativeCore/Dependencies/distorm/src/x86defs.h new file mode 100644 index 00000000..8b7b5414 --- /dev/null +++ b/NativeCore/Dependencies/distorm/src/x86defs.h @@ -0,0 +1,82 @@ +/* +x86defs.h + +diStorm3 - Powerful disassembler for X86/AMD64 +http://ragestorm.net/distorm/ +distorm at gmail dot com +Copyright (C) 2003-2021 Gil Dabah +This library is licensed under the BSD license. See the file COPYING. +*/ + + +#ifndef X86DEFS_H +#define X86DEFS_H + + +#define SEG_REGS_MAX (6) +#define CREGS_MAX (9) +#define DREGS_MAX (8) + +/* Maximum instruction size, including prefixes */ +#define INST_MAXIMUM_SIZE (15) + +/* Maximum range of imm8 (comparison type) of special SSE CMP instructions. */ +#define INST_CMP_MAX_RANGE (8) + +/* Maximum range of imm8 (comparison type) of special AVX VCMP instructions. */ +#define INST_VCMP_MAX_RANGE (32) + +/* Wait instruction byte code. */ +#define INST_WAIT_INDEX (0x9b) + +/* Lea instruction byte code. */ +#define INST_LEA_INDEX (0x8d) + +/* NOP/XCHG instruction byte code. */ +#define INST_NOP_INDEX (0x90) + +/* ARPL/MOVSXD instruction byte code. */ +#define INST_ARPL_INDEX (0x63) + +/* + * Minimal MODR/M value of divided instructions. + * It's 0xc0, two MSBs set, which indicates a general purpose register is used too. + */ +#define INST_DIVIDED_MODRM (0xc0) + +/* This is the escape byte value used for 3DNow! instructions. */ +#define _3DNOW_ESCAPE_BYTE (0x0f) + +#define PREFIX_LOCK (0xf0) +#define PREFIX_REPNZ (0xf2) +#define PREFIX_REP (0xf3) +#define PREFIX_CS (0x2e) +#define PREFIX_SS (0x36) +#define PREFIX_DS (0x3e) +#define PREFIX_ES (0x26) +#define PREFIX_FS (0x64) +#define PREFIX_GS (0x65) +#define PREFIX_OP_SIZE (0x66) +#define PREFIX_ADDR_SIZE (0x67) +#define PREFIX_VEX2b (0xc5) +#define PREFIX_VEX3b (0xc4) + +/* REX prefix value range, 64 bits mode decoding only. */ +#define PREFIX_REX_LOW (0x40) +#define PREFIX_REX_HI (0x4f) +/* In order to use the extended GPR's we have to add 8 to the Modr/M info values. */ +#define EX_GPR_BASE (8) + +/* Mask for REX and VEX features: */ +/* Base */ +#define PREFIX_EX_B (1) +/* Index */ +#define PREFIX_EX_X (2) +/* Register */ +#define PREFIX_EX_R (4) +/* Operand Width */ +#define PREFIX_EX_W (8) +/* Vector Lengh */ +#define PREFIX_EX_L (0x10) + +#endif /* X86DEFS_H */ diff --git a/NativeCore/ReClassNET_Plugin.hpp b/NativeCore/ReClassNET_Plugin.hpp new file mode 100644 index 00000000..58e909e3 --- /dev/null +++ b/NativeCore/ReClassNET_Plugin.hpp @@ -0,0 +1,306 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +// OS Specific + +#ifdef __linux__ + #define RC_CallConv +#elif _WIN32 + #define RC_CallConv __stdcall +#else + static_assert(false, "Missing RC_CallConv specification"); +#endif + +// Types + +using RC_Pointer = void*; +using RC_Size = size_t; +using RC_UnicodeChar = char16_t; + +// Constants + +const int PATH_MAXIMUM_LENGTH = 260; + +// Enumerations + +enum class ProcessAccess +{ + Read, + Write, + Full +}; + +enum class SectionProtection +{ + NoAccess = 0, + + Read = 1, + Write = 2, + CopyOnWrite = 4, + Execute = 8, + + Guard = 16 +}; + +inline SectionProtection operator|(SectionProtection lhs, SectionProtection rhs) +{ + using T = std::underlying_type_t; + + return static_cast(static_cast(lhs) | static_cast(rhs)); +} + +inline SectionProtection& operator|=(SectionProtection& lhs, SectionProtection rhs) +{ + using T = std::underlying_type_t; + + lhs = static_cast(static_cast(lhs) | static_cast(rhs)); + + return lhs; +} + +enum class SectionType +{ + Unknown, + + Private, + Mapped, + Image +}; + +enum class SectionCategory +{ + Unknown, + CODE, + DATA, + HEAP +}; + +enum class ControlRemoteProcessAction +{ + Suspend, + Resume, + Terminate +}; + +enum class DebugContinueStatus +{ + Handled, + NotHandled +}; + +enum class HardwareBreakpointRegister +{ + InvalidRegister, + + Dr0, + Dr1, + Dr2, + Dr3 +}; + +enum class HardwareBreakpointTrigger +{ + Execute, + Access, + Write, +}; + +enum class HardwareBreakpointSize +{ + Size1 = 1, + Size2 = 2, + Size4 = 4, + Size8 = 8 +}; + +// Structures + +#pragma pack(push, 1) + +struct EnumerateProcessData +{ + RC_Size Id; + RC_UnicodeChar Name[PATH_MAXIMUM_LENGTH]; + RC_UnicodeChar Path[PATH_MAXIMUM_LENGTH]; +}; + +struct InstructionData +{ + RC_Pointer Address; + int Length; + uint8_t Data[15]; + int StaticInstructionBytes; + RC_UnicodeChar Instruction[64]; +}; + +struct EnumerateRemoteSectionData +{ + RC_Pointer BaseAddress; + RC_Size Size; + SectionType Type; + SectionCategory Category; + SectionProtection Protection; + RC_UnicodeChar Name[16]; + RC_UnicodeChar ModulePath[PATH_MAXIMUM_LENGTH]; +}; + +struct EnumerateRemoteModuleData +{ + RC_Pointer BaseAddress; + RC_Size Size; + RC_UnicodeChar Path[PATH_MAXIMUM_LENGTH]; +}; + +struct ExceptionDebugInfo +{ + RC_Size ExceptionCode; + RC_Size ExceptionFlags; + RC_Pointer ExceptionAddress; + + HardwareBreakpointRegister CausedBy; + + struct RegisterInfo + { +#ifdef RECLASSNET64 + RC_Pointer Rax; + RC_Pointer Rbx; + RC_Pointer Rcx; + RC_Pointer Rdx; + RC_Pointer Rdi; + RC_Pointer Rsi; + RC_Pointer Rsp; + RC_Pointer Rbp; + RC_Pointer Rip; + + RC_Pointer R8; + RC_Pointer R9; + RC_Pointer R10; + RC_Pointer R11; + RC_Pointer R12; + RC_Pointer R13; + RC_Pointer R14; + RC_Pointer R15; +#else + RC_Pointer Eax; + RC_Pointer Ebx; + RC_Pointer Ecx; + RC_Pointer Edx; + RC_Pointer Edi; + RC_Pointer Esi; + RC_Pointer Esp; + RC_Pointer Ebp; + RC_Pointer Eip; +#endif + }; + RegisterInfo Registers; +}; + +struct DebugEvent +{ + DebugContinueStatus ContinueStatus; + + RC_Pointer ProcessId; + RC_Pointer ThreadId; + + ExceptionDebugInfo ExceptionInfo; +}; + +struct DebugRegister6 +{ + union + { + uintptr_t Value; + struct + { + unsigned DR0 : 1; + unsigned DR1 : 1; + unsigned DR2 : 1; + unsigned DR3 : 1; + unsigned Reserved : 9; + unsigned BD : 1; + unsigned BS : 1; + unsigned BT : 1; + }; + }; +}; + +struct DebugRegister7 +{ + union + { + uintptr_t Value; + struct + { + unsigned G0 : 1; + unsigned L0 : 1; + unsigned G1 : 1; + unsigned L1 : 1; + unsigned G2 : 1; + unsigned L2 : 1; + unsigned G3 : 1; + unsigned L3 : 1; + unsigned GE : 1; + unsigned LE : 1; + unsigned Reserved : 6; + unsigned RW0 : 2; + unsigned Len0 : 2; + unsigned RW1 : 2; + unsigned Len1 : 2; + unsigned RW2 : 2; + unsigned Len2 : 2; + unsigned RW3 : 2; + unsigned Len3 : 2; + }; + }; +}; + +#pragma pack(pop) + +typedef void(RC_CallConv EnumerateProcessCallback)(EnumerateProcessData* data); + +typedef void(RC_CallConv EnumerateRemoteSectionsCallback)(EnumerateRemoteSectionData* data); +typedef void(RC_CallConv EnumerateRemoteModulesCallback)(EnumerateRemoteModuleData* data); + +// Helpers + +inline void MultiByteToUnicode(const char* src, const int srcOffset, RC_UnicodeChar* dst, const int dstOffset, const int size) +{ +#if _MSC_VER >= 1900 + // VS Bug: https://connect.microsoft.com/VisualStudio/feedback/details/1348277/link-error-when-using-std-codecvt-utf8-utf16-char16-t + + using converter = std::wstring_convert, int16_t>; +#else + using converter = std::wstring_convert, RC_UnicodeChar>; +#endif + + const auto temp = converter{}.from_bytes(src + srcOffset); + + std::memcpy(dst + dstOffset, temp.c_str(), std::min(static_cast(temp.length()), size) * sizeof(RC_UnicodeChar)); +} + +inline void MultiByteToUnicode(const char* src, RC_UnicodeChar* dst, const int size) +{ + MultiByteToUnicode(src, 0, dst, 0, size); +} + +inline char16_t* str16cpy(char16_t* destination, const char16_t* source, size_t n) +{ + char16_t* temp = destination; + while (n > 0 && *source != 0) + { + *temp++ = *source++; + --n; + } + while (n > 0) + { + *temp++ = 0; + --n; + } + return destination; +} diff --git a/NativeCore/Shared/DistormHelper.cpp b/NativeCore/Shared/DistormHelper.cpp new file mode 100644 index 00000000..092b1670 --- /dev/null +++ b/NativeCore/Shared/DistormHelper.cpp @@ -0,0 +1,184 @@ +#include "DistormHelper.hpp" + +#include +#include +extern "C" +{ +#include <../src/instructions.h> +} + +bool AreOperandsStatic(const _DInst &instruction, const int prefixLength) +{ + const auto fc = META_GET_FC(instruction.meta); + if (fc == FC_UNC_BRANCH || fc == FC_CND_BRANCH) + { + if (instruction.size - prefixLength < 5) + { + return true; + } + } + + const auto ops = instruction.ops; + for (auto i = 0; i < OPERANDS_NO; i++) + { + switch (ops[i].type) + { + case O_NONE: + case O_REG: + case O_IMM1: + case O_IMM2: + continue; + case O_IMM: + if (ops[i].size < 32) + { + continue; + } + return false; + case O_DISP: + case O_SMEM: + case O_MEM: + if (instruction.dispSize < 32) + { + continue; + } + +#ifdef RECLASSNET64 + if (ops[i].index == R_RIP) + { + continue; + } +#endif + return false; + case O_PC: + case O_PTR: + return false; + } + } + + return true; +} + +_CodeInfo CreateCodeInfo(const uint8_t* address, int length, const _OffsetType virtualAddress) +{ + _CodeInfo info = {}; + info.codeOffset = virtualAddress; + info.code = address; + info.codeLen = length; + info.features = DF_NONE; + +#ifdef RECLASSNET64 + info.dt = Decode64Bits; +#else + info.dt = Decode32Bits; +#endif + + return info; +} + + +int GetStaticInstructionBytes(const _DInst &instruction, const uint8_t *data) +{ + auto info = CreateCodeInfo(data, instruction.size, reinterpret_cast<_OffsetType>(data)); + + _PrefixState ps = {}; + int isPrefixed; + inst_lookup(&info, &ps, &isPrefixed); + + if (AreOperandsStatic(instruction, ps.count)) + { + return instruction.size; + } + + return instruction.size - info.codeLen - ps.count; +} + +void FillInstructionData(const _CodeInfo& info, const RC_Pointer address, const _DInst& instruction, const bool determineStaticInstructionBytes, InstructionData* data) +{ + data->Address = reinterpret_cast(instruction.addr); + data->Length = instruction.size; + std::memcpy(data->Data, address, instruction.size); + data->StaticInstructionBytes = -1; + + if (instruction.flags == FLAG_NOT_DECODABLE) + { + std::memcpy(data->Instruction, L"???", sizeof(RC_UnicodeChar) * 3); + } + else + { + _DecodedInst instructionInfo = {}; + distorm_format(&info, &instruction, &instructionInfo); + + MultiByteToUnicode( + reinterpret_cast(instructionInfo.mnemonic.p), + data->Instruction, + instructionInfo.mnemonic.length + ); + if (instructionInfo.operands.length != 0) + { + data->Instruction[instructionInfo.mnemonic.length] = ' '; + + MultiByteToUnicode( + reinterpret_cast(instructionInfo.operands.p), + 0, + data->Instruction, + instructionInfo.mnemonic.length + 1, + std::min(64 - 1 - instructionInfo.mnemonic.length, instructionInfo.operands.length) + ); + } + + if (determineStaticInstructionBytes) + { + data->StaticInstructionBytes = GetStaticInstructionBytes( + instruction, + reinterpret_cast(address) + ); + } + } +} + +bool DisassembleInstructionsImpl(const RC_Pointer address, const RC_Size length, const RC_Pointer virtualAddress, const bool determineStaticInstructionBytes, EnumerateInstructionCallback callback) +{ + auto info = CreateCodeInfo(static_cast(address), static_cast(length), reinterpret_cast<_OffsetType>(virtualAddress)); + + const unsigned MaxInstructions = 50; + + _DInst decodedInstructions[MaxInstructions] = {}; + unsigned count = 0; + + auto instructionAddress = static_cast(address); + + while (true) + { + const auto res = distorm_decompose(&info, decodedInstructions, MaxInstructions, &count); + if (res == DECRES_INPUTERR) + { + return false; + } + + for (auto i = 0u; i < count; ++i) + { + const auto& instruction = decodedInstructions[i]; + + InstructionData data = {}; + FillInstructionData(info, instructionAddress, instruction, determineStaticInstructionBytes, &data); + + if (callback(&data) == false) + { + return true; + } + + instructionAddress += instruction.size; + } + + if (res == DECRES_SUCCESS || count == 0) + { + return true; + } + + const auto offset = static_cast(decodedInstructions[count - 1].addr + decodedInstructions[count - 1].size - info.codeOffset); + + info.codeOffset += offset; + info.code += offset; + info.codeLen -= offset; + } +} diff --git a/NativeCore/Shared/DistormHelper.hpp b/NativeCore/Shared/DistormHelper.hpp new file mode 100644 index 00000000..04a5b673 --- /dev/null +++ b/NativeCore/Shared/DistormHelper.hpp @@ -0,0 +1,7 @@ +#pragma once + +#include "../ReClassNET_Plugin.hpp" + +typedef bool(RC_CallConv EnumerateInstructionCallback)(InstructionData* data); + +bool DisassembleInstructionsImpl(const RC_Pointer address, const RC_Size length, const RC_Pointer virtualAddress, const bool determineStaticInstructionBytes, EnumerateInstructionCallback callback); \ No newline at end of file diff --git a/NativeCore/Shared/Keys.hpp b/NativeCore/Shared/Keys.hpp new file mode 100644 index 00000000..98219446 --- /dev/null +++ b/NativeCore/Shared/Keys.hpp @@ -0,0 +1,210 @@ +#pragma once + +enum class Keys : int32_t +{ + None = 0, + LButton = 1, + RButton = 2, + Cancel = 3, + MButton = 4, + XButton1 = 5, + XButton2 = 6, + Back = 8, + Tab = 9, + LineFeed = 10, + Clear = 12, + Return = 13, + Enter = 13, + ShiftKey = 16, + ControlKey = 17, + Menu = 18, + Pause = 19, + Capital = 20, + CapsLock = 20, + KanaMode = 21, + HanguelMode = 21, + HangulMode = 21, + JunjaMode = 23, + FinalMode = 24, + HanjaMode = 25, + KanjiMode = 25, + Escape = 27, + IMEConvert = 28, + IMENonconvert = 29, + IMEAccept = 30, + IMEAceept = 30, + IMEModeChange = 31, + Space = 32, + Prior = 33, + PageUp = 33, + Next = 34, + PageDown = 34, + End = 35, + Home = 36, + Left = 37, + Up = 38, + Right = 39, + Down = 40, + Select = 41, + Print = 42, + Execute = 43, + Snapshot = 44, + PrintScreen = 44, + Insert = 45, + Delete = 46, + Help = 47, + D0 = 48, + D1 = 49, + D2 = 50, + D3 = 51, + D4 = 52, + D5 = 53, + D6 = 54, + D7 = 55, + D8 = 56, + D9 = 57, + A = 65, + B = 66, + C = 67, + D = 68, + E = 69, + F = 70, + G = 71, + H = 72, + I = 73, + J = 74, + K = 75, + L = 76, + M = 77, + N = 78, + O = 79, + P = 80, + Q = 81, + R = 82, + S = 83, + T = 84, + U = 85, + V = 86, + W = 87, + X = 88, + Y = 89, + Z = 90, + LWin = 91, + RWin = 92, + Apps = 93, + Sleep = 95, + NumPad0 = 96, + NumPad1 = 97, + NumPad2 = 98, + NumPad3 = 99, + NumPad4 = 100, + NumPad5 = 101, + NumPad6 = 102, + NumPad7 = 103, + NumPad8 = 104, + NumPad9 = 105, + Multiply = 106, + Add = 107, + Separator = 108, + Subtract = 109, + Decimal = 110, + Divide = 111, + F1 = 112, + F2 = 113, + F3 = 114, + F4 = 115, + F5 = 116, + F6 = 117, + F7 = 118, + F8 = 119, + F9 = 120, + F10 = 121, + F11 = 122, + F12 = 123, + F13 = 124, + F14 = 125, + F15 = 126, + F16 = 127, + F17 = 128, + F18 = 129, + F19 = 130, + F20 = 131, + F21 = 132, + F22 = 133, + F23 = 134, + F24 = 135, + NumLock = 144, + Scroll = 145, + LShiftKey = 160, + RShiftKey = 161, + LControlKey = 162, + RControlKey = 163, + LMenu = 164, + RMenu = 165, + BrowserBack = 166, + BrowserForward = 167, + BrowserRefresh = 168, + BrowserStop = 169, + BrowserSearch = 170, + BrowserFavorites = 171, + BrowserHome = 172, + VolumeMute = 173, + VolumeDown = 174, + VolumeUp = 175, + MediaNextTrack = 176, + MediaPreviousTrack = 177, + MediaStop = 178, + MediaPlayPause = 179, + LaunchMail = 180, + SelectMedia = 181, + LaunchApplication1 = 182, + LaunchApplication2 = 183, + OemSemicolon = 186, + Oem1 = 186, + OemPlus = 187, + OemComma = 188, + OemMinus = 189, + OemPeriod = 190, + OemQuestion = 191, + Oem2 = 191, + Oemtilde = 192, + Oem3 = 192, + OemOpenBrackets = 219, + Oem4 = 219, + OemPipe = 220, + Oem5 = 220, + OemCloseBrackets = 221, + Oem6 = 221, + OemQuotes = 222, + Oem7 = 222, + Oem8 = 223, + OemBackslash = 226, + Oem102 = 226, + ProcessKey = 229, + Packet = 231, + Attn = 246, + Crsel = 247, + Exsel = 248, + EraseEof = 249, + Play = 250, + Zoom = 251, + NoName = 252, + Pa1 = 253, + OemClear = 254, + + KeyCode = 65535, + Shift = 65536, + Control = 131072, + Alt = 262144, + + Modifiers = -65536 +}; + +inline Keys& operator|=(Keys& lhs, Keys rhs) +{ + using T = std::underlying_type_t; + + lhs = static_cast(static_cast(lhs) | static_cast(rhs)); + + return lhs; +} \ No newline at end of file diff --git a/NativeCore/Unix/CloseRemoteProcess.cpp b/NativeCore/Unix/CloseRemoteProcess.cpp new file mode 100644 index 00000000..cf5dc94b --- /dev/null +++ b/NativeCore/Unix/CloseRemoteProcess.cpp @@ -0,0 +1,6 @@ +#include "NativeCore.hpp" + +extern "C" void RC_CallConv CloseRemoteProcess(RC_Pointer handle) +{ + +} diff --git a/NativeCore/Unix/ControlRemoteProcess.cpp b/NativeCore/Unix/ControlRemoteProcess.cpp new file mode 100644 index 00000000..36c86945 --- /dev/null +++ b/NativeCore/Unix/ControlRemoteProcess.cpp @@ -0,0 +1,19 @@ +//#include +#include + +#include "NativeCore.hpp" + +extern "C" void RC_CallConv ControlRemoteProcess(RC_Pointer handle, ControlRemoteProcessAction action) +{ + int signal = SIGKILL; + if (action == ControlRemoteProcessAction::Suspend) + { + signal = SIGSTOP; + } + else if (action == ControlRemoteProcessAction::Resume) + { + signal = SIGCONT; + } + + kill(static_cast(reinterpret_cast(handle)), signal); +} diff --git a/NativeCore/Unix/Debugger.cpp b/NativeCore/Unix/Debugger.cpp new file mode 100644 index 00000000..a4a74241 --- /dev/null +++ b/NativeCore/Unix/Debugger.cpp @@ -0,0 +1,300 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "NativeCore.hpp" + +namespace fs = std::experimental::filesystem; + +int ualarm(unsigned int milliseconds) +{ + struct itimerval nval = { 0 }; + nval.it_value.tv_sec = milliseconds / 1000; + nval.it_value.tv_usec = static_cast(milliseconds % 1000) * 1000; + struct itimerval oval; + if (setitimer(ITIMER_REAL, &nval, &oval) < 0) + return 0; + else + return oval.it_value.tv_sec; +} + +pid_t waitpid_timeout(pid_t pid, int* status, int options, int timeoutInMilliseconds, bool& timedOut) +{ + struct sigaction sig = {}; + sig.sa_flags = 0; + sig.sa_handler = [](int) {}; + sigfillset(&sig.sa_mask); + sigaction(SIGALRM, &sig, nullptr); + + ualarm(timeoutInMilliseconds); + + auto res = waitpid(pid, status, options); + if (res == -1 && errno == EINTR) + { + timedOut = true; + } + else + { + ualarm(0); // Cancel the alarm. + + timedOut = false; + } + return res; +} + +pid_t waitpid_timeout(int* status, int timeoutInMilliseconds, bool& timedOut) +{ + return waitpid_timeout(-1, status, 0, timeoutInMilliseconds, timedOut); +} + +extern "C" bool RC_CallConv AttachDebuggerToProcess(RC_Pointer id) +{ + //TODO: Attach to all threads. + + ptrace(PTRACE_ATTACH, static_cast(reinterpret_cast(id)), nullptr, nullptr); + + waitpid(-1, nullptr, 0); + + ptrace(PTRACE_CONT, static_cast(reinterpret_cast(id)), nullptr, nullptr); + + return false; +} + +extern "C" void RC_CallConv DetachDebuggerFromProcess(RC_Pointer id) +{ + //TODO: Detach to all threads. + + ptrace(PTRACE_DETACH, static_cast(reinterpret_cast(id)), nullptr, nullptr); +} + +extern "C" bool RC_CallConv AwaitDebugEvent(DebugEvent* evt, int timeoutInMilliseconds) +{ + int status; + bool timedOut; + + auto tid = waitpid_timeout(&status, timeoutInMilliseconds, timedOut); + + if (timedOut) + { + return false; + } + + auto result = false; + + if (tid > 0) + { + evt->ThreadId = reinterpret_cast(static_cast(tid)); + + siginfo_t si; + if (ptrace(PTRACE_GETSIGINFO, tid, nullptr, &si) == 0) + { + if (si.si_signo == SIGTRAP) + { + struct user_regs_struct regs; + if (ptrace(PTRACE_GETREGS, tid, nullptr, ®s) == 0) + { + DebugRegister6 dr6; + dr6.Value = ptrace(PTRACE_PEEKUSER, tid, offsetof(struct user, u_debugreg[6]), nullptr); + + // Check if breakpoint was a hardware breakpoint. + if (dr6.DR0) + { + evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::Dr0; + } + else if (dr6.DR1) + { + evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::Dr1; + } + else if (dr6.DR2) + { + evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::Dr2; + } + else if (dr6.DR3) + { + evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::Dr3; + } + else + { + evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::InvalidRegister; + } + + // Copy registers. + auto& reg = evt->ExceptionInfo.Registers; +#ifdef RECLASSNET64 + reg.Rax = reinterpret_cast(regs.rax); + reg.Rbx = reinterpret_cast(regs.rbx); + reg.Rcx = reinterpret_cast(regs.rcx); + reg.Rdx = reinterpret_cast(regs.rdx); + reg.Rdi = reinterpret_cast(regs.rdi); + reg.Rsi = reinterpret_cast(regs.rsi); + reg.Rsp = reinterpret_cast(regs.rsp); + reg.Rbp = reinterpret_cast(regs.rbp); + reg.Rip = reinterpret_cast(regs.rip); + + reg.R8 = reinterpret_cast(regs.r8); + reg.R9 = reinterpret_cast(regs.r9); + reg.R10 = reinterpret_cast(regs.r10); + reg.R11 = reinterpret_cast(regs.r11); + reg.R12 = reinterpret_cast(regs.r12); + reg.R13 = reinterpret_cast(regs.r13); + reg.R14 = reinterpret_cast(regs.r14); + reg.R15 = reinterpret_cast(regs.r15); +#else + reg.Eax = reinterpret_cast(regs.eax); + reg.Ebx = reinterpret_cast(regs.ebx); + reg.Ecx = reinterpret_cast(regs.ecx); + reg.Edx = reinterpret_cast(regs.edx); + reg.Edi = reinterpret_cast(regs.edi); + reg.Esi = reinterpret_cast(regs.esi); + reg.Esp = reinterpret_cast(regs.esp); + reg.Ebp = reinterpret_cast(regs.ebp); + reg.Eip = reinterpret_cast(regs.eip); +#endif + + result = true; + } + } + + if (result == false) + { + ptrace(PTRACE_CONT, tid, nullptr, si.si_signo); + } + } + } + + return result; +} + +extern "C" void RC_CallConv HandleDebugEvent(DebugEvent* evt) +{ + auto tid = static_cast(reinterpret_cast(evt->ThreadId)); + + siginfo_t si; + if (ptrace(PTRACE_GETSIGINFO, tid, 0, &si) == 0) + { + auto signal = 0; + switch (evt->ContinueStatus) + { + case DebugContinueStatus::Handled: + signal = 0; + break; + case DebugContinueStatus::NotHandled: + signal = si.si_signo; + break; + } + + if (signal == SIGSTOP) + { + signal = 0; + } + + ptrace(PTRACE_CONT, tid, nullptr, signal); + } +} + +extern "C" bool RC_CallConv SetHardwareBreakpoint(RC_Pointer id, RC_Pointer address, HardwareBreakpointRegister reg, HardwareBreakpointTrigger type, HardwareBreakpointSize size, bool set) +{ + if (reg == HardwareBreakpointRegister::InvalidRegister) + { + return false; + } + + intptr_t addressValue = 0; + auto accessValue = 0; + auto lengthValue = 0; + + if (set) + { + addressValue = reinterpret_cast(address); + + if (type == HardwareBreakpointTrigger::Execute) + accessValue = 0; + else if (type == HardwareBreakpointTrigger::Access) + accessValue = 3; + else if (type == HardwareBreakpointTrigger::Write) + accessValue = 1; + + if (size == HardwareBreakpointSize::Size1) + lengthValue = 0; + else if (size == HardwareBreakpointSize::Size2) + lengthValue = 1; + else if (size == HardwareBreakpointSize::Size4) + lengthValue = 3; + else if (size == HardwareBreakpointSize::Size8) + lengthValue = 2; + } + + auto tasksPath = fs::path("/proc") / std::to_string(reinterpret_cast(id)) / "task"; + if (fs::is_directory(tasksPath)) + { + for (auto& d : fs::directory_iterator(tasksPath)) + { + if (fs::is_directory(d)) + { + auto taskPath = d.path(); + + auto name = taskPath.filename().string(); + if (is_number(name)) + { + auto tid = parse_type(name); + + // Stop the thread. TODO: Check if the thread was already paused. + for (int i = 0; i < 10; ++i) + { + kill(tid, SIGSTOP); + + bool timedOut; + waitpid_timeout(tid, nullptr, 0, 100, timedOut); + if (!timedOut) + { + break; + } + } + + DebugRegister7 dr7; + dr7.Value = ptrace(PTRACE_PEEKUSER, tid, offsetof(struct user, u_debugreg[7]), nullptr); + + intptr_t registerAddress; + switch (reg) + { + case HardwareBreakpointRegister::Dr0: + registerAddress = offsetof(struct user, u_debugreg[0]); + dr7.G0 = true; + dr7.RW0 = accessValue; + dr7.Len0 = lengthValue; + break; + case HardwareBreakpointRegister::Dr1: + registerAddress = offsetof(struct user, u_debugreg[1]); + dr7.G1 = true; + dr7.RW1 = accessValue; + dr7.Len1 = lengthValue; + break; + case HardwareBreakpointRegister::Dr2: + registerAddress = offsetof(struct user, u_debugreg[2]); + dr7.G2 = true; + dr7.RW2 = accessValue; + dr7.Len2 = lengthValue; + break; + case HardwareBreakpointRegister::Dr3: + registerAddress = offsetof(struct user, u_debugreg[3]); + dr7.G3 = true; + dr7.RW3 = accessValue; + dr7.Len3 = lengthValue; + break; + } + + ptrace(PTRACE_POKEUSER, tid, registerAddress, addressValue); + ptrace(PTRACE_POKEUSER, tid, offsetof(struct user, u_debugreg[7]), dr7.Value); + + ptrace(PTRACE_CONT, tid, nullptr, nullptr); + } + } + } + } + + return true; +} diff --git a/NativeCore/Unix/DisassembleCode.cpp b/NativeCore/Unix/DisassembleCode.cpp new file mode 100644 index 00000000..9c2cc5af --- /dev/null +++ b/NativeCore/Unix/DisassembleCode.cpp @@ -0,0 +1,6 @@ +#include "../Shared/DistormHelper.hpp" + +extern "C" bool RC_CallConv DisassembleCode(RC_Pointer address, RC_Size length, RC_Pointer virtualAddress, bool determineStaticInstructionBytes, EnumerateInstructionCallback callback) +{ + return DisassembleInstructionsImpl(address, length, virtualAddress, determineStaticInstructionBytes, callback); +} diff --git a/NativeCore/Unix/EnumerateProcesses.cpp b/NativeCore/Unix/EnumerateProcesses.cpp new file mode 100644 index 00000000..f04bcaf1 --- /dev/null +++ b/NativeCore/Unix/EnumerateProcesses.cpp @@ -0,0 +1,137 @@ +#include +#include +#include +#include +#include + +#include "NativeCore.hpp" + +namespace fs = std::experimental::filesystem; + +// std::filesystem library doesn't work @Ubuntu 16.10, read_symlink() always fails. +#define USE_CUSTOM_READ_SYMLINK + +#ifdef USE_CUSTOM_READ_SYMLINK +#include + +fs::path my_read_symlink(const fs::path& p, std::error_code& ec) +{ + fs::path symlink_path; + + std::string temp(64, '\0'); + for (;; temp.resize(temp.size() * 2)) + { + ssize_t result; + if ((result = ::readlink(p.c_str(), /*temp.data()*/ &temp[0], temp.size())) == -1) + { + ec.assign(errno, std::system_category()); + break; + } + else + { + if (result != static_cast(temp.size())) + { + symlink_path = fs::path(std::string(temp.begin(), temp.begin() + result)); + + ec.clear(); + + break; + } + } + } + + return symlink_path; +} + +#endif + +enum class Platform +{ + Unknown, + X86, + X64 +}; + +Platform GetProcessPlatform(const std::string& auxvPath) +{ + auto platform = Platform::Unknown; + + std::ifstream file(auxvPath); + if (file) + { + char buffer[16]; + while (true) + { + file.read(buffer, 16); + + if (!file) + { + return Platform::X64; + } + + if (buffer[4] != 0 || buffer[5] != 0 || buffer[6] != 0 || buffer[7] != 0) + { + return Platform::X86; + } + } + } + + return platform; +} + +extern "C" void RC_CallConv EnumerateProcesses(EnumerateProcessCallback callbackProcess) +{ + if (callbackProcess == nullptr) + { + return; + } + + fs::path procPath("/proc"); + if (fs::is_directory(procPath)) + { + for (auto& d : fs::directory_iterator(procPath)) + { + if (fs::is_directory(d)) + { + auto processPath = d.path(); + + auto name = processPath.filename().string(); + if (is_number(name)) + { + auto exeSymLink = processPath / "exe"; + if (fs::is_symlink(fs::symlink_status(exeSymLink))) + { + std::error_code ec; + auto linkPath = +#ifdef USE_CUSTOM_READ_SYMLINK + my_read_symlink +#else + read_symlink +#endif + (exeSymLink, ec).string(); + if (!ec) + { + auto auxvPath = processPath / "auxv"; + + auto platform = GetProcessPlatform(auxvPath.string()); +#ifdef RECLASSNET64 + if (platform == Platform::X64) +#else + if (platform == Platform::X86) +#endif + { + EnumerateProcessData data = {}; + data.Id = parse_type(name); + MultiByteToUnicode(linkPath.c_str(), data.Path, PATH_MAXIMUM_LENGTH); + const auto name = fs::path(data.Path).filename().u16string(); + str16cpy(data.Name, name.c_str(), std::min(name.length(), PATH_MAXIMUM_LENGTH - 1)); + + callbackProcess(&data); + } + } + } + } + } + } + } +} diff --git a/NativeCore/Unix/EnumerateRemoteSectionsAndModules.cpp b/NativeCore/Unix/EnumerateRemoteSectionsAndModules.cpp new file mode 100644 index 00000000..9d821cfe --- /dev/null +++ b/NativeCore/Unix/EnumerateRemoteSectionsAndModules.cpp @@ -0,0 +1,131 @@ +#include +#include +#include + +#include "NativeCore.hpp" + +inline bool operator&(SectionProtection& lhs, SectionProtection rhs) +{ + using T = std::underlying_type_t; + + return (static_cast(lhs) & static_cast(rhs)) == static_cast(rhs); +} + +template +inline std::istream& skip(std::istream& s) +{ + auto f = s.flags(); + s >> std::noskipws; + + T t; + s >> t; + + s.flags(f); + + return s; +} + +std::istream& operator >> (std::istream& s, SectionProtection& protection) +{ + protection = SectionProtection::NoAccess; + + if (s.get() == 'r') protection |= SectionProtection::Read; + if (s.get() == 'w') protection |= SectionProtection::Write; + if (s.get() == 'x') protection |= SectionProtection::Execute; + + return s; +} + +extern "C" void RC_CallConv EnumerateRemoteSectionsAndModules(RC_Pointer handle, EnumerateRemoteSectionsCallback callbackSection, EnumerateRemoteModulesCallback callbackModule) +{ + if (callbackSection == nullptr && callbackModule == nullptr) + { + return; + } + + struct ModuleInfo + { + intptr_t Start = 0; + intptr_t End = 0; + RC_UnicodeChar Path[PATH_MAXIMUM_LENGTH] = {}; + }; + + auto path = std::stringstream(); + path << "/proc/" << reinterpret_cast(handle) << "/maps"; + std::ifstream input(path.str()); + + std::unordered_map modules; + + std::string line; + while (std::getline(input, line)) + { + std::stringstream ss(line); + + intptr_t start; + intptr_t end; + SectionProtection protection; + intptr_t offset; + int dev1, dev2; + int inode; + std::string path; + ss >> std::hex >> start >> skip >> end >> skip >> protection >> skip >> offset >> dev1 >> skip >> dev2 >> std::dec >> inode >> std::skipws >> path; + + EnumerateRemoteSectionData section = {}; + section.BaseAddress = reinterpret_cast(start); + section.Size = end - start; + section.Protection = protection; + + section.Category = SectionCategory::Unknown; + section.Type = SectionType::Unknown; + if (inode != 0) + { + section.Type = SectionType::Image; + + if (protection & SectionProtection::Read && protection & SectionProtection::Execute) + { + section.Category = SectionCategory::CODE; + } + else if (protection & SectionProtection::Read && protection & SectionProtection::Write) + { + section.Category = SectionCategory::DATA; + } + + MultiByteToUnicode(path.c_str(), section.ModulePath, PATH_MAXIMUM_LENGTH); + + auto& module = modules[inode]; + module.Start = module.Start != 0 ? std::min(module.Start, start) : start; + module.End = module.End != 0 ? std::max(module.End, end) : end; + if (module.Path[0] == 0) + { + std::memcpy(module.Path, section.ModulePath, PATH_MAXIMUM_LENGTH); + } + } + else + { + section.Type = SectionType::Mapped; + + if (protection & SectionProtection::Read || protection & SectionProtection::Write) + { + section.Category = SectionCategory::HEAP; + } + } + + if (callbackSection != nullptr) + { + callbackSection(§ion); + } + } + + if (callbackModule != nullptr) + { + for (auto&& kv : modules) + { + EnumerateRemoteModuleData module = {}; + module.BaseAddress = reinterpret_cast(kv.second.Start); + module.Size = kv.second.End - kv.second.Start; + std::memcpy(module.Path, kv.second.Path, PATH_MAXIMUM_LENGTH); + + callbackModule(&module); + } + } +} diff --git a/NativeCore/Unix/Input.cpp b/NativeCore/Unix/Input.cpp new file mode 100644 index 00000000..dc17d856 --- /dev/null +++ b/NativeCore/Unix/Input.cpp @@ -0,0 +1,17 @@ +#include "NativeCore.hpp" +#include "../Shared/Keys.hpp" + +RC_Pointer RC_CallConv InitializeInput() +{ + return nullptr; +} + +bool RC_CallConv GetPressedKeys(RC_Pointer handle, Keys* state[], int* count) +{ + return false; +} + +void RC_CallConv ReleaseInput(RC_Pointer handle) +{ + +} diff --git a/NativeCore/Unix/IsProcessValid.cpp b/NativeCore/Unix/IsProcessValid.cpp new file mode 100644 index 00000000..f72b7c90 --- /dev/null +++ b/NativeCore/Unix/IsProcessValid.cpp @@ -0,0 +1,9 @@ +#include +#include + +#include "NativeCore.hpp" + +extern "C" bool RC_CallConv IsProcessValid(RC_Pointer handle) +{ + return kill(static_cast(reinterpret_cast(handle)), 0) == 0; +} diff --git a/NativeCore/Unix/Makefile b/NativeCore/Unix/Makefile new file mode 100644 index 00000000..f18ff1fb --- /dev/null +++ b/NativeCore/Unix/Makefile @@ -0,0 +1,344 @@ +WORKDIR = `pwd` + +CC = gcc +CXX = gcc +AR = ar +LD = g++ +WINDRES = windres + +INC = -I../Dependencies/distorm/include +CFLAGS32 = -Wall -fPIC -m32 +CFLAGS64 = -Wall -fPIC -m64 -DRECLASSNET64=1 +RESINC = +LIBDIR = +LIB = -lstdc++fs -lstdc++ +LDFLAGS32 = -m32 -shared -Wl,--no-undefined +LDFLAGS64 = -m64 -shared -Wl,--no-undefined + +INC_DEBUG = $(INC) +CFLAGS32_DEBUG = $(CFLAGS32) -g +CFLAGS64_DEBUG = $(CFLAGS64) -g +RESINC_DEBUG = $(RESINC) +RCFLAGS_DEBUG = $(RCFLAGS) +LIBDIR_DEBUG = $(LIBDIR) +LIB_DEBUG = $(LIB) +LDFLAGS32_DEBUG = $(LDFLAGS32) +LDFLAGS64_DEBUG = $(LDFLAGS64) +OBJDIR32_DEBUG = obj/debug/x86 +OBJDIR64_DEBUG = obj/debug/x64 +DEP_DEBUG = +OUT32_DEBUG = build/debug/x86/NativeCore.so +OUT64_DEBUG = build/debug/x64/NativeCore.so + +INC_RELEASE = $(INC) +CFLAGS32_RELEASE = $(CFLAGS32) -O2 +CFLAGS64_RELEASE = $(CFLAGS64) -O2 +RESINC_RELEASE = $(RESINC) +RCFLAGS_RELEASE = $(RCFLAGS) +LIBDIR_RELEASE = $(LIBDIR) +LIB_RELEASE = $(LIB) +LDFLAGS32_RELEASE = $(LDFLAGS32) -s +LDFLAGS64_RELEASE = $(LDFLAGS64) -s +OBJDIR32_RELEASE = obj/release/x86 +OBJDIR64_RELEASE = obj/release/x64 +DEP_RELEASE = +OUT32_RELEASE = build/release/x86/NativeCore.so +OUT64_RELEASE = build/release/x64/NativeCore.so + +OBJ32_DEBUG = $(OBJDIR32_DEBUG)/WriteRemoteMemory.o $(OBJDIR32_DEBUG)/ReadRemoteMemory.o $(OBJDIR32_DEBUG)/OpenRemoteProcess.o $(OBJDIR32_DEBUG)/IsProcessValid.o $(OBJDIR32_DEBUG)/Input.o $(OBJDIR32_DEBUG)/EnumerateRemoteSectionsAndModules.o $(OBJDIR32_DEBUG)/EnumerateProcesses.o $(OBJDIR32_DEBUG)/DisassembleCode.o $(OBJDIR32_DEBUG)/DistormHelper.o $(OBJDIR32_DEBUG)/Debugger.o $(OBJDIR32_DEBUG)/ControlRemoteProcess.o $(OBJDIR32_DEBUG)/CloseRemoteProcess.o $(OBJDIR32_DEBUG)/decoder.o $(OBJDIR32_DEBUG)/distorm.o $(OBJDIR32_DEBUG)/instructions.o $(OBJDIR32_DEBUG)/insts.o $(OBJDIR32_DEBUG)/mnemonics.o $(OBJDIR32_DEBUG)/operands.o $(OBJDIR32_DEBUG)/prefix.o $(OBJDIR32_DEBUG)/textdefs.o +OBJ64_DEBUG = $(OBJDIR64_DEBUG)/WriteRemoteMemory.o $(OBJDIR64_DEBUG)/ReadRemoteMemory.o $(OBJDIR64_DEBUG)/OpenRemoteProcess.o $(OBJDIR64_DEBUG)/IsProcessValid.o $(OBJDIR64_DEBUG)/Input.o $(OBJDIR64_DEBUG)/EnumerateRemoteSectionsAndModules.o $(OBJDIR64_DEBUG)/EnumerateProcesses.o $(OBJDIR64_DEBUG)/DisassembleCode.o $(OBJDIR64_DEBUG)/DistormHelper.o $(OBJDIR64_DEBUG)/Debugger.o $(OBJDIR64_DEBUG)/ControlRemoteProcess.o $(OBJDIR64_DEBUG)/CloseRemoteProcess.o $(OBJDIR64_DEBUG)/decoder.o $(OBJDIR64_DEBUG)/distorm.o $(OBJDIR64_DEBUG)/instructions.o $(OBJDIR64_DEBUG)/insts.o $(OBJDIR64_DEBUG)/mnemonics.o $(OBJDIR64_DEBUG)/operands.o $(OBJDIR64_DEBUG)/prefix.o $(OBJDIR64_DEBUG)/textdefs.o + +OBJ32_RELEASE = $(OBJDIR32_RELEASE)/WriteRemoteMemory.o $(OBJDIR32_RELEASE)/ReadRemoteMemory.o $(OBJDIR32_RELEASE)/OpenRemoteProcess.o $(OBJDIR32_RELEASE)/IsProcessValid.o $(OBJDIR32_RELEASE)/Input.o $(OBJDIR32_RELEASE)/EnumerateRemoteSectionsAndModules.o $(OBJDIR32_RELEASE)/EnumerateProcesses.o $(OBJDIR32_RELEASE)/DisassembleCode.o $(OBJDIR32_RELEASE)/DistormHelper.o $(OBJDIR32_RELEASE)/Debugger.o $(OBJDIR32_RELEASE)/ControlRemoteProcess.o $(OBJDIR32_RELEASE)/CloseRemoteProcess.o $(OBJDIR32_RELEASE)/decoder.o $(OBJDIR32_RELEASE)/distorm.o $(OBJDIR32_RELEASE)/instructions.o $(OBJDIR32_RELEASE)/insts.o $(OBJDIR32_RELEASE)/mnemonics.o $(OBJDIR32_RELEASE)/operands.o $(OBJDIR32_RELEASE)/prefix.o $(OBJDIR32_RELEASE)/textdefs.o +OBJ64_RELEASE = $(OBJDIR64_RELEASE)/WriteRemoteMemory.o $(OBJDIR64_RELEASE)/ReadRemoteMemory.o $(OBJDIR64_RELEASE)/OpenRemoteProcess.o $(OBJDIR64_RELEASE)/IsProcessValid.o $(OBJDIR64_RELEASE)/Input.o $(OBJDIR64_RELEASE)/EnumerateRemoteSectionsAndModules.o $(OBJDIR64_RELEASE)/EnumerateProcesses.o $(OBJDIR64_RELEASE)/DisassembleCode.o $(OBJDIR64_RELEASE)/DistormHelper.o $(OBJDIR64_RELEASE)/Debugger.o $(OBJDIR64_RELEASE)/ControlRemoteProcess.o $(OBJDIR64_RELEASE)/CloseRemoteProcess.o $(OBJDIR64_RELEASE)/decoder.o $(OBJDIR64_RELEASE)/distorm.o $(OBJDIR64_RELEASE)/instructions.o $(OBJDIR64_RELEASE)/insts.o $(OBJDIR64_RELEASE)/mnemonics.o $(OBJDIR64_RELEASE)/operands.o $(OBJDIR64_RELEASE)/prefix.o $(OBJDIR64_RELEASE)/textdefs.o + +all: debug release + +clean: clean_debug clean_release + +before_debug: + test -d build/debug/x86 || mkdir -p build/debug/x86 + test -d build/debug/x64 || mkdir -p build/debug/x64 + test -d $(OBJDIR32_DEBUG) || mkdir -p $(OBJDIR32_DEBUG) + test -d $(OBJDIR64_DEBUG) || mkdir -p $(OBJDIR64_DEBUG) + +after_debug: + +debug: before_debug out_debug32 out_debug64 after_debug + +out_debug32: before_debug $(OBJ32_DEBUG) $(DEP_DEBUG) + $(CXX) $(LIBDIR_DEBUG) -o $(OUT32_DEBUG) $(OBJ32_DEBUG) $(LDFLAGS32_DEBUG) $(LIB_DEBUG) + +$(OBJDIR32_DEBUG)/WriteRemoteMemory.o: WriteRemoteMemory.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c WriteRemoteMemory.cpp -o $(OBJDIR32_DEBUG)/WriteRemoteMemory.o + +$(OBJDIR32_DEBUG)/ReadRemoteMemory.o: ReadRemoteMemory.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ReadRemoteMemory.cpp -o $(OBJDIR32_DEBUG)/ReadRemoteMemory.o + +$(OBJDIR32_DEBUG)/OpenRemoteProcess.o: OpenRemoteProcess.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c OpenRemoteProcess.cpp -o $(OBJDIR32_DEBUG)/OpenRemoteProcess.o + +$(OBJDIR32_DEBUG)/IsProcessValid.o: IsProcessValid.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c IsProcessValid.cpp -o $(OBJDIR32_DEBUG)/IsProcessValid.o + +$(OBJDIR32_DEBUG)/Input.o: Input.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c Input.cpp -o $(OBJDIR32_DEBUG)/Input.o + +$(OBJDIR32_DEBUG)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR32_DEBUG)/EnumerateRemoteSectionsAndModules.o + +$(OBJDIR32_DEBUG)/EnumerateProcesses.o: EnumerateProcesses.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c EnumerateProcesses.cpp -o $(OBJDIR32_DEBUG)/EnumerateProcesses.o + +$(OBJDIR32_DEBUG)/DisassembleCode.o: DisassembleCode.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c DisassembleCode.cpp -o $(OBJDIR32_DEBUG)/DisassembleCode.o + +$(OBJDIR32_DEBUG)/DistormHelper.o: ../Shared/DistormHelper.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Shared/DistormHelper.cpp -o $(OBJDIR32_DEBUG)/DistormHelper.o + +$(OBJDIR32_DEBUG)/Debugger.o: Debugger.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c Debugger.cpp -o $(OBJDIR32_DEBUG)/Debugger.o + +$(OBJDIR32_DEBUG)/ControlRemoteProcess.o: ControlRemoteProcess.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ControlRemoteProcess.cpp -o $(OBJDIR32_DEBUG)/ControlRemoteProcess.o + +$(OBJDIR32_DEBUG)/CloseRemoteProcess.o: CloseRemoteProcess.cpp + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c CloseRemoteProcess.cpp -o $(OBJDIR32_DEBUG)/CloseRemoteProcess.o + +$(OBJDIR32_DEBUG)/decoder.o: ../Dependencies/distorm/src/decoder.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR32_DEBUG)/decoder.o + +$(OBJDIR32_DEBUG)/distorm.o: ../Dependencies/distorm/src/distorm.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR32_DEBUG)/distorm.o + +$(OBJDIR32_DEBUG)/instructions.o: ../Dependencies/distorm/src/instructions.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR32_DEBUG)/instructions.o + +$(OBJDIR32_DEBUG)/insts.o: ../Dependencies/distorm/src/insts.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR32_DEBUG)/insts.o + +$(OBJDIR32_DEBUG)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR32_DEBUG)/mnemonics.o + +$(OBJDIR32_DEBUG)/operands.o: ../Dependencies/distorm/src/operands.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR32_DEBUG)/operands.o + +$(OBJDIR32_DEBUG)/prefix.o: ../Dependencies/distorm/src/prefix.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR32_DEBUG)/prefix.o + +$(OBJDIR32_DEBUG)/textdefs.o: ../Dependencies/distorm/src/textdefs.c + $(CXX) $(CFLAGS32_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR32_DEBUG)/textdefs.o + +out_debug64: before_debug $(OBJ64_DEBUG) $(DEP_DEBUG) + $(CXX) $(LIBDIR_DEBUG) -o $(OUT64_DEBUG) $(OBJ64_DEBUG) $(LDFLAGS64_DEBUG) $(LIB_DEBUG) + +$(OBJDIR64_DEBUG)/WriteRemoteMemory.o: WriteRemoteMemory.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c WriteRemoteMemory.cpp -o $(OBJDIR64_DEBUG)/WriteRemoteMemory.o + +$(OBJDIR64_DEBUG)/ReadRemoteMemory.o: ReadRemoteMemory.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ReadRemoteMemory.cpp -o $(OBJDIR64_DEBUG)/ReadRemoteMemory.o + +$(OBJDIR64_DEBUG)/OpenRemoteProcess.o: OpenRemoteProcess.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c OpenRemoteProcess.cpp -o $(OBJDIR64_DEBUG)/OpenRemoteProcess.o + +$(OBJDIR64_DEBUG)/IsProcessValid.o: IsProcessValid.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c IsProcessValid.cpp -o $(OBJDIR64_DEBUG)/IsProcessValid.o + +$(OBJDIR64_DEBUG)/Input.o: Input.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c Input.cpp -o $(OBJDIR64_DEBUG)/Input.o + +$(OBJDIR64_DEBUG)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR64_DEBUG)/EnumerateRemoteSectionsAndModules.o + +$(OBJDIR64_DEBUG)/EnumerateProcesses.o: EnumerateProcesses.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c EnumerateProcesses.cpp -o $(OBJDIR64_DEBUG)/EnumerateProcesses.o + +$(OBJDIR64_DEBUG)/DisassembleCode.o: DisassembleCode.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c DisassembleCode.cpp -o $(OBJDIR64_DEBUG)/DisassembleCode.o + +$(OBJDIR64_DEBUG)/DistormHelper.o: ../Shared/DistormHelper.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Shared/DistormHelper.cpp -o $(OBJDIR64_DEBUG)/DistormHelper.o + +$(OBJDIR64_DEBUG)/Debugger.o: Debugger.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c Debugger.cpp -o $(OBJDIR64_DEBUG)/Debugger.o + +$(OBJDIR64_DEBUG)/ControlRemoteProcess.o: ControlRemoteProcess.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ControlRemoteProcess.cpp -o $(OBJDIR64_DEBUG)/ControlRemoteProcess.o + +$(OBJDIR64_DEBUG)/CloseRemoteProcess.o: CloseRemoteProcess.cpp + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c CloseRemoteProcess.cpp -o $(OBJDIR64_DEBUG)/CloseRemoteProcess.o + +$(OBJDIR64_DEBUG)/decoder.o: ../Dependencies/distorm/src/decoder.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR64_DEBUG)/decoder.o + +$(OBJDIR64_DEBUG)/distorm.o: ../Dependencies/distorm/src/distorm.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR64_DEBUG)/distorm.o + +$(OBJDIR64_DEBUG)/instructions.o: ../Dependencies/distorm/src/instructions.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR64_DEBUG)/instructions.o + +$(OBJDIR64_DEBUG)/insts.o: ../Dependencies/distorm/src/insts.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR64_DEBUG)/insts.o + +$(OBJDIR64_DEBUG)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR64_DEBUG)/mnemonics.o + +$(OBJDIR64_DEBUG)/operands.o: ../Dependencies/distorm/src/operands.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR64_DEBUG)/operands.o + +$(OBJDIR64_DEBUG)/prefix.o: ../Dependencies/distorm/src/prefix.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR64_DEBUG)/prefix.o + +$(OBJDIR64_DEBUG)/textdefs.o: ../Dependencies/distorm/src/textdefs.c + $(CXX) $(CFLAGS64_DEBUG) $(INC_DEBUG) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR64_DEBUG)/textdefs.o + +clean_debug: + rm -f $(OBJ32_DEBUG) $(OUT32_DEBUG) + rm -f $(OBJ64_DEBUG) $(OUT64_DEBUG) + rm -rf build/debug + rm -rf $(OBJDIR32_DEBUG) + rm -rf $(OBJDIR64_DEBUG) + +before_release: + test -d build/release/x86 || mkdir -p build/release/x86 + test -d build/release/x64 || mkdir -p build/release/x64 + test -d $(OBJDIR32_RELEASE) || mkdir -p $(OBJDIR32_RELEASE) + test -d $(OBJDIR64_RELEASE) || mkdir -p $(OBJDIR64_RELEASE) + +after_release: + +release: before_release out_release32 out_release64 after_release + +out_release32: before_release $(OBJ32_RELEASE) $(DEP_RELEASE) + $(CXX) $(LIBDIR_RELEASE) -o $(OUT32_RELEASE) $(OBJ32_RELEASE) $(LDFLAGS32_RELEASE) $(LIB_RELEASE) + +$(OBJDIR32_RELEASE)/WriteRemoteMemory.o: WriteRemoteMemory.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c WriteRemoteMemory.cpp -o $(OBJDIR32_RELEASE)/WriteRemoteMemory.o + +$(OBJDIR32_RELEASE)/ReadRemoteMemory.o: ReadRemoteMemory.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ReadRemoteMemory.cpp -o $(OBJDIR32_RELEASE)/ReadRemoteMemory.o + +$(OBJDIR32_RELEASE)/OpenRemoteProcess.o: OpenRemoteProcess.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c OpenRemoteProcess.cpp -o $(OBJDIR32_RELEASE)/OpenRemoteProcess.o + +$(OBJDIR32_RELEASE)/IsProcessValid.o: IsProcessValid.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c IsProcessValid.cpp -o $(OBJDIR32_RELEASE)/IsProcessValid.o + +$(OBJDIR32_RELEASE)/Input.o: Input.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c Input.cpp -o $(OBJDIR32_RELEASE)/Input.o + +$(OBJDIR32_RELEASE)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR32_RELEASE)/EnumerateRemoteSectionsAndModules.o + +$(OBJDIR32_RELEASE)/EnumerateProcesses.o: EnumerateProcesses.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c EnumerateProcesses.cpp -o $(OBJDIR32_RELEASE)/EnumerateProcesses.o + +$(OBJDIR32_RELEASE)/DisassembleCode.o: DisassembleCode.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c DisassembleCode.cpp -o $(OBJDIR32_RELEASE)/DisassembleCode.o + +$(OBJDIR32_RELEASE)/DistormHelper.o: ../Shared/DistormHelper.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Shared/DistormHelper.cpp -o $(OBJDIR32_RELEASE)/DistormHelper.o + +$(OBJDIR32_RELEASE)/Debugger.o: Debugger.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c Debugger.cpp -o $(OBJDIR32_RELEASE)/Debugger.o + +$(OBJDIR32_RELEASE)/ControlRemoteProcess.o: ControlRemoteProcess.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ControlRemoteProcess.cpp -o $(OBJDIR32_RELEASE)/ControlRemoteProcess.o + +$(OBJDIR32_RELEASE)/CloseRemoteProcess.o: CloseRemoteProcess.cpp + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c CloseRemoteProcess.cpp -o $(OBJDIR32_RELEASE)/CloseRemoteProcess.o + +$(OBJDIR32_RELEASE)/decoder.o: ../Dependencies/distorm/src/decoder.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR32_RELEASE)/decoder.o + +$(OBJDIR32_RELEASE)/distorm.o: ../Dependencies/distorm/src/distorm.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR32_RELEASE)/distorm.o + +$(OBJDIR32_RELEASE)/instructions.o: ../Dependencies/distorm/src/instructions.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR32_RELEASE)/instructions.o + +$(OBJDIR32_RELEASE)/insts.o: ../Dependencies/distorm/src/insts.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR32_RELEASE)/insts.o + +$(OBJDIR32_RELEASE)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR32_RELEASE)/mnemonics.o + +$(OBJDIR32_RELEASE)/operands.o: ../Dependencies/distorm/src/operands.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR32_RELEASE)/operands.o + +$(OBJDIR32_RELEASE)/prefix.o: ../Dependencies/distorm/src/prefix.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR32_RELEASE)/prefix.o + +$(OBJDIR32_RELEASE)/textdefs.o: ../Dependencies/distorm/src/textdefs.c + $(CXX) $(CFLAGS32_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR32_RELEASE)/textdefs.o + +out_release64: before_release $(OBJ64_RELEASE) $(DEP_RELEASE) + $(CXX) $(LIBDIR_RELEASE) -o $(OUT64_RELEASE) $(OBJ64_RELEASE) $(LDFLAGS64_RELEASE) $(LIB_RELEASE) + +$(OBJDIR64_RELEASE)/WriteRemoteMemory.o: WriteRemoteMemory.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c WriteRemoteMemory.cpp -o $(OBJDIR64_RELEASE)/WriteRemoteMemory.o + +$(OBJDIR64_RELEASE)/ReadRemoteMemory.o: ReadRemoteMemory.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ReadRemoteMemory.cpp -o $(OBJDIR64_RELEASE)/ReadRemoteMemory.o + +$(OBJDIR64_RELEASE)/OpenRemoteProcess.o: OpenRemoteProcess.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c OpenRemoteProcess.cpp -o $(OBJDIR64_RELEASE)/OpenRemoteProcess.o + +$(OBJDIR64_RELEASE)/IsProcessValid.o: IsProcessValid.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c IsProcessValid.cpp -o $(OBJDIR64_RELEASE)/IsProcessValid.o + +$(OBJDIR64_RELEASE)/Input.o: Input.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c Input.cpp -o $(OBJDIR64_RELEASE)/Input.o + +$(OBJDIR64_RELEASE)/EnumerateRemoteSectionsAndModules.o: EnumerateRemoteSectionsAndModules.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c EnumerateRemoteSectionsAndModules.cpp -o $(OBJDIR64_RELEASE)/EnumerateRemoteSectionsAndModules.o + +$(OBJDIR64_RELEASE)/EnumerateProcesses.o: EnumerateProcesses.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c EnumerateProcesses.cpp -o $(OBJDIR64_RELEASE)/EnumerateProcesses.o + +$(OBJDIR64_RELEASE)/DisassembleCode.o: DisassembleCode.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c DisassembleCode.cpp -o $(OBJDIR64_RELEASE)/DisassembleCode.o + +$(OBJDIR64_RELEASE)/DistormHelper.o: ../Shared/DistormHelper.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Shared/DistormHelper.cpp -o $(OBJDIR64_RELEASE)/DistormHelper.o + +$(OBJDIR64_RELEASE)/Debugger.o: Debugger.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c Debugger.cpp -o $(OBJDIR64_RELEASE)/Debugger.o + +$(OBJDIR64_RELEASE)/ControlRemoteProcess.o: ControlRemoteProcess.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ControlRemoteProcess.cpp -o $(OBJDIR64_RELEASE)/ControlRemoteProcess.o + +$(OBJDIR64_RELEASE)/CloseRemoteProcess.o: CloseRemoteProcess.cpp + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c CloseRemoteProcess.cpp -o $(OBJDIR64_RELEASE)/CloseRemoteProcess.o + +$(OBJDIR64_RELEASE)/decoder.o: ../Dependencies/distorm/src/decoder.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/decoder.c -o $(OBJDIR64_RELEASE)/decoder.o + +$(OBJDIR64_RELEASE)/distorm.o: ../Dependencies/distorm/src/distorm.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/distorm.c -o $(OBJDIR64_RELEASE)/distorm.o + +$(OBJDIR64_RELEASE)/instructions.o: ../Dependencies/distorm/src/instructions.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/instructions.c -o $(OBJDIR64_RELEASE)/instructions.o + +$(OBJDIR64_RELEASE)/insts.o: ../Dependencies/distorm/src/insts.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/insts.c -o $(OBJDIR64_RELEASE)/insts.o + +$(OBJDIR64_RELEASE)/mnemonics.o: ../Dependencies/distorm/src/mnemonics.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/mnemonics.c -o $(OBJDIR64_RELEASE)/mnemonics.o + +$(OBJDIR64_RELEASE)/operands.o: ../Dependencies/distorm/src/operands.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/operands.c -o $(OBJDIR64_RELEASE)/operands.o + +$(OBJDIR64_RELEASE)/prefix.o: ../Dependencies/distorm/src/prefix.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/prefix.c -o $(OBJDIR64_RELEASE)/prefix.o + +$(OBJDIR64_RELEASE)/textdefs.o: ../Dependencies/distorm/src/textdefs.c + $(CXX) $(CFLAGS64_RELEASE) $(INC_RELEASE) -c ../Dependencies/distorm/src/textdefs.c -o $(OBJDIR64_RELEASE)/textdefs.o + +clean_release: + rm -f $(OBJ32_RELEASE) $(OUT32_RELEASE) + rm -f $(OBJ64_RELEASE) $(OUT64_RELEASE) + rm -rf build/release + rm -rf $(OBJDIR32_RELEASE) + rm -rf $(OBJDIR64_RELEASE) + +.PHONY: before_debug after_debug clean_debug before_release after_release clean_release diff --git a/NativeCore/Unix/NativeCore.Unix.vcxproj b/NativeCore/Unix/NativeCore.Unix.vcxproj new file mode 100644 index 00000000..83bff48a --- /dev/null +++ b/NativeCore/Unix/NativeCore.Unix.vcxproj @@ -0,0 +1,183 @@ + + + + + Debug + x86 + + + Release + x86 + + + Debug + x64 + + + Release + x64 + + + + {48c5258a-fa49-4173-aee5-0fca5190dff2} + Linux + NativeCore + 14.0 + Linux + 1.0 + Generic + {D51BCBC9-82E9-4017-911E-C93873C4EA2B} + 8.1 + + + + true + DynamicLibrary + WSL2_1_0 + + + false + DynamicLibrary + WSL2_1_0 + + + true + DynamicLibrary + WSL2_1_0 + + + false + DynamicLibrary + WSL2_1_0 + + + + + + + + NativeCore + .so + $(SolutionDir)bin\$(Configuration)\$(PlatformTarget)\ + $(SolutionDir)obj\$(Configuration)\$(PlatformTarget)\$(MSBuildProjectName)\ + + + NativeCore + .so + $(SolutionDir)bin\$(Configuration)\$(PlatformTarget)\ + $(SolutionDir)obj\$(Configuration)\$(PlatformTarget)\$(MSBuildProjectName)\ + + + NativeCore + .so + $(SolutionDir)bin\$(Configuration)\$(PlatformTarget)\ + $(SolutionDir)obj\$(Configuration)\$(PlatformTarget)\$(MSBuildProjectName)\ + + + NativeCore + .so + $(SolutionDir)bin\$(Configuration)\$(PlatformTarget)\ + $(SolutionDir)obj\$(Configuration)\$(PlatformTarget)\$(MSBuildProjectName)\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + c++1y + ../Dependencies/distorm/include;$(Sysroot)\usr\include;$(StlIncludeDirectories);%(AdditionalIncludeDirectories) + RECLASSNET64 + -m64 %(AdditionalOptions) + + + -m64 %(AdditionalOptions) + stdc++fs + + + + + true + c++1y + ../Dependencies/distorm/include;$(Sysroot)\usr\include;$(StlIncludeDirectories);%(AdditionalIncludeDirectories) + RECLASSNET64;%(PreprocessorDefinitions) + -m64 %(AdditionalOptions) + None + true + Disabled + false + + + stdc++fs + -m64 %(AdditionalOptions) + OmitAllSymbolInformation + + + + + true + c++1y + ../Dependencies/distorm/include;$(Sysroot)\usr\include;$(StlIncludeDirectories);%(AdditionalIncludeDirectories) + -m32 %(AdditionalOptions) + + + -m32 %(AdditionalOptions) + stdc++fs + + + + + true + c++1y + ../Dependencies/distorm/include;$(Sysroot)\usr\include;$(StlIncludeDirectories);%(AdditionalIncludeDirectories) + -m32 %(AdditionalOptions) + None + true + false + Disabled + + + -m32 %(AdditionalOptions) + stdc++fs + OmitAllSymbolInformation + + + + + \ No newline at end of file diff --git a/NativeCore/Unix/NativeCore.Unix.vcxproj.filters b/NativeCore/Unix/NativeCore.Unix.vcxproj.filters new file mode 100644 index 00000000..3076be6b --- /dev/null +++ b/NativeCore/Unix/NativeCore.Unix.vcxproj.filters @@ -0,0 +1,119 @@ + + + + + {32941fcb-69a5-43e7-86ba-38eb1ece3de9} + + + {eaf85ecc-eda1-49c6-a3be-14f2f8f4002c} + + + {5b0453e9-b429-4dfd-bcbb-f3756d073e60} + + + {976c6ca6-4172-4080-8162-a7913375df1a} + + + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Shared + + + + + + + Dependencies\distorm + + + Dependencies\distorm + + + Shared + + + Shared + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + \ No newline at end of file diff --git a/NativeCore/Unix/NativeCore.hpp b/NativeCore/Unix/NativeCore.hpp new file mode 100644 index 00000000..9939c9b0 --- /dev/null +++ b/NativeCore/Unix/NativeCore.hpp @@ -0,0 +1,49 @@ +#pragma once + +#include +#include + +#include "../ReClassNET_Plugin.hpp" +#include "../Shared/Keys.hpp" + +extern "C" +{ + void EnumerateProcesses(EnumerateProcessCallback callbackProcess); + void EnumerateRemoteSectionsAndModules(RC_Pointer handle, EnumerateRemoteSectionsCallback callbackSection, EnumerateRemoteModulesCallback callbackModule); + + RC_Pointer OpenRemoteProcess(RC_Pointer id, ProcessAccess desiredAccess); + bool IsProcessValid(RC_Pointer handle); + void CloseRemoteProcess(RC_Pointer handle); + + bool ReadRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size); + bool WriteRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size); + + void ControlRemoteProcess(RC_Pointer handle, ControlRemoteProcessAction action); + + bool AttachDebuggerToProcess(RC_Pointer id); + void DetachDebuggerFromProcess(RC_Pointer id); + bool AwaitDebugEvent(DebugEvent* evt, int timeoutInMilliseconds); + void HandleDebugEvent(DebugEvent* evt); + bool SetHardwareBreakpoint(RC_Pointer id, RC_Pointer address, HardwareBreakpointRegister reg, HardwareBreakpointTrigger type, HardwareBreakpointSize size, bool set); + + RC_Pointer InitializeInput(); + bool GetPressedKeys(RC_Pointer handle, Keys* state[], int* count); + void ReleaseInput(RC_Pointer handle); +} + +inline bool is_number(const std::string& s) +{ + auto it = s.begin(); + for (; it != s.end() && std::isdigit(*it); ++it); + return !s.empty() && it == s.end(); +} + +template +inline T parse_type(const std::string& s) +{ + std::stringstream ss(s); + + T val; + ss >> val; + return val; +} diff --git a/NativeCore/Unix/OpenRemoteProcess.cpp b/NativeCore/Unix/OpenRemoteProcess.cpp new file mode 100644 index 00000000..6456760e --- /dev/null +++ b/NativeCore/Unix/OpenRemoteProcess.cpp @@ -0,0 +1,6 @@ +#include "NativeCore.hpp" + +extern "C" RC_Pointer RC_CallConv OpenRemoteProcess(RC_Pointer id, ProcessAccess desiredAccess) +{ + return id; +} diff --git a/NativeCore/Unix/ReadRemoteMemory.cpp b/NativeCore/Unix/ReadRemoteMemory.cpp new file mode 100644 index 00000000..4a647668 --- /dev/null +++ b/NativeCore/Unix/ReadRemoteMemory.cpp @@ -0,0 +1,21 @@ +#include + +#include "NativeCore.hpp" + +extern "C" bool RC_CallConv ReadRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size) +{ + iovec local[1]; + iovec remote[1]; + + local[0].iov_base = (static_cast(buffer) + offset); + local[0].iov_len = size; + remote[0].iov_base = address; + remote[0].iov_len = size; + + if (process_vm_readv(static_cast(reinterpret_cast(handle)), local, 1, remote, 1, 0) != size) + { + return false; + } + + return true; +} diff --git a/NativeCore/Unix/WriteRemoteMemory.cpp b/NativeCore/Unix/WriteRemoteMemory.cpp new file mode 100644 index 00000000..4f20717a --- /dev/null +++ b/NativeCore/Unix/WriteRemoteMemory.cpp @@ -0,0 +1,21 @@ +#include + +#include "NativeCore.hpp" + +extern "C" bool RC_CallConv WriteRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size) +{ + iovec local[1]; + iovec remote[1]; + + local[0].iov_base = (static_cast(buffer) + offset); + local[0].iov_len = size; + remote[0].iov_base = address; + remote[0].iov_len = size; + + if (process_vm_writev(static_cast(reinterpret_cast(handle)), local, 1, remote, 1, 0) != size) + { + return false; + } + + return true; +} diff --git a/NativeCore/Windows/CloseRemoteProcess.cpp b/NativeCore/Windows/CloseRemoteProcess.cpp new file mode 100644 index 00000000..413ef8a1 --- /dev/null +++ b/NativeCore/Windows/CloseRemoteProcess.cpp @@ -0,0 +1,13 @@ +#include + +#include "NativeCore.hpp" + +void RC_CallConv CloseRemoteProcess(RC_Pointer handle) +{ + if (handle == nullptr) + { + return; + } + + CloseHandle(handle); +} diff --git a/NativeCore/Windows/ControlRemoteProcess.cpp b/NativeCore/Windows/ControlRemoteProcess.cpp new file mode 100644 index 00000000..82dee2a0 --- /dev/null +++ b/NativeCore/Windows/ControlRemoteProcess.cpp @@ -0,0 +1,45 @@ +#include +#include + +#include "NativeCore.hpp" + +void RC_CallConv ControlRemoteProcess(RC_Pointer handle, ControlRemoteProcessAction action) +{ + if (action == ControlRemoteProcessAction::Suspend || action == ControlRemoteProcessAction::Resume) + { + const auto processId = GetProcessId(handle); + if (processId != 0) + { + const auto snapshotHandle = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); + if (snapshotHandle != INVALID_HANDLE_VALUE) + { + const auto fn = action == ControlRemoteProcessAction::Suspend ? SuspendThread : ResumeThread; + + THREADENTRY32 te32 = {}; + te32.dwSize = sizeof(THREADENTRY32); + if (Thread32First(snapshotHandle, &te32)) + { + do + { + if (te32.th32OwnerProcessID == processId) + { + const auto threadHandle = OpenThread(THREAD_SUSPEND_RESUME, FALSE, te32.th32ThreadID); + if (threadHandle) + { + fn(threadHandle); + + CloseHandle(threadHandle); + } + } + } while (Thread32Next(snapshotHandle, &te32)); + } + + CloseHandle(snapshotHandle); + } + } + } + else if (action == ControlRemoteProcessAction::Terminate) + { + TerminateProcess(handle, 0); + } +} diff --git a/NativeCore/Windows/Debugger.cpp b/NativeCore/Windows/Debugger.cpp new file mode 100644 index 00000000..ba1505c6 --- /dev/null +++ b/NativeCore/Windows/Debugger.cpp @@ -0,0 +1,243 @@ +#include +#include + +#include "NativeCore.hpp" + +bool RC_CallConv AttachDebuggerToProcess(RC_Pointer id) +{ + if (!DebugActiveProcess(static_cast(reinterpret_cast(id)))) + { + return false; + } + + DebugSetProcessKillOnExit(FALSE); + + return true; +} + +void RC_CallConv DetachDebuggerFromProcess(RC_Pointer id) +{ + DebugActiveProcessStop(static_cast(reinterpret_cast(id))); +} + +bool RC_CallConv AwaitDebugEvent(DebugEvent* evt, int timeoutInMilliseconds) +{ + DEBUG_EVENT _evt = { }; + if (!WaitForDebugEvent(&_evt, timeoutInMilliseconds)) + { + return false; + } + + auto result = false; + + evt->ProcessId = reinterpret_cast(static_cast(_evt.dwProcessId)); + evt->ThreadId = reinterpret_cast(static_cast(_evt.dwThreadId)); + + switch (_evt.dwDebugEventCode) + { + case CREATE_PROCESS_DEBUG_EVENT: + CloseHandle(_evt.u.CreateProcessInfo.hFile); + break; + case LOAD_DLL_DEBUG_EVENT: + CloseHandle(_evt.u.LoadDll.hFile); + break; + case EXCEPTION_DEBUG_EVENT: + auto& exception = _evt.u.Exception; + + // Copy basic informations. + evt->ExceptionInfo.ExceptionAddress = exception.ExceptionRecord.ExceptionAddress; + evt->ExceptionInfo.ExceptionCode = exception.ExceptionRecord.ExceptionCode; + evt->ExceptionInfo.ExceptionFlags = exception.ExceptionRecord.ExceptionFlags; + + const auto handle = OpenThread(THREAD_GET_CONTEXT, FALSE, _evt.dwThreadId); + + CONTEXT ctx = { }; + ctx.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS; + GetThreadContext(handle, &ctx); + + DebugRegister6 dr6; + dr6.Value = ctx.Dr6; + + // Check if breakpoint was a hardware breakpoint. + if (dr6.DR0) + { + evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::Dr0; + } + else if (dr6.DR1) + { + evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::Dr1; + } + else if (dr6.DR2) + { + evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::Dr2; + } + else if (dr6.DR3) + { + evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::Dr3; + } + else + { + evt->ExceptionInfo.CausedBy = HardwareBreakpointRegister::InvalidRegister; + } + + // Copy registers. + auto& reg = evt->ExceptionInfo.Registers; +#ifdef RECLASSNET64 + reg.Rax = reinterpret_cast(ctx.Rax); + reg.Rbx = reinterpret_cast(ctx.Rbx); + reg.Rcx = reinterpret_cast(ctx.Rcx); + reg.Rdx = reinterpret_cast(ctx.Rdx); + reg.Rdi = reinterpret_cast(ctx.Rdi); + reg.Rsi = reinterpret_cast(ctx.Rsi); + reg.Rsp = reinterpret_cast(ctx.Rsp); + reg.Rbp = reinterpret_cast(ctx.Rbp); + reg.Rip = reinterpret_cast(ctx.Rip); + + reg.R8 = reinterpret_cast(ctx.R8); + reg.R9 = reinterpret_cast(ctx.R9); + reg.R10 = reinterpret_cast(ctx.R10); + reg.R11 = reinterpret_cast(ctx.R11); + reg.R12 = reinterpret_cast(ctx.R12); + reg.R13 = reinterpret_cast(ctx.R13); + reg.R14 = reinterpret_cast(ctx.R14); + reg.R15 = reinterpret_cast(ctx.R15); +#else + reg.Eax = reinterpret_cast(ctx.Eax); + reg.Ebx = reinterpret_cast(ctx.Ebx); + reg.Ecx = reinterpret_cast(ctx.Ecx); + reg.Edx = reinterpret_cast(ctx.Edx); + reg.Edi = reinterpret_cast(ctx.Edi); + reg.Esi = reinterpret_cast(ctx.Esi); + reg.Esp = reinterpret_cast(ctx.Esp); + reg.Ebp = reinterpret_cast(ctx.Ebp); + reg.Eip = reinterpret_cast(ctx.Eip); +#endif + + CloseHandle(handle); + + result = true; + break; + } + + if (result == false) + { + ContinueDebugEvent(_evt.dwProcessId, _evt.dwThreadId, DBG_CONTINUE); + } + + return result; +} + +void RC_CallConv HandleDebugEvent(DebugEvent* evt) +{ + DWORD continueStatus = 0; + switch (evt->ContinueStatus) + { + case DebugContinueStatus::Handled: + continueStatus = DBG_CONTINUE; + break; + case DebugContinueStatus::NotHandled: + continueStatus = DBG_EXCEPTION_NOT_HANDLED; + break; + } + + ContinueDebugEvent(static_cast(reinterpret_cast(evt->ProcessId)), static_cast(reinterpret_cast(evt->ThreadId)), continueStatus); +} + +bool RC_CallConv SetHardwareBreakpoint(RC_Pointer id, RC_Pointer address, HardwareBreakpointRegister reg, HardwareBreakpointTrigger type, HardwareBreakpointSize size, bool set) +{ + if (reg == HardwareBreakpointRegister::InvalidRegister) + { + return false; + } + + decltype(CONTEXT::Dr0) addressValue = 0; + int accessValue = 0; + int lengthValue = 0; + + if (set) + { + addressValue = reinterpret_cast(address); + + if (type == HardwareBreakpointTrigger::Execute) + accessValue = 0; + else if (type == HardwareBreakpointTrigger::Access) + accessValue = 3; + else if (type == HardwareBreakpointTrigger::Write) + accessValue = 1; + + if (size == HardwareBreakpointSize::Size1) + lengthValue = 0; + else if (size == HardwareBreakpointSize::Size2) + lengthValue = 1; + else if (size == HardwareBreakpointSize::Size4) + lengthValue = 3; + else if (size == HardwareBreakpointSize::Size8) + lengthValue = 2; + } + + const auto snapshotHandle = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); + if (snapshotHandle != INVALID_HANDLE_VALUE) + { + THREADENTRY32 te32 = {}; + te32.dwSize = sizeof(THREADENTRY32); + if (Thread32First(snapshotHandle, &te32)) + { + do + { + if (te32.th32OwnerProcessID == static_cast(reinterpret_cast(id))) + { + const auto threadHandle = OpenThread(THREAD_SUSPEND_RESUME | THREAD_GET_CONTEXT | THREAD_SET_CONTEXT, FALSE, te32.th32ThreadID); + + SuspendThread(threadHandle); + + CONTEXT ctx = { 0 }; + ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS; + GetThreadContext(threadHandle, &ctx); + + DebugRegister7 dr7; + dr7.Value = ctx.Dr7; + + switch (reg) + { + case HardwareBreakpointRegister::Dr0: + ctx.Dr0 = addressValue; + dr7.G0 = true; + dr7.RW0 = accessValue; + dr7.Len0 = lengthValue; + break; + case HardwareBreakpointRegister::Dr1: + ctx.Dr1 = addressValue; + dr7.G1 = true; + dr7.RW1 = accessValue; + dr7.Len1 = lengthValue; + break; + case HardwareBreakpointRegister::Dr2: + ctx.Dr2 = addressValue; + dr7.G2 = true; + dr7.RW2 = accessValue; + dr7.Len2 = lengthValue; + break; + case HardwareBreakpointRegister::Dr3: + ctx.Dr3 = addressValue; + dr7.G3 = true; + dr7.RW3 = accessValue; + dr7.Len3 = lengthValue; + break; + } + + ctx.Dr7 = dr7.Value; + + SetThreadContext(threadHandle, &ctx); + + ResumeThread(threadHandle); + + CloseHandle(threadHandle); + } + } while (Thread32Next(snapshotHandle, &te32)); + } + + CloseHandle(snapshotHandle); + } + + return true; +} diff --git a/NativeCore/Windows/DisassembleCode.cpp b/NativeCore/Windows/DisassembleCode.cpp new file mode 100644 index 00000000..073dea1f --- /dev/null +++ b/NativeCore/Windows/DisassembleCode.cpp @@ -0,0 +1,6 @@ +#include "../Shared/DistormHelper.hpp" + +bool RC_CallConv DisassembleCode(RC_Pointer address, RC_Size length, RC_Pointer virtualAddress, bool determineStaticInstructionBytes, EnumerateInstructionCallback callback) +{ + return DisassembleInstructionsImpl(address, length, virtualAddress, determineStaticInstructionBytes, callback); +} diff --git a/NativeCore/Windows/EnumerateProcesses.cpp b/NativeCore/Windows/EnumerateProcesses.cpp new file mode 100644 index 00000000..534b4a84 --- /dev/null +++ b/NativeCore/Windows/EnumerateProcesses.cpp @@ -0,0 +1,90 @@ +#include +#include +#include +#include + +#include "NativeCore.hpp" + +enum class Platform +{ + Unknown, + X86, + X64 +}; + +Platform GetProcessPlatform(HANDLE process) +{ + static USHORT processorArchitecture = PROCESSOR_ARCHITECTURE_UNKNOWN; + if (processorArchitecture == PROCESSOR_ARCHITECTURE_UNKNOWN) + { + SYSTEM_INFO info = {}; + GetNativeSystemInfo(&info); + + processorArchitecture = info.wProcessorArchitecture; + } + + switch (processorArchitecture) + { + case PROCESSOR_ARCHITECTURE_INTEL: + return Platform::X86; + case PROCESSOR_ARCHITECTURE_AMD64: + auto isWow64 = FALSE; + if (IsWow64Process(process, &isWow64)) + { + return isWow64 ? Platform::X86 : Platform::X64; + } + +#ifdef RECLASSNET64 + return Platform::X64; +#else + return Platform::X86; +#endif + } + return Platform::Unknown; +} + +void RC_CallConv EnumerateProcesses(EnumerateProcessCallback callbackProcess) +{ + if (callbackProcess == nullptr) + { + return; + } + + const auto handle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); + if (handle != INVALID_HANDLE_VALUE) + { + PROCESSENTRY32W pe32 = {}; + pe32.dwSize = sizeof(PROCESSENTRY32W); + if (Process32FirstW(handle, &pe32)) + { + do + { + const auto process = OpenRemoteProcess(reinterpret_cast(static_cast(pe32.th32ProcessID)), ProcessAccess::Read); + if (IsProcessValid(process)) + { + const auto platform = GetProcessPlatform(process); +#ifdef RECLASSNET64 + if (platform == Platform::X64) +#else + if (platform == Platform::X86) +#endif + { + EnumerateProcessData data = { }; + data.Id = pe32.th32ProcessID; + GetModuleFileNameExW(process, nullptr, reinterpret_cast(data.Path), PATH_MAXIMUM_LENGTH); + const auto name = std::filesystem::path(data.Path).filename().u16string(); + str16cpy(data.Name, name.c_str(), std::min(name.length(), PATH_MAXIMUM_LENGTH - 1)); + + callbackProcess(&data); + } + + } + + CloseRemoteProcess(process); + + } while (Process32NextW(handle, &pe32)); + } + + CloseHandle(handle); + } +} diff --git a/NativeCore/Windows/EnumerateRemoteSectionsAndModules.cpp b/NativeCore/Windows/EnumerateRemoteSectionsAndModules.cpp new file mode 100644 index 00000000..066b077b --- /dev/null +++ b/NativeCore/Windows/EnumerateRemoteSectionsAndModules.cpp @@ -0,0 +1,241 @@ +#include +#include +#include +#include +#include +#include + +#include "NativeCore.hpp" + +PPEB GetRemotePeb(const HANDLE process) +{ + static auto* const ntdll = GetModuleHandle(TEXT("ntdll")); + if (!ntdll) + { + return nullptr; + } + + using tNtQueryInformationProcess = NTSTATUS (NTAPI*)(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_writes_bytes_(ProcessInformationLength) PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength); + + static const auto pNtQueryInformationProcess = tNtQueryInformationProcess(GetProcAddress(ntdll, "NtQueryInformationProcess")); + if (!pNtQueryInformationProcess) + { + return nullptr; + } + + PROCESS_BASIC_INFORMATION pbi; + if (!NT_SUCCESS(pNtQueryInformationProcess(process, ProcessBasicInformation, &pbi, sizeof(PROCESS_BASIC_INFORMATION), nullptr))) + { + return nullptr; + } + + return pbi.PebBaseAddress; +} + +using InternalEnumerateRemoteModulesCallback = std::function; + +bool EnumerateRemoteModulesNative(const RC_Pointer process, const InternalEnumerateRemoteModulesCallback& callback) +{ + auto* const ppeb = GetRemotePeb(process); + if (ppeb == nullptr) + { + return false; + } + + PPEB_LDR_DATA ldr; + if (!ReadRemoteMemory(process, &ppeb->Ldr, &ldr, 0, sizeof(PPEB_LDR_DATA))) + { + return false; + } + + auto* const head = &ldr->InMemoryOrderModuleList; + PLIST_ENTRY current; + if (!ReadRemoteMemory(process, &head->Flink, ¤t, 0, sizeof(PLIST_ENTRY))) + { + return false; + } + + while (current != head) + { + LDR_DATA_TABLE_ENTRY entry; + if (!ReadRemoteMemory(process, CONTAINING_RECORD(current, LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks), &entry, 0, sizeof(entry))) + { + break; + } + + EnumerateRemoteModuleData data = {}; + data.BaseAddress = entry.DllBase; + data.Size = *reinterpret_cast(&entry.Reserved3[1]); // instead of undocced member could read ImageSize from headers + + const auto length = std::min(sizeof(RC_UnicodeChar) * (PATH_MAXIMUM_LENGTH - 1), entry.FullDllName.Length); + if (!ReadRemoteMemory(process, entry.FullDllName.Buffer, data.Path, 0, length)) + { + break; + } + data.Path[length / 2] = 0; + + callback(data); + + current = entry.InMemoryOrderLinks.Flink; + } + + return true; +} + +bool EnumerateRemoteModulesWinapi(const RC_Pointer process, const InternalEnumerateRemoteModulesCallback& callback) +{ + auto* const handle = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetProcessId(process)); + if (handle == INVALID_HANDLE_VALUE) + { + return false; + } + + MODULEENTRY32W me32 = {}; + me32.dwSize = sizeof(MODULEENTRY32W); + if (Module32FirstW(handle, &me32)) + { + do + { + EnumerateRemoteModuleData data = {}; + data.BaseAddress = me32.modBaseAddr; + data.Size = me32.modBaseSize; + std::memcpy(data.Path, me32.szExePath, std::min(MAX_PATH, PATH_MAXIMUM_LENGTH)); + + callback(data); + } while (Module32NextW(handle, &me32)); + } + + CloseHandle(handle); + + return true; +} + +void RC_CallConv EnumerateRemoteSectionsAndModules(RC_Pointer process, EnumerateRemoteSectionsCallback callbackSection, EnumerateRemoteModulesCallback callbackModule) +{ + if (callbackSection == nullptr && callbackModule == nullptr) + { + return; + } + + std::vector sections; + + MEMORY_BASIC_INFORMATION memory = { }; + memory.RegionSize = 0x1000; + size_t address = 0; + while (VirtualQueryEx(process, reinterpret_cast(address), &memory, sizeof(MEMORY_BASIC_INFORMATION)) != 0 && address + memory.RegionSize > address) + { + if (memory.State == MEM_COMMIT) + { + EnumerateRemoteSectionData section = {}; + section.BaseAddress = memory.BaseAddress; + section.Size = memory.RegionSize; + + section.Protection = SectionProtection::NoAccess; + if ((memory.Protect & PAGE_EXECUTE) == PAGE_EXECUTE) section.Protection |= SectionProtection::Execute; + if ((memory.Protect & PAGE_EXECUTE_READ) == PAGE_EXECUTE_READ) section.Protection |= SectionProtection::Execute | SectionProtection::Read; + if ((memory.Protect & PAGE_EXECUTE_READWRITE) == PAGE_EXECUTE_READWRITE) section.Protection |= SectionProtection::Execute | SectionProtection::Read | SectionProtection::Write; + if ((memory.Protect & PAGE_EXECUTE_WRITECOPY) == PAGE_EXECUTE_WRITECOPY) section.Protection |= SectionProtection::Execute | SectionProtection::Read | SectionProtection::CopyOnWrite; + if ((memory.Protect & PAGE_READONLY) == PAGE_READONLY) section.Protection |= SectionProtection::Read; + if ((memory.Protect & PAGE_READWRITE) == PAGE_READWRITE) section.Protection |= SectionProtection::Read | SectionProtection::Write; + if ((memory.Protect & PAGE_WRITECOPY) == PAGE_WRITECOPY) section.Protection |= SectionProtection::Read | SectionProtection::CopyOnWrite; + if ((memory.Protect & PAGE_GUARD) == PAGE_GUARD) section.Protection |= SectionProtection::Guard; + + switch (memory.Type) + { + case MEM_IMAGE: + section.Type = SectionType::Image; + break; + case MEM_MAPPED: + section.Type = SectionType::Mapped; + break; + case MEM_PRIVATE: + section.Type = SectionType::Private; + break; + } + + section.Category = section.Type == SectionType::Private ? SectionCategory::HEAP : SectionCategory::Unknown; + + sections.push_back(section); + } + address = reinterpret_cast(memory.BaseAddress) + memory.RegionSize; + } + + const auto moduleEnumerator = [&](EnumerateRemoteModuleData& data) + { + if (callbackModule != nullptr) + { + callbackModule(&data); + } + + if (callbackSection != nullptr) + { + auto it = std::lower_bound(std::begin(sections), std::end(sections), static_cast(data.BaseAddress), [§ions](const auto& lhs, const LPVOID& rhs) + { + return lhs.BaseAddress < rhs; + }); + + IMAGE_DOS_HEADER imageDosHeader = {}; + IMAGE_NT_HEADERS imageNtHeaders = {}; + + if (!ReadRemoteMemory(process, data.BaseAddress, &imageDosHeader, 0, sizeof(IMAGE_DOS_HEADER)) + || !ReadRemoteMemory(process, PUCHAR(data.BaseAddress) + imageDosHeader.e_lfanew, &imageNtHeaders, 0, sizeof(IMAGE_NT_HEADERS))) + { + return; + } + + std::vector sectionHeaders(imageNtHeaders.FileHeader.NumberOfSections); + ReadRemoteMemory(process, PUCHAR(data.BaseAddress) + imageDosHeader.e_lfanew + sizeof(IMAGE_NT_HEADERS), sectionHeaders.data(), 0, imageNtHeaders.FileHeader.NumberOfSections * sizeof(IMAGE_SECTION_HEADER)); + for (auto&& sectionHeader : sectionHeaders) + { + const auto sectionAddress = reinterpret_cast(data.BaseAddress) + sectionHeader.VirtualAddress; + + for (; it != std::end(sections); ++it) + { + auto&& section = *it; + + if (sectionAddress >= reinterpret_cast(section.BaseAddress) + && sectionAddress < reinterpret_cast(section.BaseAddress) + static_cast(section.Size) + && sectionHeader.VirtualAddress + sectionHeader.Misc.VirtualSize <= data.Size) + { + if ((sectionHeader.Characteristics & IMAGE_SCN_CNT_CODE) == IMAGE_SCN_CNT_CODE) + { + section.Category = SectionCategory::CODE; + } + else if (sectionHeader.Characteristics & (IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_CNT_UNINITIALIZED_DATA)) + { + section.Category = SectionCategory::DATA; + } + + try + { + // Copy the name because it is not null padded. + char buffer[IMAGE_SIZEOF_SHORT_NAME + 1] = { 0 }; + std::memcpy(buffer, sectionHeader.Name, IMAGE_SIZEOF_SHORT_NAME); + MultiByteToUnicode(buffer, section.Name, IMAGE_SIZEOF_SHORT_NAME); + } + catch (std::range_error &) + { + std::memset(section.Name, 0, sizeof(section.Name)); + } + std::memcpy(section.ModulePath, data.Path, std::min(MAX_PATH, PATH_MAXIMUM_LENGTH)); + + break; + } + } + } + } + }; + + if (!EnumerateRemoteModulesNative(process, moduleEnumerator)) + { + EnumerateRemoteModulesWinapi(process, moduleEnumerator); + } + + if (callbackSection != nullptr) + { + for (auto&& section : sections) + { + callbackSection(§ion); + } + } +} diff --git a/NativeCore/Windows/Input.cpp b/NativeCore/Windows/Input.cpp new file mode 100644 index 00000000..8216bd07 --- /dev/null +++ b/NativeCore/Windows/Input.cpp @@ -0,0 +1,392 @@ +#define DIRECTINPUT_VERSION 0x0800 + +#include +#include + +#include "NativeCore.hpp" +#include "../Shared/Keys.hpp" + +Keys mapping[]; + +class DirectInput +{ +public: + DirectInput() = default; + + DirectInput(const DirectInput&) = delete; + DirectInput(const DirectInput&&) = delete; + DirectInput& operator=(DirectInput const&) = delete; + DirectInput& operator=(DirectInput const&&) = delete; + + ~DirectInput() + { + if (keyboardDevice) + { + keyboardDevice->Unacquire(); + keyboardDevice->Release(); + keyboardDevice = nullptr; + } + if (directInputInterface) + { + directInputInterface->Release(); + directInputInterface = nullptr; + } + } + + bool Initialize() + { + if (DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8W, reinterpret_cast(&directInputInterface), nullptr) != DI_OK) + { + return false; + } + + if (directInputInterface->CreateDevice(GUID_SysKeyboard, &keyboardDevice, nullptr) != DI_OK + || keyboardDevice->SetDataFormat(&c_dfDIKeyboard) != DI_OK) + { + return false; + } + + return true; + } + + bool ReadKeyboardState(Keys* keys[], int* count) + { + const int STATE_PRESSED = 0x80; + + currentState.clear(); + + BYTE keyBuffer[256] = {}; + const auto result = keyboardDevice->GetDeviceState(sizeof(keyBuffer), &keyBuffer); + if (result != DI_OK) + { + if (result == DIERR_NOTACQUIRED || result == DIERR_INPUTLOST) + { + keyboardDevice->Acquire(); + } + return false; + } + + auto modifier = Keys::None; + if (keyBuffer[DIK_LSHIFT] & STATE_PRESSED || keyBuffer[DIK_RSHIFT] & STATE_PRESSED) + { + modifier |= Keys::Shift; + } + if (keyBuffer[DIK_LCONTROL] & STATE_PRESSED || keyBuffer[DIK_RCONTROL] & STATE_PRESSED) + { + modifier |= Keys::Control; + } + if (keyBuffer[DIK_LMENU] & STATE_PRESSED) + { + modifier |= Keys::Alt; + } + if (keyBuffer[DIK_RMENU] & STATE_PRESSED) + { + modifier |= Keys::Alt; + modifier |= Keys::Control; + } + + for (auto i = 0u; i < 0xEF; ++i) + { + if (keyBuffer[i] & STATE_PRESSED) + { + auto currentKey = mapping[i]; + if (currentKey != Keys::None) + { + switch (currentKey) + { + case Keys::LControlKey: + case Keys::RControlKey: + currentKey = Keys::ControlKey; + break; + case Keys::LShiftKey: + case Keys::RShiftKey: + currentKey = Keys::ControlKey; + break; + case Keys::LMenu: + case Keys::RMenu: + currentKey = Keys::Menu; + break; + } + + currentKey |= modifier; + + currentState.push_back(currentKey); + } + } + } + + *keys = currentState.data(); + *count = static_cast(currentState.size()); + + return true; + } + +private: + IDirectInput8W* directInputInterface = nullptr; + IDirectInputDevice8W* keyboardDevice = nullptr; + std::vector currentState; +}; + +RC_Pointer RC_CallConv InitializeInput() +{ + auto input = new DirectInput(); + if (!input->Initialize()) + { + delete input; + + return nullptr; + } + return static_cast(input); +} + +bool RC_CallConv GetPressedKeys(RC_Pointer handle, Keys* keys[], int* count) +{ + return static_cast(handle)->ReadKeyboardState(keys, count); +} + +void RC_CallConv ReleaseInput(RC_Pointer handle) +{ + delete static_cast(handle); +} + +Keys mapping[] = +{ + Keys::None, /*0x00*/ + Keys::Escape, /* DIK_ESCAPE */ /*0x01*/ + Keys::D1, /* DIK_1 */ /*0x02*/ + Keys::D2, /* DIK_2 */ /*0x03*/ + Keys::D3, /* DIK_3 */ /*0x04*/ + Keys::D4, /* DIK_4 */ /*0x05*/ + Keys::D5, /* DIK_5 */ /*0x06*/ + Keys::D6, /* DIK_6 */ /*0x07*/ + Keys::D7, /* DIK_7 */ /*0x08*/ + Keys::D8, /* DIK_8 */ /*0x09*/ + Keys::D9, /* DIK_9 */ /*0x0A*/ + Keys::D0, /* DIK_0 */ /*0x0B*/ + Keys::OemMinus, /* DIK_MINUS */ /*0x0C*/ + Keys::OemPlus, /* DIK_EQUALS */ /*0x0D*/ + Keys::Back, /* DIK_BACK */ /*0x0E*/ + Keys::Tab, /* DIK_TAB */ /*0x0F*/ + Keys::Q, /* DIK_Q */ /*0x10*/ + Keys::W, /* DIK_W */ /*0x11*/ + Keys::E, /* DIK_E */ /*0x12*/ + Keys::R, /* DIK_R */ /*0x13*/ + Keys::T, /* DIK_T */ /*0x14*/ + Keys::Z, /* DIK_Y */ /*0x15*/ + Keys::U, /* DIK_U */ /*0x16*/ + Keys::I, /* DIK_I */ /*0x17*/ + Keys::O, /* DIK_O */ /*0x18*/ + Keys::P, /* DIK_P */ /*0x19*/ + Keys::Oem4, /* DIK_LBRACKET */ /*0x1A*/ + Keys::Oem6, /* DIK_RBRACKET */ /*0x1B*/ + Keys::Return, /* DIK_RETURN */ /*0x1C*/ + Keys::LControlKey, /* DIK_LControl */ /*0x1D*/ + Keys::A, /* DIK_A */ /*0x1E*/ + Keys::S, /* DIK_S */ /*0x1F*/ + Keys::D, /* DIK_D */ /*0x20*/ + Keys::F, /* DIK_F */ /*0x21*/ + Keys::G, /* DIK_G */ /*0x22*/ + Keys::H, /* DIK_H */ /*0x23*/ + Keys::J, /* DIK_J */ /*0x24*/ + Keys::K, /* DIK_K */ /*0x25*/ + Keys::L, /* DIK_L */ /*0x26*/ + Keys::Oem1, /* DIK_SEMICOLON */ /*0x27*/ + Keys::Oem7, /* DIK_APOSTROPHE */ /*0x28*/ + Keys::Oem3, /* DIK_GRAVE */ /*0x29*/ + Keys::LShiftKey, /* DIK_LSHIFT */ /*0x2A*/ + Keys::OemBackslash, /* DIK_BACKSLASH */ /*0x2B*/ + Keys::Y, /* DIK_Z */ /*0x2C*/ + Keys::X, /* DIK_X */ /*0x2D*/ + Keys::C, /* DIK_C */ /*0x2E*/ + Keys::V, /* DIK_V */ /*0x2F*/ + Keys::B, /* DIK_B */ /*0x30*/ + Keys::N, /* DIK_N */ /*0x31*/ + Keys::M, /* DIK_M */ /*0x32*/ + Keys::OemComma, /* DIK_COMMA */ /*0x33*/ + Keys::OemPeriod, /* DIK_PERIOD */ /*0x34*/ + Keys::Oem2, /* DIK_SLASH */ /*0x35*/ + Keys::RShiftKey, /* DIK_RSHIFT */ /*0x36*/ + Keys::Multiply, /* DIK_MULTIPLY */ /*0x37*/ + Keys::LMenu, /* DIK_LMENU */ /*0x38*/ + Keys::Space, /* DIK_SPACE */ /*0x39*/ + Keys::CapsLock, /* DIK_CAPITAL */ /*0x3A*/ + Keys::F1, /* DIK_F1 */ /*0x3B*/ + Keys::F2, /* DIK_F2 */ /*0x3C*/ + Keys::F3, /* DIK_F3 */ /*0x3D*/ + Keys::F4, /* DIK_F4 */ /*0x3E*/ + Keys::F5, /* DIK_F5 */ /*0x3F*/ + Keys::F6, /* DIK_F6 */ /*0x40*/ + Keys::F7, /* DIK_F7 */ /*0x41*/ + Keys::F8, /* DIK_F8 */ /*0x42*/ + Keys::F9, /* DIK_F9 */ /*0x43*/ + Keys::F10, /* DIK_F10 */ /*0x44*/ + Keys::NumLock, /* DIK_NUMLOCK */ /*0x45*/ + Keys::Scroll, /* DIK_SCROLL */ /*0x46*/ + Keys::NumPad7, /* DIK_NUMPAD7 */ /*0x47*/ + Keys::NumPad8, /* DIK_NUMPAD8 */ /*0x48*/ + Keys::NumPad9, /* DIK_NUMPAD9 */ /*0x49*/ + Keys::Subtract, /* DIK_SUBSTRACT */ /*0x4A*/ + Keys::NumPad4, /* DIK_NUMPAD4 */ /*0x4B*/ + Keys::NumPad5, /* DIK_NUMPAD5 */ /*0x4C*/ + Keys::NumPad6, /* DIK_NUMPAD6 */ /*0x4D*/ + Keys::Add, /* DIK_ADD */ /*0x4E*/ + Keys::NumPad1, /* DIK_NUMPAD1 */ /*0x4F*/ + Keys::NumPad2, /* DIK_NUMPAD2 */ /*0x50*/ + Keys::NumPad3, /* DIK_NUMPAD3 */ /*0x51*/ + Keys::NumPad0, /* DIK_NUMPAD0 */ /*0x52*/ + Keys::Decimal, /* DIK_DECIMAL */ /*0x53*/ + Keys::None, /*0x54*/ + Keys::None, /*0x55*/ + Keys::Oem102, /* DIK_OEM_102 */ /*0x56*/ + Keys::F11, /* DIK_F11 */ /*0x57*/ + Keys::F12, /* DIK_F12 */ /*0x58*/ + Keys::None, /*0x59*/ + Keys::None, /*0x5A*/ + Keys::None, /*0x5B*/ + Keys::None, /*0x5C*/ + Keys::None, /*0x5D*/ + Keys::None, /*0x5E*/ + Keys::None, /*0x5F*/ + Keys::None, /*0x60*/ + Keys::None, /*0x61*/ + Keys::None, /*0x62*/ + Keys::None, /*0x63*/ + Keys::F13, /* DIK_F13 */ /*0x64*/ + Keys::F14, /* DIK_F14 */ /*0x65*/ + Keys::F15, /* DIK_F15 */ /*0x66*/ + Keys::None, /*0x67*/ + Keys::None, /*0x68*/ + Keys::None, /*0x69*/ + Keys::None, /*0x6A*/ + Keys::None, /*0x6B*/ + Keys::None, /*0x6C*/ + Keys::None, /*0x6D*/ + Keys::None, /*0x6E*/ + Keys::None, /*0x6F*/ + Keys::None, /* DIK_KANA */ /*0x70*/ + Keys::None, /*0x71*/ + Keys::None, /*0x72*/ + Keys::None, /* DIK_ABNT_C1 */ /*0x73*/ + Keys::None, /*0x74*/ + Keys::None, /*0x75*/ + Keys::None, /*0x76*/ + Keys::None, /*0x77*/ + Keys::None, /*0x78*/ + Keys::IMEConvert, /* DIK_CONVERT */ /*0x79*/ + Keys::None, /*0x7A*/ + Keys::IMENonconvert, /* DIK_NOCONVERT */ /*0x7B*/ + Keys::None, /*0x7C*/ + Keys::None, /* DIK_YEN */ /*0x7D*/ + Keys::None, /* DIK_ABNT_C2 */ /*0x7E*/ + Keys::None, /*0x7F*/ + Keys::None, /*0x80*/ + Keys::None, /*0x81*/ + Keys::None, /*0x82*/ + Keys::None, /*0x83*/ + Keys::None, /*0x84*/ + Keys::None, /*0x85*/ + Keys::None, /*0x86*/ + Keys::None, /*0x87*/ + Keys::None, /*0x88*/ + Keys::None, /*0x89*/ + Keys::None, /*0x8A*/ + Keys::None, /*0x8B*/ + Keys::None, /*0x8C*/ + Keys::None, /* DIK_NUMPADEQUALS */ /*0x8D*/ + Keys::None, /*0x8E*/ + Keys::None, /*0x8F*/ + Keys::MediaPreviousTrack, /* DIK_CIRCUMFLEX */ /*0x90*/ + Keys::None, /* DIK_AT */ /*0x91*/ + Keys::None, /* DIK_COLON */ /*0x92*/ + Keys::None, /* DIK_UNDERLINE */ /*0x93*/ + Keys::None, /* DIK_KANJI */ /*0x94*/ + Keys::None, /* DIK_STOP */ /*0x95*/ + Keys::None, /* DIK_AX */ /*0x96*/ + Keys::None, /* DIK_UNLABELED */ /*0x97*/ + Keys::None, /*0x98*/ + Keys::MediaNextTrack, /* DIK_NEXTTRACK */ /*0x99*/ + Keys::None, /*0x9A*/ + Keys::None, /*0x9B*/ + Keys::Return, /* DIK_NUMPADENTER */ /*0x9C*/ + Keys::RControlKey, /* DIK_RCONTROL */ /*0x9D*/ + Keys::None, /*0x9E*/ + Keys::None, /*0x9F*/ + Keys::VolumeMute, /* DIK_MUTE */ /*0xA0*/ + Keys::None, /* DIK_CALCULATOR */ /*0xA1*/ + Keys::MediaPlayPause, /* DIK_PLAYPAUSE */ /*0xA2*/ + Keys::None, /*0xA3*/ + Keys::MediaStop, /* DIK_MEDIASTOP */ /*0xA4*/ + Keys::None, /*0xA5*/ + Keys::None, /*0xA6*/ + Keys::None, /*0xA7*/ + Keys::None, /*0xA8*/ + Keys::None, /*0xA9*/ + Keys::None, /*0xAA*/ + Keys::None, /*0xAB*/ + Keys::None, /*0xAC*/ + Keys::None, /*0xAD*/ + Keys::VolumeDown, /* DIK_VOLUMEDOWN */ /*0xAE*/ + Keys::None, /*0xAF*/ + Keys::VolumeUp, /* DIK_VOLUMEUP */ /*0xB0*/ + Keys::None, /*0xB1*/ + Keys::BrowserHome, /* DIK_WEBHOME */ /*0xB2*/ + Keys::None, /* DIK_NUMPADCOMMA */ /*0xB3*/ + Keys::None, /*0xB4*/ + Keys::Divide, /* DIK_DIVIDE */ /*0xB5*/ + Keys::None, /*0xB6*/ + Keys::None, /* DIK_SYSRQ */ /*0xB7*/ + Keys::RMenu, /* DIK_RMENU */ /*0xB8*/ + Keys::None, /*0xB9*/ + Keys::None, /*0xBA*/ + Keys::None, /*0xBB*/ + Keys::None, /*0xBC*/ + Keys::None, /*0xBD*/ + Keys::None, /*0xBE*/ + Keys::None, /*0xBF*/ + Keys::None, /*0xC0*/ + Keys::None, /*0xC1*/ + Keys::None, /*0xC2*/ + Keys::None, /*0xC3*/ + Keys::None, /*0xC4*/ + Keys::Pause, /* DIK_PAUSE */ /*0xC5*/ + Keys::None, /*0xC6*/ + Keys::Home, /* DIK_HOME */ /*0xC7*/ + Keys::Up, /* DIK_UP */ /*0xC8*/ + Keys::Prior, /* DIK_PRIOR */ /*0xC9*/ + Keys::None, /*0xCA*/ + Keys::Left, /* DIK_LEFT */ /*0xCB*/ + Keys::None, /*0xCC*/ + Keys::Right, /* DIK_RIGHT */ /*0xCD*/ + Keys::None, /*0xCE*/ + Keys::End, /* DIK_END */ /*0xCF*/ + Keys::Down, /* DIK_DOWN */ /*0xD0*/ + Keys::Next, /* DIK_NEXT */ /*0xD1*/ + Keys::Insert, /* DIK_INSERT */ /*0xD2*/ + Keys::Delete, /* DIK_DELETE */ /*0xD3*/ + Keys::None, /*0xD4*/ + Keys::None, /*0xD5*/ + Keys::None, /*0xD6*/ + Keys::None, /*0xD7*/ + Keys::None, /*0xD8*/ + Keys::None, /*0xD9*/ + Keys::None, /*0xDA*/ + Keys::LWin, /* DIK_LWIN */ /*0xDB*/ + Keys::RWin, /* DIK_RWIN */ /*0xDC*/ + Keys::None, /* DIK_APPS */ /*0xDD*/ + Keys::None, /* DIK_POWER */ /*0xDE*/ + Keys::Sleep, /* DIK_SLEEP */ /*0xDF*/ + Keys::None, /*0xE0*/ + Keys::None, /*0xE1*/ + Keys::None, /*0xE2*/ + Keys::None, /* DIK_WAKE */ /*0xE3*/ + Keys::None, /*0xE4*/ + Keys::BrowserSearch, /* DIK_WEBSEARCH */ /*0xE5*/ + Keys::BrowserFavorites, /* DIK_WEBFAVORITES */ /*0xE6*/ + Keys::BrowserRefresh, /* DIK_WEBREFRESH */ /*0xE7*/ + Keys::BrowserStop, /* DIK_WEBSTOP */ /*0xE8*/ + Keys::BrowserForward, /* DIK_WEBFORWARD */ /*0xE9*/ + Keys::BrowserBack, /* DIK_WEBBACK */ /*0xEA*/ + Keys::None, /* DIK_MYCOMPUTER */ /*0xEB*/ + Keys::LaunchMail, /* DIK_MAIL */ /*0xEC*/ + Keys::SelectMedia, /* DIK_MEDIASELECT */ /*0xED*/ +}; \ No newline at end of file diff --git a/NativeCore/Windows/IsProcessValid.cpp b/NativeCore/Windows/IsProcessValid.cpp new file mode 100644 index 00000000..7f880dfe --- /dev/null +++ b/NativeCore/Windows/IsProcessValid.cpp @@ -0,0 +1,19 @@ +#include + +#include "NativeCore.hpp" + +bool RC_CallConv IsProcessValid(RC_Pointer handle) +{ + if (handle == nullptr) + { + return false; + } + + const auto retn = WaitForSingleObject(handle, 0); + if (retn == WAIT_FAILED) + { + return false; + } + + return retn == WAIT_TIMEOUT; +} diff --git a/NativeCore/Windows/NativeCore.hpp b/NativeCore/Windows/NativeCore.hpp new file mode 100644 index 00000000..db0fa692 --- /dev/null +++ b/NativeCore/Windows/NativeCore.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include "../ReClassNET_Plugin.hpp" +#include "../Shared/Keys.hpp" + +void RC_CallConv EnumerateProcesses(EnumerateProcessCallback callbackProcess); +void RC_CallConv EnumerateRemoteSectionsAndModules(RC_Pointer handle, EnumerateRemoteSectionsCallback callbackSection, EnumerateRemoteModulesCallback callbackModule); + +RC_Pointer RC_CallConv OpenRemoteProcess(RC_Pointer id, ProcessAccess desiredAccess); +bool RC_CallConv IsProcessValid(RC_Pointer handle); +void RC_CallConv CloseRemoteProcess(RC_Pointer handle); + +bool RC_CallConv ReadRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size); +bool RC_CallConv WriteRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size); + +void RC_CallConv ControlRemoteProcess(RC_Pointer handle, ControlRemoteProcessAction action); + +bool RC_CallConv AttachDebuggerToProcess(RC_Pointer id); +void RC_CallConv DetachDebuggerFromProcess(RC_Pointer id); +bool RC_CallConv AwaitDebugEvent(DebugEvent* evt, int timeoutInMilliseconds); +void RC_CallConv HandleDebugEvent(DebugEvent* evt); +bool RC_CallConv SetHardwareBreakpoint(RC_Pointer id, RC_Pointer address, HardwareBreakpointRegister reg, HardwareBreakpointTrigger type, HardwareBreakpointSize size, bool set); + +RC_Pointer RC_CallConv InitializeInput(); +bool RC_CallConv GetPressedKeys(RC_Pointer handle, Keys* state[], int* count); +void RC_CallConv ReleaseInput(RC_Pointer handle); \ No newline at end of file diff --git a/NativeHelper/NativeHelper.vcxproj b/NativeCore/Windows/NativeCore.vcxproj similarity index 57% rename from NativeHelper/NativeHelper.vcxproj rename to NativeCore/Windows/NativeCore.vcxproj index 3e966839..5600a51a 100644 --- a/NativeHelper/NativeHelper.vcxproj +++ b/NativeCore/Windows/NativeCore.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -21,33 +21,33 @@ {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F} Win32Proj - NativeHelper - 8.1 + NativeCore + 10.0 DynamicLibrary true - v140 - MultiByte + v143 + Unicode DynamicLibrary false - v140 + v143 true MultiByte DynamicLibrary true - v140 + v143 MultiByte DynamicLibrary false - v140 + v143 true MultiByte @@ -72,26 +72,30 @@ true $(ProjectName) - $(SolutionDir)bin\$(Configuration)\ - .\beaengine\include;$(IncludePath) + $(SolutionDir)bin\$(Configuration)\$(PlatformTarget)\ + $(SolutionDir)obj\$(Configuration)\$(PlatformTarget)\$(MSBuildProjectName)\ + ..\Dependencies\distorm\include;..\Dependencies\beaengine\include;$(IncludePath) true $(ProjectName) - $(SolutionDir)\bin\$(Configuration)\x64\ - .\beaengine\include;$(IncludePath) + $(SolutionDir)bin\$(Configuration)\$(PlatformTarget)\ + $(SolutionDir)obj\$(Configuration)\$(PlatformTarget)\$(MSBuildProjectName)\ + ..\Dependencies\distorm\include;..\Dependencies\beaengine\include;$(IncludePath) false $(ProjectName) - $(SolutionDir)bin\$(Configuration)\ - .\beaengine\include;$(IncludePath) + $(SolutionDir)bin\$(Configuration)\$(PlatformTarget)\ + $(SolutionDir)obj\$(Configuration)\$(PlatformTarget)\$(MSBuildProjectName)\ + ..\Dependencies\distorm\include;..\Dependencies\beaengine\include;$(IncludePath) false $(ProjectName) - $(SolutionDir)bin\$(Configuration)\x64\ - .\beaengine\include;$(IncludePath) + $(SolutionDir)bin\$(Configuration)\$(PlatformTarget)\ + $(SolutionDir)obj\$(Configuration)\$(PlatformTarget)\$(MSBuildProjectName)\ + ..\Dependencies\distorm\include;..\Dependencies\beaengine\include;$(IncludePath) @@ -99,12 +103,14 @@ Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVEHELPER_EXPORTS;BEA_ENGINE_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions) + stdcpp17 Windows true exports.def + dinput8.lib;dxguid.lib;%(AdditionalDependencies) @@ -113,12 +119,14 @@ Level3 Disabled - _DEBUG;_WINDOWS;_USRDLL;NATIVEHELPER_EXPORTS;BEA_ENGINE_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + _DEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;RECLASSNET64;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions) + stdcpp17 Windows true exports.def + dinput8.lib;dxguid.lib;%(AdditionalDependencies) @@ -129,7 +137,8 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVEHELPER_EXPORTS;BEA_ENGINE_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions) + stdcpp17 Windows @@ -137,6 +146,7 @@ true true exports.def + dinput8.lib;dxguid.lib;%(AdditionalDependencies) @@ -147,7 +157,8 @@ MaxSpeed true true - NDEBUG;_WINDOWS;_USRDLL;NATIVEHELPER_EXPORTS;BEA_ENGINE_STATIC;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + NDEBUG;_WINDOWS;_USRDLL;NATIVECORE_EXPORTS;_CRT_SECURE_NO_WARNINGS;NOMINMAX;RECLASSNET64;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions) + stdcpp17 Windows @@ -155,15 +166,51 @@ true true exports.def + dinput8.lib;dxguid.lib;%(AdditionalDependencies) - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/NativeCore/Windows/NativeCore.vcxproj.filters b/NativeCore/Windows/NativeCore.vcxproj.filters new file mode 100644 index 00000000..eb42b939 --- /dev/null +++ b/NativeCore/Windows/NativeCore.vcxproj.filters @@ -0,0 +1,125 @@ + + + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Functions + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Shared + + + + + + + + {9285bf7e-f1bc-42eb-b760-942eeefb0133} + + + {b74771cf-fe41-431f-b0fe-91f421240d53} + + + {4b8b2ee0-6a06-4e69-bce3-ff446bfa6b82} + + + {faf06b55-02ad-4707-a65d-37e1c0d13640} + + + + + + + Shared + + + Shared + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + Dependencies\distorm + + + \ No newline at end of file diff --git a/NativeCore/Windows/OpenRemoteProcess.cpp b/NativeCore/Windows/OpenRemoteProcess.cpp new file mode 100644 index 00000000..d8944dd3 --- /dev/null +++ b/NativeCore/Windows/OpenRemoteProcess.cpp @@ -0,0 +1,29 @@ +#include + +#include "NativeCore.hpp" + +RC_Pointer RC_CallConv OpenRemoteProcess(RC_Pointer id, ProcessAccess desiredAccess) +{ + DWORD access = STANDARD_RIGHTS_REQUIRED | PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION | SYNCHRONIZE; + switch (desiredAccess) + { + case ProcessAccess::Read: + access |= PROCESS_VM_READ; + break; + case ProcessAccess::Write: + access |= PROCESS_VM_OPERATION | PROCESS_VM_WRITE; + break; + case ProcessAccess::Full: + access |= PROCESS_VM_READ | PROCESS_VM_OPERATION | PROCESS_VM_WRITE; + break; + } + + const auto handle = OpenProcess(access, FALSE, static_cast(reinterpret_cast(id))); + + if (handle == nullptr || handle == INVALID_HANDLE_VALUE) + { + return nullptr; + } + + return handle; +} diff --git a/NativeCore/Windows/ReadRemoteMemory.cpp b/NativeCore/Windows/ReadRemoteMemory.cpp new file mode 100644 index 00000000..a29b8ae2 --- /dev/null +++ b/NativeCore/Windows/ReadRemoteMemory.cpp @@ -0,0 +1,16 @@ +#include + +#include "NativeCore.hpp" + +bool RC_CallConv ReadRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size) +{ + buffer = reinterpret_cast(reinterpret_cast(buffer) + offset); + + SIZE_T numberOfBytesRead; + if (ReadProcessMemory(handle, address, buffer, size, &numberOfBytesRead) && size == numberOfBytesRead) + { + return true; + } + + return false; +} diff --git a/NativeCore/Windows/WriteRemoteMemory.cpp b/NativeCore/Windows/WriteRemoteMemory.cpp new file mode 100644 index 00000000..e0dac2df --- /dev/null +++ b/NativeCore/Windows/WriteRemoteMemory.cpp @@ -0,0 +1,25 @@ +#include + +#include "NativeCore.hpp" + +bool RC_CallConv WriteRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size) +{ + buffer = reinterpret_cast(reinterpret_cast(buffer) + offset); + + DWORD oldProtect; + if (VirtualProtectEx(handle, address, size, PAGE_EXECUTE_READWRITE, &oldProtect)) + { + SIZE_T numberOfBytesWritten; + if (WriteProcessMemory(handle, address, buffer, size, &numberOfBytesWritten)) + { + VirtualProtectEx(handle, address, size, oldProtect, nullptr); + + if (size == numberOfBytesWritten) + { + return true; + } + } + } + + return false; +} diff --git a/NativeCore/Windows/exports.def b/NativeCore/Windows/exports.def new file mode 100644 index 00000000..0d5093cb --- /dev/null +++ b/NativeCore/Windows/exports.def @@ -0,0 +1,19 @@ +LIBRARY +EXPORTS + IsProcessValid + OpenRemoteProcess + CloseRemoteProcess + ReadRemoteMemory + WriteRemoteMemory + EnumerateProcesses + EnumerateRemoteSectionsAndModules + DisassembleCode + ControlRemoteProcess + AttachDebuggerToProcess + DetachDebuggerFromProcess + AwaitDebugEvent + HandleDebugEvent + SetHardwareBreakpoint + InitializeInput + GetPressedKeys + ReleaseInput diff --git a/NativeHelper/NativeHelper.vcxproj.filters b/NativeHelper/NativeHelper.vcxproj.filters deleted file mode 100644 index 65357285..00000000 --- a/NativeHelper/NativeHelper.vcxproj.filters +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/NativeHelper/beaengine/include/beaengine/BeaEngine.h b/NativeHelper/beaengine/include/beaengine/BeaEngine.h deleted file mode 100644 index 64bc2e7e..00000000 --- a/NativeHelper/beaengine/include/beaengine/BeaEngine.h +++ /dev/null @@ -1,389 +0,0 @@ -#ifndef _BEA_ENGINE_ -#define _BEA_ENGINE_ -#if defined(__cplusplus) && defined(__BORLANDC__) -namespace BeaEngine { -#endif - -#include -#include -#include - -#if !defined(BEA_ENGINE_STATIC) - #if defined(BUILD_BEA_ENGINE_DLL) - #define BEA_API bea__api_export__ - #else - #define BEA_API bea__api_import__ - #endif -#else - #define BEA_API -#endif - - -#define INSTRUCT_LENGTH 64 - -#pragma pack(1) -typedef struct { - UInt8 L; - UInt8 vvvv; - UInt8 mmmmm; - UInt8 pp; - UInt8 state; - UInt8 opcode; -} VEX_Struct ; -#pragma pack() - -#pragma pack(1) -typedef struct { - UInt8 W_; - UInt8 R_; - UInt8 X_; - UInt8 B_; - UInt8 state; -} REX_Struct ; -#pragma pack() - -#pragma pack(1) -typedef struct { - int Number; - int NbUndefined; - UInt8 LockPrefix; - UInt8 OperandSize; - UInt8 AddressSize; - UInt8 RepnePrefix; - UInt8 RepPrefix; - UInt8 FSPrefix; - UInt8 SSPrefix; - UInt8 GSPrefix; - UInt8 ESPrefix; - UInt8 CSPrefix; - UInt8 DSPrefix; - UInt8 BranchTaken; - UInt8 BranchNotTaken; - REX_Struct REX; - char alignment[2]; -} PREFIXINFO ; -#pragma pack() - -#pragma pack(1) -typedef struct { - UInt8 OF_; - UInt8 SF_; - UInt8 ZF_; - UInt8 AF_; - UInt8 PF_; - UInt8 CF_; - UInt8 TF_; - UInt8 IF_; - UInt8 DF_; - UInt8 NT_; - UInt8 RF_; - UInt8 alignment; -} EFLStruct ; -#pragma pack() - -#pragma pack(4) -typedef struct { - Int32 BaseRegister; - Int32 IndexRegister; - Int32 Scale; - Int64 Displacement; -} MEMORYTYPE ; -#pragma pack() - - -#pragma pack(1) -typedef struct { - Int32 Category; - Int32 Opcode; - char Mnemonic[24]; - Int32 BranchType; - EFLStruct Flags; - UInt64 AddrValue; - Int64 Immediat; - UInt32 ImplicitModifiedRegs; -} INSTRTYPE; -#pragma pack() - -#pragma pack(1) -typedef struct { - char ArgMnemonic[24]; - UInt64 ArgType; - Int32 ArgSize; - Int32 ArgPosition; - UInt32 AccessMode; - MEMORYTYPE Memory; - UInt32 SegmentReg; -} ARGTYPE; -#pragma pack() - -/* reserved structure used for thread-safety */ -/* unusable by customer */ -#pragma pack(1) -typedef struct { - UIntPtr EIP_; - UInt64 EIP_VA; - UIntPtr EIP_REAL; - Int32 OriginalOperandSize; - Int32 OperandSize; - Int32 MemDecoration; - Int32 AddressSize; - Int32 MOD_; - Int32 RM_; - Int32 INDEX_; - Int32 SCALE_; - Int32 BASE_; - Int32 MMX_; - Int32 SSE_; - Int32 CR_; - Int32 DR_; - Int32 SEG_; - Int32 REGOPCODE; - UInt32 DECALAGE_EIP; - Int32 FORMATNUMBER; - Int32 SYNTAX_; - UInt64 EndOfBlock; - Int32 RelativeAddress; - UInt32 Architecture; - Int32 ImmediatSize; - Int32 NB_PREFIX; - Int32 PrefRepe; - Int32 PrefRepne; - UInt32 SEGMENTREGS; - UInt32 SEGMENTFS; - Int32 third_arg; - Int32 TAB_; - Int32 ERROR_OPCODE; - REX_Struct REX; - Int32 OutOfBlock; - VEX_Struct VEX; - Int32 AVX_; - Int32 MPX_; -} InternalDatas; -#pragma pack() - -/* ************** main structure ************ */ -#pragma pack(1) -typedef struct _Disasm { - UIntPtr EIP; - UInt64 VirtualAddr; - UInt32 SecurityBlock; - char CompleteInstr[INSTRUCT_LENGTH]; - UInt32 Archi; - UInt64 Options; - INSTRTYPE Instruction; - ARGTYPE Argument1; - ARGTYPE Argument2; - ARGTYPE Argument3; - ARGTYPE Argument4; - PREFIXINFO Prefix; - InternalDatas Reserved_; -} DISASM, *PDISASM, *LPDISASM; -#pragma pack() - -/* #UD exception */ -#define UD_ 2 - -#define ESReg 1 -#define DSReg 2 -#define FSReg 3 -#define GSReg 4 -#define CSReg 5 -#define SSReg 6 - -#define InvalidPrefix 4 -#define SuperfluousPrefix 2 -#define NotUsedPrefix 0 -#define MandatoryPrefix 8 -#define InUsePrefix 1 - -#define LowPosition 0 -#define HighPosition 1 - -enum INSTRUCTION_TYPE -{ - GENERAL_PURPOSE_INSTRUCTION = 0x10000, - FPU_INSTRUCTION = 0x20000, - MMX_INSTRUCTION = 0x40000, - SSE_INSTRUCTION = 0x80000, - SSE2_INSTRUCTION = 0x100000, - SSE3_INSTRUCTION = 0x200000, - SSSE3_INSTRUCTION = 0x400000, - SSE41_INSTRUCTION = 0x800000, - SSE42_INSTRUCTION = 0x1000000, - SYSTEM_INSTRUCTION = 0x2000000, - VM_INSTRUCTION = 0x4000000, - UNDOCUMENTED_INSTRUCTION = 0x8000000, - AMD_INSTRUCTION = 0x10000000, - ILLEGAL_INSTRUCTION = 0x20000000, - AES_INSTRUCTION = 0x40000000, - CLMUL_INSTRUCTION = (int)0x80000000, - AVX_INSTRUCTION = (int)0x100000000, - AVX2_INSTRUCTION = (int)0x200000000, - MPX_INSTRUCTION = (int)0x400000000, - DATA_TRANSFER = 0x1, - ARITHMETIC_INSTRUCTION, - LOGICAL_INSTRUCTION, - SHIFT_ROTATE, - BIT_UInt8, - CONTROL_TRANSFER, - STRING_INSTRUCTION, - InOutINSTRUCTION, - ENTER_LEAVE_INSTRUCTION, - FLAG_CONTROL_INSTRUCTION, - SEGMENT_REGISTER, - MISCELLANEOUS_INSTRUCTION, - COMPARISON_INSTRUCTION, - LOGARITHMIC_INSTRUCTION, - TRIGONOMETRIC_INSTRUCTION, - UNSUPPORTED_INSTRUCTION, - LOAD_CONSTANTS, - FPUCONTROL, - STATE_MANAGEMENT, - CONVERSION_INSTRUCTION, - SHUFFLE_UNPACK, - PACKED_SINGLE_PRECISION, - SIMD128bits, - SIMD64bits, - CACHEABILITY_CONTROL, - FP_INTEGER_CONVERSION, - SPECIALIZED_128bits, - SIMD_FP_PACKED, - SIMD_FP_HORIZONTAL , - AGENT_SYNCHRONISATION, - PACKED_ALIGN_RIGHT , - PACKED_SIGN, - PACKED_BLENDING_INSTRUCTION, - PACKED_TEST, - PACKED_MINMAX, - HORIZONTAL_SEARCH, - PACKED_EQUALITY, - STREAMING_LOAD, - INSERTION_EXTRACTION, - DOT_PRODUCT, - SAD_INSTRUCTION, - ACCELERATOR_INSTRUCTION, /* crc32, popcnt (sse4.2) */ - ROUND_INSTRUCTION - -}; - -enum EFLAGS_STATES -{ - TE_ = 1, - MO_ = 2, - RE_ = 4, - SE_ = 8, - UN_ = 0x10, - PR_ = 0x20 -}; - -enum BRANCH_TYPE -{ - JO = 1, - JC = 2, - JE = 3, - JA = 4, - JS = 5, - JP = 6, - JL = 7, - JG = 8, - JB = 2, /* JC == JB */ - JECXZ = 10, - JmpType = 11, - CallType = 12, - RetType = 13, - JNO = -1, - JNC = -2, - JNE = -3, - JNA = -4, - JNS = -5, - JNP = -6, - JNL = -7, - JNG = -8, - JNB = -2 /* JNC == JNB */ -}; - -enum ARGUMENTS_TYPE -{ - NO_ARGUMENT = 0x10000000, - REGISTER_TYPE = 0x20000000, - MEMORY_TYPE = 0x40000000, - CONSTANT_TYPE = (UInt32)0x80000000, - - MMX_REG = 0x10000, - GENERAL_REG = 0x20000, - FPU_REG = 0x40000, - SSE_REG = 0x80000, - CR_REG = 0x100000, - DR_REG = 0x200000, - SPECIAL_REG = 0x400000, - MEMORY_MANAGEMENT_REG = 0x800000, - SEGMENT_REG = 0x1000000, - AVX_REG = 0x2000000, - MPX_REG = 0x4000000, - RELATIVE_ = 0x4000000, - ABSOLUTE_ = 0x8000000, - - READ = 0x1, - WRITE = 0x2, - - REG0 = 0x1, - REG1 = 0x2, - REG2 = 0x4, - REG3 = 0x8, - REG4 = 0x10, - REG5 = 0x20, - REG6 = 0x40, - REG7 = 0x80, - REG8 = 0x100, - REG9 = 0x200, - REG10 = 0x400, - REG11 = 0x800, - REG12 = 0x1000, - REG13 = 0x2000, - REG14 = 0x4000, - REG15 = 0x8000 -}; - -enum SPECIAL_INFO -{ - UNKNOWN_OPCODE = -1, - OUT_OF_BLOCK = 0, - - /* === mask = 0xff */ - NoTabulation = 0x00000000, - Tabulation = 0x00000001, - - /* === mask = 0xff00 */ - MasmSyntax = 0x00000000, - GoAsmSyntax = 0x00000100, - NasmSyntax = 0x00000200, - ATSyntax = 0x00000400, - IntrinsicMemSyntax= 0x00000800, - - /* === mask = 0xff0000 */ - PrefixedNumeral = 0x00010000, - SuffixedNumeral = 0x00000000, - - /* === mask = 0xff000000 */ - ShowSegmentRegs = 0x01000000 -}; - - -#ifdef __cplusplus -extern "C" { -#endif - -BEA_API int __bea_callspec__ Disasm (LPDISASM pDisAsm); -BEA_API const__ char* __bea_callspec__ BeaEngineVersion (void); -BEA_API const__ char* __bea_callspec__ BeaEngineRevision (void); - -#ifdef __cplusplus -} -#endif - - -#if defined(__cplusplus) && defined(__BORLANDC__) -}; -using namespace BeaEngine; -#endif -#endif diff --git a/NativeHelper/beaengine/include/beaengine/basic_types.h b/NativeHelper/beaengine/include/beaengine/basic_types.h deleted file mode 100644 index 4d080dfd..00000000 --- a/NativeHelper/beaengine/include/beaengine/basic_types.h +++ /dev/null @@ -1,272 +0,0 @@ -/** - * @file basic_types.h - * @author - * @date Thu Dec 24 19:31:22 2009 - * - * @brief Definitions of fixed-size integer types for various platforms - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -#ifndef __BEA_BASIC_TYPES_HPP__ -#define __BEA_BASIC_TYPES_HPP__ - -#include - -#if defined(__GNUC__) || defined (__INTEL_COMPILER) || defined(__LCC__) || defined(__POCC__) -#include -#endif - -#if defined(_MSC_VER) && !defined(__BORLANDC__) - /* - * Windows/Visual C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed __int64 Int64; - typedef unsigned __int64 UInt64; - #if defined(_WIN64) - #define BEA_PTR_IS_64_BIT 1 - typedef signed __int64 IntPtr; - typedef unsigned __int64 UIntPtr; - #else - typedef signed long IntPtr; - typedef size_t UIntPtr; - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__POCC__) - /* - * PellesC - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed long long Int64; - typedef unsigned long long UInt64; - #if defined(_WIN64) - #define BEA_PTR_IS_64_BIT 1 - typedef signed long long IntPtr; - typedef unsigned long long UIntPtr; - #else - typedef signed long IntPtr; - typedef size_t UIntPtr; - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__GNUC__) || defined(__LCC__) - /* - * Unix/GCC - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef intptr_t IntPtr; - typedef uintptr_t UIntPtr; - #if defined(__LP64__) - #define BEA_PTR_IS_64_BIT 1 - #define BEA_LONG_IS_64_BIT 1 - typedef signed long Int64; - typedef unsigned long UInt64; - #else - #if defined (__INTEL_COMPILER) || defined (__ICC) || defined (_ICC) - typedef __int64 Int64; - typedef unsigned __int64 UInt64; - #else - typedef signed long long Int64; - typedef unsigned long long UInt64; - #endif - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__DECCXX) - /* - * Compaq C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed __int64 Int64; - typedef unsigned __int64 UInt64; - #if defined(__VMS) - #if defined(__32BITS) - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #else - typedef Int64 IntPtr; - typedef UInt64 UIntPtr; - #define BEA_PTR_IS_64_BIT 1 - #endif - #else - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #define BEA_PTR_IS_64_BIT 1 - #define BEA_LONG_IS_64_BIT 1 - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__HP_aCC) - /* - * HP Ansi C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #if defined(__LP64__) - #define BEA_PTR_IS_64_BIT 1 - #define BEA_LONG_IS_64_BIT 1 - typedef signed long Int64; - typedef unsigned long UInt64; - #else - typedef signed long long Int64; - typedef unsigned long long UInt64; - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) - /* - * SUN Forte C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #if defined(__sparcv9) - #define BEA_PTR_IS_64_BIT 1 - #define BEA_LONG_IS_64_BIT 1 - typedef signed long Int64; - typedef unsigned long UInt64; - #else - typedef signed long long Int64; - typedef unsigned long long UInt64; - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__IBMCPP__) - /* - * IBM XL C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #if defined(__64BIT__) - #define BEA_PTR_IS_64_BIT 1 - #define BEA_LONG_IS_64_BIT 1 - typedef signed long Int64; - typedef unsigned long UInt64; - #else - typedef signed long long Int64; - typedef unsigned long long UInt64; - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__BORLANDC__) - /* - * Borland C/C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef unsigned __int64 Int64; - typedef signed __int64 UInt64; - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #define BEA_HAVE_INT64 1 -#elif defined(__WATCOMC__) - /* - * Watcom C/C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef unsigned __int64 Int64; - typedef signed __int64 UInt64; - #define BEA_HAVE_INT64 1 - typedef size_t UIntPtr; -#elif defined(__sgi) - /* - * MIPSpro C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #if _MIPS_SZLONG == 64 - #define BEA_PTR_IS_64_BIT 1 - #define BEA_LONG_IS_64_BIT 1 - typedef signed long Int64; - typedef unsigned long UInt64; - #else - typedef signed long long Int64; - typedef unsigned long long UInt64; - #endif - #define BEA_HAVE_INT64 1 -#endif - -#if defined(_MSC_VER) || defined(__BORLANDC__) - #define W64LIT(x) x##ui64 -#else - #define W64LIT(x) x##ULL -#endif - - -#ifndef C_STATIC_ASSERT -#define C_STATIC_ASSERT(tag_name, x) \ - typedef int cache_static_assert_ ## tag_name[(x) * 2-1] -#endif - -C_STATIC_ASSERT(sizeof_Int8 , (sizeof(Int8) == 1)); -C_STATIC_ASSERT(sizeof_UInt8, (sizeof(UInt8) == 1)); - -C_STATIC_ASSERT(sizeof_Int16 , (sizeof(Int16) == 2)); -C_STATIC_ASSERT(sizeof_UInt16, (sizeof(UInt16) == 2)); - -C_STATIC_ASSERT(sizeof_Int32 , (sizeof(Int32) == 4)); -C_STATIC_ASSERT(sizeof_UInt32, (sizeof(UInt32) == 4)); - -C_STATIC_ASSERT(sizeof_Int64 , (sizeof(Int64) == 8)); -C_STATIC_ASSERT(sizeof_UInt64, (sizeof(UInt64) == 8)); - -#endif diff --git a/NativeHelper/beaengine/include/beaengine/export.h b/NativeHelper/beaengine/include/beaengine/export.h deleted file mode 100644 index 6e550dbb..00000000 --- a/NativeHelper/beaengine/include/beaengine/export.h +++ /dev/null @@ -1,173 +0,0 @@ -/** - * @file export.h - * @author igor.gutnik@gmail.com - * @date Mon Sep 22 09:28:54 2008 - * - * @brief This file sets things up for C dynamic library function definitions and - * static inlined functions - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -#ifndef __BEA_EXPORT_H__ -#define __BEA_EXPORT_H__ - - -/* Set up for C function definitions, even when using C++ */ - -#ifdef __cplusplus -#define CPP_VISIBLE_BEGIN extern "C" { -#define CPP_VISIBLE_END } -#else -#define CPP_VISIBLE_BEGIN -#define CPP_VISIBLE_END -#endif - -#if defined(_MSC_VER) -#pragma warning( disable: 4251 ) -#endif - -/* Some compilers use a special export keyword */ -#ifndef bea__api_export__ -# if defined(__BEOS__) -# if defined(__GNUC__) -# define bea__api_export__ __declspec(dllexport) -# else -# define bea__api_export__ __declspec(export) -# endif -# elif defined(_WIN32) || defined(_WIN64) -# ifdef __BORLANDC__ -# define bea__api_export__ __declspec(dllexport) -# define bea__api_import__ __declspec(dllimport) -# elif defined(__WATCOMC__) -# define bea__api_export__ __declspec(dllexport) -# define bea__api_import__ -# else -# define bea__api_export__ __declspec(dllexport) -# define bea__api_import__ __declspec(dllimport) -# endif -# elif defined(__OS2__) -# ifdef __WATCOMC__ -# define bea__api_export__ __declspec(dllexport) -# define bea__api_import__ -# else -# define bea__api_export__ -# define bea__api_import__ -# endif -# else -# if defined(_WIN32) && defined(__GNUC__) && __GNUC__ >= 4 -# define bea__api_export__ __attribubea__ ((visibility("default"))) -# define bea__api_import__ __attribubea__ ((visibility("default"))) -# else -# define bea__api_export__ -# define bea__api_import__ -# endif -# endif -#endif - -/* Use C calling convention by default*/ - -#ifndef __bea_callspec__ -#if defined(BEA_USE_STDCALL) - #if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64) - #if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__POCC__) - #define __bea_callspec__ __stdcall - #else - #define __bea_callspec__ - #endif - #else - #ifdef __OS2__ - #define __bea_callspec__ _System - #else - #define __bea_callspec__ - #endif - #endif -#else - #define __bea_callspec__ -#endif -#endif - -#ifdef __SYMBIAN32__ -# ifndef EKA2 -# undef bea__api_export__ -# undef bea__api_import__ -# define bea__api_export__ -# define bea__api_import__ -# elif !defined(__WINS__) -# undef bea__api_export__ -# undef bea__api_import__ -# define bea__api_export__ __declspec(dllexport) -# define bea__api_import__ __declspec(dllexport) -# endif /* !EKA2 */ -#endif /* __SYMBIAN32__ */ - - -#if defined(__GNUC__) && (__GNUC__ > 2) -#define BEA_EXPECT_CONDITIONAL(c) (__builtin_expect((c), 1)) -#define BEA_UNEXPECT_CONDITIONAL(c) (__builtin_expect((c), 0)) -#else -#define BEA_EXPECT_CONDITIONAL(c) (c) -#define BEA_UNEXPECT_CONDITIONAL(c) (c) -#endif - - -/* Set up compiler-specific options for inlining functions */ -#ifndef BEA_HAS_INLINE -#if defined(__GNUC__) || defined(__POCC__) || defined(__WATCOMC__) || defined(__SUNPRO_C) -#define BEA_HAS_INLINE -#else -/* Add any special compiler-specific cases here */ -#if defined(_MSC_VER) || defined(__BORLANDC__) || \ - defined(__DMC__) || defined(__SC__) || \ - defined(__WATCOMC__) || defined(__LCC__) || \ - defined(__DECC) || defined(__EABI__) -#ifndef __inline__ -#define __inline__ __inline -#endif -#define BEA_HAS_INLINE -#else -#if !defined(__MRC__) && !defined(_SGI_SOURCE) -#ifndef __inline__ -#define __inline__ inline -#endif -#define BEA_HAS_INLINE -#endif /* Not a funky compiler */ -#endif /* Visual C++ */ -#endif /* GNU C */ -#endif /* CACHE_HAS_INLINE */ - -/* If inlining isn't supported, remove "__inline__", turning static - inlined functions into static functions (resulting in code bloat - in all files which include the offending header files) -*/ -#ifndef BEA_HAS_INLINE -#define __inline__ -#endif - -/* fix a bug with gcc under windows */ - -#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64) - #if defined(__MINGW32__) - #define const__ - #else - #define const__ const - #endif -#else - #define const__ const -#endif - - - -#endif diff --git a/NativeHelper/beaengine/include/beaengine/macros.h b/NativeHelper/beaengine/include/beaengine/macros.h deleted file mode 100644 index 8a5dc999..00000000 --- a/NativeHelper/beaengine/include/beaengine/macros.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __BEAENGINE_MACROS_H__ -#define __BEAENGINE_MACROS_H__ -/* -============================================================================ - Compiler Silencing macros - - Some compilers complain about parameters that are not used. This macro - should keep them quiet. - ============================================================================ - */ - -# if defined (__GNUC__) && ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))) -# define BEA_UNUSED_ARG(a) (void) (a) -#elif defined (ghs) || defined (__GNUC__) || defined (__hpux) || defined (__sgi) || defined (__DECCXX) || defined (__rational__) || defined (__USLC__) || defined (BEA__RM544) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || defined(__BORLANDC__) -/* - Some compilers complain about "statement with no effect" with (a). - This eliminates the warnings, and no code is generated for the null - conditional statement. Note, that may only be true if -O is enabled, - such as with GreenHills (ghs) 1.8.8. - */ - -# define BEA_UNUSED_ARG(a) do {/* null */} while (&a == 0) -#elif defined (__DMC__) - #if defined(__cplusplus) - #define BEA_UNUSED_ID(identifier) - template - inline void BEA_UNUSED_ARG(const T& BEA_UNUSED_ID(t)) { } - #else - #define BEA_UNUSED_ARG(a) - #endif -#else /* ghs || __GNUC__ || ..... */ -# define BEA_UNUSED_ARG(a) (a) -#endif /* ghs || __GNUC__ || ..... */ - -#if defined (_MSC_VER) || defined(__sgi) || defined (ghs) || defined (__DECCXX) || defined(__BORLANDC__) || defined (BEA_RM544) || defined (__USLC__) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || (defined (__HP_aCC) && (__HP_aCC >= 60500)) -# define BEA_NOTREACHED(a) -#else /* __sgi || ghs || ..... */ -# define BEA_NOTREACHED(a) a -#endif /* __sgi || ghs || ..... */ - -#endif /* __BEAENGINE_MACROS_H__ */ diff --git a/NativeHelper/beaengine/src/BeaEngine.c b/NativeHelper/beaengine/src/BeaEngine.c deleted file mode 100644 index 9ede89bb..00000000 --- a/NativeHelper/beaengine/src/BeaEngine.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * BeaEngine 4 - x86 & x86-64 disassembler library - * - * Copyright 2006-2010, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -#include -#include -#include - -#include "beaengine/BeaEngine.h" -#include "Includes/protos.h" -#include "Includes/internal_datas.h" -#include "Includes/instr_set/Data_opcode.h" -#include "Includes/instr_set/opcodes_A_M.c" -#include "Includes/instr_set/opcodes_N_Z.c" -#include "Includes/instr_set/opcodes_Grp1.c" -#include "Includes/instr_set/opcodes_Grp2.c" -#include "Includes/instr_set/opcodes_Grp3.c" -#include "Includes/instr_set/opcodes_Grp4.c" -#include "Includes/instr_set/opcodes_Grp5.c" -#include "Includes/instr_set/opcodes_Grp6.c" -#include "Includes/instr_set/opcodes_Grp7.c" -#include "Includes/instr_set/opcodes_Grp8.c" -#include "Includes/instr_set/opcodes_Grp9.c" -#include "Includes/instr_set/opcodes_Grp12.c" -#include "Includes/instr_set/opcodes_Grp13.c" -#include "Includes/instr_set/opcodes_Grp14.c" -#include "Includes/instr_set/opcodes_Grp15.c" -#include "Includes/instr_set/opcodes_Grp16.c" -#include "Includes/instr_set/opcodes_Grp17.c" -#include "Includes/instr_set/opcodes_FPU.c" -#include "Includes/instr_set/opcodes_MMX.c" -#include "Includes/instr_set/opcodes_SSE.c" -#include "Includes/instr_set/opcodes_AES.c" -#include "Includes/instr_set/opcodes_CLMUL.c" -#include "Includes/instr_set/opcodes_prefixes.c" -#include "Includes/Routines_ModRM.c" -#include "Includes/Routines_Disasm.c" -#include "Includes/BeaEngineVersion.c" - -void BeaEngine(void){return;} diff --git a/NativeHelper/beaengine/src/COPYING.LESSER.txt b/NativeHelper/beaengine/src/COPYING.LESSER.txt deleted file mode 100644 index fc8a5de7..00000000 --- a/NativeHelper/beaengine/src/COPYING.LESSER.txt +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/NativeHelper/beaengine/src/COPYING.txt b/NativeHelper/beaengine/src/COPYING.txt deleted file mode 100644 index 94a9ed02..00000000 --- a/NativeHelper/beaengine/src/COPYING.txt +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/NativeHelper/beaengine/src/Includes/BeaEngineVersion.c b/NativeHelper/beaengine/src/Includes/BeaEngineVersion.c deleted file mode 100644 index e6f82508..00000000 --- a/NativeHelper/beaengine/src/Includes/BeaEngineVersion.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright 2006-2010, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ -const__ char* __bea_callspec__ BeaEngineVersion(void) { - return "5.0"; -} -const__ char* __bea_callspec__ BeaEngineRevision(void) { - return "dev"; -} diff --git a/NativeHelper/beaengine/src/Includes/Routines_Disasm.c b/NativeHelper/beaengine/src/Includes/Routines_Disasm.c deleted file mode 100644 index f9a4ab2e..00000000 --- a/NativeHelper/beaengine/src/Includes/Routines_Disasm.c +++ /dev/null @@ -1,1324 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * - * ==================================================================== */ -int __bea_callspec__ Disasm (PDISASM pMyDisasm) { - - if (InitVariables(pMyDisasm)) { - (void) AnalyzeOpcode(pMyDisasm); - if (!GV.OutOfBlock) { - FixArgSizeForMemoryOperand(pMyDisasm); - FixREXPrefixes(pMyDisasm); - FillSegmentsRegisters(pMyDisasm); - CompleteInstructionFields(pMyDisasm); - #ifndef BEA_LIGHT_DISASSEMBLY - if (GV.SYNTAX_ == ATSyntax) { - BuildCompleteInstructionATSyntax(pMyDisasm); - } - else { - BuildCompleteInstruction(pMyDisasm); - } - #endif - if (GV.ERROR_OPCODE) { - return -1; - } - else { - return (int) (GV.EIP_-(*pMyDisasm).EIP); - } - } - else { - return 0; - } - } - else { - return -1; - } -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ CompleteInstructionFields (PDISASM pMyDisasm) { - - if (((*pMyDisasm).Instruction.BranchType == JmpType) || ((*pMyDisasm).Instruction.BranchType == CallType)) { - (*pMyDisasm).Argument1.AccessMode = READ; - } -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ FailDecode(PDISASM pMyDisasm) -{ - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "??? "); - #endif - GV.ERROR_OPCODE = 1; -} - -/* ==================================================================== - * - * ==================================================================== */ -int __bea_callspec__ InitVariables (PDISASM pMyDisasm) { - - (void) memset (&GV, 0, sizeof (InternalDatas)); - GV.EIP_ = (*pMyDisasm).EIP; - GV.EIP_REAL = GV.EIP_; - GV.EIP_VA = (*pMyDisasm).VirtualAddr; - GV.EndOfBlock = GV.EIP_ + 15; - if ((*pMyDisasm).SecurityBlock != 0) GV.EndOfBlock = GV.EIP_ + (*pMyDisasm).SecurityBlock; - GV.OperandSize = 32; - GV.OriginalOperandSize = 32; - GV.AddressSize = 32; - GV.Architecture = (*pMyDisasm).Archi; - (*pMyDisasm).Prefix.Number = 0; - if (GV.Architecture == 64) { - GV.AddressSize = 64; - } - if (GV.Architecture == 16) { - GV.OperandSize = 16; - GV.OriginalOperandSize = 16; - GV.AddressSize = 16; - } - (void) memset (&(*pMyDisasm).Argument1, 0, sizeof (ARGTYPE)); - (void) memset (&(*pMyDisasm).Argument2, 0, sizeof (ARGTYPE)); - (void) memset (&(*pMyDisasm).Argument3, 0, sizeof (ARGTYPE)); - (void) memset (&(*pMyDisasm).Argument4, 0, sizeof (ARGTYPE)); - (void) memset (&(*pMyDisasm).Prefix, 0, sizeof (PREFIXINFO)); - (*pMyDisasm).Argument1.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgPosition = LowPosition; - (*pMyDisasm).Argument2.ArgPosition = LowPosition; - (*pMyDisasm).Argument3.ArgPosition = LowPosition; - (*pMyDisasm).Argument4.ArgPosition = LowPosition; - (*pMyDisasm).Argument1.ArgType = NO_ARGUMENT; - (*pMyDisasm).Argument2.ArgType = NO_ARGUMENT; - (*pMyDisasm).Argument3.ArgType = NO_ARGUMENT; - (*pMyDisasm).Argument4.ArgType = NO_ARGUMENT; - (*pMyDisasm).Argument2.AccessMode = READ; - (*pMyDisasm).Argument3.AccessMode = READ; - (*pMyDisasm).Argument4.AccessMode = READ; - (void) memset (&(*pMyDisasm).Instruction, 0, sizeof (INSTRTYPE)); - GV.TAB_ = (UInt32)(*pMyDisasm).Options & 0xff; - GV.SYNTAX_ = (UInt32)(*pMyDisasm).Options & 0xff00; - GV.FORMATNUMBER = (UInt32)(*pMyDisasm).Options & 0xff0000; - GV.SEGMENTREGS = (UInt32)(*pMyDisasm).Options & 0xff000000; - GV.OutOfBlock = 0; - return 1; -} -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ FixArgSizeForMemoryOperand (PDISASM pMyDisasm) { - - if (GV.MemDecoration == Arg2byte) { - (*pMyDisasm).Argument2.ArgSize = 8; - } - else if (GV.MemDecoration == Arg2word) { - (*pMyDisasm).Argument2.ArgSize = 16; - } - else if (GV.MemDecoration == Arg2dword) { - (*pMyDisasm).Argument2.ArgSize = 32; - } - else if (GV.MemDecoration == Arg2qword) { - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.MemDecoration == Arg2multibytes) { - (*pMyDisasm).Argument2.ArgSize = 0; - } - else if (GV.MemDecoration == Arg2tbyte) { - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.MemDecoration == Arg2fword) { - (*pMyDisasm).Argument2.ArgSize = 48; - } - else if (GV.MemDecoration == Arg2dqword) { - (*pMyDisasm).Argument2.ArgSize = 128; - } - else if (GV.MemDecoration == Arg2_m128_xmm) { - (*pMyDisasm).Argument2.ArgSize = 128; - } - else if (GV.MemDecoration == Arg2_m256_ymm) { - (*pMyDisasm).Argument2.ArgSize = 256; - } - else if (GV.MemDecoration == Arg2_m128i_xmm) { - (*pMyDisasm).Argument2.ArgSize = 128; - } - else if (GV.MemDecoration == Arg2_m128d_xmm) { - (*pMyDisasm).Argument2.ArgSize = 128; - } - else if (GV.MemDecoration == Arg2_m256d_ymm) { - (*pMyDisasm).Argument2.ArgSize = 256; - } - - if (GV.MemDecoration == Arg1byte) { - (*pMyDisasm).Argument1.ArgSize = 8; - } - else if (GV.MemDecoration == Arg1word) { - (*pMyDisasm).Argument1.ArgSize = 16; - } - else if (GV.MemDecoration == Arg1dword) { - (*pMyDisasm).Argument1.ArgSize = 32; - } - else if (GV.MemDecoration == Arg1qword) { - (*pMyDisasm).Argument1.ArgSize = 64; - } - else if (GV.MemDecoration == Arg1multibytes) { - (*pMyDisasm).Argument1.ArgSize = 0; - } - else if (GV.MemDecoration == Arg1tbyte) { - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.MemDecoration == Arg1fword) { - (*pMyDisasm).Argument1.ArgSize = 48; - } - else if (GV.MemDecoration == Arg1dqword) { - (*pMyDisasm).Argument1.ArgSize = 128; - } - else if (GV.MemDecoration == Arg1_m128_xmm) { - (*pMyDisasm).Argument1.ArgSize = 128; - } - else if (GV.MemDecoration == Arg1_m256_ymm) { - (*pMyDisasm).Argument1.ArgSize = 256; - } - else if (GV.MemDecoration == Arg1_m128i_xmm) { - (*pMyDisasm).Argument1.ArgSize = 128; - } - else if (GV.MemDecoration == Arg1_m128d_xmm) { - (*pMyDisasm).Argument1.ArgSize = 128; - } - else if (GV.MemDecoration == Arg1_m256d_ymm) { - (*pMyDisasm).Argument1.ArgSize = 256; - } - - if (GV.MemDecoration == Arg3byte) { - (*pMyDisasm).Argument3.ArgSize = 8; - } - else if (GV.MemDecoration == Arg3word) { - (*pMyDisasm).Argument3.ArgSize = 16; - } - else if (GV.MemDecoration == Arg3dword) { - (*pMyDisasm).Argument3.ArgSize = 32; - } - else if (GV.MemDecoration == Arg3qword) { - (*pMyDisasm).Argument3.ArgSize = 64; - } - else if (GV.MemDecoration == Arg3multibytes) { - (*pMyDisasm).Argument3.ArgSize = 0; - } - else if (GV.MemDecoration == Arg3tbyte) { - (*pMyDisasm).Argument3.ArgSize = 80; - } - else if (GV.MemDecoration == Arg3fword) { - (*pMyDisasm).Argument3.ArgSize = 48; - } - else if (GV.MemDecoration == Arg3dqword) { - (*pMyDisasm).Argument3.ArgSize = 128; - } - else if (GV.MemDecoration == Arg3_m128_xmm) { - (*pMyDisasm).Argument3.ArgSize = 128; - } - else if (GV.MemDecoration == Arg3_m256_ymm) { - (*pMyDisasm).Argument3.ArgSize = 256; - } - else if (GV.MemDecoration == Arg3_m128i_xmm) { - (*pMyDisasm).Argument3.ArgSize = 128; - } - else if (GV.MemDecoration == Arg3_m128d_xmm) { - (*pMyDisasm).Argument3.ArgSize = 128; - } - else if (GV.MemDecoration == Arg3_m256d_ymm) { - (*pMyDisasm).Argument3.ArgSize = 256; - } -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ FixREXPrefixes (PDISASM pMyDisasm) { - - (*pMyDisasm).Prefix.REX.W_ = GV.REX.W_; - (*pMyDisasm).Prefix.REX.R_ = GV.REX.R_; - (*pMyDisasm).Prefix.REX.X_ = GV.REX.X_; - (*pMyDisasm).Prefix.REX.B_ = GV.REX.B_; - (*pMyDisasm).Prefix.REX.state = GV.REX.state; - -} - -/* ==================================================================== - * - * ==================================================================== */ -int __bea_callspec__ AnalyzeOpcode (PDISASM pMyDisasm) { - - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)(GV.EIP_)); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - return 1; -} -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ EbGb(PDISASM pMyDisasm) -{ - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_ += GV.DECALAGE_EIP+2; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ GbEb(PDISASM pMyDisasm) -{ - GV.MemDecoration = Arg2byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_ += GV.DECALAGE_EIP+2; -} -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ EvGv(PDISASM pMyDisasm) -{ - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg1qword; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg1dword; - } - else { - GV.MemDecoration = Arg1word; - } - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ ExGx(PDISASM pMyDisasm) -{ - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ EvIv(PDISASM pMyDisasm) -{ - if (GV.OperandSize >= 32) { - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg1qword; - } - else { - GV.MemDecoration = Arg1dword; - } - GV.ImmediatSize = 32; /* place this instruction before MOD_RM routine to inform it there is an immediat value */ - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+6; - if (!Security(0, pMyDisasm)) return; - #ifndef BEA_LIGHT_DISASSEMBLY - if (GV.OperandSize == 64) { - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.16llX",(Int64) *((Int32*)(UIntPtr) (GV.EIP_-4))); - } - else { - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_-4))); - } - #endif - - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Instruction.Immediat = *((UInt32*)(UIntPtr) (GV.EIP_-4)); - } - else { - GV.MemDecoration = Arg1word; - GV.ImmediatSize = 16; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+4; - if (!Security(0, pMyDisasm)) return; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.4X",(Int64)*((UInt16*)(UIntPtr) (GV.EIP_-2))); - #endif - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Instruction.Immediat = *((UInt16*)(UIntPtr) (GV.EIP_-2)); - } -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ EvIb(PDISASM pMyDisasm) -{ - Int8 MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.ImmediatSize = 8; - if (GV.OperandSize >= 32) { - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg1qword; - } - else { - GV.MemDecoration = Arg1dword; - } - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_-1)); - if (MyNumber > 0) { - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64)*((Int8*)(UIntPtr) (GV.EIP_-1))); - } - else { - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64)*((Int8*)(IntPtr) (GV.EIP_-1))); - } - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_-1)); - if (MyNumber > 0) { - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64)*((Int8*)(UIntPtr) (GV.EIP_-1))); - } - else { - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.16llX",(Int64)*((Int8*)(IntPtr) (GV.EIP_-1))); - } - #endif - } - - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - } - else { - GV.MemDecoration = Arg1word; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.4X",(Int64)*((Int8*)(UIntPtr) (GV.EIP_-1))); - #endif - - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - } -} -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ EbIb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.ImmediatSize = 8; - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64)*((Int8*)(UIntPtr) (GV.EIP_-1))); - #endif - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_-1)); -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ Eb(PDISASM pMyDisasm) -{ - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_ += GV.DECALAGE_EIP+2; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ Ev(PDISASM pMyDisasm) -{ - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg1qword; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg1dword; - } - else { - GV.MemDecoration = Arg1word; - } - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ GvEv(PDISASM pMyDisasm) -{ - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2dword; - } - else { - GV.MemDecoration = Arg2word; - } - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; -} - -/* ==================================================================== - * Used by AVX instructions - * ==================================================================== */ -void __bea_callspec__ GyEy(PDISASM pMyDisasm) -{ - - GV.third_arg = 1; - MOD_RM(&(*pMyDisasm).Argument3, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ GvEb(PDISASM pMyDisasm) -{ - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.OperandSize = 64; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.OperandSize = 32; - } - else { - GV.MemDecoration = Arg2byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.OperandSize = 16; - } - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ GxEx(PDISASM pMyDisasm) -{ - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ GvEw(PDISASM pMyDisasm) -{ - GV.MemDecoration = Arg2word; - GV.OriginalOperandSize = GV.OperandSize; - GV.OperandSize = 16; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.OperandSize = GV.OriginalOperandSize; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ ALIb(PDISASM pMyDisasm) -{ - long MyNumber; - if (!Security(2, pMyDisasm)) return; - GV.ImmediatSize = 8; - MyNumber = *((Int8*)(IntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8Bits[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.EIP_ += 2; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ eAX_Iv(PDISASM pMyDisasm) -{ - UInt32 MyNumber; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - if (GV.OperandSize == 64) { - if (!Security(5, pMyDisasm)) return; - GV.ImmediatSize = 32; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 32; - MyNumber = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.16llX",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); - #endif - } - GV.EIP_+= 5; - } - else if (GV.OperandSize == 32) { - if (!Security(5, pMyDisasm)) return; - GV.ImmediatSize = 32; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - MyNumber = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - } - GV.EIP_+= 5; - } - else { - if (!Security(3, pMyDisasm)) return; - GV.ImmediatSize = 16; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X", (Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - } - GV.EIP_+= 3; - } - -} - -/* ==================================================================== - * - * ==================================================================== */ -int __bea_callspec__ Security(int len, PDISASM pMyDisasm) -{ - if ((GV.EndOfBlock != 0) && (GV.EIP_+(UInt64)len >= GV.EndOfBlock)) { - GV.OutOfBlock = 1; - return 0; - } - return 1; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ FillFlags(PDISASM pMyDisasm, int index) -{ - (*pMyDisasm).Instruction.Flags = EFLAGS_TABLE[index]; -} -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ CalculateRelativeAddress(UInt64 * pMyAddress, Int64 MyNumber, PDISASM pMyDisasm) -{ - GV.RelativeAddress = 1; - if (GV.EIP_VA != 0) { - *pMyAddress = (UInt64) (GV.EIP_VA+(UInt64) MyNumber); - } - else { - *pMyAddress = (UInt64) (GV.EIP_REAL+(UInt64) MyNumber); - } -} - -/* ==================================================================== - * - * ==================================================================== */ -#ifndef BEA_LIGHT_DISASSEMBLY -size_t __bea_callspec__ CopyFormattedNumber(PDISASM pMyDisasm, char* pBuffer, const char* pFormat, Int64 MyNumber) -{ - size_t i = 0; - if (!strcmp(pFormat,"%.2X")) MyNumber = MyNumber & 0xFF; - if (!strcmp(pFormat,"%.4X")) MyNumber = MyNumber & 0xFFFF; - if (!strcmp(pFormat,"%.8X")) MyNumber = MyNumber & 0xFFFFFFFF; - if (GV.FORMATNUMBER == PrefixedNumeral) { - (void) strcpy(pBuffer, "0x"); - (void) sprintf (pBuffer+2, pFormat, MyNumber); - i += strlen(pBuffer); - } - else { - (void) sprintf (pBuffer+i, pFormat, MyNumber); - i += strlen(pBuffer); - (void) strcpy(pBuffer+i, "h"); - i++; - } - return i; -} -#endif - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ FillSegmentsRegisters(PDISASM pMyDisasm) -{ - if (((*pMyDisasm).Prefix.LockPrefix == InUsePrefix) && !((*pMyDisasm).Argument1.ArgType & (MEMORY_TYPE | REGISTER_TYPE))) { - (*pMyDisasm).Prefix.LockPrefix = InvalidPrefix; - } - if ((*pMyDisasm).Instruction.Category == GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION) { - (*pMyDisasm).Argument1.SegmentReg = ESReg; - (*pMyDisasm).Argument2.SegmentReg = DSReg; - /* =============== override affects Arg2 */ - if ((*pMyDisasm).Argument2.ArgType & MEMORY_TYPE) { - if ((*pMyDisasm).Prefix.FSPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = FSReg; - } - else if ((*pMyDisasm).Prefix.GSPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = GSReg; - } - else if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = CSReg; - } - else if ((*pMyDisasm).Prefix.ESPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = ESReg; - } - else if ((*pMyDisasm).Prefix.SSPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = SSReg; - } - else { - (*pMyDisasm).Argument2.SegmentReg = DSReg; - } - } - } - else { - if ((*pMyDisasm).Argument1.ArgType & MEMORY_TYPE) { - if (((*pMyDisasm).Argument1.Memory.BaseRegister == REG4) || ((*pMyDisasm).Argument1.Memory.BaseRegister == REG5)) { - (*pMyDisasm).Argument1.SegmentReg = SSReg; - /* ========== override is invalid here */ - if ((*pMyDisasm).Argument2.ArgType != MEMORY_TYPE) { - if ((*pMyDisasm).Prefix.FSPrefix == InUsePrefix) { - (*pMyDisasm).Argument1.SegmentReg = FSReg; - (*pMyDisasm).Prefix.FSPrefix = InvalidPrefix; - } - else if ((*pMyDisasm).Prefix.GSPrefix == InUsePrefix) { - (*pMyDisasm).Argument1.SegmentReg = GSReg; - (*pMyDisasm).Prefix.GSPrefix = InvalidPrefix; - } - else if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Argument1.SegmentReg = CSReg; - (*pMyDisasm).Prefix.CSPrefix = InvalidPrefix; - } - else if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Argument1.SegmentReg = DSReg; - (*pMyDisasm).Prefix.DSPrefix = InvalidPrefix; - } - else if ((*pMyDisasm).Prefix.ESPrefix == InUsePrefix) { - (*pMyDisasm).Argument1.SegmentReg = ESReg; - (*pMyDisasm).Prefix.ESPrefix = InvalidPrefix; - } - else if ((*pMyDisasm).Prefix.SSPrefix == InUsePrefix) { - (*pMyDisasm).Argument1.SegmentReg = SSReg; - (*pMyDisasm).Prefix.SSPrefix = InvalidPrefix; - } - } - } - else { - (*pMyDisasm).Argument1.SegmentReg = DSReg; - /* ============= test if there is override */ - if ((*pMyDisasm).Prefix.FSPrefix == InUsePrefix) { - (*pMyDisasm).Argument1.SegmentReg = FSReg; - } - else if ((*pMyDisasm).Prefix.GSPrefix == InUsePrefix) { - (*pMyDisasm).Argument1.SegmentReg = GSReg; - } - else if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Argument1.SegmentReg = CSReg; - } - else if ((*pMyDisasm).Prefix.ESPrefix == InUsePrefix) { - (*pMyDisasm).Argument1.SegmentReg = ESReg; - } - else if ((*pMyDisasm).Prefix.SSPrefix == InUsePrefix) { - (*pMyDisasm).Argument1.SegmentReg = SSReg; - } - } - } - - if ((*pMyDisasm).Argument2.ArgType & MEMORY_TYPE) { - if (((*pMyDisasm).Argument2.Memory.BaseRegister == REG4) || ((*pMyDisasm).Argument2.Memory.BaseRegister == REG5)) { - (*pMyDisasm).Argument2.SegmentReg = SSReg; - /* ========== override is invalid here */ - if ((*pMyDisasm).Prefix.FSPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = FSReg; - (*pMyDisasm).Prefix.FSPrefix = InvalidPrefix; - } - else if ((*pMyDisasm).Prefix.GSPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = GSReg; - (*pMyDisasm).Prefix.GSPrefix = InvalidPrefix; - } - else if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = CSReg; - (*pMyDisasm).Prefix.CSPrefix = InvalidPrefix; - } - else if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = DSReg; - (*pMyDisasm).Prefix.DSPrefix = InvalidPrefix; - } - else if ((*pMyDisasm).Prefix.ESPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = ESReg; - (*pMyDisasm).Prefix.ESPrefix = InvalidPrefix; - } - else if ((*pMyDisasm).Prefix.SSPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = SSReg; - (*pMyDisasm).Prefix.SSPrefix = InvalidPrefix; - } - } - else { - (*pMyDisasm).Argument2.SegmentReg = DSReg; - /* ============= test if there is override */ - if ((*pMyDisasm).Prefix.FSPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = FSReg; - } - else if ((*pMyDisasm).Prefix.GSPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = GSReg; - } - else if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = CSReg; - } - else if ((*pMyDisasm).Prefix.ESPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = ESReg; - } - else if ((*pMyDisasm).Prefix.SSPrefix == InUsePrefix) { - (*pMyDisasm).Argument2.SegmentReg = SSReg; - } - } - } - } -} - -#ifndef BEA_LIGHT_DISASSEMBLY -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ BuildCompleteInstruction(PDISASM pMyDisasm) -{ - size_t i = 0; - /* =============== Copy Instruction Mnemonic */ - - if ((*pMyDisasm).Prefix.RepnePrefix == InUsePrefix) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "repne "); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - if ((*pMyDisasm).Prefix.RepPrefix == InUsePrefix) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "rep "); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - if ((*pMyDisasm).Prefix.LockPrefix == InUsePrefix) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "lock "); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Instruction.Mnemonic); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - - /* =============== if TAB = 1, add tabulation */ - if (GV.TAB_ == 1) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, space_tab[i>10 ? 0 : 10-i]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - /* =============== if Arg1.IsMemoryType, add decoration-example == "dword ptr ds:[" */ - if ((GV.MemDecoration >0) && (GV.MemDecoration < 99)) { - if (GV.SYNTAX_ == NasmSyntax) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, NasmPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - if (GV.SEGMENTREGS != 0) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument1.SegmentReg]); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); - } - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - } - } - else { - if (GV.SYNTAX_ == MasmSyntax) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, MasmPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else if (GV.SYNTAX_ == IntrinsicMemSyntax) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, IntrinsicPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, GoAsmPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ - if (GV.SEGMENTREGS != 0) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument1.SegmentReg]); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); - } - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - } - } - /* =============== add Arg1.Mnemonic */ - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument1.ArgMnemonic); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "]"); - i++; - } - /* =============== add Arg1.Mnemonic */ - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument1.ArgMnemonic); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - - /* =============== if Arg2.Exists and Arg1.Exists , add"," */ - if (((UInt8)*((UInt8*) &(*pMyDisasm).Argument1.ArgMnemonic) != 0) && ((UInt8)*((UInt8*) &(*pMyDisasm).Argument2.ArgMnemonic) != 0)) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, ", "); - i += 2; - } - - /* =============== if Arg2.IsMemoryType, add decoration-example == "dword ptr ds:[" */ - if ((GV.MemDecoration >100) && (GV.MemDecoration < 199)) { - GV.MemDecoration -= 100; - if (GV.SYNTAX_ == NasmSyntax) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, NasmPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - if (GV.SEGMENTREGS != 0) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument2.SegmentReg]); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); - } - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - } - } - else { - if (GV.SYNTAX_ == MasmSyntax) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, MasmPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else if (GV.SYNTAX_ == IntrinsicMemSyntax) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, IntrinsicPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, GoAsmPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ - if (GV.SEGMENTREGS != 0) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument2.SegmentReg]); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); - } - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - } - } - /* =============== add Arg2.ArgMnemonic */ - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument2.ArgMnemonic); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "]"); - i++; - } - /* =============== add Arg2.ArgMnemonic */ - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument2.ArgMnemonic); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - - - /* =============== if Arg3.Exists */ -/* if (GV.third_arg != 0) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, ", "); - i += 2; - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument3.ArgMnemonic); - } -*/ - - /* =============== if Arg3.Exists and Arg2.Exists , add"," */ - if (((UInt8)*((UInt8*) &(*pMyDisasm).Argument2.ArgMnemonic) != 0) && ((UInt8)*((UInt8*) &(*pMyDisasm).Argument3.ArgMnemonic) != 0)) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, ", "); - i += 2; - } - - /* =============== if Arg3.IsMemoryType, add decoration-example == "dword ptr ds:[" */ - if ((GV.MemDecoration >200) && (GV.MemDecoration < 299)) { - GV.MemDecoration -= 200; - if (GV.SYNTAX_ == NasmSyntax) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, NasmPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - if (GV.SEGMENTREGS != 0) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument3.SegmentReg]); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); - } - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - } - } - else { - if (GV.SYNTAX_ == MasmSyntax) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, MasmPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else if (GV.SYNTAX_ == IntrinsicMemSyntax) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, IntrinsicPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, GoAsmPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ - if (GV.SEGMENTREGS != 0) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument3.SegmentReg]); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); - } - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - } - } - /* =============== add Arg2.ArgMnemonic */ - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument3.ArgMnemonic); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "]"); - i++; - } - /* =============== add Arg3.ArgMnemonic */ - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument3.ArgMnemonic); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - - - /* =============== if Arg4.Exists and Arg3.Exists , add"," */ - if (((UInt8)*((UInt8*) &(*pMyDisasm).Argument4.ArgMnemonic) != 0) && ((UInt8)*((UInt8*) &(*pMyDisasm).Argument3.ArgMnemonic) != 0)) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, ", "); - i += 2; - } - - /* =============== if Arg4.IsMemoryType, add decoration-example == "dword ptr ds:[" */ - if ((GV.MemDecoration >300) && (GV.MemDecoration < 399)) { - GV.MemDecoration -= 300; - if (GV.SYNTAX_ == NasmSyntax) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, NasmPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - if (GV.SEGMENTREGS != 0) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument4.SegmentReg]); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); - } - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - } - } - else { - if (GV.SYNTAX_ == MasmSyntax) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, MasmPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else if (GV.SYNTAX_ == IntrinsicMemSyntax) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, IntrinsicPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, GoAsmPrefixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ - if (GV.SEGMENTREGS != 0) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument4.SegmentReg]); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); - } - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "["); - i++; - } - } - /* =============== add Arg4.ArgMnemonic */ - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument4.ArgMnemonic); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "]"); - i++; - } - /* =============== add Arg4.ArgMnemonic */ - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument4.ArgMnemonic); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - - - - - - -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ BuildCompleteInstructionATSyntax(PDISASM pMyDisasm) -{ - size_t i = 0; - /* =============== Copy Instruction Mnemonic */ - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr, (char*) &(*pMyDisasm).Instruction.Mnemonic); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - - /* =============== suffix the mnemonic */ - if (GV.MemDecoration != 0) { - if (GV.MemDecoration > 99) GV.MemDecoration -= 100; - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[GV.MemDecoration-1]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else { - if ((*pMyDisasm).Argument1.ArgType != NO_ARGUMENT) { - if ((*pMyDisasm).Argument1.ArgSize == 8) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[0]); - } - else if ((*pMyDisasm).Argument1.ArgSize == 16) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[1]); - } - else if ((*pMyDisasm).Argument1.ArgSize == 32) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[2]); - } - else if ((*pMyDisasm).Argument1.ArgSize == 64) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[3]); - } - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - else if ((*pMyDisasm).Argument1.ArgType != NO_ARGUMENT) { - if ((*pMyDisasm).Argument1.ArgSize == 8) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[0]); - } - else if ((*pMyDisasm).Argument1.ArgSize == 16) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[1]); - } - else if ((*pMyDisasm).Argument1.ArgSize == 32) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[2]); - } - else if ((*pMyDisasm).Argument1.ArgSize == 64) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i-1, ATSuffixes[3]); - } - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - } - /* =============== if TAB = 1, add tabulation */ - if (GV.TAB_ == 1) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, space_tab[i>10 ? 0 : 10-i]); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - - /* =============== if Arg3.Exists, display it */ - if (GV.third_arg != 0) { - if ((*pMyDisasm).Argument3.ArgType & REGISTER_TYPE) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%"); - i++; - } - else if ((*pMyDisasm).Argument3.ArgType & CONSTANT_TYPE) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24"); - i++; - } - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument3.ArgMnemonic); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - - /* =============== if Arg3.Exists and Arg2.Exists , display " , " */ - if ((GV.third_arg != 0) && (*((UInt8*) &(*pMyDisasm).Argument2.ArgMnemonic) != 0)) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, ", "); - i += 2; - } - - /* =============== if Arg2 exists, display it */ - if (*((UInt8*) &(*pMyDisasm).Argument2.ArgMnemonic) != 0) { - if ((*pMyDisasm).Argument2.ArgType & CONSTANT_TYPE) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24"); - i++; - } - else { - if ((*pMyDisasm).Instruction.BranchType != 0) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "*"); - i++; - } - if ((*pMyDisasm).Argument2.ArgType & REGISTER_TYPE) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%"); - i++; - } - else if ((*pMyDisasm).Argument2.ArgType & CONSTANT_TYPE) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24"); - i++; - } - else { - if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%"); - i++; - if (GV.SEGMENTREGS != 0) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument2.SegmentReg]); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); - } - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - } - } - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument2.ArgMnemonic); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - - /* =============== if Arg2.Exists and Arg1.Exists , display " , " */ - if (((UInt8)*((UInt8*) &(*pMyDisasm).Argument1.ArgMnemonic) != 0) && ((UInt8)*((UInt8*) &(*pMyDisasm).Argument2.ArgMnemonic) != 0)) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, ", "); - i += 2; - } - - /* =============== if Arg1 exists, display it */ - if (*((UInt8*) &(*pMyDisasm).Argument1.ArgMnemonic) != 0) { - if ((*pMyDisasm).Argument1.ArgType & CONSTANT_TYPE) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24"); - i++; - } - else { - if ((*pMyDisasm).Instruction.BranchType != 0) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "*"); - i++; - } - if ((*pMyDisasm).Argument1.ArgType & REGISTER_TYPE) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%"); - i++; - } - else if ((*pMyDisasm).Argument1.ArgType & CONSTANT_TYPE) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "\x24"); - i++; - } - else { - if ((GV.SEGMENTREGS != 0) || (GV.SEGMENTFS != 0)){ - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, "%"); - i++; - if (GV.SEGMENTREGS != 0) { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[(*pMyDisasm).Argument1.SegmentReg]); - } - else { - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, SegmentRegs[3]); - } - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } - } - } - (void) strcpy ((char*) &(*pMyDisasm).CompleteInstr+i, (char*) &(*pMyDisasm).Argument1.ArgMnemonic); - i = strlen((char*) &(*pMyDisasm).CompleteInstr); - } -} -#endif diff --git a/NativeHelper/beaengine/src/Includes/Routines_ModRM.c b/NativeHelper/beaengine/src/Includes/Routines_ModRM.c deleted file mode 100644 index f97e8036..00000000 --- a/NativeHelper/beaengine/src/Includes/Routines_ModRM.c +++ /dev/null @@ -1,3753 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . - * ======================================= - * - * ======================================= */ -void __bea_callspec__ MOD_RM(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - GV.DECALAGE_EIP = 0; - if (!Security(1, pMyDisasm)) return; - GV.MOD_ = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; - GV.RM_ = (*((UInt8*)(UIntPtr) (GV.EIP_+1))) & 0x7; - if (GV.MOD_ == 0) { - ModRM_0[GV.RM_](pMyArgument, pMyDisasm); - } - else if (GV.MOD_ == 1) { - GV.DECALAGE_EIP++; - ModRM_1[GV.RM_](pMyArgument, pMyDisasm); - } - else if (GV.MOD_ == 2) { - if (GV.AddressSize >= 32) { - GV.DECALAGE_EIP += 4; - } - else { - GV.DECALAGE_EIP += 2; - } - ModRM_2[GV.RM_](pMyArgument, pMyDisasm); - } - else { - ModRM_3[GV.RM_](pMyArgument, pMyDisasm); - } - -} - -/* ======================================= - * used in Reg_Opcode - * ======================================= */ -void __bea_callspec__ fillRegister(int index, ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - - size_t i = 0; - - if (GV.MPX_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[index]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE + MPX_REG + REGS[index]; - (*pMyArgument).ArgSize = 128; - } - else if (GV.AVX_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersAVX[index]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+AVX_REG+REGS[index]; - (*pMyArgument).ArgSize = 256; - } - else if (GV.MMX_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[index]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[index]; - (*pMyArgument).ArgSize = 64; - } - else if (GV.SEG_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSEG[index]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[index]; - (*pMyArgument).ArgSize = 16; - } - else if (GV.CR_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersCR[index]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+CR_REG+REGS[index]; - (*pMyArgument).ArgSize = 32; - } - else if (GV.DR_ == 1) { - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersDR_AT[index]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersDR[index]); - #endif - } - (*pMyArgument).ArgType = REGISTER_TYPE+DR_REG+REGS[index]; - (*pMyArgument).ArgSize = 32; - } - else if (GV.SSE_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[index]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[index]; - (*pMyArgument).ArgSize = 128; - } - else if (GV.OperandSize == 8) { - if (GV.REX.state == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[index]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[index]; - if (index >= 4) { - (*pMyArgument).ArgPosition = HighPosition; - } - (*pMyArgument).ArgSize = 8; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[index]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[index]; - (*pMyArgument).ArgSize = 8; - } - } - else if (GV.OperandSize == 16) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[index]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[index]; - (*pMyArgument).ArgSize = 16; - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[index]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[index]; - (*pMyArgument).ArgSize = 32; - } - else if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[index]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[index]; - (*pMyArgument).ArgSize = 64; - } -} - - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ Reg_Opcode(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - - if (!Security(1, pMyDisasm)) return; - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REX.R_ == 1) { - GV.REGOPCODE += 0x8; - } - fillRegister(GV.REGOPCODE, pMyArgument, pMyDisasm); - -} -/* ======================================= - * ModRM_0 - * ======================================= */ -void __bea_callspec__ Addr_EAX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - #ifndef BEA_LIGHT_DISASSEMBLY - size_t i = 0; - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%"); - i += 2; - } - #endif - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[0]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[0]; - } - } - else if (GV.AddressSize == 32) { - - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[0]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[0]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXSI_); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - (*pMyArgument).Memory.IndexRegister = REGS[6]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - #endif - -} -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ Addr_ECX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - #ifndef BEA_LIGHT_DISASSEMBLY - size_t i = 0; - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%"); - i += 2; - } - #endif - - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[9]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[1+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[1]; - } - } - else if (GV.AddressSize == 32) { - - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[9]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[1+8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[1]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXDI_); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - (*pMyArgument).Memory.IndexRegister = REGS[7]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - #endif - -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ Addr_EDX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - #ifndef BEA_LIGHT_DISASSEMBLY - size_t i = 0; - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%"); - i += 2; - } - #endif - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[10]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[2+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[2]; - } - } - else if (GV.AddressSize == 32) { - - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[10]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[2+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[2]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPSI_); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5]; - (*pMyArgument).Memory.IndexRegister = REGS[6]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - #endif -} - - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ Addr_EBX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - #ifndef BEA_LIGHT_DISASSEMBLY - size_t i = 0; - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%"); - i += 2; - } - #endif - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[11]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - } - } - else if (GV.AddressSize == 32) { - - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[11]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPDI_); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5]; - (*pMyArgument).Memory.IndexRegister = REGS[7]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - #endif - -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ Addr_SIB(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - if (!Security(2, pMyDisasm)) return; - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize >= 32) { - GV.DECALAGE_EIP++; - GV.BASE_ = ((UInt8) *((UInt8*) (UIntPtr) (GV.EIP_+2))) & 0x7; - GV.SCALE_ = (((UInt8) *((UInt8*) (UIntPtr)(GV.EIP_+2))) & 0xc0) >> 6; - GV.INDEX_ = (((UInt8) *((UInt8*) (UIntPtr)(GV.EIP_+2))) & 0x38) >> 3; - (void) SIB[GV.SCALE_ ](pMyArgument, 0, pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic, Registers16Bits[6]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6]; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ Addr_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - Int32 MyNumber; - UInt64 MyAddress; - size_t i = 0; - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize >= 32) { - if (!Security(6, pMyDisasm)) return; - GV.DECALAGE_EIP+=4; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.Architecture == 64) { - MyNumber += 6; - MyNumber += GV.NB_PREFIX; - if (GV.ImmediatSize == 32) { - MyNumber += 4; - } - if (GV.ImmediatSize == 16) { - MyNumber += 2; - } - if (GV.ImmediatSize == 8) { - MyNumber += 1; - } - if ((*pMyDisasm).Instruction.Opcode >= 0x0F3800) { /* add two bytes if opcode is a 3-bytes */ - MyNumber +=2; - } - else if ((*pMyDisasm).Instruction.Opcode >= 0x0100) { /* add one byte if opcode is a 2-bytes */ - MyNumber +=1; - } - CalculateRelativeAddress(&MyAddress, (Int64)MyNumber, pMyDisasm); - (*pMyDisasm).Instruction.AddrValue = MyAddress; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.16llX", (Int64)MyAddress); - #endif - (*pMyArgument).ArgType |= RELATIVE_; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X", (Int64)MyNumber); - #endif - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic, Registers16Bits[7]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7]; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ Addr_ESI(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - long MyNumber; - #ifndef BEA_LIGHT_DISASSEMBLY - size_t i = 0; - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%"); - i += 2; - } - #endif - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[14]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6]; - } - } - else if (GV.AddressSize == 32) { - - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[14]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6]; - } - } - else { - GV.DECALAGE_EIP+=2; - MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+2)); - (*pMyArgument).Memory.Displacement = MyNumber; - if (!Security(2, pMyDisasm)) return; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.4X", (Int64)MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - #endif -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ Addr_EDI(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - #ifndef BEA_LIGHT_DISASSEMBLY - size_t i = 0; - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%"); - i += 2; - } - #endif - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[15]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7]; - } - } - else if (GV.AddressSize == 32) { - - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[15]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - #endif -} - -/* ======================================= - * ModRM_1 - * ======================================= */ -void __bea_callspec__ Addr_EAX_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[0]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[0]; - } - } - else if (GV.AddressSize == 32) { - - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[0]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[0]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXSI_); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - (*pMyArgument).Memory.IndexRegister = REGS[6]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); - #endif - } - } -} - -/* ======================================= - * ModRM_1 - * ======================================= */ -void __bea_callspec__ Addr_ECX_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - MyNumber = (Int8) *((UInt8*) (UIntPtr)GV.EIP_+2); - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[9]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[1+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[1]; - } - } - else if (GV.AddressSize == 32) { - - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[9]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[1+8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[1]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXDI_); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - (*pMyArgument).Memory.IndexRegister = REGS[7]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); - #endif - } - } -} - -/* ======================================= - * ModRM_1 - * ======================================= */ -void __bea_callspec__ Addr_EDX_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[10]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[2+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[2]; - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[10]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[2+8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[2]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPSI_); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5]; - (*pMyArgument).Memory.IndexRegister = REGS[6]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); - #endif - } - } -} - -/* ======================================= - * ModRM_1 - * ======================================= */ -void __bea_callspec__ Addr_EBX_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[11]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[11]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3+8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPDI_); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5]; - (*pMyArgument).Memory.IndexRegister = REGS[7]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); - #endif - } - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ Addr_SIB_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - if (!Security(2, pMyDisasm)) return; - if (GV.AddressSize >= 32) { - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+3)); - } - else { - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); - } - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); - #endif - } - /*#ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); -#endif - *i+=2; */ - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize >= 32) { - GV.DECALAGE_EIP++; - GV.BASE_ = (*((UInt8*)(UIntPtr) (GV.EIP_+2))) & 0x7; - GV.SCALE_ = ((*((UInt8*)(UIntPtr) (GV.EIP_+2))) & 0xc0) >> 6; - GV.INDEX_ = ((*((UInt8*)(UIntPtr) (GV.EIP_+2))) & 0x38) >> 3; - j = i; - i += SIB[GV.SCALE_ ](pMyArgument, j, pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic, Registers16Bits[6]); - #endif - i += strlen (Registers16Bits[6]); - (*pMyArgument).Memory.BaseRegister = REGS[6]; - - } - - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - #endif - i++; - } - else { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); - #endif - } - } - -} - -/* ======================================= - * ModRM_1 - * ======================================= */ -void __bea_callspec__ Addr_EBP_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[13]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[5]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5]; - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[13]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5+8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[5]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[7]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); - #endif - } - } -} - -/* ======================================= - * ModRM_1 - * ======================================= */ -void __bea_callspec__ Addr_ESI_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[14]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6]; - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[14]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6+8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[5]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); - #endif - } - } -} - -/* ======================================= - * ModRM_1 - * ======================================= */ -void __bea_callspec__ Addr_EDI_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2)); - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[15]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7]; - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[15]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7+8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber); - #endif - } - } -} - -/* ======================================= - * ModRM_2 - * ======================================= */ -void __bea_callspec__ Addr_EAX_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - if (GV.AddressSize == 16) { - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); - } - else{ - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); - } - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i ++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - j = i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[0]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[0]; - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[0]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[0]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXSI_); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - (*pMyArgument).Memory.IndexRegister = REGS[6]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); - #endif - } - } -} - - -/* ======================================= - * ModRM_2 - * ======================================= */ -void __bea_callspec__ Addr_ECX_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - if (GV.AddressSize == 16) { - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); - } - else{ - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); - } - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i ++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - j = i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[9]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[1+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[1]; - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[9]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[1+8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[1]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXDI_); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - (*pMyArgument).Memory.IndexRegister = REGS[7]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); - #endif - } - } -} - -/* ======================================= - * ModRM_2 - * ======================================= */ -void __bea_callspec__ Addr_EDX_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - if (GV.AddressSize == 16) { - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); - } - else{ - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); - } - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i ++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - j = i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[10]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[2+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[2]; - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[10]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[2+8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[2]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPSI_); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5]; - (*pMyArgument).Memory.IndexRegister = REGS[6]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); - #endif - } - } -} - -/* ======================================= - * ModRM_2 - * ======================================= */ -void __bea_callspec__ Addr_EBX_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - if (GV.AddressSize == 16) { - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); - } - else{ - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); - } - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i ++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - j = i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[11]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[11]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3+8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPDI_); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5]; - (*pMyArgument).Memory.IndexRegister = REGS[7]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); - #endif - } - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ Addr_SIB_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - if (!Security(2, pMyDisasm)) return; - if (GV.AddressSize >= 32) { - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+3)); - } - else { - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); - } - - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i ++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - j = i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); - #endif - } - /*#ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); -#endif - *i+=2; */ - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize >= 32) { - GV.DECALAGE_EIP++; - GV.BASE_ = ((UInt8) *((UInt8*) (UIntPtr)GV.EIP_+2)) & 0x7; - GV.SCALE_ = (((UInt8) *((UInt8*) (UIntPtr)GV.EIP_+2)) & 0xc0) >> 6; - GV.INDEX_ = (((UInt8) *((UInt8*) (UIntPtr)GV.EIP_+2)) & 0x38) >> 3; - j = i; - i += SIB[GV.SCALE_ ](pMyArgument, j, pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic, Registers16Bits[6]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6]; - i += strlen (Registers16Bits[6]); - } - - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - #endif - i += 1; - } - else { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); - #endif - } - } - -} - -/* ======================================= - * ModRM_2 - * ======================================= */ -void __bea_callspec__ Addr_EBP_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - if (GV.AddressSize == 16) { - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); - } - else{ - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); - } - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i ++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - j = i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[13]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[5]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5]; - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[13]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5+8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[5]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[7]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); - #endif - } - } -} - -/* ======================================= - * ModRM_2 - * ======================================= */ -void __bea_callspec__ Addr_ESI_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - if (GV.AddressSize == 16) { - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); - } - else{ - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); - } - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i ++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - j = i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[14]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6]; - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[14]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6+8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[6]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[5]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[5]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); - #endif - } - } -} - -/* ======================================= - * ModRM_2 - * ======================================= */ -void __bea_callspec__ Addr_EDI_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - size_t i = 0, j; - long MyNumber; - if (GV.AddressSize == 16) { - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2)); - } - else{ - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2)); - } - (*pMyArgument).Memory.Displacement = MyNumber; - if (GV.SYNTAX_ == ATSyntax) { - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i ++; - j=i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - j = i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i+=2; - } - (*pMyArgument).ArgType = MEMORY_TYPE; - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[15]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7]; - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[15]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7+8]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[7]; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[3]; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i = strlen ((char*) &(*pMyArgument).ArgMnemonic); - if (GV.SYNTAX_ == ATSyntax) { - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - i += 1; - } - else { - #else - if(1) { - #endif - if (MyNumber < 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i++; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber); - #endif - } - } -} - -/* ======================================= - * ModRM_3 - * ======================================= */ -void __bea_callspec__ _rEAX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - int i = 0; - GV.MemDecoration = 0; - - if (GV.MPX_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - - - if (GV.MMX_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[0]; - (*pMyArgument).ArgSize = 64; - return; - } - - if (GV.SSE_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - if (GV.OperandSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; - (*pMyArgument).ArgSize = 64; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyArgument).ArgSize = 64; - } - } - else if (GV.OperandSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; - (*pMyArgument).ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyArgument).ArgSize = 32; - } - } - else if (GV.OperandSize == 16) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; - (*pMyArgument).ArgSize = 16; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyArgument).ArgSize = 16; - } - } - else if (GV.OperandSize == 8) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; - (*pMyArgument).ArgSize = 8; - } - else { - if (GV.REX.state == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[0]; - (*pMyArgument).ArgSize = 8; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyArgument).ArgSize = 8; - } - } - } -} - - -/* ======================================= - * ModRM_3 - * ======================================= */ -void __bea_callspec__ _rECX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - int i = 0; - GV.MemDecoration = 0; - - if (GV.MPX_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[1+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[1]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - - if (GV.MMX_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[1]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[1]; - (*pMyArgument).ArgSize = 64; - return; - } - - if (GV.SSE_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[1+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[1+8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[1]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[1]; - (*pMyArgument).ArgSize = 128; - } - return; - } - if (GV.OperandSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; - (*pMyArgument).ArgSize = 64; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; - (*pMyArgument).ArgSize = 64; - } - } - else if (GV.OperandSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; - (*pMyArgument).ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; - (*pMyArgument).ArgSize = 32; - } - } - else if (GV.OperandSize == 16) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[1+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; - (*pMyArgument).ArgSize = 16; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[1]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; - (*pMyArgument).ArgSize = 16; - } - } - else if (GV.OperandSize == 8) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[1+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; - (*pMyArgument).ArgSize = 8; - } - else { - if (GV.REX.state == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[1]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[1]; - (*pMyArgument).ArgSize = 8; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[1]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; - (*pMyArgument).ArgSize = 8; - } - } - } -} - - - -/* ======================================= - * ModRM_3 - * ======================================= */ -void __bea_callspec__ _rEDX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - int i = 0; - GV.MemDecoration = 0; - if (GV.MPX_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[2+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[2]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - - if (GV.MMX_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[2+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[2+0]; - (*pMyArgument).ArgSize = 64; - return; - } - - if (GV.SSE_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[2+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[2+8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[2+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[2+0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - if (GV.OperandSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; - (*pMyArgument).ArgSize = 64; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; - (*pMyArgument).ArgSize = 64; - } - } - else if (GV.OperandSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; - (*pMyArgument).ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; - (*pMyArgument).ArgSize = 32; - } - } - else if (GV.OperandSize == 16) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[2+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; - (*pMyArgument).ArgSize = 16; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[2+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; - (*pMyArgument).ArgSize = 16; - } - } - else if (GV.OperandSize == 8) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[2+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; - (*pMyArgument).ArgSize = 8; - } - else { - if (GV.REX.state == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[2+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[2+0]; - (*pMyArgument).ArgSize = 8; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[2+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; - (*pMyArgument).ArgSize = 8; - } - } - } -} - - - -/* ======================================= - * ModRM_3 - * ======================================= */ -void __bea_callspec__ _rEBX(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - int i = 0; - GV.MemDecoration = 0; - if (GV.MPX_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[3+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[3]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - if (GV.MMX_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[3+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[3+0]; - (*pMyArgument).ArgSize = 64; - return; - } - - if (GV.SSE_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[3+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[3+8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[3+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[3+0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - if (GV.OperandSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; - (*pMyArgument).ArgSize = 64; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; - (*pMyArgument).ArgSize = 64; - } - } - else if (GV.OperandSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; - (*pMyArgument).ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; - (*pMyArgument).ArgSize = 32; - } - } - else if (GV.OperandSize == 16) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; - (*pMyArgument).ArgSize = 16; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; - (*pMyArgument).ArgSize = 16; - } - } - else if (GV.OperandSize == 8) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[3+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; - (*pMyArgument).ArgSize = 8; - } - else { - if (GV.REX.state == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[3+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[3+0]; - (*pMyArgument).ArgSize = 8; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[3+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; - (*pMyArgument).ArgSize = 8; - } - } - } -} - - - -/* ======================================= - * ModRM_3 - * ======================================= */ -void __bea_callspec__ _rESP(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - int i = 0; - GV.MemDecoration = 0; - if (GV.MPX_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[4+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[4]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - if (GV.MMX_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[4+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[4+0]; - (*pMyArgument).ArgSize = 64; - return; - } - - if (GV.SSE_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[4+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[4+8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[4+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[4+0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - if (GV.OperandSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[4+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; - (*pMyArgument).ArgSize = 64; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[4+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; - (*pMyArgument).ArgSize = 64; - } - } - else if (GV.OperandSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[4+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; - (*pMyArgument).ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[4+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; - (*pMyArgument).ArgSize = 32; - } - } - else if (GV.OperandSize == 16) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[4+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; - (*pMyArgument).ArgSize = 16; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[4+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; - (*pMyArgument).ArgSize = 16; - } - } - else if (GV.OperandSize == 8) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[4+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; - (*pMyArgument).ArgSize = 8; - } - else { - if (GV.REX.state == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[4+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[4+0]; - (*pMyArgument).ArgPosition = HighPosition; - (*pMyArgument).ArgSize = 8; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[4+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; - (*pMyArgument).ArgSize = 8; - } - } - } -} - - - -/* ======================================= - * ModRM_3 - * ======================================= */ -void __bea_callspec__ _rEBP(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - int i = 0; - GV.MemDecoration = 0; - if (GV.MPX_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[5+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[5]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - if (GV.MMX_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[5+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[5+0]; - (*pMyArgument).ArgSize = 64; - return; - } - - if (GV.SSE_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[5+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[5+8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[5+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[5+0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - if (GV.OperandSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[5+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; - (*pMyArgument).ArgSize = 64; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[5+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; - (*pMyArgument).ArgSize = 64; - } - } - else if (GV.OperandSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[5+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; - (*pMyArgument).ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[5+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; - (*pMyArgument).ArgSize = 32; - } - } - else if (GV.OperandSize == 16) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[5+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; - (*pMyArgument).ArgSize = 16; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[5+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; - (*pMyArgument).ArgSize = 16; - } - } - else if (GV.OperandSize == 8) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[5+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; - (*pMyArgument).ArgSize = 8; - } - else { - if (GV.REX.state == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[5+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[5+0]; - (*pMyArgument).ArgPosition = HighPosition; - (*pMyArgument).ArgSize = 8; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[5+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; - (*pMyArgument).ArgSize = 8; - } - } - } -} - - - -/* ======================================= - * ModRM_3 - * ======================================= */ -void __bea_callspec__ _rESI(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - int i = 0; - GV.MemDecoration = 0; - if (GV.MPX_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[6+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[6]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - if (GV.MMX_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[6+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[6+0]; - (*pMyArgument).ArgSize = 64; - return; - } - - if (GV.SSE_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[6+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[6+8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[6+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[6+0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - if (GV.OperandSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; - (*pMyArgument).ArgSize = 64; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; - (*pMyArgument).ArgSize = 64; - } - } - else if (GV.OperandSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; - (*pMyArgument).ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; - (*pMyArgument).ArgSize = 32; - } - } - else if (GV.OperandSize == 16) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[6+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; - (*pMyArgument).ArgSize = 16; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[6+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; - (*pMyArgument).ArgSize = 16; - } - } - else if (GV.OperandSize == 8) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[6+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; - (*pMyArgument).ArgSize = 8; - } - else { - if (GV.REX.state == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[6+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[6+0]; - (*pMyArgument).ArgPosition = HighPosition; - (*pMyArgument).ArgSize = 8; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[6+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; - (*pMyArgument).ArgSize = 8; - } - } - } -} - - - -/* ======================================= - * ModRM_3 - * ======================================= */ -void __bea_callspec__ _rEDI(ARGTYPE* pMyArgument, PDISASM pMyDisasm) -{ - int i = 0; - GV.MemDecoration = 0; - if (GV.MPX_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[7+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMPX[7]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MPX_REG+REGS[0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - if (GV.MMX_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[7+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[7+0]; - (*pMyArgument).ArgSize = 64; - return; - } - - if (GV.SSE_ == 1) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[7+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[7+8]; - (*pMyArgument).ArgSize = 128; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[7+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[7+0]; - (*pMyArgument).ArgSize = 128; - } - return; - } - if (GV.OperandSize == 64) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; - (*pMyArgument).ArgSize = 64; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; - (*pMyArgument).ArgSize = 64; - } - } - else if (GV.OperandSize == 32) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; - (*pMyArgument).ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; - (*pMyArgument).ArgSize = 32; - } - } - else if (GV.OperandSize == 16) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[7+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; - (*pMyArgument).ArgSize = 16; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[7+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; - (*pMyArgument).ArgSize = 16; - } - } - else if (GV.OperandSize == 8) { - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[7+8]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; - (*pMyArgument).ArgSize = 8; - } - else { - if (GV.REX.state == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[7+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[7+0]; - (*pMyArgument).ArgPosition = HighPosition; - (*pMyArgument).ArgSize = 8; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[7+0]); - #endif - (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; - (*pMyArgument).ArgSize = 8; - } - } - } -} - - -/* ======================================= - * - * ======================================= */ -size_t __bea_callspec__ SIB_0(ARGTYPE* pMyArgument, size_t i, PDISASM pMyDisasm) -{ - - /* ========================= Interpret Base */ - size_t j; - if ((GV.BASE_ == 5) && (GV.MOD_ == 0)) { - GV.DECALAGE_EIP += 4; - if (!Security(7, pMyDisasm)) return i; - j = i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_+3))); - #endif - (*pMyArgument).Memory.Displacement = *((UInt32*)(UIntPtr) (GV.EIP_+3)); - - } - else { - - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i += 2; - } - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ ]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; - i += strlen(Registers64Bits[GV.BASE_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ +8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; - i += strlen( Registers64Bits[GV.BASE_ +8]); - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ ]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; - i += strlen( Registers32Bits[GV.BASE_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ +8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; - i += strlen( Registers32Bits[GV.BASE_ +8]); - } - } - } - /* ======================== Interpret Index */ - - - if (GV.INDEX_ != 4 || GV.REX.X_) { - if (GV.SYNTAX_ == ATSyntax) { - if (GV.BASE_ == 5) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(,%"); - #endif - i+=3; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",%"); - #endif - i+=2; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i+=1; - } - - if (GV.AddressSize == 64) { - if (GV.REX.X_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ ]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; - i += strlen( Registers64Bits[GV.INDEX_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ +8]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; - i += strlen( Registers64Bits[GV.INDEX_ +8]); - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.X_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ ]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; - i += strlen( Registers32Bits[GV.INDEX_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ +8]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; - i += strlen( Registers32Bits[GV.INDEX_ +8]); - } - } - } - (*pMyArgument).Memory.Scale = 1; - if ((GV.SYNTAX_ == ATSyntax) && ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_))) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - #endif - i++; - } - return i; -} - -/* ======================================= - * - * ======================================= */ -size_t __bea_callspec__ SIB_1(ARGTYPE* pMyArgument, size_t i, PDISASM pMyDisasm) -{ - size_t j; - /* ========================= Interpret Base */ - - if ((GV.BASE_ == 5) && (GV.MOD_ == 0)) { - GV.DECALAGE_EIP += 4; - if (!Security(7, pMyDisasm)) return i; - j = i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_+3))); - #endif - (*pMyArgument).Memory.Displacement = *((UInt32*)(UIntPtr) (GV.EIP_+3)); - } - else { - - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i += 2; - } - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ ]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; - i += strlen( Registers64Bits[GV.BASE_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ +8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; - i += strlen( Registers64Bits[GV.BASE_ +8]); - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ ]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; - i += strlen( Registers32Bits[GV.BASE_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ +8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; - i += strlen( Registers32Bits[GV.BASE_ +8]); - } - } - } - /* ======================== Interpret Index */ - - if (GV.INDEX_ != 4 || GV.REX.X_) { - if (GV.SYNTAX_ == ATSyntax) { - if (GV.BASE_ == 5) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(,%"); - #endif - i+=3; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",%"); - #endif - i+=2; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i+=1; - } - - if (GV.AddressSize == 64) { - if (GV.REX.X_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ ]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; - i += strlen( Registers64Bits[GV.INDEX_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ +8]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; - i += strlen( Registers64Bits[GV.INDEX_ +8]); - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.X_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ ]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; - i += strlen( Registers32Bits[GV.INDEX_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ +8]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; - i += strlen( Registers32Bits[GV.INDEX_ +8]); - } - } - (*pMyArgument).Memory.Scale = 2; - if (GV.SYNTAX_ == ATSyntax) { - if ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",2"); - #endif - i+=2; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "*2"); - #endif - - i+=2; - } - } - if ((GV.SYNTAX_ == ATSyntax) && ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_))) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - #endif - i++; - } - return i; -} - -/* ======================================= - * - * ======================================= */ -size_t __bea_callspec__ SIB_2(ARGTYPE* pMyArgument, size_t i, PDISASM pMyDisasm) -{ - size_t j; - /* ========================= Interpret Base */ - - if ((GV.BASE_ == 5) && (GV.MOD_ == 0)) { - GV.DECALAGE_EIP += 4; - if (!Security(7, pMyDisasm)) return i; - j = i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_+3))); - #endif - (*pMyArgument).Memory.Displacement = *((UInt32*)(UIntPtr) (GV.EIP_+3)); - } - else { - - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i += 2; - } - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ ]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; - i += strlen( Registers64Bits[GV.BASE_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ +8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; - i += strlen( Registers64Bits[GV.BASE_ +8]); - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ ]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; - i += strlen( Registers32Bits[GV.BASE_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ +8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; - i += strlen( Registers32Bits[GV.BASE_ +8]); - } - } - } - /* ======================== Interpret Index */ - - if (GV.INDEX_ != 4) { - if (GV.SYNTAX_ == ATSyntax) { - if (GV.BASE_ == 5) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(,%"); - #endif - i+=3; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",%"); - #endif - i+=2; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i+=1; - } - - if (GV.AddressSize == 64) { - if (GV.REX.X_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ ]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; - i += strlen( Registers64Bits[GV.INDEX_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ +8]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; - i += strlen( Registers64Bits[GV.INDEX_ +8]); - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.X_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ ]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; - i += strlen( Registers32Bits[GV.INDEX_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ +8]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; - i += strlen( Registers32Bits[GV.INDEX_ +8]); - } - } - (*pMyArgument).Memory.Scale = 4; - if (GV.SYNTAX_ == ATSyntax) { - if ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",4"); - #endif - i+=2; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "*4"); - #endif - i+=2; - } - } - if ((GV.SYNTAX_ == ATSyntax) && ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_))) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - #endif - i++; - } - return i; -} - -/* ======================================= - * - * ======================================= */ -size_t __bea_callspec__ SIB_3(ARGTYPE* pMyArgument, size_t i, PDISASM pMyDisasm) -{ - size_t j; - /* ========================= Interpret Base */ - - if ((GV.BASE_ == 5) && (GV.MOD_ == 0)) { - GV.DECALAGE_EIP += 4; - if (!Security(7, pMyDisasm)) return i; - j = i; - #ifndef BEA_LIGHT_DISASSEMBLY - i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_+3))); - #endif - (*pMyArgument).Memory.Displacement = *((UInt32*)(UIntPtr) (GV.EIP_+3)); - } - else { - - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%"); - #endif - i += 2; - } - if (GV.AddressSize == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ ]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; - i += strlen( Registers64Bits[GV.BASE_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ +8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; - i += strlen( Registers64Bits[GV.BASE_ +8]); - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ ]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ]; - i += strlen( Registers32Bits[GV.BASE_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ +8]); - #endif - (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8]; - i += strlen( Registers32Bits[GV.BASE_ +8]); - } - } - } - /* ======================== Interpret Index */ - - if (GV.INDEX_ != 4 || GV.REX.X_) { - if (GV.SYNTAX_ == ATSyntax) { - if (GV.BASE_ == 5) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(,%"); - #endif - i+=3; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",%"); - #endif - i+=2; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+"); - #endif - i+=1; - } - - if (GV.AddressSize == 64) { - if (GV.REX.X_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ ]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; - i += strlen( Registers64Bits[GV.INDEX_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ +8]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; - i += strlen( Registers64Bits[GV.INDEX_ +8]); - } - } - else if (GV.AddressSize == 32) { - if (GV.REX.X_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ ]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ]; - i += strlen( Registers32Bits[GV.INDEX_ ]); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ +8]); - #endif - (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8]; - i += strlen( Registers32Bits[GV.INDEX_ +8]); - } - } - (*pMyArgument).Memory.Scale = 8; - if (GV.SYNTAX_ == ATSyntax) { - if ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",8"); - #endif - i+=2; - } - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "*8"); - #endif - i+=2; - } - } - if ((GV.SYNTAX_ == ATSyntax) && ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_))) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")"); - #endif - i++; - } - return i; -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/Data_opcode.h b/NativeHelper/beaengine/src/Includes/instr_set/Data_opcode.h deleted file mode 100644 index 95613caa..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/Data_opcode.h +++ /dev/null @@ -1,174 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* =============================================================================== */ -/* */ -/* */ -/* 1 BYTE OPCODE MAP */ -/* */ -/* */ -/* =============================================================================== */ - -void (__bea_callspec__ * opcode_map1[])(PDISASM) = { - add_EbGb , add_EvGv , add_GbEb , add_GvEv , add_ALIb , add_eAX_Iv, push_es , pop_es , or_EbGb , or_EvGv , or_GbEb , or_GvEv , or_ALIb , or_eAX_Iv , push_cs , Esc_2byte , - adc_EbGb , adc_EvGv , adc_GbEb , adc_GvEv , adc_ALIb , adc_eAX_Iv, push_ss , pop_ss , sbb_EbGb , sbb_EvGv , sbb_GbEb , sbb_GvEv , sbb_ALIb , sbb_eAX_Iv, push_ds , pop_ds , - and_EbGb , and_EvGv , and_GbEb , and_GvEv , and_ALIb , and_eAX_Iv, PrefSEGES , daa_ , sub_EbGb , sub_EvGv , sub_GbEb , sub_GvEv , sub_ALIb , sub_eAX_Iv, PrefSEGCS , das_ , - xor_EbGb , xor_EvGv , xor_GbEb , xor_GvEv , xor_ALIb , xor_eAX_Iv, PrefSEGSS , aaa_ , cmp_EbGb , cmp_EvGv , cmp_GbEb , cmp_GvEv , cmp_ALIb , cmp_eAX_Iv, PrefSEGDS , aas_ , - inc_eax , inc_ecx , inc_edx , inc_ebx , inc_esp , inc_ebp , inc_esi , inc_edi , dec_eax , dec_ecx , dec_edx , dec_ebx , dec_esp , dec_ebp , dec_esi , dec_edi , - push_eax , push_ecx , push_edx , push_ebx , push_esp , push_ebp , push_esi , push_edi , pop_eax , pop_ecx , pop_edx , pop_ebx , pop_esp , pop_ebp , pop_esi , pop_edi , - pushad_ , popad_ , bound_ , arpl_ , PrefSEGFS , PrefSEGGS , PrefOpSize, PrefAdSize, push_Iv ,imul_GvEvIv, push_Ib ,imul_GvEvIb, insb_ , ins_ , outsb_ , outsw_ , - jo_ , jno_ , jc_ , jnc_ , je_ , jne_ , jbe_ , jnbe_ , js_ , jns_ , jp_ , jnp_ , jl_ , jnl_ , jle_ , jnle_ , - G1_EbIb , G1_EvIv , G1_EbIb2 , G1_EvIb , test_EbGb , test_EvGv , xchg_EbGb , xchg_EvGv , mov_EbGb , mov_EvGv , mov_GbEb , mov_GvEv , mov_EwSreg, lea_GvM , mov_SregEw, pop_Ev , - nop_ , xchg_ecx , xchg_edx , xchg_ebx , xchg_esp , xchg_ebp , xchg_esi , xchg_edi , cwde_ , cdq_ , callf_ , wait_ , pushfd_ , popfd_ , sahf_ , lahf_ , - mov_ALOb , mov_eAXOv , mov_ObAL , mov_OveAX , movs_ , movsw_ , cmpsb_ , cmps_ , test_ALIb ,test_eAX_Iv, stos_ , stosw_ , lodsb_ , lodsw_ , scasb_ , scas_ , - mov_ALIb , mov_CLIb , mov_DLIb , mov_BLIb , mov_AHIb , mov_CHIb , mov_DHIb , mov_BHIb , mov_EAX , mov_ECX , mov_EDX , mov_EBX , mov_ESP , mov_EBP , mov_ESI , mov_EDI , - G2_EbIb , G2_EvIb , retn_ , ret_ , les_GvM , lds_GvM , mov_EbIb , mov_EvIv , enter_ , leave_ , retf_Iw , retf_ , int3_ , int_ , into_ , iret_ , - G2_Eb1 , G2_Ev1 , G2_EbCL , G2_EvCL , aam_ , aad_ , salc_ , xlat_ , D8_ , D9_ , DA_ , DB_ , DC_ , DD_ , DE_ , DF_ , - loopne_ , loope_ , loop_ , jecxz_ , in_ALIb , in_eAX_Ib , out_IbAL , out_Ib_eAX, call_ , jmp_near , jmp_far , jmp_short , in_ALDX , in_eAX , out_DXAL , out_DXeAX , - PrefLock , int1_ , PrefREPNE , PrefREPE , hlt_ , cmc_ , G3_Eb , G3_Ev , clc_ , stc_ , cli_ , sti_ , cld_ , std_ , G4_Eb , G5_Ev , - }; - -/* =============================================================================== */ -/* */ -/* */ -/* 2 BYTES OPCODE MAP --> 0F xx */ -/* */ -/* */ -/* =============================================================================== */ -void (__bea_callspec__ *opcode_map2[])(PDISASM) = { - G6_ , G7_ , lar_GvEw , lsl_GvEw , FailDecode, syscall_ , clts_ , sysret_ , invd_ , wbinvd_ , FailDecode, ud2_ , FailDecode, nop_Ev , femms_ , FailDecode, - movups_VW , movups_WV , movlps_VM , movlps_MV , unpcklps_ , unpckhps_ , movhps_VM , movhps_MV , G16_ , hint_nop , bndcl_GvEv, bndcn_GvEv, hint_nop , hint_nop , hint_nop , nop_Ev , - mov_RdCd , mov_RdDd , mov_CdRd , mov_DdRd , FailDecode, FailDecode, FailDecode, FailDecode, movaps_VW , movaps_WV , cvtpi2ps_ , movntps_ , cvttps2pi_, cvtps2pi_ , ucomiss_VW, comiss_VW , - wrmsr_ , rdtsc_ , rdmsr_ , rdpmc_ , sysenter_ , sysexit_ , FailDecode, FailDecode,Esc_tableA4, FailDecode,Esc_tableA5, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - cmovo_ , cmovno_ , cmovb_ , cmovnb_ , cmove_ , cmovne_ , cmovbe_ , cmovnbe_ , cmovs_ , cmovns_ , cmovp_ , cmovnp_ , cmovl_ , cmovnl_ , cmovle_ , cmovnle_ , - movmskps_ , sqrtps_VW , rsqrtps_ , rcpps_ , andps_VW , andnps_VW , orps_VW , xorps_VW , addps_VW , mulps_VW , cvtps2pd_ , cvtdq2ps_ , subps_VW , minps_VW , divps_VW , maxps_VW , - punpcklbw_, punpcklwd_, punpckldq_, packsswb_ , pcmpgtb_ , pcmpgtw_ , pcmpgtd_ , packuswb_ , punpckhbw_, punpckhwd_, punpckhdq_, packssdw_ ,punpcklqdq_,punpckhqdq_, movd_PE , movq_PQ , - pshufw_ , G12_ , G13_ , G14_ , pcmpeqb_ , pcmpeqw_ , pcmpeqd_ , emms_ , vmread_ , vmwrite_ , FailDecode, FailDecode, haddpd_VW , hsubpd_VW , movd_EP , movq_QP , - jo_near , jno_near , jc_near , jnc_near , je_near , jne_near , jbe_near , ja_near , js_near , jns_near , jp_near , jnp_near , jl_near , jnl_near , jle_near , jnle_near , - seto_ , setno_ , setb_ , setnb_ , sete_ , setne_ , setbe_ , setnbe_ , sets_ , setns_ , setp_ , setnp_ , setnge_ , setge_ , setle_ , setnle_ , - push_fs , pop_fs , cpuid_ , bt_EvGv ,shld_EvGvIb,shld_EvGvCL, FailDecode, FailDecode, push_gs , pop_gs , rsm_ , bts_EvGv ,shrd_EvGvIb,shrd_EvGvCL, G15_ , imul_GvEv , - cmpx_EbGb , cmpx_EvGv , lss_Mp , btr_EvGv , lfs_Mp , lgs_Mp , movzx_GvEb, movzx_GvEw, popcnt_ , ud2_ , G8_EvIb , btc_EvGv , bsf_GvEv , bsr_GvEv , movsx_GvEb, movsx_GvEw, - xadd_EbGb , xadd_EvGv , cmpps_VW , movnti_ , pinsrw_ , pextrw_ , shufps_ , G9_ , bswap_eax , bswap_ecx , bswap_edx , bswap_ebx , bswap_esp , bswap_ebp , bswap_esi , bswap_edi , - addsubpd_ , psrlw_ , psrld_ , psrlq_ , paddq_ , pmullw_ , movq_WV , pmovmskb_ , psubusb_ , psubusw_ , pminub_ , pand_ , paddusb_ , paddusw_ , pmaxub_ , pandn_ , - pavgb_ , psraw_ , psrad_ , pavgw_ , pmulhuw_ , pmulhw_ , cvtpd2dq_ , movntq_ , psubsb_ , psubsw_ , pminsw_ , por_ , paddsb_ , paddsw_ , pmaxsw_ , pxor_ , - lddqu_ , psllw_ , pslld_ , psllq_ , pmuludq_ , pmaddwd_ , psadbw_ , maskmovq_ , psubb_ , psubw_ , psubd_ , psubq_ , paddb_ , paddw_ , paddd_ , FailDecode, - }; - -/* =============================================================================== */ -/* */ -/* */ -/* 3 BYTES OPCODE MAP --> 0F 38 xx */ -/* */ -/* */ -/* =============================================================================== */ - void (__bea_callspec__ *opcode_map3[])(PDISASM) = { - pshufb_ , phaddw_ , phaddd_ , phaddsw_ , pmaddubsw_, phsubw_ , phsubd_ , phsubsw_ , psignb_ , psignw_ , psignd_ , pmulhrsw_ , FailDecode, FailDecode, FailDecode, FailDecode, - pblendvb_ , FailDecode, FailDecode, FailDecode, blendvps_ , blendvpd_ , FailDecode, ptest_ , FailDecode, FailDecode, FailDecode, FailDecode, pabsb_ , pabsw_ , pabsd_ , FailDecode, - pmovsxbw_ , pmovsxbd_ , pmovsxbq_ , pmovsxwd_ , pmovsxwq_ , pmovsxdq_ , FailDecode, FailDecode, pmuldq_ , pcmpeqq_ , movntdqa_ , packusdw_ , FailDecode, FailDecode, FailDecode, FailDecode, - pmovzxbw_ , pmovzxbd_ , pmovzxbq_ , pmovzxwd_ , pmovzxwq_ , pmovzxdq_ , FailDecode, pcmpgtq_ , pminsb_ , pminsd_ , pminuw_ , pminud_ , pmaxsb_ , pmaxsd_ , pmaxuw_ , pmaxud_ , - pmulld_ ,phminposuw_, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, aesimc , aesenc , aesenclast, aesdec , aesdeclast, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - crc32_GvEb, crc32_GvEv, andn_GyEy , G17_ , FailDecode, bzhi_GyEy , adcx_GyEy , bextr_GyEy, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - }; - -/* =============================================================================== */ -/* */ -/* */ -/* 3 BYTES OPCODE MAP --> 0F 3A xx */ -/* */ -/* */ -/* =============================================================================== */ - void (__bea_callspec__ *opcode_map4[])(PDISASM) = { - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, roundps_ , roundpd_ , roundss_ , roundsd_ , blendps_ , blendpd_ , pblendw_ , palignr_ , - FailDecode, FailDecode, FailDecode, FailDecode, pextrb_ , pextrw2_ , pextrd_ , extractps_, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - pinsrb_ , insertps_ , pinsrd_ , FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - dpps_ , dppd_ , mpsadbw_ , FailDecode, pclmulqdq_, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - pcmpestrm_, pcmpestri_, pcmpistrm_, pcmpistri_, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, aeskeygen , - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, FailDecode, - }; - - -void (__bea_callspec__ *ModRM_0[])(ARGTYPE*, PDISASM) = { - Addr_EAX, - Addr_ECX, - Addr_EDX, - Addr_EBX, - Addr_SIB, - Addr_disp32, - Addr_ESI, - Addr_EDI, - }; - - void (__bea_callspec__ *ModRM_1[])(ARGTYPE*, PDISASM) = { - Addr_EAX_disp8, - Addr_ECX_disp8, - Addr_EDX_disp8, - Addr_EBX_disp8, - Addr_SIB_disp8, - Addr_EBP_disp8, - Addr_ESI_disp8, - Addr_EDI_disp8, - }; - - void (__bea_callspec__ *ModRM_2[])(ARGTYPE*, PDISASM) = { - Addr_EAX_disp32, - Addr_ECX_disp32, - Addr_EDX_disp32, - Addr_EBX_disp32, - Addr_SIB_disp32, - Addr_EBP_disp32, - Addr_ESI_disp32, - Addr_EDI_disp32, - }; - - void (__bea_callspec__ *ModRM_3[])(ARGTYPE*, PDISASM) = { - _rEAX, - _rECX, - _rEDX, - _rEBX, - _rESP, - _rEBP, - _rESI, - _rEDI, - }; - -size_t (__bea_callspec__ *SIB[])(ARGTYPE*, size_t, PDISASM) = { - SIB_0, - SIB_1, - SIB_2, - SIB_3, - }; diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_AES.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_AES.c deleted file mode 100644 index d4aa707a..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_AES.c +++ /dev/null @@ -1,266 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * 0x 0f 38 db - * ==================================================================== */ -void __bea_callspec__ aesimc(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if (GV.OperandSize == 16) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + AES_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaesimc "); - #endif - - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.MemDecoration = Arg2_m128i_xmm; - GV.SSE_ = 0; - } - else { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128i_xmm; - (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesimc "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - (*pMyDisasm).Argument2.ArgSize = 128; - } - } - else { - FailDecode(pMyDisasm); - } -} - -/* ==================================================================== - * 0x 0f 38 dc - * ==================================================================== */ -void __bea_callspec__ aesenc(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if (GV.OperandSize == 16) { - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + AES_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaesenc "); - #endif - - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128i_xmm; - GV.SSE_ = 0; - - } - else { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128i_xmm; - (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesenc "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - } - else { - FailDecode(pMyDisasm); - } -} - -/* ==================================================================== - * 0x 0f 38 dd - * ==================================================================== */ -void __bea_callspec__ aesenclast(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if (GV.OperandSize == 16) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + AES_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaesenclast "); - #endif - - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128i_xmm; - GV.SSE_ = 0; - - } - else { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128i_xmm; - (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesenclast "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - } - else { - FailDecode(pMyDisasm); - } -} - -/* ==================================================================== - * 0x 0f 38 de - * ==================================================================== */ -void __bea_callspec__ aesdec(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if (GV.OperandSize == 16) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + AES_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaesdec "); - #endif - - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128i_xmm; - GV.SSE_ = 0; - - } - else { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128i_xmm; - (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesdec "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - } - else { - FailDecode(pMyDisasm); - } -} - -/* ==================================================================== - * 0x 0f 38 df - * ==================================================================== */ -void __bea_callspec__ aesdeclast(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if (GV.OperandSize == 16) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + AES_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaesdeclast "); - #endif - - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128i_xmm; - GV.SSE_ = 0; - - } - else { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128i_xmm; - (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesdeclast "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - } - else { - FailDecode(pMyDisasm); - } -} - -/* ==================================================================== - * 0x 0f 3a df - * ==================================================================== */ -void __bea_callspec__ aeskeygen(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if (GV.OperandSize == 16) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + AES_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaeskeygenassist "); - #endif - - GV.SSE_ = 1; - GxEx(pMyDisasm); - /*fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm);*/ - GV.MemDecoration = Arg2_m128i_xmm; - GV.SSE_ = 0; - GV.ImmediatSize = 8; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - } - else { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128i_xmm; - (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aeskeygenassist "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - } - - } - else { - FailDecode(pMyDisasm); - } - -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_A_M.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_A_M.c deleted file mode 100644 index c9cf6609..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_A_M.c +++ /dev/null @@ -1,7134 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ aaa_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Archi == 64) { - FailDecode(pMyDisasm); - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aaa "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 8; - GV.EIP_++; - }; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ aad_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Archi == 64) { - FailDecode(pMyDisasm); - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aad "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 16; - if (!Security(1, pMyDisasm)) return; - GV.ImmediatSize = 8; - if (*((UInt8*)(UIntPtr) (GV.EIP_+1)) != 0x0A) { - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_+1))); - #endif - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - GV.EIP_+=2; - }; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ aam_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Archi == 64) { - FailDecode(pMyDisasm); - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aam "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 16; - if (!Security(1, pMyDisasm)) return; - GV.ImmediatSize = 8; - if (*((UInt8*)(UIntPtr) (GV.EIP_+1)) != 0x0A) { - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_+1))); - #endif - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - GV.EIP_+=2; - }; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ aas_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Archi == 64) { - FailDecode(pMyDisasm); - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aas "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 8; - GV.EIP_++; - }; -} - -/* ======================================= - * 0Fh 38h F6h - * large integer operation (adc and mul extensions) - * ======================================= */ -void __bea_callspec__ adcx_GyEy(PDISASM pMyDisasm) -{ - - /* ========= 0xf3 */ - if (GV.PrefRepe == 1) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adox "); - #endif - if (GV.OperandSize != 64) GV.OperandSize = 32; - GvEv(pMyDisasm); - FillFlags(pMyDisasm,124); - } - /* ========= 0xf2 */ - else if (GV.PrefRepne == 1) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mulx "); - #endif - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - } - - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg3qword; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg3dword; - } - else { - GV.MemDecoration = Arg3word; - } - GyEy(pMyDisasm); - - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - - if (GV.REX.W_ == 0x0) { - (*pMyDisasm).Argument4.ArgType = REGISTER_TYPE + GENERAL_REG + REGS[2]; - (*pMyDisasm).Argument4.ArgSize = 32; - } - else if (GV.REX.W_ == 0x1) { - (*pMyDisasm).Argument4.ArgType = REGISTER_TYPE + GENERAL_REG + REGS[2]; - (*pMyDisasm).Argument4.ArgSize = 64; - } - (*pMyDisasm).Argument2.AccessMode = WRITE; - FillFlags(pMyDisasm,125); - } - else { - FailDecode(pMyDisasm); - } - } - - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adcx "); - #endif - if (GV.OperandSize != 64) GV.OperandSize = 32; - GvEv(pMyDisasm); - FillFlags(pMyDisasm,123); - } - else { - FailDecode(pMyDisasm); - } - -} - -/* ======================================= - * 00h - * ======================================= */ -void __bea_callspec__ add_EbGb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); - #endif - EbGb(pMyDisasm); - FillFlags(pMyDisasm,5); -} - -/* ======================================= - * 01h - * ======================================= */ -void __bea_callspec__ add_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); - #endif - EvGv(pMyDisasm); - FillFlags(pMyDisasm,5); -} - -/* ======================================= - * 02h - * ======================================= */ -void __bea_callspec__ add_GbEb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); - #endif - GbEb(pMyDisasm); - FillFlags(pMyDisasm,5); -} - -/* ======================================= - * 03h - * ======================================= */ -void __bea_callspec__ add_GvEv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm,5); -} - -/* ======================================= - * 04h - * ======================================= */ -void __bea_callspec__ add_ALIb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); - #endif - ALIb(pMyDisasm); - FillFlags(pMyDisasm,5); -} - -/* ======================================= - * 05h - * ======================================= */ -void __bea_callspec__ add_eAX_Iv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); - #endif - eAX_Iv(pMyDisasm); - FillFlags(pMyDisasm,5); -} - -/* ======================================= - * 10h - * ======================================= */ -void __bea_callspec__ adc_EbGb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); - #endif - EbGb(pMyDisasm); - FillFlags(pMyDisasm,4); -} - -/* ======================================= - * 11h - * ======================================= */ -void __bea_callspec__ adc_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); - #endif - EvGv(pMyDisasm); - FillFlags(pMyDisasm,4); -} - -/* ======================================= - * 12h - * ======================================= */ -void __bea_callspec__ adc_GbEb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); - #endif - GbEb(pMyDisasm); - FillFlags(pMyDisasm,4); -} - -/* ======================================= - * 13h - * ======================================= */ -void __bea_callspec__ adc_GvEv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm,4); -} - -/* ======================================= - * 14h - * ======================================= */ -void __bea_callspec__ adc_ALIb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); - #endif - ALIb(pMyDisasm); - FillFlags(pMyDisasm,4); -} - -/* ======================================= - * 15h - * ======================================= */ -void __bea_callspec__ adc_eAX_Iv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); - #endif - eAX_Iv(pMyDisasm); - FillFlags(pMyDisasm,4); -} - -/* ======================================= - * 20h - * ======================================= */ -void __bea_callspec__ and_EbGb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); - #endif - EbGb(pMyDisasm); - FillFlags(pMyDisasm,6); -} - -/* ======================================= - * 21h - * ======================================= */ -void __bea_callspec__ and_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); - #endif - EvGv(pMyDisasm); - FillFlags(pMyDisasm,6); -} - -/* ======================================= - * 22h - * ======================================= */ -void __bea_callspec__ and_GbEb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); - #endif - GbEb(pMyDisasm); - FillFlags(pMyDisasm,6); -} - -/* ======================================= - * 23h - * ======================================= */ -void __bea_callspec__ and_GvEv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm,6); -} - -/* ======================================= - * 0fh 38h f2h - * ======================================= */ -void __bea_callspec__ andn_GyEy(PDISASM pMyDisasm) -{ - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "andn "); - #endif - - GV.MemDecoration = Arg3dword; - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.MemDecoration = Arg3qword; - GV.OperandSize = 64; - } - } - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - - FillFlags(pMyDisasm,126); - - } - else { - FailDecode(pMyDisasm); - } - -} - -/* ======================================= - * 24h - * ======================================= */ -void __bea_callspec__ and_ALIb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); - #endif - ALIb(pMyDisasm); - FillFlags(pMyDisasm,6); -} - -/* ======================================= - * 25h - * ======================================= */ -void __bea_callspec__ and_eAX_Iv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); - #endif - eAX_Iv(pMyDisasm); - FillFlags(pMyDisasm,6); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ arpl_(PDISASM pMyDisasm) -{ - - if (GV.Architecture == 64) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsxd "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm,69); - } - else { - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "arpl "); - #endif - GV.OperandSize = 16; - EvGv(pMyDisasm); - GV.OperandSize = 32; - FillFlags(pMyDisasm,7); - } - -} - -/* ======================================= - * 0fh 38h f7h - * ======================================= */ -void __bea_callspec__ bextr_GyEy(PDISASM pMyDisasm) -{ - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bextr "); - #endif - - GV.MemDecoration = Arg2dword; - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.MemDecoration = Arg2qword; - GV.OperandSize = 64; - } - } - GxEx(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument3, pMyDisasm); - - FillFlags(pMyDisasm,127); - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ======================================= - * 62h - * ======================================= */ -void __bea_callspec__ bound_(PDISASM pMyDisasm) -{ - - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bound "); - #endif - GvEv(pMyDisasm); - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm,8); - } - -} - -/* ======================================= - * 0fh 1ah - * ======================================= */ -void __bea_callspec__ bndcl_GvEv(PDISASM pMyDisasm) -{ - - /* ========= 0xf3 */ - if (GV.PrefRepe == 1) { - - (*pMyDisasm).Instruction.Category = MPX_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bndcl "); - #endif - GV.MPX_ = 1; - GvEv(pMyDisasm); - GV.MPX_ = 0; - (*pMyDisasm).Argument1.AccessMode = READ; - - } - /* ========= 0xf2 */ - else if (GV.PrefRepne == 1) { - (*pMyDisasm).Instruction.Category = MPX_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bndcu "); - #endif - GV.MPX_ = 1; - GvEv(pMyDisasm); - GV.MPX_ = 0; - (*pMyDisasm).Argument1.AccessMode = READ; - - } - /* ========= 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - (*pMyDisasm).Instruction.Category = MPX_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bndmov "); - #endif - GV.MPX_ = 1; - GvEv(pMyDisasm); - GV.MPX_ = 0; - if (GV.MOD_ != 3) { - if (GV.Architecture == 64) { - GV.MemDecoration = Arg2dqword; - } - else { - GV.MemDecoration = Arg2qword; - } - } - - } - else { - FailDecode(pMyDisasm); - } - -} - -/* ======================================= - * 0fh 1bh - * ======================================= */ -void __bea_callspec__ bndcn_GvEv(PDISASM pMyDisasm) -{ - - /* ========= 0xf3 */ - if (GV.PrefRepe == 1) { - (*pMyDisasm).Instruction.Category = MPX_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bndmk "); - #endif - GV.MPX_ = 1; - GvEv(pMyDisasm); - GV.MPX_ = 0; - (*pMyDisasm).Argument1.AccessMode = READ; - - } - /* ========= 0xf2 */ - else if (GV.PrefRepne == 1) { - (*pMyDisasm).Instruction.Category = MPX_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bndcn "); - #endif - GV.MPX_ = 1; - GvEv(pMyDisasm); - GV.MPX_ = 0; - (*pMyDisasm).Argument1.AccessMode = READ; - } - /* ========= 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - (*pMyDisasm).Instruction.Category = MPX_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bndmov "); - #endif - GV.MPX_ = 1; - EvGv(pMyDisasm); - GV.MPX_ = 0; - if (GV.MOD_ != 3) { - if (GV.Architecture == 64) { - GV.MemDecoration = Arg1dqword; - } - else { - GV.MemDecoration = Arg1qword; - } - } - - } - else { - (*pMyDisasm).Instruction.Category = MPX_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bndstx "); - #endif - GV.MPX_ = 1; - EvGv(pMyDisasm); - GV.MPX_ = 0; - } - -} - -/* ======================================= - * 0fc8h - * ======================================= */ -void __bea_callspec__ bswap_eax(PDISASM pMyDisasm) -{ - - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); - #endif - if (GV.OperandSize == 64) { - (*pMyDisasm).Argument1.ArgSize = 64; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - } - } - else if (GV.OperandSize == 32){ - (*pMyDisasm).Argument1.ArgSize = 32; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - } - } - else { - (*pMyDisasm).Argument1.ArgSize = 16; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - } - } - GV.EIP_++; - FillFlags(pMyDisasm,10); - -} - - -/* ======================================= - * 0fc8h - * ======================================= */ -void __bea_callspec__ bswap_ecx(PDISASM pMyDisasm) -{ - - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); - #endif - if (GV.OperandSize == 64) { - (*pMyDisasm).Argument1.ArgSize = 64; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[1+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[1+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; - } - } - else if (GV.OperandSize == 32){ - (*pMyDisasm).Argument1.ArgSize = 32; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; - } - } - else { - (*pMyDisasm).Argument1.ArgSize = 16; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; - } - } - GV.EIP_++; - FillFlags(pMyDisasm,10); - -} - - -/* ======================================= - * 0fc8h - * ======================================= */ -void __bea_callspec__ bswap_edx(PDISASM pMyDisasm) -{ - - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); - #endif - if (GV.OperandSize == 64) { - (*pMyDisasm).Argument1.ArgSize = 64; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[2+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[2+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; - } - } - else if (GV.OperandSize == 32){ - (*pMyDisasm).Argument1.ArgSize = 32; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; - } - } - else { - (*pMyDisasm).Argument1.ArgSize = 16; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; - } - } - GV.EIP_++; - FillFlags(pMyDisasm,10); - -} - - -/* ======================================= - * 0fc8h - * ======================================= */ -void __bea_callspec__ bswap_ebx(PDISASM pMyDisasm) -{ - - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); - #endif - if (GV.OperandSize == 64) { - (*pMyDisasm).Argument1.ArgSize = 64; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[3+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[3+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; - } - } - else if (GV.OperandSize == 32){ - (*pMyDisasm).Argument1.ArgSize = 32; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; - } - } - else { - (*pMyDisasm).Argument1.ArgSize = 16; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; - } - } - GV.EIP_++; - FillFlags(pMyDisasm,10); - -} - - -/* ======================================= - * 0fc8h - * ======================================= */ -void __bea_callspec__ bswap_esp(PDISASM pMyDisasm) -{ - - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); - #endif - if (GV.OperandSize == 64) { - (*pMyDisasm).Argument1.ArgSize = 64; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[4+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[4+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; - } - } - else if (GV.OperandSize == 32){ - (*pMyDisasm).Argument1.ArgSize = 32; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; - } - } - else { - (*pMyDisasm).Argument1.ArgSize = 16; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; - } - } - GV.EIP_++; - FillFlags(pMyDisasm,10); - -} - - -/* ======================================= - * 0fc8h - * ======================================= */ -void __bea_callspec__ bswap_ebp(PDISASM pMyDisasm) -{ - - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); - #endif - if (GV.OperandSize == 64) { - (*pMyDisasm).Argument1.ArgSize = 64; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[5+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[5+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; - } - } - else if (GV.OperandSize == 32){ - (*pMyDisasm).Argument1.ArgSize = 32; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; - } - } - else { - (*pMyDisasm).Argument1.ArgSize = 16; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; - } - } - GV.EIP_++; - FillFlags(pMyDisasm,10); - -} - - -/* ======================================= - * 0fc8h - * ======================================= */ -void __bea_callspec__ bswap_esi(PDISASM pMyDisasm) -{ - - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); - #endif - if (GV.OperandSize == 64) { - (*pMyDisasm).Argument1.ArgSize = 64; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[6+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[6+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; - } - } - else if (GV.OperandSize == 32){ - (*pMyDisasm).Argument1.ArgSize = 32; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; - } - } - else { - (*pMyDisasm).Argument1.ArgSize = 16; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; - } - } - GV.EIP_++; - FillFlags(pMyDisasm,10); - -} - - -/* ======================================= - * 0fc8h - * ======================================= */ -void __bea_callspec__ bswap_edi(PDISASM pMyDisasm) -{ - - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bswap "); - #endif - if (GV.OperandSize == 64) { - (*pMyDisasm).Argument1.ArgSize = 64; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[7+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[7+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; - } - } - else if (GV.OperandSize == 32){ - (*pMyDisasm).Argument1.ArgSize = 32; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; - } - } - else { - (*pMyDisasm).Argument1.ArgSize = 16; - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; - } - } - GV.EIP_++; - FillFlags(pMyDisasm,10); - -} - -/* ======================================= - * 0fbch - * ======================================= */ -void __bea_callspec__ bsf_GvEv(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bsf "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm,9); -} - -/* ======================================= - * 0fbdh - * ======================================= */ -void __bea_callspec__ bsr_GvEv(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bsr "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm,9); -} - -/* ======================================= - * 0fbbh - * ======================================= */ -void __bea_callspec__ btc_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btc "); - #endif - EvGv(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm,11); -} - -/* ======================================= - * 0fa3h - * ======================================= */ -void __bea_callspec__ bt_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bt "); - #endif - EvGv(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm,11); -} - -/* ======================================= - * 0fb3h - * ======================================= */ -void __bea_callspec__ btr_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btr "); - #endif - EvGv(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm,11); -} - -/* ======================================= - * 0fabh - * ======================================= */ -void __bea_callspec__ bts_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bts "); - #endif - EvGv(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm,11); -} - - -/* ======================================= - * 0fh 38h f5h - * ======================================= */ -void __bea_callspec__ bzhi_GyEy(PDISASM pMyDisasm) -{ - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bzhi "); - #endif - - GV.MemDecoration = Arg2dword; - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.MemDecoration = Arg2qword; - GV.OperandSize = 64; - } - } - GxEx(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument3, pMyDisasm); - - FillFlags(pMyDisasm,128); - - } - else { - FailDecode(pMyDisasm); - } - -} - -/* ======================================= - * e8h - * ======================================= */ -void __bea_callspec__ call_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = CallType; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1))+5+GV.NB_PREFIX; - CalculateRelativeAddress(&MyAddress,(Int64) MyNumber, pMyDisasm); - (*pMyDisasm).Instruction.AddrValue = MyAddress; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - if (MyAddress >= 0x80000000) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1))+3+GV.NB_PREFIX; - CalculateRelativeAddress(&MyAddress,(Int64) MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ callf_(PDISASM pMyDisasm) -{ - UInt32 MyNumber; - UInt64 MyAddress; - size_t i = 0; - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = CallType; - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lcall "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic,"\x24"); - #endif - i++; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call far "); - #endif - } - if (GV.OperandSize ==32) { - if (!Security(7, pMyDisasm)) return; - MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+5)); - #ifndef BEA_LIGHT_DISASSEMBLY - i += CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i, "%.4X",(Int64) MyNumber); - #endif - } - else { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+3)); - #ifndef BEA_LIGHT_DISASSEMBLY - i += CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i, "%.4X",(Int64) MyNumber); - #endif - } - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic+i, " , \x24"); - #endif - i+=4; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic+i, " : "); - #endif - i+=3; - } - MyAddress = MyNumber*16; - MyNumber = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - if (GV.OperandSize == 16) { - MyNumber = MyNumber & 0xffff; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i += CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i, "%.8X",(Int64) MyNumber); - #endif - if (GV.OperandSize == 32) { - GV.EIP_+=7; - } - else { - GV.EIP_+=5; - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - (*pMyDisasm).Instruction.AddrValue = MyAddress + MyNumber; - } -} - -/* ======================================= - * 99h - * ======================================= */ -void __bea_callspec__ cdq_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - if (GV.OperandSize == 64) { - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cqto "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cqo "); - #endif - } - (*pMyDisasm).Argument1.ArgSize = 64; - } - else if (GV.OperandSize ==32) { - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cltd "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cdq "); - #endif - } - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cwtd "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cwd "); - #endif - } - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ clts_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clts "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+CR_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 1; - FillFlags(pMyDisasm, 17); - GV.EIP_++; -} - - -/* ======================================= - * F5h - * ======================================= */ -void __bea_callspec__ cmc_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmc "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 1; - FillFlags(pMyDisasm, 18); - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovo_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovo "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovno_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovno "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovb "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovnb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovnb "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmove_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmove "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovne_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovne "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovbe_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovbe "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovnbe_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovnbe "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovs_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovs "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovns_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovns "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovp_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovp "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovnp_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovnp "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovl_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovl "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovnl_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovnl "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovle_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovle "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmovnle_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmovnle "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm, 19); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmpx_EbGb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg "); - #endif - EbGb(pMyDisasm); - FillFlags(pMyDisasm,22); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cmpx_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg "); - #endif - EvGv(pMyDisasm); - FillFlags(pMyDisasm,22); -} - -/* ======================================= - * 38h - * ======================================= */ -void __bea_callspec__ cmp_EbGb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); - #endif - EbGb(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm,20); -} - -/* ======================================= - * 39h - * ======================================= */ -void __bea_callspec__ cmp_EvGv(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); - #endif - EvGv(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm,20); -} - -/* ======================================= - * 3ah - * ======================================= */ -void __bea_callspec__ cmp_GbEb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); - #endif - GbEb(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm,20); -} - -/* ======================================= - * 3bh - * ======================================= */ -void __bea_callspec__ cmp_GvEv(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); - #endif - GvEv(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm,20); -} - -/* ======================================= - * 3ch - * ======================================= */ -void __bea_callspec__ cmp_ALIb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); - #endif - ALIb(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm,20); -} - -/* ======================================= - * 3dh - * ======================================= */ -void __bea_callspec__ cmp_eAX_Iv(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); - #endif - eAX_Iv(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm,20); -} - -/* ======================================= - * a6h - * ======================================= */ -void __bea_callspec__ cmpsb_(PDISASM pMyDisasm) -{ - - /* ========= 0xf3 */ - if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpsb "); - #endif - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 8; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; - FillFlags(pMyDisasm,21); - GV.EIP_++; -} - -/* ======================================= - * a7h - * ======================================= */ -void __bea_callspec__ cmps_(PDISASM pMyDisasm) -{ - /* ========= 0xf3 */ - if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; - if (GV.Architecture == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpsq "); - #endif - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpsd "); - #endif - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpsw "); - #endif - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - FillFlags(pMyDisasm,21); - GV.EIP_++; -} - -/* ======================================= - * 98h - * ======================================= */ -void __bea_callspec__ cwde_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - if (GV.OperandSize == 64) { - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cltq "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cdqe "); - #endif - } - (*pMyDisasm).Argument1.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cwtl "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cwde "); - #endif - } - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cbtw "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cbw "); - #endif - } - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; -} - -/* ======================================= - * f8h - * ======================================= */ -void __bea_callspec__ clc_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clc "); - #endif - (*pMyDisasm).Argument1.ArgSize = 1; - FillFlags(pMyDisasm, 14); - GV.EIP_++; -} - -/* ======================================= - * f8h - * ======================================= */ -void __bea_callspec__ cld_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cld "); - #endif - (*pMyDisasm).Argument1.ArgSize = 1; - FillFlags(pMyDisasm, 15); - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ cli_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cli "); - #endif - (*pMyDisasm).Argument1.ArgSize = 1; - FillFlags(pMyDisasm, 16); - GV.EIP_++; -} - -/* ======================================= - * 0fa2h - * ======================================= */ -void __bea_callspec__ cpuid_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG1+REG2+REG3; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cpuid "); - #endif - (*pMyDisasm).Argument1.ArgSize = 32; - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ daa_(PDISASM pMyDisasm) -{ - - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "daa "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 8; - FillFlags(pMyDisasm,28); - GV.EIP_++; - } - -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ das_(PDISASM pMyDisasm) -{ - - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "das "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 8; - FillFlags(pMyDisasm,29); - GV.EIP_++; - } - -} - -/* ======================================= - * 48h - * ======================================= */ -void __bea_callspec__ dec_eax(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 1; - GV.REX.R_ = 0; - GV.REX.X_ = 0; - GV.REX.B_ = 0; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - GV.OperandSize = 64; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 30); - } -} - -/* ======================================= - * 49h - * ======================================= */ -void __bea_callspec__ dec_ecx(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 1; - GV.REX.R_ = 0; - GV.REX.X_ = 0; - GV.REX.B_ = 1; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - GV.OperandSize = 64; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 30); - } -} - -/* ======================================= - * 4ah - * ======================================= */ -void __bea_callspec__ dec_edx(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 1; - GV.REX.R_ = 0; - GV.REX.X_ = 1; - GV.REX.B_ = 0; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - GV.OperandSize = 64; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 30); - } -} - -/* ======================================= - * 4bh - * ======================================= */ -void __bea_callspec__ dec_ebx(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 1; - GV.REX.R_ = 0; - GV.REX.X_ = 1; - GV.REX.B_ = 1; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - GV.OperandSize = 64; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 30); - } -} - -/* ======================================= - * 4ch - * ======================================= */ -void __bea_callspec__ dec_esp(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 1; - GV.REX.R_ = 1; - GV.REX.X_ = 0; - GV.REX.B_ = 0; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - GV.OperandSize = 64; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 30); - } -} - -/* ======================================= - * 4dh - * ======================================= */ -void __bea_callspec__ dec_ebp(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 1; - GV.REX.R_ = 1; - GV.REX.X_ = 0; - GV.REX.B_ = 1; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - GV.OperandSize = 64; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 30); - } -} - -/* ======================================= - * 4eh - * ======================================= */ -void __bea_callspec__ dec_esi(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 1; - GV.REX.R_ = 1; - GV.REX.X_ = 1; - GV.REX.B_ = 0; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - GV.OperandSize = 64; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 30); - } -} - -/* ======================================= - * 4fh - * ======================================= */ -void __bea_callspec__ dec_edi(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 1; - GV.REX.R_ = 1; - GV.REX.X_ = 1; - GV.REX.B_ = 1; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - GV.OperandSize = 64; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 30); - } -} - -/* ======================================= - * 0c8h - * ======================================= */ -void __bea_callspec__ enter_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "enter "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber (pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic,"%.4X",(Int64) *((UInt16*)(UIntPtr) (GV.EIP_+1))); - #endif - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+ABSOLUTE_; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber (pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_+3))); - #endif - (*pMyDisasm).Argument2.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - GV.EIP_+=4; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ femms_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = AMD_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "femms "); - #endif - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ hlt_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "hlt "); - #endif - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ invd_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "invd "); - #endif - GV.EIP_++; -} - -/* ======================================= - * 40h - * ======================================= */ -void __bea_callspec__ inc_eax(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 0; - GV.REX.R_ = 0; - GV.REX.X_ = 0; - GV.REX.B_ = 0; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 40); - } -} - -/* ======================================= - * 41h - * ======================================= */ -void __bea_callspec__ inc_ecx(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 0; - GV.REX.R_ = 0; - GV.REX.X_ = 0; - GV.REX.B_ = 1; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 40); - } -} - -/* ======================================= - * 42h - * ======================================= */ -void __bea_callspec__ inc_edx(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 0; - GV.REX.R_ = 0; - GV.REX.X_ = 1; - GV.REX.B_ = 0; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 40); - } -} - -/* ======================================= - * 43h - * ======================================= */ -void __bea_callspec__ inc_ebx(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 0; - GV.REX.R_ = 0; - GV.REX.X_ = 1; - GV.REX.B_ = 1; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 40); - } -} - -/* ======================================= - * 44h - * ======================================= */ -void __bea_callspec__ inc_esp(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 0; - GV.REX.R_ = 1; - GV.REX.X_ = 0; - GV.REX.B_ = 0; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 40); - } -} - -/* ======================================= - * 45h - * ======================================= */ -void __bea_callspec__ inc_ebp(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 0; - GV.REX.R_ = 1; - GV.REX.X_ = 0; - GV.REX.B_ = 1; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 40); - } -} - -/* ======================================= - * 46h - * ======================================= */ -void __bea_callspec__ inc_esi(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 0; - GV.REX.R_ = 1; - GV.REX.X_ = 1; - GV.REX.B_ = 0; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 40); - } -} - -/* ======================================= - * 47h - * ======================================= */ -void __bea_callspec__ inc_edi(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - if (!Security(0, pMyDisasm)) return; - GV.REX.W_ = 0; - GV.REX.R_ = 1; - GV.REX.X_ = 1; - GV.REX.B_ = 1; - GV.REX.state = InUsePrefix; - GV.EIP_++; - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; - - } - else { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); - #endif - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0]; - (*pMyDisasm).Argument1.ArgSize = 16; - } - GV.EIP_++; - FillFlags(pMyDisasm, 40); - } -} -/* ======================================= - * 0xcf - * ======================================= */ -void __bea_callspec__ iret_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = RetType; - if (GV.OperandSize ==64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "iretq "); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "iretd "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "iretw "); - #endif - } - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ in_ALDX(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "in "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers8Bits[0]); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[2]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; - (*pMyDisasm).Argument2.ArgSize = 16; - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ in_ALIb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "in "); - #endif - ALIb(pMyDisasm); -} - -/* ======================================= - * 0xe5 - * ======================================= */ -void __bea_callspec__ in_eAX_Ib(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "in "); - #endif - if (!Security(1, pMyDisasm)) return; - GV.ImmediatSize = 8; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_+1))); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.EIP_+=2; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ insb_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "insb "); - #endif - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; - (*pMyDisasm).Argument2.ArgSize = 16; - GV.EIP_++; - FillFlags(pMyDisasm, 41); - - -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ ins_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; - if (GV.OperandSize >= 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "insd "); - #endif - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; - (*pMyDisasm).Argument2.ArgSize = 16; - GV.EIP_++; - FillFlags(pMyDisasm, 41); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "insw "); - #endif - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; - (*pMyDisasm).Argument2.ArgSize = 16; - GV.EIP_++; - FillFlags(pMyDisasm, 41); - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ into_(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "into "); - #endif - GV.EIP_++; - FillFlags(pMyDisasm, 43); - } -} - -/* ======================================= - * 0edh - * ======================================= */ -void __bea_callspec__ in_eAX(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "in "); - #endif - if (GV.OperandSize >=32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[2]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; - (*pMyDisasm).Argument2.ArgSize = 16; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[2]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; - (*pMyDisasm).Argument2.ArgSize = 16; - } - GV.EIP_++; -} - -/* ======================================= - * 0cdh - * ======================================= */ -void __bea_callspec__ int_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "int "); - #endif - if (!Security(1, pMyDisasm)) return; - GV.ImmediatSize = 8; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_+1))); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument1.ArgSize = 8; - GV.EIP_+=2; - FillFlags(pMyDisasm, 42); -} - -/* ======================================= - * 0f1h - * ======================================= */ -void __bea_callspec__ int1_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "int1 "); - #endif - GV.EIP_++; - FillFlags(pMyDisasm, 42); -} - -/* ======================================= - * 0cch - * ======================================= */ -void __bea_callspec__ int3_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "int3 "); - #endif - GV.EIP_++; - FillFlags(pMyDisasm, 42); -} - -/* ======================================= - * 69h - * ======================================= */ -void __bea_callspec__ imul_GvEvIv(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul "); - #endif - if (GV.OperandSize >= 32) { - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - } - else { - GV.MemDecoration = Arg2dword; - } - GV.ImmediatSize = 32; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+6; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt32*)(UIntPtr) (GV.EIP_- 4)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_- 4))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 32; - - FillFlags(pMyDisasm, 38); - } - else { - GV.MemDecoration = Arg2word; - GV.ImmediatSize = 16; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+4; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt16*)(UIntPtr) (GV.EIP_- 2)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.4X",(Int64) *((UInt16*)(UIntPtr) (GV.EIP_- 2))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 16; - - FillFlags(pMyDisasm, 38); - } -} - -/* ======================================= - * 6bh - * ======================================= */ -void __bea_callspec__ imul_GvEvIb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul "); - #endif - if (GV.OperandSize >= 32) { - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - } - else { - GV.MemDecoration = Arg2dword; - } - GV.ImmediatSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - FillFlags(pMyDisasm, 38); - } - else { - GV.MemDecoration = Arg2word; - GV.ImmediatSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - FillFlags(pMyDisasm, 38); - } -} - -/* ======================================= - * 0fafh - * ======================================= */ -void __bea_callspec__ imul_GvEv(PDISASM pMyDisasm) -{ - - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm,38); -} - -/* ======================================= - * 70h - * ======================================= */ -void __bea_callspec__ jo_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JO; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jo "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,116); -} - -/* ======================================= - * 71h - * ======================================= */ -void __bea_callspec__ jno_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNO; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jno "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,116); -} - -/* ======================================= - * 72h - * ======================================= */ -void __bea_callspec__ jc_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JC; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jc "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,117); -} - -/* ======================================= - * 73h - * ======================================= */ -void __bea_callspec__ jnc_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNC; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnc "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,117); -} -/* ======================================= - * 74h - * ======================================= */ -void __bea_callspec__ je_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "je "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,118); -} - -/* ======================================= - * 75h - * ======================================= */ -void __bea_callspec__ jne_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jne "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,49); -} - -/* ======================================= - * 76h - * ======================================= */ -void __bea_callspec__ jbe_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNA; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jbe "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,119); -} - -/* ======================================= - * 77h - * ======================================= */ -void __bea_callspec__ jnbe_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JA; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnbe "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,119); -} - -/* ======================================= - * 78h - * ======================================= */ -void __bea_callspec__ js_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JS; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "js "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,120); -} - -/* ======================================= - * 79h - * ======================================= */ -void __bea_callspec__ jns_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNS; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jns "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,120); -} - -/* ======================================= - * 7ah - * ======================================= */ -void __bea_callspec__ jp_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JP; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jp "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,121); -} - -/* ======================================= - * 7bh - * ======================================= */ -void __bea_callspec__ jnp_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNP; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnp "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,121); -} - -/* ======================================= - * 7ch - * ======================================= */ -void __bea_callspec__ jl_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jl "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,122); -} - -/* ======================================= - * 7dh - * ======================================= */ -void __bea_callspec__ jnl_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnl "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,122); -} - -/* ======================================= - * 7eh - * ======================================= */ -void __bea_callspec__ jle_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNG; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jle "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,115); -} - -/* ======================================= - * 7fh - * ======================================= */ -void __bea_callspec__ jnle_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - signed long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JG; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnle "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,115); -} - - -/* ======================================= - * 0f80h - * ======================================= */ -void __bea_callspec__ jo_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JO; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jo "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,116); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,116); - } -} - - -/* ======================================= - * 0f81h - * ======================================= */ -void __bea_callspec__ jno_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNO; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jno "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,116); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,116); - } -} - -/* ======================================= - * 0f82h - * ======================================= */ -void __bea_callspec__ jc_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JC; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jc "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,117); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,117); - } -} - -/* ======================================= - * 0f83h - * ======================================= */ -void __bea_callspec__ jnc_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNC; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnc "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,117); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,117); - } -} - -/* ======================================= - * 0f84h - * ======================================= */ -void __bea_callspec__ je_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JE; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "je "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,118); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,49); - } -} - -/* ======================================= - * 0f85h - * ======================================= */ -void __bea_callspec__ jne_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNE; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jne "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,49); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,49); - } -} -/* ======================================= - * 0f86h - * ======================================= */ -void __bea_callspec__ jbe_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNA; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jbe "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,49); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,49); - } -} - - -/* ======================================= - * 0f87h - * ======================================= */ -void __bea_callspec__ ja_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JA; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ja "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,119); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,119); - } -} - -/* ======================================= - * 0f88h - * ======================================= */ -void __bea_callspec__ js_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JS; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "js "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,120); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,49); - } -} - -/* ======================================= - * 0f89h - * ======================================= */ -void __bea_callspec__ jns_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNS; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jns "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,120); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,49); - } -} - -/* ======================================= - * 0f8ah - * ======================================= */ -void __bea_callspec__ jp_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JP; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jp "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,121); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,49); - } -} - -/* ======================================= - * 0f8bh - * ======================================= */ -void __bea_callspec__ jnp_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNP; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnp "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,121); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,121); - } -} - -/* ======================================= - * 0f8ch - * ======================================= */ -void __bea_callspec__ jl_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JL; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jl "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,122); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,122); - } -} - -/* ======================================= - * 0f8dh - * ======================================= */ -void __bea_callspec__ jnl_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNL; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jnl "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,122); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,122); - } -} - -/* ======================================= - * 0f8eh - * ======================================= */ -void __bea_callspec__ jle_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - Int32 MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNG; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jng "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,115); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,115); - } -} - -/* ======================================= - * 0f8fh - * ======================================= */ -void __bea_callspec__ jnle_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - Int64 MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JG; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jg "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+6+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,115); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+4+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,115); - } -} - -/* ======================================= - * 0e3h - * ======================================= */ -void __bea_callspec__ jecxz_(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - Int64 MyNumber; - if ((*pMyDisasm).Prefix.CSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.CSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchNotTaken = InUsePrefix; - } - if ((*pMyDisasm).Prefix.DSPrefix == InUsePrefix) { - (*pMyDisasm).Prefix.DSPrefix = NotUsedPrefix; - (*pMyDisasm).Prefix.BranchTaken = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JECXZ; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - if (GV.AddressSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jrcxz "); - #endif - } - else if (GV.AddressSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jecxz "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jcxz "); - #endif - } - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,49); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,49); - } -} - -/* ======================================= - * 0e9h - * ======================================= */ -void __bea_callspec__ jmp_near(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - long MyNumber; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JmpType; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp "); - #endif - if (GV.OperandSize >= 32) { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+5+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=5; - FillFlags(pMyDisasm,51); - } - else { - if (!Security(3, pMyDisasm)) return; - MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+3+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=3; - FillFlags(pMyDisasm,51); - } -} - - -/* ======================================= - * 0ebh - * ======================================= */ -void __bea_callspec__ jmp_short(PDISASM pMyDisasm) -{ - UInt64 MyAddress = 0; - signed long MyNumber = 0; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JmpType; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp "); - #endif - if (!Security(1, pMyDisasm)) return; - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (GV.OperandSize == 16) MyAddress = MyAddress & 0xffff; - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm,49); -} - - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ jmp_far(PDISASM pMyDisasm) -{ - UInt32 MyNumber; - UInt64 MyAddress; - size_t i = 0; - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JmpType; - (*pMyDisasm).Argument1.AccessMode = READ; - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ljmp "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic,"\x24"); - #endif - i++; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp far "); - #endif - } - if (GV.OperandSize ==32) { - if (!Security(7, pMyDisasm)) return; - MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+5)); - #ifndef BEA_LIGHT_DISASSEMBLY - i += CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i, "%.4X",(Int64) MyNumber); - #endif - } - else { - if (!Security(5, pMyDisasm)) return; - MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+3)); - #ifndef BEA_LIGHT_DISASSEMBLY - i += CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i, "%.4X",(Int64) MyNumber); - #endif - } - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic+i, " , \x24"); - #endif - i+=4; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic+i, " : "); - #endif - i+=3; - } - MyAddress = MyNumber*16; - MyNumber = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - if (GV.OperandSize == 16) { - MyNumber = MyNumber & 0xffff; - } - #ifndef BEA_LIGHT_DISASSEMBLY - i += CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i, "%.8X",(Int64) MyNumber); - #endif - if (GV.OperandSize == 32) { - GV.EIP_+=7; - } - else { - GV.EIP_+=5; - } - (*pMyDisasm).Instruction.AddrValue = MyAddress + MyNumber; - FillFlags(pMyDisasm,51); - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ lahf_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lahf "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ lar_GvEw(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lar "); - #endif - GvEw(pMyDisasm); - FillFlags(pMyDisasm, 53); -} - -/* ======================================= - * 0c5h - * ======================================= */ -void __bea_callspec__ lds_GvM(PDISASM pMyDisasm) -{ - /* if MOD == 11b, invalid instruction */ - - if (GV.Architecture == 64) { - - /* VEX2Bytes prefix */ - - if (!Security(1, pMyDisasm)) return; - GV.REX.R_ = ~((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 7) & 0x1; - GV.VEX.vvvv = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0xF; - GV.VEX.L = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 2) & 0x1; - GV.VEX.pp = ((*((UInt8*)(UIntPtr) (GV.EIP_+1)))) & 0x3; - GV.VEX.mmmmm = 0x0; - - GV.REX.state = InUsePrefix; - GV.VEX.state = InUsePrefix; - GV.VEX.opcode = 0xc5; - - if (GV.VEX.pp == 0x0) { - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - GV.EIP_+=2; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else if (GV.VEX.pp == 0x1) { - /* 66h */ - GV.EIP_+=1; - PrefOpSize(pMyDisasm); - } - else if (GV.VEX.pp == 0x2) { - /* F3h */ - GV.EIP_+=1; - PrefREPE(pMyDisasm); - } - else if (GV.VEX.pp == 0x3) { - /* F2h */ - GV.EIP_+=1; - PrefREPNE(pMyDisasm); - } - - /* FailDecode(pMyDisasm); */ - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SEGMENT_REGISTER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lds "); - #endif - if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2fword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } -} - -/* ======================================= - * 0c9h - * ======================================= */ -void __bea_callspec__ leave_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "leave "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG4; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG5; - (*pMyDisasm).Argument2.ArgSize = 32; - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ lea_GvM(PDISASM pMyDisasm) -{ - - /* if MOD == 11b, invalid instruction */ - - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lea "); - #endif - if (GV.OperandSize >= 32) { - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - } - else { - GV.MemDecoration = Arg2dword; - } - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - (*pMyDisasm).Argument2.AccessMode = 0; - -} - -/* ======================================= - * 0c4h - * ======================================= */ -void __bea_callspec__ les_GvM(PDISASM pMyDisasm) -{ - - if (GV.Architecture == 64) { - - /* VEX3Bytes prefix */ - - if (!Security(1, pMyDisasm)) return; - GV.REX.B_ = ~((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 5) & 0x1; - GV.REX.X_ = ~((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x1; - GV.REX.R_ = ~((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 7) & 0x1; - GV.VEX.mmmmm = (*((UInt8*)(UIntPtr) (GV.EIP_+1))) & 0x1F; - - if (!Security(2, pMyDisasm)) return; - GV.REX.W_ = ((*((UInt8*)(UIntPtr) (GV.EIP_+2))) >> 7) & 0x1; - GV.VEX.vvvv = ((*((UInt8*)(UIntPtr) (GV.EIP_+2))) >> 3) & 0xF; - GV.VEX.L = ((*((UInt8*)(UIntPtr) (GV.EIP_+2))) >> 2) & 0x1; - GV.VEX.pp = ((*((UInt8*)(UIntPtr) (GV.EIP_+2)))) & 0x3; - - GV.REX.state = InUsePrefix; - GV.VEX.state = InUsePrefix; - GV.VEX.opcode = 0xc4; - - - if (GV.VEX.pp == 0x0) { - GV.NB_PREFIX++; - (*pMyDisasm).Prefix.Number++; - GV.EIP_+=3; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - - if (GV.VEX.mmmmm == 0x1) { - (void) opcode_map2[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else if (GV.VEX.mmmmm == 0x2) { - (void) opcode_map3[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else if (GV.VEX.mmmmm == 0x3) { - (void) opcode_map4[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else { - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - - - } - if (GV.VEX.pp == 0x1) { - /* 66h */ - GV.EIP_+=2; - PrefOpSize(pMyDisasm); - } - else if (GV.VEX.pp == 0x2) { - /* F3h */ - GV.EIP_+=2; - PrefREPE(pMyDisasm); - } - else if (GV.VEX.pp == 0x3) { - /* F2h */ - GV.EIP_+=2; - PrefREPNE(pMyDisasm); - } - - GV.OperandSize = 32; - - - /* FailDecode(pMyDisasm); */ - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SEGMENT_REGISTER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "les "); - #endif - if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2fword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } -} - -/* ======================================= - * 0ach - * ======================================= */ -void __bea_callspec__ lodsb_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lodsb "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; - (*pMyDisasm).Argument2.ArgSize = 8; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6; - GV.EIP_++; - FillFlags(pMyDisasm, 59); -} - -/* ======================================= - * 0adh - * ======================================= */ -void __bea_callspec__ lodsw_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lodsq "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6; - GV.EIP_++; - FillFlags(pMyDisasm, 59); - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lodsd "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6; - GV.EIP_++; - FillFlags(pMyDisasm, 59); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lodsw "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6; - GV.EIP_++; - FillFlags(pMyDisasm, 59); - } -} - -/* ======================================= - * 0e2h - * ======================================= */ -void __bea_callspec__ loop_(PDISASM pMyDisasm) -{ - signed long MyNumber; - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "loop "); - #endif - if (!Security(1, pMyDisasm)) return; - if (GV.OperandSize >= 32) { - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG1; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm, 60); - } - else { - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG1; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm, 60); - } -} - -/* ======================================= - * 0xe0 - * ======================================= */ -void __bea_callspec__ loopne_(PDISASM pMyDisasm) -{ - signed long MyNumber; - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JNE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "loopne "); - #endif - if (!Security(1, pMyDisasm)) return; - if (GV.OperandSize >= 32) { - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG1; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm, 61); - } - else { - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG1; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm, 61); - - } -} - -/* ======================================= - * 0xe1 - * ======================================= */ -void __bea_callspec__ loope_(PDISASM pMyDisasm) -{ - signed long MyNumber; - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "loope "); - #endif - if (!Security(1, pMyDisasm)) return; - if (GV.OperandSize >= 32) { - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - if (MyAddress >= W64LIT (0x100000000)) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - } - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG1; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm, 61); - } - else { - MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+1)); - CalculateRelativeAddress(&MyAddress,(Int64) GV.NB_PREFIX+2+MyNumber, pMyDisasm); - MyAddress = MyAddress & 0xffff; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+RELATIVE_; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG1; - (*pMyDisasm).Instruction.AddrValue = MyAddress; - GV.EIP_+=2; - FillFlags(pMyDisasm, 61); - - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ lsl_GvEw(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lsl "); - #endif - GvEw(pMyDisasm); - FillFlags(pMyDisasm, 62); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ lss_Mp(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SEGMENT_REGISTER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lss "); - #endif - GvEv(pMyDisasm); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ lfs_Mp(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SEGMENT_REGISTER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lfs "); - #endif - GvEv(pMyDisasm); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ lgs_Mp(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SEGMENT_REGISTER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lgs "); - #endif - GvEv(pMyDisasm); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ mov_RdCd(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - if (GV.MOD_== 3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - GV.CR_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.CR_ = 0; - FillFlags(pMyDisasm,67); - GV.EIP_ += GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ mov_RdDd(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - if (GV.MOD_== 3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - GV.DR_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.DR_ = 0; - FillFlags(pMyDisasm,67); - GV.EIP_ += GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ mov_CdRd(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - if (GV.MOD_== 3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - GV.CR_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.CR_ = 0; - FillFlags(pMyDisasm,67); - GV.EIP_ += GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ mov_DdRd(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - if (GV.MOD_== 3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - GV.DR_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.DR_ = 0; - FillFlags(pMyDisasm,67); - GV.EIP_ += GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } -} - -/* ======================================= - * 88h - * ======================================= */ -void __bea_callspec__ mov_EbGb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - EbGb(pMyDisasm); -} - -/* ======================================= - * 89h - * ======================================= */ -void __bea_callspec__ mov_EvGv(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - EvGv(pMyDisasm); -} - -/* ======================================= - * 8ah - * ======================================= */ -void __bea_callspec__ mov_GbEb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - GbEb(pMyDisasm); -} - -/* ======================================= - * 8bh - * ======================================= */ -void __bea_callspec__ mov_GvEv(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - GvEv(pMyDisasm); -} - -/* ======================================= - * 0a0h - * ======================================= */ -void __bea_callspec__ mov_ALOb(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - GV.MemDecoration = Arg2byte; - GV.RM_ = 5; - GV.MOD_= 0; - - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE ; - (*pMyDisasm).Argument2.ArgSize = 8; - if (GV.AddressSize == 64) { - if (!Security(9, pMyDisasm)) return; - MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - GV.EIP_+=9; - (*pMyDisasm).Argument2.Memory.Displacement = (Int64)MyAddress; - } - else if (GV.AddressSize == 32) { - if (!Security(5, pMyDisasm)) return; - MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - GV.EIP_+=5; - (*pMyDisasm).Argument2.Memory.Displacement = (Int64)MyAddress; - } - else { - if (!Security(3, pMyDisasm)) return; - MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - GV.EIP_+=3; - (*pMyDisasm).Argument2.Memory.Displacement = (Int64)MyAddress; - } - - if (GV.REX.B_ == 0) { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers8Bits[0]); - #endif - } - else { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers8Bits[0+8]); - #endif - } - -} - -/* ======================================= - * 0a1h - * ======================================= */ -void __bea_callspec__ mov_eAXOv(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - GV.RM_ = 5; - GV.MOD_= 0; - if (GV.AddressSize == 64) { - if (!Security(9, pMyDisasm)) return; - MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - GV.EIP_+=9; - (*pMyDisasm).Argument2.Memory.Displacement = (Int64)MyAddress; - } - else if (GV.AddressSize == 32) { - if (!Security(5, pMyDisasm)) return; - MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - GV.EIP_+=5; - (*pMyDisasm).Argument2.Memory.Displacement = (Int64)MyAddress; - } - else { - if (!Security(3, pMyDisasm)) return; - MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - GV.EIP_+=3; - (*pMyDisasm).Argument2.Memory.Displacement = (Int64)MyAddress; - } - - if (GV.REX.B_ == 0) { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); - #endif - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2dword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - } - else { - GV.MemDecoration = Arg2word; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - } - } - else { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG8; - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0+8]); - #endif - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2dword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0+8]); - #endif - } - else { - GV.MemDecoration = Arg2word; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0+8]); - #endif - } - } - - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE ; - if (GV.MemDecoration == 104) { - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.MemDecoration == 103) { - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else if (GV.MemDecoration == 102) { - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - -} - -/* ======================================= - * 0a2h - * ======================================= */ -void __bea_callspec__ mov_ObAL(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - GV.MemDecoration = Arg1byte; - GV.RM_ = 5; - GV.MOD_= 0; - - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE ; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgSize = 8; - if (GV.AddressSize == 64) { - if (!Security(9, pMyDisasm)) return; - MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - GV.EIP_+=9; - (*pMyDisasm).Argument1.Memory.Displacement = (Int64)MyAddress; - } - else if (GV.AddressSize == 32) { - if (!Security(5, pMyDisasm)) return; - MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - GV.EIP_+=5; - (*pMyDisasm).Argument1.Memory.Displacement = (Int64)MyAddress; - } - else { - if (!Security(3, pMyDisasm)) return; - MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - GV.EIP_+=3; - (*pMyDisasm).Argument1.Memory.Displacement = (Int64)MyAddress; - } - - if (GV.REX.B_ == 0) { - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[0]); - #endif - } - else { - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[0+8]); - #endif - } - -} - -/* ======================================= - * 0a3h - * ======================================= */ -void __bea_callspec__ mov_OveAX(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - GV.RM_ = 5; - GV.MOD_= 0; - if (GV.AddressSize == 64) { - if (!Security(9, pMyDisasm)) return; - MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - GV.EIP_+=9; - (*pMyDisasm).Argument1.Memory.Displacement = (Int64)MyAddress; - } - else if (GV.AddressSize == 32) { - if (!Security(5, pMyDisasm)) return; - MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - GV.EIP_+=5; - (*pMyDisasm).Argument1.Memory.Displacement = (Int64)MyAddress; - } - else { - if (!Security(3, pMyDisasm)) return; - MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument1.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - GV.EIP_+=3; - (*pMyDisasm).Argument1.Memory.Displacement = (Int64)MyAddress; - } - - if (GV.REX.B_ == 0) { - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg1qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[0]); - #endif - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg1dword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[0]); - #endif - } - else { - GV.MemDecoration = Arg1word; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[0]); - #endif - } - } - else { - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG8; - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg1qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[0+8]); - #endif - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg1dword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[0+8]); - #endif - } - else { - GV.MemDecoration = Arg1word; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[0+8]); - #endif - } - } - - - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE ; - if (GV.MemDecoration == Arg1qword) { - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.MemDecoration == Arg1dword) { - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else if (GV.MemDecoration == Arg1word) { - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } -} - -/* ======================================= - * 0b0h - * ======================================= */ -void __bea_callspec__ mov_ALIb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - ALIb(pMyDisasm); -} - -/* ======================================= - * 0b1h - * ======================================= */ -void __bea_callspec__ mov_CLIb(PDISASM pMyDisasm) -{ - long MyNumber; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - if (!Security(2, pMyDisasm)) return; - GV.ImmediatSize = 8; - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[1]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.EIP_ += 2; -} - -/* ======================================= - * 0b2h - * ======================================= */ -void __bea_callspec__ mov_DLIb(PDISASM pMyDisasm) -{ - long MyNumber; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - if (!Security(2, pMyDisasm)) return; - GV.ImmediatSize = 8; - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[2]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.EIP_ += 2; -} - -/* ======================================= - * 0b3h - * ======================================= */ -void __bea_callspec__ mov_BLIb(PDISASM pMyDisasm) -{ - long MyNumber; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - if (!Security(2, pMyDisasm)) return; - GV.ImmediatSize = 8; - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[3]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.EIP_ += 2; -} - -/* ======================================= - * 0b4h - * ======================================= */ -void __bea_callspec__ mov_AHIb(PDISASM pMyDisasm) -{ - long MyNumber; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - if (!Security(2, pMyDisasm)) return; - GV.ImmediatSize = 8; - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[4]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgPosition = HighPosition; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.EIP_ += 2; -} - -/* ======================================= - * 0b5h - * ======================================= */ -void __bea_callspec__ mov_CHIb(PDISASM pMyDisasm) -{ - long MyNumber; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - if (!Security(2, pMyDisasm)) return; - GV.ImmediatSize = 8; - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[5]); - #endif - (*pMyDisasm).Argument1.ArgPosition = HighPosition; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.EIP_ += 2; -} - -/* ======================================= - * 0b6h - * ======================================= */ -void __bea_callspec__ mov_DHIb(PDISASM pMyDisasm) -{ - long MyNumber; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - if (!Security(2, pMyDisasm)) return; - GV.ImmediatSize = 8; - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[6]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; - (*pMyDisasm).Argument1.ArgPosition = HighPosition; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.EIP_ += 2; -} - -/* ======================================= - * 0b7h - * ======================================= */ -void __bea_callspec__ mov_BHIb(PDISASM pMyDisasm) -{ - long MyNumber; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - if (!Security(2, pMyDisasm)) return; - GV.ImmediatSize = 8; - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8BitsLegacy[7]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; - (*pMyDisasm).Argument1.ArgPosition = HighPosition; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.EIP_ += 2; -} - - -/* ======================================= - * 0a4h - * ======================================= */ -void __bea_callspec__ movs_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsb "); - #endif - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; - (*pMyDisasm).Argument2.ArgSize = 8; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6+REG7; - GV.EIP_++; - FillFlags(pMyDisasm, 68); -} - -/* ======================================= - * 0a5h - * ======================================= */ -void __bea_callspec__ movsw_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsq "); - #endif - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6+REG7; - GV.EIP_++; - FillFlags(pMyDisasm, 68); - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsd "); - #endif - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6+REG7; - GV.EIP_++; - FillFlags(pMyDisasm, 68); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsw "); - #endif - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG6+REG7; - GV.EIP_++; - FillFlags(pMyDisasm, 68); - } -} - -/* ======================================= - * 0fb6h - * ======================================= */ -void __bea_callspec__ movzx_GvEb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movzx "); - #endif - GvEb(pMyDisasm); -} - - -/* ======================================= - * 0fbeh - * ======================================= */ -void __bea_callspec__ movsx_GvEb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsx "); - #endif - GvEb(pMyDisasm); -} - -/* ======================================= - * 0fbfh - * ======================================= */ -void __bea_callspec__ movsx_GvEw(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsx "); - #endif - GvEw(pMyDisasm); -} - -/* ======================================= - * 0fb7h - * ======================================= */ -void __bea_callspec__ movzx_GvEw(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movzx "); - #endif - GvEw(pMyDisasm); -} - -/* ======================================= - * 0b8h - * ======================================= */ -void __bea_callspec__ mov_EAX(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION + DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE + ABSOLUTE_; - if (GV.OperandSize == 64) { - if (!Security(9, pMyDisasm)) return; - MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - GV.EIP_+=9; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - if (!Security(5, pMyDisasm)) return; - MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - GV.EIP_+=5; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - if (!Security(3, pMyDisasm)) return; - MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - GV.EIP_+=3; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - - if (GV.REX.B_ == 0) { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE + GENERAL_REG + REG0; - if (GV.OperandSize == 64) { - - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - } - } - else { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG8; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0+8]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0+8]); - #endif - } - } - -} - -/* ======================================= - * 0b9h - * ======================================= */ -void __bea_callspec__ mov_ECX(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - if (GV.OperandSize == 64) { - if (!Security(9, pMyDisasm)) return; - MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - GV.EIP_+=9; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - if (!Security(5, pMyDisasm)) return; - MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - GV.EIP_+=5; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - if (!Security(3, pMyDisasm)) return; - MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - GV.EIP_+=3; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - - if (GV.REX.B_ == 0) { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[1+0]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1+0]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1+0]); - #endif - } - } - else { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG9; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[1+0+8]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1+0+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1+0+8]); - #endif - } - } - -} - -/* ======================================= - * 0bah - * ======================================= */ -void __bea_callspec__ mov_EDX(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - if (GV.OperandSize == 64) { - if (!Security(9, pMyDisasm)) return; - MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - GV.EIP_+=9; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - if (!Security(5, pMyDisasm)) return; - MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - GV.EIP_+=5; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - if (!Security(3, pMyDisasm)) return; - MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - GV.EIP_+=3; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - - if (GV.REX.B_ == 0) { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[2+0]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2+0]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2+0]); - #endif - } - } - else { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG10; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[2+0+8]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2+0+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2+0+8]); - #endif - } - } - -} - -/* ======================================= - * 0bbh - * ======================================= */ -void __bea_callspec__ mov_EBX(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - if (GV.OperandSize == 64) { - if (!Security(9, pMyDisasm)) return; - MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - GV.EIP_+=9; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - if (!Security(5, pMyDisasm)) return; - MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - GV.EIP_+=5; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - if (!Security(3, pMyDisasm)) return; - MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - GV.EIP_+=3; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - - if (GV.REX.B_ == 0) { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[3+0]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3+0]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3+0]); - #endif - } - } - else { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG11; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[3+0+8]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3+0+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3+0+8]); - #endif - } - } - -} - -/* ======================================= - * 0bch - * ======================================= */ -void __bea_callspec__ mov_ESP(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - if (GV.OperandSize == 64) { - if (!Security(9, pMyDisasm)) return; - MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - GV.EIP_+=9; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - if (!Security(5, pMyDisasm)) return; - MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - GV.EIP_+=5; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - if (!Security(3, pMyDisasm)) return; - MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - GV.EIP_+=3; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - - if (GV.REX.B_ == 0) { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG4; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[4+0]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4+0]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4+0]); - #endif - } - } - else { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG12; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[4+0+8]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4+0+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4+0+8]); - #endif - } - } - -} - -/* ======================================= - * 0bdh - * ======================================= */ -void __bea_callspec__ mov_EBP(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - if (GV.OperandSize == 64) { - if (!Security(9, pMyDisasm)) return; - MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - GV.EIP_+=9; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - if (!Security(5, pMyDisasm)) return; - MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - GV.EIP_+=5; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - if (!Security(3, pMyDisasm)) return; - MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - GV.EIP_+=3; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - - if (GV.REX.B_ == 0) { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG5; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[5+0]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5+0]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5+0]); - #endif - } - } - else { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG13; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[5+0+8]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5+0+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5+0+8]); - #endif - } - } - -} - -/* ======================================= - * 0beh - * ======================================= */ -void __bea_callspec__ mov_ESI(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - if (GV.OperandSize == 64) { - if (!Security(9, pMyDisasm)) return; - MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - GV.EIP_+=9; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - if (!Security(5, pMyDisasm)) return; - MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - GV.EIP_+=5; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - if (!Security(3, pMyDisasm)) return; - MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - GV.EIP_+=3; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - - if (GV.REX.B_ == 0) { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG6; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[6+0]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6+0]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6+0]); - #endif - } - } - else { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG14; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[6+0+8]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6+0+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6+0+8]); - #endif - } - } - -} - -/* ======================================= - * 0bfh - * ======================================= */ -void __bea_callspec__ mov_EDI(PDISASM pMyDisasm) -{ - UInt64 MyAddress; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - if (GV.OperandSize == 64) { - if (!Security(9, pMyDisasm)) return; - MyAddress = *((UInt64 *)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.16llX",(Int64) MyAddress); - #endif - GV.EIP_+=9; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - if (!Security(5, pMyDisasm)) return; - MyAddress = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.8X",(Int64) MyAddress); - #endif - GV.EIP_+=5; - (*pMyDisasm).Instruction.Immediat = (Int64)MyAddress; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - if (!Security(3, pMyDisasm)) return; - MyAddress = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument2.ArgMnemonic, "%.4X",(Int64) MyAddress); - #endif - GV.EIP_+=3; - (*pMyDisasm).Instruction.Immediat = (Int64) MyAddress; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - - if (GV.REX.B_ == 0) { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG7; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[7+0]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7+0]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7+0]); - #endif - } - } - else { - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG15; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[7+0+8]); - #endif - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7+0+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7+0+8]); - #endif - } - } - -} -/* ======================================= - * 0c6h-Group 11 - * ======================================= */ -void __bea_callspec__ mov_EbIb(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - EbIb(pMyDisasm); - } - else { - FailDecode(pMyDisasm); - } -} - -/* ======================================= - * 0c7h-Group 11 - * ======================================= */ -void __bea_callspec__ mov_EvIv(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - EvIv(pMyDisasm); - } - else { - FailDecode(pMyDisasm); - } -} - -/* ======================================= - * 08ch - * ======================================= */ -void __bea_callspec__ mov_EwSreg(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - GV.MemDecoration = Arg1word; - GV.OperandSize = 16; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.SEG_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SEG_ = 0; - GV.EIP_ += GV.DECALAGE_EIP+2; -} - -/* ======================================= - * 08eh - * ======================================= */ -void __bea_callspec__ mov_SregEw(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov "); - #endif - GV.MemDecoration = Arg2word; - GV.OperandSize = 16; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.OperandSize = 32; - GV.SEG_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SEG_ = 0; - GV.EIP_ += GV.DECALAGE_EIP+2; -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_CLMUL.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_CLMUL.c deleted file mode 100644 index 22960ee6..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_CLMUL.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * 0x 0f 3a 44 - * ==================================================================== */ -void __bea_callspec__ pclmulqdq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if (GV.OperandSize == 16) { - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = CLMUL_INSTRUCTION; - - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - - if ((*pMyDisasm).Instruction.Immediat == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmullqlqdq "); - #endif - } - else if ((*pMyDisasm).Instruction.Immediat == 0x01 ) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulhqlqdq "); - #endif - } - else if ((*pMyDisasm).Instruction.Immediat == 0x10 ) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmullqhqdq "); - #endif - } - else if ((*pMyDisasm).Instruction.Immediat == 0x011 ) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulhqhqdq "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulqdq "); - #endif - GV.third_arg = 1; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - } - } - else { - FailDecode(pMyDisasm); - } -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_FPU.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_FPU.c deleted file mode 100644 index c5eb280e..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_FPU.c +++ /dev/null @@ -1,1785 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ D8_(PDISASM pMyDisasm) -{ - long MyMODRM; - char (*pRegistersFPU)[8][8] ; - - GV.DECALAGE_EIP = 0; - if (!Security(1, pMyDisasm)) {return;} - MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - pRegistersFPU = &RegistersFPU_Masm; - if (GV.SYNTAX_ == NasmSyntax) { - pRegistersFPU = &RegistersFPU_Nasm; - } - if (MyMODRM <= 0xbf) { - GV.MemDecoration = Arg2dword; - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fadd "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 1) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fmul "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 2) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcom "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument1.AccessMode = READ; - } - else if (GV.REGOPCODE == 3) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomp "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument1.AccessMode = READ; - } - else if (GV.REGOPCODE == 4) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsub "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 5) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsubr "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 6) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdiv "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 7) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdivr "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else { - FailDecode(pMyDisasm); - } - } - else { - if ((MyMODRM & 0xf0) == 0xc0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fadd "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fmul "); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if ((MyMODRM & 0xf0) == 0xd0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcom "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomp "); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if ((MyMODRM & 0xf0) == 0xe0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsub "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsubr "); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if ((MyMODRM & 0xf0) == 0xf0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdiv "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdivr "); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument2.ArgSize = 80; - } - } - GV.EIP_ += GV.DECALAGE_EIP+2; -} - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ D9_(PDISASM pMyDisasm) -{ - long MyMODRM; - char (*pRegistersFPU)[8][8] ; - - GV.DECALAGE_EIP = 0; - if (!Security(1, pMyDisasm)) {return;} - MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - pRegistersFPU = &RegistersFPU_Masm; - if (GV.SYNTAX_ == NasmSyntax) { - pRegistersFPU = &RegistersFPU_Nasm; - } - if (MyMODRM <= 0xbf) { - - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fld "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 2) { - GV.MemDecoration = Arg1dword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fst "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.REGOPCODE == 3) { - GV.MemDecoration = Arg1dword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.REGOPCODE == 4) { - GV.MemDecoration = Arg2multibytes; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldenv "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 5) { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldcw "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 6) { - GV.MemDecoration = Arg1multibytes; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstenv "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.REGOPCODE == 7) { - GV.MemDecoration = Arg1word; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstcw "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else { - FailDecode(pMyDisasm); - } - } - else { - if ((MyMODRM & 0xf0) == 0xc0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fld "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxch "); - #endif - (*pMyDisasm).Argument2.AccessMode = WRITE; - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if ((MyMODRM & 0xf0) == 0xd0) { - if ((MyMODRM & 0xf) ==0) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fnop "); - #endif - } - else if (((MyMODRM & 0xf) >=0x8) && ((MyMODRM & 0xf) <=0xf)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp1 "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else { - FailDecode(pMyDisasm); - } - - } - else if ((MyMODRM & 0xf0) == 0xe0) { - if ((MyMODRM & 0xf) ==0) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fchs "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==1) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fabs "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==4) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ftst "); - #endif - } - else if ((MyMODRM & 0xf) ==5) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxam "); - #endif - } - else if ((MyMODRM & 0xf) ==8) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fld1 "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 80; - - } - else if ((MyMODRM & 0xf) ==9) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldl2t "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==0xa) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldl2e "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==0xb) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldpi "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==0xc) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldlg2 "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 80; - } - - else if ((MyMODRM & 0xf) ==0xd) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldln2 "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==0xe) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOAD_CONSTANTS; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fldz "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 80; - } - - else { - FailDecode(pMyDisasm); - } - } - else if ((MyMODRM & 0xf0) == 0xf0) { - if ((MyMODRM & 0xf) ==0) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOGARITHMIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "f2xm1 "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==1) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOGARITHMIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fyl2x "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==2) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+TRIGONOMETRIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fptan "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==3) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+TRIGONOMETRIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fpatan "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==4) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxtract "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==5) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fprem1 "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==6) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdecstp "); - #endif - } - else if ((MyMODRM & 0xf) ==7) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fincstp "); - #endif - } - else if ((MyMODRM & 0xf) ==8) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fprem "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==9) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOGARITHMIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fyl2xp1 "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==0xa) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsqrt "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==0xb) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+TRIGONOMETRIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsincos "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==0xc) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "frndint "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==0xd) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+LOGARITHMIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fscale "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==0xe) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+TRIGONOMETRIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsin "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf) ==0xf) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+TRIGONOMETRIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcos "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else { - FailDecode(pMyDisasm); - } - } - } - GV.EIP_ += GV.DECALAGE_EIP+2; -} - - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ DA_(PDISASM pMyDisasm) -{ - long MyMODRM; - char (*pRegistersFPU)[8][8] ; - - GV.DECALAGE_EIP = 0; - if (!Security(1, pMyDisasm)) {return;} - MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - pRegistersFPU = &RegistersFPU_Masm; - if (GV.SYNTAX_ == NasmSyntax) { - pRegistersFPU = &RegistersFPU_Nasm; - } - if (MyMODRM <= 0xbf) { - - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fiadd "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 1) { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fimul "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 2) { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ficom "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument1.AccessMode = READ; - } - else if (GV.REGOPCODE == 3) { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ficomp "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument1.AccessMode = READ; - } - else if (GV.REGOPCODE == 4) { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisub "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 5) { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisubr "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 6) { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fidiv "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 7) { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fidivr "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else { - FailDecode(pMyDisasm); - } - } - else { - if ((MyMODRM & 0xf0) == 0xc0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovb "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmove "); - #endif - (*pMyDisasm).Argument2.AccessMode = WRITE; - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if ((MyMODRM & 0xf0) == 0xd0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovbe "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovu "); - #endif - (*pMyDisasm).Argument2.AccessMode = WRITE; - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument2.ArgSize = 80; - - } - else if (MyMODRM == 0xe9) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fucompp "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument1.AccessMode = READ; - } - else { - FailDecode(pMyDisasm); - } - } - GV.EIP_ += GV.DECALAGE_EIP+2; -} - - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ DB_(PDISASM pMyDisasm) -{ - long MyMODRM; - char (*pRegistersFPU)[8][8] ; - - GV.DECALAGE_EIP = 0; - if (!Security(1, pMyDisasm)) {return;} - MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - pRegistersFPU = &RegistersFPU_Masm; - if (GV.SYNTAX_ == NasmSyntax) { - pRegistersFPU = &RegistersFPU_Nasm; - } - if (MyMODRM <= 0xbf) { - - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fild "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 1) { - GV.MemDecoration = Arg1dword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisttp "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.REGOPCODE == 2) { - GV.MemDecoration = Arg1dword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fist "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.REGOPCODE == 3) { - GV.MemDecoration = Arg1dword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fistp "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.REGOPCODE == 5) { - GV.MemDecoration = Arg2tbyte; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fld "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 7) { - GV.MemDecoration = Arg1tbyte; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else { - FailDecode(pMyDisasm); - } - } - else { - if ((MyMODRM & 0xf0) == 0xc0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovnb "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovne "); - #endif - (*pMyDisasm).Argument2.AccessMode = WRITE; - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if ((MyMODRM & 0xf0) == 0xd0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovnbe "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcmovnu "); - #endif - (*pMyDisasm).Argument2.AccessMode = WRITE; - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if ((MyMODRM & 0xf0) == 0xe0) { - - if ((MyMODRM & 0xf) ==0) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+UNSUPPORTED_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fneni "); - #endif - } - else if ((MyMODRM & 0xf) ==1) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+UNSUPPORTED_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fndisi "); - #endif - } - else if ((MyMODRM & 0xf) ==2) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fnclex "); - #endif - } - else if ((MyMODRM & 0xf) ==3) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fninit "); - #endif - } - else if ((MyMODRM & 0xf) ==4) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+UNSUPPORTED_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fnsetpm "); - #endif - } - else if ((MyMODRM & 0xf) ==5) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "frstpm "); - #endif - } - else if (((MyMODRM & 0xf) >=0x8) && ((MyMODRM & 0xf) <=0xf)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fucomi "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument1.AccessMode = READ; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else { - FailDecode(pMyDisasm); - } - } - else if ((MyMODRM & 0xf0) == 0xf0) { - if (((MyMODRM & 0xf) >=0x0) && ((MyMODRM & 0xf) <=0x7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomi "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument1.AccessMode = READ; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else { - FailDecode(pMyDisasm); - } - } - else { - FailDecode(pMyDisasm); - } - } - GV.EIP_ += GV.DECALAGE_EIP+2; -} - - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ DC_(PDISASM pMyDisasm) -{ - long MyMODRM; - char (*pRegistersFPU)[8][8] ; - - GV.DECALAGE_EIP = 0; - if (!Security(1, pMyDisasm)) {return;} - MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - pRegistersFPU = &RegistersFPU_Masm; - if (GV.SYNTAX_ == NasmSyntax) { - pRegistersFPU = &RegistersFPU_Nasm; - } - if (MyMODRM <= 0xbf) { - - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - GV.MemDecoration = Arg2qword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fadd "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 1) { - GV.MemDecoration = Arg2qword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fmul "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 2) { - GV.MemDecoration = Arg2qword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcom "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument1.AccessMode = READ; - } - else if (GV.REGOPCODE == 3) { - GV.MemDecoration = Arg2qword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomp "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - (*pMyDisasm).Argument1.AccessMode = READ; - } - else if (GV.REGOPCODE == 4) { - GV.MemDecoration = Arg2qword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsub "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 5) { - GV.MemDecoration = Arg2qword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsubr "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 6) { - GV.MemDecoration = Arg2qword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdiv "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 7) { - GV.MemDecoration = Arg2qword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdivr "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else { - FailDecode(pMyDisasm); - } - } - else { - if ((MyMODRM & 0xf0) == 0xc0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fadd "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fmul "); - #endif - (*pMyDisasm).Argument1.AccessMode = WRITE; - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument2.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf0) == 0xd0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcom2 "); - #endif - - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomp3 "); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - - } - else if ((MyMODRM & 0xf0) == 0xe0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsubr "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsub "); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument2.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf0) == 0xf0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdivr "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdiv "); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument2.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - - } - else { - FailDecode(pMyDisasm); - } - } - GV.EIP_ += GV.DECALAGE_EIP+2; -} - - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ DD_(PDISASM pMyDisasm) -{ - long MyMODRM; - char (*pRegistersFPU)[8][8] ; - - GV.DECALAGE_EIP = 0; - if (!Security(1, pMyDisasm)) {return;} - MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - pRegistersFPU = &RegistersFPU_Masm; - if (GV.SYNTAX_ == NasmSyntax) { - pRegistersFPU = &RegistersFPU_Nasm; - } - if (MyMODRM <= 0xbf) { - - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - GV.MemDecoration = Arg2qword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fld "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 1) { - GV.MemDecoration = Arg1qword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisttp "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.REGOPCODE == 2) { - GV.MemDecoration = Arg1qword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fst "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.REGOPCODE == 3) { - GV.MemDecoration = Arg1qword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.REGOPCODE == 4) { - GV.MemDecoration = Arg2multibytes; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "frstor "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 108*8; - } - else if (GV.REGOPCODE == 6) { - GV.MemDecoration = Arg1multibytes; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsave "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 108*8; - } - else if (GV.REGOPCODE == 7) { - GV.MemDecoration = Arg1word; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstsw "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG; - (*pMyDisasm).Argument2.ArgSize = 16; - } - else { - FailDecode(pMyDisasm); - } - } - else { - if ((MyMODRM & 0xf0) == 0xc0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ffree "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxch4 "); - #endif - (*pMyDisasm).Argument2.AccessMode = WRITE; - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf0) == 0xd0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fst "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp "); - #endif - (*pMyDisasm).Argument2.AccessMode = WRITE; - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - - } - else if ((MyMODRM & 0xf0) == 0xe0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fucom "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument2.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fucomp "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - - } - - else { - FailDecode(pMyDisasm); - } - } - GV.EIP_ += GV.DECALAGE_EIP+2; -} - - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ DE_(PDISASM pMyDisasm) -{ - long MyMODRM; - char (*pRegistersFPU)[8][8] ; - - GV.DECALAGE_EIP = 0; - if (!Security(1, pMyDisasm)) {return;} - MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - pRegistersFPU = &RegistersFPU_Masm; - if (GV.SYNTAX_ == NasmSyntax) { - pRegistersFPU = &RegistersFPU_Nasm; - } - if (MyMODRM <= 0xbf) { - - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fiadd "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 1) { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fimul "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 2) { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ficom "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 3) { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ficomp "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 4) { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisub "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 5) { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisubr "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 6) { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fidiv "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 7) { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fidivr "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else { - FailDecode(pMyDisasm); - } - } - else { - if ((MyMODRM & 0xf0) == 0xc0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "faddp "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fmulp "); - #endif - (*pMyDisasm).Argument2.AccessMode = WRITE; - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument2.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf0) == 0xd0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomp5 "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (MyMODRM == 0xd9){ - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcompp "); - #endif - } - else { - FailDecode(pMyDisasm); - } - - - } - else if ((MyMODRM & 0xf0) == 0xe0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsubrp "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fsubp "); - #endif - (*pMyDisasm).Argument2.AccessMode = WRITE; - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument2.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf0) == 0xf0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdivrp "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fdivp "); - #endif - (*pMyDisasm).Argument2.AccessMode = WRITE; - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument2.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - - } - else { - FailDecode(pMyDisasm); - } - } - GV.EIP_ += GV.DECALAGE_EIP+2; -} - - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ DF_(PDISASM pMyDisasm) -{ - long MyMODRM; - char (*pRegistersFPU)[8][8] ; - - GV.DECALAGE_EIP = 0; - if (!Security(1, pMyDisasm)) {return;} - MyMODRM = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - pRegistersFPU = &RegistersFPU_Masm; - if (GV.SYNTAX_ == NasmSyntax) { - pRegistersFPU = &RegistersFPU_Nasm; - } - if (MyMODRM <= 0xbf) { - - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fild "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 1) { - GV.MemDecoration = Arg1word; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fisttp "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.REGOPCODE == 2) { - GV.MemDecoration = Arg1word; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fist "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.REGOPCODE == 3) { - GV.MemDecoration = Arg1word; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fistp "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.REGOPCODE == 4) { - GV.MemDecoration = Arg2multibytes; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fbld "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 5) { - GV.MemDecoration = Arg2qword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fild "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if (GV.REGOPCODE == 6) { - GV.MemDecoration = Arg1multibytes; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fbstp "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else if (GV.REGOPCODE == 7) { - GV.MemDecoration = Arg1qword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fistp "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else { - FailDecode(pMyDisasm); - } - } - else { - if ((MyMODRM & 0xf0) == 0xc0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ffreep "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxch7 "); - #endif - (*pMyDisasm).Argument2.AccessMode = WRITE; - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - } - else if ((MyMODRM & 0xf0) == 0xd0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp8 "); - #endif - } - else { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstp9 "); - #endif - (*pMyDisasm).Argument2.AccessMode = WRITE; - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument1.ArgSize = 80; - - } - else if ((MyMODRM & 0xf0) == 0xe0) { - if (MyMODRM == 0xe0) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fstsw "); - #endif - } - else if ((MyMODRM & 0xf) >=8) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fucomip "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument2.ArgSize = 80; - } - - - else { - FailDecode(pMyDisasm); - } - } - - else if ((MyMODRM & 0xf0) == 0xf0) { - if (((MyMODRM & 0xf) >=0) && ((MyMODRM & 0xf) <=7)) { - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fcomip "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, (*pRegistersFPU)[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 80; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, (*pRegistersFPU)[(MyMODRM & 0xf)%8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+REGS[(MyMODRM & 0xf)%8]; - (*pMyDisasm).Argument2.ArgSize = 80; - } - else { - FailDecode(pMyDisasm); - } - - } - else { - FailDecode(pMyDisasm); - } - } - GV.EIP_ += GV.DECALAGE_EIP+2; -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp1.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp1.c deleted file mode 100644 index c939bcb1..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp1.c +++ /dev/null @@ -1,297 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * 80h - * ==================================================================== */ -void __bea_callspec__ G1_EbIb(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - EbIb(pMyDisasm); - if (GV.REGOPCODE == 0) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); - #endif - FillFlags(pMyDisasm, 5); - } - else if (GV.REGOPCODE == 1) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); - #endif - FillFlags(pMyDisasm, 74); - } - else if (GV.REGOPCODE == 2) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); - #endif - FillFlags(pMyDisasm, 4); - } - else if (GV.REGOPCODE == 3) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); - #endif - FillFlags(pMyDisasm, 93); - } - else if (GV.REGOPCODE == 4) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); - #endif - FillFlags(pMyDisasm, 6); - } - else if (GV.REGOPCODE == 5) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); - #endif - FillFlags(pMyDisasm, 103); - } - - else if (GV.REGOPCODE == 6) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); - #endif - FillFlags(pMyDisasm, 113); - } - - else if (GV.REGOPCODE == 7) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); - #endif - FillFlags(pMyDisasm, 20); - (*pMyDisasm).Argument1.AccessMode = READ; - } -} - -/* ==================================================================== - * 82h - * ==================================================================== */ -void __bea_callspec__ G1_EbIb2(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - G1_EbIb(pMyDisasm); - } -} - -/* ==================================================================== - * 81h - * ==================================================================== */ -void __bea_callspec__ G1_EvIv(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - EvIv(pMyDisasm); - if (GV.REGOPCODE == 0) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); - #endif - FillFlags(pMyDisasm, 5); - } - else if (GV.REGOPCODE == 1) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); - #endif - FillFlags(pMyDisasm, 74); - } - else if (GV.REGOPCODE == 2) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); - #endif - FillFlags(pMyDisasm, 4); - } - else if (GV.REGOPCODE == 3) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); - #endif - FillFlags(pMyDisasm, 93); - } - else if (GV.REGOPCODE == 4) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); - #endif - FillFlags(pMyDisasm, 6); - } - else if (GV.REGOPCODE == 5) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); - #endif - FillFlags(pMyDisasm, 103); - } - - else if (GV.REGOPCODE == 6) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); - #endif - FillFlags(pMyDisasm, 113); - } - - else if (GV.REGOPCODE == 7) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); - #endif - FillFlags(pMyDisasm, 20); - (*pMyDisasm).Argument1.AccessMode = READ; - } -} - -/* ==================================================================== - * 83h - * ==================================================================== */ -void __bea_callspec__ G1_EvIb(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - EvIb(pMyDisasm); - if (GV.REGOPCODE == 0) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "add "); - #endif - FillFlags(pMyDisasm, 5); - } - else if (GV.REGOPCODE == 1) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); - #endif - FillFlags(pMyDisasm, 74); - } - else if (GV.REGOPCODE == 2) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "adc "); - #endif - FillFlags(pMyDisasm, 4); - } - else if (GV.REGOPCODE == 3) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); - #endif - FillFlags(pMyDisasm, 93); - } - else if (GV.REGOPCODE == 4) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "and "); - #endif - FillFlags(pMyDisasm, 6); - } - else if (GV.REGOPCODE == 5) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); - #endif - FillFlags(pMyDisasm, 103); - } - - else if (GV.REGOPCODE == 6) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); - #endif - FillFlags(pMyDisasm, 113); - } - - else if (GV.REGOPCODE == 7) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmp "); - #endif - FillFlags(pMyDisasm, 20); - (*pMyDisasm).Argument1.AccessMode = READ; - } -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp12.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp12.c deleted file mode 100644 index d0d90305..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp12.c +++ /dev/null @@ -1,195 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ G12_(PDISASM pMyDisasm) -{ - long MyNumber; - - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 2) { - if (GV.OperandSize == 16) { - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1dqword; - GV.ImmediatSize = 8; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - else { - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1qword; - GV.ImmediatSize = 8; - GV.MMX_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - } - else if (GV.REGOPCODE == 4) { - if (GV.OperandSize == 16) { - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1dqword; - GV.ImmediatSize = 8; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - else { - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1qword; - GV.ImmediatSize = 8; - GV.MMX_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - - } - else if (GV.REGOPCODE == 6) { - if (GV.OperandSize == 16) { - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1dqword; - GV.ImmediatSize = 8; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - else { - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1qword; - GV.ImmediatSize = 8; - GV.MMX_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - } - - else { - FailDecode(pMyDisasm); - } - -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp13.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp13.c deleted file mode 100644 index b01a132d..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp13.c +++ /dev/null @@ -1,194 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ G13_(PDISASM pMyDisasm) -{ - long MyNumber; - - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 2) { - if (GV.OperandSize == 16) { - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1dqword; - GV.ImmediatSize = 8; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - else { - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1qword; - GV.ImmediatSize = 8; - GV.MMX_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - } - else if (GV.REGOPCODE == 4) { - if (GV.OperandSize == 16) { - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1dqword; - GV.ImmediatSize = 8; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - else { - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1qword; - GV.ImmediatSize = 8; - GV.MMX_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - - } - else if (GV.REGOPCODE == 6) { - if (GV.OperandSize == 16) { - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1dqword; - GV.ImmediatSize = 8; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - else { - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1qword; - GV.ImmediatSize = 8; - GV.MMX_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - } - - else { - FailDecode(pMyDisasm); - } - -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp14.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp14.c deleted file mode 100644 index 801e114e..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp14.c +++ /dev/null @@ -1,203 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ G14_(PDISASM pMyDisasm) -{ - long MyNumber; - - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 2) { - if (GV.OperandSize == 16) { - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1dqword; - GV.ImmediatSize = 8; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - else { - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1qword; - GV.ImmediatSize = 8; - GV.MMX_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - } - else if (GV.REGOPCODE == 3) { - if (GV.OperandSize == 16) { - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1dqword; - GV.ImmediatSize = 8; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrldq "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - else { - FailDecode(pMyDisasm); - } - - } - else if (GV.REGOPCODE == 6) { - if (GV.OperandSize == 16) { - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1dqword; - GV.ImmediatSize = 8; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - else { - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1qword; - GV.ImmediatSize = 8; - GV.MMX_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - } - else if (GV.REGOPCODE == 7) { - if (GV.OperandSize == 16) { - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; - GV.MemDecoration = Arg1dqword; - GV.ImmediatSize = 8; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslldq "); - #endif - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Instruction.Immediat = MyNumber; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - } - else { - FailDecode(pMyDisasm); - } - - } - else { - FailDecode(pMyDisasm); - } - -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp15.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp15.c deleted file mode 100644 index 1489d0ab..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp15.c +++ /dev/null @@ -1,166 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ G15_(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - if (GV.MOD_!= 0x3) { - GV.MemDecoration = Arg1multibytes; - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxsave "); - #endif - (*pMyDisasm).Argument1.ArgSize = 512; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; - (*pMyDisasm).Argument2.ArgSize = 512; - } - else { - FailDecode(pMyDisasm); - } - } - else if (GV.REGOPCODE == 1) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - if (GV.MOD_!= 0x3) { - GV.MemDecoration = Arg2multibytes; - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxrstor "); - #endif - (*pMyDisasm).Argument2.ArgSize = 512; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; - (*pMyDisasm).Argument1.ArgSize = 512; - } - else { - FailDecode(pMyDisasm); - } - - } - else if (GV.REGOPCODE == 2) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - if (GV.MOD_!= 0x3) { - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+STATE_MANAGEMENT; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ldmxcsr "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG1; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - FailDecode(pMyDisasm); - } - - } - else if (GV.REGOPCODE == 3) { - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - if (GV.MOD_!= 0x3) { - GV.MemDecoration = Arg1dword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+STATE_MANAGEMENT; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stmxcsr "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG1; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - FailDecode(pMyDisasm); - } - - } - - else if (GV.REGOPCODE == 4) { - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - if (GV.MOD_!= 0x3) { - GV.MemDecoration = Arg1multibytes; - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xsave "); - #endif - (*pMyDisasm).Argument1.ArgSize = 512; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; - (*pMyDisasm).Argument2.ArgSize = 512; - } - else { - FailDecode(pMyDisasm); - } - } - - else if (GV.REGOPCODE == 5) { - GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; - if (GV.MOD_== 0x3) { - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lfence "); - #endif - } - else { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg2multibytes; - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xrstor "); - #endif - (*pMyDisasm).Argument2.ArgSize = 512; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; - (*pMyDisasm).Argument1.ArgSize = 512; - } - - } - else if (GV.REGOPCODE == 6) { - GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; - if (GV.MOD_== 0x3) { - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mfence "); - #endif - } - else { - FailDecode(pMyDisasm); - } - } - else if (GV.REGOPCODE == 7) { - GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; - if (GV.MOD_== 0x3) { - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sfence "); - #endif - } - else { - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.OperandSize = 32; - GV.MemDecoration = Arg2byte; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clflush "); - #endif - } - - } - - else { - FailDecode(pMyDisasm); - } - GV.EIP_+= GV.DECALAGE_EIP+2; -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp16.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp16.c deleted file mode 100644 index 58cad51a..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp16.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ G16_(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - if (GV.MOD_!= 0x3) { - GV.MemDecoration = Arg2byte; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchNTA "); - #endif - } - else { - FailDecode(pMyDisasm); - } - } - else if (GV.REGOPCODE == 1) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - if (GV.MOD_!= 0x3) { - GV.MemDecoration = Arg2byte; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT0 "); - #endif - } - else { - FailDecode(pMyDisasm); - } - - } - else if (GV.REGOPCODE == 2) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - if (GV.MOD_!= 0x3) { - GV.MemDecoration = Arg2byte; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT1 "); - #endif - } - else { - FailDecode(pMyDisasm); - } - - } - else if (GV.REGOPCODE == 3) { - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - if (GV.MOD_!= 0x3) { - GV.MemDecoration = Arg2byte; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT2 "); - #endif - } - else { - FailDecode(pMyDisasm); - } - - } - - else { - FailDecode(pMyDisasm); - } - GV.EIP_+= GV.DECALAGE_EIP+2; -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp17.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp17.c deleted file mode 100644 index 0153d44f..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp17.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . - * - * @author : beaengine@gmail.com - */ - -/* ==================================================================== - * - * ==================================================================== */ -void __bea_callspec__ G17_(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 1) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blsr "); - #endif - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - GV.MemDecoration = Arg2qword; - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument1, pMyDisasm); - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - } - else { - GV.MemDecoration = Arg2dword; - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument1, pMyDisasm); - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - } - } - - } - else { - FailDecode(pMyDisasm); - } - } - else if (GV.REGOPCODE == 2) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blmsk "); - #endif - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - GV.MemDecoration = Arg2qword; - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument1, pMyDisasm); - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - } - else { - GV.MemDecoration = Arg2dword; - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument1, pMyDisasm); - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - } - } - - } - else { - FailDecode(pMyDisasm); - } - } - else if (GV.REGOPCODE == 3) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blsi "); - #endif - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - GV.MemDecoration = Arg2qword; - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument1, pMyDisasm); - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - } - else { - GV.MemDecoration = Arg2dword; - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument1, pMyDisasm); - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - } - } - - } - else { - FailDecode(pMyDisasm); - } - } - else { - FailDecode(pMyDisasm); - } - GV.EIP_+= GV.DECALAGE_EIP + 2; -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp2.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp2.c deleted file mode 100644 index b1fc8105..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp2.c +++ /dev/null @@ -1,461 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * 0c0h - * ==================================================================== */ -void __bea_callspec__ G2_EbIb(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - EbIb(pMyDisasm); - if (GV.REGOPCODE == 0) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); - #endif - FillFlags(pMyDisasm, 88); - } - else if (GV.REGOPCODE == 1) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); - #endif - FillFlags(pMyDisasm, 88); - } - else if (GV.REGOPCODE == 2) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); - #endif - FillFlags(pMyDisasm, 81); - } - else if (GV.REGOPCODE == 3) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); - #endif - FillFlags(pMyDisasm, 81); - } - else if (GV.REGOPCODE == 4) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); - #endif - FillFlags(pMyDisasm, 92); - } - else if (GV.REGOPCODE == 5) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); - #endif - FillFlags(pMyDisasm, 92); - } - else if (GV.REGOPCODE == 6) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); - #endif - FillFlags(pMyDisasm, 92); - } - else if (GV.REGOPCODE == 7) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); - #endif - FillFlags(pMyDisasm, 92); - } -} - - -/* ==================================================================== - * 0c1h - * ==================================================================== */ -void __bea_callspec__ G2_EvIb(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - EvIb(pMyDisasm); - if (GV.REGOPCODE == 0) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); - #endif - FillFlags(pMyDisasm, 88); - } - else if (GV.REGOPCODE == 1) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); - #endif - FillFlags(pMyDisasm, 88); - } - else if (GV.REGOPCODE == 2) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); - #endif - FillFlags(pMyDisasm, 81); - } - else if (GV.REGOPCODE == 3) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); - #endif - FillFlags(pMyDisasm, 81); - } - else if (GV.REGOPCODE == 4) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); - #endif - FillFlags(pMyDisasm, 92); - } - else if (GV.REGOPCODE == 5) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); - #endif - FillFlags(pMyDisasm, 92); - } - else if (GV.REGOPCODE == 6) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); - #endif - FillFlags(pMyDisasm, 92); - } - else if (GV.REGOPCODE == 7) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); - #endif - FillFlags(pMyDisasm, 92); - } -} - -/* ==================================================================== - * 0d0h - * ==================================================================== */ -void __bea_callspec__ G2_Eb1(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, "1 "); - #endif - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - (*pMyDisasm).Instruction.Immediat = 1; - if (GV.REGOPCODE == 0) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); - #endif - FillFlags(pMyDisasm, 87); - } - else if (GV.REGOPCODE == 1) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); - #endif - FillFlags(pMyDisasm, 87); - } - else if (GV.REGOPCODE == 2) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); - #endif - FillFlags(pMyDisasm, 80); - } - else if (GV.REGOPCODE == 3) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); - #endif - FillFlags(pMyDisasm, 80); - } - else if (GV.REGOPCODE == 4) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); - #endif - FillFlags(pMyDisasm, 91); - } - else if (GV.REGOPCODE == 5) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); - #endif - FillFlags(pMyDisasm, 91); - } - else if (GV.REGOPCODE == 6) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); - #endif - FillFlags(pMyDisasm, 91); - } - else if (GV.REGOPCODE == 7) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); - #endif - FillFlags(pMyDisasm, 91); - } - GV.EIP_ += GV.DECALAGE_EIP+2; -} - - -/* ==================================================================== - * 0d1h - * ==================================================================== */ -void __bea_callspec__ G2_Ev1(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg1qword; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg1dword; - } - else { - GV.MemDecoration = Arg1word; - } - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, "1 "); - #endif - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - (*pMyDisasm).Instruction.Immediat = 1; - if (GV.REGOPCODE == 0) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); - #endif - FillFlags(pMyDisasm, 87); - } - else if (GV.REGOPCODE == 1) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); - #endif - FillFlags(pMyDisasm, 87); - } - else if (GV.REGOPCODE == 2) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); - #endif - FillFlags(pMyDisasm, 80); - } - else if (GV.REGOPCODE == 3) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); - #endif - FillFlags(pMyDisasm, 80); - } - else if (GV.REGOPCODE == 4) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); - #endif - FillFlags(pMyDisasm, 91); - } - else if (GV.REGOPCODE == 5) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); - #endif - FillFlags(pMyDisasm, 91); - } - else if (GV.REGOPCODE == 6) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); - #endif - FillFlags(pMyDisasm, 91); - } - else if (GV.REGOPCODE == 7) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); - #endif - FillFlags(pMyDisasm, 91); - } - GV.EIP_ += GV.DECALAGE_EIP+2; -} - - -/* ==================================================================== - * 0d2h - * ==================================================================== */ -void __bea_callspec__ G2_EbCL(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[1]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; - (*pMyDisasm).Argument2.ArgSize = 8; - if (GV.REGOPCODE == 0) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); - #endif - FillFlags(pMyDisasm, 88); - } - else if (GV.REGOPCODE == 1) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); - #endif - FillFlags(pMyDisasm, 88); - } - else if (GV.REGOPCODE == 2) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); - #endif - FillFlags(pMyDisasm, 81); - } - else if (GV.REGOPCODE == 3) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); - #endif - FillFlags(pMyDisasm, 81); - } - else if (GV.REGOPCODE == 4) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); - #endif - FillFlags(pMyDisasm, 92); - } - else if (GV.REGOPCODE == 5) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); - #endif - FillFlags(pMyDisasm, 92); - } - else if (GV.REGOPCODE == 6) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); - #endif - FillFlags(pMyDisasm, 92); - } - else if (GV.REGOPCODE == 7) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); - #endif - FillFlags(pMyDisasm, 92); - } - GV.EIP_ += GV.DECALAGE_EIP+2; -} - - -/* ==================================================================== - * 0d3h - * ==================================================================== */ -void __bea_callspec__ G2_EvCL(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg1qword; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg1dword; - } - else { - GV.MemDecoration = Arg1word; - } - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[1]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; - (*pMyDisasm).Argument2.ArgSize = 8; - if (GV.REGOPCODE == 0) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rol "); - #endif - FillFlags(pMyDisasm, 88); - } - else if (GV.REGOPCODE == 1) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ror "); - #endif - FillFlags(pMyDisasm, 88); - } - else if (GV.REGOPCODE == 2) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcl "); - #endif - FillFlags(pMyDisasm, 81); - } - else if (GV.REGOPCODE == 3) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcr "); - #endif - FillFlags(pMyDisasm, 81); - } - else if (GV.REGOPCODE == 4) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shl "); - #endif - FillFlags(pMyDisasm, 92); - } - else if (GV.REGOPCODE == 5) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shr "); - #endif - FillFlags(pMyDisasm, 92); - } - else if (GV.REGOPCODE == 6) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sal "); - #endif - FillFlags(pMyDisasm, 92); - } - else if (GV.REGOPCODE == 7) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sar "); - #endif - FillFlags(pMyDisasm, 92); - } - GV.EIP_ += GV.DECALAGE_EIP+2; -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp3.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp3.c deleted file mode 100644 index 2e2433c6..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp3.c +++ /dev/null @@ -1,257 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * 0f6h - * ==================================================================== */ -void __bea_callspec__ G3_Eb(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); - #endif - EbIb(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm, 104); - } - else if (GV.REGOPCODE == 1) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); - #endif - EbIb(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm, 104); - } - else if (GV.REGOPCODE == 2) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "not "); - #endif - Eb(pMyDisasm); - FillFlags(pMyDisasm, 73); - } - else if (GV.REGOPCODE == 3) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "neg "); - #endif - Eb(pMyDisasm); - FillFlags(pMyDisasm, 71); - } - else if (GV.REGOPCODE == 4) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mul "); - #endif - GV.MemDecoration = Arg2byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0; - FillFlags(pMyDisasm, 70); - } - else if (GV.REGOPCODE == 5) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul "); - #endif - GV.MemDecoration = Arg2byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - (*pMyDisasm).Argument1.ArgSize = 8; - FillFlags(pMyDisasm, 38); - } - else if (GV.REGOPCODE == 6) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "div "); - #endif - GV.MemDecoration = Arg2byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - (*pMyDisasm).Argument1.ArgSize = 8; - FillFlags(pMyDisasm, 31); - } - else if (GV.REGOPCODE == 7) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "idiv "); - #endif - GV.MemDecoration = Arg2byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0; - FillFlags(pMyDisasm, 37); - } -} - -/* ==================================================================== - * 0f7h - * ==================================================================== */ -void __bea_callspec__ G3_Ev(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); - #endif - EvIv(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm, 104); - } - else if (GV.REGOPCODE == 1) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); - #endif - EvIv(pMyDisasm); - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm, 104); - } - else if (GV.REGOPCODE == 2) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "not "); - #endif - Ev(pMyDisasm); - FillFlags(pMyDisasm, 73); - } - else if (GV.REGOPCODE == 3) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "neg "); - #endif - Ev(pMyDisasm); - FillFlags(pMyDisasm, 71); - } - else if (GV.REGOPCODE == 4) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mul "); - #endif - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Argument1.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - GV.MemDecoration = Arg2word; - (*pMyDisasm).Argument1.ArgSize = 16; - } - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - FillFlags(pMyDisasm, 70); - } - else if (GV.REGOPCODE == 5) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul "); - #endif - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Argument1.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - GV.MemDecoration = Arg2word; - (*pMyDisasm).Argument1.ArgSize = 16; - } - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - FillFlags(pMyDisasm, 38); - } - else if (GV.REGOPCODE == 6) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "div "); - #endif - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Argument1.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - GV.MemDecoration = Arg2word; - (*pMyDisasm).Argument1.ArgSize = 16; - } - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - FillFlags(pMyDisasm, 31); - } - else if (GV.REGOPCODE == 7) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "idiv "); - #endif - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Argument1.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - GV.MemDecoration = Arg2word; - (*pMyDisasm).Argument1.ArgSize = 16; - } - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - FillFlags(pMyDisasm, 37); - } -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp4.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp4.c deleted file mode 100644 index 4e430b9b..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp4.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * 0feh - * ==================================================================== */ -void __bea_callspec__ G4_Eb(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); - #endif - Eb(pMyDisasm); - FillFlags(pMyDisasm, 40); - } - else if (GV.REGOPCODE == 1) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); - #endif - Eb(pMyDisasm); - FillFlags(pMyDisasm, 30); - } - else { - FailDecode(pMyDisasm); - } -} - diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp5.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp5.c deleted file mode 100644 index f7ad8040..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp5.c +++ /dev/null @@ -1,153 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * 0ffh - * ==================================================================== */ -void __bea_callspec__ G5_Ev(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); - #endif - Ev(pMyDisasm); - FillFlags(pMyDisasm, 40); - } - else if (GV.REGOPCODE == 1) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); - #endif - Ev(pMyDisasm); - FillFlags(pMyDisasm, 30); - } - else if (GV.REGOPCODE == 2) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = CallType; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call "); - #endif - if (GV.Architecture == 64) { - GV.OperandSize = 64; - } - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg1qword; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg1dword; - } - else { - GV.MemDecoration = Arg1word; - } - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - } - else if (GV.REGOPCODE == 3) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = CallType; - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lcall "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call far "); - #endif - } - GV.MemDecoration = Arg1fword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - } - else if (GV.REGOPCODE == 4) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JmpType; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp "); - #endif - if (GV.Architecture == 64) { - GV.OperandSize = 64; - } - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg1qword; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg1dword; - } - else { - GV.MemDecoration = Arg1word; - } - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - } - else if (GV.REGOPCODE == 5) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = JmpType; - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ljmp "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp far "); - #endif - } - GV.MemDecoration = Arg1fword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - } - else if (GV.REGOPCODE == 6) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - GV.OperandSize = 64; - } - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2dword; - } - else { - GV.MemDecoration = Arg2word; - } - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - } - else { - FailDecode(pMyDisasm); - } -} - diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp6.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp6.c deleted file mode 100644 index af09f7a4..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp6.c +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * 0f00h - * ==================================================================== */ -void __bea_callspec__ G6_(PDISASM pMyDisasm) -{ - Int32 OperandSizeOld = 0; - - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - OperandSizeOld = GV.OperandSize; - GV.OperandSize = 16; - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; - - if (GV.REGOPCODE == 0) { - if ((OperandSizeOld == 64) && (GV.MOD_== 0x3)) { - GV.OperandSize = OperandSizeOld; - } - else { - GV.MemDecoration = Arg1word; - } - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sldt "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG1; - (*pMyDisasm).Argument2.ArgSize = 32; - GV.OperandSize = OperandSizeOld; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.REGOPCODE == 1) { - if ((OperandSizeOld == 64) && (GV.MOD_== 0x3)) { - GV.OperandSize = OperandSizeOld; - } - else { - GV.MemDecoration = Arg1word; - } - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "str "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG3; - (*pMyDisasm).Argument2.ArgSize = 16; - GV.OperandSize = OperandSizeOld; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.REGOPCODE == 2) { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lldt "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG1; - (*pMyDisasm).Argument1.ArgSize = 16; - GV.OperandSize = OperandSizeOld; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.REGOPCODE == 3) { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ltr "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG3; - (*pMyDisasm).Argument1.ArgSize = 16; - GV.OperandSize = OperandSizeOld; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.REGOPCODE == 4) { - GV.MemDecoration = Arg1word; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "verr "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 16; - GV.OperandSize = OperandSizeOld; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.REGOPCODE == 5) { - GV.MemDecoration = Arg1word; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "verw "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 16; - GV.OperandSize = OperandSizeOld; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.REGOPCODE == 6) { - FailDecode(pMyDisasm); - GV.OperandSize = OperandSizeOld; - } - else { - FailDecode(pMyDisasm); - GV.OperandSize = OperandSizeOld; - } -} - diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp7.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp7.c deleted file mode 100644 index 9236def2..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp7.c +++ /dev/null @@ -1,287 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * 0f01h - * ==================================================================== */ -void __bea_callspec__ G7_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; - GV.RM_ = (*((UInt8*)(UIntPtr) (GV.EIP_+1))) & 0x7; - if (GV.REGOPCODE == 0) { - if (GV.MOD_== 0x3) { - if (GV.RM_ == 0x1) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmcall "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.RM_ == 0x2) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmlaunch "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.RM_ == 0x3) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmresume "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.RM_ == 0x4) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmxoff "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } - } - else { - GV.MemDecoration = Arg1fword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sgdt "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 48; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } - else if (GV.REGOPCODE == 1) { - if (GV.MOD_== 0x3) { - if (GV.RM_ == 0x00) { - (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+AGENT_SYNCHRONISATION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "monitor "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.RM_ == 0x01) { - (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+AGENT_SYNCHRONISATION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mwait "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.RM_ == 0x2) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clac "); - #endif - FillFlags(pMyDisasm,129); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } - } - else { - GV.MemDecoration = Arg1fword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sidt "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG2; - (*pMyDisasm).Argument2.ArgSize = 48; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } - else if (GV.REGOPCODE == 2) { - if (GV.MOD_== 0x3) { - if (GV.RM_ == 0x0) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xgetbv "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.RM_ == 0x1) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xsetbv "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } - } - else { - GV.MemDecoration = Arg2fword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lgdt "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 48; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } - else if (GV.REGOPCODE == 3) { - if (GV.MOD_== 0x3) { - if (GV.RM_ == 0x0) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmrun "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.RM_ == 0x1) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmmcall "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.RM_ == 0x2) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmload "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.RM_ == 0x3) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmsave "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.RM_ == 0x4) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stgi "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.RM_ == 0x5) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clgi "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.RM_ == 0x6) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "skinit "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.RM_ == 0x7) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "invlpga "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } - } - else { - GV.MemDecoration = Arg2fword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lidt "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG2; - (*pMyDisasm).Argument1.ArgSize = 48; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } - - else if (GV.REGOPCODE == 4) { - GV.MemDecoration = Arg2word; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "smsw "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+CR_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 16; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - - else if (GV.REGOPCODE == 6) { - GV.MemDecoration = Arg1word; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lmsw "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+CR_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 16; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else if (GV.REGOPCODE == 7) { - if (GV.MOD_== 0x3) { - if (GV.Architecture == 64) { - if (GV.RM_ == 0x0) { - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "swapgs "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } - } - else { - if (GV.RM_ == 0x1) { - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rdtscp "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } - } - } - else { - GV.MemDecoration = Arg2byte; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "invlpg "); - #endif - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } - else { - FailDecode(pMyDisasm); - } - - -} - diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp8.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp8.c deleted file mode 100644 index cd0447ec..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp8.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * 0fbah - * ==================================================================== */ -void __bea_callspec__ G8_EvIb(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - EvIb(pMyDisasm); - if (GV.REGOPCODE == 4) { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bt "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm, 11); - } - else if (GV.REGOPCODE == 5) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bts "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm, 11); - } - else if (GV.REGOPCODE == 6) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btr "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm, 11); - } - else if (GV.REGOPCODE == 7) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btc "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm, 11); - } - else { - FailDecode(pMyDisasm); - } -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp9.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp9.c deleted file mode 100644 index 2519c86c..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_Grp9.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - - -/* ==================================================================== - * 0fc7h - * ==================================================================== */ -void __bea_callspec__ G9_(PDISASM pMyDisasm) -{ - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - GV.MemDecoration = Arg2qword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - if (GV.REGOPCODE == 1) { - if (GV.REX.W_ == 1) { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg16b "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - (*pMyDisasm).Argument1.ArgSize = 128; - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm, 23); - GV.EIP_ += GV.DECALAGE_EIP+2; - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg8b "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument1.AccessMode = READ; - FillFlags(pMyDisasm, 23); - GV.EIP_ += GV.DECALAGE_EIP+2; - } - } - else if (GV.REGOPCODE == 6) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - if (GV.OperandSize == 16) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmclear "); - #endif - } - else if (GV.PrefRepe == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmxon "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmptrld "); - #endif - } - GV.EIP_ += GV.DECALAGE_EIP+2; - - } - else if (GV.REGOPCODE == 7) { - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmptrst "); - #endif - GV.EIP_ += GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } - -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_MMX.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_MMX.c deleted file mode 100644 index c59217bf..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_MMX.c +++ /dev/null @@ -1,1722 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -void __bea_callspec__ emms_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+STATE_MANAGEMENT; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "emms "); - #endif - GV.EIP_++; -} - -/* ==================================================================== - * 0x 0f 7e - * ==================================================================== */ -void __bea_callspec__ movd_EP(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+DATA_TRANSFER; - /* ========= 0xf3 */ - if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); - #endif - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - if (GV.REX.W_ == 1) { - GV.MemDecoration = Arg1qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); - #endif - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - GV.MemDecoration = Arg1dword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movd "); - #endif - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } - else { - if (GV.REX.W_ == 1) { - GV.MemDecoration = Arg1qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); - #endif - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.MMX_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - GV.MemDecoration = Arg1dword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movd "); - #endif - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.MMX_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } -} - - -/* ==================================================================== - * 0x 0f 6e - * ==================================================================== */ -void __bea_callspec__ movd_PE(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+DATA_TRANSFER; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - if (GV.REX.W_ == 1) { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); - #endif - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - GV.MemDecoration = Arg2dword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movd "); - #endif - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } - else { - if (GV.REX.W_ == 1) { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); - #endif - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.MMX_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - GV.MemDecoration = Arg2dword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movd "); - #endif - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.MMX_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } -} - - - -/* ==================================================================== - * 0x 0f 6f - * ==================================================================== */ -void __bea_callspec__ movq_PQ(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+DATA_TRANSFER; - /* ========= 0xf3 */ - if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movdqu "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movdqa "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 7f - * ==================================================================== */ -void __bea_callspec__ movq_QP(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+DATA_TRANSFER; - /* ========= 0xf3 */ - if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg1dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movdqu "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg1dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movdqa "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg1qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); - #endif - GV.MMX_ = 1; - ExGx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f d6 - * ==================================================================== */ -void __bea_callspec__ movq_WV(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+DATA_TRANSFER; - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movdq2q "); - #endif - GV.MMX_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - - } - /* ========= 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq2dq "); - #endif - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - GV.MMX_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.MMX_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg1qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movq "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 1c - * ==================================================================== */ -void __bea_callspec__ pabsb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pabsb "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pabsb "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 38 1e - * ==================================================================== */ -void __bea_callspec__ pabsd_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pabsd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pabsd "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 38 1d - * ==================================================================== */ -void __bea_callspec__ pabsw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pabsw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pabsw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 63 - * ==================================================================== */ -void __bea_callspec__ packsswb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packsswb "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packsswb "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 6b - * ==================================================================== */ -void __bea_callspec__ packssdw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packssdw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packssdw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 67 - * ==================================================================== */ -void __bea_callspec__ packuswb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packuswb "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packuswb "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f fc - * ==================================================================== */ -void __bea_callspec__ paddb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddb "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddb "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f fd - * ==================================================================== */ -void __bea_callspec__ paddw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f fe - * ==================================================================== */ -void __bea_callspec__ paddd_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddd "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f ec - * ==================================================================== */ -void __bea_callspec__ paddsb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddsb "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddsb "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f ed - * ==================================================================== */ -void __bea_callspec__ paddsw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddsw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddsw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f dc - * ==================================================================== */ -void __bea_callspec__ paddusb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddusb "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddusb "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f dd - * ==================================================================== */ -void __bea_callspec__ paddusw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddusw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddusw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f db - * ==================================================================== */ -void __bea_callspec__ pand_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+LOGICAL_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pand "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pand "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} -/* ==================================================================== - * 0x 0f df - * ==================================================================== */ -void __bea_callspec__ pandn_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+LOGICAL_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pandn "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pandn "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 74 - * ==================================================================== */ -void __bea_callspec__ pcmpeqb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+COMPARISON_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqb "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqb "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 75 - * ==================================================================== */ -void __bea_callspec__ pcmpeqw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+COMPARISON_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 76 - * ==================================================================== */ -void __bea_callspec__ pcmpeqd_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+COMPARISON_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqd "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqd "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 64 - * ==================================================================== */ -void __bea_callspec__ pcmpgtb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+COMPARISON_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtb "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtb "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 65 - * ==================================================================== */ -void __bea_callspec__ pcmpgtw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+COMPARISON_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 66 - * ==================================================================== */ -void __bea_callspec__ pcmpgtd_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+COMPARISON_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtd "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtd "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f e5 - * ==================================================================== */ -void __bea_callspec__ pmulhw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulhw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulhw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f d5 - * ==================================================================== */ -void __bea_callspec__ pmullw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmullw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmullw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f f5 - * ==================================================================== */ -void __bea_callspec__ pmaddwd_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaddwd "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaddwd "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f eb - * ==================================================================== */ -void __bea_callspec__ por_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+LOGICAL_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "por "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "por "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f f1 - * ==================================================================== */ -void __bea_callspec__ psllw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f f2 - * ==================================================================== */ -void __bea_callspec__ pslld_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f f3 - * ==================================================================== */ -void __bea_callspec__ psllq_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f d1 - * ==================================================================== */ -void __bea_callspec__ psrlw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f d2 - * ==================================================================== */ -void __bea_callspec__ psrld_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f d3 - * ==================================================================== */ -void __bea_callspec__ psrlq_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f e1 - * ==================================================================== */ -void __bea_callspec__ psraw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f e2 - * ==================================================================== */ -void __bea_callspec__ psrad_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f f8 - * ==================================================================== */ -void __bea_callspec__ psubb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubb "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubb "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f f9 - * ==================================================================== */ -void __bea_callspec__ psubw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f fa - * ==================================================================== */ -void __bea_callspec__ psubd_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubd "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubd "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f e8 - * ==================================================================== */ -void __bea_callspec__ psubsb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubsb "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubsb "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f e9 - * ==================================================================== */ -void __bea_callspec__ psubsw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubsw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubsw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f d8 - * ==================================================================== */ -void __bea_callspec__ psubusb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubusb "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubusb "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f d9 - * ==================================================================== */ -void __bea_callspec__ psubusw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubusw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubusw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 68 - * ==================================================================== */ -void __bea_callspec__ punpckhbw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhbw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhbw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 69 - * ==================================================================== */ -void __bea_callspec__ punpckhwd_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhwd "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhwd "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 6a - * ==================================================================== */ -void __bea_callspec__ punpckhdq_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhdq "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhdq "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 60 - * ==================================================================== */ -void __bea_callspec__ punpcklbw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpcklbw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpcklbw "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 61 - * ==================================================================== */ -void __bea_callspec__ punpcklwd_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpcklwd "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpcklwd "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 62 - * ==================================================================== */ -void __bea_callspec__ punpckldq_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+CONVERSION_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckldq "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckldq "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - -/* ==================================================================== - * 0x 0f ef - * ==================================================================== */ -void __bea_callspec__ pxor_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+LOGICAL_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pxor "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pxor "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_N_Z.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_N_Z.c deleted file mode 100644 index df572ed2..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_N_Z.c +++ /dev/null @@ -1,3692 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * 90h - * ==================================================================== */ -void __bea_callspec__ nop_(PDISASM pMyDisasm) -{ - if (GV.PrefRepe == 1) { - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pause "); - #endif - GV.EIP_++; - } - else { - if (GV.REX.B_ == 1) { - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); - #endif - - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); - #endif - - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[0+8]); - #endif - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[0+8]); - #endif - - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[0+8]); - #endif - - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - - } - else { - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "nop "); - #endif - GV.EIP_++; - } - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ nop_Ev(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "nop "); - #endif - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2dword; - } - else { - GV.MemDecoration = Arg2word; - } - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Argument2.AccessMode = 0; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ hint_nop(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "hint_nop "); - #endif - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2dword; - } - else { - GV.MemDecoration = Arg2word; - } - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; -} - -/* ======================================= - * 08h - * ======================================= */ -void __bea_callspec__ or_EbGb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); - #endif - EbGb(pMyDisasm); - FillFlags(pMyDisasm,74); -} - -/* ======================================= - * 09h - * ======================================= */ -void __bea_callspec__ or_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); - #endif - EvGv(pMyDisasm); - FillFlags(pMyDisasm,74); -} - -/* ======================================= - * 0ah - * ======================================= */ -void __bea_callspec__ or_GbEb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); - #endif - GbEb(pMyDisasm); - FillFlags(pMyDisasm,74); -} - -/* ======================================= - * 0bh - * ======================================= */ -void __bea_callspec__ or_GvEv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm,74); -} - -/* ======================================= - * 0ch - * ======================================= */ -void __bea_callspec__ or_ALIb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); - #endif - ALIb(pMyDisasm); - FillFlags(pMyDisasm,74); -} - -/* ======================================= - * 0dh - * ======================================= */ -void __bea_callspec__ or_eAX_Iv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "or "); - #endif - eAX_Iv(pMyDisasm); - FillFlags(pMyDisasm,74); -} - - -/* ======================================= - * 06eh - * ======================================= */ -void __bea_callspec__ outsb_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "outsb "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.EIP_++; - FillFlags(pMyDisasm, 76); -} - -/* ======================================= - * 06fh - * ======================================= */ -void __bea_callspec__ outsw_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; - if (GV.OperandSize >= 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "outsd "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; - (*pMyDisasm).Argument2.ArgSize = 32; - GV.EIP_++; - FillFlags(pMyDisasm, 76); - } - - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "outsw "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG6; - (*pMyDisasm).Argument2.ArgSize = 16; - GV.EIP_++; - FillFlags(pMyDisasm, 76); - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ out_IbAL(PDISASM pMyDisasm) -{ - long MyNumber; - - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "out "); - #endif - if (!Security(2, pMyDisasm)) return; - GV.ImmediatSize = 8; - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.Immediat = MyNumber; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyDisasm).Argument2.ArgSize = 8; - GV.EIP_ += 2; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ out_Ib_eAX(PDISASM pMyDisasm) -{ - long MyNumber; - - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "out "); - #endif - if (!Security(2, pMyDisasm)) return; - GV.ImmediatSize = 8; - MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic,"%.2X",(Int64) MyNumber); - #endif - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.Immediat = MyNumber; - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[0]); - #endif - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[0]); - #endif - (*pMyDisasm).Argument2.ArgSize = 16; - } - GV.EIP_ += 2; -} - - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ out_DXAL(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "out "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2]); - #endif - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.AccessMode = READ; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers8Bits[0]); - #endif - (*pMyDisasm).Argument2.ArgSize = 8; - GV.EIP_ ++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ out_DXeAX(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+InOutINSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "out "); - #endif - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2]); - #endif - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.AccessMode = READ; - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[0]); - #endif - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[0]); - #endif - (*pMyDisasm).Argument2.ArgSize = 16; - } - GV.EIP_ ++; -} - -/* ======================================= - * 8fh - * ======================================= */ -void __bea_callspec__ pop_Ev(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; - if (GV.REGOPCODE == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - GV.OperandSize = 64; - GV.MemDecoration = Arg1qword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg1dword; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - } - else { - GV.MemDecoration = Arg1word; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - } - } - else { - FailDecode(pMyDisasm); - } -} - -/* ======================================= - * 58h - * ======================================= */ -void __bea_callspec__ pop_eax(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0+8]; - } - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 59h - * ======================================= */ -void __bea_callspec__ pop_ecx(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[1+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[1+0+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; - } - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[1+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[1+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 5ah - * ======================================= */ -void __bea_callspec__ pop_edx(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[2+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[2+0+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; - } - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[2+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[2+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 5bh - * ======================================= */ -void __bea_callspec__ pop_ebx(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[3+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[3+0+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; - } - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[3+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3]; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[3+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 5ch - * ======================================= */ -void __bea_callspec__ pop_esp(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[4+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[4+0+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; - } - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[4+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4]; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[4+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 5dh - * ======================================= */ -void __bea_callspec__ pop_ebp(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[5+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[5+0+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; - } - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[5+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5]; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[5+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 5eh - * ======================================= */ -void __bea_callspec__ pop_esi(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[6+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[6+0+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; - } - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[6+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6]; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[6+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 5fh - * ======================================= */ -void __bea_callspec__ pop_edi(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[7+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[7+0+8]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; - } - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[7+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7]; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[7+0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ pop_es(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[0]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[0]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - GV.EIP_++; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ pop_ss(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[2]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[2]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - GV.EIP_++; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ pop_ds(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[3]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[3]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - GV.EIP_++; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ pop_fs(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[4]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[4]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - GV.EIP_++; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ pop_gs(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pop "); - #endif - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[5]); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[5]; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - GV.EIP_++; - } -} - -/* ======================================= - * 9dh - * ======================================= */ -void __bea_callspec__ popfd_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; - - if (GV.Architecture == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "popfq "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - FillFlags(pMyDisasm, 78); - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "popfd "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - FillFlags(pMyDisasm, 78); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "popf "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - FillFlags(pMyDisasm, 78); - } -} - -/* ======================================= - * 9dh - * ======================================= */ -void __bea_callspec__ popad_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "popad "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG1+REG2+REG3+REG4+REG5+REG6+REG7; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "popa "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG1+REG2+REG3+REG4+REG5+REG6+REG7; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - } -} - - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ push_es(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[0]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - GV.EIP_++; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ push_ss(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[2]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[2]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - GV.EIP_++; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ push_ds(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[3]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[3]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - GV.EIP_++; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ push_fs(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[4]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[4]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - GV.EIP_++; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ push_gs(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[5]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[5]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - GV.EIP_++; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ push_cs(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, RegistersSEG[1]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[1]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - GV.EIP_++; - } -} - - - -/* ======================================= - * 50h - * ======================================= */ -void __bea_callspec__ push_eax(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[0+8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0+8]; - } - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Argument1.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 51h - * ======================================= */ -void __bea_callspec__ push_ecx(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[1+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[1+0+8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8]; - } - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Argument1.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[1+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[1+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 52h - * ======================================= */ -void __bea_callspec__ push_edx(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[2+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; - - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[2+0+8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8]; - } - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Argument1.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[2+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[2+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 53h - * ======================================= */ -void __bea_callspec__ push_ebx(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[3+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[3+0+8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8]; - } - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Argument1.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[3+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3]; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[3+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 54h - * ======================================= */ -void __bea_callspec__ push_esp(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[4+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[4+0+8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8]; - } - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Argument1.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[4+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4]; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[4+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 55h - * ======================================= */ -void __bea_callspec__ push_ebp(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[5+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[5+0+8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8]; - } - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Argument1.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[5+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5]; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[5+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 56h - * ======================================= */ -void __bea_callspec__ push_esi(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[6+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[6+0+8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8]; - } - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Argument1.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[6+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6]; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[6+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - -/* ======================================= - * 57h - * ======================================= */ -void __bea_callspec__ push_edi(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - if (GV.REX.B_ == 0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[7+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7]; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[7+0+8]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8]; - } - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Argument1.ArgSize = 64; - } - else { - if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[7+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7]; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument1.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy((char*) &(*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[7+0]); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7]; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgSize = 16; - } - } - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; -} - - -/* ======================================= - * 68h - * ======================================= */ -void __bea_callspec__ push_Iv(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (GV.Architecture == 64) { - if (!Security(5, pMyDisasm)) return; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64)*((UInt32*)(UIntPtr) (GV.EIP_+1))); - #endif - GV.ImmediatSize = 32; - (*pMyDisasm).Instruction.Immediat = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - GV.EIP_ += 5; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - } - else if (GV.OperandSize == 32) { - if (!Security(5, pMyDisasm)) return; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64)*((UInt32*)(UIntPtr) (GV.EIP_+1))); - #endif - GV.ImmediatSize = 32; - (*pMyDisasm).Instruction.Immediat = *((UInt32*)(UIntPtr) (GV.EIP_+1)); - GV.EIP_ += 5; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - } - else { - if (!Security(3, pMyDisasm)) return; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.4X",(Int64)*((UInt16*)(UIntPtr) (GV.EIP_+1))); - #endif - GV.ImmediatSize = 16; - (*pMyDisasm).Instruction.Immediat = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - GV.EIP_ += 3; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - } -} - -/* ======================================= - * 6ah - * ======================================= */ -void __bea_callspec__ push_Ib(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); - #endif - if (!Security(1, pMyDisasm)) return; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64)*((Int8*)(IntPtr) (GV.EIP_+1))); - #endif - GV.ImmediatSize = 8; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_+1)); - GV.EIP_ += 2; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument2.ArgSize = 8; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG4; - -} - - -/* ======================================= - * 9ch - * ======================================= */ -void __bea_callspec__ pushfd_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; - - if (GV.Architecture == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pushfq "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - FillFlags(pMyDisasm, 78); - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pushfd "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - FillFlags(pMyDisasm, 78); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pushf "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - FillFlags(pMyDisasm, 78); - } -} - - -/* ======================================= - * 60h - * ======================================= */ -void __bea_callspec__ pushad_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - - if (GV.Architecture == 64) { - FailDecode(pMyDisasm); - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pushad "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG1+REG2+REG3+REG4+REG5+REG6+REG7; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pusha "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG1+REG2+REG3+REG4+REG5+REG6+REG7; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; - } -} - -/* ======================================= - * 0c2h - * ======================================= */ -void __bea_callspec__ retn_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = RetType; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "retn "); - #endif - if (!Security(3, pMyDisasm)) return; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic,"%.4X",(Int64)*((UInt16*)(UIntPtr) (GV.EIP_+1))); - #endif - GV.ImmediatSize = 16; - (*pMyDisasm).Instruction.Immediat = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - GV.EIP_+=3; - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; -} - -/* ======================================= - * 0c3h - * ======================================= */ -void __bea_callspec__ ret_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = RetType; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ret "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ retf_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = RetType; - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lret "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "retf "); - #endif - } - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "retf "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG4; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ retf_Iw(PDISASM pMyDisasm) -{ - int i = 0; - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; - (*pMyDisasm).Instruction.BranchType = RetType; - if (GV.SYNTAX_ == ATSyntax) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lret "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "retf "); - #endif - } - if (!Security(3, pMyDisasm)) return; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument1.ArgMnemonic+i,"%.4X",(Int64)*((UInt16*)(UIntPtr) (GV.EIP_+1))); - #endif - GV.ImmediatSize = 16; - (*pMyDisasm).Instruction.Immediat = *((UInt16*)(UIntPtr) (GV.EIP_+1)); - GV.EIP_+=3; - (*pMyDisasm).Argument1.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ rdtsc_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rdtsc "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - (*pMyDisasm).Argument1.ArgSize = 32; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ rdmsr_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rdmsr "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; - (*pMyDisasm).Argument2.ArgSize = 32; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ rdpmc_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rdpmc "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; - (*pMyDisasm).Argument2.ArgSize = 32; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ rsm_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rsm "); - #endif - GV.EIP_++; - FillFlags(pMyDisasm, 89); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ sysenter_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sysenter "); - #endif - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ sysexit_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sysexit "); - #endif - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ sahf_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sahf "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 8; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ salc_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = UNDOCUMENTED_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "salc "); - #endif - GV.EIP_++; -} - - -/* ======================================= - * 0ach - * ======================================= */ -void __bea_callspec__ scasb_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "scasb "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument2.ArgSize = 8; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; - GV.EIP_++; - FillFlags(pMyDisasm, 94); -} - -/* ======================================= - * 0adh - * ======================================= */ -void __bea_callspec__ scas_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "scasq "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; - GV.EIP_++; - FillFlags(pMyDisasm, 94); - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "scasd "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; - GV.EIP_++; - FillFlags(pMyDisasm, 94); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "scasw "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument1.AccessMode = READ; - (*pMyDisasm).Argument2.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument2.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; - GV.EIP_++; - FillFlags(pMyDisasm, 94); - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ stc_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stc "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 1; - FillFlags(pMyDisasm, 98); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ sti_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sti "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 1; - FillFlags(pMyDisasm, 100); -} - - -/* ======================================= - * 0aah - * ======================================= */ -void __bea_callspec__ stos_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stosb "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 8; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; - GV.EIP_++; - FillFlags(pMyDisasm, 101); -} - -/* ======================================= - * 0abh - * ======================================= */ -void __bea_callspec__ stosw_(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.RepnePrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepnePrefix = InUsePrefix; - } - if ((*pMyDisasm).Prefix.RepPrefix == SuperfluousPrefix) { - (*pMyDisasm).Prefix.RepPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+STRING_INSTRUCTION; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stosq "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 64; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; - GV.EIP_++; - FillFlags(pMyDisasm, 101); - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stosd "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 32; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; - GV.EIP_++; - FillFlags(pMyDisasm, 101); - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stosw "); - #endif - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument2.ArgSize = 16; - (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; - (*pMyDisasm).Argument1.Memory.BaseRegister = REG7; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG7; - GV.EIP_++; - FillFlags(pMyDisasm, 101); - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ syscall_(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION+CONTROL_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "syscall "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG1+REG11; - (*pMyDisasm).Argument1.ArgSize = 64; - } - else { - FailDecode(pMyDisasm); - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ sysret_(PDISASM pMyDisasm) -{ - if (GV.Architecture == 64) { - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sysret "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1+REG11; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else { - FailDecode(pMyDisasm); - } -} - - - -/* ======================================= - * 18h - * ======================================= */ -void __bea_callspec__ sbb_EbGb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); - #endif - EbGb(pMyDisasm); - FillFlags(pMyDisasm,93); -} - -/* ======================================= - * 19h - * ======================================= */ -void __bea_callspec__ sbb_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); - #endif - EvGv(pMyDisasm); - FillFlags(pMyDisasm,93); -} - -/* ======================================= - * 1ah - * ======================================= */ -void __bea_callspec__ sbb_GbEb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); - #endif - GbEb(pMyDisasm); - FillFlags(pMyDisasm,93); -} - -/* ======================================= - * 1bh - * ======================================= */ -void __bea_callspec__ sbb_GvEv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm,93); -} - -/* ======================================= - * 1ch - * ======================================= */ -void __bea_callspec__ sbb_ALIb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); - #endif - ALIb(pMyDisasm); - FillFlags(pMyDisasm,93); -} - -/* ======================================= - * 1dh - * ======================================= */ -void __bea_callspec__ sbb_eAX_Iv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sbb "); - #endif - eAX_Iv(pMyDisasm); - FillFlags(pMyDisasm,93); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ seto_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "seto "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f91h - * ======================================= */ -void __bea_callspec__ setno_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setno "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ setb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setb "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ setnb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setnb "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ sete_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sete "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ setne_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setne "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ setbe_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setbe "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ setnbe_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setnbe "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ sets_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sets "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ setns_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setns "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ setp_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setp "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ setnp_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setnp "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ setge_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setnl "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ setnge_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setl "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ setle_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setle "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - -/* ======================================= - * 0f90h - * ======================================= */ -void __bea_callspec__ setnle_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "setnle "); - #endif - GV.MemDecoration = Arg1byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 32; - GV.EIP_+= GV.DECALAGE_EIP+2; - FillFlags(pMyDisasm,95); -} - - -/* ======================================= - * 0fa4h - * ======================================= */ -void __bea_callspec__ shld_EvGvIb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shld "); - #endif - GV.ImmediatSize = 8; - EvGv(pMyDisasm); - GV.EIP_+= 1; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.8X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - FillFlags(pMyDisasm, 97); -} - - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ shld_EvGvCL(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shld "); - #endif - EvGv(pMyDisasm); - GV.third_arg = 2; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument3.ArgMnemonic, Registers8Bits[1]); - #endif - (*pMyDisasm).Argument3.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; - (*pMyDisasm).Argument3.ArgSize = 8; - FillFlags(pMyDisasm, 97); -} - -/* ======================================= - * 0fach - * ======================================= */ -void __bea_callspec__ shrd_EvGvIb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shrd "); - #endif - GV.ImmediatSize = 8; - EvGv(pMyDisasm); - GV.EIP_+= 1; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.8X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - FillFlags(pMyDisasm, 97); -} - - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ shrd_EvGvCL(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+SHIFT_ROTATE; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shrd "); - #endif - EvGv(pMyDisasm); - GV.third_arg = 2; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument3.ArgMnemonic, Registers8Bits[1]); - #endif - (*pMyDisasm).Argument3.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; - (*pMyDisasm).Argument3.ArgSize = 8; - FillFlags(pMyDisasm, 97); -} - - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ std_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+FLAG_CONTROL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "std "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 1; - FillFlags(pMyDisasm, 99); -} - - -/* ======================================= - * 28h - * ======================================= */ -void __bea_callspec__ sub_EbGb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); - #endif - EbGb(pMyDisasm); - FillFlags(pMyDisasm,103); -} - -/* ======================================= - * 29h - * ======================================= */ -void __bea_callspec__ sub_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); - #endif - EvGv(pMyDisasm); - FillFlags(pMyDisasm,103); -} - -/* ======================================= - * 2ah - * ======================================= */ -void __bea_callspec__ sub_GbEb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); - #endif - GbEb(pMyDisasm); - FillFlags(pMyDisasm,103); -} - -/* ======================================= - * 2bh - * ======================================= */ -void __bea_callspec__ sub_GvEv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm,103); -} - -/* ======================================= - * 2ch - * ======================================= */ -void __bea_callspec__ sub_ALIb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); - #endif - ALIb(pMyDisasm); - FillFlags(pMyDisasm,103); -} - -/* ======================================= - * 2dh - * ======================================= */ -void __bea_callspec__ sub_eAX_Iv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sub "); - #endif - eAX_Iv(pMyDisasm); - FillFlags(pMyDisasm,103); -} - -/* ======================================= - * 84h - * ======================================= */ -void __bea_callspec__ test_EbGb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - EbGb(pMyDisasm); - FillFlags(pMyDisasm,104); -} - -/* ======================================= - * 85h - * ======================================= */ -void __bea_callspec__ test_EvGv(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - EvGv(pMyDisasm); - FillFlags(pMyDisasm,104); -} - -/* ======================================= - * 86h - * ======================================= */ -void __bea_callspec__ test_GbEb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GbEb(pMyDisasm); - FillFlags(pMyDisasm,104); -} - -/* ======================================= - * 87h - * ======================================= */ -void __bea_callspec__ test_GvEv(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - GvEv(pMyDisasm); - FillFlags(pMyDisasm,104); -} - -/* ======================================= - * 88h - * ======================================= */ -void __bea_callspec__ test_ALIb(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - ALIb(pMyDisasm); - FillFlags(pMyDisasm,104); -} - -/* ======================================= - * 89h - * ======================================= */ -void __bea_callspec__ test_eAX_Iv(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test "); - #endif - (*pMyDisasm).Argument1.AccessMode = READ; - eAX_Iv(pMyDisasm); - FillFlags(pMyDisasm,104); -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ ud2_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ud2 "); - #endif - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ vmread_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmread "); - #endif - if (GV.Architecture == 64) { - GV.OperandSize = 64; - } - EvGv(pMyDisasm); - if (GV.Architecture == 64) { - GV.OperandSize = 32; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ vmwrite_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmwrite "); - #endif - if (GV.Architecture == 64) { - GV.OperandSize = 64; - } - GvEv(pMyDisasm); - if (GV.Architecture == 64) { - GV.OperandSize = 32; - } -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ wbinvd_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "wbinvd "); - #endif - GV.EIP_++; -} - -/* ======================================= - * 9Bh - * ======================================= */ -void __bea_callspec__ wait_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+FPUCONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "wait "); - #endif - GV.EIP_++; -} - -/* ======================================= - * - * ======================================= */ -void __bea_callspec__ wrmsr_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "wrmsr "); - #endif - GV.EIP_++; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG1+REG2; - (*pMyDisasm).Argument2.ArgSize = 32; -} - - -/* ======================================= - * 0fc0h - * ======================================= */ -void __bea_callspec__ xadd_EbGb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xadd "); - #endif - EbGb(pMyDisasm); - FillFlags(pMyDisasm,110); -} - -/* ======================================= - * 0fc1h - * ======================================= */ -void __bea_callspec__ xadd_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xadd "); - #endif - EvGv(pMyDisasm); - FillFlags(pMyDisasm,110); -} - -/* ======================================= - * 91h - * ======================================= */ -void __bea_callspec__ xchg_ecx(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG1; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[1+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[1]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[1+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[1]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[1+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[1]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } -} - - -/* ======================================= - * 92h - * ======================================= */ -void __bea_callspec__ xchg_edx(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG2; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[2+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[2]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[2+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[2]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[2+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[2]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } -} - - -/* ======================================= - * 93h - * ======================================= */ -void __bea_callspec__ xchg_ebx(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[3+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[3]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[3+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[3]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[3+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[3]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } -} - - -/* ======================================= - * 94h - * ======================================= */ -void __bea_callspec__ xchg_esp(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG4; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[4+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[4]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[4+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[4]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[4+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[4]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } -} - - -/* ======================================= - * 95h - * ======================================= */ -void __bea_callspec__ xchg_ebp(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG5; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[5+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[5]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[5+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[5]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[5+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[5]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } -} - - -/* ======================================= - * 96h - * ======================================= */ -void __bea_callspec__ xchg_esi(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG6; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[6+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[6]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[6+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[6]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[6+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[6]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } -} - - -/* ======================================= - * 97h - * ======================================= */ -void __bea_callspec__ xchg_edi(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG7; - if (GV.OperandSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[7+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers64Bits[7]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 64; - (*pMyDisasm).Argument2.ArgSize = 64; - } - else if (GV.OperandSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[7+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers32Bits[7]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 32; - (*pMyDisasm).Argument2.ArgSize = 32; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]); - #endif - if (GV.REX.B_ == 1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[7+8]); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Argument2.ArgMnemonic, Registers16Bits[7]); - #endif - } - GV.EIP_++; - (*pMyDisasm).Argument2.AccessMode = WRITE; - (*pMyDisasm).Argument1.ArgSize = 16; - (*pMyDisasm).Argument2.ArgSize = 16; - } -} - -/* ======================================= - * 0d7h - * ======================================= */ -void __bea_callspec__ xlat_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+MISCELLANEOUS_INSTRUCTION; - if (GV.AddressSize == 64) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xlatb "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; - (*pMyDisasm).Argument2.ArgSize = 64; - GV.EIP_++; - } - else if (GV.AddressSize == 32) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xlatb "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; - (*pMyDisasm).Argument2.ArgSize = 32; - GV.EIP_++; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xlatb "); - #endif - (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0; - (*pMyDisasm).Argument1.ArgSize = 8; - (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+GENERAL_REG+REG3; - (*pMyDisasm).Argument2.ArgSize = 16; - GV.EIP_++; - } -} - - -/* ======================================= - * 30h - * ======================================= */ -void __bea_callspec__ xor_EbGb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); - #endif - EbGb(pMyDisasm); - FillFlags(pMyDisasm,113); -} - -/* ======================================= - * 31h - * ======================================= */ -void __bea_callspec__ xor_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); - #endif - EvGv(pMyDisasm); - FillFlags(pMyDisasm,113); -} - -/* ======================================= - * 32h - * ======================================= */ -void __bea_callspec__ xor_GbEb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); - #endif - GbEb(pMyDisasm); - FillFlags(pMyDisasm,113); -} - -/* ======================================= - * 33h - * ======================================= */ -void __bea_callspec__ xor_GvEv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm,113); -} - -/* ======================================= - * 34h - * ======================================= */ -void __bea_callspec__ xor_ALIb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); - #endif - ALIb(pMyDisasm); - FillFlags(pMyDisasm,113); -} - -/* ======================================= - * 35h - * ======================================= */ -void __bea_callspec__ xor_eAX_Iv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xor "); - #endif - eAX_Iv(pMyDisasm); - FillFlags(pMyDisasm,113); -} - - -/* ======================================= - * 86h - * ======================================= */ -void __bea_callspec__ xchg_EbGb(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); - #endif - EbGb(pMyDisasm); - FillFlags(pMyDisasm,113); - (*pMyDisasm).Argument2.AccessMode = WRITE; -} - -/* ======================================= - * 87h - * ======================================= */ -void __bea_callspec__ xchg_EvGv(PDISASM pMyDisasm) -{ - if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { - (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; - } - (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xchg "); - #endif - EvGv(pMyDisasm); - FillFlags(pMyDisasm,113); - (*pMyDisasm).Argument2.AccessMode = WRITE; -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_SSE.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_SSE.c deleted file mode 100644 index 9cb0f557..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_SSE.c +++ /dev/null @@ -1,5565 +0,0 @@ -/* - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . - * - * @author : beaengine@gmail.com - -/* ==================================================================== - * 0x 0f 58 - * ==================================================================== */ -void __bea_callspec__ addps_VW(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaddsd "); - #endif - - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - } - } - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3qword; - GV.SSE_ = 0; - - /* FillFlags(pMyDisasm,125); */ - - } - else { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "addsd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - } - /* ========= 0xf3 */ - else if (GV.PrefRepe == 1) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaddss "); - #endif - - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - } - } - - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3dword; - GV.SSE_ = 0; - - - /* FillFlags(pMyDisasm,125); */ - - } - else { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "addss "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaddpd "); - #endif - - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - } - } - if (GV.VEX.L == 0) { - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128d_xmm; - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m256d_ymm; - GV.AVX_ = 0; - - } - - /* FillFlags(pMyDisasm,125); */ - - } - else { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128d_xmm; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "addpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - } - else { - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaddps "); - #endif - - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - } - } - if (GV.VEX.L == 0) { - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128_xmm; - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m256_ymm; - GV.AVX_ = 0; - - } - - /* FillFlags(pMyDisasm,125); */ - - } - else { - - GV.MemDecoration = Arg2_m128_xmm; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "addps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - } -} - -/* ==================================================================== - * 0x 0f d0 - * ==================================================================== */ -void __bea_callspec__ addsubpd_(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION+SIMD_FP_PACKED; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaddsubps "); - #endif - - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - } - } - if (GV.VEX.L == 0) { - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128_xmm; - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m256_ymm; - GV.AVX_ = 0; - - } - /* FillFlags(pMyDisasm,125); */ - - } - else { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2_m128_xmm; - (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SIMD_FP_PACKED; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "addsubps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - (*pMyDisasm).Argument2.ArgSize = 128; - } - } - - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION+SIMD_FP_PACKED; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vaddsubpd "); - #endif - - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - } - } - if (GV.VEX.L == 0) { - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128d_xmm; - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m256d_ymm; - GV.AVX_ = 0; - - } - - /* FillFlags(pMyDisasm,125); */ - - } - else { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128d_xmm; - (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SIMD_FP_PACKED; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "addsubpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - (*pMyDisasm).Argument2.ArgSize = 128; - } - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 55 - * ==================================================================== */ -void __bea_callspec__ andnps_VW(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vandnpd "); - #endif - - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - } - } - if (GV.VEX.L == 0) { - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128d_xmm; - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m256d_ymm; - GV.AVX_ = 0; - - } - - } - else { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128d_xmm; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "andnpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - } - else { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vandnps "); - #endif - - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - } - } - if (GV.VEX.L == 0) { - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128_xmm; - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m256_ymm; - GV.AVX_ = 0; - - } - - } - else { - GV.MemDecoration = Arg2_m128_xmm; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "andnps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - } -} - - -/* ==================================================================== - * 0x 0f 54 - * ==================================================================== */ -void __bea_callspec__ andps_VW(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vandpd "); - #endif - - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - } - } - if (GV.VEX.L == 0) { - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128d_xmm; - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m256d_ymm; - GV.AVX_ = 0; - - } - - /* FillFlags(pMyDisasm,125); */ - - } - else { - - - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128d_xmm; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "andpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - } - else { - - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vandps "); - #endif - - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.OperandSize = 64; - } - } - if (GV.VEX.L == 0) { - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128_xmm; - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m256_ymm; - GV.AVX_ = 0; - - } - - } - else { - - GV.MemDecoration = Arg2_m128_xmm; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "andps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - } -} - - -/* ==================================================================== - * 0x 0f 3a 0d - * ==================================================================== */ -void __bea_callspec__ blendpd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + PACKED_BLENDING_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vblendpd "); - #endif - - if (GV.VEX.L == 0) { - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.MemDecoration = Arg2_m128_xmm; - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GxEx(pMyDisasm); - GV.MemDecoration = Arg2_m256_ymm; - GV.AVX_ = 0; - - } - - GV.ImmediatSize = 8; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } - else { - - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128_xmm; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_BLENDING_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blendpd "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - } - - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 3a 0c - * ==================================================================== */ -void __bea_callspec__ blendps_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + PACKED_BLENDING_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vblendps "); - #endif - - if (GV.VEX.L == 0) { - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.MemDecoration = Arg2_m128_xmm; - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GxEx(pMyDisasm); - GV.MemDecoration = Arg2_m256_ymm; - GV.AVX_ = 0; - - } - - GV.ImmediatSize = 8; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } - else { - - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128_xmm; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_BLENDING_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blendps "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - } - - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 15 - * ==================================================================== */ -void __bea_callspec__ blendvpd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vblendvpd "); - #endif - - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.ERROR_OPCODE = UD_; - } - } - UInt8 Imm8; - if (GV.VEX.L == 0) { - - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128_xmm; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - Imm8 = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - fillRegister((Imm8 >> 4) & 0xF, &(*pMyDisasm).Argument4, pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m256_ymm; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - Imm8 = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - fillRegister((Imm8 >> 4) & 0xF, &(*pMyDisasm).Argument4, pMyDisasm); - GV.AVX_ = 0; - - } - - } - else { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128d_xmm; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_BLENDING_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blendvpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - (*pMyDisasm).Argument3.ArgType = REGISTER_TYPE + SSE_REG + REG0; - (*pMyDisasm).Argument3.ArgSize = 128; - } - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 38 14 - * ==================================================================== */ -void __bea_callspec__ blendvps_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vblendvps "); - #endif - - if (GV.VEX.opcode == 0xc4) { - /* using VEX3Bytes */ - if (GV.REX.W_ == 0x1) { - GV.ERROR_OPCODE = UD_; - } - } - UInt8 Imm8; - if (GV.VEX.L == 0) { - - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128_xmm; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - Imm8 = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - fillRegister((Imm8 >> 4) & 0xF, &(*pMyDisasm).Argument4, pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m256_ymm; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - Imm8 = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - fillRegister((Imm8 >> 4) & 0xF, &(*pMyDisasm).Argument4, pMyDisasm); - GV.AVX_ = 0; - - } - - } - else { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128_xmm; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_BLENDING_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "blendvps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - (*pMyDisasm).Argument3.ArgType = REGISTER_TYPE + SSE_REG + REG0; - (*pMyDisasm).Argument3.ArgSize = 128; - } - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f c2 - * ==================================================================== */ -void __bea_callspec__ cmpps_VW(PDISASM pMyDisasm) -{ - - /* ========= 0xf2 */ - GV.ImmediatSize = 8; - if (GV.PrefRepne == 1) { - - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + COMPARISON_INSTRUCTION; - /* use pseudo-opcode instead */ - /*#ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vcmpsd "); - #endif*/ - - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3qword; - GV.SSE_ = 0; - - (*pMyDisasm).Argument1.AccessMode = READ; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - (*pMyDisasm).Argument4.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument4.ArgSize = 8; - UInt8 Imm8; - Imm8 = (*pMyDisasm).Instruction.Immediat & 0x1F; - - char pseudoOpcodes[0x20][16] = { - "vcmpeqsd ", - "vcmpltsd ", - "vcmplesd ", - "vcmpunordsd ", - "vcmpneqsd ", - "vcmpnltsd ", - "vcmpnlesd ", - "vcmpordsd ", - "vcmpeq_uqsd ", - "vcmpngesd ", - "vcmpngtsd ", - "vcmpfalsesd ", - "vcmpneq_oqsd ", - "vcmpgesd ", - "vcmpgtsd ", - "vcmptruesd ", - "vcmpeq_ossd ", - "vcmplt_oqsd ", - "vcmple_oqsd ", - "vcmpunord_ssd ", - "vcmpneq_ussd ", - "vcmpnlt_uqsd ", - "vcmpnle_uqsd ", - "vcmpord_ssd ", - "vcmpeq_ussd ", - "vcmpnge_uqsd ", - "vcmpngt_uqsd ", - "vcmpfalse_ossd ", - "vcmpneq_ossd ", - "vcmpge_oqsd ", - "vcmpgt_oqsd ", - "vcmptrue_ussd " - }; - - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, pseudoOpcodes[Imm8]); - #endif - - /* FillFlags(pMyDisasm,125); */ - - } - else { - - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+COMPARISON_INSTRUCTION; - - /* use pseudo-opcode instead */ - /*#ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpsd "); - #endif*/ - - - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - - (*pMyDisasm).Argument1.AccessMode = READ; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - UInt8 Imm8; - Imm8 = (*pMyDisasm).Instruction.Immediat & 0x7; - - if (Imm8 == 0x0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpeqsd "); - #endif - } - else if (Imm8 == 0x1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpltsd "); - #endif - } - else if (Imm8 == 0x2) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmplesd "); - #endif - } - else if (Imm8 == 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpunordsd "); - #endif - } - else if (Imm8 == 0x4) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpneqsd "); - #endif - } - else if (Imm8 == 0x5) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpnltsd "); - #endif - } - else if (Imm8 == 0x6) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpnlesd "); - #endif - } - else if (Imm8 == 0x7) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpordsd "); - #endif - } - } - - - } - /* ========== 0xf3 */ - else if (GV.PrefRepe == 1) { - - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + COMPARISON_INSTRUCTION; - /* use pseudo-opcode instead */ - /*#ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vcmpss "); - #endif*/ - - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3dword; - GV.SSE_ = 0; - - (*pMyDisasm).Argument1.AccessMode = READ; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - (*pMyDisasm).Argument4.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument4.ArgSize = 8; - UInt8 Imm8; - Imm8 = (*pMyDisasm).Instruction.Immediat & 0x1F; - - char pseudoOpcodes[0x20][16] = { - "vcmpeqss ", - "vcmpltss ", - "vcmpless ", - "vcmpunordss ", - "vcmpneqss ", - "vcmpnltss ", - "vcmpnless ", - "vcmpordss ", - "vcmpeq_uqss ", - "vcmpngess ", - "vcmpngtss ", - "vcmpfalsess ", - "vcmpneq_oqss ", - "vcmpgess ", - "vcmpgtss ", - "vcmptruess ", - "vcmpeq_osss ", - "vcmplt_oqss ", - "vcmple_oqss ", - "vcmpunord_sss ", - "vcmpneq_usss ", - "vcmpnlt_uqss ", - "vcmpnle_uqss ", - "vcmpord_sss ", - "vcmpeq_usss ", - "vcmpnge_uqss ", - "vcmpngt_uqss ", - "vcmpfalse_osss ", - "vcmpneq_osss ", - "vcmpge_oqss", - "vcmpgt_oqss ", - "vcmptrue_usss " - }; - - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, pseudoOpcodes[Imm8]); - #endif - - /* FillFlags(pMyDisasm,125); */ - - } - else { - - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+COMPARISON_INSTRUCTION; - - /* use pseudo-opcode instead */ - /*#ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpsd "); - #endif*/ - - - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - - (*pMyDisasm).Argument1.AccessMode = READ; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - UInt8 Imm8; - Imm8 = (*pMyDisasm).Instruction.Immediat & 0x7; - - if (Imm8 == 0x0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpeqss "); - #endif - } - else if (Imm8 == 0x1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpltss "); - #endif - } - else if (Imm8 == 0x2) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpless "); - #endif - } - else if (Imm8 == 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpunordss "); - #endif - } - else if (Imm8 == 0x4) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpneqss "); - #endif - } - else if (Imm8 == 0x5) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpnltss "); - #endif - } - else if (Imm8 == 0x6) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpnless "); - #endif - } - else if (Imm8 == 0x7) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpordsd "); - #endif - } - } - - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + COMPARISON_INSTRUCTION; - /* use pseudo-opcode instead */ - /*#ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vcmppd "); - #endif*/ - - if (GV.VEX.L == 0) { - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128_xmm; - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m256_ymm; - GV.AVX_ = 0; - - } - - (*pMyDisasm).Argument1.AccessMode = READ; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - (*pMyDisasm).Argument4.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument4.ArgSize = 8; - UInt8 Imm8; - Imm8 = (*pMyDisasm).Instruction.Immediat & 0x1F; - - char pseudoOpcodes[0x20][16] = { - "vcmpeqpd ", - "vcmpltpd ", - "vcmplepd ", - "vcmpunordpd ", - "vcmpneqpd ", - "vcmpnltpd ", - "vcmpnlepd ", - "vcmpordpd ", - "vcmpeq_uqpd ", - "vcmpngepd ", - "vcmpngtpd ", - "vcmpfalsepd ", - "vcmpneq_oqpd ", - "vcmpgepd ", - "vcmpgtpd ", - "vcmptruepd ", - "vcmpeq_ospd ", - "vcmplt_oqpd ", - "vcmple_oqpd ", - "vcmpunord_spd ", - "vcmpneq_uspd ", - "vcmpnlt_uqpd ", - "vcmpnle_uqpd ", - "vcmpord_spd ", - "vcmpeq_uspd ", - "vcmpnge_uqpd ", - "vcmpngt_uqpd ", - "vcmpfalse_ospd ", - "vcmpneq_ospd ", - "vcmpge_oqpd ", - "vcmpgt_oqpd ", - "vcmptrue_uspd " - }; - - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, pseudoOpcodes[Imm8]); - #endif - - /* FillFlags(pMyDisasm,125); */ - - } - else { - - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128d_xmm; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+COMPARISON_INSTRUCTION; - - /* use pseudo-opcode instead */ - /*#ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmppd "); - #endif*/ - - - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - - (*pMyDisasm).Argument1.AccessMode = READ; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - UInt8 Imm8; - Imm8 = (*pMyDisasm).Instruction.Immediat & 0x7; - - if (Imm8 == 0x0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpeqpd "); - #endif - } - else if (Imm8 == 0x1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpltpd "); - #endif - } - else if (Imm8 == 0x2) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmplepd "); - #endif - } - else if (Imm8 == 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpunordpd "); - #endif - } - else if (Imm8 == 0x4) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpneqpd "); - #endif - } - else if (Imm8 == 0x5) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpnltpd "); - #endif - } - else if (Imm8 == 0x6) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpnlepd "); - #endif - } - else if (Imm8 == 0x7) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpordpd "); - #endif - } - } - } - else { - - - if (GV.VEX.state == InUsePrefix) { - (*pMyDisasm).Instruction.Category = AVX_INSTRUCTION + COMPARISON_INSTRUCTION; - /* use pseudo-opcode instead */ - /*#ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vcmpps "); - #endif*/ - - if (GV.VEX.L == 0) { - GV.SSE_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m128_xmm; - GV.SSE_ = 0; - } - else { - GV.AVX_ = 1; - GyEy(pMyDisasm); - fillRegister(~GV.VEX.vvvv & 0xF, &(*pMyDisasm).Argument2, pMyDisasm); - GV.MemDecoration = Arg3_m256_ymm; - GV.AVX_ = 0; - - } - - (*pMyDisasm).Argument1.AccessMode = READ; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - (*pMyDisasm).Argument4.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument4.ArgSize = 8; - UInt8 Imm8; - Imm8 = (*pMyDisasm).Instruction.Immediat & 0x1F; - - char pseudoOpcodes[0x20][16] = { - "vcmpeqps ", - "vcmpltps ", - "vcmpleps ", - "vcmpunordps ", - "vcmpneqps ", - "vcmpnltps ", - "vcmpnleps ", - "vcmpordps ", - "vcmpeq_uqps ", - "vcmpngeps ", - "vcmpngtps ", - "vcmpfalseps ", - "vcmpneq_oqps ", - "vcmpgeps ", - "vcmpgtps ", - "vcmptrueps ", - "vcmpeq_osps ", - "vcmplt_oqps ", - "vcmple_oqps ", - "vcmpunord_sps ", - "vcmpneq_usps ", - "vcmpnlt_uqps ", - "vcmpnle_uqps ", - "vcmpord_sps ", - "vcmpeq_usps ", - "vcmpnge_uqps ", - "vcmpngt_uqps ", - "vcmpfalse_osps ", - "vcmpneq_osps ", - "vcmpge_oqps ", - "vcmpgt_oqps ", - "vcmptrue_usps " - }; - - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, pseudoOpcodes[Imm8]); - #endif - - /* FillFlags(pMyDisasm,125); */ - - } - else { - - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2_m128_xmm; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+COMPARISON_INSTRUCTION; - - /* use pseudo-opcode instead */ - /*#ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmppd "); - #endif*/ - - - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - - (*pMyDisasm).Argument1.AccessMode = READ; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - UInt8 Imm8; - Imm8 = (*pMyDisasm).Instruction.Immediat & 0x7; - - if (Imm8 == 0x0) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpeqps "); - #endif - } - else if (Imm8 == 0x1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpltps "); - #endif - } - else if (Imm8 == 0x2) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpleps "); - #endif - } - else if (Imm8 == 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpunordps "); - #endif - } - else if (Imm8 == 0x4) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpneqps "); - #endif - } - else if (Imm8 == 0x5) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpnltps "); - #endif - } - else if (Imm8 == 0x6) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpnleps "); - #endif - } - else if (Imm8 == 0x7) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpordps "); - #endif - } - } - } - - -} - - -/* ==================================================================== - * 0x 0f 38 f0 - * ==================================================================== */ -void __bea_callspec__ crc32_GvEb(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+ACCELERATOR_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "crc32 "); - #endif - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.OperandSize = 64; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2byte; - GV.OperandSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.OperandSize = 32; - } - else { - GV.MemDecoration = Arg2byte; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - } - - if (GV.OperandSize == 16) { - GV.OperandSize = 32; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 16; - } - else { - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } -} - -/* ==================================================================== - * 0x 0f 38 f1 - * ==================================================================== */ -void __bea_callspec__ crc32_GvEv(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+ACCELERATOR_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "crc32 "); - #endif - - if (GV.OperandSize == 64) { - GV.MemDecoration = Arg2qword; - } - else if (GV.OperandSize == 32) { - GV.MemDecoration = Arg2dword; - } - else { - GV.MemDecoration = Arg2word; - } - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - - if (GV.OperandSize == 16) { - GV.OperandSize = 32; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.OperandSize = 16; - } - else { - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - } - GV.EIP_ += GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 2f - * ==================================================================== */ -void __bea_callspec__ comiss_VW(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "comisd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "comiss "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 5a - * ==================================================================== */ -void __bea_callspec__ cvtps2pd_(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtsd2ss "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtss2sd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtpd2ps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtps2pd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 5b - * ==================================================================== */ -void __bea_callspec__ cvtdq2ps_(PDISASM pMyDisasm) -{ - /* ========== 0xf3 */ - if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvttps2dq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtps2dq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtdq2ps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 2a - * ==================================================================== */ -void __bea_callspec__ cvtpi2ps_(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtsi2sd "); - #endif - if (GV.REX.W_ == 1) { - GV.MemDecoration = Arg2qword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } - /* ========== 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtsi2ss "); - #endif - if (GV.REX.W_ == 1) { - GV.MemDecoration = Arg2qword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - GV.MemDecoration = Arg2dword; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtpi2pd "); - #endif - GV.MemDecoration = Arg2qword; - GV.MMX_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.MMX_ = 0; - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtpi2ps "); - #endif - GV.MemDecoration = Arg2qword; - GV.MMX_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.MMX_ = 0; - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } -} - - -/* ==================================================================== - * 0x 0f 2d - * ==================================================================== */ -void __bea_callspec__ cvtps2pi_(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtsd2si "); - #endif - if (GV.REX.W_ == 1) { - GV.MemDecoration = Arg2qword; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - GV.MemDecoration = Arg2qword; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } - /* ========== 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtss2si "); - #endif - if (GV.REX.W_ == 1) { - GV.MemDecoration = Arg2dword; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - GV.MemDecoration = Arg2dword; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtpd2pi "); - #endif - GV.MemDecoration = Arg2dqword; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - GV.MMX_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtps2pi "); - #endif - GV.MemDecoration = Arg2qword; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - GV.MMX_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } -} - - -/* ==================================================================== - * 0x 0f 2c - * ==================================================================== */ -void __bea_callspec__ cvttps2pi_(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvttsd2si "); - #endif - if (GV.REX.W_ == 1) { - GV.MemDecoration = Arg2qword; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - GV.MemDecoration = Arg2qword; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - } - /* ========== 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvttss2si "); - #endif - GV.MemDecoration = Arg2dword; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_+= GV.DECALAGE_EIP+2; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvttpd2pi "); - #endif - GV.MemDecoration = Arg2dqword; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - GV.MMX_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvttps2pi "); - #endif - GV.MemDecoration = Arg2qword; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - GV.MMX_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } -} - - -/* ==================================================================== - * 0x 0f e6 - * ==================================================================== */ -void __bea_callspec__ cvtpd2dq_(PDISASM pMyDisasm) -{ - /* ========== 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtpd2dq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvtdq2pd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cvttpd2dq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 3a 41 - * ==================================================================== */ -void __bea_callspec__ dppd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+DOT_PRODUCT; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dppd "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - -/* ==================================================================== - * 0x 0f 3a 40 - * ==================================================================== */ -void __bea_callspec__ dpps_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+DOT_PRODUCT; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dpps "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 5e - * ==================================================================== */ -void __bea_callspec__ divps_VW(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "divsd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========= 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "divss "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "divpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "divps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 3a 17 - * ==================================================================== */ -void __bea_callspec__ extractps_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg1dword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "extractps "); - #endif - GV.ImmediatSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 7c - * ==================================================================== */ -void __bea_callspec__ haddpd_VW(PDISASM pMyDisasm) -{ - - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SIMD_FP_HORIZONTAL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "haddpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SIMD_FP_HORIZONTAL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "haddps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 7d - * ==================================================================== */ -void __bea_callspec__ hsubpd_VW(PDISASM pMyDisasm) -{ - - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SIMD_FP_HORIZONTAL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "hsubpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SIMD_FP_HORIZONTAL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "hsubps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 3a 21 - * ==================================================================== */ -void __bea_callspec__ insertps_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "insertps "); - #endif - GV.SSE_ = 1; - GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; - if (GV.MOD_== 0x3) { - GV.MemDecoration = Arg2qword; - } - else { - GV.MemDecoration = Arg2dword; - } - - GV.ImmediatSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - - - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - - - -/* ==================================================================== - * 0x 0f f0 - * ==================================================================== */ -void __bea_callspec__ lddqu_(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+SPECIALIZED_128bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lddqu "); - #endif - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_+= GV.DECALAGE_EIP+2; - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f f7 - * ==================================================================== */ -void __bea_callspec__ maskmovq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "maskmovdqu "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "maskmovq "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 5f - * ==================================================================== */ -void __bea_callspec__ maxps_VW(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "maxsd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========= 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "maxss "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "maxpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "maxps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 5d - * ==================================================================== */ -void __bea_callspec__ minps_VW(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "minsd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========= 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "minss "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "minpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "minps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 28 - * ==================================================================== */ -void __bea_callspec__ movaps_VW(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movapd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movaps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 29 - * ==================================================================== */ -void __bea_callspec__ movaps_WV(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg1dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movapd "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movaps "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 16 - * ==================================================================== */ -void __bea_callspec__ movhps_VM(PDISASM pMyDisasm) -{ - - /* ========= 0xf3 */ - if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movshdup "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movhpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+DATA_TRANSFER; - GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movlhps "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movhps "); - #endif - } - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 17 - * ==================================================================== */ -void __bea_callspec__ movhps_MV(PDISASM pMyDisasm) -{ - - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg1qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movhpd "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg1qword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movhps "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 12 - * ==================================================================== */ -void __bea_callspec__ movlps_VM(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movddup "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========= 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE3_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsldup "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movlpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+DATA_TRANSFER; - if (GV.MOD_== 0x3) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movhlps "); - #endif - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movlps "); - #endif - } - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 13 - * ==================================================================== */ -void __bea_callspec__ movlps_MV(PDISASM pMyDisasm) -{ - - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg1qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movlpd "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg1qword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movlps "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 50 - * ==================================================================== */ -void __bea_callspec__ movmskps_(PDISASM pMyDisasm) -{ - GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; - if (GV.MOD_!= 0x3) { - FailDecode(pMyDisasm); - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movmskpd "); - #endif - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movmskps "); - #endif - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - - } -} - - -/* ==================================================================== - * 0x 0f 38 2a - * ==================================================================== */ -void __bea_callspec__ movntdqa_(PDISASM pMyDisasm) -{ - - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+STREAMING_LOAD; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movntdqa "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f c3 - * ==================================================================== */ -void __bea_callspec__ movnti_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movnti "); - #endif - EvGv(pMyDisasm); - -} - - -/* ==================================================================== - * 0x 0f 2b - * ==================================================================== */ -void __bea_callspec__ movntps_(PDISASM pMyDisasm) -{ - GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; - if (GV.MOD_== 0x3) { - FailDecode(pMyDisasm); - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg1dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movntpd "); - #endif - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - - } - else { - GV.MemDecoration = Arg1dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movntps "); - #endif - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - - } -} - - -/* ==================================================================== - * 0x 0f e7 - * ==================================================================== */ -void __bea_callspec__ movntq_(PDISASM pMyDisasm) -{ - GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; - if (GV.MOD_== 0x3) { - FailDecode(pMyDisasm); - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg1dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movntdq "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg1qword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movntq "); - #endif - GV.MMX_ = 1; - ExGx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 10 - * ==================================================================== */ -void __bea_callspec__ movups_VW(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========= 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movss "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movupd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movups "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - - -/* ==================================================================== - * 0x 0f 11 - * ==================================================================== */ -void __bea_callspec__ movups_WV(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg1qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movsd "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========= 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg1dword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movss "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg1dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movupd "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg1dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "movups "); - #endif - GV.SSE_ = 1; - ExGx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 3a 42 - * ==================================================================== */ -void __bea_callspec__ mpsadbw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+SAD_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mpsadbw "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 59 - * ==================================================================== */ -void __bea_callspec__ mulps_VW(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mulsd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mulss "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mulpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mulps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 56 - * ==================================================================== */ -void __bea_callspec__ orps_VW(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "orpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "orps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 38 2b - * ==================================================================== */ -void __bea_callspec__ packusdw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "packusdw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f d4 - * ==================================================================== */ -void __bea_callspec__ paddq_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SIMD128bits; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "paddq "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f e0 - * ==================================================================== */ -void __bea_callspec__ pavgb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pavgb "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pavgb "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f e3 - * ==================================================================== */ -void __bea_callspec__ pavgw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pavgw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pavgw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 3a 0f - * ==================================================================== */ -void __bea_callspec__ palignr_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "palignr "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "palignr "); - #endif - GV.ImmediatSize = 8; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } -} - - -/* ==================================================================== - * 0x 0f 38 10 - * ==================================================================== */ -void __bea_callspec__ pblendvb_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_BLENDING_INSTRUCTION; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pblendvb "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pblendvb "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 3a 0e - * ==================================================================== */ -void __bea_callspec__ pblendw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+SAD_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pblendw "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 38 29 - * ==================================================================== */ -void __bea_callspec__ pcmpeqq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_EQUALITY; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpeqq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 3a 61 - * ==================================================================== */ -void __bea_callspec__ pcmpestri_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpestri "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 3a 60 - * ==================================================================== */ -void __bea_callspec__ pcmpestrm_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpestrm "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 3a 63 - * ==================================================================== */ -void __bea_callspec__ pcmpistri_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpistri "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 3a 62 - * ==================================================================== */ -void __bea_callspec__ pcmpistrm_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpestrm "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 38 37 - * ==================================================================== */ -void __bea_callspec__ pcmpgtq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pcmpgtq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 3a 14 - * ==================================================================== */ -void __bea_callspec__ pextrb_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pextrb "); - #endif - GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; - if (GV.MOD_== 0x3) { - GV.MemDecoration = Arg1dword; - } - else { - GV.MemDecoration = Arg1byte; - } - GV.ImmediatSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 3a 16 - * ==================================================================== */ -void __bea_callspec__ pextrd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; - if (GV.REX.W_ == 0x1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pextrq "); - #endif - GV.MemDecoration = Arg1qword; - GV.OperandSize = 64; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pextrd "); - #endif - GV.MemDecoration = Arg1dword; - } - GV.ImmediatSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - -/* ==================================================================== - * 0x 0f c5 - * ==================================================================== */ -void __bea_callspec__ pextrw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pextrw "); - #endif - GV.MemDecoration = Arg2dqword; - GV.ImmediatSize = 8; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pextrw "); - #endif - GV.MemDecoration = Arg2dqword; - GV.ImmediatSize = 8; - GV.MMX_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.MMX_ = 0; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } - -} - -/* ==================================================================== - * 0x 0f 3a 15 - * ==================================================================== */ -void __bea_callspec__ pextrw2_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pextrw "); - #endif - GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; - if (GV.MOD_== 0x3) { - GV.MemDecoration = Arg1dword; - } - else { - GV.MemDecoration = Arg1word; - } - GV.ImmediatSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 38 02 - * ==================================================================== */ -void __bea_callspec__ phaddd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phaddd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phaddd "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 38 03 - * ==================================================================== */ -void __bea_callspec__ phaddsw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phaddsw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phaddsw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 38 01 - * ==================================================================== */ -void __bea_callspec__ phaddw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phaddw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phaddw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 38 41 - * ==================================================================== */ -void __bea_callspec__ phminposuw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+HORIZONTAL_SEARCH; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phminposuw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 05 - * ==================================================================== */ -void __bea_callspec__ phsubw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phsubw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phsubw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 38 06 - * ==================================================================== */ -void __bea_callspec__ phsubd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phsubd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phsubd "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 38 07 - * ==================================================================== */ -void __bea_callspec__ phsubsw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phsubsw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "phsubsw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 3a 20 - * ==================================================================== */ -void __bea_callspec__ pinsrb_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2byte; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pinsrb "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 3a 22 - * ==================================================================== */ -void __bea_callspec__ pinsrd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+INSERTION_EXTRACTION; - if (GV.REX.W_ == 0x1) { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pinsrq "); - #endif - GV.MemDecoration = Arg1qword; - } - else { - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pinsrd "); - #endif - GV.MemDecoration = Arg1dword; - } - GV.ImmediatSize = 8; - MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f c4 - * ==================================================================== */ -void __bea_callspec__ pinsrw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pinsrw "); - #endif - GV.MemDecoration = Arg2word; - GV.ImmediatSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.SSE_ = 0; - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - - } - else { - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pinsrw "); - #endif - GV.MemDecoration = Arg2word; - GV.ImmediatSize = 8; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.MMX_ = 1; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.MMX_ = 0; - GV.EIP_ += GV.DECALAGE_EIP+3; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } - -} - - -/* ==================================================================== - * 0x 0f 38 3c - * ==================================================================== */ -void __bea_callspec__ pmaxsb_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxsb "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - -/* ==================================================================== - * 0x 0f 38 3d - * ==================================================================== */ -void __bea_callspec__ pmaxsd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxsd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - -/* ==================================================================== - * 0x 0f 38 3e - * ==================================================================== */ -void __bea_callspec__ pmaxuw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxuw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - -/* ==================================================================== - * 0x 0f 38 3f - * ==================================================================== */ -void __bea_callspec__ pmaxud_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxud "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - -/* ==================================================================== - * 0x 0f 38 38 - * ==================================================================== */ -void __bea_callspec__ pminsb_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminsb "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - -/* ==================================================================== - * 0x 0f 38 39 - * ==================================================================== */ -void __bea_callspec__ pminsd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminsd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - -/* ==================================================================== - * 0x 0f 38 3a - * ==================================================================== */ -void __bea_callspec__ pminuw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminuw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - -/* ==================================================================== - * 0x 0f 38 3b - * ==================================================================== */ -void __bea_callspec__ pminud_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_MINMAX; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminud "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f da - * ==================================================================== */ -void __bea_callspec__ pminub_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminub "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminub "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f de - * ==================================================================== */ -void __bea_callspec__ pmaxub_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxub "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxub "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f ea - * ==================================================================== */ -void __bea_callspec__ pminsw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminsw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pminsw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f ee - * ==================================================================== */ -void __bea_callspec__ pmaxsw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxsw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaxsw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 38 04 - * ==================================================================== */ -void __bea_callspec__ pmaddubsw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaddubsw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmaddubsw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f d7 - * ==================================================================== */ -void __bea_callspec__ pmovmskb_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovmskb "); - #endif - GV.MemDecoration = Arg2dqword; - GV.SSE_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.SSE_ = 0; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - } - else { - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovmskb "); - #endif - GV.MemDecoration = Arg2qword; - GV.MMX_ = 1; - MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); - GV.MMX_ = 0; - Reg_Opcode(&(*pMyDisasm).Argument1, pMyDisasm); - GV.EIP_ += GV.DECALAGE_EIP+2; - } - -} - - -/* ==================================================================== - * 0x 0f 38 21 - * ==================================================================== */ -void __bea_callspec__ pmovsxbd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovsxbd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 22 - * ==================================================================== */ -void __bea_callspec__ pmovsxbq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovsxbq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 20 - * ==================================================================== */ -void __bea_callspec__ pmovsxbw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovsxbw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 25 - * ==================================================================== */ -void __bea_callspec__ pmovsxdq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovsxdq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 23 - * ==================================================================== */ -void __bea_callspec__ pmovsxwd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovsxwd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 24 - * ==================================================================== */ -void __bea_callspec__ pmovsxwq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovsxwq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 31 - * ==================================================================== */ -void __bea_callspec__ pmovzxbd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovzxbd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 32 - * ==================================================================== */ -void __bea_callspec__ pmovzxbq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovzxbq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 30 - * ==================================================================== */ -void __bea_callspec__ pmovzxbw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovzxbw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 35 - * ==================================================================== */ -void __bea_callspec__ pmovzxdq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovzxdq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 33 - * ==================================================================== */ -void __bea_callspec__ pmovzxwd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovzxwd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 34 - * ==================================================================== */ -void __bea_callspec__ pmovzxwq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+CONVERSION_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmovzxwq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 28 - * ==================================================================== */ -void __bea_callspec__ pmuldq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmuldq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 40 - * ==================================================================== */ -void __bea_callspec__ pmulld_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulld "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 38 0b - * ==================================================================== */ -void __bea_callspec__ pmulhrsw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulhrsw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulhrsw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f e4 - * ==================================================================== */ -void __bea_callspec__ pmulhuw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulhuw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmulhuw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f f4 - * ==================================================================== */ -void __bea_callspec__ pmuludq_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmuludq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pmuludq "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ======================================= - * 0x 0f b8 - * ======================================= */ -void __bea_callspec__ popcnt_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SSE42_INSTRUCTION+DATA_TRANSFER; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "popcnt "); - #endif - GvEv(pMyDisasm); - FillFlags(pMyDisasm,114); -} - - -/* ==================================================================== - * 0x 0f f6 - * ==================================================================== */ -void __bea_callspec__ psadbw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SIMD64bits; - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psadbw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psadbw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 38 00 - * ==================================================================== */ -void __bea_callspec__ pshufb_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+SHUFFLE_UNPACK; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pshufb "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+SHUFFLE_UNPACK; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pshufb "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 70 - * ==================================================================== */ -void __bea_callspec__ pshufw_(PDISASM pMyDisasm) -{ - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SIMD128bits; - /* ========= 0xf3 */ - if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pshufhw "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } - /* ========= 0xf2 */ - else if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pshuflw "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } - - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pshufd "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } - else { - GV.MemDecoration = Arg2qword; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pshufw "); - #endif - GV.ImmediatSize = 8; - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } -} - -/* ==================================================================== - * 0x 0f 38 08 - * ==================================================================== */ -void __bea_callspec__ psignb_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+PACKED_SIGN; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psignb "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+PACKED_SIGN; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psignb "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 38 0a - * ==================================================================== */ -void __bea_callspec__ psignd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+PACKED_SIGN; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psignd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+PACKED_SIGN; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psignd "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 38 09 - * ==================================================================== */ -void __bea_callspec__ psignw_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+PACKED_SIGN; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psignw "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSSE3_INSTRUCTION+PACKED_SIGN; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psignw "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f fb - * ==================================================================== */ -void __bea_callspec__ psubq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SIMD128bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SIMD128bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psubq "); - #endif - GV.MMX_ = 1; - GxEx(pMyDisasm); - GV.MMX_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 38 17 - * ==================================================================== */ -void __bea_callspec__ ptest_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+PACKED_TEST; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ptest "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } - -} - -/* ==================================================================== - * 0x 0f 6c - * ==================================================================== */ -void __bea_callspec__ punpcklqdq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SIMD128bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpcklqdq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } - -} - -/* ==================================================================== - * 0x 0f 6d - * ==================================================================== */ -void __bea_callspec__ punpckhqdq_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SIMD128bits; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "punpckhqdq "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - FailDecode(pMyDisasm); - } - -} - - -/* ==================================================================== - * 0x 0f 53 - * ==================================================================== */ -void __bea_callspec__ rcpps_(PDISASM pMyDisasm) -{ - /* ========== 0xf3 */ - if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcpss "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rcpps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 3a 09 - * ==================================================================== */ -void __bea_callspec__ roundpd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+ROUND_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "roundpd "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 3a 08 - * ==================================================================== */ -void __bea_callspec__ roundps_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+ROUND_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "roundps "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 3a 0b - * ==================================================================== */ -void __bea_callspec__ roundsd_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+ROUND_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "roundsd "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 3a 0a - * ==================================================================== */ -void __bea_callspec__ roundss_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE41_INSTRUCTION+ROUND_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "roundss "); - #endif - GV.ImmediatSize = 8; - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - - } - else { - FailDecode(pMyDisasm); - } -} - - -/* ==================================================================== - * 0x 0f 52 - * ==================================================================== */ -void __bea_callspec__ rsqrtps_(PDISASM pMyDisasm) -{ - /* ========== 0xf3 */ - if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rsqrtss "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "rsqrtps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f c6 - * ==================================================================== */ -void __bea_callspec__ shufps_(PDISASM pMyDisasm) -{ - - /* ========== 0x66 */ - GV.ImmediatSize = 8; - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SHUFFLE_UNPACK; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shufpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHUFFLE_UNPACK; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "shufps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - (*pMyDisasm).Argument1.AccessMode = READ; - GV.EIP_++; - if (!Security(0, pMyDisasm)) return; - GV.third_arg = 1; - (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); - #ifndef BEA_LIGHT_DISASSEMBLY - (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); - #endif - (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; - (*pMyDisasm).Argument3.ArgSize = 8; - -} - - -/* ==================================================================== - * 0x 0f 51 - * ==================================================================== */ -void __bea_callspec__ sqrtps_VW(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sqrtsd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========= 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sqrtss "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sqrtpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sqrtps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 5c - * ==================================================================== */ -void __bea_callspec__ subps_VW(PDISASM pMyDisasm) -{ - /* ========= 0xf2 */ - if (GV.PrefRepne == 1) { - (*pMyDisasm).Prefix.RepnePrefix = MandatoryPrefix; - GV.MemDecoration = Arg2qword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "subsd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========= 0xf3 */ - else if (GV.PrefRepe == 1) { - (*pMyDisasm).Prefix.RepPrefix = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "subss "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - /* ========== 0x66 */ - else if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "subpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "subps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 2e - * ==================================================================== */ -void __bea_callspec__ ucomiss_VW(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if (GV.OperandSize == 16) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ucomisd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+COMPARISON_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ucomiss "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 15 - * ==================================================================== */ -void __bea_callspec__ unpckhps_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if (GV.OperandSize == 16) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SHUFFLE_UNPACK; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "unpckhpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SHUFFLE_UNPACK; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "unpckhps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - -/* ==================================================================== - * 0x 0f 14 - * ==================================================================== */ -void __bea_callspec__ unpcklps_(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SHUFFLE_UNPACK; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "unpcklpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+SHUFFLE_UNPACK; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "unpcklps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} - - -/* ==================================================================== - * 0x 0f 57 - * ==================================================================== */ -void __bea_callspec__ xorps_VW(PDISASM pMyDisasm) -{ - /* ========== 0x66 */ - if ((*pMyDisasm).Prefix.OperandSize == InUsePrefix) { - GV.OperandSize = GV.OriginalOperandSize; - (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xorpd "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } - else { - GV.MemDecoration = Arg2dqword; - (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+LOGICAL_INSTRUCTION; - #ifndef BEA_LIGHT_DISASSEMBLY - (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xorps "); - #endif - GV.SSE_ = 1; - GxEx(pMyDisasm); - GV.SSE_ = 0; - } -} diff --git a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_prefixes.c b/NativeHelper/beaengine/src/Includes/instr_set/opcodes_prefixes.c deleted file mode 100644 index a7aaf3ff..00000000 --- a/NativeHelper/beaengine/src/Includes/instr_set/opcodes_prefixes.c +++ /dev/null @@ -1,281 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* ==================================================================== - * Legacy Prefix F0h-Group 1 - * ==================================================================== */ -void __bea_callspec__ PrefLock(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - (*pMyDisasm).Prefix.LockPrefix = InvalidPrefix; - GV.EIP_++; - (*pMyDisasm).Prefix.Number++; - GV.NB_PREFIX++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - GV.OperandSize = 32; -} - -/* ==================================================================== - * Legacy Prefix F2h-Group 1 - * ==================================================================== */ -void __bea_callspec__ PrefREPNE(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - (*pMyDisasm).Prefix.RepnePrefix = SuperfluousPrefix; - GV.EIP_++; - (*pMyDisasm).Prefix.Number++; - GV.NB_PREFIX++; - GV.PrefRepne = 1; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - if (GV.VEX.state != InUsePrefix) { - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else if (GV.VEX.mmmmm == 0x1) { - (void) opcode_map2[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else if (GV.VEX.mmmmm == 0x2) { - (void) opcode_map3[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else if (GV.VEX.mmmmm == 0x3) { - (void) opcode_map4[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else { - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - GV.PrefRepne = 0; -} - -/* ==================================================================== - * Legacy Prefix F3h-Group 1 - * ==================================================================== */ -void __bea_callspec__ PrefREPE(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - (*pMyDisasm).Prefix.RepPrefix = SuperfluousPrefix; - GV.EIP_++; - (*pMyDisasm).Prefix.Number++; - GV.NB_PREFIX++; - GV.PrefRepe = 1; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - if (GV.VEX.state != InUsePrefix) { - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else if (GV.VEX.mmmmm == 0x1) { - (void) opcode_map2[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else if (GV.VEX.mmmmm == 0x2) { - (void) opcode_map3[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else if (GV.VEX.mmmmm == 0x3) { - (void) opcode_map4[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else { - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - GV.PrefRepe = 0; -} - -/* ==================================================================== - * Legacy Prefix 2Eh-Group 2 - * ==================================================================== */ -void __bea_callspec__ PrefSEGCS(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - (*pMyDisasm).Prefix.CSPrefix = InUsePrefix; - GV.EIP_++; - (*pMyDisasm).Prefix.Number++; - GV.NB_PREFIX++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); -} - -/* ==================================================================== - * Legacy Prefix 3Eh-Group 2 - * ==================================================================== */ -void __bea_callspec__ PrefSEGDS(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - (*pMyDisasm).Prefix.DSPrefix = InUsePrefix; - GV.EIP_++; - (*pMyDisasm).Prefix.Number++; - GV.NB_PREFIX++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); -} - -/* ==================================================================== - * Legacy Prefix 26h-Group 2 - * ==================================================================== */ -void __bea_callspec__ PrefSEGES(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - (*pMyDisasm).Prefix.ESPrefix = InUsePrefix; - GV.EIP_++; - (*pMyDisasm).Prefix.Number++; - GV.NB_PREFIX++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); -} - -/* ==================================================================== - * Legacy Prefix 64h-Group 2 - * ==================================================================== */ -void __bea_callspec__ PrefSEGFS(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - (*pMyDisasm).Prefix.FSPrefix = InUsePrefix; - GV.EIP_++; - (*pMyDisasm).Prefix.Number++; - GV.NB_PREFIX++; - GV.SEGMENTFS = 1; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); -} - -/* ==================================================================== - * Legacy Prefix 65h-Group 2 - * ==================================================================== */ -void __bea_callspec__ PrefSEGGS(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - (*pMyDisasm).Prefix.GSPrefix = InUsePrefix; - GV.EIP_++; - (*pMyDisasm).Prefix.Number++; - GV.NB_PREFIX++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); -} - - -/* ==================================================================== - * Legacy Prefix 36h-Group 2 - * ==================================================================== */ -void __bea_callspec__ PrefSEGSS(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - (*pMyDisasm).Prefix.SSPrefix = InUsePrefix; - GV.EIP_++; - (*pMyDisasm).Prefix.Number++; - GV.NB_PREFIX++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); -} - -/* ==================================================================== - * Legacy Prefix 66h-Group 3 - * ==================================================================== */ -void __bea_callspec__ PrefOpSize(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - (*pMyDisasm).Prefix.OperandSize = InUsePrefix; - GV.EIP_++; - (*pMyDisasm).Prefix.Number++; - GV.NB_PREFIX++; - GV.OriginalOperandSize = GV.OperandSize; /* if GV.OperandSize is used as a mandatory prefix, keep the real operandsize value */ - if (GV.Architecture == 16) { - GV.OperandSize = 32; - } - else { - if (GV.OperandSize != 64) { - GV.OperandSize = 16; - } - } - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - if (GV.VEX.state != InUsePrefix) { - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else if (GV.VEX.mmmmm == 0x1) { - (void) opcode_map2[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else if (GV.VEX.mmmmm == 0x2) { - (void) opcode_map3[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else if (GV.VEX.mmmmm == 0x3) { - (void) opcode_map4[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - else { - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - } - if (GV.Architecture == 16) { - GV.OperandSize = 16; - } - else { - GV.OperandSize = 32; - } -} - -/* ==================================================================== - * Legacy Prefix 67h-Group 4 - * ==================================================================== */ -void __bea_callspec__ PrefAdSize(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - (*pMyDisasm).Prefix.AddressSize = InUsePrefix; - GV.EIP_++; - (*pMyDisasm).Prefix.Number++; - GV.NB_PREFIX++; - if (GV.Architecture == 16) { - GV.AddressSize = GV.AddressSize << 1; - } - else { - GV.AddressSize = GV.AddressSize >> 1; - } - - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_); - (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); - if (GV.Architecture == 16) { - GV.AddressSize = GV.AddressSize >> 1; - } - else { - GV.AddressSize = GV.AddressSize << 1; - } - -} - -/* ==================================================================== - * Escape Prefix 0Fh-two bytes opcodes - * ==================================================================== */ -void __bea_callspec__ Esc_2byte(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - GV.EIP_++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_)+0x0F00; - (void) opcode_map2[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); -} - -/* ==================================================================== - * Escape Prefix 0F38h-three bytes opcodes - * ==================================================================== */ -void __bea_callspec__ Esc_tableA4(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - GV.EIP_++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_)+0x0F3800; - (void) opcode_map3[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); -} -/* ==================================================================== - * Escape Prefix 0F3Ah-three bytes opcodes - * ==================================================================== */ -void __bea_callspec__ Esc_tableA5(PDISASM pMyDisasm) -{ - if (!Security(0, pMyDisasm)) return; - GV.EIP_++; - (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_)+0x0F3A00; - (void) opcode_map4[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm); -} diff --git a/NativeHelper/beaengine/src/Includes/internal_datas.h b/NativeHelper/beaengine/src/Includes/internal_datas.h deleted file mode 100644 index fee1c561..00000000 --- a/NativeHelper/beaengine/src/Includes/internal_datas.h +++ /dev/null @@ -1,734 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - -/* Define prefix GV aka GlobalVariable - used instead of global internal variables to make BeaEngine thread-safe */ - -#define GV (*pMyDisasm).Reserved_ - -/* Define constants to identify the position and type of decoration used in case of memory argument */ - - - -EFLStruct EFLAGS_TABLE[] = { - /*OF, SF , ZF , AF , PF , CF , TF , IF , DF , NT , RF , ? */ - {UN_, UN_, UN_, MO_, UN_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 0-AAA */ - {UN_, MO_, MO_, UN_, MO_, UN_, 0 , 0 , 0 , 0 , 0 , 0}, /* 1-AAD */ - {UN_, MO_, MO_, UN_, MO_, UN_, 0 , 0 , 0 , 0 , 0 , 0}, /* 2-AAM */ - {UN_, UN_, UN_, MO_, UN_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 3-AAS */ - {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 4-ADC */ - {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 5-ADD */ - {RE_, MO_, MO_, UN_, MO_, RE_, 0 , 0 , 0 , 0 , 0 , 0}, /* 6-AND */ - {0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 7-ARPL */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 8-BOUND */ - {UN_, UN_, MO_, UN_, UN_, UN_, 0 , 0 , 0 , 0 , 0 , 0}, /* 9-BSF/BSR */ - - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 10-BSWAP */ - {UN_, UN_, UN_, UN_, UN_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 11-BT/BTS/BTR/BTC */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 12-CALL */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 13-CBW */ - {0 , 0 , 0 , 0 , 0 , RE_, 0 , 0 , 0 , 0 , 0 , 0}, /* 14-CLC */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , RE_, 0 , 0 , 0}, /* 15-CLD */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , RE_, 0 , 0 , 0 , 0}, /* 16-CLI */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 17-CLTS */ - {0 , 0 , 0 , 0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 18-CMC */ - {TE_, TE_, TE_, 0 , TE_, TE_, 0 , 0 , 0 , 0 , 0 , 0}, /* 19-CMOVcc */ - - {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 20-CMP */ - {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 21-CMPS */ - {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 22-CMPXCHG */ - {0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 23-CMPXCHGG8B */ - {RE_, RE_, MO_, RE_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 24-COMSID */ - {RE_, RE_, MO_, RE_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 25-COMISS */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 26-CPUID */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 27-CWD */ - {UN_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 28-DAA */ - {UN_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 29-DAS */ - - {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 30-DEC */ - {UN_, UN_, UN_, UN_, UN_, UN_, 0 , 0 , 0 , 0 , 0 , 0}, /* 31-DIV */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 32-ENTER */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 33-ESC */ - {0 , 0 , TE_, 0 , TE_, TE_, 0 , 0 , 0 , 0 , 0 , 0}, /* 34-FCMOV */ - {0 , 0 , MO_, 0 , MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 35-FCOMI FCOMIP FUCMI FUCMIP */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 36-HLT */ - {UN_, UN_, UN_, UN_, UN_, UN_, 0 , 0 , 0 , 0 , 0 , 0}, /* 37-IDIV */ - {MO_, UN_, UN_, UN_, UN_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 38-IMUL */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 39-IN */ - - {MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 40-INC */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , TE_, 0 , 0 , 0}, /* 41-INS */ - {0 , 0 , 0 , 0 , 0 , 0 , RE_, 0 , 0 , RE_, 0 , 0}, /* 42-INT */ - {TE_, 0 , 0 , 0 , 0 , 0 , RE_, 0 , 0 , RE_, 0 , 0}, /* 43-INTO */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 44-INVD */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 45-INVLPG */ - {RE_, RE_, MO_, RE_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 46-UCOMSID */ - {RE_, RE_, MO_, RE_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 47-UCOMISS */ - {PR_, PR_, PR_, PR_, PR_, PR_, PR_, PR_, PR_, TE_, 0 , 0}, /* 48-IRET */ - {TE_, TE_, TE_, 0 , TE_, TE_, 0 , 0 , 0 , 0 , 0 , 0}, /* 49-Jcc */ - - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 50-JCXZ */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 51-JMP */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 52-LAHF */ - {0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 53-LAR */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 54-LDS LES LSS LFS LGS */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 55-LEA */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 56-LEAVE */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 57-LGDT LIDT LLDT LMSW */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 58-LOCK */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , TE_, 0 , 0 , 0}, /* 59-LODS */ - - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 60-LOOP */ - {0 , 0 , TE_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 61-LOOPE LOOPNE */ - {0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 62-LSL */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 63-LTR */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 64-MONITOR */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 65-MWAIT */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 66-MOV */ - {UN_, UN_, UN_, UN_, UN_, UN_, 0 , 0 , 0 , 0 , 0 , 0}, /* 67-MOV control, debug, test */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , TE_, 0 , 0 , 0}, /* 68-MOVS */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 69-MOVSX MOVZX */ - - {MO_, UN_, UN_, UN_, UN_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 70-MUL */ - {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 71-NEG */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 72-NOP */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 73-NOT */ - {RE_, MO_, MO_, UN_, MO_, RE_, 0 , 0 , 0 , 0 , 0 , 0}, /* 74-OR */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 75-OUT */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , TE_, 0 , 0 , 0}, /* 76-OUTS */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 77-POP POPA */ - {PR_, PR_, PR_, PR_, PR_, PR_, PR_, PR_, PR_, PR_, 0 , 0}, /* 78-POPF */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 79-PUSH PUSHA PUSHF */ - - {MO_, 0 , 0 , 0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 80-RCL RCR 1 */ - {UN_, 0 , 0 , 0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 81-RCL RCR */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 82-RDMSR */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 83-RDPMC */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 84-RDTSC */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 85-REP REPE REPNE */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 86-RET */ - {MO_, 0 , 0 , 0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 87-ROL ROR 1 */ - {UN_, 0 , 0 , 0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 88-ROL ROR */ - {MO_, MO_, MO_, MO_, MO_, MO_, MO_, MO_, MO_, MO_, MO_, 0}, /* 89-RSM */ - - {0 , PR_, PR_, PR_, PR_, PR_, 0 , 0 , 0 , 0 , 0 , 0}, /* 90-SAHF */ - {MO_, MO_, MO_, 0 , MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 91-SAL SAR SHL SHR 1 */ - {0 , MO_, MO_, 0 , MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 92-SAL SAR SHL SHR */ - {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 93-SBB */ - {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 94-SCAS */ - {TE_, TE_, TE_, 0 , TE_, TE_, 0 , 0 , 0 , 0 , 0 , 0}, /* 95-SETcc */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 96-SGDT SIDT SLDT SMSW */ - {UN_, MO_, MO_, UN_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 97-SHLD SHRD */ - {0 , 0 , 0 , 0 , 0 , SE_, 0 , 0 , 0 , 0 , 0 , 0}, /* 98-STC */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , SE_, 0 , 0 , 0}, /* 99-STD */ - - {0 , 0 , 0 , 0 , 0 , 0 , 0 , SE_, 0 , 0 , 0 , 0}, /* 100-STI */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 101-STOS */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 102-STR */ - {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 103-SUB */ - {RE_, MO_, MO_, UN_, MO_, RE_, 0 , 0 , 0 , 0 , 0 , 0}, /* 104-TEST */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 105-UD2 */ - {0 , 0 , MO_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 106-VERR VERRW */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 107-WAIT */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 108-WBINVD */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 109-WRMSR */ - - {MO_, MO_, MO_, MO_, MO_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 110-XADD */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 111-XCHG */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 112-XLAT */ - {RE_, MO_, MO_, UN_, MO_, RE_, 0 , 0 , 0 , 0 , 0 , 0}, /* 113-XOR */ - - {RE_, RE_, MO_, RE_, RE_, RE_, 0 , 0 , 0 , 0 , 0 , 0}, /* 114-POPCNT */ - - {TE_, TE_, TE_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /*115 -jg jnle jng jle http://ref.x86asm.net/coder.html */ - {TE_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /*116 -jo jno http://ref.x86asm.net/coder.html */ - {0 , 0 , 0 , 0 , 0 , TE_, 0 , 0 , 0 , 0 , 0 , 0}, /*117 -jc jnc jb jnb jnae jae http://ref.x86asm.net/coder.html */ - {0 , 0 , TE_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /*118 -jz jnz je jne http://ref.x86asm.net/coder.html */ - {0 , 0 , TE_, 0 , 0 , TE_, 0 , 0 , 0 , 0 , 0 , 0}, /*119 -jbe jnbe jna ja http://ref.x86asm.net/coder.html */ - - {0 , TE_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 120 - js jns http://ref.x86asm.net/coder.html */ - {0 , 0 , 0 , 0 , TE_, 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 121 - jp jpe jnp jpo http://ref.x86asm.net/coder.html */ - {TE_, TE_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 122 - jl jnge jnl jge http://ref.x86asm.net/coder.html */ - {UN_, UN_, UN_, UN_, UN_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 123 - adcx */ - {MO_, UN_, UN_, UN_, UN_, UN_, 0 , 0 , 0 , 0 , 0 , 0}, /* 124 - adox */ - {0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0}, /* 125 - mulx */ - {RE_, MO_, MO_, UN_, UN_, RE_, 0 , 0 , 0 , 0 , 0 , 0}, /* 126 - andn */ - {RE_, UN_, MO_, UN_, UN_, RE_, RE_, RE_, RE_, RE_, RE_, 0}, /* 127 - bextr */ - {RE_, MO_, MO_, UN_, UN_, MO_, 0 , 0 , 0 , 0 , 0 , 0}, /* 128 - bzhi */ - {0 , 0 , 0 , RE_, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0} /* 129 - clac */ - /*OF, SF , ZF , AF , PF , CF , TF , IF , DF , NT , RF , Align */ - }; -/* ===================================================== - * To make a tabulation between mnemonic and first argument - * ===================================================== */ -char space_tab[11][16] = { - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - -}; -/* ===================================================== - * Segment registers - * ===================================================== */ -char SegmentRegs[7][4] = { - "??:", /* +0 */ - "es:", /* +1 */ - "ds:", /* +2 */ - "fs:", /* +3 */ - "gs:", /* +4 */ - "cs:", /* +5 */ - "ss:", /* +6 */ -}; - -#define Arg1byte 1 -#define Arg1word 2 -#define Arg1dword 3 -#define Arg1qword 4 -#define Arg1multibytes 5 -#define Arg1tbyte 6 -#define Arg1fword 7 -#define Arg1dqword 8 -#define Arg1_m128_xmm 9 -#define Arg1_m256_ymm 10 -#define Arg1_m128i_xmm 11 -#define Arg1_m128d_xmm 12 -#define Arg1_m256d_ymm 13 - -#define Arg2byte 101 -#define Arg2word 102 -#define Arg2dword 103 -#define Arg2qword 104 -#define Arg2multibytes 105 -#define Arg2tbyte 106 -#define Arg2fword 107 -#define Arg2dqword 108 -#define Arg2_m128_xmm 109 -#define Arg2_m256_ymm 110 -#define Arg2_m128i_xmm 111 -#define Arg2_m128d_xmm 112 -#define Arg2_m256d_ymm 113 - -#define Arg3byte 201 -#define Arg3word 202 -#define Arg3dword 203 -#define Arg3qword 204 -#define Arg3multibytes 205 -#define Arg3tbyte 206 -#define Arg3fword 207 -#define Arg3dqword 208 -#define Arg3_m128_xmm 209 -#define Arg3_m256_ymm 210 -#define Arg3_m128i_xmm 211 -#define Arg3_m128d_xmm 212 -#define Arg3_m256d_ymm 213 - -#define Arg4byte 301 -#define Arg4word 302 -#define Arg4dword 303 -#define Arg4qword 304 -#define Arg4multibytes 305 -#define Arg4tbyte 306 -#define Arg4fword 307 -#define Arg4dqword 308 -#define Arg4_m128_xmm 309 -#define Arg4_m256_ymm 310 -#define Arg4_m128i_xmm 311 -#define Arg4_m128d_xmm 312 -#define Arg4_m256d_ymm 313 - -#define nbMemoryTypes 13 - -/* ===================================================== - * Intrinsic representation of prefixes - * ===================================================== */ -char IntrinsicPrefixes[nbMemoryTypes][16] = { - "m8 ", /* GV.MemDecoration == 1 */ - "m16 ", /* GV.MemDecoration == 2 */ - "m32 ", /* GV.MemDecoration == 3 */ - "m64 ", /* GV.MemDecoration == 4 */ - " ", /* GV.MemDecoration == 5 (multibytes) */ - "tword ", /* GV.MemDecoration == 6 */ - " ", /* GV.MemDecoration == 7 (fword) */ - "m128 ", /* GV.MemDecoration == 8 (dqword) */ - "m128 ", /* GV.MemDecoration == 9 */ - "m256 ", /* GV.MemDecoration == 10 */ - "m128i ", /* GV.MemDecoration == 11 */ - "m128d ", /* GV.MemDecoration == 12 */ - "m256d " /* GV.MemDecoration == 13 */ -}; - -/* ===================================================== - * AT&T Suffixes - * ===================================================== */ -char ATSuffixes[nbMemoryTypes][4] = { - "b ", /* GV.MemDecoration == 1 */ - "w ", /* GV.MemDecoration == 2 */ - "l ", /* GV.MemDecoration == 3 */ - "q ", /* GV.MemDecoration == 4 */ - " ", /* GV.MemDecoration == 5 (multibytes) */ - "t ", /* GV.MemDecoration == 6 */ - " ", /* GV.MemDecoration == 7 (fword) */ - " ", /* GV.MemDecoration == 8 (dqword) */ - " ", /* GV.MemDecoration == 9 */ - " ", /* GV.MemDecoration == 10 */ - " ", /* GV.MemDecoration == 11 */ - " ", /* GV.MemDecoration == 12 */ - " " /* GV.MemDecoration == 13 */ -}; - -/* ===================================================== - * MASM Prefixes for MemoryType - * ===================================================== */ - -char MasmPrefixes[nbMemoryTypes][16] = { - "byte ptr ", /* GV.MemDecoration == 1 - 8 bits long */ - "word ptr ", /* GV.MemDecoration == 2 - 16 bits long */ - "dword ptr ", /* GV.MemDecoration == 3 - 32 bits long */ - "qword ptr ", /* GV.MemDecoration == 4 - 64 bits long */ - " ", /* GV.MemDecoration == 5 - (multibytes) */ - "tbyte ptr ", /* GV.MemDecoration == 6 - 80 bits long */ - "fword ptr ", /* GV.MemDecoration == 7 - 48 bits long */ - "dqword ptr ", /* GV.MemDecoration == 8 - 128 bits long */ - "xmmword ptr ", /* GV.MemDecoration == 9 - 128 bits long XMM registers */ - "ymmword ptr ", /* GV.MemDecoration == 10 - 256 bits long YMM registers*/ - "xmmword ptr ", /* GV.MemDecoration == 11 - 128 bits long XMM registers */ - "xmmword ptr ", /* GV.MemDecoration == 12 - 128 bits long XMM registers */ - "ymmword ptr " /* GV.MemDecoration == 13 - 256 bits long YMM registers */ -}; - -/* ===================================================== - * NASM Prefixes for MemoryType - * ===================================================== */ -char NasmPrefixes[nbMemoryTypes][8] = { - "byte ", /* GV.MemDecoration == 1 */ - "word ", /* GV.MemDecoration == 2 */ - " ", /* GV.MemDecoration == 3 */ - "qword ", /* GV.MemDecoration == 4 */ - " ", /* GV.MemDecoration == 5 (multibytes) */ - "tword ", /* GV.MemDecoration == 6 */ - " ", /* GV.MemDecoration == 7 (fword) */ - " ", /* GV.MemDecoration == 8 (dqword) */ - " ", /* GV.MemDecoration == 9 */ - " ", /* GV.MemDecoration == 10 */ - " ", /* GV.MemDecoration == 11 */ - " ", /* GV.MemDecoration == 12 */ - " " /* GV.MemDecoration == 13 */ -}; - - - -/* ===================================================== - * GOASM Prefixes for MemoryType - * ===================================================== */ -char GoAsmPrefixes[nbMemoryTypes][4] = { - "b ", /* GV.MemDecoration == 1 */ - "w ", /* GV.MemDecoration == 2 */ - "d ", /* GV.MemDecoration == 3 */ - "q ", /* GV.MemDecoration == 4 */ - " ", /* GV.MemDecoration == 5 (multibytes) */ - "t ", /* GV.MemDecoration == 6 */ - " ", /* GV.MemDecoration == 7 (fword) */ - " ", /* GV.MemDecoration == 8 (dqword) */ - " ", /* GV.MemDecoration == 9 */ - " ", /* GV.MemDecoration == 10 */ - " ", /* GV.MemDecoration == 11 */ - " ", /* GV.MemDecoration == 12 */ - " " /* GV.MemDecoration == 13 */ -}; - - -/* ===================================================== - * Segment registers - * ===================================================== */ -char RegistersSEG[16][8] = { - "es", /* +0 */ - "cs", /* +1 */ - "ss", /* +2 */ - "ds", /* +3 */ - "fs", /* +4 */ - "gs", /* +5 */ - "seg?", - "seg?", - "seg?", - "seg?", - "seg?", - "seg?", - "seg?", - "seg?", - "seg?", - "seg?", -}; - - - -/* ===================================================== - * MPX Registers - * ===================================================== */ -char RegistersMPX[16][8] = { - "bnd0", /* +0 */ - "bnd1", /* +1 */ - "bnd2", /* +2 */ - "bnd3", /* +3 */ - "bnd4?", /* wrong register */ - "bnd5?", /* wrong register */ - "bnd6?", /* wrong register */ - "bnd7?", /* wrong register */ - "bnd8?", /* wrong register */ - "bnd9?", /* wrong register */ - "bnd10?", /* wrong register */ - "bnd11?", /* wrong register */ - "bnd12?", /* wrong register */ - "bnd13?", /* wrong register */ - "bnd14?", /* wrong register */ - "bnd15?" /* wrong register */ -}; - -/* ===================================================== - * FPU Registers - * ===================================================== */ -char RegistersFPU_Masm[8][8] = { - "st(0)", /* +0 */ - "st(1)", /* +1 */ - "st(2)", /* +2 */ - "st(3)", /* +3 */ - "st(4)", /* +4 */ - "st(5)", /* +5 */ - "st(6)", /* +6 */ - "st(7)", /* +7 */ -}; - -char RegistersFPU_Nasm[8][8] = { - "st0", /* +0 */ - "st1", /* +1 */ - "st2", /* +2 */ - "st3", /* +3 */ - "st4", /* +4 */ - "st5", /* +5 */ - "st6", /* +6 */ - "st7", /* +7 */ -}; - -/* ===================================================== - * debug registers - * ===================================================== */ -char RegistersDR[16][8] = { - "dr0", /* +0 */ - "dr1", /* +1 */ - "dr2", /* +2 */ - "dr3", /* +3 */ - "dr4", /* +4 */ - "dr5", /* +5 */ - "dr6", /* +6 */ - "dr7", /* +7 */ - "dr8", /* +8 */ - "dr9", /* +9 */ - "dr10", /* +10 */ - "dr11", /* +11 */ - "dr12", /* +12 */ - "dr13", /* +13 */ - "dr14", /* +14 */ - "dr15", /* +15 */ -}; - -/* ===================================================== - * debug registers-AT&T syntax - * ===================================================== */ -char RegistersDR_AT[16][8] = { - "db0", /* +0 */ - "db1", /* +1 */ - "db2", /* +2 */ - "db3", /* +3 */ - "db4", /* +4 */ - "db5", /* +5 */ - "db6", /* +6 */ - "db7", /* +7 */ - "db8", /* +8 */ - "db9", /* +9 */ - "db10", /* +10 */ - "db11", /* +11 */ - "db12", /* +12 */ - "db13", /* +13 */ - "db14", /* +14 */ - "db15", /* +15 */ -}; - - -/* ===================================================== - * control registers - * ===================================================== */ -char RegistersCR[16][8] = { - "cr0", /* +0 */ - "cr1", /* +1 */ - "cr2", /* +2 */ - "cr3", /* +3 */ - "cr4", /* +4 */ - "cr5", /* +5 */ - "cr6", /* +6 */ - "cr7", /* +7 */ - "cr8", /* +8 */ - "cr9", /* +9 */ - "cr10", /* +10 */ - "cr11", /* +11 */ - "cr12", /* +12 */ - "cr13", /* +13 */ - "cr14", /* +14 */ - "cr15", /* +15 */ -}; - - - -/* ===================================================== - * 64 bits registers - * ===================================================== */ -char Registers64Bits[16][4] = { - "rax", /* +0 */ - "rcx", /* +1 */ - "rdx", /* +2 */ - "rbx", /* +3 */ - "rsp", /* +4 */ - "rbp", /* +5 */ - "rsi", /* +6 */ - "rdi", /* +7 */ - "r8", /* +8 */ - "r9", /* +9 */ - "r10", /* +10 */ - "r11", /* +11 */ - "r12", /* +12 */ - "r13", /* +13 */ - "r14", /* +14 */ - "r15", /* +15 */ -}; - -/* ===================================================== - * 32 bits registers - * ===================================================== */ -char Registers32Bits[16][8] = { - "eax", - "ecx", - "edx", - "ebx", - "esp", - "ebp", - "esi", - "edi", - "r8d", - "r9d", - "r10d", - "r11d", - "r12d", - "r13d", - "r14d", - "r15d", -}; - -/* ===================================================== - * 16 bits registers - * ===================================================== */ -char Registers16Bits[16][8] = { - "ax", - "cx", - "dx", - "bx", - "sp", - "bp", - "si", - "di", - "r8w", - "r9w", - "r10w", - "r11w", - "r12w", - "r13w", - "r14w", - "r15w", -}; -/* ===================================================== - * 8 bits registers - * ===================================================== */ -char Registers8BitsLegacy[8][4] = { - "al", - "cl", - "dl", - "bl", - "ah", - "ch", - "dh", - "bh", -}; - -Int32 REGS8BITS[] = { - REG0, - REG1, - REG2, - REG3, - REG0, - REG1, - REG2, - REG3, -}; - -/* ===================================================== - * 8 bits registers - * ===================================================== */ -char Registers8Bits[16][8] = { - "al", - "cl", - "dl", - "bl", - "spl", - "bpl", - "sil", - "dil", - "r8L", - "r9L", - "r10L", - "r11L", - "r12L", - "r13L", - "r14L", - "r15L", -}; -/* ===================================================== - * MMX Registers - * ===================================================== */ -char RegistersMMX[8][4] = { - "mm0", - "mm1", - "mm2", - "mm3", - "mm4", - "mm5", - "mm6", - "mm7", -}; - -/* ===================================================== - * SSE Registers - * ===================================================== */ -char RegistersSSE[16][8] = { - "xmm0", - "xmm1", - "xmm2", - "xmm3", - "xmm4", - "xmm5", - "xmm6", - "xmm7", - "xmm8", /* SSE3, SSSE3, SSE4 */ - "xmm9", /* SSE3, SSSE3, SSE4 */ - "xmm10", /* SSE3, SSSE3, SSE4 */ - "xmm11", /* SSE3, SSSE3, SSE4 */ - "xmm12", /* SSE3, SSSE3, SSE4 */ - "xmm13", /* SSE3, SSSE3, SSE4 */ - "xmm14", /* SSE3, SSSE3, SSE4 */ - "xmm15", /* SSE3, SSSE3, SSE4 */ -}; - -/* ===================================================== - * AVX 256 bits Registers - * ===================================================== */ -char RegistersAVX[16][8] = { - "ymm0", - "ymm1", - "ymm2", - "ymm3", - "ymm4", - "ymm5", - "ymm6", - "ymm7", - "ymm8", - "ymm9", - "ymm10", - "ymm11", - "ymm12", - "ymm13", - "ymm14", - "ymm15", -}; - -/* ===================================================== - * AVX 256 bits Registers - * ===================================================== */ -char RegistersAVX512[32][8] = { - "zmm0", - "zmm1", - "zmm2", - "zmm3", - "zmm4", - "zmm5", - "zmm6", - "zmm7", - "zmm8", - "zmm9", - "zmm10", - "zmm11", - "zmm12", - "zmm13", - "zmm14", - "zmm15", - "zmm16", - "zmm17", - "zmm18", - "zmm19", - "zmm20", - "zmm21", - "zmm22", - "zmm23", - "zmm24", - "zmm25", - "zmm26", - "zmm27", - "zmm28", - "zmm29", - "zmm30", - "zmm31", -}; - -Int32 REGS[] = { - REG0, /* REG0 */ - REG1, /* REG1 */ - REG2, /* REG2 */ - REG3, /* REG3 */ - REG4, /* REG4 */ - REG5, /* REG5 */ - REG6, /* REG6 */ - REG7, /* REG7 */ - REG8, /* REG8 */ - REG9, /* REG9 */ - REG10, /* REG10 */ - REG11, /* REG11 */ - REG12, /* REG12 */ - REG13, /* REG13 */ - REG14, /* REG14 */ - REG15, /* REG15 */ -}; - -char BXSI_[] = "bx+si"; -char BXDI_[] = "bx+di"; -char BPSI_[] = "bp+si"; -char BPDI_[] = "bp+di"; - - - diff --git a/NativeHelper/beaengine/src/Includes/protos.h b/NativeHelper/beaengine/src/Includes/protos.h deleted file mode 100644 index 1928b71e..00000000 --- a/NativeHelper/beaengine/src/Includes/protos.h +++ /dev/null @@ -1,717 +0,0 @@ -/* Copyright 2006-2009, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see . */ - - -/* ====================================== Routines_MODRM */ -void __bea_callspec__ MOD_RM(ARGTYPE*, PDISASM); -void __bea_callspec__ fillRegister(int, ARGTYPE*, PDISASM); -void __bea_callspec__ Reg_Opcode(ARGTYPE*, PDISASM); - -void __bea_callspec__ Addr_EAX(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_ECX(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_EDX(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_EBX(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_SIB(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_disp32(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_ESI(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_EDI(ARGTYPE*, PDISASM); - -void __bea_callspec__ Addr_EAX_disp8(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_ECX_disp8(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_EDX_disp8(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_EBX_disp8(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_SIB_disp8(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_EBP_disp8(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_ESI_disp8(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_EDI_disp8(ARGTYPE*, PDISASM); - -void __bea_callspec__ Addr_EAX_disp32(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_ECX_disp32(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_EDX_disp32(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_EBX_disp32(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_SIB_disp32(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_EBP_disp32(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_ESI_disp32(ARGTYPE*, PDISASM); -void __bea_callspec__ Addr_EDI_disp32(ARGTYPE*, PDISASM); - -void __bea_callspec__ _rEAX(ARGTYPE*, PDISASM); -void __bea_callspec__ _rECX(ARGTYPE*, PDISASM); -void __bea_callspec__ _rEDX(ARGTYPE*, PDISASM); -void __bea_callspec__ _rEBX(ARGTYPE*, PDISASM); -void __bea_callspec__ _rESP(ARGTYPE*, PDISASM); -void __bea_callspec__ _rEBP(ARGTYPE*, PDISASM); -void __bea_callspec__ _rESI(ARGTYPE*, PDISASM); -void __bea_callspec__ _rEDI(ARGTYPE*, PDISASM); - -size_t __bea_callspec__ SIB_0(ARGTYPE*, size_t, PDISASM); -size_t __bea_callspec__ SIB_1(ARGTYPE*, size_t, PDISASM); -size_t __bea_callspec__ SIB_2(ARGTYPE*, size_t, PDISASM); -size_t __bea_callspec__ SIB_3(ARGTYPE*, size_t, PDISASM); - -/* ====================================== Routines_Disasm */ -void __bea_callspec__ CompleteInstructionFields (PDISASM); -void __bea_callspec__ EbGb(PDISASM); -void __bea_callspec__ EvGv(PDISASM); -void __bea_callspec__ EvIb(PDISASM); -void __bea_callspec__ ExGx(PDISASM); -void __bea_callspec__ EvIv(PDISASM); -void __bea_callspec__ EbIb(PDISASM); -void __bea_callspec__ Eb(PDISASM); -void __bea_callspec__ Ev(PDISASM); -void __bea_callspec__ GvEv(PDISASM); -void __bea_callspec__ GyEy(PDISASM); -void __bea_callspec__ GvEb(PDISASM); -void __bea_callspec__ GxEx(PDISASM); -void __bea_callspec__ GvEw(PDISASM); -void __bea_callspec__ GbEb(PDISASM); -void __bea_callspec__ ALIb(PDISASM); -void __bea_callspec__ eAX_Iv(PDISASM); -int __bea_callspec__ AnalyzeOpcode (PDISASM); -int __bea_callspec__ Security(int, PDISASM); -void __bea_callspec__ CalculateRelativeAddress(UInt64 *, Int64, PDISASM); -size_t __bea_callspec__ CopyFormattedNumber(PDISASM, char*, const char*, Int64); -void __bea_callspec__ BuildCompleteInstruction(PDISASM); -void __bea_callspec__ BuildCompleteInstructionATSyntax(PDISASM); -int __bea_callspec__ InitVariables (PDISASM); -void __bea_callspec__ FillFlags(PDISASM, int); -void __bea_callspec__ FillSegmentsRegisters (PDISASM); -void __bea_callspec__ FixArgSizeForMemoryOperand (PDISASM); -void __bea_callspec__ FixREXPrefixes (PDISASM); - -/* ====================================== opcodes_prefix */ -void __bea_callspec__ PrefLock(PDISASM); -void __bea_callspec__ PrefREPNE(PDISASM); -void __bea_callspec__ PrefREPE(PDISASM); -void __bea_callspec__ PrefSEGCS(PDISASM); -void __bea_callspec__ PrefSEGDS(PDISASM); -void __bea_callspec__ PrefSEGES(PDISASM); -void __bea_callspec__ PrefSEGFS(PDISASM); -void __bea_callspec__ PrefSEGGS(PDISASM); -void __bea_callspec__ PrefSEGSS(PDISASM); -void __bea_callspec__ PrefOpSize(PDISASM); -void __bea_callspec__ PrefAdSize(PDISASM); -void __bea_callspec__ Esc_2byte(PDISASM); -void __bea_callspec__ Esc_tableA4(PDISASM); -void __bea_callspec__ Esc_tableA5(PDISASM); - - -/* ====================================== opcodes_A_M */ -void __bea_callspec__ FailDecode(PDISASM); -void __bea_callspec__ aaa_(PDISASM); -void __bea_callspec__ aad_(PDISASM); -void __bea_callspec__ aas_(PDISASM); -void __bea_callspec__ aam_(PDISASM); -void __bea_callspec__ adcx_GyEy(PDISASM); -void __bea_callspec__ add_EbGb(PDISASM); -void __bea_callspec__ add_EvGv(PDISASM); -void __bea_callspec__ add_GbEb(PDISASM); -void __bea_callspec__ add_GvEv(PDISASM); -void __bea_callspec__ add_ALIb(PDISASM); -void __bea_callspec__ add_eAX_Iv(PDISASM); -void __bea_callspec__ adc_ALIb(PDISASM); -void __bea_callspec__ adc_eAX_Iv(PDISASM); -void __bea_callspec__ adc_EbGb(PDISASM); -void __bea_callspec__ adc_EvGv(PDISASM); -void __bea_callspec__ adc_GbEb(PDISASM); -void __bea_callspec__ adc_GvEv(PDISASM); -void __bea_callspec__ and_EbGb(PDISASM); -void __bea_callspec__ and_ALIb(PDISASM); -void __bea_callspec__ and_eAX_Iv(PDISASM); -void __bea_callspec__ and_EvGv(PDISASM); -void __bea_callspec__ and_GbEb(PDISASM); -void __bea_callspec__ and_GvEv(PDISASM); -void __bea_callspec__ andn_GyEy(PDISASM); -void __bea_callspec__ arpl_(PDISASM); -void __bea_callspec__ bextr_GyEy(PDISASM); -void __bea_callspec__ bndcl_GvEv(PDISASM); -void __bea_callspec__ bndcn_GvEv(PDISASM); -void __bea_callspec__ bound_(PDISASM); -void __bea_callspec__ bswap_eax(PDISASM); -void __bea_callspec__ bswap_ebp(PDISASM); -void __bea_callspec__ bswap_ebx(PDISASM); -void __bea_callspec__ bswap_ecx(PDISASM); -void __bea_callspec__ bswap_edi(PDISASM); -void __bea_callspec__ bswap_edx(PDISASM); -void __bea_callspec__ bswap_esi(PDISASM); -void __bea_callspec__ bswap_esp(PDISASM); -void __bea_callspec__ bsf_GvEv(PDISASM); -void __bea_callspec__ bsr_GvEv(PDISASM); -void __bea_callspec__ btc_EvGv(PDISASM); -void __bea_callspec__ btr_EvGv(PDISASM); -void __bea_callspec__ bt_EvGv(PDISASM); -void __bea_callspec__ bts_EvGv(PDISASM); -void __bea_callspec__ bzhi_GyEy(PDISASM); -void __bea_callspec__ callf_(PDISASM); -void __bea_callspec__ call_(PDISASM); -void __bea_callspec__ cdq_(PDISASM); -void __bea_callspec__ clts_(PDISASM); -void __bea_callspec__ cmc_(PDISASM); -void __bea_callspec__ cmovo_(PDISASM); -void __bea_callspec__ cmovno_(PDISASM); -void __bea_callspec__ cmovb_(PDISASM); -void __bea_callspec__ cmovnb_(PDISASM); -void __bea_callspec__ cmove_(PDISASM); -void __bea_callspec__ cmovne_(PDISASM); -void __bea_callspec__ cmovbe_(PDISASM); -void __bea_callspec__ cmovnbe_(PDISASM); -void __bea_callspec__ cmovs_(PDISASM); -void __bea_callspec__ cmovns_(PDISASM); -void __bea_callspec__ cmovp_(PDISASM); -void __bea_callspec__ cmovnp_(PDISASM); -void __bea_callspec__ cmovl_(PDISASM); -void __bea_callspec__ cmovnl_(PDISASM); -void __bea_callspec__ cmovle_(PDISASM); -void __bea_callspec__ cmovnle_(PDISASM); -void __bea_callspec__ cmpx_EbGb(PDISASM); -void __bea_callspec__ cmpx_EvGv(PDISASM); -void __bea_callspec__ cmp_EbGb(PDISASM); -void __bea_callspec__ cmp_EvGv(PDISASM); -void __bea_callspec__ cmp_GbEb(PDISASM); -void __bea_callspec__ cmp_GvEv(PDISASM); -void __bea_callspec__ cmp_ALIb(PDISASM); -void __bea_callspec__ cmp_eAX_Iv(PDISASM); -void __bea_callspec__ cmpsb_(PDISASM); -void __bea_callspec__ cmps_(PDISASM); -void __bea_callspec__ cwde_(PDISASM); -void __bea_callspec__ clc_(PDISASM); -void __bea_callspec__ cld_(PDISASM); -void __bea_callspec__ cli_(PDISASM); -void __bea_callspec__ cpuid_(PDISASM); -void __bea_callspec__ daa_(PDISASM); -void __bea_callspec__ das_(PDISASM); -void __bea_callspec__ dec_eax(PDISASM); -void __bea_callspec__ dec_ecx(PDISASM); -void __bea_callspec__ dec_edx(PDISASM); -void __bea_callspec__ dec_ebx(PDISASM); -void __bea_callspec__ dec_esp(PDISASM); -void __bea_callspec__ dec_ebp(PDISASM); -void __bea_callspec__ dec_esi(PDISASM); -void __bea_callspec__ dec_edi(PDISASM); -void __bea_callspec__ enter_(PDISASM); -void __bea_callspec__ femms_(PDISASM); -void __bea_callspec__ hlt_(PDISASM); -void __bea_callspec__ invd_(PDISASM); -void __bea_callspec__ inc_eax(PDISASM); -void __bea_callspec__ inc_ecx(PDISASM); -void __bea_callspec__ inc_edx(PDISASM); -void __bea_callspec__ inc_ebx(PDISASM); -void __bea_callspec__ inc_esp(PDISASM); -void __bea_callspec__ inc_ebp(PDISASM); -void __bea_callspec__ inc_esi(PDISASM); -void __bea_callspec__ inc_edi(PDISASM); -void __bea_callspec__ iret_(PDISASM); -void __bea_callspec__ in_ALDX(PDISASM); -void __bea_callspec__ in_ALIb(PDISASM); -void __bea_callspec__ in_eAX_Ib(PDISASM); -void __bea_callspec__ insb_(PDISASM); -void __bea_callspec__ ins_(PDISASM); -void __bea_callspec__ into_(PDISASM); -void __bea_callspec__ in_eAX(PDISASM); -void __bea_callspec__ int_(PDISASM); -void __bea_callspec__ int1_(PDISASM); -void __bea_callspec__ int3_(PDISASM); -void __bea_callspec__ imul_GvEvIv(PDISASM); -void __bea_callspec__ imul_GvEv(PDISASM); -void __bea_callspec__ imul_GvEvIb(PDISASM); -void __bea_callspec__ jo_(PDISASM); -void __bea_callspec__ jno_(PDISASM); -void __bea_callspec__ jc_(PDISASM); -void __bea_callspec__ jnc_(PDISASM); -void __bea_callspec__ je_(PDISASM); -void __bea_callspec__ jne_(PDISASM); -void __bea_callspec__ jbe_(PDISASM); -void __bea_callspec__ jnbe_(PDISASM); -void __bea_callspec__ js_(PDISASM); -void __bea_callspec__ jns_(PDISASM); -void __bea_callspec__ jp_(PDISASM); -void __bea_callspec__ jnp_(PDISASM); -void __bea_callspec__ jl_(PDISASM); -void __bea_callspec__ jnl_(PDISASM); -void __bea_callspec__ jle_(PDISASM); -void __bea_callspec__ jnle_(PDISASM); -void __bea_callspec__ jo_near(PDISASM); -void __bea_callspec__ jno_near(PDISASM); -void __bea_callspec__ jc_near(PDISASM); -void __bea_callspec__ jnc_near(PDISASM); -void __bea_callspec__ je_near(PDISASM); -void __bea_callspec__ jne_near(PDISASM); -void __bea_callspec__ jbe_near(PDISASM); -void __bea_callspec__ ja_near(PDISASM); -void __bea_callspec__ js_near(PDISASM); -void __bea_callspec__ jns_near(PDISASM); -void __bea_callspec__ jp_near(PDISASM); -void __bea_callspec__ jnp_near(PDISASM); -void __bea_callspec__ jl_near(PDISASM); -void __bea_callspec__ jnl_near(PDISASM); -void __bea_callspec__ jle_near(PDISASM); -void __bea_callspec__ jnle_near(PDISASM); -void __bea_callspec__ jecxz_(PDISASM); -void __bea_callspec__ jmp_near(PDISASM); -void __bea_callspec__ jmp_far(PDISASM); -void __bea_callspec__ jmp_short(PDISASM); -void __bea_callspec__ lahf_(PDISASM); -void __bea_callspec__ lar_GvEw(PDISASM); -void __bea_callspec__ lds_GvM(PDISASM); -void __bea_callspec__ leave_(PDISASM); -void __bea_callspec__ lea_GvM(PDISASM); -void __bea_callspec__ les_GvM(PDISASM); -void __bea_callspec__ lodsb_(PDISASM); -void __bea_callspec__ lodsw_(PDISASM); -void __bea_callspec__ loop_(PDISASM); -void __bea_callspec__ loope_(PDISASM); -void __bea_callspec__ loopne_(PDISASM); -void __bea_callspec__ lsl_GvEw(PDISASM); -void __bea_callspec__ lss_Mp(PDISASM); -void __bea_callspec__ lfs_Mp(PDISASM); -void __bea_callspec__ lgs_Mp(PDISASM); -void __bea_callspec__ mov_RdCd(PDISASM); -void __bea_callspec__ mov_RdDd(PDISASM); -void __bea_callspec__ mov_CdRd(PDISASM); -void __bea_callspec__ mov_DdRd(PDISASM); -void __bea_callspec__ mov_EbGb(PDISASM); -void __bea_callspec__ mov_EvGv(PDISASM); -void __bea_callspec__ mov_GbEb(PDISASM); -void __bea_callspec__ mov_GvEv(PDISASM); -void __bea_callspec__ mov_ALOb(PDISASM); -void __bea_callspec__ mov_eAXOv(PDISASM); -void __bea_callspec__ mov_ObAL(PDISASM); -void __bea_callspec__ mov_OveAX(PDISASM); -void __bea_callspec__ mov_ALIb(PDISASM); -void __bea_callspec__ mov_CLIb(PDISASM); -void __bea_callspec__ mov_DLIb(PDISASM); -void __bea_callspec__ mov_BLIb(PDISASM); -void __bea_callspec__ mov_AHIb(PDISASM); -void __bea_callspec__ mov_CHIb(PDISASM); -void __bea_callspec__ mov_DHIb(PDISASM); -void __bea_callspec__ mov_BHIb(PDISASM); -void __bea_callspec__ movs_(PDISASM); -void __bea_callspec__ movsw_(PDISASM); -void __bea_callspec__ movzx_GvEb(PDISASM); -void __bea_callspec__ movsx_GvEb(PDISASM); -void __bea_callspec__ movzx_GvEw(PDISASM); -void __bea_callspec__ movsx_GvEw(PDISASM); -void __bea_callspec__ mov_EAX(PDISASM); -void __bea_callspec__ mov_ECX(PDISASM); -void __bea_callspec__ mov_EDX(PDISASM); -void __bea_callspec__ mov_EBX(PDISASM); -void __bea_callspec__ mov_ESP(PDISASM); -void __bea_callspec__ mov_EBP(PDISASM); -void __bea_callspec__ mov_ESI(PDISASM); -void __bea_callspec__ mov_EDI(PDISASM); -void __bea_callspec__ mov_EbIb(PDISASM); -void __bea_callspec__ mov_EvIv(PDISASM); -void __bea_callspec__ mov_EwSreg(PDISASM); -void __bea_callspec__ mov_SregEw(PDISASM); - -/* ====================================== opcodes_N_Z */ -void __bea_callspec__ nop_(PDISASM); -void __bea_callspec__ nop_Ev(PDISASM); -void __bea_callspec__ hint_nop(PDISASM); -void __bea_callspec__ or_EbGb(PDISASM); -void __bea_callspec__ or_EvGv(PDISASM); -void __bea_callspec__ or_GbEb(PDISASM); -void __bea_callspec__ or_GvEv(PDISASM); -void __bea_callspec__ or_ALIb(PDISASM); -void __bea_callspec__ or_eAX_Iv(PDISASM); -void __bea_callspec__ outsb_(PDISASM); -void __bea_callspec__ outsw_(PDISASM); -void __bea_callspec__ out_IbAL(PDISASM); -void __bea_callspec__ out_Ib_eAX(PDISASM); -void __bea_callspec__ out_DXAL(PDISASM); -void __bea_callspec__ out_DXeAX(PDISASM); -void __bea_callspec__ pop_Ev(PDISASM); -void __bea_callspec__ pop_eax(PDISASM); -void __bea_callspec__ pop_ecx(PDISASM); -void __bea_callspec__ pop_edx(PDISASM); -void __bea_callspec__ pop_ebx(PDISASM); -void __bea_callspec__ pop_esp(PDISASM); -void __bea_callspec__ pop_ebp(PDISASM); -void __bea_callspec__ pop_esi(PDISASM); -void __bea_callspec__ pop_edi(PDISASM); -void __bea_callspec__ pop_ds(PDISASM); -void __bea_callspec__ pop_es(PDISASM); -void __bea_callspec__ pop_fs(PDISASM); -void __bea_callspec__ pop_gs(PDISASM); -void __bea_callspec__ pop_ss(PDISASM); -void __bea_callspec__ popfd_(PDISASM); -void __bea_callspec__ popad_(PDISASM); -void __bea_callspec__ push_eax(PDISASM); -void __bea_callspec__ push_ecx(PDISASM); -void __bea_callspec__ push_edx(PDISASM); -void __bea_callspec__ push_ebx(PDISASM); -void __bea_callspec__ push_esp(PDISASM); -void __bea_callspec__ push_ebp(PDISASM); -void __bea_callspec__ push_esi(PDISASM); -void __bea_callspec__ push_edi(PDISASM); -void __bea_callspec__ push_cs(PDISASM); -void __bea_callspec__ push_ds(PDISASM); -void __bea_callspec__ push_es(PDISASM); -void __bea_callspec__ push_fs(PDISASM); -void __bea_callspec__ push_gs(PDISASM); -void __bea_callspec__ push_ss(PDISASM); -void __bea_callspec__ pushfd_(PDISASM); -void __bea_callspec__ pushad_(PDISASM); -void __bea_callspec__ push_Iv(PDISASM); -void __bea_callspec__ push_Ib(PDISASM); -void __bea_callspec__ pushfd_(PDISASM); -void __bea_callspec__ pushad_(PDISASM); -void __bea_callspec__ retn_(PDISASM); -void __bea_callspec__ ret_(PDISASM); -void __bea_callspec__ retf_(PDISASM); -void __bea_callspec__ retf_Iw(PDISASM); -void __bea_callspec__ rdtsc_(PDISASM); -void __bea_callspec__ rdmsr_(PDISASM); -void __bea_callspec__ rdpmc_(PDISASM); -void __bea_callspec__ rsm_(PDISASM); -void __bea_callspec__ sysenter_(PDISASM); -void __bea_callspec__ sysexit_(PDISASM); -void __bea_callspec__ sahf_(PDISASM); -void __bea_callspec__ salc_(PDISASM); -void __bea_callspec__ scasb_(PDISASM); -void __bea_callspec__ scas_(PDISASM); -void __bea_callspec__ stc_(PDISASM); -void __bea_callspec__ sti_(PDISASM); -void __bea_callspec__ stos_(PDISASM); -void __bea_callspec__ stosw_(PDISASM); -void __bea_callspec__ syscall_(PDISASM); -void __bea_callspec__ sysret_(PDISASM); -void __bea_callspec__ sbb_EbGb(PDISASM); -void __bea_callspec__ sbb_EvGv(PDISASM); -void __bea_callspec__ sbb_GbEb(PDISASM); -void __bea_callspec__ sbb_GvEv(PDISASM); -void __bea_callspec__ sbb_ALIb(PDISASM); -void __bea_callspec__ sbb_eAX_Iv(PDISASM); -void __bea_callspec__ seto_(PDISASM); -void __bea_callspec__ setno_(PDISASM); -void __bea_callspec__ setb_(PDISASM); -void __bea_callspec__ setnb_(PDISASM); -void __bea_callspec__ sete_(PDISASM); -void __bea_callspec__ setne_(PDISASM); -void __bea_callspec__ setbe_(PDISASM); -void __bea_callspec__ setnbe_(PDISASM); -void __bea_callspec__ sets_(PDISASM); -void __bea_callspec__ setns_(PDISASM); -void __bea_callspec__ setp_(PDISASM); -void __bea_callspec__ setnp_(PDISASM); -void __bea_callspec__ setnge_(PDISASM); -void __bea_callspec__ setge_(PDISASM); -void __bea_callspec__ setle_(PDISASM); -void __bea_callspec__ setnle_(PDISASM); -void __bea_callspec__ shld_EvGvIb(PDISASM); -void __bea_callspec__ shld_EvGvCL(PDISASM); -void __bea_callspec__ shrd_EvGvIb(PDISASM); -void __bea_callspec__ shrd_EvGvCL(PDISASM); -void __bea_callspec__ std_(PDISASM); -void __bea_callspec__ sub_ALIb(PDISASM); -void __bea_callspec__ sub_eAX_Iv(PDISASM); -void __bea_callspec__ sub_EbGb(PDISASM); -void __bea_callspec__ sub_EvGv(PDISASM); -void __bea_callspec__ sub_GbEb(PDISASM); -void __bea_callspec__ sub_GvEv(PDISASM); -void __bea_callspec__ test_ALIb(PDISASM); -void __bea_callspec__ test_eAX_Iv(PDISASM); -void __bea_callspec__ test_EbGb(PDISASM); -void __bea_callspec__ test_EvGv(PDISASM); -void __bea_callspec__ test_GbEb(PDISASM); -void __bea_callspec__ test_GvEv(PDISASM); -void __bea_callspec__ ud2_(PDISASM); -void __bea_callspec__ vmread_(PDISASM); -void __bea_callspec__ vmwrite_(PDISASM); -void __bea_callspec__ wbinvd_(PDISASM); -void __bea_callspec__ wait_(PDISASM); -void __bea_callspec__ wrmsr_(PDISASM); -void __bea_callspec__ xadd_EbGb(PDISASM); -void __bea_callspec__ xadd_EvGv(PDISASM); -void __bea_callspec__ xchg_EbGb(PDISASM); -void __bea_callspec__ xchg_ebp(PDISASM); -void __bea_callspec__ xchg_ebx(PDISASM); -void __bea_callspec__ xchg_ecx(PDISASM); -void __bea_callspec__ xchg_edi(PDISASM); -void __bea_callspec__ xchg_edx(PDISASM); -void __bea_callspec__ xchg_esi(PDISASM); -void __bea_callspec__ xchg_esp(PDISASM); -void __bea_callspec__ xchg_EvGv(PDISASM); -void __bea_callspec__ xlat_(PDISASM); -void __bea_callspec__ xor_ALIb(PDISASM); -void __bea_callspec__ xor_eAX_Iv(PDISASM); -void __bea_callspec__ xor_EbGb(PDISASM); -void __bea_callspec__ xor_EvGv(PDISASM); -void __bea_callspec__ xor_GbEb(PDISASM); -void __bea_callspec__ xor_GvEv(PDISASM); - -/* ====================================== opcodes_Grp1 */ -void __bea_callspec__ G1_EbIb(PDISASM); -void __bea_callspec__ G1_EbIb2(PDISASM); -void __bea_callspec__ G1_EvIv(PDISASM); -void __bea_callspec__ G1_EvIb(PDISASM); - -/* ====================================== opcodes_Grp2 */ -void __bea_callspec__ G2_EbIb(PDISASM); -void __bea_callspec__ G2_EvIb(PDISASM); -void __bea_callspec__ G2_Ev1(PDISASM); -void __bea_callspec__ G2_Eb1(PDISASM); -void __bea_callspec__ G2_EbCL(PDISASM); -void __bea_callspec__ G2_EvCL(PDISASM); - -/* ====================================== opcodes_Grp3 */ -void __bea_callspec__ G3_Eb(PDISASM); -void __bea_callspec__ G3_Ev(PDISASM); - -/* ====================================== opcodes_Grp4 */ -void __bea_callspec__ G4_Eb(PDISASM); - -/* ====================================== opcodes_Grp5 */ -void __bea_callspec__ G5_Ev(PDISASM); - -/* ====================================== opcodes_Grp6 */ -void __bea_callspec__ G6_(PDISASM); - -/* ====================================== opcodes_Grp7 */ -void __bea_callspec__ G7_(PDISASM); - -/* ====================================== opcodes_Grp8 */ -void __bea_callspec__ G8_EvIb(PDISASM); - -/* ====================================== opcodes_Grp9 */ -void __bea_callspec__ G9_(PDISASM); - -/* ====================================== opcodes_Grp12 */ -void __bea_callspec__ G12_(PDISASM); - -/* ====================================== opcodes_Grp13 */ -void __bea_callspec__ G13_(PDISASM); - -/* ====================================== opcodes_Grp14 */ -void __bea_callspec__ G14_(PDISASM); - -/* ====================================== opcodes_Grp15 */ -void __bea_callspec__ G15_(PDISASM); - -/* ====================================== opcodes_Grp16 */ -void __bea_callspec__ G16_(PDISASM); - -/* ====================================== opcodes_Grp17 */ -void __bea_callspec__ G17_(PDISASM); - - -/* ====================================== opcodes_FPU */ -void __bea_callspec__ D8_(PDISASM); -void __bea_callspec__ D9_(PDISASM); -void __bea_callspec__ DA_(PDISASM); -void __bea_callspec__ DB_(PDISASM); -void __bea_callspec__ DC_(PDISASM); -void __bea_callspec__ DD_(PDISASM); -void __bea_callspec__ DE_(PDISASM); -void __bea_callspec__ DF_(PDISASM); - -/* ====================================== opcodes_MMX */ -void __bea_callspec__ emms_(PDISASM); -void __bea_callspec__ movd_EP(PDISASM); -void __bea_callspec__ movd_PE(PDISASM); -void __bea_callspec__ movq_PQ(PDISASM); -void __bea_callspec__ movq_QP(PDISASM); -void __bea_callspec__ movq_WV(PDISASM); -void __bea_callspec__ pabsb_(PDISASM); -void __bea_callspec__ pabsd_(PDISASM); -void __bea_callspec__ pabsw_(PDISASM); -void __bea_callspec__ packssdw_(PDISASM); -void __bea_callspec__ packsswb_(PDISASM); -void __bea_callspec__ packuswb_(PDISASM); -void __bea_callspec__ paddb_(PDISASM); -void __bea_callspec__ paddd_(PDISASM); -void __bea_callspec__ paddsb_(PDISASM); -void __bea_callspec__ paddsw_(PDISASM); -void __bea_callspec__ paddusb_(PDISASM); -void __bea_callspec__ paddusw_(PDISASM); -void __bea_callspec__ paddw_(PDISASM); -void __bea_callspec__ pandn_(PDISASM); -void __bea_callspec__ pand_(PDISASM); -void __bea_callspec__ pcmpeqb_(PDISASM); -void __bea_callspec__ pcmpeqd_(PDISASM); -void __bea_callspec__ pcmpeqw_(PDISASM); -void __bea_callspec__ pcmpgtb_(PDISASM); -void __bea_callspec__ pcmpgtd_(PDISASM); -void __bea_callspec__ pcmpgtw_(PDISASM); -void __bea_callspec__ pmulhw_(PDISASM); -void __bea_callspec__ pmullw_(PDISASM); -void __bea_callspec__ pmaddwd_(PDISASM); -void __bea_callspec__ por_(PDISASM); -void __bea_callspec__ pslld_(PDISASM); -void __bea_callspec__ psllq_(PDISASM); -void __bea_callspec__ psllw_(PDISASM); -void __bea_callspec__ psrld_(PDISASM); -void __bea_callspec__ psrlq_(PDISASM); -void __bea_callspec__ psrlw_(PDISASM); -void __bea_callspec__ psrad_(PDISASM); -void __bea_callspec__ psraw_(PDISASM); -void __bea_callspec__ psubb_(PDISASM); -void __bea_callspec__ psubd_(PDISASM); -void __bea_callspec__ psubsb_(PDISASM); -void __bea_callspec__ psubsw_(PDISASM); -void __bea_callspec__ psubusb_(PDISASM); -void __bea_callspec__ psubusw_(PDISASM); -void __bea_callspec__ psubw_(PDISASM); -void __bea_callspec__ punpckhbw_(PDISASM); -void __bea_callspec__ punpckhdq_(PDISASM); -void __bea_callspec__ punpckhwd_(PDISASM); -void __bea_callspec__ punpcklbw_(PDISASM); -void __bea_callspec__ punpckldq_(PDISASM); -void __bea_callspec__ punpcklwd_(PDISASM); -void __bea_callspec__ pxor_(PDISASM); - -/* ====================================== opcodes_SSE */ -void __bea_callspec__ addps_VW(PDISASM); -void __bea_callspec__ addsubpd_(PDISASM); -void __bea_callspec__ andnps_VW(PDISASM); -void __bea_callspec__ andps_VW(PDISASM); -void __bea_callspec__ blendpd_(PDISASM); -void __bea_callspec__ blendps_(PDISASM); -void __bea_callspec__ blendvpd_(PDISASM); -void __bea_callspec__ blendvps_(PDISASM); -void __bea_callspec__ cmpps_VW(PDISASM); -void __bea_callspec__ crc32_GvEb(PDISASM); -void __bea_callspec__ crc32_GvEv(PDISASM); -void __bea_callspec__ comiss_VW(PDISASM); -void __bea_callspec__ cvtdq2ps_(PDISASM); -void __bea_callspec__ cvtpd2dq_(PDISASM); -void __bea_callspec__ cvtpi2ps_(PDISASM); -void __bea_callspec__ cvtps2pd_(PDISASM); -void __bea_callspec__ cvtps2pi_(PDISASM); -void __bea_callspec__ cvttps2pi_(PDISASM); -void __bea_callspec__ dppd_(PDISASM); -void __bea_callspec__ dpps_(PDISASM); -void __bea_callspec__ divps_VW(PDISASM); -void __bea_callspec__ extractps_(PDISASM); -void __bea_callspec__ haddpd_VW(PDISASM); -void __bea_callspec__ hsubpd_VW(PDISASM); -void __bea_callspec__ insertps_(PDISASM); -void __bea_callspec__ lddqu_(PDISASM); -void __bea_callspec__ maskmovq_(PDISASM); -void __bea_callspec__ maxps_VW(PDISASM); -void __bea_callspec__ minps_VW(PDISASM); -void __bea_callspec__ movaps_VW(PDISASM); -void __bea_callspec__ movaps_WV(PDISASM); -void __bea_callspec__ movhps_MV(PDISASM); -void __bea_callspec__ movhps_VM(PDISASM); -void __bea_callspec__ movlps_MV(PDISASM); -void __bea_callspec__ movlps_VM(PDISASM); -void __bea_callspec__ movmskps_(PDISASM); -void __bea_callspec__ movntdqa_(PDISASM); -void __bea_callspec__ movnti_(PDISASM); -void __bea_callspec__ movntps_(PDISASM); -void __bea_callspec__ movntq_(PDISASM); -void __bea_callspec__ movups_VW(PDISASM); -void __bea_callspec__ movups_WV(PDISASM); -void __bea_callspec__ mpsadbw_(PDISASM); -void __bea_callspec__ mulps_VW(PDISASM); -void __bea_callspec__ orps_VW(PDISASM); -void __bea_callspec__ packusdw_(PDISASM); -void __bea_callspec__ paddq_(PDISASM); -void __bea_callspec__ pavgb_(PDISASM); -void __bea_callspec__ pavgw_(PDISASM); -void __bea_callspec__ palignr_(PDISASM); -void __bea_callspec__ pblendvb_(PDISASM); -void __bea_callspec__ pblendw_(PDISASM); -void __bea_callspec__ pcmpeqq_(PDISASM); -void __bea_callspec__ pcmpestri_(PDISASM); -void __bea_callspec__ pcmpestrm_(PDISASM); -void __bea_callspec__ pcmpgtq_(PDISASM); -void __bea_callspec__ pcmpistri_(PDISASM); -void __bea_callspec__ pcmpistrm_(PDISASM); -void __bea_callspec__ pextrb_(PDISASM); -void __bea_callspec__ pextrd_(PDISASM); -void __bea_callspec__ pextrw2_(PDISASM); -void __bea_callspec__ pextrw_(PDISASM); -void __bea_callspec__ phaddd_(PDISASM); -void __bea_callspec__ phaddsw_(PDISASM); -void __bea_callspec__ phaddw_(PDISASM); -void __bea_callspec__ phminposuw_(PDISASM); -void __bea_callspec__ phsubd_(PDISASM); -void __bea_callspec__ phsubsw_(PDISASM); -void __bea_callspec__ phsubw_(PDISASM); -void __bea_callspec__ pinsrb_(PDISASM); -void __bea_callspec__ pinsrd_(PDISASM); -void __bea_callspec__ pinsrw_(PDISASM); -void __bea_callspec__ pmaxsb_(PDISASM); -void __bea_callspec__ pmaxsd_(PDISASM); -void __bea_callspec__ pmaxsw_(PDISASM); -void __bea_callspec__ pmaxub_(PDISASM); -void __bea_callspec__ pmaxud_(PDISASM); -void __bea_callspec__ pmaxuw_(PDISASM); -void __bea_callspec__ pminsb_(PDISASM); -void __bea_callspec__ pminsd_(PDISASM); -void __bea_callspec__ pminsw_(PDISASM); -void __bea_callspec__ pminub_(PDISASM); -void __bea_callspec__ pminud_(PDISASM); -void __bea_callspec__ pminuw_(PDISASM); -void __bea_callspec__ pmaddubsw_(PDISASM); -void __bea_callspec__ pmovmskb_(PDISASM); -void __bea_callspec__ pmovsxbd_(PDISASM); -void __bea_callspec__ pmovsxbq_(PDISASM); -void __bea_callspec__ pmovsxbw_(PDISASM); -void __bea_callspec__ pmovsxdq_(PDISASM); -void __bea_callspec__ pmovsxwd_(PDISASM); -void __bea_callspec__ pmovsxwq_(PDISASM); -void __bea_callspec__ pmovzxbd_(PDISASM); -void __bea_callspec__ pmovzxbq_(PDISASM); -void __bea_callspec__ pmovzxbw_(PDISASM); -void __bea_callspec__ pmovzxdq_(PDISASM); -void __bea_callspec__ pmovzxwd_(PDISASM); -void __bea_callspec__ pmovzxwq_(PDISASM); -void __bea_callspec__ pmuldq_(PDISASM); -void __bea_callspec__ pmulhrsw_(PDISASM); -void __bea_callspec__ pmulhuw_(PDISASM); -void __bea_callspec__ pmulhw_(PDISASM); -void __bea_callspec__ pmulld_(PDISASM); -void __bea_callspec__ pmullw_(PDISASM); -void __bea_callspec__ pmuludq_(PDISASM); -void __bea_callspec__ popcnt_(PDISASM); -void __bea_callspec__ psadbw_(PDISASM); -void __bea_callspec__ pshufb_(PDISASM); -void __bea_callspec__ pshufw_(PDISASM); -void __bea_callspec__ psignb_(PDISASM); -void __bea_callspec__ psignd_(PDISASM); -void __bea_callspec__ psignw_(PDISASM); -void __bea_callspec__ psubq_(PDISASM); -void __bea_callspec__ ptest_(PDISASM); -void __bea_callspec__ punpcklqdq_(PDISASM); -void __bea_callspec__ punpckhqdq_(PDISASM); -void __bea_callspec__ rcpps_(PDISASM); -void __bea_callspec__ roundpd_(PDISASM); -void __bea_callspec__ roundps_(PDISASM); -void __bea_callspec__ roundsd_(PDISASM); -void __bea_callspec__ roundss_(PDISASM); -void __bea_callspec__ rsqrtps_(PDISASM); -void __bea_callspec__ shufps_(PDISASM); -void __bea_callspec__ sqrtps_VW(PDISASM); -void __bea_callspec__ subps_VW(PDISASM); -void __bea_callspec__ ucomiss_VW(PDISASM); -void __bea_callspec__ unpckhps_(PDISASM); -void __bea_callspec__ unpcklps_(PDISASM); -void __bea_callspec__ xorps_VW(PDISASM); - -/* ====================================== opcodes_AES */ -void __bea_callspec__ aesimc(PDISASM); -void __bea_callspec__ aesdec(PDISASM); -void __bea_callspec__ aesdeclast(PDISASM); -void __bea_callspec__ aesenc(PDISASM); -void __bea_callspec__ aesenclast(PDISASM); -void __bea_callspec__ aeskeygen(PDISASM); - -/* ====================================== opcodes_CLMUL */ -void __bea_callspec__ pclmulqdq_(PDISASM); diff --git a/NativeHelper/dllmain.cpp b/NativeHelper/dllmain.cpp deleted file mode 100644 index 1512747c..00000000 --- a/NativeHelper/dllmain.cpp +++ /dev/null @@ -1,405 +0,0 @@ -#define EXTERN_DLL_EXPORT - -#include -#include -#include -#include -#include - -#include - -const int PATH_MAXIMUM_LENGTH = 260; - -enum class RequestFunction -{ - IsProcessValid, - OpenRemoteProcess, - CloseRemoteProcess, - ReadRemoteMemory, - WriteRemoteMemory, - EnumerateProcesses, - EnumerateRemoteSectionsAndModules, - DisassembleRemoteCode, - ControlRemoteProcess -}; - -typedef LPVOID(__stdcall *RequestFunctionPtrCallback)(RequestFunction request); -RequestFunctionPtrCallback requestFunction; - -EXTERN_DLL_EXPORT VOID __stdcall Initialize(RequestFunctionPtrCallback requestCallback) -{ - requestFunction = requestCallback; -} - -DWORD lastError = 0; -EXTERN_DLL_EXPORT DWORD __stdcall GetLastErrorCode() -{ - return lastError; -} - -EXTERN_DLL_EXPORT BOOL __stdcall IsProcessValid(HANDLE process) -{ - if (!process) - { - return FALSE; - } - - auto retn = WaitForSingleObject(process, 0); - if (retn == WAIT_FAILED) - { - return FALSE; - } - return retn == WAIT_TIMEOUT; -} - -EXTERN_DLL_EXPORT LPVOID __stdcall OpenRemoteProcess(DWORD pid, DWORD desiredAccess) -{ - return OpenProcess(desiredAccess, FALSE, pid); -} - -EXTERN_DLL_EXPORT VOID __stdcall CloseRemoteProcess(HANDLE process) -{ - CloseHandle(process); -} - -EXTERN_DLL_EXPORT BOOL __stdcall ReadRemoteMemory(HANDLE process, LPCVOID address, LPVOID buffer, SIZE_T size) -{ - if (ReadProcessMemory(process, address, buffer, size, nullptr)) - { - lastError = 0; - - return TRUE; - } - - lastError = GetLastError(); - - return FALSE; -} - -EXTERN_DLL_EXPORT BOOL __stdcall WriteRemoteMemory(HANDLE process, LPVOID address, LPCVOID buffer, SIZE_T size) -{ - DWORD oldProtect; - if (VirtualProtectEx(process, address, size, PAGE_EXECUTE_READWRITE, &oldProtect)) - { - if (WriteProcessMemory(process, address, buffer, size, nullptr)) - { - VirtualProtectEx(process, address, size, oldProtect, nullptr); - - lastError = 0; - - return TRUE; - } - } - - lastError = GetLastError(); - - return FALSE; -} - -enum class Platform -{ - Unknown, - X86, - X64 -}; - -Platform GetProcessPlatform(HANDLE process) -{ - auto GetProcessorArchitecture = []() - { - static USHORT processorArchitecture = PROCESSOR_ARCHITECTURE_UNKNOWN; - if (processorArchitecture == PROCESSOR_ARCHITECTURE_UNKNOWN) - { - SYSTEM_INFO info = {}; - GetNativeSystemInfo(&info); - - processorArchitecture = info.wProcessorArchitecture; - } - return processorArchitecture; - }; - - switch (GetProcessorArchitecture()) - { - case PROCESSOR_ARCHITECTURE_INTEL: - return Platform::X86; - case PROCESSOR_ARCHITECTURE_AMD64: - BOOL isWow64 = FALSE; - if (IsWow64Process(process, &isWow64)) - { - return isWow64 ? Platform::X86 : Platform::X64; - } - -#ifdef _WIN64 - return Platform::X64; -#else - return Platform::X86; -#endif - } - return Platform::Unknown; -} - -typedef VOID(__stdcall EnumerateProcessCallback)(DWORD pid, WCHAR modulePath[PATH_MAXIMUM_LENGTH]); - -EXTERN_DLL_EXPORT VOID __stdcall EnumerateProcesses(EnumerateProcessCallback callbackProcess) -{ - if (callbackProcess == nullptr) - { - return; - } - - auto handle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); - if (handle != INVALID_HANDLE_VALUE) - { - PROCESSENTRY32W pe32 = {}; - pe32.dwSize = sizeof(PROCESSENTRY32W); - if (Process32FirstW(handle, &pe32)) - { - auto openRemoteProcess = reinterpret_cast(requestFunction(RequestFunction::OpenRemoteProcess)); - auto closeRemoteProcess = reinterpret_cast(requestFunction(RequestFunction::CloseRemoteProcess)); - - do - { - auto process = openRemoteProcess(pe32.th32ProcessID, PROCESS_QUERY_INFORMATION | PROCESS_VM_READ); - if (process != nullptr && process != INVALID_HANDLE_VALUE) - { - auto platform = GetProcessPlatform(process); - -#ifdef _WIN64 - if (platform == Platform::X64) -#else - if (platform == Platform::X86) -#endif - { - WCHAR process_path[MAX_PATH] = { }; - GetModuleFileNameExW(process, NULL, process_path, MAX_PATH); - - callbackProcess(pe32.th32ProcessID, process_path); - } - - closeRemoteProcess(process); - } - } while (Process32NextW(handle, &pe32)); - } - - CloseHandle(handle); - - lastError = 0; - - return; - } - - lastError = GetLastError(); -} - -typedef VOID(__stdcall EnumerateRemoteSectionsCallback)(LPVOID baseAddress, SIZE_T regionSize, BYTE name[IMAGE_SIZEOF_SHORT_NAME + 2], DWORD state, DWORD protection, DWORD type, WCHAR modulePath[PATH_MAXIMUM_LENGTH]); -typedef VOID(__stdcall EnumerateRemoteModulesCallback)(LPVOID baseAddress, SIZE_T regionSize, WCHAR modulePath[PATH_MAXIMUM_LENGTH]); - -EXTERN_DLL_EXPORT VOID __stdcall EnumerateRemoteSectionsAndModules(HANDLE process, EnumerateRemoteSectionsCallback callbackSection, EnumerateRemoteModulesCallback callbackModule) -{ - if (callbackSection == nullptr && callbackModule == nullptr) - { - return; - } - - struct SectionInfo - { - LPVOID BaseAddress; - SIZE_T RegionSize; - BYTE Name[IMAGE_SIZEOF_SHORT_NAME + 2]; - DWORD State; - DWORD Protection; - DWORD Type; - WCHAR ModulePath[PATH_MAXIMUM_LENGTH]; - }; - std::vector sections; - - SYSTEM_INFO sysInfo; - GetSystemInfo(&sysInfo); - - MEMORY_BASIC_INFORMATION memInfo; - size_t address = (size_t)sysInfo.lpMinimumApplicationAddress; - while (address < (size_t)sysInfo.lpMaximumApplicationAddress) - { - if (VirtualQueryEx(process, (LPCVOID)address, &memInfo, sizeof(MEMORY_BASIC_INFORMATION)) != 0) - { - if (memInfo.State == MEM_COMMIT /*&& memInfo.Type == MEM_PRIVATE*/) - { - SectionInfo section = {}; - section.BaseAddress = memInfo.BaseAddress; - section.RegionSize = memInfo.RegionSize; - section.State = memInfo.State; - section.Protection = memInfo.Protect; - section.Type = memInfo.Type; - - sections.push_back(std::move(section)); - } - address = (ULONG_PTR)memInfo.BaseAddress + memInfo.RegionSize; - } - else - { - address += 1024; - } - } - - auto handle = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetProcessId(process)); - if (handle != INVALID_HANDLE_VALUE) - { - MODULEENTRY32W me32 = {}; - me32.dwSize = sizeof(MODULEENTRY32W); - if (Module32FirstW(handle, &me32)) - { - auto readRemoteMemory = reinterpret_cast(requestFunction(RequestFunction::ReadRemoteMemory)); - - do - { - if (callbackModule != nullptr) - { - callbackModule(me32.modBaseAddr, me32.modBaseSize, me32.szExePath); - } - - if (callbackSection != nullptr) - { - auto it = std::lower_bound(std::begin(sections), std::end(sections), (LPVOID)me32.modBaseAddr, [§ions](const SectionInfo& lhs, const LPVOID& rhs) - { - return lhs.BaseAddress < rhs; - }); - - IMAGE_DOS_HEADER DosHdr = {}; - IMAGE_NT_HEADERS NtHdr = {}; - - readRemoteMemory(process, me32.modBaseAddr, &DosHdr, sizeof(IMAGE_DOS_HEADER)); - readRemoteMemory(process, me32.modBaseAddr + DosHdr.e_lfanew, &NtHdr, sizeof(IMAGE_NT_HEADERS)); - - std::vector sectionHeaders(NtHdr.FileHeader.NumberOfSections); - readRemoteMemory(process, me32.modBaseAddr + DosHdr.e_lfanew + sizeof(IMAGE_NT_HEADERS), sectionHeaders.data(), NtHdr.FileHeader.NumberOfSections * sizeof(IMAGE_SECTION_HEADER)); - for (int i = 0; i < NtHdr.FileHeader.NumberOfSections; ++i) - { - auto&& section = sectionHeaders[i]; - - auto sectionAddress = (size_t)me32.modBaseAddr + section.VirtualAddress; - for (auto j = it; j != std::end(sections); ++j) - { - if (sectionAddress >= (size_t)j->BaseAddress && sectionAddress < (size_t)j->BaseAddress + (size_t)j->RegionSize) - { - std::memcpy(j->Name, section.Name, IMAGE_SIZEOF_SHORT_NAME); - std::memcpy(j->ModulePath, me32.szExePath, sizeof(SectionInfo::ModulePath)); - break; - } - } - - } - } - } while (Module32NextW(handle, &me32)); - } - - CloseHandle(handle); - - if (callbackSection != nullptr) - { - for (auto&& section : sections) - { - callbackSection(section.BaseAddress, section.RegionSize, section.Name, section.State, section.Protection, section.Type, section.ModulePath); - } - } - - lastError = 0; - - return; - } - - lastError = GetLastError(); -} - -typedef VOID(__stdcall DisassembleRemoteCodeCallback)(LPVOID address, DWORD length, CHAR instruction[64]); - -EXTERN_DLL_EXPORT VOID __stdcall DisassembleRemoteCode(HANDLE process, LPVOID address, int length, DisassembleRemoteCodeCallback callbackDisassembledCode) -{ - if (callbackDisassembledCode == nullptr) - { - return; - } - - UIntPtr start = (UIntPtr)address; - - DISASM disasm = { }; - disasm.Options = NasmSyntax + PrefixedNumeral; -#ifdef _WIN64 - disasm.Archi = 64; -#endif - - auto readRemoteMemory = reinterpret_cast(requestFunction(RequestFunction::ReadRemoteMemory)); - - std::vector buffer(length); - readRemoteMemory(process, address, buffer.data(), buffer.size()); - - UIntPtr end = (UIntPtr)buffer.data() + length; - - disasm.EIP = (UIntPtr)buffer.data(); - disasm.VirtualAddr = start; - - while (true) - { - disasm.SecurityBlock = end - disasm.EIP; - - auto disamLength = Disasm(&disasm); - if (disamLength == OUT_OF_BLOCK || disamLength == UNKNOWN_OPCODE) - { - break; - } - - callbackDisassembledCode((LPVOID)disasm.VirtualAddr, disamLength, disasm.CompleteInstr); - - disasm.EIP += disamLength; - if (disasm.EIP >= end || buffer[disasm.EIP - (UIntPtr)buffer.data()] == 0xCC) - { - break; - } - disasm.VirtualAddr += disamLength; - } -} - -enum class ControlRemoteProcessAction -{ - Suspend, - Resume, - Terminate -}; - -EXTERN_DLL_EXPORT VOID __stdcall ControlRemoteProcess(HANDLE process, ControlRemoteProcessAction action) -{ - if (action == ControlRemoteProcessAction::Suspend || action == ControlRemoteProcessAction::Resume) - { - auto processId = GetProcessId(process); - - auto handle = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); - if (handle != INVALID_HANDLE_VALUE) - { - auto fn = action == ControlRemoteProcessAction::Suspend ? SuspendThread : ResumeThread; - - THREADENTRY32 te32 = {}; - te32.dwSize = sizeof(THREADENTRY32); - if (Thread32First(handle, &te32)) - { - do - { - if (te32.th32OwnerProcessID == processId) - { - auto threadHandle = OpenThread(THREAD_SUSPEND_RESUME, FALSE, te32.th32ThreadID); - if (threadHandle) - { - fn(threadHandle); - - CloseHandle(threadHandle); - } - } - } while (Thread32Next(handle, &te32)); - } - - CloseHandle(handle); - } - } - else if (action == ControlRemoteProcessAction::Terminate) - { - TerminateProcess(process, 0); - } -} diff --git a/NativeHelper/exports.def b/NativeHelper/exports.def deleted file mode 100644 index 3ba41418..00000000 --- a/NativeHelper/exports.def +++ /dev/null @@ -1,13 +0,0 @@ -LIBRARY -EXPORTS - Initialize - GetLastErrorCode - IsProcessValid - OpenRemoteProcess - CloseRemoteProcess - ReadRemoteMemory - WriteRemoteMemory - EnumerateProcesses - EnumerateRemoteSectionsAndModules - DisassembleRemoteCode - ControlRemoteProcess \ No newline at end of file diff --git a/Nodes/BaseArrayNode.cs b/Nodes/BaseArrayNode.cs deleted file mode 100644 index dddbea5d..00000000 --- a/Nodes/BaseArrayNode.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - [ContractClass(typeof(BaseArrayNodeContract))] - public abstract class BaseArrayNode : BaseReferenceNode - { - public int CurrentIndex { get; set; } - public int Count { get; set; } = 1; - - protected int Draw(ViewInfo view, int x, int y, string type, HotSpotType exchange) - { - Contract.Requires(view != null); - Contract.Requires(type != null); - - if (IsHidden) - { - return DrawHidden(view, x, y); - } - - AddSelection(view, x, y, view.Font.Height); - AddDelete(view, x, y); - AddTypeDrop(view, x, y); - - x = AddOpenClose(view, x, y); - x = AddIcon(view, x, y, Icons.Array, -1, HotSpotType.None); - - var tx = x; - x = AddAddressOffset(view, x, y); - - x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name); - x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, "["); - x = AddText(view, x, y, Program.Settings.IndexColor, 0, Count.ToString()); - x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, "]"); - - x = AddIcon(view, x, y, Icons.LeftArrow, 2, HotSpotType.Click); - x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, "("); - x = AddText(view, x, y, Program.Settings.IndexColor, 1, CurrentIndex.ToString()); - x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, ")"); - x = AddIcon(view, x, y, Icons.RightArrow, 3, HotSpotType.Click); - - x = AddText(view, x, y, Program.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name} Size={MemorySize}>"); - x = AddIcon(view, x + 2, y, Icons.Change, 4, exchange); - - x += view.Font.Width; - AddComment(view, x, y); - - y += view.Font.Height; - - if (levelsOpen[view.Level]) - { - y = DrawChild(view, tx, y); - } - - return y; - } - - protected abstract int DrawChild(ViewInfo view, int x, int y); - - public override int CalculateHeight(ViewInfo view) - { - if (IsHidden) - { - return HiddenHeight; - } - - var h = view.Font.Height; - if (levelsOpen[view.Level]) - { - h += CalculateChildHeight(view); - } - return h; - } - - protected abstract int CalculateChildHeight(ViewInfo view); - - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id == 0 || spot.Id == 1) - { - int value; - if (int.TryParse(spot.Text, out value)) - { - if (spot.Id == 0) - { - if (value != 0) - { - Count = value; - - ParentNode.ChildHasChanged(this); - } - } - else - { - if (value < Count) - { - CurrentIndex = value; - } - } - } - } - else if (spot.Id == 2) - { - if (CurrentIndex > 0) - { - --CurrentIndex; - } - } - else if (spot.Id == 3) - { - if (CurrentIndex < Count - 1) - { - ++CurrentIndex; - } - } - } - } - - [ContractClassFor(typeof(BaseArrayNode))] - internal abstract class BaseArrayNodeContract : BaseArrayNode - { - protected override int DrawChild(ViewInfo view, int x, int y) - { - Contract.Requires(view != null); - - throw new NotImplementedException(); - } - } -} diff --git a/Nodes/BaseContainerNode.cs b/Nodes/BaseContainerNode.cs deleted file mode 100644 index 77d2f67e..00000000 --- a/Nodes/BaseContainerNode.cs +++ /dev/null @@ -1,216 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using ReClassNET.Util; - -namespace ReClassNET.Nodes -{ - public abstract class BaseContainerNode : BaseNode - { - protected readonly List nodes = new List(); - - /// The child nodes of the node. - public IEnumerable Nodes => nodes; - - /// Calculates the offset of every child node. - public void UpdateOffsets() - { - var offset = IntPtr.Zero; - foreach (var node in Nodes) - { - node.Offset = offset; - offset += node.MemorySize; - } - } - - /// Searches for the node index. - /// The node to search. - /// The found node index or -1 if the node was not found. - public int FindNodeIndex(BaseNode node) - { - Contract.Requires(node != null); - Contract.Ensures(Contract.Result() >= -1); - - return Nodes.FindIndex(n => n == node); - } - - public virtual BaseNode ReplaceChildNode(BaseNode child, Type nodeType) - { - Contract.Requires(nodeType != null); - - return ReplaceChildNode(FindNodeIndex(child), nodeType); - } - - /// Replaces the child at the specific position with the provided node. - /// Zero-based position. - /// The node to add. - /// True if it succeeds, false if it fails. - public virtual BaseNode ReplaceChildNode(int index, Type nodeType) - { - Contract.Requires(nodeType != null); - Contract.Requires(nodeType.IsSubclassOf(typeof(BaseNode))); - - var node = Activator.CreateInstance(nodeType) as BaseNode; - - node.Intialize(); - - if (ReplaceChildNode(index, node)) - { - return node; - } - - return null; - } - - /// Replaces the child at the specific position with the provided node. - /// Zero-based position. - /// The node to add. - /// True if it succeeds, false if it fails. - public bool ReplaceChildNode(BaseNode child, BaseNode node) - { - return ReplaceChildNode(FindNodeIndex(child), node); - } - - /// Replaces the child at the specific position with the provided node. - /// Zero-based position. - /// The node to add. - /// True if it succeeds, false if it fails. - public virtual bool ReplaceChildNode(int index, BaseNode node) - { - if (node == null) - { - return false; - } - if (index < 0 || index >= nodes.Count) - { - return false; - } - - var oldNode = nodes[index]; - - node.CopyFromNode(oldNode); - - node.ParentNode = this; - node.ClearSelection(); - - nodes[index] = node; - - var oldSize = oldNode.MemorySize; - var newSize = node.MemorySize; - - if (newSize < oldSize) - { - InsertBytes(index + 1, oldSize - newSize); - } - else if (newSize > oldSize) - { - //RemoveNodes(index + 1, newSize - oldSize); - } - - return true; - } - - /// Adds the specific amount of bytes at the end of the node. - /// The number of bytes to insert. - public void AddBytes(int size) - { - InsertBytes(nodes.Count, size); - } - - public virtual void InsertBytes(BaseNode position, int size) - { - InsertBytes(FindNodeIndex(position), size); - } - - /// Inserts bytes at the specified position. - /// Zero-based position. - /// The number of bytes to insert. - public virtual void InsertBytes(int index, int size) - { - if (index < 0 || index > nodes.Count || size == 0) - { - return; - } - - var offset = IntPtr.Zero; - if (index > 0) - { - var node = nodes[index - 1]; - offset = node.Offset + node.MemorySize; - } - - while (size != 0) - { - BaseNode node = null; -#if WIN64 - if (size >= 8) - { - node = new Hex64Node(); - } - else -#endif - if (size >= 4) - { - node = new Hex32Node(); - } - else if (size >= 2) - { - node = new Hex16Node(); - } - else - { - node = new Hex8Node(); - } - - node.ParentNode = this; - node.Offset = offset; - - nodes.Insert(index, node); - - offset += node.MemorySize; - size -= node.MemorySize; - - index++; - } - } - - public void AddNode(BaseNode node) - { - Contract.Requires(node != null); - - InsertNode(nodes.Count, node); - } - - public virtual void InsertNode(BaseNode position, BaseNode node) - { - InsertNode(FindNodeIndex(position), node); - } - - public virtual void InsertNode(int index, BaseNode node) - { - Contract.Requires(index >= 0); - Contract.Requires(node != null); - - node.ParentNode = this; - - nodes.Insert(index, node); - } - - /// Removes the specified node. - /// The node to remove. - /// True if it succeeds, false if it fails. - public virtual bool RemoveNode(BaseNode node) - { - Contract.Requires(node != null); - - return nodes.Remove(node); - } - - /// Called by a child if it has changed. - /// The child. - protected internal virtual void ChildHasChanged(BaseNode child) - { - - } - } -} diff --git a/Nodes/BaseFunctionPtrNode.cs b/Nodes/BaseFunctionPtrNode.cs deleted file mode 100644 index 00f53346..00000000 --- a/Nodes/BaseFunctionPtrNode.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using ReClassNET.Memory; -using ReClassNET.UI; -using ReClassNET.Util; - -namespace ReClassNET.Nodes -{ - public abstract class BaseFunctionPtrNode : BaseNode - { - private IntPtr address = IntPtr.Zero; - private readonly List assembledCode = new List(); - - /// Size of the node in bytes. - public override int MemorySize => IntPtr.Size; - - public override string GetToolTipText(HotSpot spot, MemoryBuffer memory) - { - var ptr = memory.ReadObject(Offset); - - DisassembleRemoteCode(memory, ptr); - - return string.Join("\n", assembledCode); - } - - protected int Draw(ViewInfo view, int x, int y, string type, string name) - { - Contract.Requires(view != null); - Contract.Requires(type != null); - Contract.Requires(name != null); - - if (IsHidden) - { - return DrawHidden(view, x, y); - } - - AddSelection(view, x, y, view.Font.Height); - AddDelete(view, x, y); - AddTypeDrop(view, x, y); - - x += TextPadding; - - x = AddIcon(view, x, y, Icons.Function, -1, HotSpotType.None); - x = AddAddressOffset(view, x, y); - - var tx = x; - - x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, name) + view.Font.Width; - - x = AddOpenClose(view, x, y) + view.Font.Width; - - x = AddComment(view, x, y); - - if (levelsOpen[view.Level]) - { - var ptr = view.Memory.ReadObject(Offset); - - DisassembleRemoteCode(view.Memory, ptr); - - foreach (var line in assembledCode) - { - y += view.Font.Height; - - AddText(view, tx, y, Program.Settings.NameColor, -1, line); - } - } - - return y + view.Font.Height; - } - - public override int CalculateHeight(ViewInfo view) - { - if (IsHidden) - { - return HiddenHeight; - } - - var h = view.Font.Height; - if (levelsOpen[view.Level]) - { - h += assembledCode.Count * view.Font.Height; - } - return h; - } - - private void DisassembleRemoteCode(MemoryBuffer memory, IntPtr address) - { - Contract.Requires(memory != null); - - if (this.address != address) - { - assembledCode.Clear(); - - this.address = address; - - if (!address.IsNull() && memory.Process.IsValid) - { - memory.Process.NativeHelper.DisassembleRemoteCode( - memory.Process.Process.Handle, - address, - 200, -#if WIN64 - (a, l, i) => assembledCode.Add($"{a.ToString("X08")} {i}") -#else - (a, l, i) => assembledCode.Add($"{a.ToString("X04")} {i}") -#endif - ); - } - } - } - } -} diff --git a/Nodes/BaseHexCommentNode.cs b/Nodes/BaseHexCommentNode.cs deleted file mode 100644 index 4df940c7..00000000 --- a/Nodes/BaseHexCommentNode.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using System.Linq; -using System.Text; -using ReClassNET.UI; -using ReClassNET.Util; - -namespace ReClassNET.Nodes -{ - public abstract class BaseHexCommentNode : BaseHexNode - { - protected int AddComment(ViewInfo view, int x, int y, float fvalue, IntPtr ivalue, UIntPtr uvalue) - { - Contract.Requires(view != null); - - if (Program.Settings.ShowCommentFloat) - { - x = AddText(view, x, y, Program.Settings.ValueColor, HotSpot.NoneId, $"({(fvalue > -99999.0f && fvalue < 99999.0f ? fvalue : 0.0f):0.000})"); - } - if (Program.Settings.ShowCommentInteger) - { - if (ivalue == IntPtr.Zero) - { - x = AddText(view, x, y, Program.Settings.ValueColor, HotSpot.NoneId, "(0)"); - } - else - { - x = AddText(view, x, y, Program.Settings.ValueColor, HotSpot.NoneId, $"({ivalue.ToInt64()}|0x{uvalue.ToUInt64():X})"); - } - } - - var namedAddress = view.Memory.Process.GetNamedAddress(ivalue); - if (!string.IsNullOrEmpty(namedAddress)) - { - x += view.Font.Width; - - if (Program.Settings.ShowCommentPointer) - { - x = AddText(view, x, y, Program.Settings.OffsetColor, HotSpot.NoneId, $"-> {namedAddress}") + view.Font.Width; - } - - if (Program.Settings.ShowCommentRtti) - { - var rtti = view.Memory.Process.ReadRemoteRuntimeTypeInformation(ivalue); - if (!string.IsNullOrEmpty(rtti)) - { - x = AddText(view, x, y, Program.Settings.OffsetColor, HotSpot.NoneId, rtti) + view.Font.Width; - } - } - - if (Program.Settings.ShowCommentSymbol) - { - var module = view.Memory.Process.GetModuleToPointer(ivalue); - if (module != null) - { - var symbols = view.Memory.Process.Symbols.GetSymbolsForModule(module); - if (symbols != null) - { - var symbol = symbols.GetSymbolString(ivalue, module); - if (!string.IsNullOrEmpty(symbol)) - { - x = AddText(view, x, y, Program.Settings.OffsetColor, HotSpot.NoneId, symbol) + view.Font.Width; - } - } - } - } - - if (Program.Settings.ShowCommentString) - { - var data = view.Memory.Process.ReadRemoteMemory(ivalue, 64); - - // First check if it could be an UTF8 string and if not try UTF16. - if (data.Take(IntPtr.Size).InterpretAsUTF8().IsPrintableData()) - { - var text = new string(Encoding.UTF8.GetChars(data).TakeWhile(c => c != 0).ToArray()); - x = AddText(view, x, y, Program.Settings.TextColor, HotSpot.NoneId, $"'{text}'") + view.Font.Width; - } - else if(data.Take(IntPtr.Size * 2).InterpretAsUTF16().IsPrintableData()) - { - var text = new string(Encoding.Unicode.GetChars(data).TakeWhile(c => c != 0).ToArray()); - x = AddText(view, x, y, Program.Settings.TextColor, HotSpot.NoneId, $"L'{text}'") + view.Font.Width; - } - } - - if (Program.Settings.ShowCommentPluginInfo) - { - foreach (var reader in NodeInfoReader) - { - var info = reader.ReadNodeInfo(this, ivalue, view.Memory); - if (info != null) - { - x = AddText(view, x, y, Program.Settings.PluginColor, HotSpot.NoneId, info) + view.Font.Width; - } - } - } - } - - return x; - } - } -} diff --git a/Nodes/BaseHexNode.cs b/Nodes/BaseHexNode.cs deleted file mode 100644 index 5fbb21b9..00000000 --- a/Nodes/BaseHexNode.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using System.Globalization; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public abstract class BaseHexNode : BaseNode - { - private readonly byte[] buffer; - private DateTime highlightUntil; - - public static DateTime CurrentHighlightTime; - public static readonly TimeSpan HightlightDuration = TimeSpan.FromSeconds(1); - - public BaseHexNode() - { - Contract.Ensures(buffer != null); - - buffer = new byte[MemorySize]; - } - - protected int Draw(ViewInfo view, int x, int y, string text, int length) - { - Contract.Requires(view != null); - Contract.Requires(text != null); - - if (IsHidden) - { - return DrawHidden(view, x, y); - } - - AddSelection(view, x, y, view.Font.Height); - AddDelete(view, x, y); - AddTypeDrop(view, x, y); - - x += TextPadding + 16; - x = AddAddressOffset(view, x, y); - - if (Program.Settings.ShowNodeText) - { - x = AddText(view, x, y, Program.Settings.TextColor, HotSpot.NoneId, text); - } - - var color = Program.Settings.HighlightChangedValues && highlightUntil > CurrentHighlightTime ? Program.Settings.HighlightColor : Program.Settings.HexColor; - var changed = false; - for (var i = 0; i < length; ++i) - { - var b = view.Memory.ReadByte(Offset + i); - if (buffer[i] != b) - { - changed = true; - - buffer[i] = b; - } - - x = AddText(view, x, y, color, i, $"{b:X02}") + view.Font.Width; - } - - if (changed) - { - highlightUntil = CurrentHighlightTime.Add(HightlightDuration); - } - - AddComment(view, x, y); - - return y + view.Font.Height; - } - - public override int CalculateHeight(ViewInfo view) - { - return IsHidden ? HiddenHeight : view.Font.Height; - } - - /// Updates the node from the given spot. Sets the value of the selected byte. - /// The spot. - public void Update(HotSpot spot, int length) - { - Contract.Requires(spot != null); - - base.Update(spot); - - if (spot.Id >= 0 && spot.Id < length) - { - byte val; - if (byte.TryParse(spot.Text, NumberStyles.HexNumber, null, out val)) - { - spot.Memory.Process.WriteRemoteMemory(spot.Address + spot.Id, val); - } - } - } - } -} diff --git a/Nodes/BaseMatrixNode.cs b/Nodes/BaseMatrixNode.cs deleted file mode 100644 index 1c7ea678..00000000 --- a/Nodes/BaseMatrixNode.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System.Diagnostics.Contracts; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public abstract class BaseMatrixNode : BaseNode - { - public BaseMatrixNode() - { - levelsOpen.DefaultValue = true; - } - - protected delegate void DrawMatrixValues(ref int x, ref int y, int defaultX); - - protected int DrawMatrixType(ViewInfo view, int x, int y, string type, DrawMatrixValues drawValues) - { - Contract.Requires(view != null); - Contract.Requires(type != null); - Contract.Requires(drawValues != null); - - if (IsHidden) - { - return DrawHidden(view, x, y); - } - - AddSelection(view, x, y, view.Font.Height); - AddDelete(view, x, y); - AddTypeDrop(view, x, y); - - x += TextPadding; - - x = AddIcon(view, x, y, Icons.Matrix, HotSpot.NoneId, HotSpotType.None); - - var tx = x; - - x = AddAddressOffset(view, x, y); - - x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name); - x = AddOpenClose(view, x, y); - - x += view.Font.Width; - - x = AddComment(view, x, y); - - if (levelsOpen[view.Level]) - { - drawValues(ref x, ref y, tx); - } - - return y + view.Font.Height; - } - - protected delegate void DrawVectorValues(ref int x, ref int y); - protected int DrawVectorType(ViewInfo view, int x, int y, string type, DrawVectorValues drawValues) - { - Contract.Requires(view != null); - Contract.Requires(type != null); - Contract.Requires(drawValues != null); - - if (IsHidden) - { - return DrawHidden(view, x, y); - } - - AddSelection(view, x, y, view.Font.Height); - AddDelete(view, x, y); - AddTypeDrop(view, x, y); - - x += TextPadding; - - x = AddIcon(view, x, y, Icons.Vector, HotSpot.NoneId, HotSpotType.None); - x = AddAddressOffset(view, x, y); - - x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name); - x = AddOpenClose(view, x, y); - - if (levelsOpen[view.Level]) - { - drawValues(ref x, ref y); - } - - x += view.Font.Width; - - AddComment(view, x, y); - - return y + view.Font.Height; - } - - public override int CalculateHeight(ViewInfo view) - { - if (IsHidden) - { - return HiddenHeight; - } - - var h = view.Font.Height; - if (levelsOpen[view.Level]) - { - h += CalculateValuesHeight(view); - } - return h; - } - - protected abstract int CalculateValuesHeight(ViewInfo view); - - public void Update(HotSpot spot, int max) - { - Contract.Requires(spot != null); - - base.Update(spot); - - if (spot.Id >= 0 && spot.Id < max) - { - float val; - if (float.TryParse(spot.Text, out val)) - { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); - } - } - } - } -} diff --git a/Nodes/BaseNode.cs b/Nodes/BaseNode.cs deleted file mode 100644 index 8c0168f0..00000000 --- a/Nodes/BaseNode.cs +++ /dev/null @@ -1,394 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.Contracts; -using System.Drawing; -using ReClassNET.Memory; -using ReClassNET.UI; -using ReClassNET.Util; - -namespace ReClassNET.Nodes -{ - public delegate void NodeEventHandler(BaseNode sender); - - [DebuggerDisplay("{DebuggerDisplay,nq}")] - [ContractClass(typeof(BaseNodeContract))] - public abstract class BaseNode - { - private string DebuggerDisplay => $"Type: {GetType().Name} Name: {Name} Offset: 0x{Offset.ToString("X")}"; - - internal static readonly List NodeInfoReader = new List(); - - protected static readonly int TextPadding = Icons.Dimensions; - protected const int HiddenHeight = 1; - - private static int NodeIndex = 0; - - private string name; - private string comment; - - /// Gets or sets the offset of the node. - public IntPtr Offset { get; set; } - - /// Gets or sets the name of the node. If a new name was set the property changed event gets fired. - public virtual string Name { get { return name; } set { if (value != null && name != value) { name = value; NameChanged?.Invoke(this); } } } - - /// Gets or sets the comment of the node. - public string Comment { get { return comment; } set { if (value != null && comment != value) { comment = value; CommentChanged?.Invoke(this); } } } - - /// Gets or sets the parent node. - public BaseContainerNode ParentNode { get; internal set; } - - /// Gets or sets a value indicating whether this object is hidden. - public bool IsHidden { get; protected set; } - - /// Gets or sets a value indicating whether this object is selected. - public bool IsSelected { get; set; } - - /// Size of the node in bytes. - public abstract int MemorySize { get; } - - public event NodeEventHandler NameChanged; - public event NodeEventHandler CommentChanged; - - protected GrowingList levelsOpen = new GrowingList(false); - - /// Constructor which sets a unique . - public BaseNode() - { - Contract.Ensures(name != null); - Contract.Ensures(comment != null); - - Name = $"N{NodeIndex++:X08}"; - Comment = string.Empty; - - levelsOpen[0] = true; - } - - /// Clears the selection of the node. - public virtual void ClearSelection() - { - IsSelected = false; - } - - /// Initializes this object from the given node. It copies the name and the comment. - /// The node to copy from. - public virtual void CopyFromNode(BaseNode node) - { - Contract.Requires(node != null); - - Name = node.Name; - Comment = node.Comment; - } - - - /// Called when the node was created. Does not get called after loading a project. - public virtual void Intialize() - { - - } - - /// Gets informations about this node to show in a tool tip. - /// The spot. - /// The process memory. - /// The information to show in a tool tip or null if no information should be shown. - public virtual string GetToolTipText(HotSpot spot, MemoryBuffer memory) - { - Contract.Requires(spot != null); - Contract.Requires(memory != null); - - return null; - } - - /// Draws the node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public abstract int Draw(ViewInfo view, int x, int y); - - /// - /// Calculates the height of the node if drawn. - /// This method is used to determine if a node outside the visible area should be drawn. - /// The returned height must be equal to the height which gets added by the method. - /// - /// The view information. - /// The calculated height. - public abstract int CalculateHeight(ViewInfo view); - - /// Updates the node from the given . Sets the and of the node. - /// The spot. - public virtual void Update(HotSpot spot) - { - Contract.Requires(spot != null); - - if (spot.Id == HotSpot.NameId) - { - Name = spot.Text; - } - else if (spot.Id == HotSpot.CommentId) - { - Comment = spot.Text; - } - } - - /// Toggles the specified level. - /// The level to toggle. - internal void ToggleLevelOpen(int level) - { - levelsOpen[level] = !levelsOpen[level]; - } - - /// Adds a the user can interact with. - /// The view information. - /// The spot. - /// The text to edit. - /// The id of the spot. - /// The type of the spot. - protected void AddHotSpot(ViewInfo view, Rectangle spot, string text, int id, HotSpotType type) - { - Contract.Requires(view != null); - Contract.Requires(text != null); - - if (spot.Top > view.ClientArea.Bottom || spot.Bottom < 0) - { - return; - } - - view.HotSpots.Add(new HotSpot - { - Rect = spot, - Text = text, - Address = view.Address.Add(Offset), - Id = id, - Type = type, - Node = this, - Level = view.Level, - Memory = view.Memory - }); - } - - /// Draws the specific text and adds a if is not . - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The color of the text. - /// Id for the clickable area. - /// The text to draw. - /// The new x coordinate after drawing the text. - protected int AddText(ViewInfo view, int x, int y, Color color, int hitId, string text) - { - Contract.Requires(view != null); - Contract.Requires(text != null); - - var width = Math.Max(text.Length, hitId != HotSpot.NoneId ? 1 : 0) * view.Font.Width; - - if (y >= -view.Font.Height && y + view.Font.Height <= view.ClientArea.Bottom + view.Font.Height) - { - if (hitId != HotSpot.NoneId) - { - var rect = new Rectangle(x, y, width, view.Font.Height); - AddHotSpot(view, rect, text, hitId, HotSpotType.Edit); - } - - using (var brush = new SolidBrush(color)) - { - view.Context.DrawString(text, view.Font.Font, brush, x, y); - } - } - - return x + width; - } - - /// Draws the address and of the node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The new x coordinate after drawing the text. - protected int AddAddressOffset(ViewInfo view, int x, int y) - { - Contract.Requires(view != null); - - if (Program.Settings.ShowNodeOffset) - { - x = AddText(view, x, y, Program.Settings.OffsetColor, HotSpot.NoneId, $"{Offset.ToInt32():X04}") + view.Font.Width; - } - - if (Program.Settings.ShowNodeAddress) - { -#if WIN32 - x = AddText(view, x, y, Program.Settings.AddressColor, HotSpot.AddressId, $"{view.Address.Add(Offset).ToInt32():X08}") + view.Font.Width; -#else - x = AddText(view, x, y, Program.Settings.AddressColor, HotSpot.AddressId, $"{view.Address.Add(Offset).ToInt64():X016}") + view.Font.Width; -#endif - } - - return x; - } - - /// Draws a bar which indicates the selection status of the node. A for this area gets added too. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height of the bar. - protected void AddSelection(ViewInfo view, int x, int y, int height) - { - Contract.Requires(view != null); - - if (y > view.ClientArea.Bottom || y + height < 0) - { - return; - } - - if (IsSelected) - { - using (var brush = new SolidBrush(Program.Settings.SelectedColor)) - { - view.Context.FillRectangle(brush, 0, y, view.ClientArea.Right, height); - } - } - - AddHotSpot(view, new Rectangle(0, y, view.ClientArea.Right - (IsSelected ? 16 : 0), height), string.Empty, -1, HotSpotType.Select); - } - - /// Draws an icon and adds a if is not . - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The icon. - /// The id of the spot. - /// The type of the spot. - /// The new x coordinate after drawing the icon. - protected int AddIcon(ViewInfo view, int x, int y, Image icon, int id, HotSpotType type) - { - Contract.Requires(view != null); - Contract.Requires(icon != null); - - if (y > view.ClientArea.Bottom || y + Icons.Dimensions < 0) - { - return x + Icons.Dimensions; - } - - view.Context.DrawImage(icon, x + 2, y, Icons.Dimensions, Icons.Dimensions); - - if (id != -1) - { - AddHotSpot(view, new Rectangle(x, y, Icons.Dimensions, Icons.Dimensions), string.Empty, id, type); - } - - return x + Icons.Dimensions; - } - - /// Adds a togglable Open/Close icon. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The new x coordinate after drawing the icon. - protected int AddOpenClose(ViewInfo view, int x, int y) - { - Contract.Requires(view != null); - - if (y > view.ClientArea.Bottom || y + Icons.Dimensions < 0) - { - return x + Icons.Dimensions; - } - - return AddIcon(view, x, y, levelsOpen[view.Level] ? Icons.OpenCloseOpen : Icons.OpenCloseClosed, 0, HotSpotType.OpenClose); - } - - /// Draws a delete icon if the node is selected. - /// The view information. - /// The x coordinate. - /// The y coordinate. - protected void AddDelete(ViewInfo view, int x, int y) - { - Contract.Requires(view != null); - - if (y > view.ClientArea.Bottom || y + Icons.Dimensions < 0) - { - return; - } - - if (IsSelected) - { - AddIcon(view, view.ClientArea.Right - Icons.Dimensions, y, Icons.Delete, 0, HotSpotType.Delete); - } - } - - /// Draws a type drop icon if the node is selected. - /// The view information. - /// The x coordinate. - /// The y coordinate. - protected void AddTypeDrop(ViewInfo view, int x, int y) - { - Contract.Requires(view != null); - - if (view.MultiSelected || (y > view.ClientArea.Bottom || y + Icons.Dimensions < 0)) - { - return; - } - - if (IsSelected) - { - AddIcon(view, 0, y, Icons.DropArrow, 0, HotSpotType.Drop); - } - } - - /// Draws the . - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The new x coordinate after drawing the comment. - protected virtual int AddComment(ViewInfo view, int x, int y) - { - Contract.Requires(view != null); - - x = AddText(view, x, y, Program.Settings.CommentColor, HotSpot.NoneId, "//"); - x = AddText(view, x, y, Program.Settings.CommentColor, HotSpot.CommentId, Comment) + view.Font.Width; - - return x; - } - - /// Draws a vertical line to show the hidden state. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The new y coordinate after drawing the line. - protected int DrawHidden(ViewInfo view, int x, int y) - { - Contract.Requires(view != null); - - view.Context.FillRectangle(new SolidBrush(IsSelected ? Program.Settings.SelectedColor : Program.Settings.HiddenColor), 0, y, view.ClientArea.Right, 1); - - return y + HiddenHeight; - } - } - - [ContractClassFor(typeof(BaseNode))] - internal abstract class BaseNodeContract : BaseNode - { - public override int MemorySize - { - get - { - Contract.Ensures(Contract.Result() >= 0); - - throw new NotImplementedException(); - } - } - - public override int Draw(ViewInfo view, int x, int y) - { - Contract.Requires(view != null); - - throw new NotImplementedException(); - } - - public override int CalculateHeight(ViewInfo view) - { - Contract.Requires(view != null); - - throw new NotImplementedException(); - } - } -} diff --git a/Nodes/BaseNumericNode.cs b/Nodes/BaseNumericNode.cs deleted file mode 100644 index e0798763..00000000 --- a/Nodes/BaseNumericNode.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Diagnostics.Contracts; -using System.Drawing; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public abstract class BaseNumericNode : BaseNode - { - /// Draws the node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The icon of the node. - /// The type of the node. - /// The value of the node. - /// The height the node occupies. - protected int DrawNumeric(ViewInfo view, int x, int y, Image icon, string type, string value) - { - Contract.Requires(view != null); - Contract.Requires(icon != null); - Contract.Requires(type != null); - Contract.Requires(value != null); - - if (IsHidden) - { - return DrawHidden(view, x, y); - } - - AddSelection(view, x, y, view.Font.Height); - AddDelete(view, x, y); - AddTypeDrop(view, x, y); - - x = x + TextPadding; - - x = AddIcon(view, x, y, icon, HotSpot.NoneId, HotSpotType.None); - x = AddAddressOffset(view, x, y); - - x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "=") + view.Font.Width; - x = AddText(view, x, y, Program.Settings.ValueColor, 0, value) + view.Font.Width; - - AddComment(view, x, y); - - return y + view.Font.Height; - } - - public override int CalculateHeight(ViewInfo view) - { - return IsHidden ? HiddenHeight : view.Font.Height; - } - } -} diff --git a/Nodes/BaseReferenceNode.cs b/Nodes/BaseReferenceNode.cs deleted file mode 100644 index 41ec719d..00000000 --- a/Nodes/BaseReferenceNode.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Diagnostics.Contracts; - -namespace ReClassNET.Nodes -{ - public abstract class BaseReferenceNode : BaseNode - { - private readonly bool performCycleCheck; - - /// Gets or sets the inner node. - public ClassNode InnerNode { get; protected set; } - - /// Gets signaled if the inner node was changed. - public event NodeEventHandler InnerNodeChanged; - - /// True to perform class cycle checks when changing the inner node. - public abstract bool PerformCycleCheck { get; } - - /// Changes the inner node. - /// The new node. - public void ChangeInnerNode(ClassNode node) - { - Contract.Requires(node != null); - - if (InnerNode != node) - { - InnerNode = node; - - InnerNodeChanged?.Invoke(this); - - ParentNode?.ChildHasChanged(this); - } - } - } -} diff --git a/Nodes/BaseTextNode.cs b/Nodes/BaseTextNode.cs deleted file mode 100644 index 788bdc1e..00000000 --- a/Nodes/BaseTextNode.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using ReClassNET.UI; -using ReClassNET.Util; - -namespace ReClassNET.Nodes -{ - [ContractClass(typeof(BaseTextNodeContract))] - public abstract class BaseTextNode : BaseNode - { - public int Length { get; set; } - - /// Size of the node in bytes. - public override int MemorySize => Length * CharacterSize; - - /// Size of one character in bytes. - public abstract int CharacterSize { get; } - - public override void CopyFromNode(BaseNode node) - { - Length = node.MemorySize / CharacterSize; - } - - protected int DrawText(ViewInfo view, int x, int y, string type, int length, string text) - { - Contract.Requires(view != null); - Contract.Requires(type != null); - Contract.Requires(text != null); - - if (IsHidden) - { - return DrawHidden(view, x, y); - } - - AddSelection(view, x, y, view.Font.Height); - AddDelete(view, x, y); - AddTypeDrop(view, x, y); - - x += TextPadding; - x = AddIcon(view, x, y, Icons.Text, HotSpot.NoneId, HotSpotType.None); - x = AddAddressOffset(view, x, y); - - x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name); - x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, "["); - x = AddText(view, x, y, Program.Settings.IndexColor, 0, length.ToString()); - x = AddText(view, x, y, Program.Settings.IndexColor, HotSpot.NoneId, "]") + view.Font.Width; - - x = AddText(view, x, y, Program.Settings.TextColor, HotSpot.NoneId, "= '"); - x = AddText(view, x, y, Program.Settings.TextColor, HotSpot.NoneId, text.LimitLength(150)); - x = AddText(view, x, y, Program.Settings.TextColor, HotSpot.NoneId, "'") + view.Font.Width; - - AddComment(view, x, y); - - return y + view.Font.Height; - } - - public override int CalculateHeight(ViewInfo view) - { - return IsHidden ? HiddenHeight : view.Font.Height; - } - - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id == 0) - { - int val; - if (int.TryParse(spot.Text, out val) && val > 0) - { - Length = val; - - ParentNode.ChildHasChanged(this); - } - } - } - } - - [ContractClassFor(typeof(BaseTextNode))] - internal abstract class BaseTextNodeContract : BaseTextNode - { - public override int CharacterSize - { - get - { - Contract.Ensures(Contract.Result() > 0); - - throw new NotImplementedException(); - } - } - } -} diff --git a/Nodes/BaseTextPtrNode.cs b/Nodes/BaseTextPtrNode.cs deleted file mode 100644 index 7165a52d..00000000 --- a/Nodes/BaseTextPtrNode.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public abstract class BaseTextPtrNode : BaseNode - { - /// Size of the node in bytes. - public override int MemorySize => IntPtr.Size; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public int DrawText(ViewInfo view, int x, int y, string type, int length, string text) - { - Contract.Requires(view != null); - Contract.Requires(type != null); - Contract.Requires(text != null); - - if (IsHidden) - { - return DrawHidden(view, x, y); - } - - AddSelection(view, x, y, view.Font.Height); - AddDelete(view, x, y); - AddTypeDrop(view, x, y); - - x += TextPadding; - x = AddIcon(view, x, y, Icons.Text, HotSpot.NoneId, HotSpotType.None); - x = AddAddressOffset(view, x, y); - - x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, type) + view.Font.Width; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; - - x = AddText(view, x, y, Program.Settings.TextColor, HotSpot.NoneId, "= '"); - x = AddText(view, x, y, Program.Settings.TextColor, HotSpot.NoneId, text); - x = AddText(view, x, y, Program.Settings.TextColor, HotSpot.NoneId, "'") + view.Font.Width; - - AddComment(view, x, y); - - return y + view.Font.Height; - } - - public override int CalculateHeight(ViewInfo view) - { - return IsHidden ? HiddenHeight : view.Font.Height; - } - } -} diff --git a/Nodes/BitFieldNode.cs b/Nodes/BitFieldNode.cs deleted file mode 100644 index 0e6896ca..00000000 --- a/Nodes/BitFieldNode.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using System.Drawing; -using ReClassNET.Memory; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class BitFieldNode : BaseNode - { - private int size; - private int bits; - - /// Gets or sets the bit count. - /// Possible values: 64, 32, 16, 8 - public int Bits - { - get { return bits; } - set - { - Contract.Ensures(bits > 0); - Contract.Ensures(size > 0); - - if (value >= 64) - { - bits = 64; - } - else if (value >= 32) - { - bits = 32; - } - else if (value >= 16) - { - bits = 16; - } - else - { - bits = 8; - } - - size = bits / 8; - } - } - - /// Size of the node in bytes. - public override int MemorySize => size; - - /// Default constructor. - public BitFieldNode() - { - Bits = IntPtr.Size * 8; - - levelsOpen.DefaultValue = true; - } - - /// Initializes this object with a bit count which equals the other nodes memory size. - /// The node to copy from. - public override void CopyFromNode(BaseNode node) - { - base.CopyFromNode(node); - - Bits = node.MemorySize * 8; - } - - /// Converts the memory value to a bit string. - /// The process memory. - /// The value converted to a bit string. - private string ConvertValueToBitString(MemoryBuffer memory) - { - Contract.Requires(memory != null); - Contract.Ensures(Contract.Result() != null); - - string str; - switch(bits) - { - case 64: - str = Convert.ToString(memory.ReadObject(Offset), 2); - break; - case 32: - str = Convert.ToString(memory.ReadObject(Offset), 2); - break; - case 16: - str = Convert.ToString(memory.ReadObject(Offset), 2); - break; - default: - str = Convert.ToString(memory.ReadObject(Offset), 2); - break; - } - return str.PadLeft(bits, '0'); - } - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - if (IsHidden) - { - return DrawHidden(view, x, y); - } - - AddSelection(view, x, y, view.Font.Height); - AddDelete(view, x, y); - AddTypeDrop(view, x, y); - - x += TextPadding + 16; - - x = AddAddressOffset(view, x, y); - - x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, "Bits") + view.Font.Width; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; - - x = AddOpenClose(view, x, y) + view.Font.Width; - - var tx = x - 3; - - for (var i = 0; i < bits; ++i) - { - var rect = new Rectangle(x + i * view.Font.Width, y, view.Font.Width, view.Font.Height); - AddHotSpot(view, rect, string.Empty, i, HotSpotType.Edit); - } - x = AddText(view, x, y, Program.Settings.ValueColor, HotSpot.NoneId, ConvertValueToBitString(view.Memory)) + view.Font.Width; - - x += view.Font.Width; - - AddComment(view, x, y); - - if (levelsOpen[view.Level]) - { - y += view.Font.Height; - - var format = new StringFormat(StringFormatFlags.DirectionVertical); - - using (var brush = new SolidBrush(Program.Settings.ValueColor)) - { - view.Context.DrawString("1", view.Font.Font, brush, tx + (bits - 1) * view.Font.Width + 1, y, format); - - for (var i = 8; i <= bits; i += 8) - { - view.Context.DrawString(i.ToString(), view.Font.Font, brush, tx + (bits - i) * view.Font.Width, y, format); - } - } - - y += 2; - } - - return y + view.Font.Height; - } - - public override int CalculateHeight(ViewInfo view) - { - if (IsHidden) - { - return HiddenHeight; - } - - var h = view.Font.Height; - if (levelsOpen[view.Level]) - { - h += view.Font.Height + 2; - } - return h; - } - - /// Updates the node from the given spot. Sets the value of the selected bit. - /// The spot. - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id >= 0 && spot.Id < bits) - { - if (spot.Text == "1" || spot.Text == "0") - { - var bit = (bits - 1) - spot.Id; - var add = bit / 8; - bit = bit % 8; - - var val = spot.Memory.ReadObject(Offset + add); - if (spot.Text == "1") - { - val |= (sbyte)(1 << bit); - } - else - { - val &= (sbyte)~(1 << bit); - } - spot.Memory.Process.WriteRemoteMemory(spot.Address + add, val); - } - } - } - } -} diff --git a/Nodes/ClassInstanceArrayNode.cs b/Nodes/ClassInstanceArrayNode.cs deleted file mode 100644 index 13bc1ce3..00000000 --- a/Nodes/ClassInstanceArrayNode.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using ReClassNET.UI; -using ReClassNET.Util; - -namespace ReClassNET.Nodes -{ - public class ClassInstanceArrayNode : BaseArrayNode - { - /// Size of the node in bytes. - public override int MemorySize => InnerNode.MemorySize * Count; - - public override bool PerformCycleCheck => true; - - public override void Intialize() - { - InnerNode = ClassNode.Create(); - InnerNode.Intialize(); - } - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return Draw(view, x, y, "Array", HotSpotType.ChangeType); - } - - protected override int DrawChild(ViewInfo view, int x, int y) - { - var v = view.Clone(); - v.Address = view.Address.Add(Offset) + InnerNode.MemorySize * CurrentIndex; - v.Memory = view.Memory.Clone(); - v.Memory.Offset = Offset.ToInt32() + InnerNode.MemorySize * CurrentIndex; - - return InnerNode.Draw(v, x, y); - } - - protected override int CalculateChildHeight(ViewInfo view) - { - return InnerNode.CalculateHeight(view); - } - } -} diff --git a/Nodes/ClassInstanceNode.cs b/Nodes/ClassInstanceNode.cs deleted file mode 100644 index 18f99998..00000000 --- a/Nodes/ClassInstanceNode.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using ReClassNET.UI; -using ReClassNET.Util; - -namespace ReClassNET.Nodes -{ - public class ClassInstanceNode : BaseReferenceNode - { - /// Size of the node in bytes. - public override int MemorySize => InnerNode.MemorySize; - - public override bool PerformCycleCheck => true; - - public override void Intialize() - { - InnerNode = ClassNode.Create(); - InnerNode.Intialize(); - } - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - if (IsHidden) - { - return DrawHidden(view, x, y); - } - - AddSelection(view, x, y, view.Font.Height); - AddDelete(view, x, y); - AddTypeDrop(view, x, y); - - x = AddOpenClose(view, x, y); - x = AddIcon(view, x, y, Icons.Class, -1, HotSpotType.None); - - var tx = x; - x = AddAddressOffset(view, x, y); - - x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, "Instance") + view.Font.Width; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name); - x = AddText(view, x, y, Program.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>"); - x = AddIcon(view, x, y, Icons.Change, 4, HotSpotType.ChangeType); - - x += view.Font.Width; - AddComment(view, x, y); - - y += view.Font.Height; - - if (levelsOpen[view.Level]) - { - var v = view.Clone(); - v.Address = view.Address.Add(Offset); - v.Memory = view.Memory.Clone(); - v.Memory.Offset = Offset.ToInt32(); - - y = InnerNode.Draw(v, tx, y); - } - - return y; - } - - public override int CalculateHeight(ViewInfo view) - { - if (IsHidden) - { - return HiddenHeight; - } - - var h = view.Font.Height; - if (levelsOpen[view.Level]) - { - h += InnerNode.CalculateHeight(view); - } - return h; - } - } -} diff --git a/Nodes/ClassNode.cs b/Nodes/ClassNode.cs deleted file mode 100644 index 2981e605..00000000 --- a/Nodes/ClassNode.cs +++ /dev/null @@ -1,229 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using System.Drawing; -using System.Linq; -using ReClassNET.AddressParser; -using ReClassNET.Memory; -using ReClassNET.UI; -using ReClassNET.Util; - -namespace ReClassNET.Nodes -{ - public delegate void ClassCreatedEventHandler(ClassNode node); - - public class ClassNode : BaseContainerNode - { - public static event ClassCreatedEventHandler ClassCreated; - - /// Size of the node in bytes. - public override int MemorySize => Nodes.Sum(n => n.MemorySize); - - private NodeUuid uuid; - public NodeUuid Uuid - { - get { return uuid; } - set - { - Contract.Requires(uuid != null); - - uuid = value; - } - } - - public IntPtr Address - { - set - { - Contract.Ensures(AddressFormula != null); - - AddressFormula = value.ToString("X"); - } - } - - public string AddressFormula { get; set; } - - public event NodeEventHandler NodesChanged; - - internal ClassNode(bool notifyClassCreated) - { - Contract.Ensures(AddressFormula != null); - - Uuid = new NodeUuid(true); - -#if WIN64 - Address = (IntPtr)0x140000000; -#else - Address = (IntPtr)0x400000; -#endif - - if (notifyClassCreated) - { - ClassCreated?.Invoke(this); - } - } - - public static ClassNode Create() - { - return new ClassNode(true); - } - - public override void Intialize() - { - AddBytes(IntPtr.Size); - } - - public override void ClearSelection() - { - base.ClearSelection(); - - foreach (var node in Nodes) - { - node.ClearSelection(); - } - } - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - AddSelection(view, 0, y, view.Font.Height); - x = AddOpenClose(view, x, y); - - var tx = x; - - x = AddIcon(view, x, y, Icons.Class, -1, HotSpotType.None); - x = AddText(view, x, y, Program.Settings.OffsetColor, 0, AddressFormula) + view.Font.Width; - - x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, "Class") + view.Font.Width; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; - x = AddText(view, x, y, Program.Settings.ValueColor, HotSpot.NoneId, $"[{MemorySize}]") + view.Font.Width; - x = AddComment(view, x, y); - - y += view.Font.Height; - if (levelsOpen[view.Level]) - { - var nv = view.Clone(); - nv.Level++; - foreach (var node in Nodes) - { - // If the node is in the visible area draw it. - if (view.ClientArea.Contains(tx, y)) - { - y = node.Draw(nv, tx, y); - } - else - { - // Otherwise calculate the height... - var height = node.CalculateHeight(nv); - - // and check if the nodes area overlaps with the visible area... - if (new Rectangle(tx, y, view.ClientArea.Width, height).IntersectsWith(view.ClientArea)) - { - // then draw the node... - y = node.Draw(nv, tx, y); - } - else - { - // or skip drawing and just add the height. - y += height; - } - } - } - } - - return y; - } - - public override int CalculateHeight(ViewInfo view) - { - if (IsHidden) - { - return HiddenHeight; - } - - var h = view.Font.Height; - if (levelsOpen[view.Level]) - { - var nv = view.Clone(); - nv.Level++; - h += Nodes.Sum(n => n.CalculateHeight(nv)); - } - return h; - } - - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id == 0) - { - Offset = spot.Memory.Process.ParseAddress(spot.Text); - - AddressFormula = spot.Text; - } - } - - public void UpdateAddress(MemoryBuffer memory) - { - Contract.Requires(memory != null); - - try - { - Offset = memory.Process.ParseAddress(AddressFormula); - } - catch (ParseException) - { - Offset = IntPtr.Zero; - } - } - - public override void InsertBytes(int index, int size) - { - base.InsertBytes(index, size); - - ChildHasChanged(null); - } - - public override void InsertNode(int index, BaseNode node) - { - if (node is ClassNode || node is VMethodNode) - { - return; - } - - base.InsertNode(index, node); - - ChildHasChanged(node); - } - - public override bool RemoveNode(BaseNode node) - { - var removed = base.RemoveNode(node); - if (removed) - { - UpdateOffsets(); - - ChildHasChanged(node); - } - return removed; - } - - public override bool ReplaceChildNode(int index, BaseNode node) - { - var replaced = base.ReplaceChildNode(index, node); - if (replaced) - { - ChildHasChanged(node); - } - return replaced; - } - - protected internal override void ChildHasChanged(BaseNode child) - { - NodesChanged?.Invoke(this); - } - } -} diff --git a/Nodes/ClassPtrArrayNode.cs b/Nodes/ClassPtrArrayNode.cs deleted file mode 100644 index d65943c0..00000000 --- a/Nodes/ClassPtrArrayNode.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using ReClassNET.Memory; -using ReClassNET.UI; -using ReClassNET.Util; - -namespace ReClassNET.Nodes -{ - public class ClassPtrArrayNode : BaseArrayNode - { - private readonly MemoryBuffer memory = new MemoryBuffer(); - - /// Size of the node in bytes. - public override int MemorySize => IntPtr.Size * Count; - - public override bool PerformCycleCheck => true; - - public override void Intialize() - { - var node = ClassNode.Create(); - node.Intialize(); - node.AddBytes(64); - InnerNode = node; - } - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return Draw(view, x, y, "PtrArray", HotSpotType.ChangeType); - } - - protected override int DrawChild(ViewInfo view, int x, int y) - { - var ptr = view.Memory.ReadObject(Offset + InnerNode.MemorySize * CurrentIndex); - - memory.Size = InnerNode.MemorySize; - memory.Process = view.Memory.Process; - memory.Update(ptr); - - var v = view.Clone(); - v.Address = ptr; - v.Memory = memory; - - return InnerNode.Draw(v, x, y); - } - - protected override int CalculateChildHeight(ViewInfo view) - { - return InnerNode.CalculateHeight(view); - } - } -} diff --git a/Nodes/ClassPtrNode.cs b/Nodes/ClassPtrNode.cs deleted file mode 100644 index cca53dd3..00000000 --- a/Nodes/ClassPtrNode.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using ReClassNET.Memory; -using ReClassNET.UI; -using ReClassNET.Util; - -namespace ReClassNET.Nodes -{ - public class ClassPtrNode : BaseReferenceNode - { - private readonly MemoryBuffer memory = new MemoryBuffer(); - - /// Size of the node in bytes. - public override int MemorySize => IntPtr.Size; - - public override bool PerformCycleCheck => false; - - public override void Intialize() - { - var node = ClassNode.Create(); - node.Intialize(); - node.AddBytes(64); - InnerNode = node; - } - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - if (IsHidden) - { - return DrawHidden(view, x, y); - } - - AddSelection(view, x, y, view.Font.Height); - AddDelete(view, x, y); - AddTypeDrop(view, x, y); - - x = AddOpenClose(view, x, y); - x = AddIcon(view, x, y, Icons.Pointer, -1, HotSpotType.None); - - var tx = x; - x = AddAddressOffset(view, x, y); - - x = AddText(view, x, y, Program.Settings.TypeColor, HotSpot.NoneId, "Ptr") + view.Font.Width; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; - x = AddText(view, x, y, Program.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>"); - x = AddIcon(view, x, y, Icons.Change, 4, HotSpotType.ChangeType); - - x += view.Font.Width; - AddComment(view, x, y); - - y += view.Font.Height; - - if (levelsOpen[view.Level]) - { - var ptr = view.Memory.ReadObject(Offset); - - memory.Size = InnerNode.MemorySize; - memory.Process = view.Memory.Process; - memory.Update(ptr); - - var v = view.Clone(); - v.Address = ptr; - v.Memory = memory; - - y = InnerNode.Draw(v, tx, y); - } - - return y; - } - - public override int CalculateHeight(ViewInfo view) - { - if (IsHidden) - { - return HiddenHeight; - } - - var h = view.Font.Height; - if (levelsOpen[view.Level]) - { - h += InnerNode.CalculateHeight(view); - } - return h; - } - } -} diff --git a/Nodes/ClassUtil.cs b/Nodes/ClassUtil.cs deleted file mode 100644 index aad56da1..00000000 --- a/Nodes/ClassUtil.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.Linq; -using ReClassNET.Util; - -namespace ReClassNET.Nodes -{ - public class ClassUtil - { - internal static IEnumerable Classes; - - public static bool IsCycleFree(ClassNode parent, ClassNode check) - { - Contract.Requires(parent != null); - Contract.Requires(check != null); - - if (Classes == null) - { - return true; - } - - return IsCycleFree(parent, check, Classes); - } - - public static bool IsCycleFree(ClassNode parent, ClassNode check, IEnumerable classes) - { - Contract.Requires(parent != null); - Contract.Requires(check != null); - Contract.Requires(classes != null); - Contract.Requires(Contract.ForAll(classes, c => c != null)); - - var toCheck = new HashSet( - check.Yield() - .Traverse( - c => c.Nodes - .Where(n => n is ClassInstanceNode || n is ClassInstanceArrayNode) - .Select(n => ((BaseReferenceNode)n).InnerNode as ClassNode) - ) - ); - - if (!IsCycleFree(parent, toCheck, classes)) - { - return false; - } - - return true; - } - - private static bool IsCycleFree(ClassNode root, HashSet seen, IEnumerable classes) - { - Contract.Requires(root != null); - Contract.Requires(seen != null); - Contract.Requires(Contract.ForAll(seen, c => c != null)); - Contract.Requires(Contract.ForAll(classes, c => c != null)); - - if (!seen.Add(root)) - { - return false; - } - - foreach (var cls in classes/*.Except(seen)*/) - { - if (cls.Nodes - .OfType() - .Where(n => n is ClassInstanceNode || n is ClassInstanceArrayNode) - .Where(n => n.InnerNode == root) - .Any()) - { - if (!IsCycleFree(cls, seen, classes)) - { - return false; - } - } - } - - return true; - } - } -} diff --git a/Nodes/DoubleNode.cs b/Nodes/DoubleNode.cs deleted file mode 100644 index 37b38309..00000000 --- a/Nodes/DoubleNode.cs +++ /dev/null @@ -1,36 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class DoubleNode : BaseNumericNode - { - /// Size of the node in bytes. - public override int MemorySize => 8; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return DrawNumeric(view, x, y, Icons.Double, "Double", view.Memory.ReadObject(Offset).ToString("0.000")); - } - - /// Updates the node from the given spot. Sets the value of the node. - /// The spot. - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id == 0) - { - double val; - if (double.TryParse(spot.Text, out val)) - { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); - } - } - } - } -} diff --git a/Nodes/FloatNode.cs b/Nodes/FloatNode.cs deleted file mode 100644 index 2ba889a2..00000000 --- a/Nodes/FloatNode.cs +++ /dev/null @@ -1,36 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class FloatNode : BaseNumericNode - { - /// Size of the node in bytes. - public override int MemorySize => 4; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return DrawNumeric(view, x, y, Icons.Float, "Float", view.Memory.ReadObject(Offset).ToString("0.000")); - } - - /// Updates the node from the given spot. Sets the value of the node. - /// The spot. - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id == 0) - { - float val; - if (float.TryParse(spot.Text, out val)) - { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); - } - } - } - } -} diff --git a/Nodes/FunctionPtrNode.cs b/Nodes/FunctionPtrNode.cs deleted file mode 100644 index f25b8a83..00000000 --- a/Nodes/FunctionPtrNode.cs +++ /dev/null @@ -1,17 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class FunctionPtrNode : BaseFunctionPtrNode - { - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return Draw(view, x, y, "Function", Name); - } - } -} diff --git a/Nodes/Hex16Node.cs b/Nodes/Hex16Node.cs deleted file mode 100644 index 2b08cd99..00000000 --- a/Nodes/Hex16Node.cs +++ /dev/null @@ -1,37 +0,0 @@ -using ReClassNET.Memory; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Hex16Node : BaseHexNode - { - /// Size of the node in bytes. - public override int MemorySize => 2; - - /// Gets informations about this node to show in a tool tip. - /// The spot. - /// The process memory. - /// The information to show in a tool tip. - public override string GetToolTipText(HotSpot spot, MemoryBuffer memory) - { - var value = memory.ReadObject(Offset); - - return $"Int16: {value.ShortValue}\nUInt16: 0x{value.UShortValue:X04}"; - } - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return Draw(view, x, y, Program.Settings.ShowNodeText ? view.Memory.ReadPrintableASCIIString(Offset, 2) + " " : null, 2); - } - - public override void Update(HotSpot spot) - { - Update(spot, 2); - } - } -} diff --git a/Nodes/Hex32Node.cs b/Nodes/Hex32Node.cs deleted file mode 100644 index 722b2064..00000000 --- a/Nodes/Hex32Node.cs +++ /dev/null @@ -1,48 +0,0 @@ -using ReClassNET.Memory; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Hex32Node : BaseHexCommentNode - { - /// Size of the node in bytes. - public override int MemorySize => 4; - - /// Gets informations about this node to show in a tool tip. - /// The spot. - /// The process memory. - /// The information to show in a tool tip. - public override string GetToolTipText(HotSpot spot, MemoryBuffer memory) - { - var value = memory.ReadObject(Offset); - - return $"Int32: {value.IntValue}\nUInt32: 0x{value.UIntValue:X08}\nFloat: {value.FloatValue:0.000}"; - } - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return Draw(view, x, y, Program.Settings.ShowNodeText ? view.Memory.ReadPrintableASCIIString(Offset, 4) + " " : null, 4); - } - - public override void Update(HotSpot spot) - { - Update(spot, 4); - } - - protected override int AddComment(ViewInfo view, int x, int y) - { - x = base.AddComment(view, x, y); - - var value = view.Memory.ReadObject(Offset); - - x = AddComment(view, x, y, value.FloatValue, value.IntPtr, value.UIntPtr); - - return x; - } - } -} diff --git a/Nodes/Hex64Node.cs b/Nodes/Hex64Node.cs deleted file mode 100644 index dae67233..00000000 --- a/Nodes/Hex64Node.cs +++ /dev/null @@ -1,48 +0,0 @@ -using ReClassNET.Memory; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Hex64Node : BaseHexCommentNode - { - /// Size of the node in bytes. - public override int MemorySize => 8; - - /// Gets informations about this node to show in a tool tip. - /// The spot. - /// The process memory. - /// The information to show in a tool tip. - public override string GetToolTipText(HotSpot spot, MemoryBuffer memory) - { - var value = memory.ReadObject(Offset); - - return $"Int64: {value.LongValue}\nUInt64: 0x{value.ULongValue:X016}\nFloat: {value.FloatValue:0.000}\nDouble: {value.DoubleValue:0.000}"; - } - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return Draw(view, x, y, Program.Settings.ShowNodeText ? view.Memory.ReadPrintableASCIIString(Offset, 8) + " " : null, 8); - } - - public override void Update(HotSpot spot) - { - Update(spot, 8); - } - - protected override int AddComment(ViewInfo view, int x, int y) - { - x = base.AddComment(view, x, y); - - var value = view.Memory.ReadObject(Offset); - - x = AddComment(view, x, y, value.FloatValue, value.IntPtr, value.UIntPtr); - - return x; - } - } -} diff --git a/Nodes/Hex8Node.cs b/Nodes/Hex8Node.cs deleted file mode 100644 index a8adf075..00000000 --- a/Nodes/Hex8Node.cs +++ /dev/null @@ -1,37 +0,0 @@ -using ReClassNET.Memory; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Hex8Node : BaseHexNode - { - /// Size of the node in bytes. - public override int MemorySize => 1; - - /// Gets informations about this node to show in a tool tip. - /// The spot. - /// The process memory. - /// The information to show in a tool tip. - public override string GetToolTipText(HotSpot spot, MemoryBuffer memory) - { - var b = memory.ReadByte(Offset); - - return $"Int8: {(int)b}\nUInt8: 0x{b:X02}"; - } - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return Draw(view, x, y, Program.Settings.ShowNodeText ? view.Memory.ReadPrintableASCIIString(Offset, 1) + " " : null, 1); - } - - public override void Update(HotSpot spot) - { - Update(spot, 1); - } - } -} diff --git a/Nodes/INodeInfoReader.cs b/Nodes/INodeInfoReader.cs deleted file mode 100644 index a9c212c6..00000000 --- a/Nodes/INodeInfoReader.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using ReClassNET.Memory; - -namespace ReClassNET.Nodes -{ - public interface INodeInfoReader - { - string ReadNodeInfo(BaseNode node, IntPtr value, MemoryBuffer memory); - } -} diff --git a/Nodes/Int16Node.cs b/Nodes/Int16Node.cs deleted file mode 100644 index c11a3ddc..00000000 --- a/Nodes/Int16Node.cs +++ /dev/null @@ -1,36 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Int16Node : BaseNumericNode - { - /// Size of the node in bytes. - public override int MemorySize => 2; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return DrawNumeric(view, x, y, Icons.Signed, "Int16", view.Memory.ReadObject(Offset).ToString()); - } - - /// Updates the node from the given spot. Sets the value of the node. - /// The spot. - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id == 0) - { - short val; - if (short.TryParse(spot.Text, out val)) - { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); - } - } - } - } -} diff --git a/Nodes/Int32Node.cs b/Nodes/Int32Node.cs deleted file mode 100644 index 2db94bc8..00000000 --- a/Nodes/Int32Node.cs +++ /dev/null @@ -1,36 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Int32Node : BaseNumericNode - { - /// Size of the node in bytes. - public override int MemorySize => 4; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return DrawNumeric(view, x, y, Icons.Signed, "Int32", view.Memory.ReadObject(Offset).ToString()); - } - - /// Updates the node from the given spot. Sets the value of the node. - /// The spot. - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id == 0) - { - int val; - if (int.TryParse(spot.Text, out val)) - { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); - } - } - } - } -} diff --git a/Nodes/Int64Node.cs b/Nodes/Int64Node.cs deleted file mode 100644 index 7b92a61b..00000000 --- a/Nodes/Int64Node.cs +++ /dev/null @@ -1,36 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Int64Node : BaseNumericNode - { - /// Size of the node in bytes. - public override int MemorySize => 8; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return DrawNumeric(view, x, y, Icons.Signed, "Int64", view.Memory.ReadObject(Offset).ToString()); - } - - /// Updates the node from the given spot. Sets the value of the node. - /// The spot. - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id == 0) - { - long val; - if (long.TryParse(spot.Text, out val)) - { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); - } - } - } - } -} diff --git a/Nodes/Int8Node.cs b/Nodes/Int8Node.cs deleted file mode 100644 index 2bf32eba..00000000 --- a/Nodes/Int8Node.cs +++ /dev/null @@ -1,36 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Int8Node : BaseNumericNode - { - /// Size of the node in bytes. - public override int MemorySize => 1; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height th node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return DrawNumeric(view, x, y, Icons.Signed, "Int8", view.Memory.ReadObject(Offset).ToString()); - } - - /// Updates the node from the given spot. Sets the value of the node. - /// The spot. - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id == 0) - { - sbyte val; - if (sbyte.TryParse(spot.Text, out val)) - { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); - } - } - } - } -} diff --git a/Nodes/Matrix3x3Node.cs b/Nodes/Matrix3x3Node.cs deleted file mode 100644 index 17f2b22e..00000000 --- a/Nodes/Matrix3x3Node.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Matrix3x3Node : BaseMatrixNode - { - [StructLayout(LayoutKind.Explicit)] - struct Matrix3x3Data - { - [FieldOffset(0)] - public float _11; - [FieldOffset(4)] - public float _12; - [FieldOffset(8)] - public float _13; - [FieldOffset(12)] - public float _21; - [FieldOffset(16)] - public float _22; - [FieldOffset(20)] - public float _23; - [FieldOffset(24)] - public float _31; - [FieldOffset(28)] - public float _32; - [FieldOffset(32)] - public float _33; - } - - /// Size of the node in bytes. - public override int MemorySize => 9 * 4; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x2, int y2) - { - return DrawMatrixType(view, x2, y2, "Matrix (3x3)", (ref int x, ref int y, int defaultX) => - { - var value = view.Memory.ReadObject(Offset); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, Program.Settings.ValueColor, 0, $"{value._11,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 1, $"{value._12,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 2, $"{value._13,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, Program.Settings.ValueColor, 3, $"{value._21,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 4, $"{value._22,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 5, $"{value._23,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, Program.Settings.ValueColor, 6, $"{value._31,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 7, $"{value._32,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 8, $"{value._33,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - }); - } - - protected override int CalculateValuesHeight(ViewInfo view) - { - return 3 * view.Font.Height; - } - - public override void Update(HotSpot spot) - { - base.Update(spot); - - Update(spot, 9); - } - } -} diff --git a/Nodes/Matrix3x4Node.cs b/Nodes/Matrix3x4Node.cs deleted file mode 100644 index 92e830f7..00000000 --- a/Nodes/Matrix3x4Node.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System.Runtime.InteropServices; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Matrix3x4Node : BaseMatrixNode - { - [StructLayout(LayoutKind.Explicit)] - struct Matrix3x4Data - { - [FieldOffset(0)] - public float _11; - [FieldOffset(4)] - public float _12; - [FieldOffset(8)] - public float _13; - [FieldOffset(12)] - public float _14; - [FieldOffset(16)] - public float _21; - [FieldOffset(20)] - public float _22; - [FieldOffset(24)] - public float _23; - [FieldOffset(28)] - public float _24; - [FieldOffset(32)] - public float _31; - [FieldOffset(36)] - public float _32; - [FieldOffset(40)] - public float _33; - [FieldOffset(44)] - public float _34; - } - - /// Size of the node in bytes. - public override int MemorySize => 12 * 4; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x2, int y2) - { - return DrawMatrixType(view, x2, y2, "Matrix (3x4)", (ref int x, ref int y, int defaultX) => - { - var value = view.Memory.ReadObject(Offset); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, Program.Settings.ValueColor, 0, $"{value._11,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 1, $"{value._12,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 2, $"{value._13,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 3, $"{value._14,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, Program.Settings.ValueColor, 4, $"{value._21,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 5, $"{value._22,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 6, $"{value._23,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 7, $"{value._24,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, Program.Settings.ValueColor, 8, $"{value._31,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 9, $"{value._32,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 10, $"{value._33,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 11, $"{value._34,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - }); - } - - protected override int CalculateValuesHeight(ViewInfo view) - { - return 3 * view.Font.Height; - } - - public override void Update(HotSpot spot) - { - base.Update(spot); - - Update(spot, 12); - } - } -} diff --git a/Nodes/Matrix4x4Node.cs b/Nodes/Matrix4x4Node.cs deleted file mode 100644 index 6a5a8a28..00000000 --- a/Nodes/Matrix4x4Node.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System.Runtime.InteropServices; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Matrix4x4Node : BaseMatrixNode - { - [StructLayout(LayoutKind.Explicit)] - struct Matrix4x4Data - { - [FieldOffset(0)] - public float _11; - [FieldOffset(4)] - public float _12; - [FieldOffset(8)] - public float _13; - [FieldOffset(12)] - public float _14; - [FieldOffset(16)] - public float _21; - [FieldOffset(20)] - public float _22; - [FieldOffset(24)] - public float _23; - [FieldOffset(28)] - public float _24; - [FieldOffset(32)] - public float _31; - [FieldOffset(36)] - public float _32; - [FieldOffset(40)] - public float _33; - [FieldOffset(44)] - public float _34; - [FieldOffset(48)] - public float _41; - [FieldOffset(52)] - public float _42; - [FieldOffset(56)] - public float _43; - [FieldOffset(60)] - public float _44; - } - - /// Size of the node in bytes. - public override int MemorySize => 16 * 4; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x2, int y2) - { - return DrawMatrixType(view, x2, y2, "Matrix (4x4)", (ref int x, ref int y, int defaultX) => - { - var value = view.Memory.ReadObject(Offset); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, Program.Settings.ValueColor, 0, $"{value._11,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 1, $"{value._12,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 2, $"{value._13,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 3, $"{value._14,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, Program.Settings.ValueColor, 4, $"{value._21,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 5, $"{value._22,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 6, $"{value._23,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 7, $"{value._24,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, Program.Settings.ValueColor, 8, $"{value._31,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 9, $"{value._32,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 10, $"{value._33,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 11, $"{value._34,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - - y += view.Font.Height; - x = defaultX; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - x = AddText(view, x, y, Program.Settings.ValueColor, 12, $"{value._41,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 13, $"{value._42,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 14, $"{value._43,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 15, $"{value._44,14:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "|"); - }); - } - - protected override int CalculateValuesHeight(ViewInfo view) - { - return 4 * view.Font.Height; - } - - public override void Update(HotSpot spot) - { - base.Update(spot); - - Update(spot, 16); - } - } -} diff --git a/Nodes/NodeUuid.cs b/Nodes/NodeUuid.cs deleted file mode 100644 index 95ac5546..00000000 --- a/Nodes/NodeUuid.cs +++ /dev/null @@ -1,206 +0,0 @@ -using System; -using System.Diagnostics.Contracts; - -namespace ReClassNET.Nodes -{ - public sealed class NodeUuid : IComparable, IEquatable - { - /// Size in bytes of a UUID. - public const int UuidSize = 16; - - /// Zero UUID (all bytes are zero). - public static readonly NodeUuid Zero = new NodeUuid(false); - - /// The maximum reserved UUID value. - private static readonly NodeUuid MaxReserved = new NodeUuid(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF }); - - /// Checks if the given UUID is reserved. - /// The uuid. - /// True if reserved, false if not. - public static bool IsReserved(NodeUuid uuid) - { - Contract.Requires(uuid != null); - - return uuid.CompareTo(MaxReserved) <= 0; - } - - private byte[] uuidBytes; - - /// Get the 16 UUID bytes. - public byte[] UuidBytes => uuidBytes; - - /// Construct a new UUID object. - /// If this parameter is true, a new UUID is generated. - /// If it is false, the UUID is initialized to zero. - public NodeUuid(bool createNew) - { - Contract.Ensures(uuidBytes != null); - - if (createNew) - { - CreateNew(); - } - else - { - SetZero(); - } - } - - /// Construct a new UUID object. - /// Initial value of the object. - public NodeUuid(byte[] valueBytes) - { - Contract.Requires(uuidBytes == null); - Contract.Requires(valueBytes != null); - Contract.Requires(valueBytes.Length == UuidSize); - Contract.Ensures(uuidBytes != null); - - SetValue(valueBytes); - } - - public static NodeUuid FromBase64String(string base64, bool createNew) - { - try - { - if (base64 != null) - { - var bytes = Convert.FromBase64String(base64); - - if (bytes.Length == UuidSize) - { - return new NodeUuid(bytes); - } - } - } - catch (ArgumentNullException) - { - - } - - return new NodeUuid(createNew); - } - - /// Create a new, random UUID. - /// Returns true if a random UUID has been generated, otherwise it returns false. - private void CreateNew() - { - Contract.Requires(uuidBytes == null); - Contract.Ensures(uuidBytes != null); - - while (true) - { - uuidBytes = Guid.NewGuid().ToByteArray(); - - if (uuidBytes == null || uuidBytes.Length != UuidSize) - { - throw new InvalidOperationException(); - } - - // Do not generate reserved UUIDs. - if (!IsReserved(this)) - { - break; - } - } - } - - /// Sets the UUID to the given value. - /// Initial value of the object. - private void SetValue(byte[] valueBytes) - { - Contract.Requires(uuidBytes == null); - Contract.Requires(valueBytes != null); - Contract.Requires(valueBytes.Length == UuidSize); - Contract.Ensures(uuidBytes != null); - - uuidBytes = new byte[UuidSize]; - - Array.Copy(valueBytes, uuidBytes, UuidSize); - } - - /// Sets the UUID to zero. - private void SetZero() - { - Contract.Requires(uuidBytes == null); - Contract.Ensures(uuidBytes != null); - - uuidBytes = new byte[UuidSize]; - } - - public override bool Equals(object obj) - { - return Equals(obj as NodeUuid); - } - - public bool Equals(NodeUuid other) - { - if (other == null) - { - return false; - } - - for (int i = 0; i < UuidSize; ++i) - { - if (uuidBytes[i] != other.uuidBytes[i]) - { - return false; - } - } - - return true; - } - - private int hash = 0; - public override int GetHashCode() - { - if (hash == 0) - { - unchecked - { - hash = 17; - foreach (var b in uuidBytes) - { - hash = hash * 31 + b.GetHashCode(); - } - } - } - return hash; - } - - public int CompareTo(NodeUuid other) - { - Contract.Requires(other != null); - - for (int i = 0; i < UuidSize; ++i) - { - if (uuidBytes[i] < other.uuidBytes[i]) - { - return -1; - } - if (uuidBytes[i] > other.uuidBytes[i]) - { - return 1; - } - } - - return 0; - } - - public string ToBase64String() - { - return Convert.ToBase64String(uuidBytes); - } - - /// Convert the UUID to its string representation. - /// String containing the UUID value. - public string ToHexString() - { - return BitConverter.ToString(uuidBytes).Replace("-", string.Empty); - } - - public override string ToString() - { - return ToHexString(); - } - } -} diff --git a/Nodes/UInt16Node.cs b/Nodes/UInt16Node.cs deleted file mode 100644 index 9e821977..00000000 --- a/Nodes/UInt16Node.cs +++ /dev/null @@ -1,36 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class UInt16Node : BaseNumericNode - { - /// Size of the node in bytes. - public override int MemorySize => 2; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return DrawNumeric(view, x, y, Icons.Unsigned, "UInt16", view.Memory.ReadObject(Offset).ToString()); - } - - /// Updates the node from the given spot. Sets the value of the node. - /// The spot. - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id == 0) - { - ushort val; - if (ushort.TryParse(spot.Text, out val)) - { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); - } - } - } - } -} diff --git a/Nodes/UInt32Node.cs b/Nodes/UInt32Node.cs deleted file mode 100644 index 82f026a3..00000000 --- a/Nodes/UInt32Node.cs +++ /dev/null @@ -1,36 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class UInt32Node : BaseNumericNode - { - /// Size of the node in bytes. - public override int MemorySize => 4; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return DrawNumeric(view, x, y, Icons.Unsigned, "UInt32", view.Memory.ReadObject(Offset).ToString()); - } - - /// Updates the node from the given spot. Sets the value of the node. - /// The spot. - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id == 0) - { - uint val; - if (uint.TryParse(spot.Text, out val)) - { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); - } - } - } - } -} diff --git a/Nodes/UInt64Node.cs b/Nodes/UInt64Node.cs deleted file mode 100644 index f6f8b1cd..00000000 --- a/Nodes/UInt64Node.cs +++ /dev/null @@ -1,36 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class UInt64Node : BaseNumericNode - { - /// Size of the node in bytes. - public override int MemorySize => 8; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return DrawNumeric(view, x, y, Icons.Unsigned, "UInt64", view.Memory.ReadObject(Offset).ToString()); - } - - /// Updates the node from the given spot. Sets the value of the node. - /// The spot. - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id == 0) - { - ulong val; - if (ulong.TryParse(spot.Text, out val)) - { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); - } - } - } - } -} diff --git a/Nodes/UInt8Node.cs b/Nodes/UInt8Node.cs deleted file mode 100644 index fd9ed1a9..00000000 --- a/Nodes/UInt8Node.cs +++ /dev/null @@ -1,36 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class UInt8Node : BaseNumericNode - { - /// Size of the node in bytes. - public override int MemorySize => 1; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return DrawNumeric(view, x, y, Icons.Unsigned, "UInt8", view.Memory.ReadByte(Offset).ToString()); - } - - /// Updates the node from the given spot. Sets the value of the node. - /// The spot. - public override void Update(HotSpot spot) - { - base.Update(spot); - - if (spot.Id == 0) - { - byte val; - if (byte.TryParse(spot.Text, out val)) - { - spot.Memory.Process.WriteRemoteMemory(spot.Address, val); - } - } - } - } -} diff --git a/Nodes/UTF16TextNode.cs b/Nodes/UTF16TextNode.cs deleted file mode 100644 index 6afe1235..00000000 --- a/Nodes/UTF16TextNode.cs +++ /dev/null @@ -1,19 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class UTF16TextNode : BaseTextNode - { - public override int CharacterSize => 2; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return DrawText(view, x, y, "Text16", MemorySize / CharacterSize, view.Memory.ReadUTF16String(Offset, MemorySize)); - } - } -} diff --git a/Nodes/UTF16TextPtrNode.cs b/Nodes/UTF16TextPtrNode.cs deleted file mode 100644 index f1117988..00000000 --- a/Nodes/UTF16TextPtrNode.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Text; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class UTF16TextPtrNode : BaseTextPtrNode - { - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - var ptr = view.Memory.ReadObject(Offset); - var str = view.Memory.Process.ReadRemoteString(Encoding.Unicode, ptr, 128); - - return DrawText(view, x, y, "Text16Ptr", MemorySize, str); - } - } -} diff --git a/Nodes/UTF32TextNode.cs b/Nodes/UTF32TextNode.cs deleted file mode 100644 index 3b93dea4..00000000 --- a/Nodes/UTF32TextNode.cs +++ /dev/null @@ -1,19 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class UTF32TextNode : BaseTextNode - { - public override int CharacterSize => 4; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return DrawText(view, x, y, "Text32", MemorySize / CharacterSize, view.Memory.ReadUTF32String(Offset, MemorySize)); - } - } -} diff --git a/Nodes/UTF32TextPtrNode.cs b/Nodes/UTF32TextPtrNode.cs deleted file mode 100644 index 641aaa79..00000000 --- a/Nodes/UTF32TextPtrNode.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Text; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class UTF32TextPtrNode : BaseTextPtrNode - { - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - var ptr = view.Memory.ReadObject(Offset); - var str = view.Memory.Process.ReadRemoteString(Encoding.UTF32, ptr, 256); - - return DrawText(view, x, y, "Text32Ptr", MemorySize, str); - } - } -} diff --git a/Nodes/UTF8TextNode.cs b/Nodes/UTF8TextNode.cs deleted file mode 100644 index 3e314f92..00000000 --- a/Nodes/UTF8TextNode.cs +++ /dev/null @@ -1,19 +0,0 @@ -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class UTF8TextNode : BaseTextNode - { - public override int CharacterSize => 1; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return DrawText(view, x, y, "Text8", MemorySize, view.Memory.ReadUTF8String(Offset, MemorySize)); - } - } -} diff --git a/Nodes/UTF8TextPtrNode.cs b/Nodes/UTF8TextPtrNode.cs deleted file mode 100644 index 1c74fea1..00000000 --- a/Nodes/UTF8TextPtrNode.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Text; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class UTF8TextPtrNode : BaseTextPtrNode - { - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - var ptr = view.Memory.ReadObject(Offset); - var str = view.Memory.Process.ReadRemoteString(Encoding.UTF8, ptr, 64); - - return DrawText(view, x, y, "Text8Ptr", MemorySize, str); - } - } -} diff --git a/Nodes/VMethodNode.cs b/Nodes/VMethodNode.cs deleted file mode 100644 index 8f95df91..00000000 --- a/Nodes/VMethodNode.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class VMethodNode : BaseFunctionPtrNode - { - public string MethodName => string.IsNullOrEmpty(Name) ? $"Function{Offset.ToInt32() / IntPtr.Size}" : Name; - - public VMethodNode() - { - Contract.Ensures(Name != null); - - Name = string.Empty; - } - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - return Draw(view, x, y, $"({Offset.ToInt32() / IntPtr.Size})", MethodName); - } - } -} diff --git a/Nodes/VTableNode.cs b/Nodes/VTableNode.cs deleted file mode 100644 index 5d937ff5..00000000 --- a/Nodes/VTableNode.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Linq; -using ReClassNET.Memory; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class VTableNode : BaseContainerNode - { - private readonly MemoryBuffer memory = new MemoryBuffer(); - - /// Size of the node in bytes. - public override int MemorySize => IntPtr.Size; - - public override void Intialize() - { - InsertBytes(0, 10 * IntPtr.Size); - } - - public override void ClearSelection() - { - base.ClearSelection(); - - foreach (var node in nodes) - { - node.ClearSelection(); - } - } - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x, int y) - { - if (IsHidden) - { - return DrawHidden(view, x, y); - } - - AddSelection(view, x, y, view.Font.Height); - AddDelete(view, x, y); - AddTypeDrop(view, x, y); - - x = AddOpenClose(view, x, y); - x = AddIcon(view, x, y, Icons.VTable, -1, HotSpotType.None); - - var tx = x; - x = AddAddressOffset(view, x, y); - - x = AddText(view, x, y, Program.Settings.VTableColor, HotSpot.NoneId, $"VTable[{nodes.Count}]") + view.Font.Width; - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; - - AddComment(view, x, y); - - y += view.Font.Height; - - if (levelsOpen[view.Level]) - { - var ptr = view.Memory.ReadObject(Offset); - - memory.Size = nodes.Count * IntPtr.Size; - memory.Process = view.Memory.Process; - memory.Update(ptr); - - var v = view.Clone(); - v.Address = ptr; - v.Memory = memory; - - foreach (var node in nodes) - { - y = node.Draw(v, tx, y); - } - } - - return y; - } - - public override int CalculateHeight(ViewInfo view) - { - if (IsHidden) - { - return HiddenHeight; - } - - var h = view.Font.Height; - if (levelsOpen[view.Level]) - { - h += nodes.Sum(n => n.CalculateHeight(view)); - } - return h; - } - - public override bool ReplaceChildNode(int index, BaseNode node) => false; - - public override void InsertBytes(int index, int size) - { - if (index < 0 || index > nodes.Count || size == 0) - { - return; - } - - var offset = IntPtr.Zero; - if (index > 0) - { - var node = nodes[index - 1]; - offset = node.Offset + node.MemorySize; - } - - while (size > 0) - { - var node = new VMethodNode - { - Offset = offset, - ParentNode = this - }; - - nodes.Insert(index, node); - - offset += node.MemorySize; - size -= node.MemorySize; - - index++; - } - - UpdateOffsets(); - } - - public override void InsertNode(int index, BaseNode node) - { - if (!(node is VMethodNode)) - { - return; - } - - base.InsertNode(index, node); - - UpdateOffsets(); - } - - public override bool RemoveNode(BaseNode node) - { - var removed = base.RemoveNode(node); - if (removed) - { - UpdateOffsets(); - } - return removed; - } - } -} diff --git a/Nodes/Vector2Node.cs b/Nodes/Vector2Node.cs deleted file mode 100644 index 7876f0a6..00000000 --- a/Nodes/Vector2Node.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Runtime.InteropServices; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Vector2Node : BaseMatrixNode - { - [StructLayout(LayoutKind.Explicit)] - struct Vector2Data - { - [FieldOffset(0)] - public float X; - [FieldOffset(4)] - public float Y; - } - - /// Size of the node in bytes. - public override int MemorySize => 2 * 4; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x2, int y2) - { - return DrawVectorType(view, x2, y2, "Vector2", (ref int x, ref int y) => - { - var value = view.Memory.ReadObject(Offset); - - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "("); - x = AddText(view, x, y, Program.Settings.ValueColor, 0, $"{value.X:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 1, $"{value.Y:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ")"); - }); - } - - protected override int CalculateValuesHeight(ViewInfo view) - { - return 0; - } - - public override void Update(HotSpot spot) - { - base.Update(spot); - - Update(spot, 2); - } - } -} diff --git a/Nodes/Vector3Node.cs b/Nodes/Vector3Node.cs deleted file mode 100644 index ff3fc64e..00000000 --- a/Nodes/Vector3Node.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Runtime.InteropServices; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Vector3Node : BaseMatrixNode - { - [StructLayout(LayoutKind.Explicit)] - struct Vector3Data - { - [FieldOffset(0)] - public float X; - [FieldOffset(4)] - public float Y; - [FieldOffset(8)] - public float Z; - } - - /// Size of the node in bytes. - public override int MemorySize => 3 * 4; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x2, int y2) - { - return DrawVectorType(view, x2, y2, "Vector3", (ref int x, ref int y) => - { - var value = view.Memory.ReadObject(Offset); - - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "("); - x = AddText(view, x, y, Program.Settings.ValueColor, 0, $"{value.X:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 1, $"{value.Y:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 2, $"{value.Z:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ")"); - }); - } - - protected override int CalculateValuesHeight(ViewInfo view) - { - return 0; - } - - public override void Update(HotSpot spot) - { - base.Update(spot); - - Update(spot, 3); - } - } -} diff --git a/Nodes/Vector4Node.cs b/Nodes/Vector4Node.cs deleted file mode 100644 index c5b68d42..00000000 --- a/Nodes/Vector4Node.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Runtime.InteropServices; -using ReClassNET.UI; - -namespace ReClassNET.Nodes -{ - public class Vector4Node : BaseMatrixNode - { - [StructLayout(LayoutKind.Explicit)] - struct Vector4Data - { - [FieldOffset(0)] - public float X; - [FieldOffset(4)] - public float Y; - [FieldOffset(8)] - public float Z; - [FieldOffset(12)] - public float W; - } - - /// Size of the node in bytes. - public override int MemorySize => 4 * 4; - - /// Draws this node. - /// The view information. - /// The x coordinate. - /// The y coordinate. - /// The height the node occupies. - public override int Draw(ViewInfo view, int x2, int y2) - { - return DrawVectorType(view, x2, y2, "Vector4", (ref int x, ref int y) => - { - var value = view.Memory.ReadObject(Offset); - - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, "("); - x = AddText(view, x, y, Program.Settings.ValueColor, 0, $"{value.X:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 1, $"{value.Y:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 2, $"{value.Z:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ","); - x = AddText(view, x, y, Program.Settings.ValueColor, 3, $"{value.W:0.000}"); - x = AddText(view, x, y, Program.Settings.NameColor, HotSpot.NoneId, ")"); - }); - } - - protected override int CalculateValuesHeight(ViewInfo view) - { - return 0; - } - - public override void Update(HotSpot spot) - { - base.Update(spot); - - Update(spot, 4); - } - } -} diff --git a/Plugins/DefaultPluginHost.cs b/Plugins/DefaultPluginHost.cs deleted file mode 100644 index 29132697..00000000 --- a/Plugins/DefaultPluginHost.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using System.Drawing; -using System.Resources; -using ReClassNET.CodeGenerator; -using ReClassNET.DataExchange; -using ReClassNET.Forms; -using ReClassNET.Logger; -using ReClassNET.Memory; -using ReClassNET.Nodes; - -namespace ReClassNET.Plugins -{ - internal sealed class DefaultPluginHost : IPluginHost - { - public MainForm MainWindow { get; } - - public ResourceManager Resources => Properties.Resources.ResourceManager; - - public RemoteProcess Process { get; } - - public ILogger Logger { get; } - - public Settings Settings => Program.Settings; - - public DefaultPluginHost(MainForm form, RemoteProcess process, ILogger logger) - { - Contract.Requires(form != null); - Contract.Requires(process != null); - Contract.Requires(logger != null); - - MainWindow = form; - Process = process; - Logger = logger; - } - - public void RegisterNodeInfoReader(INodeInfoReader reader) - { - BaseNode.NodeInfoReader.Add(reader); - } - - public void DeregisterNodeInfoReader(INodeInfoReader reader) - { - BaseNode.NodeInfoReader.Remove(reader); - } - - public void RegisterNodeType(Type type, string name, Image icon, ICustomNodeConverter converter, ICustomCodeGenerator generator) - { - CustomNodeConvert.RegisterCustomType(converter); - CustomCodeGenerator.RegisterCustomType(generator); - - MainWindow.RegisterNodeType(type, name, icon ?? Properties.Resources.B16x16_Plugin); - } - - public void DeregisterNodeType(Type type, ICustomNodeConverter converter, ICustomCodeGenerator generator) - { - CustomNodeConvert.DeregisterCustomType(converter); - CustomCodeGenerator.DeregisterCustomType(generator); - - MainWindow.DeregisterNodeType(type); - } - } -} diff --git a/Plugins/IPluginHost.cs b/Plugins/IPluginHost.cs deleted file mode 100644 index 730cb17e..00000000 --- a/Plugins/IPluginHost.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using System.Drawing; -using System.Resources; -using ReClassNET.CodeGenerator; -using ReClassNET.DataExchange; -using ReClassNET.Forms; -using ReClassNET.Logger; -using ReClassNET.Memory; -using ReClassNET.Nodes; - -namespace ReClassNET.Plugins -{ - [ContractClass(typeof(IPluginHostContract))] - public interface IPluginHost - { - /// Gets the main window of ReClass.NET. - MainForm MainWindow { get; } - - /// Gets the resources of ReClass.NET. - ResourceManager Resources { get; } - - /// Gets the process ReClass.NET is attached to. - RemoteProcess Process { get; } - - /// Gets the logger ReClass.NET is using. - ILogger Logger { get; } - - /// Gets the settings ReClass.NET is using. - Settings Settings { get; } - - /// Registers a node information reader to display custom data on nodes. - /// The node information reader. - void RegisterNodeInfoReader(INodeInfoReader reader); - - /// Unregisters the node information reader. - /// The node information reader. - void DeregisterNodeInfoReader(INodeInfoReader reader); - - /// Registers a new node type. - /// The type of the node. - /// The name of the type. - /// The icon of the type (may be null). - /// The converter used to serialize the node. - /// The generator used to generate code from the node. - void RegisterNodeType(Type type, string name, Image icon, ICustomNodeConverter converter, ICustomCodeGenerator generator); - - /// Unregisters a node type. - /// The type of the node. - /// The converter used to serialize the node. - /// The generator used to generate code from the node. - void DeregisterNodeType(Type type, ICustomNodeConverter converter, ICustomCodeGenerator generator); - } - - [ContractClassFor(typeof(IPluginHost))] - internal abstract class IPluginHostContract : IPluginHost - { - public ILogger Logger - { - get - { - Contract.Ensures(Logger != null); - - throw new NotImplementedException(); - } - } - - public MainForm MainWindow - { - get - { - Contract.Ensures(MainWindow != null); - - throw new NotImplementedException(); - } - } - - public RemoteProcess Process - { - get - { - Contract.Ensures(Process != null); - - throw new NotImplementedException(); - } - } - - public ResourceManager Resources - { - get - { - Contract.Ensures(Resources != null); - - throw new NotImplementedException(); - } - } - - public Settings Settings - { - get - { - Contract.Ensures(Settings != null); - - throw new NotImplementedException(); - } - } - - public void RegisterNodeInfoReader(INodeInfoReader reader) - { - Contract.Requires(reader != null); - - throw new NotImplementedException(); - } - - public void RegisterNodeType(Type type, string name, Image icon, ICustomNodeConverter converter, ICustomCodeGenerator generator) - { - Contract.Requires(type != null); - Contract.Requires(name != null); - Contract.Requires(converter != null); - Contract.Requires(generator != null); - - throw new NotImplementedException(); - } - - public void DeregisterNodeInfoReader(INodeInfoReader reader) - { - Contract.Requires(reader != null); - - throw new NotImplementedException(); - } - - public void DeregisterNodeType(Type type, ICustomNodeConverter converter, ICustomCodeGenerator generator) - { - Contract.Requires(type != null); - Contract.Requires(converter != null); - Contract.Requires(generator != null); - - throw new NotImplementedException(); - } - } -} diff --git a/Plugins/Plugin.cs b/Plugins/Plugin.cs deleted file mode 100644 index b99173f5..00000000 --- a/Plugins/Plugin.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Diagnostics.Contracts; -using System.Drawing; - -namespace ReClassNET.Plugins -{ - public abstract class Plugin - { - public virtual Image Icon => null; - - public virtual bool Initialize(IPluginHost host) - { - Contract.Requires(host != null); - - return true; - } - - public virtual void Terminate() - { - - } - } -} diff --git a/Plugins/PluginManager.cs b/Plugins/PluginManager.cs deleted file mode 100644 index 32d04245..00000000 --- a/Plugins/PluginManager.cs +++ /dev/null @@ -1,178 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.Contracts; -using System.IO; -using System.Runtime.InteropServices; -using ReClassNET.Memory; -using ReClassNET.Util; -using ReClassNET.Logger; - -namespace ReClassNET.Plugins -{ - internal sealed class PluginManager : IEnumerable - { - private readonly List plugins = new List(); - - private readonly IPluginHost host = null; - private readonly NativeHelper nativeHelper; - - public PluginManager(IPluginHost host, NativeHelper nativeHelper) - { - Contract.Requires(host != null); - - this.host = host; - this.nativeHelper = nativeHelper; - } - - IEnumerator IEnumerable.GetEnumerator() - { - return plugins.GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return plugins.GetEnumerator(); - } - - public void LoadAllPlugins(string path, ILogger logger) - { - Contract.Requires(path != null); - Contract.Requires(logger != null); - - try - { - if (!Directory.Exists(path)) - { - return; - } - - var directory = new DirectoryInfo(path); - - LoadPlugins(directory.GetFiles("*.dll"), logger); - - LoadPlugins(directory.GetFiles("*.exe"), logger); - } - catch (Exception ex) - { - logger.Log(ex); - } - } - - private void LoadPlugins(IEnumerable files, ILogger logger) - { - Contract.Requires(files != null); - Contract.Requires(logger != null); - - foreach (var fi in files) - { - FileVersionInfo fvi = null; - try - { - fvi = FileVersionInfo.GetVersionInfo(fi.FullName); - - if (fvi.ProductName != PluginInfo.PluginName && fvi.ProductName != PluginInfo.PluginNativeName) - { - continue; - } - } - catch - { - continue; - } - - try - { - var pi = new PluginInfo(fi.FullName, fvi); - if (!pi.IsNative) - { - pi.Interface = CreatePluginInstance(pi.FilePath); - - pi.NativeHandle = Marshal.GetHINSTANCE(pi.Interface.GetType().Module); - } - else - { - pi.NativeHandle = CreateNativePluginInstance(pi.FilePath); - } - - if (!pi.IsNative) - { - if (!pi.Interface.Initialize(host)) - { - continue; - } - } - else - { - nativeHelper.InintializeNativeModule(pi.NativeHandle); - } - - if (!pi.NativeHandle.IsNull()) - { - nativeHelper.RegisterProvidedNativeMethods(pi.NativeHandle, pi.Name); - } - - plugins.Add(pi); - } - catch (Exception ex) - { - logger.Log(ex); - } - } - } - - public void UnloadAllPlugins() - { - foreach (var plugin in plugins) - { - if (plugin.Interface != null) - { - try - { - plugin.Interface.Terminate(); - } - catch - { - - } - } - else if (!plugin.NativeHandle.IsNull()) - { - NativeMethods.FreeLibrary(plugin.NativeHandle); - } - } - - plugins.Clear(); - } - - private static Plugin CreatePluginInstance(string filePath) - { - Contract.Requires(filePath != null); - - var type = Path.GetFileNameWithoutExtension(filePath); - type = type + "." + type + "Ext"; - - var handle = Activator.CreateInstanceFrom(filePath, type); - - var plugin = (handle.Unwrap() as Plugin); - if (plugin == null) - { - throw new FileLoadException(); - } - return plugin; - } - - private static IntPtr CreateNativePluginInstance(string filePath) - { - Contract.Requires(filePath != null); - - var handle = NativeMethods.LoadLibrary(filePath); - if (handle.IsNull()) - { - throw new FileLoadException(); - } - return handle; - } - } -} diff --git a/Program.cs b/Program.cs deleted file mode 100644 index 20f3e941..00000000 --- a/Program.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Globalization; -using System.Security.Principal; -using System.Windows.Forms; -using Microsoft.SqlServer.MessageBox; -using ReClassNET.Forms; -using ReClassNET.Logger; -using ReClassNET.Memory; -using ReClassNET.UI; -using ReClassNET.Util; - -namespace ReClassNET -{ - static class Program - { - private static Settings settings; - private static ILogger logger; - private static Random random = new Random(); - private static MainForm mainForm; - private static bool designMode = true; - - public static Settings Settings => settings; - - public static ILogger Logger => logger; - - public static Random GlobalRandom => random; - - public static MainForm MainForm => mainForm; - - public static bool DesignMode => designMode; - - [STAThread] - static void Main() - { - designMode = false; // The designer doesn't call Main() - - DpiUtil.ConfigureProcess(); - - EnableDebugPrivileges(); - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - - CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; - - settings = Settings.Load(Constants.SettingsFile); - logger = new GuiLogger(); -#if RELEASE - try - { - using (var nativeHelper = new NativeHelper()) - { - mainForm = new MainForm(nativeHelper); - - Application.Run(mainForm); - } - } - catch (Exception ex) - { - ShowException(ex); - } -#else - using (var nativeHelper = new NativeHelper()) - { - mainForm = new MainForm(nativeHelper); - - Application.Run(mainForm); - } -#endif - - Settings.Save(settings, Constants.SettingsFile); - } - - private static bool EnableDebugPrivileges() - { - var result = false; - - IntPtr token; - if (NativeMethods.OpenProcessToken(System.Diagnostics.Process.GetCurrentProcess().Handle, TokenAccessLevels.AllAccess, out token)) - { - var privileges = new NativeMethods.TOKEN_PRIVILEGES(); - privileges.PrivilegeCount = 1; - privileges.Luid.LowPart = 0x14; - privileges.Luid.HighPart = 0; - privileges.Attributes = 2; - - result = NativeMethods.AdjustTokenPrivileges(token, false, ref privileges, 0, IntPtr.Zero, IntPtr.Zero); - - NativeMethods.CloseHandle(token); - } - - return result; - } - - /// Shows the exception in a special form. - /// The exception. - public static void ShowException(Exception ex) - { - ex.HelpLink = Constants.HelpUrl; - - var msg = new ExceptionMessageBox(ex); - msg.ShowToolBar = true; - msg.Symbol = ExceptionMessageBoxSymbol.Error; - msg.Show(null); - } - } -} diff --git a/README.md b/README.md index cf8ab1c2..82a8a53d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ReClass.NET -This is a port of ReClass to the .NET platform with additional features. +This is a port of ReClass to the .NET platform with lots of additional features. ![](https://abload.de/img/main4hsbj.jpg) @@ -7,47 +7,91 @@ This is a port of ReClass to the .NET platform with additional features. - Support for x86 / x64 - File import from ReClass 2007-2016 and ReClass QT - Memory Nodes - - Hex 8 / 16 / 32 / 64 - - Int 8 / 16 / 32 / 64 - - UInt 8 / 16 / 32 / 64 - - Bits ![](https://abload.de/img/bitsnhlql.jpg) - - Float / Double - - Vector 2 / 3 / 4 - - Matrix 3x3 / 3x4 / 4x4 - - UTF8/16/32 Text and pointer to text - - Class Arrays and array of pointers to classes - - VTable - - Function Pointer + - Arrays and Pointers to every other node types + - Hex 8 / 16 / 32 / 64 + - Int 8 / 16 / 32 / 64 + - UInt 8 / 16 / 32 / 64 + - Bool + - Bits ![](https://abload.de/img/bitsnhlql.jpg) + - Enumerations + - Float / Double + - Vector 2 / 3 / 4 + - Matrix 3x3 / 3x4 / 4x4 + - UTF8 / UTF16 / UTF32 Text and pointer to text + - Virtual Tables + - Function + - Function Pointer + - Unions - Automatic Node Dissection - Highlight changed memory +- Pointer Preview - Copy / Paste Support across ReClass.NET instances - Display types from Debug Symbols (*.pdb) - Display Runtime Type Informations (RTTI) - Control the remote process: start / stop / kill - Process Selection Dialog with filtering - Memory Viewer +- Memory Scanner + - Import files from Cheat Engine and CrySearch + - Scan for values correlated to your input +- Class address calculator - Code Generator (C++ / C#) +- Module / Section Dumper +- Linux Support (tested on Ubuntu 18.04) +- Debugger with "Find out what writes/accesses this address" support - Plugin Support - - Plugins can be written in different languages (example: C++, C++/CLI, C#) - - Plugins can provide custom methods to access an other process (example: use a driver) - - Plugins can interact with the ReClass.NET windows - - Plugins can provide node infos which will be displayed (example: class informations for Frostbite games) - - Plugins can implement custom nodes with load/save and code generation support + - Plugins can be written in different languages (example: C++, C++/CLI, C#) + - Plugins can provide custom methods to access an other process (example: use a driver) + - Plugins can interact with the ReClass.NET windows + - Plugins can provide node infos which will be displayed (example: class informations for Frostbite games) + - Plugins can implement custom nodes with load/save and code generation support ## Plugins -- [Sample Plugins](https://github.com/KN4CK3R/ReClass.NET-SamplePlugin) -- [Frostbite Plugin](https://github.com/KN4CK3R/ReClass.NET-FrostbitePlugin) +- [Sample Plugins](https://github.com/ReClassNET/ReClass.NET-SamplePlugin) +- [Frostbite Plugin](https://github.com/ReClassNET/ReClass.NET-FrostbitePlugin) +- [MemoryPipe Plugin](https://github.com/ReClassNET/ReClass.NET-MemoryPipePlugin) +- [LoadBinary Plugin](https://github.com/ReClassNET/ReClass.NET-LoadBinaryPlugin) +- [Handle Abuser Plugin](https://github.com/ReClassNET/ReClass.NET-HandleAbuser) +- Unreal Plugin (not available anymore) (by [DrP3pp3r](https://github.com/DrP3pp3r)) +- [DriverReader](https://github.com/niemand-sec/ReClass.NET-DriverReader) (by [Niemand](https://github.com/niemand-sec)) To install a plugin just copy it in the "Plugins" folder. -If you want to develop your own plugin just learn from the code of the [Sample Plugins](https://github.com/KN4CK3R/ReClass.NET-SamplePlugin) and [Frostbite Plugin](https://github.com/KN4CK3R/ReClass.NET-FrostbitePlugin) repositories. If you have developed a nice plugin, leave me a message and I will add it to the list above. +If you want to develop your own plugin just learn from the code of the [Sample Plugins](https://github.com/ReClassNET/ReClass.NET-SamplePlugin) and [Frostbite Plugin](https://github.com/ReClassNET/ReClass.NET-FrostbitePlugin) repositories. If you have developed a nice plugin, leave me a message and I will add it to the list above. ## Installation -Just download the [latest version](https://github.com/KN4CK3R/ReClass.NET/releases) and start the x86 / x64 version. +Just download the [latest version](https://github.com/ReClassNET/ReClass.NET/releases) and start the x86 / x64 version or let the launcher decide. + +## Tips +- Lots of elements have a context menu. Just right-click it and see what you can do there. +- The node window can be controlled with the keyboard too. Arrow keys can select other keys, combined with the shift key the nodes get selected. The menu key opens the context menu which itself can be controlled with the keyboard. +- The memory address field of a class can contain a real formula not just a fixed address. + + **\ + 0x123** will use the base address of Program.exe and add 0x123 to it. + **[0x4012ABDE]** will read the integer (4 byte on x86 / 8 byte on x64) from the address 0x4012ABDE and use this value as class address. + **[\ + 0xDE] - AB** will use the base address of Program.exe, add 0xDE to it, read the value from this address and finally sub 0xAB from it. + **[\ + offset + [\ + offset2]]** Nested operations are supported too. + + Valid operations are read ([..]), add (+), sub (-), mul (*) and div (/). Please note that all operations are integer calculations. ## Compiling -If you want to compile ReClass.NET just fork the repository and open the ReClass.NET.sln file. +If you want to compile ReClass.NET just fork the repository and open the ReClass.NET.sln file with Visual Studio 2019. Compile the project and copy the dependencies to the output folder. +To compile the linux native core library, you need WSL [installed and configured](https://learn.microsoft.com/en-us/cpp/build/walkthrough-build-debug-wsl2). If you do not need linux support, simply unload the project in the Solution Explorer. If you want to build cross-platform (x86/x64) you have to install `g++-multilib` too. + +If you use the `Makefile` with `docker` or `podman` you have to build the needed image `gcc_multilib` from the following `Dockerfile` (`docker build -t gcc_multi .`): + +``` +FROM ubuntu:latest + +RUN apt-get update \ + && apt-get install --assume-yes --no-install-recommends --quiet \ + make \ + g++ \ + g++-multilib \ + && apt-get clean all +``` + ## Videos [Youtube Playlist](https://www.youtube.com/playlist?list=PLO246BmtoITanq3ygMCL8_w0eov4D8hjk) @@ -59,6 +103,12 @@ Process Selection Memory Viewer ![](https://abload.de/img/memoryviewerb4y1s.jpg) +Memory Scanner +![](https://abload.de/img/scannerytub1.jpg) + +Pointer Preview +![](https://abload.de/img/memorypreview2gsfp.jpg) + Code Generator ![](https://abload.de/img/codegeneratorqdat2.jpg) ![](https://abload.de/img/codegenerator24qzce.jpg) @@ -75,11 +125,14 @@ Settings - DrUnKeN ChEeTaH - P47R!CK - DogMatt -- [Dude719](https://github.com/dude719) +- [ajkhoury](https://github.com/ajkhoury) - [IChooseYou](https://github.com/IChooseYou) - [stevemk14ebr](https://github.com/stevemk14ebr) - [Timboy67678](https://github.com/Timboy67678) - [DarthTon](https://github.com/DarthTon) - [ReUnioN](https://github.com/ReUnioN) - leveln -- [buddyfavors](https://github.com/buddyfavors) \ No newline at end of file +- [buddyfavors](https://github.com/buddyfavors) +- [DrP3pp3r](https://github.com/DrP3pp3r) +- [ko1N](https://github.com/ko1N) +- [Niemand](https://github.com/niemand-sec) (see his talk at [BlackHat Europe 2019 (London) "Unveiling the underground world of Anti-Cheats"](https://www.blackhat.com/eu-19/briefings/schedule/index.html#unveiling-the-underground-world-of-anti-cheats-17358)) \ No newline at end of file diff --git a/ReClass.NET.sln b/ReClass.NET.sln index f87ab321..6345bb67 100644 --- a/ReClass.NET.sln +++ b/ReClass.NET.sln @@ -1,41 +1,95 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28803.156 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReClass.NET", "ReClass.NET.csproj", "{BFB8917D-E9B4-463F-A6E8-612C35728C78}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReClass.NET", "ReClass.NET\ReClass.NET.csproj", "{BFB8917D-E9B4-463F-A6E8-612C35728C78}" ProjectSection(ProjectDependencies) = postProject + {16591D29-2370-428A-BA11-87E38D0F3551} = {16591D29-2370-428A-BA11-87E38D0F3551} {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F} = {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NativeHelper", "NativeHelper\NativeHelper.vcxproj", "{22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NativeCore", "NativeCore\Windows\NativeCore.vcxproj", "{22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NativeCore.Unix", "NativeCore\Unix\NativeCore.Unix.vcxproj", "{48C5258A-FA49-4173-AEE5-0FCA5190DFF2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReClass.NET_Launcher", "ReClass.NET_Launcher\ReClass.NET_Launcher.csproj", "{16591D29-2370-428A-BA11-87E38D0F3551}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{19CF2B0F-2722-4108-8308-B628D91F7A1E}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + README.md = README.md + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReClass.NET_Tests", "ReClass.NET_Tests\ReClass.NET_Tests.csproj", "{E2D0424D-738F-41C3-9935-1B282624600F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Debug|Any CPU.ActiveCfg = Debug|x86 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Debug|x64.ActiveCfg = Debug|x64 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Debug|x64.Build.0 = Debug|x64 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Debug|x86.ActiveCfg = Debug|x86 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Debug|x86.Build.0 = Debug|x86 + {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Release|Any CPU.ActiveCfg = Release|x86 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Release|x64.ActiveCfg = Release|x64 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Release|x64.Build.0 = Release|x64 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Release|x86.ActiveCfg = Release|x86 {BFB8917D-E9B4-463F-A6E8-612C35728C78}.Release|x86.Build.0 = Release|x86 + {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Debug|Any CPU.ActiveCfg = Debug|Win32 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Debug|x64.ActiveCfg = Debug|x64 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Debug|x64.Build.0 = Debug|x64 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Debug|x86.ActiveCfg = Debug|Win32 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Debug|x86.Build.0 = Debug|Win32 + {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Release|Any CPU.ActiveCfg = Release|Win32 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Release|x64.ActiveCfg = Release|x64 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Release|x64.Build.0 = Release|x64 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Release|x86.ActiveCfg = Release|Win32 {22CA6FDB-7622-4F94-8FC2-2E7AB481C86F}.Release|x86.Build.0 = Release|Win32 + {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|Any CPU.ActiveCfg = Debug|x86 + {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|x64.ActiveCfg = Debug|x64 + {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|x64.Build.0 = Debug|x64 + {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|x86.ActiveCfg = Debug|x86 + {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Debug|x86.Build.0 = Debug|x86 + {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|Any CPU.ActiveCfg = Release|x86 + {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|x64.ActiveCfg = Release|x64 + {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|x64.Build.0 = Release|x64 + {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|x86.ActiveCfg = Release|x86 + {48C5258A-FA49-4173-AEE5-0FCA5190DFF2}.Release|x86.Build.0 = Release|x86 + {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|Any CPU.Build.0 = Debug|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|x64.ActiveCfg = Debug|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|x64.Build.0 = Debug|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|x86.ActiveCfg = Debug|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Debug|x86.Build.0 = Debug|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Release|Any CPU.ActiveCfg = Release|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Release|Any CPU.Build.0 = Release|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Release|x64.ActiveCfg = Release|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Release|x64.Build.0 = Release|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Release|x86.ActiveCfg = Release|Any CPU + {16591D29-2370-428A-BA11-87E38D0F3551}.Release|x86.Build.0 = Release|Any CPU + {E2D0424D-738F-41C3-9935-1B282624600F}.Debug|Any CPU.ActiveCfg = Debug|x86 + {E2D0424D-738F-41C3-9935-1B282624600F}.Debug|x64.ActiveCfg = Debug|x64 + {E2D0424D-738F-41C3-9935-1B282624600F}.Debug|x64.Build.0 = Debug|x64 + {E2D0424D-738F-41C3-9935-1B282624600F}.Debug|x86.ActiveCfg = Debug|x86 + {E2D0424D-738F-41C3-9935-1B282624600F}.Debug|x86.Build.0 = Debug|x86 + {E2D0424D-738F-41C3-9935-1B282624600F}.Release|Any CPU.ActiveCfg = Release|x86 + {E2D0424D-738F-41C3-9935-1B282624600F}.Release|x64.ActiveCfg = Release|x64 + {E2D0424D-738F-41C3-9935-1B282624600F}.Release|x64.Build.0 = Release|x64 + {E2D0424D-738F-41C3-9935-1B282624600F}.Release|x86.ActiveCfg = Release|x86 + {E2D0424D-738F-41C3-9935-1B282624600F}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BDFC9557-8E89-44A1-97D7-A830F2A52938} + EndGlobalSection EndGlobal diff --git a/AddressParser/AstBuilder.cs b/ReClass.NET/AddressParser/AstBuilder.cs similarity index 86% rename from AddressParser/AstBuilder.cs rename to ReClass.NET/AddressParser/AstBuilder.cs index 78d97dcd..f12ddefc 100644 --- a/AddressParser/AstBuilder.cs +++ b/ReClass.NET/AddressParser/AstBuilder.cs @@ -1,17 +1,15 @@ -// Design taken from https://github.com/pieterderycke/Jace - -using System; +using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; namespace ReClassNET.AddressParser { - class AstBuilder + public class AstBuilder { private readonly Dictionary operationPrecedence; - private readonly Stack resultStack = new Stack(); + private readonly Stack resultStack = new Stack(); private readonly Stack operatorStack = new Stack(); public AstBuilder() @@ -29,7 +27,7 @@ public AstBuilder() }; } - public Operation Build(IEnumerable tokens) + public IOperation Build(IEnumerable tokens) { Contract.Requires(tokens != null); Contract.Ensures(Contract.ForAll(tokens, t => t != null)); @@ -89,12 +87,11 @@ public Operation Build(IEnumerable tokens) private void PopOperations(bool untillLeftBracket) { - Operation lastOperation = null; while (operatorStack.Count > 0 && operatorStack.Peek().TokenType != TokenType.LeftBracket) { var token = operatorStack.Pop(); - lastOperation = ConvertOperation(token); + var lastOperation = ConvertOperation(token); resultStack.Push(lastOperation); } @@ -104,7 +101,7 @@ private void PopOperations(bool untillLeftBracket) if (operatorStack.Count > 0 && operatorStack.Peek().TokenType == TokenType.LeftBracket) { operatorStack.Pop(); - operatorStack.Push(new Token { TokenType = TokenType.ReadPointer, Value = '\r' }); + resultStack.Push(ConvertOperation(new Token(TokenType.ReadPointer, '\r'))); } else { @@ -120,14 +117,14 @@ private void PopOperations(bool untillLeftBracket) } } - private Operation ConvertOperation(Token operationToken) + private IOperation ConvertOperation(Token operationToken) { Contract.Requires(operationToken != null); try { - Operation argument1; - Operation argument2; + IOperation argument1; + IOperation argument2; switch ((char)operationToken.Value) { @@ -164,8 +161,7 @@ private void VerifyResultStack() { if (resultStack.Count > 1) { - var offset = resultStack.Skip(1).Where(o => o is OffsetOperation).FirstOrDefault() as OffsetOperation; - if (offset != null) + if (resultStack.Skip(1).FirstOrDefault(o => o is OffsetOperation) is OffsetOperation offset) { throw new ParseException($"Unexpected offset '{offset.Value}' found."); } diff --git a/ReClass.NET/AddressParser/DynamicCompiler.cs b/ReClass.NET/AddressParser/DynamicCompiler.cs new file mode 100644 index 00000000..2ffd110b --- /dev/null +++ b/ReClass.NET/AddressParser/DynamicCompiler.cs @@ -0,0 +1,120 @@ +using System; +using System.Diagnostics.Contracts; +using System.Linq.Expressions; +using System.Reflection; +using ReClassNET.Extensions; +using ReClassNET.Memory; + +namespace ReClassNET.AddressParser +{ + public class DynamicCompiler : IExecutor + { + public IntPtr Execute(IExpression expression, IProcessReader processReader) + { + Contract.Requires(expression != null); + Contract.Requires(processReader != null); + + return CompileExpression(expression)(processReader); + } + + public static Func CompileExpression(IExpression expression) + { + Contract.Requires(expression != null); + + var processParameter = Expression.Parameter(typeof(IProcessReader)); + + return Expression.Lambda>( + GenerateMethodBody(expression, processParameter), + processParameter + ).Compile(); + } + + private static Expression GenerateMethodBody(IExpression expression, Expression processParameter) + { + Contract.Requires(expression != null); + Contract.Requires(processParameter != null); + + static MethodInfo GetIntPtrExtension(string name) => typeof(IntPtrExtension).GetRuntimeMethod(name, new[] { typeof(IntPtr), typeof(IntPtr) }); + + switch (expression) + { + case ConstantExpression constantExpression: + { + var convertFn = typeof(IntPtrExtension).GetRuntimeMethod(nameof(IntPtrExtension.From), new[] { typeof(long) }); + + return Expression.Call(null, convertFn, Expression.Constant(constantExpression.Value)); + } + case NegateExpression negateExpression: + { + var argument = GenerateMethodBody(negateExpression.Expression, processParameter); + + var negateFn = typeof(IntPtrExtension).GetRuntimeMethod(nameof(IntPtrExtension.Negate), new[] { typeof(IntPtr) }); + + return Expression.Call(null, negateFn, argument); + } + case AddExpression addExpression: + { + var argument1 = GenerateMethodBody(addExpression.Lhs, processParameter); + var argument2 = GenerateMethodBody(addExpression.Rhs, processParameter); + + return Expression.Call(null, GetIntPtrExtension(nameof(IntPtrExtension.Add)), argument1, argument2); + } + case SubtractExpression subtractExpression: + { + var argument1 = GenerateMethodBody(subtractExpression.Lhs, processParameter); + var argument2 = GenerateMethodBody(subtractExpression.Rhs, processParameter); + + return Expression.Call(null, GetIntPtrExtension(nameof(IntPtrExtension.Sub)), argument1, argument2); + } + case MultiplyExpression multiplyExpression: + { + var argument1 = GenerateMethodBody(multiplyExpression.Lhs, processParameter); + var argument2 = GenerateMethodBody(multiplyExpression.Rhs, processParameter); + + return Expression.Call(null, GetIntPtrExtension(nameof(IntPtrExtension.Mul)), argument1, argument2); + } + case DivideExpression divideExpression: + { + var argument1 = GenerateMethodBody(divideExpression.Lhs, processParameter); + var argument2 = GenerateMethodBody(divideExpression.Rhs, processParameter); + + return Expression.Call(null, GetIntPtrExtension(nameof(IntPtrExtension.Div)), argument1, argument2); + } + case ModuleExpression moduleExpression: + { + var getModuleByNameFunc = typeof(IProcessReader).GetRuntimeMethod(nameof(IProcessReader.GetModuleByName), new[] { typeof(string) }); + var moduleNameConstant = Expression.Constant(moduleExpression.Name); + + var moduleVariable = Expression.Variable(typeof(Memory.Module)); + var assignExpression = Expression.Assign(moduleVariable, Expression.Call(processParameter, getModuleByNameFunc, moduleNameConstant)); + + return Expression.Block( + new[] { moduleVariable }, + assignExpression, + Expression.Condition( + Expression.Equal(moduleVariable, Expression.Constant(null)), + Expression.Constant(IntPtr.Zero), + Expression.MakeMemberAccess(moduleVariable, typeof(Memory.Module).GetProperty(nameof(Memory.Module.Start))!) + ) + ); + } + case ReadMemoryExpression readMemoryExpression: + { + var addressParameter = GenerateMethodBody(readMemoryExpression.Expression, processParameter); + + var functionName = readMemoryExpression.ByteCount == 4 ? nameof(IRemoteMemoryReaderExtension.ReadRemoteInt32) : nameof(IRemoteMemoryReaderExtension.ReadRemoteInt64); + var readRemoteIntPtrFn = typeof(IRemoteMemoryReaderExtension).GetRuntimeMethod(functionName, new[] { typeof(IRemoteMemoryReader), typeof(IntPtr) }); + + var callExpression = Expression.Call(null, readRemoteIntPtrFn, processParameter, addressParameter); + + var paramType = readMemoryExpression.ByteCount == 4 ? typeof(int) : typeof(long); + var convertFn = typeof(IntPtrExtension).GetRuntimeMethod(nameof(IntPtrExtension.From), new[] { paramType }); + + return Expression.Call(null, convertFn, callExpression); + } + } + + throw new ArgumentException($"Unsupported operation '{expression.GetType().FullName}'."); + } + } +} diff --git a/ReClass.NET/AddressParser/Expressions.cs b/ReClass.NET/AddressParser/Expressions.cs new file mode 100644 index 00000000..52388aed --- /dev/null +++ b/ReClass.NET/AddressParser/Expressions.cs @@ -0,0 +1,99 @@ +namespace ReClassNET.AddressParser +{ + public interface IExpression + { + } + + public abstract class BinaryExpression : IExpression + { + public IExpression Lhs { get; } + public IExpression Rhs { get; } + + protected BinaryExpression(IExpression lhs, IExpression rhs) + { + Lhs = lhs; + Rhs = rhs; + } + } + + public class AddExpression : BinaryExpression + { + public AddExpression(IExpression lhs, IExpression rhs) + : base(lhs, rhs) + { + } + } + + public class SubtractExpression : BinaryExpression + { + public SubtractExpression(IExpression lhs, IExpression rhs) + : base(lhs, rhs) + { + } + } + + public class MultiplyExpression : BinaryExpression + { + public MultiplyExpression(IExpression lhs, IExpression rhs) + : base(lhs, rhs) + { + } + } + + public class DivideExpression : BinaryExpression + { + public DivideExpression(IExpression lhs, IExpression rhs) + : base(lhs, rhs) + { + } + } + + public class ConstantExpression : IExpression + { + public long Value { get; } + + public ConstantExpression(long value) + { + Value = value; + } + } + + public abstract class UnaryExpression : IExpression + { + public IExpression Expression { get; } + + protected UnaryExpression(IExpression expression) + { + Expression = expression; + } + } + + public class NegateExpression : UnaryExpression + { + public NegateExpression(IExpression expression) + : base(expression) + { + } + } + + public class ReadMemoryExpression : UnaryExpression + { + public int ByteCount { get; } + + public ReadMemoryExpression(IExpression expression, int byteCount) + : base(expression) + { + ByteCount = byteCount; + } + } + + public class ModuleExpression : IExpression + { + public string Name { get; } + + public ModuleExpression(string name) + { + Name = name; + } + } +} diff --git a/ReClass.NET/AddressParser/IExecutor.cs b/ReClass.NET/AddressParser/IExecutor.cs new file mode 100644 index 00000000..0620d0e4 --- /dev/null +++ b/ReClass.NET/AddressParser/IExecutor.cs @@ -0,0 +1,10 @@ +using System; +using ReClassNET.Memory; + +namespace ReClassNET.AddressParser +{ + public interface IExecutor + { + IntPtr Execute(IExpression expression, IProcessReader processReader); + } +} diff --git a/ReClass.NET/AddressParser/ITokenizer.cs b/ReClass.NET/AddressParser/ITokenizer.cs new file mode 100644 index 00000000..171113a1 --- /dev/null +++ b/ReClass.NET/AddressParser/ITokenizer.cs @@ -0,0 +1,25 @@ +namespace ReClassNET.AddressParser +{ + public interface ITokenizer + { + /// + /// The current token. It is set to if no more tokens are avaiable. + /// + Token Token { get; } + + /// + /// The current identifier. + /// + string Identifier { get; } + + /// + /// The current number. + /// + long Number { get; } + + /// + /// Reads the next token. + /// + void ReadNextToken(); + } +} diff --git a/ReClass.NET/AddressParser/Interpreter.cs b/ReClass.NET/AddressParser/Interpreter.cs new file mode 100644 index 00000000..ad7ee372 --- /dev/null +++ b/ReClass.NET/AddressParser/Interpreter.cs @@ -0,0 +1,54 @@ +using System; +using System.Diagnostics.Contracts; +using ReClassNET.Extensions; +using ReClassNET.Memory; + +namespace ReClassNET.AddressParser +{ + public class Interpreter : IExecutor + { + public IntPtr Execute(IExpression expression, IProcessReader processReader) + { + Contract.Requires(expression != null); + Contract.Requires(processReader != null); + + switch (expression) + { + case ConstantExpression constantExpression: + return IntPtrExtension.From(constantExpression.Value); + case NegateExpression negateExpression: + return Execute(negateExpression.Expression, processReader).Negate(); + case ModuleExpression moduleExpression: + { + var module = processReader.GetModuleByName(moduleExpression.Name); + if (module != null) + { + return module.Start; + } + + return IntPtr.Zero; + } + case AddExpression addExpression: + return Execute(addExpression.Lhs, processReader).Add(Execute(addExpression.Rhs, processReader)); + case SubtractExpression subtractExpression: + return Execute(subtractExpression.Lhs, processReader).Sub(Execute(subtractExpression.Rhs, processReader)); + case MultiplyExpression multiplyExpression: + return Execute(multiplyExpression.Lhs, processReader).Mul(Execute(multiplyExpression.Rhs, processReader)); + case DivideExpression divideExpression: + return Execute(divideExpression.Lhs, processReader).Div(Execute(divideExpression.Rhs, processReader)); + case ReadMemoryExpression readMemoryExpression: + var readFromAddress = Execute(readMemoryExpression.Expression, processReader); + if (readMemoryExpression.ByteCount == 4) + { + return IntPtrExtension.From(processReader.ReadRemoteInt32(readFromAddress)); + } + else + { + return IntPtrExtension.From(processReader.ReadRemoteInt64(readFromAddress)); + } + default: + throw new ArgumentException($"Unsupported operation '{expression.GetType().FullName}'."); + } + } + } +} diff --git a/AddressParser/Operations.cs b/ReClass.NET/AddressParser/Operations.cs similarity index 54% rename from AddressParser/Operations.cs rename to ReClass.NET/AddressParser/Operations.cs index db60979e..c51f8df2 100644 --- a/AddressParser/Operations.cs +++ b/ReClass.NET/AddressParser/Operations.cs @@ -1,16 +1,14 @@ -// Design taken from https://github.com/pieterderycke/Jace - -using System; +using System; using System.Diagnostics.Contracts; namespace ReClassNET.AddressParser { - interface Operation + public interface IOperation { } - class OffsetOperation : Operation + public class OffsetOperation : IOperation { public OffsetOperation(IntPtr value) { @@ -21,8 +19,7 @@ public OffsetOperation(IntPtr value) public override bool Equals(object obj) { - var other = obj as OffsetOperation; - if (other != null) + if (obj is OffsetOperation other) { return Value.Equals(other.Value); } @@ -38,21 +35,21 @@ public override int GetHashCode() } } - class ReadPointerOperation : Operation + public class ReadPointerOperation : IOperation { - public ReadPointerOperation(Operation argument) + public ReadPointerOperation(IOperation argument) { Contract.Requires(argument != null); Argument = argument; } - public Operation Argument { get; } + public IOperation Argument { get; } } - class AdditionOperation : Operation + public class AdditionOperation : IOperation { - public AdditionOperation(Operation argument1, Operation argument2) + public AdditionOperation(IOperation argument1, IOperation argument2) { Contract.Requires(argument1 != null); Contract.Requires(argument2 != null); @@ -61,13 +58,13 @@ public AdditionOperation(Operation argument1, Operation argument2) Argument2 = argument2; } - public Operation Argument1 { get; } - public Operation Argument2 { get; } + public IOperation Argument1 { get; } + public IOperation Argument2 { get; } } - class SubtractionOperation : Operation + public class SubtractionOperation : IOperation { - public SubtractionOperation(Operation argument1, Operation argument2) + public SubtractionOperation(IOperation argument1, IOperation argument2) { Contract.Requires(argument1 != null); Contract.Requires(argument2 != null); @@ -76,13 +73,13 @@ public SubtractionOperation(Operation argument1, Operation argument2) Argument2 = argument2; } - public Operation Argument1 { get; } - public Operation Argument2 { get; } + public IOperation Argument1 { get; } + public IOperation Argument2 { get; } } - class DivisionOperation : Operation + public class DivisionOperation : IOperation { - public DivisionOperation(Operation dividend, Operation divisor) + public DivisionOperation(IOperation dividend, IOperation divisor) { Contract.Requires(dividend != null); Contract.Requires(divisor != null); @@ -91,13 +88,13 @@ public DivisionOperation(Operation dividend, Operation divisor) Divisor = divisor; } - public Operation Dividend { get; } - public Operation Divisor { get; } + public IOperation Dividend { get; } + public IOperation Divisor { get; } } - class MultiplicationOperation : Operation + public class MultiplicationOperation : IOperation { - public MultiplicationOperation(Operation argument1, Operation argument2) + public MultiplicationOperation(IOperation argument1, IOperation argument2) { Contract.Requires(argument1 != null); Contract.Requires(argument2 != null); @@ -106,11 +103,11 @@ public MultiplicationOperation(Operation argument1, Operation argument2) Argument2 = argument2; } - public Operation Argument1 { get; } - public Operation Argument2 { get; } + public IOperation Argument1 { get; } + public IOperation Argument2 { get; } } - class ModuleOffsetOperation : Operation + public class ModuleOffsetOperation : IOperation { public ModuleOffsetOperation(string name) { @@ -123,8 +120,7 @@ public ModuleOffsetOperation(string name) public override bool Equals(object obj) { - var other = obj as ModuleOffsetOperation; - if (other != null) + if (obj is ModuleOffsetOperation other) { return Name.Equals(other.Name); } diff --git a/AddressParser/ParseException.cs b/ReClass.NET/AddressParser/ParseException.cs similarity index 50% rename from AddressParser/ParseException.cs rename to ReClass.NET/AddressParser/ParseException.cs index bee79ae4..793746dd 100644 --- a/AddressParser/ParseException.cs +++ b/ReClass.NET/AddressParser/ParseException.cs @@ -1,10 +1,8 @@ -// Design taken from https://github.com/pieterderycke/Jace - -using System; +using System; namespace ReClassNET.AddressParser { - class ParseException : Exception + public class ParseException : Exception { public ParseException(string message) : base(message) diff --git a/ReClass.NET/AddressParser/Parser.cs b/ReClass.NET/AddressParser/Parser.cs new file mode 100644 index 00000000..4db14fda --- /dev/null +++ b/ReClass.NET/AddressParser/Parser.cs @@ -0,0 +1,199 @@ +using System; +using System.IO; + +namespace ReClassNET.AddressParser +{ + public class Parser + { + private readonly ITokenizer tokenizer; + + public Parser(ITokenizer tokenizer) + { + this.tokenizer = tokenizer; + } + + public IExpression ParseExpression() + { + var expr = ParseAddSubtract(); + + if (tokenizer.Token != Token.None) + { + throw new ParseException("Unexpected characters at end of expression"); + } + + return expr; + } + + private IExpression ParseAddSubtract() + { + var lhs = ParseMultiplyDivide(); + + while (true) + { + if (tokenizer.Token == Token.Add || tokenizer.Token == Token.Subtract) + { + var token = tokenizer.Token; + + tokenizer.ReadNextToken(); + + var rhs = ParseMultiplyDivide(); + + if (token == Token.Add) + { + lhs = new AddExpression(lhs, rhs); + } + else + { + lhs = new SubtractExpression(lhs, rhs); + } + } + else + { + return lhs; + } + } + } + + private IExpression ParseMultiplyDivide() + { + var lhs = ParseUnary(); + + while (true) + { + if (tokenizer.Token == Token.Multiply || tokenizer.Token == Token.Divide) + { + var token = tokenizer.Token; + + tokenizer.ReadNextToken(); + + var rhs = ParseUnary(); + + if (token == Token.Multiply) + { + lhs = new MultiplyExpression(lhs, rhs); + } + else + { + lhs = new DivideExpression(lhs, rhs); + } + } + else + { + return lhs; + } + } + } + + private IExpression ParseUnary() + { + while (true) + { + if (tokenizer.Token == Token.Add) + { + tokenizer.ReadNextToken(); + + continue; + } + + if (tokenizer.Token == Token.Subtract) + { + tokenizer.ReadNextToken(); + + var rhs = ParseUnary(); + + return new NegateExpression(rhs); + } + + return ParseLeaf(); + } + } + + private IExpression ParseLeaf() + { + switch (tokenizer.Token) + { + case Token.Number: + { + var node = new ConstantExpression(tokenizer.Number); + + tokenizer.ReadNextToken(); + + return node; + } + case Token.OpenParenthesis: + { + tokenizer.ReadNextToken(); + + var node = ParseAddSubtract(); + + if (tokenizer.Token != Token.CloseParenthesis) + { + throw new ParseException("Missing close parenthesis"); + } + + tokenizer.ReadNextToken(); + + return node; + } + case Token.OpenBrackets: + { + tokenizer.ReadNextToken(); + + var node = ParseAddSubtract(); + + var byteCount = IntPtr.Size; + if (tokenizer.Token == Token.Comma) + { + tokenizer.ReadNextToken(); + + if (tokenizer.Token != Token.Number) + { + throw new ParseException("Missing read byte count"); + } + + if (tokenizer.Number != 4 && tokenizer.Number != 8) + { + throw new ParseException("The byte count must be 4 or 8."); + } + + byteCount = (int)tokenizer.Number; + + tokenizer.ReadNextToken(); + } + + if (tokenizer.Token != Token.CloseBrackets) + { + throw new ParseException("Missing close bracket"); + } + + tokenizer.ReadNextToken(); + + return new ReadMemoryExpression(node, byteCount); + } + case Token.Identifier: + { + var node = new ModuleExpression(tokenizer.Identifier); + + tokenizer.ReadNextToken(); + + return node; + } + default: + throw new ParseException($"Unexpect token: {tokenizer.Token}"); + } + } + + public static IExpression Parse(string str) + { + using var sr = new StringReader(str); + + return Parse(new Tokenizer(sr)); + } + + private static IExpression Parse(ITokenizer tokenizer) + { + var parser = new Parser(tokenizer); + return parser.ParseExpression(); + } + } +} diff --git a/ReClass.NET/AddressParser/Token.cs b/ReClass.NET/AddressParser/Token.cs new file mode 100644 index 00000000..b8036b83 --- /dev/null +++ b/ReClass.NET/AddressParser/Token.cs @@ -0,0 +1,18 @@ +namespace ReClassNET.AddressParser +{ + public enum Token + { + None, + Add, + Subtract, + Multiply, + Divide, + OpenParenthesis, + CloseParenthesis, + OpenBrackets, + CloseBrackets, + Comma, + Number, + Identifier + } +} diff --git a/ReClass.NET/AddressParser/Tokenizer.cs b/ReClass.NET/AddressParser/Tokenizer.cs new file mode 100644 index 00000000..a43907ec --- /dev/null +++ b/ReClass.NET/AddressParser/Tokenizer.cs @@ -0,0 +1,189 @@ +using System.Diagnostics.Contracts; +using System.Globalization; +using System.IO; +using System.Text; + +namespace ReClassNET.AddressParser +{ + /// + /// Parses the given text and reads individual tokens from it. + /// + public class Tokenizer : ITokenizer + { + private readonly TextReader reader; + + private char currentCharacter; + + public Token Token { get; private set; } + + public string Identifier { get; private set; } + + public long Number { get; private set; } + + public Tokenizer(TextReader reader) + { + Contract.Requires(reader != null); + + this.reader = reader; + + ReadNextCharacter(); + ReadNextToken(); + } + + public void ReadNextToken() + { + SkipWhitespaces(); + + if (currentCharacter == '\0') + { + Token = Token.None; + Identifier = null; + Number = 0; + + return; + } + + if (TryReadSimpleToken()) + { + ReadNextCharacter(); + + return; + } + + if (TryReadNumberToken()) + { + return; + } + + if (TryReadIdentifierToken()) + { + return; + } + + throw new ParseException($"Invalid character '{currentCharacter}'."); + } + + private void ReadNextCharacter() + { + var c = reader.Read(); + currentCharacter = c < 0 ? '\0' : (char)c; + } + + private void SkipWhitespaces() + { + while (char.IsWhiteSpace(currentCharacter)) + { + ReadNextCharacter(); + } + } + + private bool TryReadSimpleToken() + { + switch (currentCharacter) + { + case '+': + Token = Token.Add; + return true; + case '-': + Token = Token.Subtract; + return true; + case '*': + Token = Token.Multiply; + return true; + case '/': + Token = Token.Divide; + return true; + case '(': + Token = Token.OpenParenthesis; + return true; + case ')': + Token = Token.CloseParenthesis; + return true; + case '[': + Token = Token.OpenBrackets; + return true; + case ']': + Token = Token.CloseBrackets; + return true; + case ',': + Token = Token.Comma; + return true; + } + + return false; + } + + private bool TryReadNumberToken() + { + bool IsHexadecimalDigit(char c) => char.IsDigit(c) || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F'; + bool IsHexadecimalIdentifier(char c) => c == 'x' || c == 'X'; + + if (IsHexadecimalDigit(currentCharacter)) + { + var sb = new StringBuilder(); + var hasHexadecimalIdentifier = false; + + while (IsHexadecimalDigit(currentCharacter) + || IsHexadecimalIdentifier(currentCharacter) && !hasHexadecimalIdentifier && sb.Length == 1 && sb[0] == '0') + { + sb.Append(currentCharacter); + + if (!hasHexadecimalIdentifier) + { + hasHexadecimalIdentifier = IsHexadecimalIdentifier(currentCharacter); + } + + ReadNextCharacter(); + } + + if (hasHexadecimalIdentifier) + { + sb.Remove(0, 2); + } + + if (!long.TryParse(sb.ToString(), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var number)) + { + throw new ParseException($"Could not parse '{sb}' as number."); + } + Number = number; + + Token = Token.Number; + + return true; + } + + return false; + } + + private bool TryReadIdentifierToken() + { + if (currentCharacter == '<') + { + ReadNextCharacter(); + + var sb = new StringBuilder(); + + while (currentCharacter != '\0' && currentCharacter != '>') + { + sb.Append(currentCharacter); + + ReadNextCharacter(); + } + + if (currentCharacter != '>') + { + throw new ParseException("Invalid identifier, missing '>'."); + } + + ReadNextCharacter(); + + Identifier = sb.ToString(); + Token = Token.Identifier; + + return true; + } + + return false; + } + } +} \ No newline at end of file diff --git a/ReClass.NET/App.config b/ReClass.NET/App.config new file mode 100644 index 00000000..1b379a17 --- /dev/null +++ b/ReClass.NET/App.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/ReClass.NET/CodeGenerator/CSharpCodeGenerator.cs b/ReClass.NET/CodeGenerator/CSharpCodeGenerator.cs new file mode 100644 index 00000000..c46bb836 --- /dev/null +++ b/ReClass.NET/CodeGenerator/CSharpCodeGenerator.cs @@ -0,0 +1,277 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.IO; +using System.Linq; +using ReClassNET.Extensions; +using ReClassNET.Logger; +using ReClassNET.Nodes; +using ReClassNET.Project; + +namespace ReClassNET.CodeGenerator +{ + public class CSharpCodeGenerator : ICodeGenerator + { + private static readonly Dictionary nodeTypeToTypeDefinationMap = new Dictionary + { + [typeof(DoubleNode)] = "double", + [typeof(FloatNode)] = "float", + [typeof(BoolNode)] = "bool", + [typeof(Int8Node)] = "sbyte", + [typeof(Int16Node)] = "short", + [typeof(Int32Node)] = "int", + [typeof(Int64Node)] = "long", + [typeof(NIntNode)] = "IntPtr", + [typeof(UInt8Node)] = "byte", + [typeof(UInt16Node)] = "ushort", + [typeof(UInt32Node)] = "uint", + [typeof(UInt64Node)] = "ulong", + [typeof(NUIntNode)] = "UIntPtr", + + [typeof(FunctionPtrNode)] = "IntPtr", + [typeof(Utf8TextPtrNode)] = "IntPtr", + [typeof(Utf16TextPtrNode)] = "IntPtr", + [typeof(Utf32TextPtrNode)] = "IntPtr", + [typeof(PointerNode)] = "IntPtr", + [typeof(VirtualMethodTableNode)] = "IntPtr", + + [typeof(Vector2Node)] = "Vector2", + [typeof(Vector3Node)] = "Vector3", + [typeof(Vector4Node)] = "Vector4" + }; + + public Language Language => Language.CSharp; + + public string GenerateCode(IReadOnlyList classes, IReadOnlyList enums, ILogger logger) + { + using var sw = new StringWriter(); + using var iw = new IndentedTextWriter(sw, "\t"); + + iw.WriteLine($"// Created with {Constants.ApplicationName} {Constants.ApplicationVersion} by {Constants.Author}"); + iw.WriteLine(); + iw.WriteLine("// Warning: The C# code generator doesn't support all node types!"); + iw.WriteLine(); + iw.WriteLine("using System.Runtime.InteropServices;"); + + iw.WriteLine("// optional namespace, only for vectors"); + iw.WriteLine("using System.Numerics;"); + iw.WriteLine(); + + using (var en = enums.GetEnumerator()) + { + if (en.MoveNext()) + { + WriteEnum(iw, en.Current); + + while (en.MoveNext()) + { + iw.WriteLine(); + + WriteEnum(iw, en.Current); + } + + iw.WriteLine(); + } + } + + var classesToWrite = classes + .Where(c => c.Nodes.None(n => n is FunctionNode)) // Skip class which contains FunctionNodes because these are not data classes. + .Distinct(); + + var unicodeStringClassLengthsToGenerate = new HashSet(); + + using (var en = classesToWrite.GetEnumerator()) + { + if (en.MoveNext()) + { + void FindUnicodeStringClasses(IEnumerable nodes) + { + unicodeStringClassLengthsToGenerate.UnionWith(nodes.OfType().Select(n => n.Length)); + } + + FindUnicodeStringClasses(en.Current!.Nodes); + + WriteClass(iw, en.Current, logger); + + while (en.MoveNext()) + { + iw.WriteLine(); + + FindUnicodeStringClasses(en.Current!.Nodes); + + WriteClass(iw, en.Current, logger); + } + } + } + + if (unicodeStringClassLengthsToGenerate.Any()) + { + foreach (var length in unicodeStringClassLengthsToGenerate) + { + iw.WriteLine(); + + WriteUnicodeStringClass(iw, length); + } + } + + return sw.ToString(); + } + + /// + /// Outputs the C# code for the given enum to the instance. + /// + /// The writer to output to. + /// The enum to output. + private static void WriteEnum(IndentedTextWriter writer, EnumDescription @enum) + { + Contract.Requires(writer != null); + Contract.Requires(@enum != null); + + writer.Write($"enum {@enum.Name} : "); + switch (@enum.Size) + { + case EnumDescription.UnderlyingTypeSize.OneByte: + writer.WriteLine(nodeTypeToTypeDefinationMap[typeof(Int8Node)]); + break; + case EnumDescription.UnderlyingTypeSize.TwoBytes: + writer.WriteLine(nodeTypeToTypeDefinationMap[typeof(Int16Node)]); + break; + case EnumDescription.UnderlyingTypeSize.FourBytes: + writer.WriteLine(nodeTypeToTypeDefinationMap[typeof(Int32Node)]); + break; + case EnumDescription.UnderlyingTypeSize.EightBytes: + writer.WriteLine(nodeTypeToTypeDefinationMap[typeof(Int64Node)]); + break; + } + writer.WriteLine("{"); + writer.Indent++; + for (var j = 0; j < @enum.Values.Count; ++j) + { + var kv = @enum.Values[j]; + + writer.Write(kv.Key); + writer.Write(" = "); + writer.Write(kv.Value); + if (j < @enum.Values.Count - 1) + { + writer.Write(","); + } + writer.WriteLine(); + } + writer.Indent--; + writer.WriteLine("};"); + } + + /// + /// Outputs the C# code for the given class to the instance. + /// + /// The writer to output to. + /// The class to output. + /// The logger. + private static void WriteClass(IndentedTextWriter writer, ClassNode @class, ILogger logger) + { + Contract.Requires(writer != null); + Contract.Requires(@class != null); + Contract.Requires(logger != null); + + writer.WriteLine("[StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi)]"); + writer.Write("public struct "); + writer.Write(@class.Name); + + if (!string.IsNullOrEmpty(@class.Comment)) + { + writer.Write(" // "); + writer.Write(@class.Comment); + } + + writer.WriteLine(); + + writer.WriteLine("{"); + writer.Indent++; + + var nodes = @class.Nodes + .WhereNot(n => n is FunctionNode || n is BaseHexNode); + foreach (var node in nodes) + { + var (type, attribute) = GetTypeDefinition(node); + if (type != null) + { + if (attribute != null) + { + writer.WriteLine(attribute); + } + + writer.WriteLine($"[FieldOffset(0x{node.Offset:X})]"); + writer.Write($"public readonly {type} {node.Name};"); + if (!string.IsNullOrEmpty(node.Comment)) + { + writer.Write(" //"); + writer.Write(node.Comment); + } + writer.WriteLine(); + } + else + { + logger.Log(LogLevel.Warning, $"Skipping node with unhandled type: {node.GetType()}"); + } + } + + writer.Indent--; + writer.WriteLine("}"); + } + + /// + /// Gets the type definition for the given node. If the node is not expressible null as typename is returned. + /// + /// The target node. + /// The type definition for the node or null as typename if the node is not expressible. + private static (string typeName, string attribute) GetTypeDefinition(BaseNode node) + { + Contract.Requires(node != null); + + if (node is BitFieldNode bitFieldNode) + { + var underlayingNode = bitFieldNode.GetUnderlayingNode(); + underlayingNode.CopyFromNode(node); + node = underlayingNode; + } + + if (nodeTypeToTypeDefinationMap.TryGetValue(node.GetType(), out var type)) + { + return (type, null); + } + + return node switch + { + EnumNode enumNode => (enumNode.Enum.Name, null), + Utf8TextNode utf8TextNode => ("string", $"[MarshalAs(UnmanagedType.ByValTStr, SizeConst = {utf8TextNode.Length})]"), + Utf16TextNode utf16TextNode => (GetUnicodeStringClassName(utf16TextNode.Length), "[MarshalAs(UnmanagedType.Struct)]"), + _ => (null, null) + }; + } + + private static string GetUnicodeStringClassName(int length) => $"__UnicodeString{length}"; + + /// + /// Writes a helper class for unicode strings with the specific length. + /// + /// The writer to output to. + /// The string length for this class. + private static void WriteUnicodeStringClass(IndentedTextWriter writer, int length) + { + var className = GetUnicodeStringClassName(length); + + writer.WriteLine("[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]"); + writer.WriteLine($"public struct {className}"); + writer.WriteLine("{"); + writer.Indent++; + writer.WriteLine($"[MarshalAs(UnmanagedType.ByValTStr, SizeConst = {length})]"); + writer.WriteLine("public string Value;"); + writer.WriteLine(); + writer.WriteLine($"public static implicit operator string({className} value) => value.Value;"); + writer.Indent--; + writer.WriteLine("}"); + } + } +} diff --git a/ReClass.NET/CodeGenerator/CppCodeGenerator.cs b/ReClass.NET/CodeGenerator/CppCodeGenerator.cs new file mode 100644 index 00000000..b6495aab --- /dev/null +++ b/ReClass.NET/CodeGenerator/CppCodeGenerator.cs @@ -0,0 +1,651 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Logger; +using ReClassNET.Nodes; +using ReClassNET.Project; + +namespace ReClassNET.CodeGenerator +{ + public delegate void WriteNodeFunc(IndentedTextWriter writer, BaseNode node, ILogger logger); + + public delegate string GetTypeDefinitionFunc(BaseNode node, ILogger logger); + + public delegate string ResolveWrappedTypeFunc(BaseNode node, bool isAnonymousExpression, ILogger logger); + + /// + /// A C++ code generator for custom nodes. + /// + public abstract class CustomCppCodeGenerator + { + /// + /// Returns true if the code generator can handle the given node. + /// + /// The node to check. + /// True if the code generator can handle the given node, false otherwise. + public abstract bool CanHandle(BaseNode node); + + /// + /// Outputs the C++ code for the node to the instance. + /// + /// The writer to output to. + /// The node to output. + /// The default implementation of . + /// The logger. + /// True if the code generator has processed the node, false otherwise. If this method returns false, the default implementation is used. + public virtual bool WriteNode(IndentedTextWriter writer, BaseNode node, WriteNodeFunc defaultWriteNodeFunc, ILogger logger) + { + return false; + } + + /// + /// Transforms the given node if necessary. + /// + /// The node to transform. + /// The transformed node. + public virtual BaseNode TransformNode(BaseNode node) + { + return node; + } + + /// + /// Gets the type definition for the node. If the node is not a simple node null is returned. + /// + /// The node. + /// The default implementation of . + /// The default implementation of . + /// The logger. + /// The type definition for the node or null if no simple type is available. + public virtual string GetTypeDefinition(BaseNode node, GetTypeDefinitionFunc defaultGetTypeDefinitionFunc, ResolveWrappedTypeFunc defaultResolveWrappedTypeFunc, ILogger logger) + { + return null; + } + } + + public class CppCodeGenerator : ICodeGenerator + { + #region Custom Code Generators + + private static readonly ISet customGenerators = new HashSet(); + + public static void Add(CustomCppCodeGenerator generator) + { + customGenerators.Add(generator); + } + + public static void Remove(CustomCppCodeGenerator generator) + { + customGenerators.Remove(generator); + } + + private static CustomCppCodeGenerator GetCustomCodeGeneratorForNode(BaseNode node) + { + return customGenerators.FirstOrDefault(g => g.CanHandle(node)); + } + + #endregion + + private readonly Dictionary nodeTypeToTypeDefinationMap; + + #region HelperNodes + + private class Utf8CharacterNode : BaseNode + { + public override int MemorySize => throw new NotImplementedException(); + public override void GetUserInterfaceInfo(out string name, out Image icon) => throw new NotImplementedException(); + public override Size Draw(DrawContext context, int x, int y) => throw new NotImplementedException(); + public override int CalculateDrawnHeight(DrawContext context) => throw new NotImplementedException(); + } + + private class Utf16CharacterNode : BaseNode + { + public override int MemorySize => throw new NotImplementedException(); + public override void GetUserInterfaceInfo(out string name, out Image icon) => throw new NotImplementedException(); + public override Size Draw(DrawContext context, int x, int y) => throw new NotImplementedException(); + public override int CalculateDrawnHeight(DrawContext context) => throw new NotImplementedException(); + } + + private class Utf32CharacterNode : BaseNode + { + public override int MemorySize => throw new NotImplementedException(); + public override void GetUserInterfaceInfo(out string name, out Image icon) => throw new NotImplementedException(); + public override Size Draw(DrawContext context, int x, int y) => throw new NotImplementedException(); + public override int CalculateDrawnHeight(DrawContext context) => throw new NotImplementedException(); + } + + #endregion + + public Language Language => Language.Cpp; + + public CppCodeGenerator(CppTypeMapping typeMapping) + { + nodeTypeToTypeDefinationMap = new Dictionary + { + [typeof(BoolNode)] = typeMapping.TypeBool, + [typeof(DoubleNode)] = typeMapping.TypeDouble, + [typeof(FloatNode)] = typeMapping.TypeFloat, + [typeof(FunctionPtrNode)] = typeMapping.TypeFunctionPtr, + [typeof(Int8Node)] = typeMapping.TypeInt8, + [typeof(Int16Node)] = typeMapping.TypeInt16, + [typeof(Int32Node)] = typeMapping.TypeInt32, + [typeof(Int64Node)] = typeMapping.TypeInt64, + [typeof(NIntNode)] = typeMapping.TypeNInt, + [typeof(Matrix3x3Node)] = typeMapping.TypeMatrix3x3, + [typeof(Matrix3x4Node)] = typeMapping.TypeMatrix3x4, + [typeof(Matrix4x4Node)] = typeMapping.TypeMatrix4x4, + [typeof(UInt8Node)] = typeMapping.TypeUInt8, + [typeof(UInt16Node)] = typeMapping.TypeUInt16, + [typeof(UInt32Node)] = typeMapping.TypeUInt32, + [typeof(UInt64Node)] = typeMapping.TypeUInt64, + [typeof(NUIntNode)] = typeMapping.TypeNUInt, + [typeof(Utf8CharacterNode)] = typeMapping.TypeUtf8Text, + [typeof(Utf16CharacterNode)] = typeMapping.TypeUtf16Text, + [typeof(Utf32CharacterNode)] = typeMapping.TypeUtf32Text, + [typeof(Vector2Node)] = typeMapping.TypeVector2, + [typeof(Vector3Node)] = typeMapping.TypeVector3, + [typeof(Vector4Node)] = typeMapping.TypeVector4 + }; + } + + public string GenerateCode(IReadOnlyList classes, IReadOnlyList enums, ILogger logger) + { + using var sw = new StringWriter(); + using var iw = new IndentedTextWriter(sw, "\t"); + + iw.WriteLine($"// Created with {Constants.ApplicationName} {Constants.ApplicationVersion} by {Constants.Author}"); + iw.WriteLine(); + + using (var en = enums.GetEnumerator()) + { + if (en.MoveNext()) + { + WriteEnum(iw, en.Current); + + while (en.MoveNext()) + { + iw.WriteLine(); + + WriteEnum(iw, en.Current); + } + + iw.WriteLine(); + } + } + + var alreadySeen = new HashSet(); + + IEnumerable GetReversedClassHierarchy(ClassNode node) + { + Contract.Requires(node != null); + Contract.Ensures(Contract.Result>() != null); + + if (!alreadySeen.Add(node)) + { + return Enumerable.Empty(); + } + + var classNodes = node.Nodes + .OfType() + .SelectMany(c => c.Nodes) + .Concat(node.Nodes) + .OfType() + .Where(w => !w.IsNodePresentInChain()) // Pointers are forward declared + .Select(w => w.ResolveMostInnerNode() as ClassNode) + .Where(n => n != null); + + return classNodes + .SelectMany(GetReversedClassHierarchy) + .Append(node); + } + + var classesToWrite = classes + .Where(c => c.Nodes.None(n => n is FunctionNode)) // Skip class which contains FunctionNodes because these are not data classes. + .SelectMany(GetReversedClassHierarchy) // Order the classes by their use hierarchy. + .Distinct(); + + using (var en = classesToWrite.GetEnumerator()) + { + if (en.MoveNext()) + { + WriteClass(iw, en.Current, classes, logger); + + while (en.MoveNext()) + { + iw.WriteLine(); + + WriteClass(iw, en.Current, classes, logger); + } + } + } + + return sw.ToString(); + } + + /// + /// Outputs the C++ code for the given enum to the instance. + /// + /// The writer to output to. + /// The enum to output. + private void WriteEnum(IndentedTextWriter writer, EnumDescription @enum) + { + Contract.Requires(writer != null); + Contract.Requires(@enum != null); + + writer.Write($"enum class {@enum.Name} : "); + switch (@enum.Size) + { + case EnumDescription.UnderlyingTypeSize.OneByte: + writer.WriteLine(nodeTypeToTypeDefinationMap[typeof(Int8Node)]); + break; + case EnumDescription.UnderlyingTypeSize.TwoBytes: + writer.WriteLine(nodeTypeToTypeDefinationMap[typeof(Int16Node)]); + break; + case EnumDescription.UnderlyingTypeSize.FourBytes: + writer.WriteLine(nodeTypeToTypeDefinationMap[typeof(Int32Node)]); + break; + case EnumDescription.UnderlyingTypeSize.EightBytes: + writer.WriteLine(nodeTypeToTypeDefinationMap[typeof(Int64Node)]); + break; + } + writer.WriteLine("{"); + writer.Indent++; + for (var j = 0; j < @enum.Values.Count; ++j) + { + var kv = @enum.Values[j]; + + writer.Write(kv.Key); + writer.Write(" = "); + writer.Write(kv.Value); + if (j < @enum.Values.Count - 1) + { + writer.Write(","); + } + writer.WriteLine(); + } + writer.Indent--; + writer.WriteLine("};"); + } + + /// + /// Outputs the C++ code for the given class to the instance. + /// + /// The writer to output to. + /// The class to output. + /// The list of all available classes. + /// The logger. + private void WriteClass(IndentedTextWriter writer, ClassNode @class, IEnumerable classes, ILogger logger) + { + Contract.Requires(writer != null); + Contract.Requires(@class != null); + Contract.Requires(classes != null); + + writer.Write("class "); + writer.Write(@class.Name); + + var skipFirstMember = false; + if (@class.Nodes.FirstOrDefault() is ClassInstanceNode inheritedFromNode) + { + skipFirstMember = true; + + writer.Write(" : public "); + writer.Write(inheritedFromNode.InnerNode.Name); + } + + if (!string.IsNullOrEmpty(@class.Comment)) + { + writer.Write(" // "); + writer.Write(@class.Comment); + } + + writer.WriteLine(); + + writer.WriteLine("{"); + writer.WriteLine("public:"); + writer.Indent++; + + var nodes = @class.Nodes + .Skip(skipFirstMember ? 1 : 0) + .WhereNot(n => n is FunctionNode); + WriteNodes(writer, nodes, logger); + + var vTableNodes = @class.Nodes.OfType().ToList(); + if (vTableNodes.Any()) + { + writer.WriteLine(); + + var virtualMethodNodes = vTableNodes + .SelectMany(vt => vt.Nodes) + .OfType(); + foreach (var node in virtualMethodNodes) + { + writer.Write("virtual void "); + writer.Write(node.MethodName); + writer.WriteLine("();"); + } + } + + var functionNodes = classes + .SelectMany(c2 => c2.Nodes) + .OfType() + .Where(f => f.BelongsToClass == @class) + .ToList(); + if (functionNodes.Any()) + { + writer.WriteLine(); + + foreach (var node in functionNodes) + { + writer.Write(node.Signature); + writer.WriteLine("{ }"); + } + } + + writer.Indent--; + writer.Write("}; //Size: 0x"); + writer.WriteLine($"{@class.MemorySize:X04}"); + + writer.WriteLine($"static_assert(sizeof({@class.Name}) == 0x{@class.MemorySize:X});"); + } + + /// + /// Outputs the C++ code for the given nodes to the instance. + /// + /// The writer to output to. + /// The nodes to output. + /// The logger. + private void WriteNodes(IndentedTextWriter writer, IEnumerable nodes, ILogger logger) + { + Contract.Requires(writer != null); + Contract.Requires(nodes != null); + + var fill = 0; + var fillStart = 0; + + static BaseNode CreatePaddingMember(int offset, int count) + { + var node = new ArrayNode + { + Offset = offset, + Count = count, + Name = $"pad_{offset:X04}" + }; + + node.ChangeInnerNode(new Utf8CharacterNode()); + + return node; + } + + foreach (var member in nodes.WhereNot(m => m is VirtualMethodTableNode)) + { + if (member is BaseHexNode) + { + if (fill == 0) + { + fillStart = member.Offset; + } + fill += member.MemorySize; + + continue; + } + + if (fill != 0) + { + WriteNode(writer, CreatePaddingMember(fillStart, fill), logger); + + fill = 0; + } + + WriteNode(writer, member, logger); + } + + if (fill != 0) + { + WriteNode(writer, CreatePaddingMember(fillStart, fill), logger); + } + } + + /// + /// Outputs the C++ code for the given node to the instance. + /// + /// The writer to output to. + /// The node to output. + /// The logger. + private void WriteNode(IndentedTextWriter writer, BaseNode node, ILogger logger) + { + Contract.Requires(writer != null); + Contract.Requires(node != null); + + var custom = GetCustomCodeGeneratorForNode(node); + if (custom != null) + { + if (custom.WriteNode(writer, node, WriteNode, logger)) + { + return; + } + } + + node = TransformNode(node); + + var simpleType = GetTypeDefinition(node, logger); + if (simpleType != null) + { + //$"{type} {node.Name}; //0x{node.Offset.ToInt32():X04} {node.Comment}".Trim(); + writer.Write(simpleType); + writer.Write(" "); + writer.Write(node.Name); + writer.Write("; //0x"); + writer.Write($"{node.Offset:X04}"); + if (!string.IsNullOrEmpty(node.Comment)) + { + writer.Write(" "); + writer.Write(node.Comment); + } + writer.WriteLine(); + } + else if (node is BaseWrapperNode) + { + writer.Write(ResolveWrappedType(node, false, logger)); + writer.Write("; //0x"); + writer.Write($"{node.Offset:X04}"); + if (!string.IsNullOrEmpty(node.Comment)) + { + writer.Write(" "); + writer.Write(node.Comment); + } + writer.WriteLine(); + } + else if (node is UnionNode unionNode) + { + writer.Write("union //0x"); + writer.Write($"{node.Offset:X04}"); + if (!string.IsNullOrEmpty(node.Comment)) + { + writer.Write(" "); + writer.Write(node.Comment); + } + writer.WriteLine(); + writer.WriteLine("{"); + writer.Indent++; + + WriteNodes(writer, unionNode.Nodes, logger); + + writer.Indent--; + writer.WriteLine("};"); + } + else + { + logger.Log(LogLevel.Error, $"Skipping node with unhandled type: {node.GetType()}"); + } + } + + /// + /// Transforms the given node into some other node if necessary. + /// + /// The node to transform. + /// The transformed node. + private static BaseNode TransformNode(BaseNode node) + { + var custom = GetCustomCodeGeneratorForNode(node); + if (custom != null) + { + return custom.TransformNode(node); + } + + static BaseNode GetCharacterNodeForEncoding(Encoding encoding) + { + if (encoding.IsSameCodePage(Encoding.Unicode)) + { + return new Utf16CharacterNode(); + } + if (encoding.IsSameCodePage(Encoding.UTF32)) + { + return new Utf32CharacterNode(); + } + return new Utf8CharacterNode(); + } + + switch (node) + { + case BaseTextNode textNode: + { + var arrayNode = new ArrayNode { Count = textNode.Length }; + arrayNode.CopyFromNode(node); + arrayNode.ChangeInnerNode(GetCharacterNodeForEncoding(textNode.Encoding)); + return arrayNode; + } + case BaseTextPtrNode textPtrNode: + { + var pointerNode = new PointerNode(); + pointerNode.CopyFromNode(node); + pointerNode.ChangeInnerNode(GetCharacterNodeForEncoding(textPtrNode.Encoding)); + return pointerNode; + } + case BitFieldNode bitFieldNode: + { + var underlayingNode = bitFieldNode.GetUnderlayingNode(); + underlayingNode.CopyFromNode(node); + return underlayingNode; + } + case BaseHexNode hexNode: + { + var arrayNode = new ArrayNode { Count = hexNode.MemorySize }; + arrayNode.CopyFromNode(node); + arrayNode.ChangeInnerNode(new Utf8CharacterNode()); + return arrayNode; + } + } + + return node; + } + + /// + /// Gets the type definition for the given node. If the node is not a simple node null is returned. + /// + /// The target node. + /// The logger. + /// The type definition for the node or null if no simple type is available. + private string GetTypeDefinition(BaseNode node, ILogger logger) + { + Contract.Requires(node != null); + + var custom = GetCustomCodeGeneratorForNode(node); + if (custom != null) + { + return custom.GetTypeDefinition(node, GetTypeDefinition, ResolveWrappedType, logger); + } + + if (nodeTypeToTypeDefinationMap.TryGetValue(node.GetType(), out var type)) + { + return type; + } + + switch (node) + { + case ClassInstanceNode classInstanceNode: + return $"class {classInstanceNode.InnerNode.Name}"; + case EnumNode enumNode: + return enumNode.Enum.Name; + } + + return null; + } + + /// + /// Resolves the type of a node ( and ). + /// + /// The node to resolve. + /// Specify if the expression should be anonymous. + /// The logger. + /// The resolved type of the node. + private string ResolveWrappedType(BaseNode node, bool isAnonymousExpression, ILogger logger) + { + Contract.Requires(node != null); + + var sb = new StringBuilder(); + if (!isAnonymousExpression) + { + sb.Append(node.Name); + } + + BaseNode lastWrapperNode = null; + var currentNode = node; + + while (true) + { + currentNode = TransformNode(currentNode); + + if (currentNode is PointerNode pointerNode) + { + sb.Prepend('*'); + + if (pointerNode.InnerNode == null) // void* + { + if (!isAnonymousExpression) + { + sb.Prepend(' '); + } + sb.Prepend("void"); + break; + } + + lastWrapperNode = pointerNode; + currentNode = pointerNode.InnerNode; + } + else if (currentNode is ArrayNode arrayNode) + { + if (lastWrapperNode is PointerNode) + { + sb.Prepend('('); + sb.Append(')'); + } + + sb.Append($"[{arrayNode.Count}]"); + + lastWrapperNode = arrayNode; + currentNode = arrayNode.InnerNode; + } + else + { + var simpleType = GetTypeDefinition(currentNode, logger); + + if (!isAnonymousExpression) + { + sb.Prepend(' '); + } + + sb.Prepend(simpleType); + break; + } + } + + return sb.ToString().Trim(); + } + } +} diff --git a/CodeGenerator/ICodeGenerator.cs b/ReClass.NET/CodeGenerator/ICodeGenerator.cs similarity index 66% rename from CodeGenerator/ICodeGenerator.cs rename to ReClass.NET/CodeGenerator/ICodeGenerator.cs index a45f76cc..159a64d4 100644 --- a/CodeGenerator/ICodeGenerator.cs +++ b/ReClass.NET/CodeGenerator/ICodeGenerator.cs @@ -3,10 +3,11 @@ using System.Diagnostics.Contracts; using ReClassNET.Logger; using ReClassNET.Nodes; +using ReClassNET.Project; namespace ReClassNET.CodeGenerator { - [ContractClass(typeof(ICodeGeneratorContract))] + [ContractClass(typeof(CodeGeneratorContract))] public interface ICodeGenerator { /// The language this generator produces. @@ -16,21 +17,15 @@ public interface ICodeGenerator /// The classes to generate code from. /// The logger used to output messages. /// The code for the classes. - string GenerateCode(IEnumerable classes, ILogger logger); + string GenerateCode(IReadOnlyList classes, IReadOnlyList enums, ILogger logger); } [ContractClassFor(typeof(ICodeGenerator))] - internal abstract class ICodeGeneratorContract : ICodeGenerator + internal abstract class CodeGeneratorContract : ICodeGenerator { - public Language Language - { - get - { - throw new NotImplementedException(); - } - } + public Language Language => throw new NotImplementedException(); - public string GenerateCode(IEnumerable classes, ILogger logger) + public string GenerateCode(IReadOnlyList classes, IReadOnlyList enums, ILogger logger) { Contract.Requires(classes != null); Contract.Requires(Contract.ForAll(classes, c => c != null)); diff --git a/CodeGenerator/Language.cs b/ReClass.NET/CodeGenerator/Language.cs similarity index 100% rename from CodeGenerator/Language.cs rename to ReClass.NET/CodeGenerator/Language.cs diff --git a/ReClass.NET/Constants.cs b/ReClass.NET/Constants.cs new file mode 100644 index 00000000..4e54782a --- /dev/null +++ b/ReClass.NET/Constants.cs @@ -0,0 +1,43 @@ +namespace ReClassNET +{ + public class Constants + { + public const string ApplicationName = "ReClass.NET"; + + public const string ApplicationExecutableName = ApplicationName + ".exe"; + + public const string ApplicationVersion = "1.2"; + + public const string LauncherExecutableName = ApplicationName + "_Launcher.exe"; + + public const string Author = "KN4CK3R"; + + public const string HomepageUrl = "https://github.com/ReClassNET/ReClass.NET"; + + public const string HelpUrl = "https://github.com/ReClassNET/ReClass.NET/issues"; + + public const string PluginUrl = "https://github.com/ReClassNET/ReClass.NET#plugins"; + +#if RECLASSNET64 + public const string Platform = "x64"; + + public const string AddressHexFormat = "X016"; +#else + public const string Platform = "x86"; + + public const string AddressHexFormat = "X08"; +#endif + + public const string SettingsFile = "settings.xml"; + + public const string PluginsFolder = "Plugins"; + + public static class CommandLineOptions + { + public const string AttachTo = "attachto"; + + public const string FileExtRegister = "registerfileext"; + public const string FileExtUnregister = "unregisterfileext"; + } + } +} diff --git a/UI/BannerBox.cs b/ReClass.NET/Controls/BannerBox.cs similarity index 64% rename from UI/BannerBox.cs rename to ReClass.NET/Controls/BannerBox.cs index 16a89e74..b3cdab8c 100644 --- a/UI/BannerBox.cs +++ b/ReClass.NET/Controls/BannerBox.cs @@ -1,9 +1,9 @@ -using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; +using ReClassNET.UI; -namespace ReClassNET.UI +namespace ReClassNET.Controls { public class BannerBox : Control, ISupportInitialize { @@ -17,11 +17,11 @@ public class BannerBox : Control, ISupportInitialize private Image image; - public Image Icon { get { return icon; } set { icon = value; UpdateBanner(); } } + public Image Icon { get => icon; set { icon = value; UpdateBanner(); } } - public string Title { get { return title; } set { title = value ?? string.Empty; UpdateBanner(); } } + public string Title { get => title; set { title = value ?? string.Empty; UpdateBanner(); } } - public override string Text { get { return text; } set { text = value ?? string.Empty; UpdateBanner(); } } + public override string Text { get => text; set { text = value ?? string.Empty; UpdateBanner(); } } public BannerBox() { @@ -33,7 +33,7 @@ protected override void SetBoundsCore(int x, int y, int width, int height, Bound { int oldWidth = Width; - base.SetBoundsCore(x, y, width, DefaultBannerHeight, specified); + base.SetBoundsCore(x, y, width, DpiUtil.ScaleIntY(DefaultBannerHeight), specified); if (oldWidth != width && width > 0) { @@ -72,18 +72,15 @@ private void UpdateBanner() { var oldImage = image; - image = BannerFactory.CreateBanner(Width, DefaultBannerHeight, icon, title, text, true); + image = BannerFactory.CreateBanner(Width, Height, icon, title, text, true); - if (oldImage != null) - { - oldImage.Dispose(); - } + oldImage?.Dispose(); Invalidate(); } - catch (Exception) + catch { - + // ignored } } } diff --git a/UI/ColorBox.Designer.cs b/ReClass.NET/Controls/ColorBox.Designer.cs similarity index 92% rename from UI/ColorBox.Designer.cs rename to ReClass.NET/Controls/ColorBox.Designer.cs index ccc1be6b..0757df19 100644 --- a/UI/ColorBox.Designer.cs +++ b/ReClass.NET/Controls/ColorBox.Designer.cs @@ -1,4 +1,4 @@ -namespace ReClassNET.UI +namespace ReClassNET.Controls { partial class ColorBox { @@ -38,7 +38,7 @@ private void InitializeComponent() this.valueTextBox.Name = "valueTextBox"; this.valueTextBox.Size = new System.Drawing.Size(86, 20); this.valueTextBox.TabIndex = 0; - this.valueTextBox.TextChanged += new System.EventHandler(this.valueTextBox_TextChanged); + this.valueTextBox.TextChanged += new System.EventHandler(this.OnTextChanged); // // colorPanel // @@ -46,8 +46,8 @@ private void InitializeComponent() this.colorPanel.Name = "colorPanel"; this.colorPanel.Size = new System.Drawing.Size(30, 20); this.colorPanel.TabIndex = 1; - this.colorPanel.Click += new System.EventHandler(this.colorPanel_Click); - this.colorPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.colorPanel_Paint); + this.colorPanel.Click += new System.EventHandler(this.OnPanelClick); + this.colorPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.OnPanelPaint); // // ColorBox // diff --git a/ReClass.NET/Controls/ColorBox.cs b/ReClass.NET/Controls/ColorBox.cs new file mode 100644 index 00000000..9325e645 --- /dev/null +++ b/ReClass.NET/Controls/ColorBox.cs @@ -0,0 +1,106 @@ +using System; +using System.ComponentModel; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Windows.Forms; + +namespace ReClassNET.Controls +{ + [DefaultEvent(nameof(ColorChanged))] + [DefaultBindingProperty(nameof(Color))] + public partial class ColorBox : UserControl + { + private const int DefaultWidth = 123; + private const int DefaultHeight = 20; + + private bool updateTextBox = true; + + public event EventHandler ColorChanged; + + private Color color; + public Color Color + { + get => color; + set + { + // Normalize the color because Color.Red != Color.FromArgb(255, 0, 0) + value = Color.FromArgb(value.ToArgb()); + if (color != value) + { + color = value; + + colorPanel.BackColor = value; + if (updateTextBox) + { + valueTextBox.Text = ColorTranslator.ToHtml(value); + } + + OnColorChanged(EventArgs.Empty); + } + + updateTextBox = true; + } + } + + protected virtual void OnColorChanged(EventArgs e) + { + Contract.Requires(e != null); + + var eh = ColorChanged; + eh?.Invoke(this, e); + } + + public ColorBox() + { + InitializeComponent(); + } + + protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) + { + base.SetBoundsCore(x, y, DefaultWidth, DefaultHeight, specified); + } + + private void OnTextChanged(object sender, EventArgs e) + { + try + { + var str = valueTextBox.Text; + if (!str.StartsWith("#")) + { + str = "#" + str; + } + + var newColor = ColorTranslator.FromHtml(str); + + updateTextBox = false; + Color = newColor; + } + catch + { + // ignored + } + } + + private void OnPanelClick(object sender, EventArgs e) + { + using var cd = new ColorDialog + { + FullOpen = true, + Color = Color + }; + + if (cd.ShowDialog() == DialogResult.OK) + { + Color = cd.Color; + } + } + + private void OnPanelPaint(object sender, PaintEventArgs e) + { + var rect = colorPanel.ClientRectangle; + rect.Width--; + rect.Height--; + e.Graphics.DrawRectangle(Pens.Black, rect); + } + } +} diff --git a/UI/ColorBox.resx b/ReClass.NET/Controls/ColorBox.resx similarity index 100% rename from UI/ColorBox.resx rename to ReClass.NET/Controls/ColorBox.resx diff --git a/UI/CustomToolStripItems.cs b/ReClass.NET/Controls/CustomToolStripItems.cs similarity index 66% rename from UI/CustomToolStripItems.cs rename to ReClass.NET/Controls/CustomToolStripItems.cs index f10b95ec..ea186f17 100644 --- a/UI/CustomToolStripItems.cs +++ b/ReClass.NET/Controls/CustomToolStripItems.cs @@ -1,23 +1,23 @@ -using System; +using System; using System.Windows.Forms; using System.Windows.Forms.Design; -namespace ReClassNET.UI +namespace ReClassNET.Controls { [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All)] - class IntegerToolStripMenuItem : ToolStripMenuItem + public class IntegerToolStripMenuItem : ToolStripMenuItem { public int Value { get; set; } } [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All)] - class TypeToolStripMenuItem : ToolStripMenuItem + public class TypeToolStripMenuItem : ToolStripMenuItem { public Type Value { get; set; } } [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All)] - class TypeToolStripButton : ToolStripButton + public class TypeToolStripButton : ToolStripButton { public Type Value { get; set; } } diff --git a/ReClass.NET/Controls/DrawContext.cs b/ReClass.NET/Controls/DrawContext.cs new file mode 100644 index 00000000..6d233780 --- /dev/null +++ b/ReClass.NET/Controls/DrawContext.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Controls +{ + public class DrawContext + { + public Settings Settings { get; set; } + + public Graphics Graphics { get; set; } + public FontEx Font { get; set; } + public IconProvider IconProvider { get; set; } + + public RemoteProcess Process { get; set; } + public MemoryBuffer Memory { get; set; } + + public DateTime CurrentTime { get; set; } + + public Rectangle ClientArea { get; set; } + public List HotSpots { get; set; } + public IntPtr Address { get; set; } + public int Level { get; set; } + public bool MultipleNodesSelected { get; set; } + + public DrawContext Clone() + { + return new DrawContext + { + Settings = Settings, + Graphics = Graphics, + Font = Font, + IconProvider = IconProvider, + Process = Process, + Memory = Memory, + CurrentTime = CurrentTime, + ClientArea = ClientArea, + HotSpots = HotSpots, + Address = Address, + Level = Level, + MultipleNodesSelected = MultipleNodesSelected + }; + } + } +} diff --git a/ReClass.NET/Controls/DrawContextRequestEventArgs.cs b/ReClass.NET/Controls/DrawContextRequestEventArgs.cs new file mode 100644 index 00000000..13c04d03 --- /dev/null +++ b/ReClass.NET/Controls/DrawContextRequestEventArgs.cs @@ -0,0 +1,26 @@ +using System; +using ReClassNET.Memory; +using ReClassNET.Nodes; +using ReClassNET.UI; + +namespace ReClassNET.Controls +{ + public class DrawContextRequestEventArgs : EventArgs + { + public DateTime CurrentTime { get; set; } = DateTime.UtcNow; + + public Settings Settings { get; set; } + + public IconProvider IconProvider { get; set; } + + public RemoteProcess Process { get; set; } + + public MemoryBuffer Memory { get; set; } + + public BaseNode Node { get; set; } + + public IntPtr BaseAddress { get; set; } + } + + public delegate void DrawContextRequestEventHandler(object sender, DrawContextRequestEventArgs args); +} diff --git a/ReClass.NET/Controls/DualValueBox.Designer.cs b/ReClass.NET/Controls/DualValueBox.Designer.cs new file mode 100644 index 00000000..dd5a675b --- /dev/null +++ b/ReClass.NET/Controls/DualValueBox.Designer.cs @@ -0,0 +1,119 @@ +namespace ReClassNET.Controls +{ + partial class DualValueBox + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.value1TextBox = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.value2TextBox = new System.Windows.Forms.TextBox(); + this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel.SuspendLayout(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Margin = new System.Windows.Forms.Padding(0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(37, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Value:"; + // + // value1TextBox + // + this.value1TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.value1TextBox.Location = new System.Drawing.Point(0, 13); + this.value1TextBox.Margin = new System.Windows.Forms.Padding(0); + this.value1TextBox.Name = "value1TextBox"; + this.value1TextBox.Size = new System.Drawing.Size(255, 20); + this.value1TextBox.TabIndex = 1; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(255, 0); + this.label2.Margin = new System.Windows.Forms.Padding(0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(1, 13); + this.label2.TabIndex = 2; + this.label2.Text = "Value 2:"; + // + // value2TextBox + // + this.value2TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.value2TextBox.Location = new System.Drawing.Point(255, 13); + this.value2TextBox.Margin = new System.Windows.Forms.Padding(1, 0, 0, 0); + this.value2TextBox.Name = "value2TextBox"; + this.value2TextBox.Size = new System.Drawing.Size(1, 20); + this.value2TextBox.TabIndex = 3; + // + // tableLayoutPanel + // + this.tableLayoutPanel.ColumnCount = 2; + this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 0F)); + this.tableLayoutPanel.Controls.Add(this.label1, 0, 0); + this.tableLayoutPanel.Controls.Add(this.value2TextBox, 1, 1); + this.tableLayoutPanel.Controls.Add(this.value1TextBox, 0, 1); + this.tableLayoutPanel.Controls.Add(this.label2, 1, 0); + this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel.Name = "tableLayoutPanel"; + this.tableLayoutPanel.RowCount = 2; + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel.Size = new System.Drawing.Size(255, 34); + this.tableLayoutPanel.TabIndex = 4; + // + // DualValueBox + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tableLayoutPanel); + this.Name = "DualValueBox"; + this.Size = new System.Drawing.Size(255, 34); + this.tableLayoutPanel.ResumeLayout(false); + this.tableLayoutPanel.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox value1TextBox; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox value2TextBox; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; + } +} diff --git a/ReClass.NET/Controls/DualValueBox.cs b/ReClass.NET/Controls/DualValueBox.cs new file mode 100644 index 00000000..d2b8d264 --- /dev/null +++ b/ReClass.NET/Controls/DualValueBox.cs @@ -0,0 +1,79 @@ +using System.ComponentModel; +using System.Windows.Forms; +using System.Windows.Forms.Design; + +namespace ReClassNET.Controls +{ + [Designer(typeof(DualValueControlDesigner))] + public partial class DualValueBox : UserControl + { + public bool ShowSecondInputField + { + get => tableLayoutPanel.ColumnStyles[0].Width <= 99; + set + { + if (value) + { + tableLayoutPanel.ColumnStyles[1].SizeType = SizeType.Percent; + tableLayoutPanel.ColumnStyles[1].Width = 50; + tableLayoutPanel.ColumnStyles[0].Width = 50; + value1TextBox.Margin = new Padding(0, 0, 1, 0); + } + else + { + tableLayoutPanel.ColumnStyles[1].SizeType = SizeType.Absolute; + tableLayoutPanel.ColumnStyles[1].Width = 0; + tableLayoutPanel.ColumnStyles[0].Width = 100; + value1TextBox.Margin = new Padding(0); + value2TextBox.Text = null; + } + } + } + + public string Value1 + { + get => value1TextBox.Text; + set => value1TextBox.Text = value; + } + + public string Value2 + { + get => value2TextBox.Text; + set => value2TextBox.Text = value; + } + + public DualValueBox() + { + InitializeComponent(); + } + + protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) + { + base.SetBoundsCore(x, y, width, 34, specified); + } + + public void Clear() => Clear(true, true); + + public void Clear(bool clearValue1, bool clearValue2) + { + if (clearValue1) + { + value1TextBox.Clear(); + } + if (clearValue2) + { + value2TextBox.Clear(); + } + } + } + + internal class DualValueControlDesigner : ControlDesigner + { + DualValueControlDesigner() + { + AutoResizeHandles = true; + } + + public override SelectionRules SelectionRules => SelectionRules.LeftSizeable | SelectionRules.RightSizeable | SelectionRules.Moveable; + } +} diff --git a/Forms/CodeForm.resx b/ReClass.NET/Controls/DualValueBox.resx similarity index 100% rename from Forms/CodeForm.resx rename to ReClass.NET/Controls/DualValueBox.resx diff --git a/ReClass.NET/Controls/EnumComboBox.cs b/ReClass.NET/Controls/EnumComboBox.cs new file mode 100644 index 00000000..4875b85d --- /dev/null +++ b/ReClass.NET/Controls/EnumComboBox.cs @@ -0,0 +1,125 @@ +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Windows.Forms; +using ReClassNET.Extensions; + +namespace ReClassNET.Controls +{ + public class EnumComboBox : ComboBox where TEnum : struct + { + #region Properties + + [Browsable(false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ObjectCollection Items => new ObjectCollection(this); + + [Browsable(false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new AutoCompleteMode AutoCompleteMode { get => AutoCompleteMode.None; set { } } + + [Browsable(false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new ComboBoxStyle DropDownStyle { get => ComboBoxStyle.DropDownList; set { } } + + [Browsable(false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new string DisplayMember { get; set; } + + [Browsable(false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new bool FormattingEnabled { get; set; } + + [Browsable(false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new string ValueMember { get; set; } + + [Browsable(false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new object DataSource { get; set; } + + [Browsable(false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new TEnum SelectedValue + { + get => ((EnumDescriptionDisplay)base.SelectedItem)?.Value ?? default; + set => base.SelectedItem = base.Items.Cast>().PredicateOrFirst(e => e.Value.Equals(value)); + } + + [Browsable(false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new TEnum SelectedItem + { + get => SelectedValue; + set => SelectedValue = value; + } + + [Browsable(false)] + [EditorBrowsable(EditorBrowsableState.Never)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new string SelectedText + { + get => ((EnumDescriptionDisplay)base.SelectedItem).Description; + set => base.SelectedItem = base.Items.Cast>().PredicateOrFirst(e => e.Description.Equals(value)); + } + + #endregion + + public EnumComboBox() + { + base.AutoCompleteMode = AutoCompleteMode.None; + base.DropDownStyle = ComboBoxStyle.DropDownList; + base.FormattingEnabled = false; + base.DisplayMember = nameof(EnumDescriptionDisplay.Description); + base.ValueMember = nameof(EnumDescriptionDisplay.Value); + + SetValues(EnumDescriptionDisplay.Create()); + if (base.Items.Count != 0) + { + SelectedIndex = 0; + } + } + + public void SetAvailableValues(TEnum item1, params TEnum[] items) + { + SetAvailableValues(items.Prepend(item1)); + } + + public void SetAvailableValues(IEnumerable values) + { + Contract.Requires(values != null); + + SetValues(EnumDescriptionDisplay.CreateExact(values)); + } + + public void SetAvailableValuesExclude(TEnum item1, params TEnum[] items) + { + SetAvailableValuesExclude(items.Prepend(item1)); + } + + public void SetAvailableValuesExclude(IEnumerable values) + { + Contract.Requires(values != null); + + SetValues(EnumDescriptionDisplay.CreateExclude(values)); + } + + private void SetValues(List> values) + { + Contract.Requires(values != null); + + base.Items.Clear(); + base.Items.AddRange(values.ToArray()); + } + } +} diff --git a/ReClass.NET/Controls/EnumDescriptionDisplay.cs b/ReClass.NET/Controls/EnumDescriptionDisplay.cs new file mode 100644 index 00000000..e2fa4c1b --- /dev/null +++ b/ReClass.NET/Controls/EnumDescriptionDisplay.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Reflection; + +namespace ReClassNET.Controls +{ + public class EnumDescriptionDisplay where TEnum : struct + { + public TEnum Value { get; internal set; } + public string Description { get; internal set; } + + public static List> Create() + { + Contract.Ensures(Contract.Result>>() != null); + + return CreateExact(Enum.GetValues(typeof(TEnum)).Cast()); + } + + public static List> CreateExact(IEnumerable include) + { + Contract.Requires(include != null); + Contract.Ensures(Contract.Result>>() != null); + + return include + .Select(value => new EnumDescriptionDisplay + { + Description = GetDescription(value), + Value = value + }) + .OrderBy(item => item.Value) + .ToList(); + } + + public static List> CreateExclude(IEnumerable exclude) + { + Contract.Requires(exclude != null); + Contract.Ensures(Contract.Result>>() != null); + + return Enum.GetValues(typeof(TEnum)) + .Cast() + .Except(exclude) + .Select(value => new EnumDescriptionDisplay + { + Description = GetDescription(value), + Value = value + }) + .OrderBy(item => item.Value) + .ToList(); + } + + private static string GetDescription(TEnum value) + { + Contract.Ensures(Contract.Result() != null); + + return value.GetType().GetField(value.ToString()).GetCustomAttribute()?.Description ?? value.ToString(); + } + } +} diff --git a/ReClass.NET/Controls/HotSpotTextBox.cs b/ReClass.NET/Controls/HotSpotTextBox.cs new file mode 100644 index 00000000..218cdeb7 --- /dev/null +++ b/ReClass.NET/Controls/HotSpotTextBox.cs @@ -0,0 +1,130 @@ +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; +using ReClassNET.UI; + +namespace ReClassNET.Controls +{ + public class HotSpotTextBox : TextBox + { + private HotSpot currentHotSpot; + + private FontEx font; + private int minimumWidth; + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public new FontEx Font + { + get => font; + set + { + if (font != value) + { + font = value; + + base.Font = font.Font; + } + } + } + + public event HotSpotTextBoxCommitEventHandler Committed; + + public HotSpotTextBox() + { + BorderStyle = BorderStyle.None; + } + + #region Events + + protected override void OnVisibleChanged(EventArgs e) + { + base.OnVisibleChanged(e); + + if (Visible) + { + BackColor = Program.Settings.BackgroundColor; + + if (currentHotSpot != null) + { + Focus(); + Select(0, TextLength); + } + } + } + + protected override void OnKeyDown(KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + OnCommit(); + + e.Handled = true; + e.SuppressKeyPress = true; + } + + base.OnKeyDown(e); + } + + protected override void OnTextChanged(EventArgs e) + { + base.OnTextChanged(e); + + var w = (TextLength + 1) * font.Width; + if (w > minimumWidth) + { + Width = w; + } + } + + private void OnCommit() + { + Visible = false; + + currentHotSpot.Text = Text.Trim(); + + Committed?.Invoke(this, new HotSpotTextBoxCommitEventArgs(currentHotSpot)); + } + + #endregion + + public void ShowOnHotSpot(HotSpot hotSpot) + { + currentHotSpot = hotSpot; + + if (hotSpot == null) + { + Visible = false; + + return; + } + + AlignToRect(hotSpot.Rect); + + Text = hotSpot.Text.Trim(); + ReadOnly = hotSpot.Id == HotSpot.ReadOnlyId; + + Visible = true; + } + + private void AlignToRect(Rectangle rect) + { + SetBounds(rect.Left + 2, rect.Top, rect.Width, rect.Height); + + minimumWidth = rect.Width; + } + } + + public delegate void HotSpotTextBoxCommitEventHandler(object sender, HotSpotTextBoxCommitEventArgs e); + + public class HotSpotTextBoxCommitEventArgs : EventArgs + { + public HotSpot HotSpot { get; set; } + + public HotSpotTextBoxCommitEventArgs(HotSpot hotSpot) + { + HotSpot = hotSpot; + } + } +} diff --git a/ReClass.NET/Controls/HotkeyBox.Designer.cs b/ReClass.NET/Controls/HotkeyBox.Designer.cs new file mode 100644 index 00000000..c65ead37 --- /dev/null +++ b/ReClass.NET/Controls/HotkeyBox.Designer.cs @@ -0,0 +1,84 @@ +namespace ReClassNET.Controls +{ + partial class HotkeyBox + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.timer = new System.Windows.Forms.Timer(this.components); + this.textBox = new System.Windows.Forms.TextBox(); + this.clearButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // timer + // + this.timer.Enabled = true; + this.timer.Interval = 50; + this.timer.Tick += new System.EventHandler(this.timer_Tick); + // + // textBox + // + this.textBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.textBox.Enabled = false; + this.textBox.Location = new System.Drawing.Point(0, 0); + this.textBox.Name = "textBox"; + this.textBox.Size = new System.Drawing.Size(140, 20); + this.textBox.TabIndex = 0; + this.textBox.Enter += new System.EventHandler(this.textBox_Enter); + this.textBox.Leave += new System.EventHandler(this.textBox_Leave); + // + // clearButton + // + this.clearButton.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.clearButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Delete; + this.clearButton.Location = new System.Drawing.Point(142, 0); + this.clearButton.Name = "clearButton"; + this.clearButton.Size = new System.Drawing.Size(20, 20); + this.clearButton.TabIndex = 1; + this.clearButton.UseVisualStyleBackColor = true; + this.clearButton.Click += new System.EventHandler(this.clearButton_Click); + // + // HotkeyBox + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.clearButton); + this.Controls.Add(this.textBox); + this.Name = "HotkeyBox"; + this.Size = new System.Drawing.Size(162, 20); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Timer timer; + private System.Windows.Forms.TextBox textBox; + private System.Windows.Forms.Button clearButton; + } +} diff --git a/ReClass.NET/Controls/HotkeyBox.cs b/ReClass.NET/Controls/HotkeyBox.cs new file mode 100644 index 00000000..9a24e7b3 --- /dev/null +++ b/ReClass.NET/Controls/HotkeyBox.cs @@ -0,0 +1,84 @@ +using System; +using System.ComponentModel; +using System.Linq; +using System.Windows.Forms; +using System.Windows.Forms.Design; +using ReClassNET.Input; + +namespace ReClassNET.Controls +{ + [Designer(typeof(HotkeyBoxDesigner))] + public partial class HotkeyBox : UserControl + { + public KeyboardInput Input { get; set; } + + public KeyboardHotkey Hotkey { get; } = new KeyboardHotkey(); + + public HotkeyBox() + { + InitializeComponent(); + + DisplayHotkey(); + } + + protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) + { + base.SetBoundsCore(x, y, width, 20, specified); + } + + private void textBox_Enter(object sender, EventArgs e) + { + timer.Enabled = true; + } + + private void textBox_Leave(object sender, EventArgs e) + { + timer.Enabled = false; + } + + private void timer_Tick(object sender, EventArgs e) + { + if (Input == null) + { + return; + } + + var keys = Input.GetPressedKeys(); + if (keys.Length != 0) + { + foreach (var key in keys.Select(k => k & Keys.KeyCode).Where(k => k != Keys.None)) + { + Hotkey.AddKey(key); + } + DisplayHotkey(); + } + } + + private void clearButton_Click(object sender, EventArgs e) + { + Clear(); + } + + private void DisplayHotkey() + { + textBox.Text = Hotkey.ToString(); + } + + public void Clear() + { + Hotkey.Clear(); + + DisplayHotkey(); + } + } + + internal class HotkeyBoxDesigner : ControlDesigner + { + private HotkeyBoxDesigner() + { + AutoResizeHandles = true; + } + + public override SelectionRules SelectionRules => SelectionRules.LeftSizeable | SelectionRules.RightSizeable | SelectionRules.Moveable; + } +} diff --git a/UI/ClassNodeView.resx b/ReClass.NET/Controls/HotkeyBox.resx similarity index 93% rename from UI/ClassNodeView.resx rename to ReClass.NET/Controls/HotkeyBox.resx index a6b10143..e22c5ac6 100644 --- a/UI/ClassNodeView.resx +++ b/ReClass.NET/Controls/HotkeyBox.resx @@ -117,10 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 - - 193, 17 - \ No newline at end of file diff --git a/ReClass.NET/Controls/IconButton.cs b/ReClass.NET/Controls/IconButton.cs new file mode 100644 index 00000000..5d45a198 --- /dev/null +++ b/ReClass.NET/Controls/IconButton.cs @@ -0,0 +1,191 @@ +using System; +using System.ComponentModel; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; +using System.Windows.Forms.Design; + +namespace ReClassNET.Controls +{ + /// + /// Based on . + /// + [DefaultEvent("Click")] + public class IconButton : Panel + { + public bool Pressed { get; set; } + public bool Selected { get; set; } + + public Image Image { get; set; } + public Rectangle ImageRectangle { get; } = new Rectangle(3, 3, 16, 16); + + private readonly ProfessionalColorTable colorTable = new ProfessionalColorTable(); + + public IconButton() + { + DoubleBuffered = true; + } + + protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified) + { + base.SetBoundsCore(x, y, 23, 22, specified); + } + + protected override void Select(bool directed, bool forward) + { + base.Select(directed, forward); + + Selected = true; + } + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + + Pressed = true; + + Invalidate(); + } + + protected override void OnMouseUp(MouseEventArgs e) + { + base.OnMouseUp(e); + + Pressed = false; + + Invalidate(); + } + + protected override void OnMouseEnter(EventArgs e) + { + base.OnMouseEnter(e); + + Selected = true; + + Invalidate(); + } + + protected override void OnMouseLeave(EventArgs e) + { + base.OnMouseLeave(e); + + Selected = false; + Pressed = false; + + Invalidate(); + } + + protected override void OnPaint(PaintEventArgs e) + { + RenderButtonBackground(e.Graphics); + RenderImage(e.Graphics); + } + + private void RenderButtonBackground(Graphics g) + { + Contract.Requires(g != null); + + var bounds = new Rectangle(Point.Empty, Size); + var drawHotBorder = true; + + if (Pressed) + { + RenderPressedButtonFill(g, bounds); + } + else if (Selected) + { + RenderSelectedButtonFill(g, bounds); + } + else + { + drawHotBorder = false; + using var brush = new SolidBrush(BackColor); + + g.FillRectangle(brush, bounds); + } + + if (drawHotBorder) + { + using var pen = new Pen(colorTable.ButtonSelectedBorder); + + g.DrawRectangle(pen, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); + } + } + + private void RenderPressedButtonFill(Graphics g, Rectangle bounds) + { + Contract.Requires(g != null); + + if (bounds.Width == 0 || bounds.Height == 0) + { + return; + } + + using var brush = new LinearGradientBrush(bounds, colorTable.ButtonPressedGradientBegin, colorTable.ButtonPressedGradientEnd, LinearGradientMode.Vertical); + + g.FillRectangle(brush, bounds); + } + + private void RenderSelectedButtonFill(Graphics g, Rectangle bounds) + { + Contract.Requires(g != null); + + if (bounds.Width == 0 || bounds.Height == 0) + { + return; + } + + using var brush = new LinearGradientBrush(bounds, colorTable.ButtonSelectedGradientBegin, colorTable.ButtonSelectedGradientEnd, LinearGradientMode.Vertical); + + g.FillRectangle(brush, bounds); + } + + private void RenderImage(Graphics g) + { + Contract.Requires(g != null); + + var image = Image; + if (image == null) + { + return; + } + + var imageRect = ImageRectangle; + + if (!Enabled) + { + var disposeImage = false; + if (Pressed) + { + imageRect.X += 1; + } + if (!Enabled) + { + image = ToolStripRenderer.CreateDisabledImage(image); + disposeImage = true; + } + + g.DrawImage(image, imageRect); + + if (disposeImage) + { + image.Dispose(); + } + return; + } + + g.DrawImage(image, imageRect); + } + } + + internal class IconButtonDesigner : ControlDesigner + { + private IconButtonDesigner() + { + AutoResizeHandles = true; + } + + public override SelectionRules SelectionRules => SelectionRules.Moveable; + } +} diff --git a/ReClass.NET/Controls/MemoryPreviewPopUp.cs b/ReClass.NET/Controls/MemoryPreviewPopUp.cs new file mode 100644 index 00000000..c407a40d --- /dev/null +++ b/ReClass.NET/Controls/MemoryPreviewPopUp.cs @@ -0,0 +1,230 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.Nodes; +using ReClassNET.UI; + +namespace ReClassNET.Controls +{ + [ToolboxItem(false)] + public class MemoryPreviewPopUp : ToolStripDropDown + { + private const int ToolTipWidth = 1000 + ToolTipPadding; + private const int ToolTipPadding = 4; + + /// Panel for the memory preview. + private class MemoryPreviewPanel : Panel + { + private const int MinNodeCount = 10; + + public DrawContext DrawContext { get; } + + private readonly List nodes; + + public MemoryPreviewPanel(FontEx font) + { + Contract.Requires(font != null); + + DoubleBuffered = true; + + nodes = new List(); + + DrawContext = new DrawContext + { + Font = font, + IconProvider = new IconProvider(), // TODO use single instance + + Memory = new MemoryBuffer(), + + HotSpots = new List() + }; + + SetNodeCount(MinNodeCount); + + CalculateSize(); + } + + /// Sets the absolute number of nodes and resizes the underlaying memory buffer. + /// Number of nodes. + private void SetNodeCount(int count) + { + BaseHexNode CreateNode(int index) + { + return new +#if RECLASSNET64 + Hex64Node +#else + Hex32Node +#endif + { + Offset = index * IntPtr.Size + }; + } + + if (nodes.Count < count) + { + nodes.AddRange(Enumerable.Range(nodes.Count, count - nodes.Count).Select(CreateNode)); + } + else if (nodes.Count > count && count >= MinNodeCount) + { + nodes.RemoveRange(count, nodes.Count - count); + } + + DrawContext.Memory.Size = nodes.Select(n => n.MemorySize).Sum(); + } + + /// Changes the number of nodes with the provided delta. + /// The change delta. + public void ChangeNodeCount(int delta) + { + SetNodeCount(nodes.Count + delta); + + CalculateSize(); + } + + /// Resets the settings of the panel to the defaults. + public void Reset() + { + SetNodeCount(MinNodeCount); + + CalculateSize(); + } + + /// Calculates the size of the panel. + private void CalculateSize() + { + var size = new Size( + ToolTipWidth, + nodes.Sum(n => n.CalculateDrawnHeight(DrawContext)) + ToolTipPadding + ); + + DrawContext.ClientArea = new Rectangle(ToolTipPadding / 2, ToolTipPadding / 2, size.Width - ToolTipPadding, size.Height - ToolTipPadding); + + Size = MinimumSize = MaximumSize = size; + } + + protected override void OnPaint(PaintEventArgs e) + { + DrawContext.HotSpots.Clear(); + + // Some settings are not usefull for the preview. + DrawContext.Settings = Program.Settings.Clone(); + DrawContext.Settings.ShowNodeAddress = false; + + DrawContext.Graphics = e.Graphics; + + using (var brush = new SolidBrush(DrawContext.Settings.BackgroundColor)) + { + e.Graphics.FillRectangle(brush, ClientRectangle); + } + using (var pen = new Pen(DrawContext.Settings.BackgroundColor.Invert(), 1)) + { + e.Graphics.DrawRectangle(pen, new Rectangle(Bounds.X, Bounds.Y, Bounds.Width - 1, Bounds.Height - 1)); + } + + int x = -24; + int y = 2; + foreach (var node in nodes) + { + y += node.Draw(DrawContext, x, y).Height; + } + } + } + + private readonly MemoryPreviewPanel panel; + + private IntPtr memoryAddress; + + protected override CreateParams CreateParams + { + get + { + const int WS_EX_NOACTIVATE = 0x08000000; + + var cp = base.CreateParams; + cp.ExStyle |= WS_EX_NOACTIVATE; + return cp; + } + } + + public MemoryPreviewPopUp(FontEx font) + { + Contract.Requires(font != null); + + AutoSize = false; + AutoClose = false; + DoubleBuffered = true; + ResizeRedraw = true; + TabStop = false; + + panel = new MemoryPreviewPanel(font) + { + Location = Point.Empty + }; + + var host = new ToolStripControlHost(panel); + Padding = Margin = host.Padding = host.Margin = Padding.Empty; + MinimumSize = panel.MinimumSize; + panel.MinimumSize = panel.Size; + MaximumSize = panel.MaximumSize; + panel.MaximumSize = panel.Size; + Size = panel.Size; + + panel.SizeChanged += (s, e) => Size = MinimumSize = MaximumSize = panel.Size; + + Items.Add(host); + } + + protected override void OnClosed(ToolStripDropDownClosedEventArgs e) + { + panel.Reset(); + + base.OnClosed(e); + } + + internal void HandleMouseWheelEvent(MouseEventArgs e) + { + if (e.Delta != 0) + { + panel.ChangeNodeCount(e.Delta < 0 ? 1 : -1); + + UpdateMemory(); + + Invalidate(); + + if (e is HandledMouseEventArgs he) + { + he.Handled = true; + } + } + } + + /// Initializes the memory buffer. + /// The process to use. + /// The address to read from. + public void InitializeMemory(RemoteProcess process, IntPtr address) + { + Contract.Requires(process != null); + + memoryAddress = address; + + panel.DrawContext.Process = process; + + panel.DrawContext.Memory.UpdateFrom(process, address); + } + + /// Updates the memory buffer to get current data. + public void UpdateMemory() + { + panel.DrawContext.Memory.UpdateFrom(panel.DrawContext.Process, memoryAddress); + + panel.Invalidate(); + } + } +} diff --git a/ReClass.NET/Controls/MemoryRecordList.Designer.cs b/ReClass.NET/Controls/MemoryRecordList.Designer.cs new file mode 100644 index 00000000..8f3e0379 --- /dev/null +++ b/ReClass.NET/Controls/MemoryRecordList.Designer.cs @@ -0,0 +1,125 @@ +namespace ReClassNET.Controls +{ + partial class MemoryRecordList + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.resultDataGridView = new System.Windows.Forms.DataGridView(); + this.descriptionColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.addressColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.valueTypeColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.valueColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.previousValueColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.resultDataGridView)).BeginInit(); + this.SuspendLayout(); + // + // resultDataGridView + // + this.resultDataGridView.AllowUserToAddRows = false; + this.resultDataGridView.AllowUserToDeleteRows = false; + this.resultDataGridView.AllowUserToResizeRows = false; + this.resultDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.resultDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleVertical; + this.resultDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.resultDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.descriptionColumn, + this.addressColumn, + this.valueTypeColumn, + this.valueColumn, + this.previousValueColumn}); + this.resultDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + this.resultDataGridView.Location = new System.Drawing.Point(0, 0); + this.resultDataGridView.Name = "resultDataGridView"; + this.resultDataGridView.ReadOnly = true; + this.resultDataGridView.RowHeadersVisible = false; + this.resultDataGridView.RowTemplate.Height = 19; + this.resultDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.resultDataGridView.Size = new System.Drawing.Size(290, 327); + this.resultDataGridView.TabIndex = 15; + this.resultDataGridView.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.resultDataGridView_CellDoubleClick); + this.resultDataGridView.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.resultDataGridView_CellFormatting); + this.resultDataGridView.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.resultDataGridView_CellMouseDown); + this.resultDataGridView.RowContextMenuStripNeeded += new System.Windows.Forms.DataGridViewRowContextMenuStripNeededEventHandler(this.resultDataGridView_RowContextMenuStripNeeded); + // + // descriptionColumn + // + this.descriptionColumn.DataPropertyName = "Description"; + this.descriptionColumn.HeaderText = "Description"; + this.descriptionColumn.Name = "descriptionColumn"; + this.descriptionColumn.ReadOnly = true; + // + // addressColumn + // + this.addressColumn.DataPropertyName = "AddressStr"; + this.addressColumn.HeaderText = "Address"; + this.addressColumn.MinimumWidth = 70; + this.addressColumn.Name = "addressColumn"; + this.addressColumn.ReadOnly = true; + // + // valueTypeColumn + // + this.valueTypeColumn.DataPropertyName = "ValueType"; + this.valueTypeColumn.HeaderText = "Value Type"; + this.valueTypeColumn.Name = "valueTypeColumn"; + this.valueTypeColumn.ReadOnly = true; + // + // valueColumn + // + this.valueColumn.DataPropertyName = "ValueStr"; + this.valueColumn.HeaderText = "Value"; + this.valueColumn.Name = "valueColumn"; + this.valueColumn.ReadOnly = true; + // + // previousValueColumn + // + this.previousValueColumn.DataPropertyName = "PreviousValueStr"; + this.previousValueColumn.HeaderText = "Previous"; + this.previousValueColumn.Name = "previousValueColumn"; + this.previousValueColumn.ReadOnly = true; + // + // MemoryRecordList + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.resultDataGridView); + this.Name = "MemoryRecordList"; + this.Size = new System.Drawing.Size(290, 327); + ((System.ComponentModel.ISupportInitialize)(this.resultDataGridView)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataGridView resultDataGridView; + private System.Windows.Forms.DataGridViewTextBoxColumn descriptionColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn addressColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn valueTypeColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn valueColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn previousValueColumn; + } +} diff --git a/ReClass.NET/Controls/MemoryRecordList.cs b/ReClass.NET/Controls/MemoryRecordList.cs new file mode 100644 index 00000000..b3a06672 --- /dev/null +++ b/ReClass.NET/Controls/MemoryRecordList.cs @@ -0,0 +1,195 @@ +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.MemoryScanner; +using ReClassNET.UI; + +namespace ReClassNET.Controls +{ + public delegate void MemorySearchResultControlResultDoubleClickEventHandler(object sender, MemoryRecord record); + + public partial class MemoryRecordList : UserControl + { + public bool ShowDescriptionColumn + { + get => descriptionColumn.Visible; + set => descriptionColumn.Visible = value; + } + + public bool ShowAddressColumn + { + get => addressColumn.Visible; + set => addressColumn.Visible = value; + } + + public bool ShowValueTypeColumn + { + get => valueTypeColumn.Visible; + set => valueTypeColumn.Visible = value; + } + + public bool ShowValueColumn + { + get => valueColumn.Visible; + set => valueColumn.Visible = value; + } + + public bool ShowPreviousValueColumn + { + get => previousValueColumn.Visible; + set => previousValueColumn.Visible = value; + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public IList Records => bindings; + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public MemoryRecord SelectedRecord => GetSelectedRecords().FirstOrDefault(); + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public IList SelectedRecords => GetSelectedRecords().ToList(); + + public override ContextMenuStrip ContextMenuStrip + { + get; + set; + } + + public event MemorySearchResultControlResultDoubleClickEventHandler RecordDoubleClick; + + private readonly BindingList bindings; + + public MemoryRecordList() + { + InitializeComponent(); + + if (Program.DesignMode) + { + return; + } + + bindings = new BindingList + { + AllowNew = true, + AllowEdit = true, + RaiseListChangedEvents = true + }; + + resultDataGridView.AutoGenerateColumns = false; + resultDataGridView.DefaultCellStyle.Font = new Font( + Program.MonoSpaceFont.Font.FontFamily, + DpiUtil.ScaleIntX(11), + GraphicsUnit.Pixel + ); + resultDataGridView.DataSource = bindings; + } + + #region Event Handler + + private void resultDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) + { + OnRecordDoubleClick((MemoryRecord)resultDataGridView.Rows[e.RowIndex].DataBoundItem); + } + + private void resultDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) + { + if (e.ColumnIndex == 1) // Address + { + var record = (MemoryRecord)resultDataGridView.Rows[e.RowIndex].DataBoundItem; + if (record.IsRelativeAddress) + { + e.CellStyle.ForeColor = Color.ForestGreen; + e.FormattingApplied = true; + } + } + else if (e.ColumnIndex == 3) // Value + { + var record = (MemoryRecord)resultDataGridView.Rows[e.RowIndex].DataBoundItem; + e.CellStyle.ForeColor = record.HasChangedValue ? Color.Red : Color.Black; + e.FormattingApplied = true; + } + } + + private void resultDataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + if (e.RowIndex != -1) + { + var row = resultDataGridView.Rows[e.RowIndex]; + if (!row.Selected && !(ModifierKeys == Keys.Shift || ModifierKeys == Keys.Control)) + { + resultDataGridView.ClearSelection(); + } + row.Selected = true; + } + } + } + + private void resultDataGridView_RowContextMenuStripNeeded(object sender, DataGridViewRowContextMenuStripNeededEventArgs e) + { + e.ContextMenuStrip = ContextMenuStrip; + } + + #endregion + + private IEnumerable GetSelectedRecords() => resultDataGridView.SelectedRows.Cast().Select(r => (MemoryRecord)r.DataBoundItem); + + /// + /// Sets the records to display. + /// + /// The records. + public void SetRecords(IEnumerable records) + { + Contract.Requires(records != null); + + bindings.Clear(); + + bindings.RaiseListChangedEvents = false; + + foreach (var record in records) + { + bindings.Add(record); + } + + bindings.RaiseListChangedEvents = true; + bindings.ResetBindings(); + } + + /// + /// Removes all records. + /// + public void Clear() + { + bindings.Clear(); + } + + /// + /// Refreshes the data of all displayed records. + /// + /// The process. + public void RefreshValues(RemoteProcess process) + { + Contract.Requires(process != null); + + foreach (var record in resultDataGridView.GetVisibleRows().Select(r => (MemoryRecord)r.DataBoundItem)) + { + record.RefreshValue(process); + } + } + + private void OnRecordDoubleClick(MemoryRecord record) + { + var evt = RecordDoubleClick; + evt?.Invoke(this, record); + } + } +} diff --git a/ReClass.NET/Controls/MemoryRecordList.resx b/ReClass.NET/Controls/MemoryRecordList.resx new file mode 100644 index 00000000..29991de7 --- /dev/null +++ b/ReClass.NET/Controls/MemoryRecordList.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/ReClass.NET/Controls/MemoryViewControl.Designer.cs b/ReClass.NET/Controls/MemoryViewControl.Designer.cs new file mode 100644 index 00000000..942c196d --- /dev/null +++ b/ReClass.NET/Controls/MemoryViewControl.Designer.cs @@ -0,0 +1,74 @@ +namespace ReClassNET.Controls +{ + partial class MemoryViewControl + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.repaintTimer = new System.Windows.Forms.Timer(this.components); + this.hotSpotEditBox = new HotSpotTextBox(); + this.nodeInfoToolTip = new System.Windows.Forms.ToolTip(this.components); + this.SuspendLayout(); + // + // repaintTimer + // + this.repaintTimer.Enabled = true; + this.repaintTimer.Interval = 250; + this.repaintTimer.Tick += new System.EventHandler(this.repaintTimer_Tick); + // + // hotSpotEditBox + // + this.hotSpotEditBox.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.hotSpotEditBox.Location = new System.Drawing.Point(0, 0); + this.hotSpotEditBox.Name = "hotSpotEditBox"; + this.hotSpotEditBox.Size = new System.Drawing.Size(100, 13); + this.hotSpotEditBox.TabIndex = 1; + this.hotSpotEditBox.TabStop = false; + this.hotSpotEditBox.Visible = false; + this.hotSpotEditBox.Committed += new HotSpotTextBoxCommitEventHandler(this.editBox_Committed); + // + // nodeInfoToolTip + // + this.nodeInfoToolTip.ShowAlways = true; + // + // MemoryViewControl + // + this.Controls.Add(this.hotSpotEditBox); + this.DoubleBuffered = true; + this.Name = "MemoryViewControl"; + this.Size = new System.Drawing.Size(150, 162); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Timer repaintTimer; + private HotSpotTextBox hotSpotEditBox; + private System.Windows.Forms.ToolTip nodeInfoToolTip; + } +} diff --git a/ReClass.NET/Controls/MemoryViewControl.cs b/ReClass.NET/Controls/MemoryViewControl.cs new file mode 100644 index 00000000..64b8dfa4 --- /dev/null +++ b/ReClass.NET/Controls/MemoryViewControl.cs @@ -0,0 +1,708 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.Nodes; +using ReClassNET.UI; +using ReClassNET.Util; + +namespace ReClassNET.Controls +{ + public partial class MemoryViewControl : UserControl + { + /// + /// Contains informations about a selected node. + /// + public class SelectedNodeInfo + { + /// + /// The selected node. + /// + public BaseNode Node { get; } + + public RemoteProcess Process { get; } + + /// + /// The memory this node uses. + /// + public MemoryBuffer Memory { get; } + + /// + /// The address of the node in the remote process. + /// + public IntPtr Address { get; } + + public int Level { get; } + + public SelectedNodeInfo(BaseNode node, RemoteProcess process, MemoryBuffer memory, IntPtr address, int level) + { + Contract.Requires(node != null); + Contract.Requires(process != null); + Contract.Requires(memory != null); + + Node = node; + Process = process; + Memory = memory; + Address = address; + Level = level; + } + } + + private readonly List hotSpots = new List(); + private readonly List selectedNodes = new List(); + + private HotSpot selectionCaret; + private HotSpot selectionAnchor; + + private readonly FontEx font; + + public ContextMenuStrip NodeContextMenuStrip { get; set; } + + public event DrawContextRequestEventHandler DrawContextRequested; + public event EventHandler SelectionChanged; + public event NodeClickEventHandler ChangeClassTypeClick; + public event NodeClickEventHandler ChangeWrappedTypeClick; + public event NodeClickEventHandler ChangeEnumTypeClick; + + private readonly MemoryPreviewPopUp memoryPreviewPopUp; + + public MemoryViewControl() + { + InitializeComponent(); + + if (Program.DesignMode) + { + return; + } + + AutoScroll = true; + + font = Program.MonoSpaceFont; + + hotSpotEditBox.Font = font; + + memoryPreviewPopUp = new MemoryPreviewPopUp(font); + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + if (DesignMode) + { + e.Graphics.FillRectangle(Brushes.White, ClientRectangle); + + return; + } + + var args = new DrawContextRequestEventArgs(); + + var requestHandler = DrawContextRequested; + requestHandler?.Invoke(this, args); + + hotSpots.Clear(); + + using (var brush = new SolidBrush(Program.Settings.BackgroundColor)) + { + e.Graphics.FillRectangle(brush, ClientRectangle); + } + + if (args.Process == null || args.Memory == null || args.Node == null) + { + return; + } + + if (memoryPreviewPopUp.Visible) + { + memoryPreviewPopUp.UpdateMemory(); + } + + var view = new DrawContext + { + Settings = args.Settings, + Graphics = e.Graphics, + Font = font, + IconProvider = args.IconProvider, + Process = args.Process, + Memory = args.Memory, + CurrentTime = args.CurrentTime, + ClientArea = ClientRectangle, + HotSpots = hotSpots, + Address = args.BaseAddress, + Level = 0, + MultipleNodesSelected = selectedNodes.Count > 1 + }; + + var scrollPosition = AutoScrollPosition; + + var drawnSize = args.Node.Draw( + view, + scrollPosition.X, + scrollPosition.Y + ); + drawnSize.Width += 10; + + /*foreach (var spot in hotSpots.Where(h => h.Type == HotSpotType.Select)) + { + e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(150, 255, 0, 0)), 1), spot.Rect); + }*/ + + AutoScrollMinSize = new Size(Math.Max(drawnSize.Width, ClientSize.Width), Math.Max(drawnSize.Height, ClientSize.Height)); + + // Sometimes setting AutoScrollMinSize resets AutoScrollPosition. This restores the original position. + AutoScrollPosition = new Point(-scrollPosition.X, -scrollPosition.Y); + } + + private void OnSelectionChanged() + { + SelectionChanged?.Invoke(this, EventArgs.Empty); + } + + #region Process Input + + protected override void OnMouseClick(MouseEventArgs e) + { + Contract.Requires(e != null); + + hotSpotEditBox.Hide(); + + var invalidate = false; + + foreach (var hotSpot in hotSpots) + { + if (hotSpot.Rect.Contains(e.Location)) + { + var hitObject = hotSpot.Node; + + if (hotSpot.Type == HotSpotType.OpenClose) + { + hitObject.ToggleLevelOpen(hotSpot.Level); + + invalidate = true; + + break; + } + if (hotSpot.Type == HotSpotType.Click) + { + hitObject.Update(hotSpot); + + invalidate = true; + + break; + } + if (hotSpot.Type == HotSpotType.Select) + { + if (e.Button == MouseButtons.Left) + { + if (ModifierKeys == Keys.None) + { + ClearSelection(); + + hitObject.IsSelected = true; + + selectedNodes.Add(hotSpot); + + OnSelectionChanged(); + + selectionAnchor = selectionCaret = hotSpot; + } + else if (ModifierKeys == Keys.Control) + { + hitObject.IsSelected = !hitObject.IsSelected; + + if (hitObject.IsSelected) + { + selectedNodes.Add(hotSpot); + } + else + { + selectedNodes.Remove(selectedNodes.FirstOrDefault(c => c.Node == hitObject)); + } + + OnSelectionChanged(); + } + else if (ModifierKeys == Keys.Shift) + { + if (selectedNodes.Count > 0) + { + var selectedNode = selectedNodes[0].Node; + if (hitObject.GetParentContainer() != null && selectedNode.GetParentContainer() != hitObject.GetParentContainer()) + { + continue; + } + + if (hotSpot.Node is BaseContainerNode) + { + continue; + } + + var first = Utils.Min(selectedNodes[0], hotSpot, h => h.Node.Offset); + var last = first == hotSpot ? selectedNodes[0] : hotSpot; + + ClearSelection(); + + var containerNode = selectedNode.GetParentContainer(); + foreach (var spot in containerNode.Nodes + .SkipWhile(n => n != first.Node) + .TakeWhileInclusive(n => n != last.Node) + .Select(n => new HotSpot + { + Address = (IntPtr)(containerNode.Offset + n.Offset), + Node = n, + Process = first.Process, + Memory = first.Memory, + Level = first.Level + })) + { + spot.Node.IsSelected = true; + selectedNodes.Add(spot); + } + + OnSelectionChanged(); + + selectionAnchor = first; + selectionCaret = last; + } + } + } + else if (e.Button == MouseButtons.Right) + { + // If there is only one selected node, select the node the user clicked at. + if (selectedNodes.Count <= 1) + { + ClearSelection(); + + hitObject.IsSelected = true; + + selectedNodes.Add(hotSpot); + + OnSelectionChanged(); + + selectionAnchor = selectionCaret = hotSpot; + } + + ShowNodeContextMenu(e.Location); + } + + invalidate = true; + } + else if (hotSpot.Type == HotSpotType.Context) + { + ShowNodeContextMenu(e.Location); + + break; + } + else if (hotSpot.Type == HotSpotType.Delete) + { + hotSpot.Node.GetParentContainer().RemoveNode(hotSpot.Node); + + invalidate = true; + + break; + } + else if (hotSpot.Type == HotSpotType.ChangeClassType || hotSpot.Type == HotSpotType.ChangeWrappedType || hotSpot.Type == HotSpotType.ChangeEnumType) + { + var handler = hotSpot.Type switch + { + HotSpotType.ChangeClassType => ChangeClassTypeClick, + HotSpotType.ChangeWrappedType => ChangeWrappedTypeClick, + HotSpotType.ChangeEnumType => ChangeEnumTypeClick + }; + + handler?.Invoke(this, new NodeClickEventArgs(hitObject, hotSpot.Address, hotSpot.Memory, e.Button, e.Location)); + + break; + } + } + } + + if (invalidate) + { + Invalidate(); + } + + base.OnMouseClick(e); + } + + protected override void OnMouseDoubleClick(MouseEventArgs e) + { + Contract.Requires(e != null); + + hotSpotEditBox.Hide(); + + var invalidate = false; + + // Order the hotspots: 1. DoubleClick 2. Click 3. Edit 4. Select + var spots = hotSpots.Where(h => h.Type == HotSpotType.DoubleClick) + .Concat(hotSpots.Where(h => h.Type == HotSpotType.Click)) + .Concat(hotSpots.Where(h => h.Type == HotSpotType.Edit)) + .Concat(hotSpots.Where(h => h.Type == HotSpotType.Select)); + + foreach (var hotSpot in spots) + { + if (hotSpot.Rect.Contains(e.Location)) + { + if (hotSpot.Type == HotSpotType.DoubleClick || hotSpot.Type == HotSpotType.Click) + { + hotSpot.Node.Update(hotSpot); + + invalidate = true; + + break; + } + if (hotSpot.Type == HotSpotType.Edit) + { + hotSpotEditBox.ShowOnHotSpot(hotSpot); + + break; + } + if (hotSpot.Type == HotSpotType.Select) + { + hotSpot.Node.ToggleLevelOpen(hotSpot.Level); + + invalidate = true; + + break; + } + } + } + + if (invalidate) + { + Invalidate(); + } + + base.OnMouseDoubleClick(e); + } + + private Point toolTipPosition; + protected override void OnMouseHover(EventArgs e) + { + Contract.Requires(e != null); + + base.OnMouseHover(e); + + if (selectedNodes.Count > 1) + { + var memorySize = selectedNodes.Sum(h => h.Node.MemorySize); + nodeInfoToolTip.Show($"{selectedNodes.Count} Nodes selected, {memorySize} bytes", this, toolTipPosition.Relocate(16, 16)); + } + else + { + foreach (var spot in hotSpots.Where(h => h.Type == HotSpotType.Select)) + { + if (spot.Rect.Contains(toolTipPosition)) + { + if (spot.Node.UseMemoryPreviewToolTip(spot, out var previewAddress)) + { + memoryPreviewPopUp.InitializeMemory(spot.Process, previewAddress); + + memoryPreviewPopUp.Show(this, toolTipPosition.Relocate(16, 16)); + } + else + { + var text = spot.Node.GetToolTipText(spot); + if (!string.IsNullOrEmpty(text)) + { + nodeInfoToolTip.Show(text, this, toolTipPosition.Relocate(16, 16)); + } + } + + return; + } + } + } + } + + protected override void OnMouseMove(MouseEventArgs e) + { + Contract.Requires(e != null); + + base.OnMouseMove(e); + + if (e.Location != toolTipPosition) + { + toolTipPosition = e.Location; + + nodeInfoToolTip.Hide(this); + + if (memoryPreviewPopUp.Visible) + { + memoryPreviewPopUp.Close(); + + Invalidate(); + } + + ResetMouseEventArgs(); + } + } + + protected override void OnMouseWheel(MouseEventArgs e) + { + hotSpotEditBox.Hide(); + + if (memoryPreviewPopUp.Visible) + { + memoryPreviewPopUp.HandleMouseWheelEvent(e); + } + else + { + base.OnMouseWheel(e); + } + } + + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (hotSpotEditBox.Visible == false) // Only process keys if the edit field is not visible. + { + var key = keyData & Keys.KeyCode; + var modifier = keyData & Keys.Modifiers; + + if (selectedNodes.Count > 0) + { + if (key == Keys.Menu) + { + ShowNodeContextMenu(new Point(10, 10)); + + return true; + } + if ((key == Keys.Down || key == Keys.Up) && selectionCaret != null && selectionAnchor != null) + { + HotSpot toSelect; + bool isAtEnd; + + var query = hotSpots + .Where(h => h.Type == HotSpotType.Select) + .Where(h => h.Node.GetParentContainer() == selectionCaret.Node.GetParentContainer()); + + if (key == Keys.Down) + { + var temp = query + .SkipWhile(h => h.Node != selectionCaret.Node) + .Skip(1) + .ToList(); + + toSelect = temp.FirstOrDefault(); + isAtEnd = toSelect != null && toSelect == temp.LastOrDefault(); + } + else + { + var temp = query + .TakeWhile(h => h.Node != selectionCaret.Node) + .ToList(); + + toSelect = temp.LastOrDefault(); + isAtEnd = toSelect != null && toSelect == temp.FirstOrDefault(); + } + + if (toSelect != null && !(toSelect.Node is ClassNode)) + { + if (modifier != Keys.Shift) + { + selectionAnchor = selectionCaret = toSelect; + } + else + { + selectionCaret = toSelect; + } + + var first = Utils.Min(selectionAnchor, selectionCaret, h => h.Node.Offset); + var last = first == selectionAnchor ? selectionCaret : selectionAnchor; + + selectedNodes.ForEach(h => h.Node.ClearSelection()); + selectedNodes.Clear(); + + var containerNode = toSelect.Node.GetParentContainer(); + foreach (var spot in containerNode.Nodes + .SkipWhile(n => n != first.Node) + .TakeWhileInclusive(n => n != last.Node) + .Select(n => new HotSpot + { + Address = (IntPtr)(containerNode.Offset + n.Offset), + Node = n, + Process = toSelect.Process, + Memory = toSelect.Memory, + Level = toSelect.Level + })) + { + spot.Node.IsSelected = true; + selectedNodes.Add(spot); + } + + OnSelectionChanged(); + + if (isAtEnd) + { + const int ScrollAmount = 3; + + var position = AutoScrollPosition; + AutoScrollPosition = new Point(-position.X, -position.Y + (key == Keys.Down ? ScrollAmount : -ScrollAmount) * font.Height); + } + + Invalidate(); + + return true; + } + } + else if (key == Keys.Left || key == Keys.Right) + { + if (selectedNodes.Count == 1) + { + var selected = selectedNodes[0]; + + selected.Node.SetLevelOpen(selected.Level, key == Keys.Right); + } + } + } + else if (key == Keys.Down || key == Keys.Up) + { + // If no node is selected, try to select the first one. + var selection = hotSpots + .Where(h => h.Type == HotSpotType.Select) + .WhereNot(h => h.Node is ClassNode) + .FirstOrDefault(); + if (selection != null) + { + selectionAnchor = selectionCaret = selection; + + selection.Node.IsSelected = true; + + selectedNodes.Add(selection); + + OnSelectionChanged(); + + return true; + } + } + } + + return base.ProcessCmdKey(ref msg, keyData); + } + + #endregion + + #region Event Handler + + protected override void OnSizeChanged(EventArgs e) + { + base.OnSizeChanged(e); + + Invalidate(); + } + + private void repaintTimer_Tick(object sender, EventArgs e) + { + if (DesignMode) + { + return; + } + + Invalidate(false); + } + + private void editBox_Committed(object sender, HotSpotTextBoxCommitEventArgs e) + { + var hotSpot = e.HotSpot; + if (hotSpot != null) + { + try + { + hotSpot.Node.Update(hotSpot); + } + catch (Exception ex) + { + Program.Logger.Log(ex); + } + + Invalidate(); + } + + Focus(); + } + + #endregion + + /// + /// Gets informations about all selected nodes. + /// + /// A list with informations about all selected nodes. + public IReadOnlyList GetSelectedNodes() + { + return selectedNodes + .Select(h => new SelectedNodeInfo(h.Node, h.Process, h.Memory, h.Address, h.Level)) + .ToList(); + } + + /// + /// Selects the given nodes. + /// + /// + public void SetSelectedNodes(IEnumerable nodes) + { + selectedNodes.ForEach(h => h.Node.ClearSelection()); + + selectedNodes.Clear(); + + selectedNodes.AddRange(nodes.Select(i => new HotSpot { Type = HotSpotType.Select, Node = i.Node, Process = i.Process, Memory = i.Memory, Address = i.Address, Level = i.Level })); + selectedNodes.ForEach(h => h.Node.IsSelected = true); + + OnSelectionChanged(); + } + + /// + /// Shows the context menu at the given point. + /// + /// The location where the context menu should be shown. + private void ShowNodeContextMenu(Point location) + { + NodeContextMenuStrip?.Show(this, location); + } + + public void ShowNodeNameEditBox(BaseNode node) + { + if (node == null || node is BaseHexNode) + { + return; + } + + var hotSpot = hotSpots + .FirstOrDefault(s => s.Node == node && s.Type == HotSpotType.Edit && s.Id == HotSpot.NameId); + if (hotSpot != null) + { + hotSpotEditBox.ShowOnHotSpot(hotSpot); + } + } + + /// + /// Resets the selection state of all selected nodes. + /// + public void ClearSelection() + { + selectionAnchor = selectionCaret = null; + + selectedNodes.ForEach(h => h.Node.ClearSelection()); + + selectedNodes.Clear(); + + OnSelectionChanged(); + + //Invalidate(); + } + + /// + /// Resets the control to the initial state. + /// + public void Reset() + { + ClearSelection(); + + hotSpotEditBox.Hide(); + + VerticalScroll.Value = VerticalScroll.Minimum; + } + } +} diff --git a/UI/MemoryViewControl.resx b/ReClass.NET/Controls/MemoryViewControl.resx similarity index 94% rename from UI/MemoryViewControl.resx rename to ReClass.NET/Controls/MemoryViewControl.resx index 56447432..49dac163 100644 --- a/UI/MemoryViewControl.resx +++ b/ReClass.NET/Controls/MemoryViewControl.resx @@ -117,13 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - 243, 17 - + 364, 17 diff --git a/ReClass.NET/Controls/NodeClickEventArgs.cs b/ReClass.NET/Controls/NodeClickEventArgs.cs new file mode 100644 index 00000000..3d9dd82f --- /dev/null +++ b/ReClass.NET/Controls/NodeClickEventArgs.cs @@ -0,0 +1,36 @@ +using System; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Windows.Forms; +using ReClassNET.Memory; +using ReClassNET.Nodes; + +namespace ReClassNET.Controls +{ + public class NodeClickEventArgs : EventArgs + { + public BaseNode Node { get; } + + public IntPtr Address { get; } + + public MemoryBuffer Memory { get; } + + public MouseButtons Button { get; } + + public Point Location { get; } + + public NodeClickEventArgs(BaseNode node, IntPtr address, MemoryBuffer memory, MouseButtons button, Point location) + { + Contract.Requires(node != null); + Contract.Requires(memory != null); + + Node = node; + Address = address; + Memory = memory; + Button = button; + Location = location; + } + } + + public delegate void NodeClickEventHandler(object sender, NodeClickEventArgs args); +} diff --git a/ReClass.NET/Controls/PlaceholderTextBox.cs b/ReClass.NET/Controls/PlaceholderTextBox.cs new file mode 100644 index 00000000..59734c10 --- /dev/null +++ b/ReClass.NET/Controls/PlaceholderTextBox.cs @@ -0,0 +1,75 @@ +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace ReClassNET.Controls +{ + public class PlaceholderTextBox : TextBox + { + private Font fontBackup; + private Color foreColorBackup; + private Color backColorBackup; + + /// + /// The color of the placeholder text. + /// + [DefaultValue(typeof(Color), "ControlDarkDark")] + public Color PlaceholderColor { get; set; } = SystemColors.ControlDarkDark; + + /// + /// The placeholder text. + /// + [DefaultValue("")] + public string PlaceholderText { get; set; } + + public PlaceholderTextBox() + { + fontBackup = Font; + foreColorBackup = ForeColor; + backColorBackup = BackColor; + + SetStyle(ControlStyles.UserPaint, true); + } + + protected override void OnTextChanged(EventArgs e) + { + base.OnTextChanged(e); + + if (string.IsNullOrEmpty(Text)) + { + if (!GetStyle(ControlStyles.UserPaint)) + { + fontBackup = Font; + foreColorBackup = ForeColor; + backColorBackup = BackColor; + + SetStyle(ControlStyles.UserPaint, true); + } + } + else + { + if (GetStyle(ControlStyles.UserPaint)) + { + SetStyle(ControlStyles.UserPaint, false); + + Font = fontBackup; + ForeColor = foreColorBackup; + BackColor = backColorBackup; + } + } + } + + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + if (string.IsNullOrEmpty(Text) && Focused == false) + { + using var brush = new SolidBrush(PlaceholderColor); + + e.Graphics.DrawString(PlaceholderText ?? string.Empty, Font, brush, new PointF(-1.0f, 1.0f)); + } + } + } +} diff --git a/ReClass.NET/Controls/ProjectView.Designer.cs b/ReClass.NET/Controls/ProjectView.Designer.cs new file mode 100644 index 00000000..25d6422e --- /dev/null +++ b/ReClass.NET/Controls/ProjectView.Designer.cs @@ -0,0 +1,64 @@ +namespace ReClassNET.Controls +{ + partial class ProjectView + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.projectTreeView = new System.Windows.Forms.TreeView(); + this.SuspendLayout(); + // + // projectTreeView + // + this.projectTreeView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.projectTreeView.Dock = System.Windows.Forms.DockStyle.Fill; + this.projectTreeView.HideSelection = false; + this.projectTreeView.LabelEdit = true; + this.projectTreeView.Location = new System.Drawing.Point(0, 0); + this.projectTreeView.Name = "projectTreeView"; + this.projectTreeView.ShowRootLines = false; + this.projectTreeView.Size = new System.Drawing.Size(150, 150); + this.projectTreeView.TabIndex = 0; + this.projectTreeView.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.projectTreeView_BeforeLabelEdit); + this.projectTreeView.AfterLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.projectTreeView_AfterLabelEdit); + this.projectTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.projectTreeView_AfterSelect); + this.projectTreeView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.projectTreeView_MouseUp); + // + // ClassNodeView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.projectTreeView); + this.Name = "ClassNodeView"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TreeView projectTreeView; + } +} diff --git a/ReClass.NET/Controls/ProjectView.cs b/ReClass.NET/Controls/ProjectView.cs new file mode 100644 index 00000000..f1b12261 --- /dev/null +++ b/ReClass.NET/Controls/ProjectView.cs @@ -0,0 +1,538 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Windows.Forms; +using ReClassNET.Extensions; +using ReClassNET.Nodes; +using ReClassNET.Project; + +namespace ReClassNET.Controls +{ + public partial class ProjectView : UserControl + { + /// A custom tree node for class nodes with hierarchical structure. + private class ClassTreeNode : TreeNode + { + private readonly ProjectView control; + + public ClassNode ClassNode { get; } + + /// Constructor of the class. + /// The class node. + /// The instance this node should belong to. + public ClassTreeNode(ClassNode node, ProjectView control) + : this(node, control, null) + { + Contract.Requires(node != null); + Contract.Requires(control != null); + } + + private ClassTreeNode(ClassNode node, ProjectView control, HashSet seen) + { + Contract.Requires(node != null); + Contract.Requires(control != null); + + ClassNode = node; + + this.control = control; + + Text = node.Name; + + ImageIndex = 1; + SelectedImageIndex = 1; + + RebuildClassHierarchy(seen ?? new HashSet { ClassNode }); + } + + public void Update() + { + Text = ClassNode.Name; + + RebuildClassHierarchy(new HashSet { ClassNode }); + } + + /// Rebuilds the class hierarchy. + /// The already seen classes. + private void RebuildClassHierarchy(HashSet seen) + { + Contract.Requires(seen != null); + + if (!control.EnableClassHierarchyView) + { + return; + } + + var distinctClasses = ClassNode.Nodes + .OfType() + .Select(w => w.ResolveMostInnerNode()) + .OfType() + .Distinct() + .ToList(); + + if (distinctClasses.IsEquivalentTo(Nodes.Cast().Select(t => t.ClassNode))) + { + return; + } + + Nodes.Clear(); + + foreach (var child in distinctClasses) + { + var childSeen = new HashSet(seen); + if (childSeen.Add(child)) + { + Nodes.Add(new ClassTreeNode(child, control, childSeen)); + } + } + + if (control.AutoExpandClassNodes) + { + Expand(); + } + } + } + + public class EnumTreeNode : TreeNode + { + public EnumDescription Enum { get; } + + public EnumTreeNode(EnumDescription @enum) + { + Contract.Requires(@enum != null); + + Enum = @enum; + + ImageIndex = 3; + SelectedImageIndex = 3; + + Update(); + } + + public void Update() + { + Text = Enum.Name; + } + } + + private class NodeSorter : IComparer + { + public int Compare(object x, object y) + { + var compare = Application.CurrentCulture.CompareInfo; + + if (x is ClassTreeNode cn1 && y is ClassTreeNode cn2) + { + return compare.Compare(cn1.Text, cn2.Text); + } + if (x is EnumTreeNode en1 && y is EnumTreeNode en2) + { + return compare.Compare(en1.Text, en2.Text); + } + if (x is TreeNode tn1 && tn1.Parent == null && y is TreeNode tn2 && tn2.Parent == null) + { + return (int)tn1.Tag - (int)tn2.Tag; + } + + return 0; + } + } + + private readonly TreeNode enumsRootNode; + private readonly TreeNode classesRootNode; + + private ClassNode selectedClass; + + private bool autoExpandClassNodes; + private bool enableClassHierarchyView; + + public delegate void SelectionChangedEvent(object sender, ClassNode node); + public event SelectionChangedEvent SelectionChanged; + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public ClassNode SelectedClass + { + get => selectedClass; + set + { + if (selectedClass != value) + { + selectedClass = value; + if (selectedClass != null) + { + projectTreeView.SelectedNode = FindMainClassTreeNode(selectedClass); + } + + SelectionChanged?.Invoke(this, selectedClass); + } + } + } + + [Browsable(false)] + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public EnumDescription SelectedEnum { get; private set; } + + [DefaultValue(false)] + public bool AutoExpandClassNodes + { + get => autoExpandClassNodes; + set + { + if (autoExpandClassNodes != value) + { + autoExpandClassNodes = value; + + if (autoExpandClassNodes) + { + ExpandAllClassNodes(); + } + } + } + } + + [DefaultValue(false)] + public bool EnableClassHierarchyView + { + get => enableClassHierarchyView; + set + { + if (enableClassHierarchyView != value) + { + enableClassHierarchyView = value; + + var classes = classesRootNode.Nodes.Cast().Select(t => t.ClassNode).ToList(); + + classesRootNode.Nodes.Clear(); + + AddClasses(classes); + } + } + } + + public ContextMenuStrip ClassesContextMenuStrip { get; set; } + + public ContextMenuStrip ClassContextMenuStrip { get; set; } + + public ContextMenuStrip EnumsContextMenuStrip { get; set; } + + public ContextMenuStrip EnumContextMenuStrip { get; set; } + + public ProjectView() + { + Contract.Ensures(classesRootNode != null); + Contract.Ensures(enumsRootNode != null); + + InitializeComponent(); + + DoubleBuffered = true; + + projectTreeView.TreeViewNodeSorter = new NodeSorter(); + projectTreeView.ImageList = new ImageList(); + projectTreeView.ImageList.Images.Add(Properties.Resources.B16x16_Text_List_Bullets); + projectTreeView.ImageList.Images.Add(Properties.Resources.B16x16_Class_Type); + projectTreeView.ImageList.Images.Add(Properties.Resources.B16x16_Category); + projectTreeView.ImageList.Images.Add(Properties.Resources.B16x16_Enum_Type); + + classesRootNode = new TreeNode + { + Text = "Classes", + ImageIndex = 0, + SelectedImageIndex = 0, + Tag = 0 + }; + + projectTreeView.Nodes.Add(classesRootNode); + + enumsRootNode = new TreeNode + { + Text = "Enums", + ImageIndex = 2, + SelectedImageIndex = 2, + Tag = 1 + }; + + projectTreeView.Nodes.Add(enumsRootNode); + } + + #region Event Handler + + private void projectTreeView_AfterSelect(object sender, TreeViewEventArgs e) + { + if (e.Node.Level == 0) + { + return; + } + + if (e.Node is ClassTreeNode classTreeNode) + { + if (selectedClass != classTreeNode.ClassNode) + { + SelectedClass = classTreeNode.ClassNode; + } + } + else if (e.Node is EnumTreeNode enumTreeNode) + { + SelectedEnum = enumTreeNode.Enum; + } + } + + private void projectTreeView_MouseUp(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Right) + { + return; + } + + var node = projectTreeView.GetNodeAt(e.X, e.Y); + if (node == null) + { + return; + } + + ContextMenuStrip cms = null; + if (node == classesRootNode) + { + cms = ClassesContextMenuStrip; + } + else if (node is ClassTreeNode) + { + cms = ClassContextMenuStrip; + + projectTreeView.SelectedNode = node; + } + else if (node == enumsRootNode) + { + cms = EnumsContextMenuStrip; + } + else if (node is EnumTreeNode) + { + cms = EnumContextMenuStrip; + + projectTreeView.SelectedNode = node; + } + cms?.Show(projectTreeView, e.Location); + } + + private void projectTreeView_BeforeLabelEdit(object sender, NodeLabelEditEventArgs e) + { + var isClassTreeNode = e.Node is ClassTreeNode; + var isEnumTreeNode = e.Node is EnumTreeNode; + e.CancelEdit = !isClassTreeNode && !isEnumTreeNode; + } + + private void projectTreeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) + { + if (!string.IsNullOrEmpty(e.Label)) + { + if (e.Node is ClassTreeNode classTreeNode) + { + classTreeNode.ClassNode.Name = e.Label; + } + else if (e.Node is EnumTreeNode enumTreeNode) + { + enumTreeNode.Enum.Name = e.Label; + } + } + } + + #endregion + + public void ExpandAllClassNodes() + { + classesRootNode.ExpandAll(); + } + + public void CollapseAllClassNodes() + { + foreach (var tn in classesRootNode.Nodes.Cast()) + { + tn.Collapse(); + } + } + + /// + /// Clears all displayed nodes. + /// + public void Clear() + { + Clear(true, true); + } + + /// + /// Clears the selected nodes. + /// + /// Clears the classes if set. + /// Clears the enums if set. + public void Clear(bool clearClasses, bool clearEnums) + { + if (clearClasses) + { + classesRootNode.Nodes.Clear(); + } + + if (clearEnums) + { + enumsRootNode.Nodes.Clear(); + } + } + + /// Adds the class to the view. + /// The class to add. + public void AddClass(ClassNode @class) + { + Contract.Requires(@class != null); + + AddClasses(new[] { @class }); + } + + /// + /// Adds all classes to the view. + /// + /// The classes to add. + public void AddClasses(IEnumerable classes) + { + Contract.Requires(classes != null); + + projectTreeView.BeginUpdate(); + + foreach (var @class in classes) + { + classesRootNode.Nodes.Add(new ClassTreeNode(@class, this)); + } + + classesRootNode.Expand(); + + projectTreeView.Sort(); + + projectTreeView.EndUpdate(); + } + + /// Removes the class from the view. + /// The class to remove. + public void RemoveClass(ClassNode node) + { + Contract.Requires(node != null); + + foreach (var tn in FindClassTreeNodes(node)) + { + tn.Remove(); + } + + if (selectedClass == node) + { + if (classesRootNode.Nodes.Count > 0) + { + projectTreeView.SelectedNode = classesRootNode.Nodes[0]; + } + else + { + SelectedClass = null; + } + } + } + + /// Searches for the which represents the class. + /// The class to search. + /// The found class tree node. + private ClassTreeNode FindMainClassTreeNode(ClassNode node) + { + Contract.Requires(node != null); + + return classesRootNode.Nodes + .Cast() + .FirstOrDefault(t => t.ClassNode == node); + } + + /// Searches for the ClassTreeNode which represents the class. + /// The class to search. + /// The found class tree node. + private IEnumerable FindClassTreeNodes(ClassNode node) + { + Contract.Requires(node != null); + + return classesRootNode.Nodes + .Cast() + .Traverse(t => t.Nodes.Cast()) + .Where(n => n.ClassNode == node); + } + + /// + /// Updates the display for the given class. + /// + /// The class to update. + public void UpdateClassNode(ClassNode @class) + { + Contract.Requires(@class != null); + + projectTreeView.BeginUpdate(); + + foreach (var tn in FindClassTreeNodes(@class)) + { + tn.Update(); + } + + projectTreeView.Sort(); + + projectTreeView.EndUpdate(); + } + + /// Adds the enum to the view. + /// The enum to add. + public void AddEnum(EnumDescription @enum) + { + Contract.Requires(@enum != null); + + AddEnums(new[] { @enum }); + } + + /// Adds the enums to the view. + /// The enums to add. + public void AddEnums(IEnumerable enums) + { + Contract.Requires(enums != null); + + projectTreeView.BeginUpdate(); + + foreach (var @enum in enums) + { + enumsRootNode.Nodes.Add(new EnumTreeNode(@enum)); + } + + enumsRootNode.ExpandAll(); + + projectTreeView.Sort(); + + projectTreeView.EndUpdate(); + } + + /// + /// Updates the display for the given enum. + /// + /// The enum to update. + public void UpdateEnumNode(EnumDescription @enum) + { + Contract.Requires(@enum != null); + + projectTreeView.BeginUpdate(); + + var node = enumsRootNode.Nodes + .Cast() + .FirstOrDefault(n => n.Enum == @enum); + + if (node != null) + { + node.Update(); + } + else + { + AddEnum(@enum); + } + + projectTreeView.Sort(); + + projectTreeView.EndUpdate(); + } + } +} diff --git a/Forms/InputBytesForm.resx b/ReClass.NET/Controls/ProjectView.resx similarity index 100% rename from Forms/InputBytesForm.resx rename to ReClass.NET/Controls/ProjectView.resx diff --git a/ReClass.NET/Core/CoreFunctionsManager.cs b/ReClass.NET/Core/CoreFunctionsManager.cs new file mode 100644 index 00000000..92af4d6e --- /dev/null +++ b/ReClass.NET/Core/CoreFunctionsManager.cs @@ -0,0 +1,207 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.IO; +using System.Linq; +using System.Windows.Forms; +using ReClassNET.Debugger; +using ReClassNET.Extensions; +using ReClassNET.Memory; + +namespace ReClassNET.Core +{ + public class CoreFunctionsManager : IDisposable + { + private readonly Dictionary functionsRegistry = new Dictionary(); + + private readonly InternalCoreFunctions internalCoreFunctions; + + private ICoreProcessFunctions currentFunctions; + + public IEnumerable FunctionProviders => functionsRegistry.Keys; + + public ICoreProcessFunctions CurrentFunctions => currentFunctions; + + public string CurrentFunctionsProvider => functionsRegistry + .Where(kv => kv.Value == currentFunctions) + .Select(kv => kv.Key) + .FirstOrDefault(); + + public CoreFunctionsManager() + { + internalCoreFunctions = InternalCoreFunctions.Create(); + + RegisterFunctions("Default", internalCoreFunctions); + + currentFunctions = internalCoreFunctions; + } + + #region IDisposable Support + + public void Dispose() + { + internalCoreFunctions.Dispose(); + } + + #endregion + + public void RegisterFunctions(string provider, ICoreProcessFunctions functions) + { + Contract.Requires(provider != null); + Contract.Requires(functions != null); + + functionsRegistry.Add(provider, functions); + } + + public void SetActiveFunctionsProvider(string provider) + { + if (!functionsRegistry.TryGetValue(provider, out var functions)) + { + throw new ArgumentException(); + } + + currentFunctions = functions; + } + + #region Plugin Functions + + public void EnumerateProcesses(Action callbackProcess) + { + var c = callbackProcess == null ? null : (EnumerateProcessCallback)delegate (ref EnumerateProcessData data) + { + callbackProcess(new ProcessInfo(data.Id, data.Name, data.Path)); + }; + + currentFunctions.EnumerateProcesses(c); + } + + public IList EnumerateProcesses() + { + var processes = new List(); + EnumerateProcesses(processes.Add); + return processes; + } + + public void EnumerateRemoteSectionsAndModules(IntPtr process, Action
callbackSection, Action callbackModule) + { + var c1 = callbackSection == null ? null : (EnumerateRemoteSectionCallback)delegate (ref EnumerateRemoteSectionData data) + { + callbackSection(new Section + { + Start = data.BaseAddress, + End = data.BaseAddress.Add(data.Size), + Size = data.Size, + Name = data.Name, + Protection = data.Protection, + Type = data.Type, + ModulePath = data.ModulePath, + ModuleName = Path.GetFileName(data.ModulePath), + Category = data.Category + }); + }; + + var c2 = callbackModule == null ? null : (EnumerateRemoteModuleCallback)delegate (ref EnumerateRemoteModuleData data) + { + callbackModule(new Module + { + Start = data.BaseAddress, + End = data.BaseAddress.Add(data.Size), + Size = data.Size, + Path = data.Path, + Name = Path.GetFileName(data.Path) + }); + }; + + currentFunctions.EnumerateRemoteSectionsAndModules(process, c1, c2); + } + + public void EnumerateRemoteSectionsAndModules(IntPtr process, out List
sections, out List modules) + { + sections = new List
(); + modules = new List(); + + EnumerateRemoteSectionsAndModules(process, sections.Add, modules.Add); + } + + public IntPtr OpenRemoteProcess(IntPtr pid, ProcessAccess desiredAccess) + { + return currentFunctions.OpenRemoteProcess(pid, desiredAccess); + } + + public bool IsProcessValid(IntPtr process) + { + return currentFunctions.IsProcessValid(process); + } + + public void CloseRemoteProcess(IntPtr process) + { + currentFunctions.CloseRemoteProcess(process); + } + + public bool ReadRemoteMemory(IntPtr process, IntPtr address, ref byte[] buffer, int offset, int size) + { + return currentFunctions.ReadRemoteMemory(process, address, ref buffer, offset, size); + } + + public bool WriteRemoteMemory(IntPtr process, IntPtr address, ref byte[] buffer, int offset, int size) + { + return currentFunctions.WriteRemoteMemory(process, address, ref buffer, offset, size); + } + + public void ControlRemoteProcess(IntPtr process, ControlRemoteProcessAction action) + { + currentFunctions.ControlRemoteProcess(process, action); + } + + public bool AttachDebuggerToProcess(IntPtr id) + { + return currentFunctions.AttachDebuggerToProcess(id); + } + + public void DetachDebuggerFromProcess(IntPtr id) + { + currentFunctions.DetachDebuggerFromProcess(id); + } + + public void HandleDebugEvent(ref DebugEvent evt) + { + currentFunctions.HandleDebugEvent(ref evt); + } + + public bool AwaitDebugEvent(ref DebugEvent evt, int timeoutInMilliseconds) + { + return currentFunctions.AwaitDebugEvent(ref evt, timeoutInMilliseconds); + } + + public bool SetHardwareBreakpoint(IntPtr id, IntPtr address, HardwareBreakpointRegister register, HardwareBreakpointTrigger trigger, HardwareBreakpointSize size, bool set) + { + return currentFunctions.SetHardwareBreakpoint(id, address, register, trigger, size, set); + } + + #endregion + + #region Internal Core Functions + + public bool DisassembleCode(IntPtr address, int length, IntPtr virtualAddress, bool determineStaticInstructionBytes, EnumerateInstructionCallback callback) + { + return internalCoreFunctions.DisassembleCode(address, length, virtualAddress, determineStaticInstructionBytes, callback); + } + + public IntPtr InitializeInput() + { + return internalCoreFunctions.InitializeInput(); + } + + public Keys[] GetPressedKeys(IntPtr handle) + { + return internalCoreFunctions.GetPressedKeys(handle); + } + + public void ReleaseInput(IntPtr handle) + { + internalCoreFunctions.ReleaseInput(handle); + } + + #endregion + } +} diff --git a/ReClass.NET/Core/DataExchange.cs b/ReClass.NET/Core/DataExchange.cs new file mode 100644 index 00000000..40d29b26 --- /dev/null +++ b/ReClass.NET/Core/DataExchange.cs @@ -0,0 +1,79 @@ +using System; +using System.Runtime.InteropServices; +using ReClassNET.Memory; + +namespace ReClassNET.Core +{ + public enum ProcessAccess + { + Read, + Write, + Full + }; + + public enum ControlRemoteProcessAction + { + Suspend, + Resume, + Terminate + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)] + public struct EnumerateProcessData + { + public IntPtr Id; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string Name; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string Path; + }; + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)] + public struct EnumerateRemoteSectionData + { + public IntPtr BaseAddress; + + public IntPtr Size; + + public SectionType Type; + + public SectionCategory Category; + + public SectionProtection Protection; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] + public string Name; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string ModulePath; + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)] + public struct EnumerateRemoteModuleData + { + public IntPtr BaseAddress; + + public IntPtr Size; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string Path; + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)] + public struct InstructionData + { + public IntPtr Address; + + public int Length; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] + public byte[] Data; + + public int StaticInstructionBytes; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] + public string Instruction; + }; +} diff --git a/ReClass.NET/Core/ICoreProcessFunctions.cs b/ReClass.NET/Core/ICoreProcessFunctions.cs new file mode 100644 index 00000000..1c96f4df --- /dev/null +++ b/ReClass.NET/Core/ICoreProcessFunctions.cs @@ -0,0 +1,38 @@ +using System; +using ReClassNET.Debugger; + +namespace ReClassNET.Core +{ + public delegate void EnumerateProcessCallback(ref EnumerateProcessData data); + public delegate void EnumerateRemoteSectionCallback(ref EnumerateRemoteSectionData data); + public delegate void EnumerateRemoteModuleCallback(ref EnumerateRemoteModuleData data); + + public interface ICoreProcessFunctions + { + void EnumerateProcesses(EnumerateProcessCallback callbackProcess); + + void EnumerateRemoteSectionsAndModules(IntPtr process, EnumerateRemoteSectionCallback callbackSection, EnumerateRemoteModuleCallback callbackModule); + + IntPtr OpenRemoteProcess(IntPtr pid, ProcessAccess desiredAccess); + + bool IsProcessValid(IntPtr process); + + void CloseRemoteProcess(IntPtr process); + + bool ReadRemoteMemory(IntPtr process, IntPtr address, ref byte[] buffer, int offset, int size); + + bool WriteRemoteMemory(IntPtr process, IntPtr address, ref byte[] buffer, int offset, int size); + + void ControlRemoteProcess(IntPtr process, ControlRemoteProcessAction action); + + bool AttachDebuggerToProcess(IntPtr id); + + void DetachDebuggerFromProcess(IntPtr id); + + bool AwaitDebugEvent(ref DebugEvent evt, int timeoutInMilliseconds); + + void HandleDebugEvent(ref DebugEvent evt); + + bool SetHardwareBreakpoint(IntPtr id, IntPtr address, HardwareBreakpointRegister register, HardwareBreakpointTrigger trigger, HardwareBreakpointSize size, bool set); + } +} diff --git a/ReClass.NET/Core/IInternalCoreFunctions.cs b/ReClass.NET/Core/IInternalCoreFunctions.cs new file mode 100644 index 00000000..e1418f14 --- /dev/null +++ b/ReClass.NET/Core/IInternalCoreFunctions.cs @@ -0,0 +1,16 @@ +using System; +using System.Windows.Forms; + +namespace ReClassNET.Core +{ + public interface IInternalCoreFunctions + { + bool DisassembleCode(IntPtr address, int length, IntPtr virtualAddress, bool determineStaticInstructionBytes, EnumerateInstructionCallback callback); + + IntPtr InitializeInput(); + + Keys[] GetPressedKeys(IntPtr handle); + + void ReleaseInput(IntPtr handle); + } +} diff --git a/ReClass.NET/Core/InternalCoreFunctions.cs b/ReClass.NET/Core/InternalCoreFunctions.cs new file mode 100644 index 00000000..0e1494b3 --- /dev/null +++ b/ReClass.NET/Core/InternalCoreFunctions.cs @@ -0,0 +1,112 @@ +using System; +using System.IO; +using System.Runtime.InteropServices; +using System.Windows.Forms; +using ReClassNET.Extensions; +using ReClassNET.Native; +using ReClassNET.Util; + +namespace ReClassNET.Core +{ + public delegate bool EnumerateInstructionCallback(ref InstructionData data); + + internal class InternalCoreFunctions : NativeCoreWrapper, IInternalCoreFunctions, IDisposable + { + private const string CoreFunctionsModuleWindows = "NativeCore.dll"; + private const string CoreFunctionsModuleUnix = "NativeCore.so"; + + private readonly IntPtr handle; + + [return: MarshalAs(UnmanagedType.I1)] + private delegate bool DisassembleCodeDelegate(IntPtr address, IntPtr length, IntPtr virtualAddress, [MarshalAs(UnmanagedType.I1)] bool determineStaticInstructionBytes, [MarshalAs(UnmanagedType.FunctionPtr)] EnumerateInstructionCallback callback); + + private delegate IntPtr InitializeInputDelegate(); + + private delegate bool GetPressedKeysDelegate(IntPtr handle, out IntPtr pressedKeysArrayPtr, out int length); + + private delegate void ReleaseInputDelegate(IntPtr handle); + + private readonly DisassembleCodeDelegate disassembleCodeDelegate; + + private readonly InitializeInputDelegate initializeInputDelegate; + private readonly GetPressedKeysDelegate getPressedKeysDelegate; + private readonly ReleaseInputDelegate releaseInputDelegate; + + private InternalCoreFunctions(IntPtr handle) + : base(handle) + { + this.handle = handle; + + disassembleCodeDelegate = GetFunctionDelegate(handle, "DisassembleCode"); + + initializeInputDelegate = GetFunctionDelegate(handle, "InitializeInput"); + getPressedKeysDelegate = GetFunctionDelegate(handle, "GetPressedKeys"); + releaseInputDelegate = GetFunctionDelegate(handle, "ReleaseInput"); + } + + public static InternalCoreFunctions Create() + { + var libraryName = NativeMethods.IsUnix() ? CoreFunctionsModuleUnix : CoreFunctionsModuleWindows; + var libraryPath = Path.Combine(PathUtil.ExecutableFolderPath, libraryName); + + var handle = NativeMethods.LoadLibrary(libraryPath); + if (handle.IsNull()) + { + throw new FileNotFoundException($"Failed to load native core functions! Couldnt find at location {libraryPath}"); + } + + return new InternalCoreFunctions(handle); + } + + #region IDisposable Support + + ~InternalCoreFunctions() + { + ReleaseUnmanagedResources(); + } + + private void ReleaseUnmanagedResources() + { + NativeMethods.FreeLibrary(handle); + } + + public void Dispose() + { + ReleaseUnmanagedResources(); + + GC.SuppressFinalize(this); + } + + #endregion + + public bool DisassembleCode(IntPtr address, int length, IntPtr virtualAddress, bool determineStaticInstructionBytes, EnumerateInstructionCallback callback) + { + return disassembleCodeDelegate(address, (IntPtr)length, virtualAddress, determineStaticInstructionBytes, callback); + } + + public IntPtr InitializeInput() + { + return initializeInputDelegate(); + } + + private static readonly Keys[] empty = new Keys[0]; + + public Keys[] GetPressedKeys(IntPtr handle) + { + if (!getPressedKeysDelegate(handle, out var buffer, out var length) || length == 0) + { + return empty; + } + + var keys = new int[length]; + Marshal.Copy(buffer, keys, 0, length); + return (Keys[])(object)keys; // Yes, it's legal... + //return Array.ConvertAll(keys, k => (Keys)k); + } + + public void ReleaseInput(IntPtr handle) + { + releaseInputDelegate(handle); + } + } +} diff --git a/ReClass.NET/Core/NativeCoreWrapper.cs b/ReClass.NET/Core/NativeCoreWrapper.cs new file mode 100644 index 00000000..bdca5954 --- /dev/null +++ b/ReClass.NET/Core/NativeCoreWrapper.cs @@ -0,0 +1,158 @@ +using System; +using System.Runtime.InteropServices; +using ReClassNET.Debugger; +using ReClassNET.Extensions; +using ReClassNET.Native; + +namespace ReClassNET.Core +{ + public class NativeCoreWrapper : ICoreProcessFunctions + { + #region Native Delegates + + private delegate void EnumerateProcessesDelegate([MarshalAs(UnmanagedType.FunctionPtr)] EnumerateProcessCallback callbackProcess); + + private delegate void EnumerateRemoteSectionsAndModulesDelegate(IntPtr process, [MarshalAs(UnmanagedType.FunctionPtr)] EnumerateRemoteSectionCallback callbackSection, [MarshalAs(UnmanagedType.FunctionPtr)] EnumerateRemoteModuleCallback callbackModule); + + [return: MarshalAs(UnmanagedType.I1)] + private delegate bool IsProcessValidDelegate(IntPtr process); + + private delegate IntPtr OpenRemoteProcessDelegate(IntPtr pid, ProcessAccess desiredAccess); + + private delegate void CloseRemoteProcessDelegate(IntPtr process); + + [return: MarshalAs(UnmanagedType.I1)] + private delegate bool ReadRemoteMemoryDelegate(IntPtr process, IntPtr address, [Out] byte[] buffer, int offset, int size); + + [return: MarshalAs(UnmanagedType.I1)] + private delegate bool WriteRemoteMemoryDelegate(IntPtr process, IntPtr address, [In] byte[] buffer, int offset, int size); + + private delegate void ControlRemoteProcessDelegate(IntPtr process, ControlRemoteProcessAction action); + + [return: MarshalAs(UnmanagedType.I1)] + private delegate bool AttachDebuggerToProcessDelegate(IntPtr id); + + private delegate void DetachDebuggerFromProcessDelegate(IntPtr id); + + [return: MarshalAs(UnmanagedType.I1)] + private delegate bool AwaitDebugEventDelegate([In, Out] ref DebugEvent evt, int timeoutInMilliseconds); + + private delegate void HandleDebugEventDelegate([In, Out] ref DebugEvent evt); + + [return: MarshalAs(UnmanagedType.I1)] + private delegate bool SetHardwareBreakpointDelegate(IntPtr id, IntPtr address, HardwareBreakpointRegister register, HardwareBreakpointTrigger trigger, HardwareBreakpointSize size, [param: MarshalAs(UnmanagedType.I1)] bool set); + + private readonly EnumerateProcessesDelegate enumerateProcessesDelegate; + private readonly EnumerateRemoteSectionsAndModulesDelegate enumerateRemoteSectionsAndModulesDelegate; + private readonly OpenRemoteProcessDelegate openRemoteProcessDelegate; + private readonly IsProcessValidDelegate isProcessValidDelegate; + private readonly CloseRemoteProcessDelegate closeRemoteProcessDelegate; + private readonly ReadRemoteMemoryDelegate readRemoteMemoryDelegate; + private readonly WriteRemoteMemoryDelegate writeRemoteMemoryDelegate; + private readonly ControlRemoteProcessDelegate controlRemoteProcessDelegate; + private readonly AttachDebuggerToProcessDelegate attachDebuggerToProcessDelegate; + private readonly DetachDebuggerFromProcessDelegate detachDebuggerFromProcessDelegate; + private readonly AwaitDebugEventDelegate awaitDebugEventDelegate; + private readonly HandleDebugEventDelegate handleDebugEventDelegate; + private readonly SetHardwareBreakpointDelegate setHardwareBreakpointDelegate; + + #endregion + + public NativeCoreWrapper(IntPtr handle) + { + if (handle.IsNull()) + { + throw new ArgumentNullException(); + } + + enumerateProcessesDelegate = GetFunctionDelegate(handle, "EnumerateProcesses"); + enumerateRemoteSectionsAndModulesDelegate = GetFunctionDelegate(handle, "EnumerateRemoteSectionsAndModules"); + openRemoteProcessDelegate = GetFunctionDelegate(handle, "OpenRemoteProcess"); + isProcessValidDelegate = GetFunctionDelegate(handle, "IsProcessValid"); + closeRemoteProcessDelegate = GetFunctionDelegate(handle, "CloseRemoteProcess"); + readRemoteMemoryDelegate = GetFunctionDelegate(handle, "ReadRemoteMemory"); + writeRemoteMemoryDelegate = GetFunctionDelegate(handle, "WriteRemoteMemory"); + controlRemoteProcessDelegate = GetFunctionDelegate(handle, "ControlRemoteProcess"); + attachDebuggerToProcessDelegate = GetFunctionDelegate(handle, "AttachDebuggerToProcess"); + detachDebuggerFromProcessDelegate = GetFunctionDelegate(handle, "DetachDebuggerFromProcess"); + awaitDebugEventDelegate = GetFunctionDelegate(handle, "AwaitDebugEvent"); + handleDebugEventDelegate = GetFunctionDelegate(handle, "HandleDebugEvent"); + setHardwareBreakpointDelegate = GetFunctionDelegate(handle, "SetHardwareBreakpoint"); + } + + protected static TDelegate GetFunctionDelegate(IntPtr handle, string function) + { + var address = NativeMethods.GetProcAddress(handle, function); + if (address.IsNull()) + { + throw new Exception($"Function '{function}' not found."); + } + return Marshal.GetDelegateForFunctionPointer(address); + } + + public void EnumerateProcesses(EnumerateProcessCallback callbackProcess) + { + enumerateProcessesDelegate(callbackProcess); + } + + public void EnumerateRemoteSectionsAndModules(IntPtr process, EnumerateRemoteSectionCallback callbackSection, EnumerateRemoteModuleCallback callbackModule) + { + enumerateRemoteSectionsAndModulesDelegate(process, callbackSection, callbackModule); + } + + public IntPtr OpenRemoteProcess(IntPtr pid, ProcessAccess desiredAccess) + { + return openRemoteProcessDelegate(pid, desiredAccess); + } + + public bool IsProcessValid(IntPtr process) + { + return isProcessValidDelegate(process); + } + + public void CloseRemoteProcess(IntPtr process) + { + closeRemoteProcessDelegate(process); + } + + public bool ReadRemoteMemory(IntPtr process, IntPtr address, ref byte[] buffer, int offset, int size) + { + return readRemoteMemoryDelegate(process, address, buffer, offset, size); + } + + public bool WriteRemoteMemory(IntPtr process, IntPtr address, ref byte[] buffer, int offset, int size) + { + return writeRemoteMemoryDelegate(process, address, buffer, offset, size); + } + + public void ControlRemoteProcess(IntPtr process, ControlRemoteProcessAction action) + { + controlRemoteProcessDelegate(process, action); + } + + public bool AttachDebuggerToProcess(IntPtr id) + { + return attachDebuggerToProcessDelegate(id); + } + + public void DetachDebuggerFromProcess(IntPtr id) + { + detachDebuggerFromProcessDelegate(id); + } + + public bool AwaitDebugEvent(ref DebugEvent evt, int timeoutInMilliseconds) + { + return awaitDebugEventDelegate(ref evt, timeoutInMilliseconds); + } + + public void HandleDebugEvent(ref DebugEvent evt) + { + handleDebugEventDelegate(ref evt); + } + + public bool SetHardwareBreakpoint(IntPtr id, IntPtr address, HardwareBreakpointRegister register, HardwareBreakpointTrigger trigger, HardwareBreakpointSize size, bool set) + { + return setHardwareBreakpointDelegate(id, address, register, trigger, size, set); + } + } +} diff --git a/DataExchange/CustomNodeConverter.cs b/ReClass.NET/DataExchange/ReClass/CustomNodeSerializer.cs similarity index 52% rename from DataExchange/CustomNodeConverter.cs rename to ReClass.NET/DataExchange/ReClass/CustomNodeSerializer.cs index 8ac76814..53797944 100644 --- a/DataExchange/CustomNodeConverter.cs +++ b/ReClass.NET/DataExchange/ReClass/CustomNodeSerializer.cs @@ -6,10 +6,13 @@ using ReClassNET.Logger; using ReClassNET.Nodes; -namespace ReClassNET.DataExchange +namespace ReClassNET.DataExchange.ReClass { - [ContractClass(typeof(ICustomNodeConverterContract))] - public interface ICustomNodeConverter + public delegate BaseNode CreateNodeFromElementHandler(XElement element, BaseNode parent, ILogger logger); + public delegate XElement CreateElementFromNodeHandler(BaseNode node, ILogger logger); + + [ContractClass(typeof(CustomNodeSerializerContract))] + public interface ICustomNodeSerializer { /// Determine if the instance can handle the xml element. /// The xml element to check. @@ -26,19 +29,20 @@ public interface ICustomNodeConverter /// The parent of the node. /// The list of classes which correspond to the node. /// The logger used to output messages. - /// [out] The node for the xml element. - /// True if a node was created, otherwise false. - bool TryCreateNodeFromElement(XElement element, ClassNode parent, IEnumerable classes, ILogger logger, out BaseNode node); + /// The default method which creates a node from an element. Should be called to resolve nodes for wrapped inner nodes. + /// The node for the xml element. + BaseNode CreateNodeFromElement(XElement element, BaseNode parent, IEnumerable classes, ILogger logger, CreateNodeFromElementHandler defaultHandler); - /// Creates a xml element from the node. This method gets only called if returned true. + /// Creates a xml element from the node. This method gets only called if returned true. /// The node to create the xml element from. /// The logger used to output messages. + /// The default method which creates an element for a node. Should be called to resolve elements for wrapped inner nodes. /// The xml element for the node. - XElement CreateElementFromNode(BaseNode node, ILogger logger); + XElement CreateElementFromNode(BaseNode node, ILogger logger, CreateElementFromNodeHandler defaultHandler); } - [ContractClassFor(typeof(ICustomNodeConverter))] - internal abstract class ICustomNodeConverterContract : ICustomNodeConverter + [ContractClassFor(typeof(ICustomNodeSerializer))] + internal abstract class CustomNodeSerializerContract : ICustomNodeSerializer { public bool CanHandleElement(XElement element) { @@ -54,7 +58,7 @@ public bool CanHandleNode(BaseNode node) throw new NotImplementedException(); } - public bool TryCreateNodeFromElement(XElement element, ClassNode parent, IEnumerable classes, ILogger logger, out BaseNode node) + public BaseNode CreateNodeFromElement(XElement element, BaseNode parent, IEnumerable classes, ILogger logger, CreateNodeFromElementHandler defaultHandler) { Contract.Requires(element != null); Contract.Requires(CanHandleElement(element)); @@ -62,51 +66,53 @@ public bool TryCreateNodeFromElement(XElement element, ClassNode parent, IEnumer Contract.Requires(classes != null); Contract.Requires(Contract.ForAll(classes, c => c != null)); Contract.Requires(logger != null); + Contract.Requires(defaultHandler != null); throw new NotImplementedException(); } - public XElement CreateElementFromNode(BaseNode node, ILogger logger) + public XElement CreateElementFromNode(BaseNode node, ILogger logger, CreateElementFromNodeHandler defaultHandler) { Contract.Requires(node != null); Contract.Requires(CanHandleNode(node)); Contract.Requires(logger != null); + Contract.Requires(defaultHandler != null); Contract.Ensures(Contract.Result() != null); throw new NotImplementedException(); } } - public class CustomNodeConvert + internal class CustomNodeSerializer { - private static readonly List converters = new List(); + private static readonly List converters = new List(); - public static void RegisterCustomType(ICustomNodeConverter converter) + public static void Add(ICustomNodeSerializer serializer) { - Contract.Requires(converter != null); + Contract.Requires(serializer != null); - converters.Add(converter); + converters.Add(serializer); } - public static void DeregisterCustomType(ICustomNodeConverter converter) + public static void Remove(ICustomNodeSerializer serializer) { - Contract.Requires(converter != null); + Contract.Requires(serializer != null); - converters.Remove(converter); + converters.Remove(serializer); } - public static ICustomNodeConverter GetReadConverter(XElement element) + public static ICustomNodeSerializer GetReadConverter(XElement element) { Contract.Requires(element != null); - return converters.Where(c => c.CanHandleElement(element)).FirstOrDefault(); + return converters.FirstOrDefault(c => c.CanHandleElement(element)); } - public static ICustomNodeConverter GetWriteConverter(BaseNode node) + public static ICustomNodeSerializer GetWriteConverter(BaseNode node) { Contract.Requires(node != null); - return converters.Where(c => c.CanHandleNode(node)).FirstOrDefault(); + return converters.FirstOrDefault(c => c.CanHandleNode(node)); } } } diff --git a/DataExchange/IReClassExport.cs b/ReClass.NET/DataExchange/ReClass/IReClassExport.cs similarity index 77% rename from DataExchange/IReClassExport.cs rename to ReClass.NET/DataExchange/ReClass/IReClassExport.cs index f06c6ab2..d169251e 100644 --- a/DataExchange/IReClassExport.cs +++ b/ReClass.NET/DataExchange/ReClass/IReClassExport.cs @@ -2,9 +2,9 @@ using System.IO; using ReClassNET.Logger; -namespace ReClassNET.DataExchange +namespace ReClassNET.DataExchange.ReClass { - [ContractClass(typeof(IReClassExportContract))] + [ContractClass(typeof(ReClassExportContract))] public interface IReClassExport { void Save(string filePath, ILogger logger); @@ -13,7 +13,7 @@ public interface IReClassExport } [ContractClassFor(typeof(IReClassExport))] - internal abstract class IReClassExportContract : IReClassExport + internal abstract class ReClassExportContract : IReClassExport { public void Save(string filePath, ILogger logger) { diff --git a/DataExchange/IReClassImport.cs b/ReClass.NET/DataExchange/ReClass/IReClassImport.cs similarity index 72% rename from DataExchange/IReClassImport.cs rename to ReClass.NET/DataExchange/ReClass/IReClassImport.cs index 32f9a131..802dbc8a 100644 --- a/DataExchange/IReClassImport.cs +++ b/ReClass.NET/DataExchange/ReClass/IReClassImport.cs @@ -2,16 +2,16 @@ using System.Diagnostics.Contracts; using ReClassNET.Logger; -namespace ReClassNET.DataExchange +namespace ReClassNET.DataExchange.ReClass { - [ContractClass(typeof(IReClassImportContract))] + [ContractClass(typeof(ReClassImportContract))] public interface IReClassImport { void Load(string filePath, ILogger logger); } [ContractClassFor(typeof(IReClassImport))] - internal abstract class IReClassImportContract : IReClassImport + internal abstract class ReClassImportContract : IReClassImport { public void Load(string filePath, ILogger logger) { diff --git a/ReClass.NET/DataExchange/ReClass/Legacy/BaseClassArrayNode.cs b/ReClass.NET/DataExchange/ReClass/Legacy/BaseClassArrayNode.cs new file mode 100644 index 00000000..0871658d --- /dev/null +++ b/ReClass.NET/DataExchange/ReClass/Legacy/BaseClassArrayNode.cs @@ -0,0 +1,34 @@ +using System; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Nodes; + +namespace ReClassNET.DataExchange.ReClass.Legacy +{ + public abstract class BaseClassArrayNode : BaseWrapperNode + { + public override int MemorySize => throw new NotImplementedException(); + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + throw new NotImplementedException(); + } + + public override int CalculateDrawnHeight(DrawContext context) + { + throw new NotImplementedException(); + } + + public override Size Draw(DrawContext context, int x, int y) + { + throw new NotImplementedException(); + } + + public override bool CanChangeInnerNodeTo(BaseNode node) + { + return node is ClassNode; + } + + public abstract BaseNode GetEquivalentNode(int count, ClassNode classNode); + } +} diff --git a/ReClass.NET/DataExchange/ReClass/Legacy/ClassInstanceArrayNode.cs b/ReClass.NET/DataExchange/ReClass/Legacy/ClassInstanceArrayNode.cs new file mode 100644 index 00000000..02b75995 --- /dev/null +++ b/ReClass.NET/DataExchange/ReClass/Legacy/ClassInstanceArrayNode.cs @@ -0,0 +1,21 @@ +using ReClassNET.Nodes; + +namespace ReClassNET.DataExchange.ReClass.Legacy +{ + public class ClassInstanceArrayNode : BaseClassArrayNode + { + protected override bool PerformCycleCheck => true; + + public override BaseNode GetEquivalentNode(int count, ClassNode classNode) + { + var classInstanceNode = new ClassInstanceNode(); + classInstanceNode.ChangeInnerNode(classNode); + + var arrayNode = new ArrayNode { Count = count }; + arrayNode.ChangeInnerNode(classInstanceNode); + arrayNode.CopyFromNode(this); + + return arrayNode; + } + } +} diff --git a/ReClass.NET/DataExchange/ReClass/Legacy/ClassPointerArrayNode.cs b/ReClass.NET/DataExchange/ReClass/Legacy/ClassPointerArrayNode.cs new file mode 100644 index 00000000..2e5ee2da --- /dev/null +++ b/ReClass.NET/DataExchange/ReClass/Legacy/ClassPointerArrayNode.cs @@ -0,0 +1,24 @@ +using ReClassNET.Nodes; + +namespace ReClassNET.DataExchange.ReClass.Legacy +{ + public class ClassPointerArrayNode : BaseClassArrayNode + { + protected override bool PerformCycleCheck => false; + + public override BaseNode GetEquivalentNode(int count, ClassNode classNode) + { + var classInstanceNode = new ClassInstanceNode(); + classInstanceNode.ChangeInnerNode(classNode); + + var pointerNode = new PointerNode(); + pointerNode.ChangeInnerNode(classInstanceNode); + + var arrayNode = new ArrayNode { Count = count }; + arrayNode.ChangeInnerNode(pointerNode); + arrayNode.CopyFromNode(this); + + return arrayNode; + } + } +} diff --git a/ReClass.NET/DataExchange/ReClass/Legacy/ClassPointerNode.cs b/ReClass.NET/DataExchange/ReClass/Legacy/ClassPointerNode.cs new file mode 100644 index 00000000..243707e8 --- /dev/null +++ b/ReClass.NET/DataExchange/ReClass/Legacy/ClassPointerNode.cs @@ -0,0 +1,46 @@ +using System; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Nodes; + +namespace ReClassNET.DataExchange.ReClass.Legacy +{ + public class ClassPointerNode : BaseWrapperNode + { + public override int MemorySize => throw new NotImplementedException(); + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + throw new NotImplementedException(); + } + + public override int CalculateDrawnHeight(DrawContext context) + { + throw new NotImplementedException(); + } + + public override Size Draw(DrawContext context, int x, int y) + { + throw new NotImplementedException(); + } + + protected override bool PerformCycleCheck => false; + + public override bool CanChangeInnerNodeTo(BaseNode node) + { + return node is ClassNode; + } + + public BaseNode GetEquivalentNode(ClassNode classNode) + { + var classInstanceNode = new ClassInstanceNode(); + classInstanceNode.ChangeInnerNode(classNode); + + var pointerNode = new PointerNode(); + pointerNode.ChangeInnerNode(classInstanceNode); + pointerNode.CopyFromNode(this); + + return pointerNode; + } + } +} diff --git a/ReClass.NET/DataExchange/ReClass/Legacy/CustomNode.cs b/ReClass.NET/DataExchange/ReClass/Legacy/CustomNode.cs new file mode 100644 index 00000000..0645f860 --- /dev/null +++ b/ReClass.NET/DataExchange/ReClass/Legacy/CustomNode.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Nodes; + +namespace ReClassNET.DataExchange.ReClass.Legacy +{ + public class CustomNode : BaseNode + { + public override int MemorySize => throw new NotImplementedException(); + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + throw new NotImplementedException(); + } + + public override int CalculateDrawnHeight(DrawContext context) + { + throw new NotImplementedException(); + } + + public override Size Draw(DrawContext context, int x, int y) + { + throw new NotImplementedException(); + } + + public IEnumerable GetEquivalentNodes(int size) + { + while (size != 0) + { + BaseNode paddingNode; +#if RECLASSNET64 + if (size >= 8) + { + paddingNode = new Hex64Node(); + } + else +#endif + if (size >= 4) + { + paddingNode = new Hex32Node(); + } + else if (size >= 2) + { + paddingNode = new Hex16Node(); + } + else + { + paddingNode = new Hex8Node(); + } + + paddingNode.Comment = Comment; + + size -= paddingNode.MemorySize; + + yield return paddingNode; + } + } + } +} diff --git a/DataExchange/ReClassClipboard.cs b/ReClass.NET/DataExchange/ReClass/ReClassClipboard.cs similarity index 66% rename from DataExchange/ReClassClipboard.cs rename to ReClass.NET/DataExchange/ReClass/ReClassClipboard.cs index 6803911d..908040c9 100644 --- a/DataExchange/ReClassClipboard.cs +++ b/ReClass.NET/DataExchange/ReClass/ReClassClipboard.cs @@ -5,8 +5,9 @@ using System.Windows.Forms; using ReClassNET.Logger; using ReClassNET.Nodes; +using ReClassNET.Project; -namespace ReClassNET.DataExchange +namespace ReClassNET.DataExchange.ReClass { public class ReClassClipboard { @@ -24,12 +25,11 @@ public static void Copy(IEnumerable nodes, ILogger logger) Contract.Requires(nodes != null); Contract.Requires(logger != null); - using (var ms = new MemoryStream()) - { - ReClassNetFile.WriteNodes(ms, nodes, logger); + using var ms = new MemoryStream(); - Clipboard.SetData(ClipboardFormat, ms.ToArray()); - } + ReClassNetFile.SerializeNodesToStream(ms, nodes, logger); + + Clipboard.SetData(ClipboardFormat, ms.ToArray()); } /// Pastes nodes from the clipboard. @@ -40,26 +40,16 @@ public static Tuple, List> Paste(ReClassNetProject tem { Contract.Requires(templateProject != null); Contract.Requires(logger != null); - Contract.Ensures(Contract.Result>() != null); + Contract.Ensures(Contract.Result, List>>() != null); - var classes = new List(); - var nodes = new List(); - - if (ContainsNodes) + if (ContainsNodes && Clipboard.GetData(ClipboardFormat) is byte[] data) { - var data = Clipboard.GetData(ClipboardFormat) as byte[]; - if (data != null) - { - using (var ms = new MemoryStream(data)) - { - var result = ReClassNetFile.ReadNodes(ms, templateProject, logger); - classes.AddRange(result.Item1); - nodes.AddRange(result.Item2); - } - } + using var ms = new MemoryStream(data); + + return ReClassNetFile.DeserializeNodesFromStream(ms, templateProject, logger); } - return Tuple.Create(classes, nodes); + return Tuple.Create(new List(), new List()); } } } diff --git a/DataExchange/ReClassFile.cs b/ReClass.NET/DataExchange/ReClass/ReClassFile.cs similarity index 56% rename from DataExchange/ReClassFile.cs rename to ReClass.NET/DataExchange/ReClass/ReClassFile.cs index 7c5593f9..9bb01985 100644 --- a/DataExchange/ReClassFile.cs +++ b/ReClass.NET/DataExchange/ReClass/ReClassFile.cs @@ -3,19 +3,20 @@ using System.Diagnostics.Contracts; using System.Linq; using System.Xml.Linq; +using ReClassNET.DataExchange.ReClass.Legacy; +using ReClassNET.Extensions; using ReClassNET.Logger; using ReClassNET.Nodes; -using ReClassNET.UI; -using ReClassNET.Util; +using ReClassNET.Project; -namespace ReClassNET.DataExchange +namespace ReClassNET.DataExchange.ReClass { - partial class ReClassFile : IReClassImport + public class ReClassFile : IReClassImport { public const string FormatName = "ReClass File"; public const string FileExtension = ".reclass"; - private ReClassNetProject project; + private readonly ReClassNetProject project; public ReClassFile(ReClassNetProject project) { @@ -27,31 +28,32 @@ public ReClassFile(ReClassNetProject project) public void Load(string filePath, ILogger logger) { var document = XDocument.Load(filePath); + if (document.Root == null) + { + return; + } Type[] typeMap = null; - var versionComment = document.Root.FirstNode as XComment; - if (versionComment != null) + if (document.Root.FirstNode is XComment versionComment) { switch (versionComment.Value.Substring(0, 12).ToLower()) { case "reclass 2011": case "reclass 2013": - typeMap = TypeMap2013; + typeMap = typeMap2013; break; case "reclass 2015": case "reclass 2016": - typeMap = TypeMap2016; + typeMap = typeMap2016; break; - } - } + default: + logger.Log(LogLevel.Warning, $"Unknown file version: {versionComment.Value}"); + logger.Log(LogLevel.Warning, "Defaulting to ReClass 2016."); - if (typeMap == null) - { - logger.Log(LogLevel.Warning, $"Unknown file version: {versionComment?.Value}"); - logger.Log(LogLevel.Warning, "Defaulting to ReClass 2016."); - - typeMap = TypeMap2016; + typeMap = typeMap2016; + break; + } } var classes = new List>(); @@ -72,41 +74,44 @@ public void Load(string filePath, ILogger logger) } var classMap = classes.ToDictionary(t => t.Item2.Name, t => t.Item2); - foreach (var t in classes) + foreach (var (classElement, classNode) in classes) { ReadNodeElements( - t.Item1.Elements("Node"), - t.Item2, + classElement.Elements("Node"), + classNode, classMap, typeMap, logger - ).ForEach(t.Item2.AddNode); + ).ForEach(classNode.AddNode); } } /// Parse ReClass address string and transform it into a ReClass.NET formula. /// The address string. /// A string. - private string TransformAddressString(string address) + private static string TransformAddressString(string address) { Contract.Requires(address != null); - var parts = address.Split('+').Select(s => s.Trim().ToLower().Replace("\"", string.Empty)).Where(s => s != string.Empty).ToArray(); + var parts = address.Split('+') + .Select(s => s.Trim().ToLower().Replace("\"", string.Empty)) + .Where(s => s != string.Empty) + .ToArray(); - for (int i = 0; i < parts.Length; ++i) + for (var i = 0; i < parts.Length; ++i) { var part = parts[i]; - bool isModule = part.Contains(".exe") || part.Contains(".dll"); + var isModule = part.Contains(".exe") || part.Contains(".dll"); - bool isPointer = false; + var isPointer = false; if (part.StartsWith("*")) { isPointer = true; part = part.Substring(1); } - if (part.Contains(".exe") || part.Contains(".dll")) + if (isModule) { part = $"<{part}>"; } @@ -133,8 +138,7 @@ private IEnumerable ReadNodeElements(IEnumerable elements, C { Type nodeType = null; - int typeVal; - if (int.TryParse(element.Attribute("Type")?.Value, out typeVal)) + if (int.TryParse(element.Attribute("Type")?.Value, out var typeVal)) { if (typeVal >= 0 && typeVal < typeMap.Length) { @@ -150,7 +154,7 @@ private IEnumerable ReadNodeElements(IEnumerable elements, C continue; } - var node = Activator.CreateInstance(nodeType) as BaseNode; + var node = BaseNode.CreateInstanceFromType(nodeType, false); if (node == null) { logger.Log(LogLevel.Error, $"Could not create node of type: {nodeType}"); @@ -159,56 +163,41 @@ private IEnumerable ReadNodeElements(IEnumerable elements, C } node.Name = element.Attribute("Name")?.Value ?? string.Empty; - node.Comment = element.Attribute("Comments")?.Value ?? string.Empty; + node.Comment = element.Attribute("Comment")?.Value ?? string.Empty; + node.IsHidden = element.Attribute("bHidden")?.Value.Equals("1") ?? false; // Convert the Custom node into normal hex nodes. - if (node is CustomNode) + if (node is CustomNode customNode) { - int size; - int.TryParse(element.Attribute("Size")?.Value, out size); + int.TryParse(element.Attribute("Size")?.Value, out var size); - while (size != 0) + foreach (var paddingNode in customNode.GetEquivalentNodes(size)) { - BaseNode paddingNode = null; -#if WIN64 - if (size >= 8) - { - paddingNode = new Hex64Node(); - } - else -#endif - if (size >= 4) - { - paddingNode = new Hex32Node(); - } - else if (size >= 2) - { - paddingNode = new Hex16Node(); - } - else - { - paddingNode = new Hex8Node(); - } - - paddingNode.Comment = node.Comment; - - size -= node.MemorySize; - yield return paddingNode; } continue; } - var referenceNode = node as BaseReferenceNode; - if (referenceNode != null) + // ClassInstanceNode, ClassPointerNode, ClassInstanceArrayNode, ClassPointerArrayNode + if (node is BaseWrapperNode baseWrapperNode) { - string reference = null; - if (referenceNode is ClassInstanceArrayNode) + string reference; + int arrayCount = 0; + if (node is BaseClassArrayNode) // ClassInstanceArrayNode, ClassPointerArrayNode { reference = element.Element("Array")?.Attribute("Name")?.Value; + + if (node is ClassInstanceArrayNode) + { + TryGetAttributeValue(element, "Total", out arrayCount, logger); + } + else + { + TryGetAttributeValue(element, "Count", out arrayCount, logger); + } } - else + else // ClassInstanceNode, ClassPointerNode { reference = element.Attribute("Pointer")?.Value ?? element.Attribute("Instance")?.Value; } @@ -222,54 +211,53 @@ private IEnumerable ReadNodeElements(IEnumerable elements, C } var innerClassNode = classes[reference]; - if (referenceNode.PerformCycleCheck && !ClassUtil.IsCycleFree(parent, innerClassNode, project.Classes)) + if (baseWrapperNode.ShouldPerformCycleCheckForInnerNode() && !ClassUtil.IsCyclicIfClassIsAccessibleFromParent(parent, innerClassNode, project.Classes)) { logger.Log(LogLevel.Error, $"Skipping node with cycle reference: {parent.Name}->{node.Name}"); continue; } - referenceNode.ChangeInnerNode(innerClassNode); - } - var vtableNode = node as VTableNode; - if (vtableNode != null) - { - element - .Elements("Function") - .Select(e => new VMethodNode - { - Name = e.Attribute("Name")?.Value ?? string.Empty, - Comment = e.Attribute("Comments")?.Value ?? string.Empty - }) - .ForEach(vtableNode.AddNode); - } - var classInstanceArrayNode = node as ClassInstanceArrayNode; - if (classInstanceArrayNode != null) - { - int count; - TryGetAttributeValue(element, "Total", out count, logger); - classInstanceArrayNode.Count = count; - } - var classPtrArrayNode = node as ClassPtrArrayNode; - if (classPtrArrayNode != null) - { - int count; - TryGetAttributeValue(element, "Size", out count, logger); - classInstanceArrayNode.Count = count / IntPtr.Size; - } - var textNode = node as BaseTextNode; - if (textNode != null) - { - int length; - TryGetAttributeValue(element, "Size", out length, logger); - textNode.Length = textNode is UTF16TextNode ? length / 2 : length; + // ClassPointerNode, ClassInstanceArrayNode and ClassPointerArrayNode need to be converted to supported nodes. + if (node is BaseClassArrayNode classArrayNode) // ClassInstanceArrayNode, ClassPointerArrayNode + { + node = classArrayNode.GetEquivalentNode(arrayCount, innerClassNode); + } + else if (node is ClassPointerNode classPointerNode) // ClassPointerNode + { + node = classPointerNode.GetEquivalentNode(innerClassNode); + } + else // ClassInstanceNode, ClassPointerNode + { + baseWrapperNode.ChangeInnerNode(innerClassNode); + } } - var bitFieldNode = node as BitFieldNode; - if (bitFieldNode != null) + + switch (node) { - int bits; - TryGetAttributeValue(element, "Size", out bits, logger); - bitFieldNode.Bits = bits * 8; + case VirtualMethodTableNode vtableNode: + element + .Elements("Function") + .Select(e => new VirtualMethodNode + { + Name = e.Attribute("Name")?.Value ?? string.Empty, + Comment = e.Attribute("Comment")?.Value ?? string.Empty, + IsHidden = e.Attribute("bHidden")?.Value.Equals("1") ?? false + }) + .ForEach(vtableNode.AddNode); + break; + case BaseTextNode textNode: + { + TryGetAttributeValue(element, "Size", out var length, logger); + textNode.Length = textNode is Utf16TextNode ? length / 2 : length; + break; + } + case BitFieldNode bitFieldNode: + { + TryGetAttributeValue(element, "Size", out var bits, logger); + bitFieldNode.Bits = bits * 8; + break; + } } yield return node; @@ -287,28 +275,9 @@ private static void TryGetAttributeValue(XElement element, string attribute, out } } - /// Dummy node to represent the ReClass Custom node. - private class CustomNode : BaseNode - { - public override int MemorySize - { - get { throw new NotImplementedException(); } - } - - public override int CalculateHeight(ViewInfo view) - { - throw new NotImplementedException(); - } - - public override int Draw(ViewInfo view, int x, int y) - { - throw new NotImplementedException(); - } - } - #region ReClass 2011 / ReClass 2013 - private static readonly Type[] TypeMap2013 = new Type[] + private static readonly Type[] typeMap2013 = { null, typeof(ClassInstanceNode), @@ -317,7 +286,7 @@ public override int Draw(ViewInfo view, int x, int y) typeof(Hex32Node), typeof(Hex16Node), typeof(Hex8Node), - typeof(ClassPtrNode), + typeof(ClassPointerNode), typeof(Int32Node), typeof(Int16Node), typeof(Int8Node), @@ -325,29 +294,29 @@ public override int Draw(ViewInfo view, int x, int y) typeof(UInt32Node), typeof(UInt16Node), typeof(UInt8Node), - typeof(UTF8TextNode), + typeof(Utf8TextNode), typeof(FunctionPtrNode), typeof(CustomNode), typeof(Vector2Node), typeof(Vector3Node), typeof(Vector4Node), typeof(Matrix4x4Node), - typeof(VTableNode), + typeof(VirtualMethodTableNode), typeof(ClassInstanceArrayNode), null, null, null, typeof(Int64Node), typeof(DoubleNode), - typeof(UTF16TextNode), - typeof(ClassPtrArrayNode) + typeof(Utf16TextNode), + typeof(ClassPointerArrayNode) }; #endregion #region ReClass 2015 / ReClass 2016 - private static readonly Type[] TypeMap2016 = new Type[] + private static readonly Type[] typeMap2016 = { null, typeof(ClassInstanceNode), @@ -357,7 +326,7 @@ public override int Draw(ViewInfo view, int x, int y) typeof(Hex64Node), typeof(Hex16Node), typeof(Hex8Node), - typeof(ClassPtrNode), + typeof(ClassPointerNode), typeof(Int64Node), typeof(Int32Node), typeof(Int16Node), @@ -367,21 +336,22 @@ public override int Draw(ViewInfo view, int x, int y) typeof(UInt32Node), typeof(UInt16Node), typeof(UInt8Node), - typeof(UTF8TextNode), - typeof(UTF16TextNode), + typeof(Utf8TextNode), + typeof(Utf16TextNode), typeof(FunctionPtrNode), typeof(CustomNode), typeof(Vector2Node), typeof(Vector3Node), typeof(Vector4Node), typeof(Matrix4x4Node), - typeof(VTableNode), + typeof(VirtualMethodTableNode), typeof(ClassInstanceArrayNode), null, - typeof(UTF8TextPtrNode), - typeof(UTF16TextPtrNode), + typeof(Utf8TextPtrNode), + typeof(Utf16TextPtrNode), typeof(BitFieldNode), - typeof(UInt64Node) + typeof(UInt64Node), + typeof(FunctionNode) }; #endregion diff --git a/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Constants.cs b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Constants.cs new file mode 100644 index 00000000..d44c645f --- /dev/null +++ b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Constants.cs @@ -0,0 +1,43 @@ +namespace ReClassNET.DataExchange.ReClass +{ + public partial class ReClassNetFile + { + public const string FormatName = "ReClass.NET File"; + public const string FileExtension = ".rcnet"; + public const string FileExtensionId = "rcnetfile"; + + private const uint FileVersion = 0x00010001; + private const uint FileVersionCriticalMask = 0xFFFF0000; + + private const string DataFileName = "Data.xml"; + + private const string SerializationClassName = "__Serialization_Class__"; + + public const string XmlRootElement = "reclass"; + public const string XmlCustomDataElement = "custom_data"; + public const string XmlTypeMappingElement = "type_mapping"; + public const string XmlEnumsElement = "enums"; + public const string XmlEnumElement = "enum"; + public const string XmlClassesElement = "classes"; + public const string XmlClassElement = "class"; + public const string XmlNodeElement = "node"; + public const string XmlMethodElement = "method"; + public const string XmlVersionAttribute = "version"; + public const string XmlPlatformAttribute = "type"; + public const string XmlUuidAttribute = "uuid"; + public const string XmlNameAttribute = "name"; + public const string XmlCommentAttribute = "comment"; + public const string XmlHiddenAttribute = "hidden"; + public const string XmlAddressAttribute = "address"; + public const string XmlTypeAttribute = "type"; + public const string XmlReferenceAttribute = "reference"; + public const string XmlCountAttribute = "count"; + public const string XmlBitsAttribute = "bits"; + public const string XmlLengthAttribute = "length"; + public const string XmlSizeAttribute = "size"; + public const string XmlSignatureAttribute = "signature"; + public const string XmlFlagsAttribute = "flags"; + public const string XmlItemElement = "item"; + public const string XmlValueAttribute = "value"; + } +} diff --git a/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Read.cs b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Read.cs new file mode 100644 index 00000000..4a3cb65d --- /dev/null +++ b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Read.cs @@ -0,0 +1,341 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Xml.Linq; +using ReClassNET.DataExchange.ReClass.Legacy; +using ReClassNET.Extensions; +using ReClassNET.Logger; +using ReClassNET.Nodes; +using ReClassNET.Project; + +namespace ReClassNET.DataExchange.ReClass +{ + public partial class ReClassNetFile + { + public void Load(string filePath, ILogger logger) + { + using var fs = new FileStream(filePath, FileMode.Open); + + Load(fs, logger); + } + + public void Load(Stream input, ILogger logger) + { + Contract.Requires(input != null); + Contract.Requires(logger != null); + + using var archive = new ZipArchive(input, ZipArchiveMode.Read); + var dataEntry = archive.GetEntry(DataFileName); + if (dataEntry == null) + { + throw new FormatException(); + } + + using var entryStream = dataEntry.Open(); + var document = XDocument.Load(entryStream); + if (document.Root?.Element(XmlClassesElement) == null) + { + throw new FormatException("The data has not the correct format."); + } + + uint.TryParse(document.Root.Attribute(XmlVersionAttribute)?.Value, out var fileVersion); + if ((fileVersion & FileVersionCriticalMask) > (FileVersion & FileVersionCriticalMask)) + { + throw new FormatException($"The file version is unsupported. A newer {Constants.ApplicationName} version is required to read it."); + } + + var platform = document.Root.Attribute(XmlPlatformAttribute)?.Value; + if (platform != Constants.Platform) + { + logger.Log(LogLevel.Warning, $"The platform of the file ({platform}) doesn't match the program platform ({Constants.Platform})."); + } + + var customDataElement = document.Root.Element(XmlCustomDataElement); + if (customDataElement != null) + { + project.CustomData.Deserialize(customDataElement); + } + + var typeMappingElement = document.Root.Element(XmlTypeMappingElement); + if (typeMappingElement != null) + { + project.TypeMapping.Deserialize(typeMappingElement); + } + + var enumsElement = document.Root.Element(XmlEnumsElement); + if (enumsElement != null) + { + foreach (var enumElement in enumsElement.Elements(XmlEnumElement)) + { + var name = enumElement.Attribute(XmlNameAttribute)?.Value ?? string.Empty; + var useFlagsMode = (bool?)enumElement.Attribute(XmlFlagsAttribute) ?? false; + var size = enumElement.Attribute(XmlSizeAttribute).GetEnumValue(); + + var values = new Dictionary(); + foreach (var itemElement in enumElement.Elements(XmlItemElement)) + { + var itemName = itemElement.Attribute(XmlNameAttribute)?.Value ?? string.Empty; + var itemValue = (long?)itemElement.Attribute(XmlValueAttribute) ?? 0L; + + values.Add(itemName, itemValue); + } + + var @enum = new EnumDescription + { + Name = name + }; + @enum.SetData(useFlagsMode, size, values); + + project.AddEnum(@enum); + } + } + + var classes = new List<(XElement, ClassNode)>(); + + var classesElement = document.Root.Element(XmlClassesElement); + if (classesElement != null) + { + foreach (var element in classesElement + .Elements(XmlClassElement) + .DistinctBy(e => e.Attribute(XmlUuidAttribute)?.Value)) + { + var node = new ClassNode(false) + { + Uuid = ParseUuid(element.Attribute(XmlUuidAttribute)?.Value), + Name = element.Attribute(XmlNameAttribute)?.Value ?? string.Empty, + Comment = element.Attribute(XmlCommentAttribute)?.Value ?? string.Empty, + AddressFormula = element.Attribute(XmlAddressAttribute)?.Value ?? string.Empty + }; + + if (!project.ContainsClass(node.Uuid)) + { + project.AddClass(node); + + classes.Add((element, node)); + } + } + } + + foreach (var (element, classNode) in classes) + { + var nodes = element.Elements(XmlNodeElement) + .Select(e => CreateNodeFromElement(e, classNode, logger)) + .Where(n => n != null); + + classNode.BeginUpdate(); + classNode.AddNodes(nodes); + classNode.EndUpdate(); + } + } + + private BaseNode CreateNodeFromElement(XElement element, BaseNode parent, ILogger logger) + { + Contract.Requires(element != null); + Contract.Requires(logger != null); + + BaseNode CreateNode() + { + var converter = CustomNodeSerializer.GetReadConverter(element); + if (converter != null) + { + return converter.CreateNodeFromElement(element, parent, project.Classes, logger, CreateNodeFromElement); + } + + if (!buildInStringToTypeMap.TryGetValue(element.Attribute(XmlTypeAttribute)?.Value ?? string.Empty, out var nodeType)) + { + logger.Log(LogLevel.Error, $"Skipping node with unknown type: {element.Attribute(XmlTypeAttribute)?.Value}"); + logger.Log(LogLevel.Warning, element.ToString()); + + return null; + } + + return BaseNode.CreateInstanceFromType(nodeType, false); + } + + var node = CreateNode(); + if (node == null) + { + logger.Log(LogLevel.Error, "Could not create node."); + + return null; + } + + node.ParentNode = parent; + + node.Name = element.Attribute(XmlNameAttribute)?.Value ?? string.Empty; + node.Comment = element.Attribute(XmlCommentAttribute)?.Value ?? string.Empty; + node.IsHidden = bool.TryParse(element.Attribute(XmlHiddenAttribute)?.Value, out var val) && val; + + if (node is BaseWrapperNode wrapperNode) + { + ClassNode GetClassNodeFromElementReference() + { + var reference = ParseUuid(element.Attribute(XmlReferenceAttribute)?.Value); + if (!project.ContainsClass(reference)) + { + logger.Log(LogLevel.Error, $"Skipping node with unknown reference: {reference}"); + logger.Log(LogLevel.Warning, element.ToString()); + + return null; + } + + return project.GetClassByUuid(reference); + } + + // Legacy Support + if (node is ClassPointerNode || node is ClassInstanceArrayNode || node is ClassPointerArrayNode) + { + var innerClass = GetClassNodeFromElementReference(); + if (innerClass == null) + { + return null; + } + + node = node switch + { + BaseClassArrayNode classArrayNode => classArrayNode.GetEquivalentNode(0, innerClass), + ClassPointerNode classPointerNode => classPointerNode.GetEquivalentNode(innerClass) + }; + } + else + { + BaseNode innerNode = null; + + if (node is BaseClassWrapperNode) + { + innerNode = GetClassNodeFromElementReference(); + if (innerNode == null) + { + return null; + } + } + else + { + var innerElement = element.Elements().FirstOrDefault(); + if (innerElement != null) + { + innerNode = CreateNodeFromElement(innerElement, node, logger); + } + } + + if (wrapperNode.CanChangeInnerNodeTo(innerNode)) + { + var rootWrapperNode = node.GetRootWrapperNode(); + if (rootWrapperNode.ShouldPerformCycleCheckForInnerNode() + && innerNode is ClassNode classNode + && ClassUtil.IsCyclicIfClassIsAccessibleFromParent(node.GetParentClass(), classNode, project.Classes)) + { + logger.Log(LogLevel.Error, $"Skipping node with cyclic class reference: {node.GetParentClass().Name}->{rootWrapperNode.Name}"); + + return null; + } + + wrapperNode.ChangeInnerNode(innerNode); + } + else + { + logger.Log(LogLevel.Error, $"The node {innerNode} is not a valid child for {node}."); + } + } + } + + switch (node) + { + case VirtualMethodTableNode vtableNode: + { + var nodes = element + .Elements(XmlMethodElement) + .Select(e => new VirtualMethodNode + { + Name = e.Attribute(XmlNameAttribute)?.Value ?? string.Empty, + Comment = e.Attribute(XmlCommentAttribute)?.Value ?? string.Empty, + IsHidden = (bool?)e.Attribute(XmlHiddenAttribute) ?? false + }); + + vtableNode.AddNodes(nodes); + break; + } + case UnionNode unionNode: + { + var nodes = element + .Elements() + .Select(e => CreateNodeFromElement(e, unionNode, logger)); + + unionNode.AddNodes(nodes); + break; + } + case BaseWrapperArrayNode arrayNode: + { + arrayNode.Count = (int?)element.Attribute(XmlCountAttribute) ?? 0; + break; + } + case BaseTextNode textNode: + { + textNode.Length = (int?)element.Attribute(XmlLengthAttribute) ?? 0; + break; + } + case BitFieldNode bitFieldNode: + { + bitFieldNode.Bits = (int?)element.Attribute(XmlBitsAttribute) ?? 0; + break; + } + case FunctionNode functionNode: + { + functionNode.Signature = element.Attribute(XmlSignatureAttribute)?.Value ?? string.Empty; + + var reference = ParseUuid(element.Attribute(XmlReferenceAttribute)?.Value); + if (project.ContainsClass(reference)) + { + functionNode.BelongsToClass = project.GetClassByUuid(reference); + } + break; + } + case EnumNode enumNode: + { + var enumName = element.Attribute(XmlReferenceAttribute)?.Value ?? string.Empty; + var @enum = project.Enums.FirstOrDefault(e => e.Name == enumName) ?? EnumDescription.Default; + + enumNode.ChangeEnum(@enum); + break; + } + } + + return node; + } + + private static Guid ParseUuid(string raw) => raw == null + ? throw new ArgumentNullException() + : raw.Length == 24 + ? new Guid(Convert.FromBase64String(raw)) + : Guid.Parse(raw); + + public static Tuple, List> DeserializeNodesFromStream(Stream input, ReClassNetProject templateProject, ILogger logger) + { + Contract.Requires(input != null); + Contract.Requires(logger != null); + Contract.Ensures(Contract.Result, List>>() != null); + + using var project = new ReClassNetProject(); + templateProject?.Classes.ForEach(project.AddClass); + + var file = new ReClassNetFile(project); + file.Load(input, logger); + + var classes = project.Classes + .Where(c => c.Name != SerializationClassName); + if (templateProject != null) + { + classes = classes.Where(c => !templateProject.ContainsClass(c.Uuid)); + } + + var nodes = project.Classes + .Where(c => c.Name == SerializationClassName) + .SelectMany(c => c.Nodes); + + return Tuple.Create(classes.ToList(), nodes.ToList()); + } + } +} diff --git a/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Write.cs b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Write.cs new file mode 100644 index 00000000..1d33ebc5 --- /dev/null +++ b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.Write.cs @@ -0,0 +1,242 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Xml.Linq; +using ReClassNET.Logger; +using ReClassNET.Nodes; +using ReClassNET.Project; + +namespace ReClassNET.DataExchange.ReClass +{ + public partial class ReClassNetFile + { + public void Save(string filePath, ILogger logger) + { + using var fs = new FileStream(filePath, FileMode.Create); + + Save(fs, logger); + } + + public void Save(Stream output, ILogger logger) + { + using var archive = new ZipArchive(output, ZipArchiveMode.Create); + + var dataEntry = archive.CreateEntry(DataFileName); + using var entryStream = dataEntry.Open(); + + var document = new XDocument( + new XComment($"{Constants.ApplicationName} {Constants.ApplicationVersion} by {Constants.Author}"), + new XComment($"Website: {Constants.HomepageUrl}"), + new XElement( + XmlRootElement, + new XAttribute(XmlVersionAttribute, FileVersion), + new XAttribute(XmlPlatformAttribute, Constants.Platform), + project.CustomData.Serialize(XmlCustomDataElement), + project.TypeMapping.Serialize(XmlTypeMappingElement), + new XElement(XmlEnumsElement, CreateEnumElements(project.Enums)), + new XElement(XmlClassesElement, CreateClassElements(project.Classes, logger)) + ) + ); + + document.Save(entryStream); + } + + private static IEnumerable CreateEnumElements(IEnumerable enums) + { + return enums.Select(e => new XElement( + XmlEnumElement, + new XAttribute(XmlNameAttribute, e.Name), + new XAttribute(XmlSizeAttribute, e.Size), + new XAttribute(XmlFlagsAttribute, e.UseFlagsMode), + e.Values.Select(kv => new XElement( + XmlItemElement, + new XAttribute(XmlNameAttribute, kv.Key), + new XAttribute(XmlValueAttribute, kv.Value) + )) + )); + } + + private static IEnumerable CreateClassElements(IEnumerable classes, ILogger logger) + { + Contract.Requires(classes != null); + Contract.Requires(Contract.ForAll(classes, c => c != null)); + Contract.Requires(logger != null); + Contract.Ensures(Contract.Result>() != null); + + return classes.Select(c => new XElement( + XmlClassElement, + new XAttribute(XmlUuidAttribute, c.Uuid), + new XAttribute(XmlNameAttribute, c.Name ?? string.Empty), + new XAttribute(XmlCommentAttribute, c.Comment ?? string.Empty), + new XAttribute(XmlAddressAttribute, c.AddressFormula ?? string.Empty), + c.Nodes.Select(n => CreateElementFromNode(n, logger)).Where(e => e != null) + )); + } + + private static XElement CreateElementFromNode(BaseNode node, ILogger logger) + { + Contract.Requires(node != null); + Contract.Requires(logger != null); + + XElement CreateElement() + { + var converter = CustomNodeSerializer.GetWriteConverter(node); + if (converter != null) + { + return converter.CreateElementFromNode(node, logger, CreateElementFromNode); + } + + if (!buildInTypeToStringMap.TryGetValue(node.GetType(), out var typeString)) + { + logger.Log(LogLevel.Error, $"Skipping node with unknown type: {node.Name}"); + logger.Log(LogLevel.Warning, node.GetType().ToString()); + + return null; + } + + return new XElement( + XmlNodeElement, + new XAttribute(XmlTypeAttribute, typeString) + ); + } + + var element = CreateElement(); + if (element == null) + { + logger.Log(LogLevel.Error, "Could not create element."); + + return null; + } + + element.SetAttributeValue(XmlNameAttribute, node.Name ?? string.Empty); + element.SetAttributeValue(XmlCommentAttribute, node.Comment ?? string.Empty); + element.SetAttributeValue(XmlHiddenAttribute, node.IsHidden); + + if (node is BaseWrapperNode wrapperNode) + { + if (node is BaseClassWrapperNode classWrapperNode) + { + element.SetAttributeValue(XmlReferenceAttribute, ((ClassNode)classWrapperNode.InnerNode).Uuid); + } + else if (wrapperNode.InnerNode != null) + { + element.Add(CreateElementFromNode(wrapperNode.InnerNode, logger)); + } + } + + switch (node) + { + case VirtualMethodTableNode vtableNode: + { + element.Add(vtableNode.Nodes.Select(n => new XElement( + XmlMethodElement, + new XAttribute(XmlNameAttribute, n.Name ?? string.Empty), + new XAttribute(XmlCommentAttribute, n.Comment ?? string.Empty), + new XAttribute(XmlHiddenAttribute, n.IsHidden) + ))); + break; + } + case UnionNode unionNode: + { + element.Add(unionNode.Nodes.Select(n => CreateElementFromNode(n, logger))); + break; + } + case BaseWrapperArrayNode arrayNode: + { + element.SetAttributeValue(XmlCountAttribute, arrayNode.Count); + break; + } + case BaseTextNode textNode: + { + element.SetAttributeValue(XmlLengthAttribute, textNode.Length); + break; + } + case BitFieldNode bitFieldNode: + { + element.SetAttributeValue(XmlBitsAttribute, bitFieldNode.Bits); + break; + } + case FunctionNode functionNode: + { + var uuid = functionNode.BelongsToClass?.Uuid ?? Guid.Empty; + element.SetAttributeValue(XmlReferenceAttribute, uuid); + element.SetAttributeValue(XmlSignatureAttribute, functionNode.Signature); + break; + } + case EnumNode enumNode: + { + element.SetAttributeValue(XmlReferenceAttribute, enumNode.Enum.Name); + break; + } + } + + return element; + } + + public static void SerializeNodesToStream(Stream output, IEnumerable nodes, ILogger logger) + { + Contract.Requires(output != null); + Contract.Requires(nodes != null); + Contract.Requires(Contract.ForAll(nodes, n => n != null)); + Contract.Requires(logger != null); + + using var project = new ReClassNetProject(); + + void RecursiveAddClasses(BaseNode node) + { + ClassNode classNode = null; + switch (node) + { + case ClassNode c1: + classNode = c1; + break; + case BaseWrapperNode wrapperNode when wrapperNode.ResolveMostInnerNode() is ClassNode c2: + classNode = c2; + break; + } + + if (classNode == null || project.ContainsClass(classNode.Uuid)) + { + return; + } + + project.AddClass(classNode); + + foreach (var wrapperNodeChild in classNode.Nodes.OfType()) + { + RecursiveAddClasses(wrapperNodeChild); + } + } + + var serialisationClass = new ClassNode(false) + { + Name = SerializationClassName + }; + + var needsSerialisationClass = true; + + foreach (var node in nodes) + { + RecursiveAddClasses(node); + + if (!(node is ClassNode)) + { + if (needsSerialisationClass) + { + needsSerialisationClass = false; + + project.AddClass(serialisationClass); + } + + serialisationClass.AddNode(node); + } + } + + var file = new ReClassNetFile(project); + file.Save(output, logger); + } + } +} diff --git a/ReClass.NET/DataExchange/ReClass/ReClassNetFile.cs b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.cs new file mode 100644 index 00000000..af258a04 --- /dev/null +++ b/ReClass.NET/DataExchange/ReClass/ReClassNetFile.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using ReClassNET.DataExchange.ReClass.Legacy; +using ReClassNET.Nodes; +using ReClassNET.Project; + +namespace ReClassNET.DataExchange.ReClass +{ + public partial class ReClassNetFile : IReClassImport, IReClassExport + { + private readonly ReClassNetProject project; + + public ReClassNetFile(ReClassNetProject project) + { + Contract.Requires(project != null); + + this.project = project; + } + + static ReClassNetFile() + { + // Obsolete: The name of the class was changed. Because of this older versions can't load these nodes. + buildInStringToTypeMap["UTF8TextNode"] = typeof(Utf8TextNode); + buildInStringToTypeMap["UTF8TextPtrNode"] = typeof(Utf8TextPtrNode); + buildInStringToTypeMap["UTF16TextNode"] = typeof(Utf16TextNode); + buildInStringToTypeMap["UTF16TextPtrNode"] = typeof(Utf16TextPtrNode); + buildInStringToTypeMap["UTF32TextNode"] = typeof(Utf32TextNode); + buildInStringToTypeMap["UTF32TextPtrNode"] = typeof(Utf32TextPtrNode); + buildInStringToTypeMap["VTableNode"] = typeof(VirtualMethodTableNode); + + // Legacy + buildInStringToTypeMap["ClassInstanceArrayNode"] = typeof(ClassInstanceArrayNode); + buildInStringToTypeMap["ClassPtrArrayNode"] = typeof(ClassPointerArrayNode); + buildInStringToTypeMap["ClassPtrNode"] = typeof(ClassPointerNode); + } + + private static readonly Dictionary buildInStringToTypeMap = new[] + { + typeof(BoolNode), + typeof(BitFieldNode), + typeof(EnumNode), + typeof(ClassInstanceNode), + typeof(DoubleNode), + typeof(FloatNode), + typeof(FunctionNode), + typeof(FunctionPtrNode), + typeof(Hex8Node), + typeof(Hex16Node), + typeof(Hex32Node), + typeof(Hex64Node), + typeof(Int8Node), + typeof(Int16Node), + typeof(Int32Node), + typeof(Int64Node), + typeof(NIntNode), + typeof(Matrix3x3Node), + typeof(Matrix3x4Node), + typeof(Matrix4x4Node), + typeof(UInt8Node), + typeof(UInt16Node), + typeof(UInt32Node), + typeof(UInt64Node), + typeof(NUIntNode), + typeof(Utf8TextNode), + typeof(Utf8TextPtrNode), + typeof(Utf16TextNode), + typeof(Utf16TextPtrNode), + typeof(Utf32TextNode), + typeof(Utf32TextPtrNode), + typeof(Vector2Node), + typeof(Vector3Node), + typeof(Vector4Node), + typeof(VirtualMethodTableNode), + typeof(ArrayNode), + typeof(PointerNode), + typeof(UnionNode) + }.ToDictionary(t => t.Name, t => t); + + private static readonly Dictionary buildInTypeToStringMap = buildInStringToTypeMap.ToDictionary(kv => kv.Value, kv => kv.Key); + } +} diff --git a/DataExchange/ReClassQtFile.cs b/ReClass.NET/DataExchange/ReClass/ReClassQtFile.cs similarity index 74% rename from DataExchange/ReClassQtFile.cs rename to ReClass.NET/DataExchange/ReClass/ReClassQtFile.cs index 7fd8d79c..275624c0 100644 --- a/DataExchange/ReClassQtFile.cs +++ b/ReClass.NET/DataExchange/ReClass/ReClassQtFile.cs @@ -3,18 +3,45 @@ using System.Diagnostics.Contracts; using System.Linq; using System.Xml.Linq; +using ReClassNET.DataExchange.ReClass.Legacy; +using ReClassNET.Extensions; using ReClassNET.Logger; using ReClassNET.Nodes; -using ReClassNET.Util; +using ReClassNET.Project; -namespace ReClassNET.DataExchange +namespace ReClassNET.DataExchange.ReClass { - class ReClassQtFile : IReClassImport + public class ReClassQtFile : IReClassImport { public const string FormatName = "ReClassQt File"; public const string FileExtension = ".reclassqt"; - private ReClassNetProject project; + private readonly Type[] typeMap = { + null, + null, + typeof(ClassPointerNode), + typeof(ClassInstanceNode), + typeof(Hex64Node), + typeof(Hex32Node), + typeof(Hex16Node), + typeof(Hex8Node), + typeof(Int64Node), + typeof(Int32Node), + typeof(Int16Node), + typeof(Int8Node), + typeof(UInt32Node), + null, + null, + typeof(UInt32Node), //bool + null, + typeof(FloatNode), + typeof(DoubleNode), + typeof(Vector4Node), + typeof(Vector3Node), + typeof(Vector2Node) + }; + + private readonly ReClassNetProject project; public ReClassQtFile(ReClassNetProject project) { @@ -26,6 +53,10 @@ public ReClassQtFile(ReClassNetProject project) public void Load(string filePath, ILogger logger) { var document = XDocument.Load(filePath); + if (document.Root == null) + { + return; + } var classes = new List>(); @@ -46,21 +77,21 @@ public void Load(string filePath, ILogger logger) } var classMap = classes.ToDictionary(c => c.Item1.Attribute("ClassId")?.Value, c => c.Item2); - foreach (var t in classes) + foreach (var (classElement, classNode) in classes) { ReadNodeElements( - t.Item1.Elements("Node"), - t.Item2, + classElement.Elements("Node"), + classNode, classMap, logger - ).ForEach(t.Item2.AddNode); + ).ForEach(classNode.AddNode); } } /// Parse a ReClassQT address string and transform it into a ReClass.NET formula. /// The class element. /// A string with an address formula. - private string ParseAddressString(XElement element) + private static string ParseAddressString(XElement element) { Contract.Requires(element != null); @@ -78,35 +109,10 @@ private string ParseAddressString(XElement element) return address; } - private readonly Type[] typeMap = new Type[] - { - null, - null, - typeof(ClassPtrNode), - typeof(ClassInstanceNode), - typeof(Hex64Node), - typeof(Hex32Node), - typeof(Hex16Node), - typeof(Hex8Node), - typeof(Int64Node), - typeof(Int32Node), - typeof(Int16Node), - typeof(Int8Node), - typeof(UInt32Node), - null, - null, - typeof(UInt32Node), //bool - null, - typeof(FloatNode), - typeof(DoubleNode), - typeof(Vector4Node), - typeof(Vector3Node), - typeof(Vector2Node) - }; - private IEnumerable ReadNodeElements(IEnumerable elements, ClassNode parent, IReadOnlyDictionary classes, ILogger logger) { Contract.Requires(elements != null); + Contract.Requires(Contract.ForAll(elements, e => e != null)); Contract.Requires(parent != null); Contract.Requires(logger != null); @@ -114,8 +120,7 @@ private IEnumerable ReadNodeElements(IEnumerable elements, C { Type nodeType = null; - int typeVal; - if (int.TryParse(element.Attribute("Type")?.Value, out typeVal)) + if (int.TryParse(element.Attribute("Type")?.Value, out var typeVal)) { if (typeVal >= 0 && typeVal < typeMap.Length) { @@ -131,7 +136,7 @@ private IEnumerable ReadNodeElements(IEnumerable elements, C continue; } - var node = Activator.CreateInstance(nodeType) as BaseNode; + var node = BaseNode.CreateInstanceFromType(nodeType, false); if (node == null) { logger.Log(LogLevel.Error, $"Could not create node of type: {nodeType}"); @@ -142,8 +147,8 @@ private IEnumerable ReadNodeElements(IEnumerable elements, C node.Name = element.Attribute("Name")?.Value ?? string.Empty; node.Comment = element.Attribute("Comments")?.Value ?? string.Empty; - var referenceNode = node as BaseReferenceNode; - if (referenceNode != null) + // ClassInstanceNode, ClassPointerNode + if (node is BaseWrapperNode wrapperNode) { var pointToClassId = element.Attribute("PointToClass")?.Value; if (pointToClassId == null || !classes.ContainsKey(pointToClassId)) @@ -155,14 +160,21 @@ private IEnumerable ReadNodeElements(IEnumerable elements, C } var innerClassNode = classes[pointToClassId]; - if (referenceNode.PerformCycleCheck && !ClassUtil.IsCycleFree(parent, innerClassNode, project.Classes)) + if (wrapperNode.ShouldPerformCycleCheckForInnerNode() && !ClassUtil.IsCyclicIfClassIsAccessibleFromParent(parent, innerClassNode, project.Classes)) { logger.Log(LogLevel.Error, $"Skipping node with cycle reference: {parent.Name}->{node.Name}"); continue; } - referenceNode.ChangeInnerNode(innerClassNode); + if (node is ClassPointerNode classPointerNode) + { + node = classPointerNode.GetEquivalentNode(innerClassNode); + } + else // ClassInstanceNode + { + wrapperNode.ChangeInnerNode(innerClassNode); + } } yield return node; diff --git a/ReClass.NET/DataExchange/Scanner/CheatEngineFile.cs b/ReClass.NET/DataExchange/Scanner/CheatEngineFile.cs new file mode 100644 index 00000000..1c6b95d9 --- /dev/null +++ b/ReClass.NET/DataExchange/Scanner/CheatEngineFile.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Text; +using System.Xml.Linq; +using ReClassNET.Logger; +using ReClassNET.MemoryScanner; + +namespace ReClassNET.DataExchange.Scanner +{ + public class CheatEngineFile : IScannerImport + { + public const string FormatName = "Cheat Engine Tables"; + public const string FileExtension = ".ct"; + + private const string Version26 = "26"; + + public const string XmlVersionElement = "CheatEngineTableVersion"; + public const string XmlEntriesElement = "CheatEntries"; + public const string XmlEntryElement = "CheatEntry"; + public const string XmlDescriptionElement = "Description"; + public const string XmlValueTypeElement = "VariableType"; + public const string XmlAddressElement = "Address"; + public const string XmlUnicodeElement = "Unicode"; + public const string XmlLengthElement = "Length"; + + public IEnumerable Load(string filePath, ILogger logger) + { + using var stream = File.OpenRead(filePath); + + var document = XDocument.Load(stream); + if (document.Root != null) + { + var version = document.Root.Attribute(XmlVersionElement)?.Value; + if (string.Compare(version, Version26, StringComparison.Ordinal) >= 0) + { + var entries = document.Root.Element(XmlEntriesElement); + if (entries != null) + { + foreach (var entry in entries.Elements(XmlEntryElement)) + { + var description = entry.Element(XmlDescriptionElement)?.Value.Trim() ?? string.Empty; + if (description == "\"No description\"") + { + description = string.Empty; + } + var variableTypeStr = entry.Element(XmlValueTypeElement)?.Value.Trim() ?? string.Empty; + var valueType = Parse(variableTypeStr, logger); + + var record = new MemoryRecord + { + Description = description, + ValueType = valueType + }; + + var addressStr = entry.Element(XmlAddressElement)?.Value.Trim() ?? string.Empty; + var addressParts = addressStr.Split('+'); + if (addressParts.Length == 2) + { + long.TryParse(addressParts[1], NumberStyles.HexNumber, null, out var value); + record.AddressOrOffset = (IntPtr)value; + + record.ModuleName = addressParts[0].Trim(); + } + else + { + long.TryParse(addressStr, NumberStyles.HexNumber, null, out var value); + record.AddressOrOffset = (IntPtr)value; + } + + if (valueType == ScanValueType.ArrayOfBytes || valueType == ScanValueType.String) + { + var lengthStr = entry.Element(XmlLengthElement)?.Value ?? string.Empty; + int.TryParse(lengthStr, NumberStyles.Integer, null, out var valueLength); + + record.ValueLength = Math.Max(1, valueLength); + + if (valueType == ScanValueType.String) + { + var isUnicode = (entry.Element(XmlUnicodeElement)?.Value ?? string.Empty) == "1"; + + record.Encoding = isUnicode ? Encoding.Unicode : Encoding.UTF8; + } + } + + yield return record; + } + } + } + } + } + + private static ScanValueType Parse(string value, ILogger logger) + { + switch (value) + { + case "Byte": + return ScanValueType.Byte; + case "2 Bytes": + return ScanValueType.Short; + case "4 Bytes": + return ScanValueType.Integer; + case "8 Bytes": + return ScanValueType.Long; + case "Float": + return ScanValueType.Float; + case "Double": + return ScanValueType.Double; + case "String": + return ScanValueType.String; + case "Array of byte": + return ScanValueType.ArrayOfBytes; + default: + logger?.Log(LogLevel.Warning, $"Unknown value type: {value}"); + + return ScanValueType.Integer; + } + } + } +} diff --git a/ReClass.NET/DataExchange/Scanner/CrySearchFile.cs b/ReClass.NET/DataExchange/Scanner/CrySearchFile.cs new file mode 100644 index 00000000..2aca38c7 --- /dev/null +++ b/ReClass.NET/DataExchange/Scanner/CrySearchFile.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Text; +using System.Xml.Linq; +using ReClassNET.Logger; +using ReClassNET.MemoryScanner; + +namespace ReClassNET.DataExchange.Scanner +{ + public class CrySearchFile : IScannerImport + { + public const string FormatName = "CrySearch Address Tables"; + public const string FileExtension = ".csat"; + + private const string Version3 = "3.0"; + + public const string XmlVersionElement = "CrySearchVersion"; + public const string XmlEntriesElement = "Entries"; + public const string XmlItemElement = "item"; + public const string XmlDescriptionElement = "Description"; + public const string XmlValueTypeElement = "ValueType"; + public const string XmlAddressElement = "Address"; + public const string XmlModuleNameElement = "ModuleName"; + public const string XmlIsRelativeElement = "IsRelative"; + public const string XmlSizeElement = "Size"; + + public const string XmlValueAttribute = "value"; + + public IEnumerable Load(string filePath, ILogger logger) + { + var document = XDocument.Load(filePath); + if (document.Root != null) + { + var version = document.Root.Element(XmlVersionElement)?.Value; + if (string.Compare(version, Version3, StringComparison.Ordinal) >= 0) + { + var entries = document.Root.Element(XmlEntriesElement); + if (entries != null) + { + foreach (var entry in entries.Elements(XmlItemElement)) + { + var description = entry.Element(XmlDescriptionElement)?.Value.Trim() ?? string.Empty; + var valueTypeStr = entry.Element(XmlValueTypeElement)?.Attribute(XmlValueAttribute)?.Value.Trim() ?? string.Empty; + var addressStr = entry.Element(XmlAddressElement)?.Attribute(XmlValueAttribute)?.Value.Trim() ?? string.Empty; + var moduleName = entry.Element(XmlModuleNameElement)?.Value.Trim() ?? string.Empty; + + long.TryParse(addressStr, NumberStyles.Number, null, out var value); + var valueType = Parse(valueTypeStr, logger); + + var record = new MemoryRecord + { + AddressOrOffset = (IntPtr)value, + Description = description, + ValueType = valueType + }; + + if ((entry.Element(XmlIsRelativeElement)?.Attribute(XmlValueAttribute)?.Value.Trim() ?? string.Empty) == "1" && !string.IsNullOrEmpty(moduleName)) + { + record.ModuleName = moduleName; + } + + if (valueType == ScanValueType.ArrayOfBytes || valueType == ScanValueType.String) + { + var lengthStr = (entry.Element(XmlSizeElement)?.Attribute(XmlValueAttribute)?.Value.Trim() ?? string.Empty); + int.TryParse(lengthStr, NumberStyles.Integer, null, out var valueLength); + + record.ValueLength = Math.Max(1, valueLength); + + if (valueType == ScanValueType.String) + { + switch (valueTypeStr) + { + default: + // case "8": + record.Encoding = Encoding.UTF8; + break; + case "9": + record.Encoding = Encoding.Unicode; + break; + } + } + } + + yield return record; + } + } + } + } + } + + private static ScanValueType Parse(string value, ILogger logger) + { + switch (value) + { + case "1": + return ScanValueType.Byte; + case "2": + return ScanValueType.Short; + case "3": + return ScanValueType.Integer; + case "4": + return ScanValueType.Long; + case "5": + return ScanValueType.Float; + case "6": + return ScanValueType.Double; + case "7": + return ScanValueType.ArrayOfBytes; + case "8": + case "9": + return ScanValueType.String; + default: + logger?.Log(LogLevel.Warning, $"Unknown value type: {value}"); + + return ScanValueType.Integer; + } + } + } +} diff --git a/ReClass.NET/DataExchange/Scanner/IScannerExport.cs b/ReClass.NET/DataExchange/Scanner/IScannerExport.cs new file mode 100644 index 00000000..83b58fa2 --- /dev/null +++ b/ReClass.NET/DataExchange/Scanner/IScannerExport.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using ReClassNET.Logger; +using ReClassNET.MemoryScanner; + +namespace ReClassNET.DataExchange.Scanner +{ + [ContractClass(typeof(ScannerExportContract))] + public interface IScannerExport + { + void Save(IEnumerable records, string filePath, ILogger logger); + } + + [ContractClassFor(typeof(IScannerExport))] + internal abstract class ScannerExportContract : IScannerExport + { + public void Save(IEnumerable records, string filePath, ILogger logger) + { + Contract.Requires(records != null); + Contract.Requires(filePath != null); + Contract.Requires(logger != null); + } + } +} diff --git a/ReClass.NET/DataExchange/Scanner/IScannerImport.cs b/ReClass.NET/DataExchange/Scanner/IScannerImport.cs new file mode 100644 index 00000000..d9ee79dd --- /dev/null +++ b/ReClass.NET/DataExchange/Scanner/IScannerImport.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using ReClassNET.Logger; +using ReClassNET.MemoryScanner; + +namespace ReClassNET.DataExchange.Scanner +{ + [ContractClass(typeof(ScannerImportContract))] + public interface IScannerImport + { + IEnumerable Load(string filePath, ILogger logger); + } + + [ContractClassFor(typeof(IScannerImport))] + internal abstract class ScannerImportContract : IScannerImport + { + public IEnumerable Load(string filePath, ILogger logger) + { + Contract.Requires(filePath != null); + Contract.Requires(logger != null); + Contract.Ensures(Contract.Result>() != null); + + throw new NotImplementedException(); + } + } +} diff --git a/ReClass.NET/DataExchange/Scanner/ReClassScanFile.cs b/ReClass.NET/DataExchange/Scanner/ReClassScanFile.cs new file mode 100644 index 00000000..8af86952 --- /dev/null +++ b/ReClass.NET/DataExchange/Scanner/ReClassScanFile.cs @@ -0,0 +1,162 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Text; +using System.Xml.Linq; +using ReClassNET.Extensions; +using ReClassNET.Logger; +using ReClassNET.MemoryScanner; + +namespace ReClassNET.DataExchange.Scanner +{ + public class ReClassScanFile : IScannerImport, IScannerExport + { + public const string FormatName = "ReClass.NET Scanner File"; + public const string FileExtension = ".rcnetscan"; + + private const string Version1 = "1"; + + private const string DataFileName = "Data.xml"; + + public const string XmlRootElement = "records"; + public const string XmlRecordElement = "record"; + + public const string XmlVersionAttribute = "version"; + public const string XmlPlatformAttribute = "platform"; + public const string XmlValueTypeAttribute = "type"; + public const string XmlAddressAttribute = "address"; + public const string XmlModuleAttribute = "module"; + public const string XmlDescriptionAttribute = "description"; + public const string XmlValueLengthAttribute = "length"; + public const string XmlEncodingAttribute = "encoding"; + + public IEnumerable Load(string filePath, ILogger logger) + { + using var fs = new FileStream(filePath, FileMode.Open); + using var archive = new ZipArchive(fs, ZipArchiveMode.Read); + + var dataEntry = archive.GetEntry(DataFileName); + if (dataEntry == null) + { + throw new FormatException(); + } + + using var entryStream = dataEntry.Open(); + var document = XDocument.Load(entryStream); + if (document.Root == null) + { + logger.Log(LogLevel.Error, "File has not the correct format."); + yield break; + } + + //var version = document.Root.Attribute(XmlVersionAttribute)?.Value; + var platform = document.Root.Attribute(XmlPlatformAttribute)?.Value; + if (platform != Constants.Platform) + { + logger.Log(LogLevel.Warning, $"The platform of the file ({platform}) doesn't match the program platform ({Constants.Platform})."); + } + + foreach (var element in document.Root.Elements(XmlRecordElement)) + { + var valueTypeStr = element.Attribute(XmlValueTypeAttribute)?.Value ?? string.Empty; + + if (!Enum.TryParse(valueTypeStr, out var valueType)) + { + logger?.Log(LogLevel.Warning, $"Unknown value type: {valueTypeStr}"); + continue; + } + + var description = element.Attribute(XmlDescriptionAttribute)?.Value ?? string.Empty; + + var addressStr = element.Attribute(XmlAddressAttribute)?.Value ?? string.Empty; + var moduleName = element.Attribute(XmlModuleAttribute)?.Value ?? string.Empty; + + long.TryParse(addressStr, NumberStyles.HexNumber, null, out var address); + + var record = new MemoryRecord + { + Description = description, + AddressOrOffset = (IntPtr)address, + ValueType = valueType + }; + + if (!string.IsNullOrEmpty(moduleName)) + { + record.ModuleName = moduleName; + } + + if (valueType == ScanValueType.ArrayOfBytes || valueType == ScanValueType.String) + { + var lengthStr = element.Attribute(XmlValueLengthAttribute)?.Value ?? string.Empty; + int.TryParse(lengthStr, NumberStyles.Integer, null, out var valueLength); + + record.ValueLength = Math.Max(1, valueLength); + + if (valueType == ScanValueType.String) + { + switch (element.Attribute(XmlEncodingAttribute)?.Value ?? string.Empty) + { + default: + record.Encoding = Encoding.UTF8; + break; + case "UTF16": + record.Encoding = Encoding.Unicode; + break; + case "UTF32": + record.Encoding = Encoding.UTF32; + break; + } + } + } + + yield return record; + } + } + + public void Save(IEnumerable records, string filePath, ILogger logger) + { + using var fs = new FileStream(filePath, FileMode.Create); + using var archive = new ZipArchive(fs, ZipArchiveMode.Create); + + var dataEntry = archive.CreateEntry(DataFileName); + using var entryStream = dataEntry.Open(); + + var document = new XDocument( + new XComment($"{Constants.ApplicationName} Scanner {Constants.ApplicationVersion} by {Constants.Author}"), + new XComment($"Website: {Constants.HomepageUrl}"), + new XElement( + XmlRootElement, + new XAttribute(XmlVersionAttribute, Version1), + new XAttribute(XmlPlatformAttribute, Constants.Platform), + records.Select(r => + { + var temp = new XElement( + XmlRecordElement, + new XAttribute(XmlValueTypeAttribute, r.ValueType.ToString()), + new XAttribute(XmlDescriptionAttribute, r.Description ?? string.Empty), + new XAttribute(XmlAddressAttribute, r.AddressOrOffset.ToString(Constants.AddressHexFormat)) + ); + if (r.IsRelativeAddress) + { + temp.SetAttributeValue(XmlModuleAttribute, r.ModuleName); + } + if (r.ValueType == ScanValueType.ArrayOfBytes || r.ValueType == ScanValueType.String) + { + temp.SetAttributeValue(XmlValueLengthAttribute, r.ValueLength); + if (r.ValueType == ScanValueType.String) + { + temp.SetAttributeValue(XmlEncodingAttribute, r.Encoding.IsSameCodePage(Encoding.UTF8) ? "UTF8" : r.Encoding.IsSameCodePage(Encoding.Unicode) ? "UTF16" : "UTF32"); + } + } + return temp; + }) + ) + ); + + document.Save(entryStream); + } + } +} diff --git a/ReClass.NET/Debugger/BreakpointAlreadySetException.cs b/ReClass.NET/Debugger/BreakpointAlreadySetException.cs new file mode 100644 index 00000000..b552843f --- /dev/null +++ b/ReClass.NET/Debugger/BreakpointAlreadySetException.cs @@ -0,0 +1,18 @@ +using System; +using System.Diagnostics.Contracts; + +namespace ReClassNET.Debugger +{ + public class BreakpointAlreadySetException : Exception + { + public IBreakpoint Breakpoint { get; } + + public BreakpointAlreadySetException(IBreakpoint breakpoint) + : base("This breakpoint is already set.") + { + Contract.Requires(breakpoint != null); + + Breakpoint = breakpoint; + } + } +} diff --git a/ReClass.NET/Debugger/DataExchange.cs b/ReClass.NET/Debugger/DataExchange.cs new file mode 100644 index 00000000..176352ce --- /dev/null +++ b/ReClass.NET/Debugger/DataExchange.cs @@ -0,0 +1,69 @@ +using System; +using System.Runtime.InteropServices; + +namespace ReClassNET.Debugger +{ + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct ExceptionDebugInfo + { + public IntPtr ExceptionCode; + public IntPtr ExceptionFlags; + public IntPtr ExceptionAddress; + + public HardwareBreakpointRegister CausedBy; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct RegisterInfo + { +#if RECLASSNET64 + public IntPtr Rax; + public IntPtr Rbx; + public IntPtr Rcx; + public IntPtr Rdx; + public IntPtr Rdi; + public IntPtr Rsi; + public IntPtr Rsp; + public IntPtr Rbp; + public IntPtr Rip; + + public IntPtr R8; + public IntPtr R9; + public IntPtr R10; + public IntPtr R11; + public IntPtr R12; + public IntPtr R13; + public IntPtr R14; + public IntPtr R15; +#else + public IntPtr Eax; + public IntPtr Ebx; + public IntPtr Ecx; + public IntPtr Edx; + public IntPtr Edi; + public IntPtr Esi; + public IntPtr Esp; + public IntPtr Ebp; + public IntPtr Eip; +#endif + }; + + public RegisterInfo Registers; + } + + public enum DebugContinueStatus + { + Handled, + NotHandled + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct DebugEvent + { + public DebugContinueStatus ContinueStatus; + + public IntPtr ProcessId; + public IntPtr ThreadId; + + public ExceptionDebugInfo ExceptionInfo; + } +} diff --git a/ReClass.NET/Debugger/HardwareBreakpoint.cs b/ReClass.NET/Debugger/HardwareBreakpoint.cs new file mode 100644 index 00000000..c758ef41 --- /dev/null +++ b/ReClass.NET/Debugger/HardwareBreakpoint.cs @@ -0,0 +1,86 @@ +using System; +using System.Diagnostics.Contracts; +using ReClassNET.Memory; + +namespace ReClassNET.Debugger +{ + public enum HardwareBreakpointRegister + { + InvalidRegister, + + Dr0, + Dr1, + Dr2, + Dr3 + } + + public enum HardwareBreakpointTrigger + { + Execute, + Access, + Write, + } + + public enum HardwareBreakpointSize + { + Size1 = 1, + Size2 = 2, + Size4 = 4, + Size8 = 8 + } + + public sealed class HardwareBreakpoint : IBreakpoint + { + public IntPtr Address { get; } + public HardwareBreakpointRegister Register { get; } + public HardwareBreakpointTrigger Trigger { get; } + public HardwareBreakpointSize Size { get; } + + private readonly BreakpointHandler handler; + + public HardwareBreakpoint(IntPtr address, HardwareBreakpointRegister register, HardwareBreakpointTrigger trigger, HardwareBreakpointSize size, BreakpointHandler handler) + { + Contract.Requires(handler != null); + + if (register == HardwareBreakpointRegister.InvalidRegister) + { + throw new InvalidOperationException(); + } + + Address = address; + Register = register; + Trigger = trigger; + Size = size; + + this.handler = handler; + } + + public bool Set(RemoteProcess process) + { + return process.CoreFunctions.SetHardwareBreakpoint(process.UnderlayingProcess.Id, Address, Register, Trigger, Size, true); + } + + public void Remove(RemoteProcess process) + { + process.CoreFunctions.SetHardwareBreakpoint(process.UnderlayingProcess.Id, Address, Register, Trigger, Size, false); + } + + public void Handler(ref DebugEvent evt) + { + handler?.Invoke(this, ref evt); + } + + public override bool Equals(object obj) + { + var hwbp = obj as HardwareBreakpoint; + + // Two hardware breakpoints are equal if they use the same register. + return hwbp?.Register == Register; + } + + public override int GetHashCode() + { + return Register.GetHashCode(); + } + } +} diff --git a/ReClass.NET/Debugger/IBreakpoint.cs b/ReClass.NET/Debugger/IBreakpoint.cs new file mode 100644 index 00000000..09485ad4 --- /dev/null +++ b/ReClass.NET/Debugger/IBreakpoint.cs @@ -0,0 +1,44 @@ +using System; +using System.Diagnostics.Contracts; +using ReClassNET.Memory; + +namespace ReClassNET.Debugger +{ + public delegate void BreakpointHandler(IBreakpoint breakpoint, ref DebugEvent evt); + + [ContractClass(typeof(BreakpointContract))] + public interface IBreakpoint + { + IntPtr Address { get; } + + bool Set(RemoteProcess process); + void Remove(RemoteProcess process); + + void Handler(ref DebugEvent evt); + } + + [ContractClassFor(typeof(IBreakpoint))] + internal abstract class BreakpointContract : IBreakpoint + { + public IntPtr Address => throw new NotImplementedException(); + + public void Handler(ref DebugEvent evt) + { + throw new NotImplementedException(); + } + + public void Remove(RemoteProcess process) + { + Contract.Requires(process != null); + + throw new NotImplementedException(); + } + + public bool Set(RemoteProcess process) + { + Contract.Requires(process != null); + + throw new NotImplementedException(); + } + } +} diff --git a/ReClass.NET/Debugger/NoHardwareBreakpointAvailableException.cs b/ReClass.NET/Debugger/NoHardwareBreakpointAvailableException.cs new file mode 100644 index 00000000..83270a56 --- /dev/null +++ b/ReClass.NET/Debugger/NoHardwareBreakpointAvailableException.cs @@ -0,0 +1,13 @@ +using System; + +namespace ReClassNET.Debugger +{ + public class NoHardwareBreakpointAvailableException : Exception + { + public NoHardwareBreakpointAvailableException() + : base("All available hardware breakpoints are already set.") + { + + } + } +} diff --git a/ReClass.NET/Debugger/RemoteDebugger.Extensions.cs b/ReClass.NET/Debugger/RemoteDebugger.Extensions.cs new file mode 100644 index 00000000..a5d1de7c --- /dev/null +++ b/ReClass.NET/Debugger/RemoteDebugger.Extensions.cs @@ -0,0 +1,22 @@ +using System.Diagnostics.Contracts; +using System.Windows.Forms; + +namespace ReClassNET.Debugger +{ + public static class RemoteDebuggerExtensions + { + public static bool AskUserAndAttachDebugger(this RemoteDebugger debugger) + { + Contract.Requires(debugger != null); + + return debugger.StartDebuggerIfNeeded( + () => MessageBox.Show( + "This will attach the debugger of ReClass.NET to the current process. Continue?", + "Confirmation", + MessageBoxButtons.YesNo, + MessageBoxIcon.Question + ) == DialogResult.Yes + ); + } + } +} diff --git a/ReClass.NET/Debugger/RemoteDebugger.Handler.cs b/ReClass.NET/Debugger/RemoteDebugger.Handler.cs new file mode 100644 index 00000000..60e07402 --- /dev/null +++ b/ReClass.NET/Debugger/RemoteDebugger.Handler.cs @@ -0,0 +1,23 @@ +namespace ReClassNET.Debugger +{ + public partial class RemoteDebugger + { + private void HandleExceptionEvent(ref DebugEvent evt) + { + lock (syncBreakpoint) + { + var causedBy = evt.ExceptionInfo.CausedBy; + + foreach (var bp in breakpoints) + { + if (bp is HardwareBreakpoint hwbp && hwbp.Register == causedBy) + { + hwbp.Handler(ref evt); + + break; + } + } + } + } + } +} diff --git a/ReClass.NET/Debugger/RemoteDebugger.Thread.cs b/ReClass.NET/Debugger/RemoteDebugger.Thread.cs new file mode 100644 index 00000000..3f406b2b --- /dev/null +++ b/ReClass.NET/Debugger/RemoteDebugger.Thread.cs @@ -0,0 +1,117 @@ +using System; +using System.Diagnostics.Contracts; +using System.Threading; + +namespace ReClassNET.Debugger +{ + public partial class RemoteDebugger + { + private readonly object syncThread = new object(); + + private Thread thread; + + private volatile bool running = true; + private volatile bool isAttached; + + public bool IsAttached => isAttached; + + public bool StartDebuggerIfNeeded(Func queryAttach) + { + Contract.Requires(queryAttach != null); + + if (!process.IsValid) + { + return false; + } + + lock (syncThread) + { + if (thread != null && IsAttached) + { + return true; + } + + if (queryAttach()) + { + thread = new Thread(Run) + { + IsBackground = true + }; + thread.Start(); + + return true; + } + } + + return false; + } + + private void Run() + { + try + { + if (!process.CoreFunctions.AttachDebuggerToProcess(process.UnderlayingProcess.Id)) + { + return; + } + + isAttached = true; + + var evt = new DebugEvent(); + + running = true; + while (running) + { + if (process.CoreFunctions.AwaitDebugEvent(ref evt, 100)) + { + evt.ContinueStatus = DebugContinueStatus.Handled; + + HandleExceptionEvent(ref evt); + + process.CoreFunctions.HandleDebugEvent(ref evt); + } + else + { + if (!process.IsValid) + { + Terminate(false); + } + } + } + + process.CoreFunctions.DetachDebuggerFromProcess(process.UnderlayingProcess.Id); + } + finally + { + isAttached = false; + } + } + + public void Terminate() + { + Terminate(true); + } + + private void Terminate(bool join) + { + lock (syncBreakpoint) + { + foreach (var bp in breakpoints) + { + bp.Remove(process); + } + breakpoints.Clear(); + } + + running = false; + + if (join) + { + lock (syncThread) + { + thread?.Join(); + } + } + } + } +} diff --git a/ReClass.NET/Debugger/RemoteDebugger.cs b/ReClass.NET/Debugger/RemoteDebugger.cs new file mode 100644 index 00000000..3224293a --- /dev/null +++ b/ReClass.NET/Debugger/RemoteDebugger.cs @@ -0,0 +1,216 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using ReClassNET.Extensions; +using ReClassNET.Forms; +using ReClassNET.Memory; + +namespace ReClassNET.Debugger +{ + public partial class RemoteDebugger + { + private readonly object syncBreakpoint = new object(); + + private readonly RemoteProcess process; + + private readonly HashSet breakpoints = new HashSet(); + + public RemoteDebugger(RemoteProcess process) + { + Contract.Requires(process != null); + + this.process = process; + } + + public void AddBreakpoint(IBreakpoint breakpoint) + { + Contract.Requires(breakpoint != null); + + lock (syncBreakpoint) + { + if (!breakpoints.Add(breakpoint)) + { + throw new BreakpointAlreadySetException(breakpoint); + } + + breakpoint.Set(process); + } + } + + public void RemoveBreakpoint(IBreakpoint bp) + { + Contract.Requires(bp != null); + + lock (syncBreakpoint) + { + if (breakpoints.Remove(bp)) + { + bp.Remove(process); + } + } + } + + public void FindWhatAccessesAddress(IntPtr address, int size) + { + FindCodeByBreakpoint(address, size, HardwareBreakpointTrigger.Access); + } + + public void FindWhatWritesToAddress(IntPtr address, int size) + { + FindCodeByBreakpoint(address, size, HardwareBreakpointTrigger.Write); + } + + public void FindCodeByBreakpoint(IntPtr address, int size, HardwareBreakpointTrigger trigger) + { + var register = GetUsableDebugRegister(); + if (register == HardwareBreakpointRegister.InvalidRegister) + { + throw new NoHardwareBreakpointAvailableException(); + } + + var breakpointList = SplitBreakpoint(address, size); + + var fcf = new FoundCodeForm(process, breakpointList[0].Address, trigger); + + var localBreakpoints = new List(); + fcf.Stop += (sender, e) => + { + lock (localBreakpoints) + { + foreach (var bp in localBreakpoints) + { + RemoveBreakpoint(bp); + } + + localBreakpoints.Clear(); + } + }; + + void HandleBreakpoint(IBreakpoint bp, ref DebugEvent evt) + { + fcf.AddRecord(evt.ExceptionInfo); + } + + var breakpoint = new HardwareBreakpoint(breakpointList[0].Address, register, trigger, (HardwareBreakpointSize)breakpointList[0].Size, HandleBreakpoint); + try + { + AddBreakpoint(breakpoint); + localBreakpoints.Add(breakpoint); + + fcf.Show(); + } + catch + { + fcf.Dispose(); + + throw; + } + + if (breakpointList.Count > 1) + { + foreach (var split in breakpointList.Skip(1)) + { + register = GetUsableDebugRegister(); + if (register == HardwareBreakpointRegister.InvalidRegister) + { + break; + } + + breakpoint = new HardwareBreakpoint(split.Address, register, trigger, (HardwareBreakpointSize)split.Size, HandleBreakpoint); + AddBreakpoint(breakpoint); + localBreakpoints.Add(breakpoint); + } + } + } + + private List SplitBreakpoint(IntPtr address, int size) + { + var splits = new List(); + + while (size > 0) + { +#if RECLASSNET64 + if (size >= 8) + { + if (address.Mod(8) == 0) + { + splits.Add(new BreakpointSplit { Address = address, Size = 8 }); + + address += 8; + size -= 8; + + continue; + } + } +#endif + if (size >= 4) + { + if (address.Mod(4) == 0) + { + splits.Add(new BreakpointSplit { Address = address, Size = 4 }); + + address += 4; + size -= 4; + + continue; + } + } + if (size >= 2) + { + if (address.Mod(2) == 0) + { + splits.Add(new BreakpointSplit { Address = address, Size = 2 }); + + address += 2; + size -= 2; + + continue; + } + } + + splits.Add(new BreakpointSplit { Address = address, Size = 1 }); + + address += 1; + size -= 1; + } + + return splits; + } + + private HardwareBreakpointRegister GetUsableDebugRegister() + { + var all = new HashSet + { + HardwareBreakpointRegister.Dr0, + HardwareBreakpointRegister.Dr1, + HardwareBreakpointRegister.Dr2, + HardwareBreakpointRegister.Dr3 + }; + + lock (syncBreakpoint) + { + foreach (var bp in breakpoints) + { + if (bp is HardwareBreakpoint hwbp) + { + all.Remove(hwbp.Register); + } + } + } + + if (all.Count > 0) + { + return all.First(); + } + + return HardwareBreakpointRegister.InvalidRegister; + } + } + + internal class BreakpointSplit + { + public IntPtr Address { get; set; } + public int Size { get; set; } + } +} diff --git a/ReClass.NET/Debugger/SoftwareBreakpoint.cs b/ReClass.NET/Debugger/SoftwareBreakpoint.cs new file mode 100644 index 00000000..7fb45fff --- /dev/null +++ b/ReClass.NET/Debugger/SoftwareBreakpoint.cs @@ -0,0 +1,61 @@ +using System; +using ReClassNET.Memory; +using System.Diagnostics.Contracts; + +namespace ReClassNET.Debugger +{ + public sealed class SoftwareBreakpoint : IBreakpoint + { + public IntPtr Address { get; } + + private byte orig; + + private readonly BreakpointHandler handler; + + public SoftwareBreakpoint(IntPtr address, BreakpointHandler handler) + { + Contract.Requires(handler != null); + + Address = address; + + this.handler = handler; + } + + public bool Set(RemoteProcess process) + { + var temp = new byte[1]; + if (!process.ReadRemoteMemoryIntoBuffer(Address, ref temp)) + { + return false; + } + orig = temp[0]; + + return process.WriteRemoteMemory(Address, new byte[] { 0xCC }); + } + + public void Remove(RemoteProcess process) + { + process.WriteRemoteMemory(Address, new[] { orig }); + } + + public void Handler(ref DebugEvent evt) + { + handler?.Invoke(this, ref evt); + } + + public override bool Equals(object obj) + { + if (!(obj is SoftwareBreakpoint bp)) + { + return false; + } + + return Address == bp.Address; + } + + public override int GetHashCode() + { + return Address.GetHashCode(); + } + } +} diff --git a/ReClass.NET/Extensions/BinaryReaderWriterExtensions.cs b/ReClass.NET/Extensions/BinaryReaderWriterExtensions.cs new file mode 100644 index 00000000..fdae07f4 --- /dev/null +++ b/ReClass.NET/Extensions/BinaryReaderWriterExtensions.cs @@ -0,0 +1,31 @@ +using System; +using System.Diagnostics.Contracts; +using System.IO; + +namespace ReClassNET.Extensions +{ + public static class BinaryReaderWriterExtension + { + public static IntPtr ReadIntPtr(this BinaryReader br) + { + Contract.Requires(br != null); + +#if RECLASSNET64 + return (IntPtr)br.ReadInt64(); +#else + return (IntPtr)br.ReadInt32(); +#endif + } + + public static void Write(this BinaryWriter bw, IntPtr value) + { + Contract.Requires(bw != null); + +#if RECLASSNET64 + bw.Write(value.ToInt64()); +#else + bw.Write(value.ToInt32()); +#endif + } + } +} diff --git a/ReClass.NET/Extensions/ByteExtension.cs b/ReClass.NET/Extensions/ByteExtension.cs new file mode 100644 index 00000000..1ed5035d --- /dev/null +++ b/ReClass.NET/Extensions/ByteExtension.cs @@ -0,0 +1,21 @@ +using System; +using System.Diagnostics; +using System.Diagnostics.Contracts; + +namespace ReClassNET.Extensions +{ + public static class ByteExtension + { + /// + /// Sets every element in the array to zero. + /// + /// + [DebuggerStepThrough] + public static void FillWithZero(this byte[] array) + { + Contract.Requires(array != null); + + Array.Clear(array, 0, array.Length); + } + } +} diff --git a/ReClass.NET/Extensions/ColorExtensions.cs b/ReClass.NET/Extensions/ColorExtensions.cs new file mode 100644 index 00000000..c28c0937 --- /dev/null +++ b/ReClass.NET/Extensions/ColorExtensions.cs @@ -0,0 +1,23 @@ +using System.Diagnostics; +using System.Diagnostics.Contracts; +using System.Drawing; + +namespace ReClassNET.Extensions +{ + public static class ExtensionColor + { + [Pure] + [DebuggerStepThrough] + public static int ToRgb(this Color color) + { + return 0xFFFFFF & color.ToArgb(); + } + + [Pure] + [DebuggerStepThrough] + public static Color Invert(this Color color) + { + return Color.FromArgb(color.A, 255 - color.R, 255 - color.G, 255 - color.B); + } + } +} diff --git a/ReClass.NET/Extensions/DataGridViewExtensions.cs b/ReClass.NET/Extensions/DataGridViewExtensions.cs new file mode 100644 index 00000000..848d06c7 --- /dev/null +++ b/ReClass.NET/Extensions/DataGridViewExtensions.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Windows.Forms; + +namespace ReClassNET.Extensions +{ + public static class DataGridViewExtension + { + public static IEnumerable GetVisibleRows(this DataGridView dgv) + { + var visibleRowsCount = dgv.DisplayedRowCount(true); + var firstVisibleRowIndex = dgv.FirstDisplayedCell?.RowIndex ?? 0; + var lastVisibleRowIndex = firstVisibleRowIndex + visibleRowsCount - 1; + for (var i = firstVisibleRowIndex; i <= lastVisibleRowIndex; i++) + { + yield return dgv.Rows[i]; + } + } + } +} diff --git a/ReClass.NET/Extensions/DictionaryExtensions.cs b/ReClass.NET/Extensions/DictionaryExtensions.cs new file mode 100644 index 00000000..94d3bf9a --- /dev/null +++ b/ReClass.NET/Extensions/DictionaryExtensions.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; + +namespace ReClassNET.Extensions +{ + public static class DictionaryExtension + { + public static void RemoveWhere(this IDictionary source, Func, bool> selector) + { + Contract.Requires(source != null); + Contract.Requires(selector != null); + + foreach (var kv in source.Where(selector).ToList()) + { + source.Remove(kv.Key); + } + } + } +} diff --git a/ReClass.NET/Extensions/EncodingExtensions.cs b/ReClass.NET/Extensions/EncodingExtensions.cs new file mode 100644 index 00000000..4a3ed695 --- /dev/null +++ b/ReClass.NET/Extensions/EncodingExtensions.cs @@ -0,0 +1,40 @@ +using System; +using System.Text; + +namespace ReClassNET.Extensions +{ + public static class EncodingExtension + { + /// Gets the (perhaps wrong) byte count per character. Special characters may need more bytes. + /// The encoding. + /// The byte count per character. + public static int GuessByteCountPerChar(this Encoding encoding) + { + if (encoding.IsSameCodePage(Encoding.UTF8) || encoding.CodePage == 1252 /* Windows-1252 */ || encoding.IsSameCodePage(Encoding.ASCII)) + { + return 1; + } + if (encoding.IsSameCodePage(Encoding.Unicode) || encoding.IsSameCodePage(Encoding.BigEndianUnicode)) + { + return 2; + } + if (encoding.IsSameCodePage(Encoding.UTF32)) + { + return 4; + } + + throw new NotImplementedException(); + } + + /// + /// Checks if the code page of both encodings is equal. + /// + /// + /// + /// + public static bool IsSameCodePage(this Encoding encoding, Encoding other) + { + return encoding.CodePage == other.CodePage; + } + } +} diff --git a/ReClass.NET/Extensions/EnumerableExtension.cs b/ReClass.NET/Extensions/EnumerableExtension.cs new file mode 100644 index 00000000..0619c87f --- /dev/null +++ b/ReClass.NET/Extensions/EnumerableExtension.cs @@ -0,0 +1,206 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.Contracts; +using System.Linq; + +namespace ReClassNET.Extensions +{ + public static class EnumerableExtension + { + [DebuggerStepThrough] + public static bool None(this IEnumerable source) + { + Contract.Requires(source != null); + + return !source.Any(); + } + + [DebuggerStepThrough] + public static bool None(this IEnumerable source, Func predicate) + { + Contract.Requires(source != null); + Contract.Requires(predicate != null); + + return !source.Any(predicate); + } + + [DebuggerStepThrough] + public static IEnumerable WhereNot(this IEnumerable source, Func predicate) + { + Contract.Requires(source != null); + Contract.Requires(predicate != null); + + return source.Where(item => predicate(item) == false); + } + + [DebuggerStepThrough] + public static int FindIndex(this IEnumerable source, Func predicate) + { + Contract.Requires(source != null); + Contract.Requires(predicate != null); + Contract.Ensures(Contract.Result() >= -1); + + var index = 0; + foreach (var item in source) + { + if (predicate(item)) + { + return index; + } + ++index; + } + return -1; + } + + [DebuggerStepThrough] + public static void ForEach(this IEnumerable source, Action func) + { + Contract.Requires(source != null); + Contract.Requires(func != null); + + foreach (var item in source) + { + func(item); + } + } + + [DebuggerStepThrough] + public static IEnumerable Traverse(this IEnumerable source, Func> childSelector) + { + Contract.Requires(source != null); + Contract.Requires(childSelector != null); + Contract.Ensures(Contract.Result>() != null); + + var queue = new Queue(source); + while (queue.Count > 0) + { + var next = queue.Dequeue(); + + yield return next; + + foreach (var child in childSelector(next)) + { + queue.Enqueue(child); + } + } + } + + [DebuggerStepThrough] + public static IEnumerable TakeWhileInclusive(this IEnumerable source, Func predicate) + { + Contract.Requires(source != null); + Contract.Requires(predicate != null); + Contract.Ensures(Contract.Result>() != null); + + foreach (var item in source) + { + yield return item; + + if (!predicate(item)) + { + yield break; + } + } + } + + [DebuggerStepThrough] + public static IEnumerable DistinctBy(this IEnumerable source, Func keySelector) + { + Contract.Requires(source != null); + Contract.Requires(keySelector != null); + Contract.Ensures(Contract.Result>() != null); + + var knownKeys = new HashSet(); + foreach (var element in source) + { + if (knownKeys.Add(keySelector(element))) + { + yield return element; + } + } + } + + [DebuggerStepThrough] + public static bool IsEquivalentTo(this IEnumerable source, IEnumerable other) + { + Contract.Requires(source != null); + Contract.Requires(other != null); + + var expected = new List(source); + + if (other.Any(item => !expected.Remove(item))) + { + return false; + } + + return expected.Count == 0; + } + + /// + /// Scans the source and returns the first element where the predicate matches. + /// If the predicate doesn't match the first element of the source is returned. + /// + /// + /// + /// + public static TSource PredicateOrFirst(this IEnumerable source, Func predicate) + { + Contract.Requires(source != null); + Contract.Requires(predicate != null); + + var result = default(TSource); + var first = true; + foreach (var element in source) + { + if (predicate(element)) + { + return element; + } + if (first) + { + result = element; + first = false; + } + } + + if (first) + { + throw new InvalidOperationException("Sequence contains no elements"); + } + + return result; + } + + public static IEnumerable> GroupWhile(this IEnumerable source, Func condition) + { + Contract.Requires(source != null); + Contract.Requires(condition != null); + + using var it = source.GetEnumerator(); + if (it.MoveNext()) + { + var previous = it.Current; + var list = new List { previous }; + + while (it.MoveNext()) + { + var item = it.Current; + + if (condition(previous, item) == false) + { + yield return list; + + list = new List(); + } + + list.Add(item); + + previous = item; + } + + yield return list; + } + } + } +} diff --git a/ReClass.NET/Extensions/FloatingPointExtensions.cs b/ReClass.NET/Extensions/FloatingPointExtensions.cs new file mode 100644 index 00000000..410c56e8 --- /dev/null +++ b/ReClass.NET/Extensions/FloatingPointExtensions.cs @@ -0,0 +1,33 @@ +using System; +using System.Diagnostics; +using System.Diagnostics.Contracts; + +namespace ReClassNET.Extensions +{ + public static class FloatingPointExtension + { + [Pure] + [DebuggerStepThrough] + public static bool IsNearlyEqual(this float val, float other, float epsilon) + { + if (val == other) + { + return true; + } + + return Math.Abs(val - other) <= epsilon; + } + + [Pure] + [DebuggerStepThrough] + public static bool IsNearlyEqual(this double val, double other, double epsilon) + { + if (val == other) + { + return true; + } + + return Math.Abs(val - other) <= epsilon; + } + } +} diff --git a/ReClass.NET/Extensions/GraphicsExtensions.cs b/ReClass.NET/Extensions/GraphicsExtensions.cs new file mode 100644 index 00000000..fb3d973d --- /dev/null +++ b/ReClass.NET/Extensions/GraphicsExtensions.cs @@ -0,0 +1,23 @@ +using System.Drawing; +using System.Windows.Forms; + +namespace ReClassNET.Extensions +{ + public static class GraphicsExtension + { + /// + /// Use GDI to render normal text because GDI+ doesn't work nicely with long texts and the custom width calculation. + /// But GDI is simple, there is no custom rendering (rotation, scale, ...). So the BitFieldNode uses GDI+ for rendering. + /// + /// The graphics context. + /// The text to render. + /// The font to use. + /// The color to use. + /// The x coordinate. + /// The y coordinate. + public static void DrawStringEx(this Graphics g, string text, Font font, Color color, int x, int y) + { + TextRenderer.DrawText(g, text, font, new Point(x, y), color); + } + } +} diff --git a/ReClass.NET/Extensions/IRemoteMemoryReaderExtension.cs b/ReClass.NET/Extensions/IRemoteMemoryReaderExtension.cs new file mode 100644 index 00000000..b8f36bab --- /dev/null +++ b/ReClass.NET/Extensions/IRemoteMemoryReaderExtension.cs @@ -0,0 +1,146 @@ +using System; +using System.Diagnostics.Contracts; +using System.Text; +using ReClassNET.Memory; +using ReClassNET.MemoryScanner; + +namespace ReClassNET.Extensions +{ + public static class IRemoteMemoryReaderExtension + { + public static sbyte ReadRemoteInt8(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(sbyte)); + + return (sbyte)data[0]; + } + + public static byte ReadRemoteUInt8(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(byte)); + + return data[0]; + } + + public static short ReadRemoteInt16(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(short)); + + return reader.BitConverter.ToInt16(data, 0); + } + + public static ushort ReadRemoteUInt16(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(ushort)); + + return reader.BitConverter.ToUInt16(data, 0); + } + + public static int ReadRemoteInt32(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(int)); + + return reader.BitConverter.ToInt32(data, 0); + } + + public static uint ReadRemoteUInt32(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(uint)); + + return reader.BitConverter.ToUInt32(data, 0); + } + + public static long ReadRemoteInt64(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(long)); + + return reader.BitConverter.ToInt64(data, 0); + } + + public static ulong ReadRemoteUInt64(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(ulong)); + + return reader.BitConverter.ToUInt64(data, 0); + } + + public static float ReadRemoteFloat(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(float)); + + return reader.BitConverter.ToSingle(data, 0); + } + + public static double ReadRemoteDouble(this IRemoteMemoryReader reader, IntPtr address) + { + var data = reader.ReadRemoteMemory(address, sizeof(double)); + + return reader.BitConverter.ToDouble(data, 0); + } + + public static IntPtr ReadRemoteIntPtr(this IRemoteMemoryReader reader, IntPtr address) + { +#if RECLASSNET64 + return (IntPtr)reader.ReadRemoteInt64(address); +#else + return (IntPtr)reader.ReadRemoteInt32(address); +#endif + } + + public static string ReadRemoteString(this IRemoteMemoryReader reader, IntPtr address, Encoding encoding, int length) + { + Contract.Requires(encoding != null); + Contract.Requires(length >= 0); + Contract.Ensures(Contract.Result() != null); + + var data = reader.ReadRemoteMemory(address, length * encoding.GuessByteCountPerChar()); + + try + { + var sb = new StringBuilder(encoding.GetString(data)); + for (var i = 0; i < sb.Length; ++i) + { + if (sb[i] == '\0') + { + sb.Length = i; + break; + } + if (!sb[i].IsPrintable()) + { + sb[i] = '.'; + } + } + return sb.ToString(); + } + catch + { + return string.Empty; + } + } + + public static string ReadRemoteStringUntilFirstNullCharacter(this IRemoteMemoryReader reader, IntPtr address, Encoding encoding, int length) + { + Contract.Requires(encoding != null); + Contract.Requires(length >= 0); + Contract.Ensures(Contract.Result() != null); + + var data = reader.ReadRemoteMemory(address, length * encoding.GuessByteCountPerChar()); + + // TODO We should cache the pattern per encoding. + var index = PatternScanner.FindPattern(BytePattern.From(new byte[encoding.GuessByteCountPerChar()]), data); + if (index == -1) + { + index = data.Length; + } + + try + { + return encoding.GetString(data, 0, Math.Min(index, data.Length)); + } + catch + { + return string.Empty; + } + } + } +} diff --git a/ReClass.NET/Extensions/IRemoteMemoryWriterExtension.cs b/ReClass.NET/Extensions/IRemoteMemoryWriterExtension.cs new file mode 100644 index 00000000..d39dace9 --- /dev/null +++ b/ReClass.NET/Extensions/IRemoteMemoryWriterExtension.cs @@ -0,0 +1,40 @@ +using System; +using System.Text; +using ReClassNET.Memory; + +namespace ReClassNET.Extensions +{ + public static class IRemoteMemoryWriterExtension + { + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, sbyte value) => writer.WriteRemoteMemory(address, new[] { (byte)value }); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, byte value) => writer.WriteRemoteMemory(address, new[] { value }); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, short value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, ushort value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, int value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, uint value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, long value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, ulong value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, float value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, double value) => writer.WriteRemoteMemory(address, writer.BitConverter.GetBytes(value)); + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, IntPtr value) + { +#if RECLASSNET64 + writer.WriteRemoteMemory(address, value.ToInt64()); +#else + writer.WriteRemoteMemory(address, value.ToInt32()); +#endif + } + + public static void WriteRemoteMemory(this IRemoteMemoryWriter writer, IntPtr address, string value, Encoding encoding) => writer.WriteRemoteMemory(address, encoding.GetBytes(value)); + } +} diff --git a/ReClass.NET/Extensions/IntPtrExtensions.cs b/ReClass.NET/Extensions/IntPtrExtensions.cs new file mode 100644 index 00000000..7f2ff58a --- /dev/null +++ b/ReClass.NET/Extensions/IntPtrExtensions.cs @@ -0,0 +1,177 @@ +using System; +using System.Diagnostics; +using System.Diagnostics.Contracts; + +namespace ReClassNET.Extensions +{ + public static class IntPtrExtension + { + [Pure] + [DebuggerStepThrough] + public static bool IsNull(this IntPtr ptr) + { + return ptr == IntPtr.Zero; + } + + [Pure] + [DebuggerStepThrough] + public static bool MayBeValid(this IntPtr ptr) + { +#if RECLASSNET64 + return ptr.IsInRange((IntPtr)0x10000, (IntPtr)long.MaxValue); +#else + return ptr.IsInRange((IntPtr)0x10000, (IntPtr)int.MaxValue); +#endif + } + + [Pure] + [DebuggerStepThrough] + public static IntPtr Add(this IntPtr lhs, IntPtr rhs) + { +#if RECLASSNET64 + return new IntPtr(lhs.ToInt64() + rhs.ToInt64()); +#else + return new IntPtr(lhs.ToInt32() + rhs.ToInt32()); +#endif + } + + [Pure] + [DebuggerStepThrough] + public static IntPtr Sub(this IntPtr lhs, IntPtr rhs) + { +#if RECLASSNET64 + return new IntPtr(lhs.ToInt64() - rhs.ToInt64()); +#else + return new IntPtr(lhs.ToInt32() - rhs.ToInt32()); +#endif + } + + [Pure] + [DebuggerStepThrough] + public static IntPtr Mul(this IntPtr lhs, IntPtr rhs) + { +#if RECLASSNET64 + return new IntPtr(lhs.ToInt64() * rhs.ToInt64()); +#else + return new IntPtr(lhs.ToInt32() * rhs.ToInt32()); +#endif + } + + [Pure] + [DebuggerStepThrough] + public static IntPtr Div(this IntPtr lhs, IntPtr rhs) + { + Contract.Requires(!rhs.IsNull()); + +#if RECLASSNET64 + return new IntPtr(lhs.ToInt64() / rhs.ToInt64()); +#else + return new IntPtr(lhs.ToInt32() / rhs.ToInt32()); +#endif + } + + [Pure] + [DebuggerStepThrough] + public static int Mod(this IntPtr lhs, int mod) + { +#if RECLASSNET64 + return (int)(lhs.ToInt64() % mod); +#else + return lhs.ToInt32() % mod; +#endif + } + + [Pure] + [DebuggerStepThrough] + public static IntPtr Negate(this IntPtr ptr) + { +#if RECLASSNET64 + return new IntPtr(-ptr.ToInt64()); +#else + return new IntPtr(-ptr.ToInt32()); +#endif + } + + [Pure] + [DebuggerStepThrough] + public static bool IsInRange(this IntPtr address, IntPtr start, IntPtr end) + { +#if RECLASSNET64 + var val = (ulong)address.ToInt64(); + return (ulong)start.ToInt64() <= val && val <= (ulong)end.ToInt64(); +#else + var val = (uint)address.ToInt32(); + return (uint)start.ToInt32() <= val && val <= (uint)end.ToInt32(); +#endif + } + + [Pure] + [DebuggerStepThrough] + public static int CompareTo(this IntPtr lhs, IntPtr rhs) + { +#if RECLASSNET64 + return ((ulong)lhs.ToInt64()).CompareTo((ulong)rhs.ToInt64()); +#else + return ((uint)lhs.ToInt32()).CompareTo((uint)rhs.ToInt32()); +#endif + } + + [Pure] + [DebuggerStepThrough] + public static int CompareToRange(this IntPtr address, IntPtr start, IntPtr end) + { + if (IsInRange(address, start, end)) + { + return 0; + } + return CompareTo(address, start); + } + + /// + /// Changes the behaviour of ToInt64 in x86 mode. + /// IntPtr(int.MaxValue + 1) = (int)0x80000000 (-2147483648) = (long)0xFFFFFFFF80000000 + /// This method converts the value to (long)0x0000000080000000 (2147483648). + /// + /// + /// + [Pure] + [DebuggerStepThrough] + public static long ToInt64Bits(this IntPtr ptr) + { +#if RECLASSNET64 + return ptr.ToInt64(); +#else + var value = ptr.ToInt64(); + + if (value < 0) + { + var intValue = ptr.ToInt32(); + if (value == intValue) + { + value = intValue & 0xFFFFFFFFL; + } + } + + return value; +#endif + } + + [Pure] + [DebuggerStepThrough] + public static IntPtr From(int value) + { + return (IntPtr)value; + } + + [Pure] + [DebuggerStepThrough] + public static IntPtr From(long value) + { +#if RECLASSNET64 + return (IntPtr)value; +#else + return (IntPtr)unchecked((int)value); +#endif + } + } +} diff --git a/ReClass.NET/Extensions/ListExtension.cs b/ReClass.NET/Extensions/ListExtension.cs new file mode 100644 index 00000000..cad4b572 --- /dev/null +++ b/ReClass.NET/Extensions/ListExtension.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.Contracts; + +namespace ReClassNET.Extensions +{ + public static class ListExtension + { + /// + /// Searches a range of elements in the sorted list for an element using the specified comparer and returns the zero-based index of the element. + /// + /// + /// + /// The comparer to use + /// The zero-based index in the sorted list, if an item is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger or, if there is no larger element, the bitwise complement of . + [Pure] + [DebuggerStepThrough] + public static int BinarySearch(this IList source, Func comparer) + { + Contract.Requires(source != null); + Contract.Requires(comparer != null); + + var lo = 0; + var hi = source.Count - 1; + + while (lo <= hi) + { + var i = lo + (hi - lo >> 1); + + var order = comparer(source[i]); + if (order == 0) + { + return i; + } + if (order > 0) + { + lo = i + 1; + } + else + { + hi = i - 1; + } + } + + return ~lo; + } + } +} diff --git a/ReClass.NET/Extensions/PointExtension.cs b/ReClass.NET/Extensions/PointExtension.cs new file mode 100644 index 00000000..a43fa48f --- /dev/null +++ b/ReClass.NET/Extensions/PointExtension.cs @@ -0,0 +1,23 @@ +using System.Diagnostics; +using System.Diagnostics.Contracts; +using System.Drawing; + +namespace ReClassNET.Extensions +{ + public static class PointExtension + { + /// + /// Creates a new point which is relocated with the given offsets. + /// + /// + /// The offset in x direction. + /// The offset in y direction. + /// The relocated point. + [Pure] + [DebuggerStepThrough] + public static Point Relocate(this Point point, int offsetX, int offsetY) + { + return new Point(point.X + offsetX, point.Y + offsetY); + } + } +} diff --git a/ReClass.NET/Extensions/RichTextBoxExtensions.cs b/ReClass.NET/Extensions/RichTextBoxExtensions.cs new file mode 100644 index 00000000..4c1b49a3 --- /dev/null +++ b/ReClass.NET/Extensions/RichTextBoxExtensions.cs @@ -0,0 +1,62 @@ +using System; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Windows.Forms; + +namespace ReClassNET.Extensions +{ + public static class RichTextBoxExtension + { + public static void SetInnerMargin(this TextBoxBase textBox, int left, int top, int right, int bottom) + { + var rect = textBox.GetFormattingRect(); + + var newRect = new Rectangle(left, top, rect.Width - left - right, rect.Height - top - bottom); + textBox.SetFormattingRect(newRect); + } + + [StructLayout(LayoutKind.Sequential)] + private readonly struct RECT + { + public readonly int Left; + public readonly int Top; + public readonly int Right; + public readonly int Bottom; + + private RECT(int left, int top, int right, int bottom) + { + Left = left; + Top = top; + Right = right; + Bottom = bottom; + } + + public RECT(Rectangle r) + : this(r.Left, r.Top, r.Right, r.Bottom) + { + } + } + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + private static extern int SendMessage(IntPtr hWnd, uint msg, int wParam, ref RECT rect); + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + private static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, ref Rectangle lParam); + + private const int EmGetrect = 0xB2; + private const int EmSetrect = 0xB3; + + private static void SetFormattingRect(this TextBoxBase textbox, Rectangle rect) + { + var rc = new RECT(rect); + SendMessage(textbox.Handle, EmSetrect, 0, ref rc); + } + + private static Rectangle GetFormattingRect(this TextBoxBase textbox) + { + var rect = new Rectangle(); + SendMessage(textbox.Handle, EmGetrect, (IntPtr)0, ref rect); + return rect; + } + } +} diff --git a/ReClass.NET/Extensions/StringBuilderExtensions.cs b/ReClass.NET/Extensions/StringBuilderExtensions.cs new file mode 100644 index 00000000..1bf1d25b --- /dev/null +++ b/ReClass.NET/Extensions/StringBuilderExtensions.cs @@ -0,0 +1,17 @@ +using System.Text; + +namespace ReClassNET.Extensions +{ + public static class StringBuilderExtensions + { + public static StringBuilder Prepend(this StringBuilder sb, char value) + { + return sb.Insert(0, value); + } + + public static StringBuilder Prepend(this StringBuilder sb, string value) + { + return sb.Insert(0, value); + } + } +} diff --git a/ReClass.NET/Extensions/StringExtensions.cs b/ReClass.NET/Extensions/StringExtensions.cs new file mode 100644 index 00000000..51ae20d2 --- /dev/null +++ b/ReClass.NET/Extensions/StringExtensions.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Text.RegularExpressions; + +namespace ReClassNET.Extensions +{ + public static class StringExtension + { + [Pure] + [DebuggerStepThrough] + public static bool IsPrintable(this char c) + { + return (' ' <= c && c <= '~' || '\xA1' <= c && c <= '\xFF') && c != '\xFFFD' /* Unicode REPLACEMENT CHARACTER � */; + } + + [DebuggerStepThrough] + public static IEnumerable InterpretAsSingleByteCharacter(this IEnumerable source) + { + Contract.Requires(source != null); + + return source.Select(b => (char)b); + } + + [DebuggerStepThrough] + public static IEnumerable InterpretAsDoubleByteCharacter(this IEnumerable source) + { + Contract.Requires(source != null); + + var bytes = source.ToArray(); + var chars = new char[bytes.Length / 2]; + Buffer.BlockCopy(bytes, 0, chars, 0, bytes.Length); + return chars; + } + + [DebuggerStepThrough] + public static bool IsPrintableData(this IEnumerable source) + { + Contract.Requires(source != null); + + return CalculatePrintableDataThreshold(source) >= 1.0f; + } + + [DebuggerStepThrough] + public static bool IsLikelyPrintableData(this IEnumerable source) + { + Contract.Requires(source != null); + + return CalculatePrintableDataThreshold(source) >= 0.75f; + } + + [DebuggerStepThrough] + public static float CalculatePrintableDataThreshold(this IEnumerable source) + { + var doCountValid = true; + var countValid = 0; + var countAll = 0; + + foreach (var c in source) + { + countAll++; + + if (doCountValid) + { + if (c.IsPrintable()) + { + countValid++; + } + else + { + doCountValid = false; + } + } + } + + if (countAll == 0) + { + return 0.0f; + } + + return countValid / (float)countAll; + } + + [Pure] + [DebuggerStepThrough] + public static string LimitLength(this string s, int length) + { + Contract.Requires(s != null); + Contract.Ensures(Contract.Result() != null); + + if (s.Length <= length) + { + return s; + } + return s.Substring(0, length); + } + + private static readonly Regex hexadecimalValueRegex = new Regex("^(0x|h)?([0-9A-F]+)$", RegexOptions.Compiled | RegexOptions.IgnoreCase); + public static bool TryGetHexString(this string s, out string value) + { + Contract.Requires(s != null); + + var match = hexadecimalValueRegex.Match(s); + value = match.Success ? match.Groups[2].Value : null; + + return match.Success; + } + } +} diff --git a/ReClass.NET/Extensions/StringReaderExtensions.cs b/ReClass.NET/Extensions/StringReaderExtensions.cs new file mode 100644 index 00000000..516f8eb6 --- /dev/null +++ b/ReClass.NET/Extensions/StringReaderExtensions.cs @@ -0,0 +1,24 @@ +using System.IO; + +namespace ReClassNET.Extensions +{ + public static class StringReaderExtension + { + public static int ReadSkipWhitespaces(this StringReader sr) + { + while (true) + { + var i = sr.Read(); + if (i == -1) + { + return i; + } + + if (!char.IsWhiteSpace((char)i)) + { + return i; + } + } + } + } +} diff --git a/ReClass.NET/Extensions/XAttributeExtensions.cs b/ReClass.NET/Extensions/XAttributeExtensions.cs new file mode 100644 index 00000000..d559e50d --- /dev/null +++ b/ReClass.NET/Extensions/XAttributeExtensions.cs @@ -0,0 +1,18 @@ +using System; +using System.Xml.Linq; + +namespace ReClassNET.Extensions +{ + public static class XAttributeExtensions + { + public static TEnum GetEnumValue(this XAttribute attribute) where TEnum : struct + { + TEnum @enum = default; + if (attribute != null) + { + Enum.TryParse(attribute.Value, out @enum); + } + return @enum; + } + } +} diff --git a/Forms/AboutForm.Designer.cs b/ReClass.NET/Forms/AboutForm.Designer.cs similarity index 96% rename from Forms/AboutForm.Designer.cs rename to ReClass.NET/Forms/AboutForm.Designer.cs index 739bf454..97793e12 100644 --- a/Forms/AboutForm.Designer.cs +++ b/ReClass.NET/Forms/AboutForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class AboutForm { @@ -29,7 +31,7 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutForm)); - this.bannerBox = new ReClassNET.UI.BannerBox(); + this.bannerBox = new BannerBox(); this.infoLabel = new System.Windows.Forms.Label(); this.platformLabel = new System.Windows.Forms.Label(); this.buildTimeLabel = new System.Windows.Forms.Label(); @@ -175,6 +177,9 @@ private void InitializeComponent() this.Controls.Add(this.platformLabel); this.Controls.Add(this.infoLabel); this.Controls.Add(this.bannerBox); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; this.Name = "AboutForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "ReClass.NET - Info"; @@ -188,7 +193,7 @@ private void InitializeComponent() #endregion - private UI.BannerBox bannerBox; + private BannerBox bannerBox; private System.Windows.Forms.Label infoLabel; private System.Windows.Forms.Label platformLabel; private System.Windows.Forms.Label buildTimeLabel; diff --git a/Forms/AboutForm.cs b/ReClass.NET/Forms/AboutForm.cs similarity index 100% rename from Forms/AboutForm.cs rename to ReClass.NET/Forms/AboutForm.cs diff --git a/Forms/AboutForm.resx b/ReClass.NET/Forms/AboutForm.resx similarity index 100% rename from Forms/AboutForm.resx rename to ReClass.NET/Forms/AboutForm.resx diff --git a/ReClass.NET/Forms/ClassSelectionForm.Designer.cs b/ReClass.NET/Forms/ClassSelectionForm.Designer.cs new file mode 100644 index 00000000..cc441d54 --- /dev/null +++ b/ReClass.NET/Forms/ClassSelectionForm.Designer.cs @@ -0,0 +1,129 @@ +using ReClassNET.Controls; + +namespace ReClassNET.Forms +{ + partial class ClassSelectionForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.bannerBox = new BannerBox(); + this.classesListBox = new System.Windows.Forms.ListBox(); + this.filterNameTextBox = new PlaceholderTextBox(); + this.cancelButton = new System.Windows.Forms.Button(); + this.selectButton = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); + this.SuspendLayout(); + // + // bannerBox + // + this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; + this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B16x16_Class_Type; + this.bannerBox.Location = new System.Drawing.Point(0, 0); + this.bannerBox.Name = "bannerBox"; + this.bannerBox.Size = new System.Drawing.Size(516, 48); + this.bannerBox.TabIndex = 9; + this.bannerBox.Text = "Select a class of the project."; + this.bannerBox.Title = "Class Selection"; + // + // classesListBox + // + this.classesListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.classesListBox.DisplayMember = "Name"; + this.classesListBox.FormattingEnabled = true; + this.classesListBox.Location = new System.Drawing.Point(12, 80); + this.classesListBox.Name = "classesListBox"; + this.classesListBox.Size = new System.Drawing.Size(492, 186); + this.classesListBox.TabIndex = 2; + this.classesListBox.SelectedIndexChanged += new System.EventHandler(this.classesListBox_SelectedIndexChanged); + this.classesListBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.classesListBox_MouseDoubleClick); + // + // filterNameTextBox + // + this.filterNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.filterNameTextBox.Location = new System.Drawing.Point(12, 54); + this.filterNameTextBox.Name = "filterNameTextBox"; + this.filterNameTextBox.PlaceholderText = "Filter by Class Name..."; + this.filterNameTextBox.Size = new System.Drawing.Size(492, 20); + this.filterNameTextBox.TabIndex = 1; + this.filterNameTextBox.TextChanged += new System.EventHandler(this.filterNameTextBox_TextChanged); + // + // cancelButton + // + this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelButton.Location = new System.Drawing.Point(430, 272); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 23); + this.cancelButton.TabIndex = 4; + this.cancelButton.Text = "Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + // + // selectButton + // + this.selectButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.selectButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.selectButton.Enabled = false; + this.selectButton.Location = new System.Drawing.Point(328, 272); + this.selectButton.Name = "selectButton"; + this.selectButton.Size = new System.Drawing.Size(95, 23); + this.selectButton.TabIndex = 3; + this.selectButton.Text = "Select Class"; + this.selectButton.UseVisualStyleBackColor = true; + // + // ClassSelectionForm + // + this.AcceptButton = this.selectButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.cancelButton; + this.ClientSize = new System.Drawing.Size(516, 306); + this.Controls.Add(this.selectButton); + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.filterNameTextBox); + this.Controls.Add(this.classesListBox); + this.Controls.Add(this.bannerBox); + this.Name = "ClassSelectionForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "ReClass.NET - Class Selection"; + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private BannerBox bannerBox; + private System.Windows.Forms.ListBox classesListBox; + private PlaceholderTextBox filterNameTextBox; + private System.Windows.Forms.Button cancelButton; + private System.Windows.Forms.Button selectButton; + } +} \ No newline at end of file diff --git a/ReClass.NET/Forms/ClassSelectionForm.cs b/ReClass.NET/Forms/ClassSelectionForm.cs new file mode 100644 index 00000000..e8ed984d --- /dev/null +++ b/ReClass.NET/Forms/ClassSelectionForm.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Windows.Forms; +using ReClassNET.Nodes; +using ReClassNET.UI; + +namespace ReClassNET.Forms +{ + public partial class ClassSelectionForm : IconForm + { + private readonly List allClasses; + + public ClassNode SelectedClass => classesListBox.SelectedItem as ClassNode; + + public ClassSelectionForm(IEnumerable classes) + { + Contract.Requires(classes != null); + + allClasses = classes.ToList(); + + InitializeComponent(); + + ShowFilteredClasses(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + + private void filterNameTextBox_TextChanged(object sender, EventArgs e) + { + ShowFilteredClasses(); + } + + private void classesListBox_SelectedIndexChanged(object sender, EventArgs e) + { + selectButton.Enabled = SelectedClass != null; + } + + private void classesListBox_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (SelectedClass != null) + { + selectButton.PerformClick(); + } + } + + private void ShowFilteredClasses() + { + IEnumerable classes = allClasses; + + if (!string.IsNullOrEmpty(filterNameTextBox.Text)) + { + classes = classes.Where(c => c.Name.IndexOf(filterNameTextBox.Text, StringComparison.OrdinalIgnoreCase) >= 0); + } + + classesListBox.DataSource = classes.ToList(); + } + } +} diff --git a/Forms/SettingsForm.resx b/ReClass.NET/Forms/ClassSelectionForm.resx similarity index 100% rename from Forms/SettingsForm.resx rename to ReClass.NET/Forms/ClassSelectionForm.resx diff --git a/Forms/CodeForm.Designer.cs b/ReClass.NET/Forms/CodeForm.Designer.cs similarity index 68% rename from Forms/CodeForm.Designer.cs rename to ReClass.NET/Forms/CodeForm.Designer.cs index d5adb709..4c419b03 100644 --- a/Forms/CodeForm.Designer.cs +++ b/ReClass.NET/Forms/CodeForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET.Forms +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class CodeForm { @@ -28,24 +30,11 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.codeWebBrowser = new System.Windows.Forms.WebBrowser(); - this.bannerBox = new ReClassNET.UI.BannerBox(); + this.bannerBox = new BannerBox(); + this.codeRichTextBox = new System.Windows.Forms.RichTextBox(); ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); this.SuspendLayout(); // - // codeWebBrowser - // - this.codeWebBrowser.AllowNavigation = false; - this.codeWebBrowser.AllowWebBrowserDrop = false; - this.codeWebBrowser.Dock = System.Windows.Forms.DockStyle.Fill; - this.codeWebBrowser.IsWebBrowserContextMenuEnabled = false; - this.codeWebBrowser.Location = new System.Drawing.Point(0, 48); - this.codeWebBrowser.MinimumSize = new System.Drawing.Size(20, 20); - this.codeWebBrowser.Name = "codeWebBrowser"; - this.codeWebBrowser.ScriptErrorsSuppressed = true; - this.codeWebBrowser.Size = new System.Drawing.Size(629, 390); - this.codeWebBrowser.TabIndex = 1; - // // bannerBox // this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; @@ -57,12 +46,22 @@ private void InitializeComponent() this.bannerBox.Text = "The classes transformed into source code."; this.bannerBox.Title = "Code Generator"; // + // codeRichTextBox + // + this.codeRichTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.codeRichTextBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.codeRichTextBox.Location = new System.Drawing.Point(0, 48); + this.codeRichTextBox.Name = "codeRichTextBox"; + this.codeRichTextBox.Size = new System.Drawing.Size(629, 390); + this.codeRichTextBox.TabIndex = 3; + this.codeRichTextBox.Text = ""; + // // CodeForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(629, 438); - this.Controls.Add(this.codeWebBrowser); + this.Controls.Add(this.codeRichTextBox); this.Controls.Add(this.bannerBox); this.MinimumSize = new System.Drawing.Size(350, 185); this.Name = "CodeForm"; @@ -74,7 +73,7 @@ private void InitializeComponent() } #endregion - private System.Windows.Forms.WebBrowser codeWebBrowser; - private UI.BannerBox bannerBox; + private BannerBox bannerBox; + private System.Windows.Forms.RichTextBox codeRichTextBox; } } \ No newline at end of file diff --git a/ReClass.NET/Forms/CodeForm.cs b/ReClass.NET/Forms/CodeForm.cs new file mode 100644 index 00000000..f84d3f0e --- /dev/null +++ b/ReClass.NET/Forms/CodeForm.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.IO; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using ColorCode; +using ColorCode.Parsing; +using ReClassNET.CodeGenerator; +using ReClassNET.Extensions; +using ReClassNET.Logger; +using ReClassNET.Nodes; +using ReClassNET.Project; +using ReClassNET.UI; +using ReClassNET.Util.Rtf; + +namespace ReClassNET.Forms +{ + public partial class CodeForm : IconForm + { + public CodeForm(ICodeGenerator generator, IReadOnlyList classes, IReadOnlyList enums, ILogger logger) + { + Contract.Requires(generator != null); + Contract.Requires(classes != null); + Contract.Requires(enums != null); + + InitializeComponent(); + + codeRichTextBox.SetInnerMargin(5, 5, 5, 5); + + var code = generator.GenerateCode(classes, enums, logger); + + var buffer = new StringBuilder(code.Length * 2); + using (var writer = new StringWriter(buffer)) + { + new CodeColorizer().Colorize( + code, + generator.Language == Language.Cpp ? Languages.Cpp : Languages.CSharp, + new RtfFormatter(), + StyleSheets.Default, + writer + ); + } + + codeRichTextBox.Rtf = buffer.ToString(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + } + + internal class RtfFormatter : IFormatter + { + private readonly RtfBuilder builder = new RtfBuilder(RtfFont.Consolas, 20); + + public void Write(string parsedSourceCode, IList scopes, IStyleSheet styleSheet, TextWriter textWriter) + { + if (scopes.Any()) + { + builder.SetForeColor(styleSheet.Styles[scopes.First().Name].Foreground).Append(parsedSourceCode); + } + else + { + builder.Append(parsedSourceCode); + } + } + + public void WriteHeader(IStyleSheet styleSheet, ILanguage language, TextWriter textWriter) + { + + } + + public void WriteFooter(IStyleSheet styleSheet, ILanguage language, TextWriter textWriter) + { + textWriter.Write(builder.ToString()); + } + } +} diff --git a/ReClass.NET/Forms/CodeForm.resx b/ReClass.NET/Forms/CodeForm.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/ReClass.NET/Forms/CodeForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ReClass.NET/Forms/EnumEditorForm.Designer.cs b/ReClass.NET/Forms/EnumEditorForm.Designer.cs new file mode 100644 index 00000000..c06e2978 --- /dev/null +++ b/ReClass.NET/Forms/EnumEditorForm.Designer.cs @@ -0,0 +1,196 @@ +using ReClassNET.Controls; + +namespace ReClassNET.Forms +{ + partial class EnumEditorForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.bannerBox = new BannerBox(); + this.saveButton = new System.Windows.Forms.Button(); + this.enumNameLabel = new System.Windows.Forms.Label(); + this.cancelButton = new System.Windows.Forms.Button(); + this.enumFlagCheckBox = new System.Windows.Forms.CheckBox(); + this.enumNameTextBox = new System.Windows.Forms.TextBox(); + this.enumDataGridView = new System.Windows.Forms.DataGridView(); + this.enumValueKeyColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.enumValueNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.enumUnderlyingTypeSizeLabel = new System.Windows.Forms.Label(); + this.enumUnderlyingTypeSizeComboBox = new ReClassNET.Forms.UnderlyingSizeComboBox(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.enumDataGridView)).BeginInit(); + this.SuspendLayout(); + // + // bannerBox + // + this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; + this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B16x16_Class_Type; + this.bannerBox.Location = new System.Drawing.Point(0, 0); + this.bannerBox.Name = "bannerBox"; + this.bannerBox.Size = new System.Drawing.Size(380, 48); + this.bannerBox.TabIndex = 15; + this.bannerBox.Text = "Edit an enum of the project."; + this.bannerBox.Title = "Enum Editor"; + // + // saveButton + // + this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.saveButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.saveButton.Location = new System.Drawing.Point(214, 250); + this.saveButton.Name = "saveButton"; + this.saveButton.Size = new System.Drawing.Size(75, 23); + this.saveButton.TabIndex = 22; + this.saveButton.Text = "Save"; + this.saveButton.UseVisualStyleBackColor = true; + this.saveButton.Click += new System.EventHandler(this.saveButton_Click); + // + // enumNameLabel + // + this.enumNameLabel.AutoSize = true; + this.enumNameLabel.Location = new System.Drawing.Point(9, 57); + this.enumNameLabel.Name = "enumNameLabel"; + this.enumNameLabel.Size = new System.Drawing.Size(38, 13); + this.enumNameLabel.TabIndex = 21; + this.enumNameLabel.Text = "Name:"; + // + // cancelButton + // + this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelButton.Location = new System.Drawing.Point(295, 250); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 23); + this.cancelButton.TabIndex = 19; + this.cancelButton.Text = "Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + // + // enumFlagCheckBox + // + this.enumFlagCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.enumFlagCheckBox.AutoSize = true; + this.enumFlagCheckBox.Location = new System.Drawing.Point(267, 82); + this.enumFlagCheckBox.Name = "enumFlagCheckBox"; + this.enumFlagCheckBox.Size = new System.Drawing.Size(103, 17); + this.enumFlagCheckBox.TabIndex = 18; + this.enumFlagCheckBox.Text = "Use Flags Mode"; + this.enumFlagCheckBox.UseVisualStyleBackColor = true; + // + // enumNameTextBox + // + this.enumNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.enumNameTextBox.Location = new System.Drawing.Point(53, 54); + this.enumNameTextBox.Name = "enumNameTextBox"; + this.enumNameTextBox.Size = new System.Drawing.Size(315, 20); + this.enumNameTextBox.TabIndex = 17; + // + // enumDataGridView + // + this.enumDataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.enumDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.enumDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.enumValueKeyColumn, + this.enumValueNameColumn}); + this.enumDataGridView.Location = new System.Drawing.Point(12, 108); + this.enumDataGridView.Name = "enumDataGridView"; + this.enumDataGridView.RowHeadersVisible = false; + this.enumDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.enumDataGridView.Size = new System.Drawing.Size(358, 136); + this.enumDataGridView.TabIndex = 16; + this.enumDataGridView.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.enumDataGridView_CellValidating); + this.enumDataGridView.DefaultValuesNeeded += new System.Windows.Forms.DataGridViewRowEventHandler(this.enumDataGridView_DefaultValuesNeeded); + // + // enumValueKeyColumn + // + this.enumValueKeyColumn.HeaderText = "Value"; + this.enumValueKeyColumn.Name = "enumValueKeyColumn"; + // + // enumValueNameColumn + // + this.enumValueNameColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.enumValueNameColumn.HeaderText = "Name"; + this.enumValueNameColumn.Name = "enumValueNameColumn"; + // + // enumUnderlyingTypeSizeLabel + // + this.enumUnderlyingTypeSizeLabel.AutoSize = true; + this.enumUnderlyingTypeSizeLabel.Location = new System.Drawing.Point(9, 83); + this.enumUnderlyingTypeSizeLabel.Name = "enumUnderlyingTypeSizeLabel"; + this.enumUnderlyingTypeSizeLabel.Size = new System.Drawing.Size(30, 13); + this.enumUnderlyingTypeSizeLabel.TabIndex = 24; + this.enumUnderlyingTypeSizeLabel.Text = "Size:"; + // + // enumUnderlyingTypeSizeComboBox + // + this.enumUnderlyingTypeSizeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.enumUnderlyingTypeSizeComboBox.Location = new System.Drawing.Point(53, 80); + this.enumUnderlyingTypeSizeComboBox.Name = "enumUnderlyingTypeSizeComboBox"; + this.enumUnderlyingTypeSizeComboBox.Size = new System.Drawing.Size(208, 21); + this.enumUnderlyingTypeSizeComboBox.TabIndex = 25; + // + // EnumEditorForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(380, 282); + this.Controls.Add(this.enumUnderlyingTypeSizeComboBox); + this.Controls.Add(this.enumUnderlyingTypeSizeLabel); + this.Controls.Add(this.saveButton); + this.Controls.Add(this.enumNameLabel); + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.enumFlagCheckBox); + this.Controls.Add(this.enumNameTextBox); + this.Controls.Add(this.enumDataGridView); + this.Controls.Add(this.bannerBox); + this.MinimumSize = new System.Drawing.Size(396, 321); + this.Name = "EnumEditorForm"; + this.Text = "ReClass.NET - Enum Editor"; + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.enumDataGridView)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private BannerBox bannerBox; + private System.Windows.Forms.Button saveButton; + private System.Windows.Forms.Label enumNameLabel; + private System.Windows.Forms.Button cancelButton; + private System.Windows.Forms.CheckBox enumFlagCheckBox; + private System.Windows.Forms.TextBox enumNameTextBox; + private System.Windows.Forms.DataGridView enumDataGridView; + private System.Windows.Forms.Label enumUnderlyingTypeSizeLabel; + private System.Windows.Forms.DataGridViewTextBoxColumn enumValueKeyColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn enumValueNameColumn; + private UnderlyingSizeComboBox enumUnderlyingTypeSizeComboBox; + } +} \ No newline at end of file diff --git a/ReClass.NET/Forms/EnumEditorForm.cs b/ReClass.NET/Forms/EnumEditorForm.cs new file mode 100644 index 00000000..cfdc5302 --- /dev/null +++ b/ReClass.NET/Forms/EnumEditorForm.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Windows.Forms; +using ReClassNET.Controls; +using ReClassNET.Project; +using ReClassNET.UI; + +namespace ReClassNET.Forms +{ + public partial class EnumEditorForm : IconForm + { + private readonly EnumDescription @enum; + + public EnumEditorForm(EnumDescription @enum) + { + Contract.Requires(@enum != null); + + InitializeComponent(); + + this.@enum = @enum; + + enumNameTextBox.Text = @enum.Name; + enumUnderlyingTypeSizeComboBox.SelectedValue = @enum.Size; + enumFlagCheckBox.Checked = @enum.UseFlagsMode; + + foreach (var kv in @enum.Values) + { + enumDataGridView.Rows.Add(kv.Value, kv.Key); + } + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + + private void enumDataGridView_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e) + { + long value = e.Row.Index; + if (enumFlagCheckBox.Checked) + { + value = (long)Math.Pow(2, e.Row.Index); + } + + e.Row.Cells[0].Value = value; + } + + private void saveButton_Click(object sender, EventArgs e) + { + @enum.Name = enumNameTextBox.Text; + + var values = new Dictionary(); + + foreach (var row in enumDataGridView.Rows.Cast().Where(r => r.IsNewRow == false)) + { + if (!long.TryParse(Convert.ToString(row.Cells[0].Value), out var itemValue)) + { + continue; + } + + var itemName = Convert.ToString(row.Cells[1].Value); + + values.Add(itemName, itemValue); + } + + @enum.SetData(enumFlagCheckBox.Checked, enumUnderlyingTypeSizeComboBox.SelectedValue, values); + } + + private void enumDataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) + { + void SetErrorText(string text) + { + enumDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].ErrorText = text; + } + + SetErrorText(null); + + var formattedValue = Convert.ToString(e.FormattedValue); + + if (e.ColumnIndex == 0 && !long.TryParse(formattedValue, out _)) + { + SetErrorText($"'{formattedValue}' is not a valid value."); + } + else if (e.ColumnIndex == 1 && string.IsNullOrWhiteSpace(formattedValue)) + { + SetErrorText("Empty names are not allowed."); + } + } + } + + internal class UnderlyingSizeComboBox : EnumComboBox { } +} diff --git a/ReClass.NET/Forms/EnumEditorForm.resx b/ReClass.NET/Forms/EnumEditorForm.resx new file mode 100644 index 00000000..8ff01df4 --- /dev/null +++ b/ReClass.NET/Forms/EnumEditorForm.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/ReClass.NET/Forms/EnumListForm.Designer.cs b/ReClass.NET/Forms/EnumListForm.Designer.cs new file mode 100644 index 00000000..44d1f381 --- /dev/null +++ b/ReClass.NET/Forms/EnumListForm.Designer.cs @@ -0,0 +1,142 @@ +using ReClassNET.Controls; + +namespace ReClassNET.Forms +{ + partial class EnumListForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.filterNameTextBox = new PlaceholderTextBox(); + this.itemListBox = new System.Windows.Forms.ListBox(); + this.bannerBox = new BannerBox(); + this.addEnumIconButton = new IconButton(); + this.removeEnumIconButton = new IconButton(); + this.editEnumIconButton = new IconButton(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); + this.SuspendLayout(); + // + // filterNameTextBox + // + this.filterNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.filterNameTextBox.Location = new System.Drawing.Point(12, 60); + this.filterNameTextBox.Name = "filterNameTextBox"; + this.filterNameTextBox.PlaceholderText = "Filter by Enum Name..."; + this.filterNameTextBox.Size = new System.Drawing.Size(411, 20); + this.filterNameTextBox.TabIndex = 10; + this.filterNameTextBox.TextChanged += new System.EventHandler(this.filterNameTextBox_TextChanged); + // + // itemListBox + // + this.itemListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.itemListBox.DisplayMember = "Name"; + this.itemListBox.FormattingEnabled = true; + this.itemListBox.Location = new System.Drawing.Point(12, 86); + this.itemListBox.Name = "itemListBox"; + this.itemListBox.Size = new System.Drawing.Size(492, 212); + this.itemListBox.TabIndex = 11; + this.itemListBox.SelectedIndexChanged += new System.EventHandler(this.itemListBox_SelectedIndexChanged); + // + // bannerBox + // + this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; + this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B16x16_Class_Type; + this.bannerBox.Location = new System.Drawing.Point(0, 0); + this.bannerBox.Name = "bannerBox"; + this.bannerBox.Size = new System.Drawing.Size(516, 48); + this.bannerBox.TabIndex = 14; + this.bannerBox.Text = "Edit the enums of the project."; + this.bannerBox.Title = "Enums"; + // + // addEnumIconButton + // + this.addEnumIconButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.addEnumIconButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add; + this.addEnumIconButton.Location = new System.Drawing.Point(456, 59); + this.addEnumIconButton.Name = "addEnumIconButton"; + this.addEnumIconButton.Pressed = false; + this.addEnumIconButton.Selected = false; + this.addEnumIconButton.Size = new System.Drawing.Size(23, 22); + this.addEnumIconButton.TabIndex = 15; + this.addEnumIconButton.Click += new System.EventHandler(this.addEnumIconButton_Click); + // + // removeEnumIconButton + // + this.removeEnumIconButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.removeEnumIconButton.Enabled = false; + this.removeEnumIconButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Remove; + this.removeEnumIconButton.Location = new System.Drawing.Point(481, 59); + this.removeEnumIconButton.Name = "removeEnumIconButton"; + this.removeEnumIconButton.Pressed = false; + this.removeEnumIconButton.Selected = false; + this.removeEnumIconButton.Size = new System.Drawing.Size(23, 22); + this.removeEnumIconButton.TabIndex = 16; + this.removeEnumIconButton.Click += new System.EventHandler(this.removeEnumIconButton_Click); + // + // editEnumIconButton + // + this.editEnumIconButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.editEnumIconButton.Enabled = false; + this.editEnumIconButton.Image = global::ReClassNET.Properties.Resources.B16x16_Custom_Type; + this.editEnumIconButton.Location = new System.Drawing.Point(431, 59); + this.editEnumIconButton.Name = "editEnumIconButton"; + this.editEnumIconButton.Pressed = false; + this.editEnumIconButton.Selected = false; + this.editEnumIconButton.Size = new System.Drawing.Size(23, 22); + this.editEnumIconButton.TabIndex = 16; + this.editEnumIconButton.Click += new System.EventHandler(this.editEnumIconButton_Click); + // + // EnumListForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(516, 308); + this.Controls.Add(this.editEnumIconButton); + this.Controls.Add(this.addEnumIconButton); + this.Controls.Add(this.removeEnumIconButton); + this.Controls.Add(this.filterNameTextBox); + this.Controls.Add(this.itemListBox); + this.Controls.Add(this.bannerBox); + this.Name = "EnumListForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "ReClass.NET - Enums"; + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private PlaceholderTextBox filterNameTextBox; + private System.Windows.Forms.ListBox itemListBox; + private BannerBox bannerBox; + private IconButton addEnumIconButton; + private IconButton removeEnumIconButton; + private IconButton editEnumIconButton; + } +} \ No newline at end of file diff --git a/ReClass.NET/Forms/EnumListForm.cs b/ReClass.NET/Forms/EnumListForm.cs new file mode 100644 index 00000000..f8cafe56 --- /dev/null +++ b/ReClass.NET/Forms/EnumListForm.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Windows.Forms; +using ReClassNET.Project; +using ReClassNET.UI; + +namespace ReClassNET.Forms +{ + public partial class EnumListForm : IconForm + { + private readonly ReClassNetProject project; + + public EnumDescription SelectedItem => itemListBox.SelectedItem as EnumDescription; + + public EnumListForm(ReClassNetProject project) + { + Contract.Requires(project != null); + + this.project = project; + + InitializeComponent(); + + ShowFilteredEnums(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + + private void filterNameTextBox_TextChanged(object sender, EventArgs e) + { + ShowFilteredEnums(); + } + + private void itemListBox_SelectedIndexChanged(object sender, EventArgs e) + { + editEnumIconButton.Enabled = removeEnumIconButton.Enabled = SelectedItem != null; + } + + private void editEnumIconButton_Click(object sender, EventArgs e) + { + var @enum = SelectedItem; + if (@enum == null) + { + return; + } + + using var eef = new EnumEditorForm(@enum); + + eef.ShowDialog(); + } + + private void addEnumIconButton_Click(object sender, EventArgs e) + { + var @enum = new EnumDescription + { + Name = "Enum" + }; + + using var eef = new EnumEditorForm(@enum); + + if (eef.ShowDialog() == DialogResult.OK) + { + project.AddEnum(@enum); + + ShowFilteredEnums(); + } + } + + private void removeEnumIconButton_Click(object sender, EventArgs e) + { + var @enum = SelectedItem; + if (@enum == null) + { + return; + } + + project.RemoveEnum(@enum); + + ShowFilteredEnums(); + } + + private void ShowFilteredEnums() + { + IEnumerable enums = project.Enums; + + if (!string.IsNullOrEmpty(filterNameTextBox.Text)) + { + enums = enums.Where(c => c.Name.IndexOf(filterNameTextBox.Text, StringComparison.OrdinalIgnoreCase) >= 0); + } + + itemListBox.DataSource = enums.ToList(); + } + } +} diff --git a/ReClass.NET/Forms/EnumListForm.resx b/ReClass.NET/Forms/EnumListForm.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/ReClass.NET/Forms/EnumListForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ReClass.NET/Forms/EnumSelectionForm.Designer.cs b/ReClass.NET/Forms/EnumSelectionForm.Designer.cs new file mode 100644 index 00000000..6334244a --- /dev/null +++ b/ReClass.NET/Forms/EnumSelectionForm.Designer.cs @@ -0,0 +1,175 @@ +using ReClassNET.Controls; + +namespace ReClassNET.Forms +{ + partial class EnumSelectionForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.selectButton = new System.Windows.Forms.Button(); + this.cancelButton = new System.Windows.Forms.Button(); + this.filterNameTextBox = new PlaceholderTextBox(); + this.itemListBox = new System.Windows.Forms.ListBox(); + this.bannerBox = new BannerBox(); + this.addEnumIconButton = new IconButton(); + this.removeEnumIconButton = new IconButton(); + this.editEnumIconButton = new IconButton(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); + this.SuspendLayout(); + // + // selectButton + // + this.selectButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.selectButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.selectButton.Enabled = false; + this.selectButton.Location = new System.Drawing.Point(328, 278); + this.selectButton.Name = "selectButton"; + this.selectButton.Size = new System.Drawing.Size(95, 23); + this.selectButton.TabIndex = 12; + this.selectButton.Text = "Select Enum"; + this.selectButton.UseVisualStyleBackColor = true; + // + // cancelButton + // + this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelButton.Location = new System.Drawing.Point(430, 278); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 23); + this.cancelButton.TabIndex = 13; + this.cancelButton.Text = "Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + // + // filterNameTextBox + // + this.filterNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.filterNameTextBox.Location = new System.Drawing.Point(12, 60); + this.filterNameTextBox.Name = "filterNameTextBox"; + this.filterNameTextBox.PlaceholderText = "Filter by Enum Name..."; + this.filterNameTextBox.Size = new System.Drawing.Size(411, 20); + this.filterNameTextBox.TabIndex = 10; + this.filterNameTextBox.TextChanged += new System.EventHandler(this.filterNameTextBox_TextChanged); + // + // itemListBox + // + this.itemListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.itemListBox.DisplayMember = "Name"; + this.itemListBox.FormattingEnabled = true; + this.itemListBox.Location = new System.Drawing.Point(12, 86); + this.itemListBox.Name = "itemListBox"; + this.itemListBox.Size = new System.Drawing.Size(492, 186); + this.itemListBox.TabIndex = 11; + this.itemListBox.SelectedIndexChanged += new System.EventHandler(this.itemListBox_SelectedIndexChanged); + // + // bannerBox + // + this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; + this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B16x16_Class_Type; + this.bannerBox.Location = new System.Drawing.Point(0, 0); + this.bannerBox.Name = "bannerBox"; + this.bannerBox.Size = new System.Drawing.Size(516, 48); + this.bannerBox.TabIndex = 14; + this.bannerBox.Text = "Select an enum of the project."; + this.bannerBox.Title = "Enum Selection"; + // + // addEnumIconButton + // + this.addEnumIconButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.addEnumIconButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add; + this.addEnumIconButton.Location = new System.Drawing.Point(456, 59); + this.addEnumIconButton.Name = "addEnumIconButton"; + this.addEnumIconButton.Pressed = false; + this.addEnumIconButton.Selected = false; + this.addEnumIconButton.Size = new System.Drawing.Size(23, 22); + this.addEnumIconButton.TabIndex = 15; + this.addEnumIconButton.Click += new System.EventHandler(this.addEnumIconButton_Click); + // + // removeEnumIconButton + // + this.removeEnumIconButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.removeEnumIconButton.Enabled = false; + this.removeEnumIconButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Remove; + this.removeEnumIconButton.Location = new System.Drawing.Point(481, 59); + this.removeEnumIconButton.Name = "removeEnumIconButton"; + this.removeEnumIconButton.Pressed = false; + this.removeEnumIconButton.Selected = false; + this.removeEnumIconButton.Size = new System.Drawing.Size(23, 22); + this.removeEnumIconButton.TabIndex = 16; + this.removeEnumIconButton.Click += new System.EventHandler(this.removeEnumIconButton_Click); + // + // editEnumIconButton + // + this.editEnumIconButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.editEnumIconButton.Enabled = false; + this.editEnumIconButton.Image = global::ReClassNET.Properties.Resources.B16x16_Custom_Type; + this.editEnumIconButton.Location = new System.Drawing.Point(431, 59); + this.editEnumIconButton.Name = "editEnumIconButton"; + this.editEnumIconButton.Pressed = false; + this.editEnumIconButton.Selected = false; + this.editEnumIconButton.Size = new System.Drawing.Size(23, 22); + this.editEnumIconButton.TabIndex = 16; + this.editEnumIconButton.Click += new System.EventHandler(this.editEnumIconButton_Click); + // + // EnumSelectionForm + // + this.AcceptButton = this.selectButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.cancelButton; + this.ClientSize = new System.Drawing.Size(516, 306); + this.Controls.Add(this.editEnumIconButton); + this.Controls.Add(this.addEnumIconButton); + this.Controls.Add(this.removeEnumIconButton); + this.Controls.Add(this.selectButton); + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.filterNameTextBox); + this.Controls.Add(this.itemListBox); + this.Controls.Add(this.bannerBox); + this.Name = "EnumSelectionForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "ReClass.NET - Enum Selection"; + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button selectButton; + private System.Windows.Forms.Button cancelButton; + private PlaceholderTextBox filterNameTextBox; + private System.Windows.Forms.ListBox itemListBox; + private BannerBox bannerBox; + private IconButton addEnumIconButton; + private IconButton removeEnumIconButton; + private IconButton editEnumIconButton; + } +} \ No newline at end of file diff --git a/ReClass.NET/Forms/EnumSelectionForm.cs b/ReClass.NET/Forms/EnumSelectionForm.cs new file mode 100644 index 00000000..6ef69d17 --- /dev/null +++ b/ReClass.NET/Forms/EnumSelectionForm.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Windows.Forms; +using ReClassNET.Project; +using ReClassNET.UI; + +namespace ReClassNET.Forms +{ + public partial class EnumSelectionForm : IconForm + { + private readonly ReClassNetProject project; + + public EnumDescription SelectedItem => itemListBox.SelectedItem as EnumDescription; + + public EnumSelectionForm(ReClassNetProject project) + { + Contract.Requires(project != null); + + this.project = project; + + InitializeComponent(); + + ShowFilteredEnums(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + + private void filterNameTextBox_TextChanged(object sender, EventArgs e) + { + ShowFilteredEnums(); + } + + private void itemListBox_SelectedIndexChanged(object sender, EventArgs e) + { + selectButton.Enabled = editEnumIconButton.Enabled = removeEnumIconButton.Enabled = SelectedItem != null; + } + + private void editEnumIconButton_Click(object sender, EventArgs e) + { + var @enum = SelectedItem; + if (@enum == null) + { + return; + } + + using var eef = new EnumEditorForm(@enum); + + eef.ShowDialog(); + } + + private void addEnumIconButton_Click(object sender, EventArgs e) + { + var @enum = new EnumDescription + { + Name = "Enum" + }; + + using var eef = new EnumEditorForm(@enum); + + if (eef.ShowDialog() == DialogResult.OK) + { + project.AddEnum(@enum); + + ShowFilteredEnums(); + } + } + + private void removeEnumIconButton_Click(object sender, EventArgs e) + { + var @enum = SelectedItem; + if (@enum == null) + { + return; + } + + project.RemoveEnum(@enum); + + ShowFilteredEnums(); + } + + private void ShowFilteredEnums() + { + IEnumerable enums = project.Enums; + + if (!string.IsNullOrEmpty(filterNameTextBox.Text)) + { + enums = enums.Where(c => c.Name.IndexOf(filterNameTextBox.Text, StringComparison.OrdinalIgnoreCase) >= 0); + } + + itemListBox.DataSource = enums.ToList(); + } + } +} diff --git a/ReClass.NET/Forms/EnumSelectionForm.resx b/ReClass.NET/Forms/EnumSelectionForm.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/ReClass.NET/Forms/EnumSelectionForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ReClass.NET/Forms/FoundCodeForm.Designer.cs b/ReClass.NET/Forms/FoundCodeForm.Designer.cs new file mode 100644 index 00000000..75df742e --- /dev/null +++ b/ReClass.NET/Forms/FoundCodeForm.Designer.cs @@ -0,0 +1,201 @@ +using ReClassNET.Controls; + +namespace ReClassNET.Forms +{ + partial class FoundCodeForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.splitContainer = new System.Windows.Forms.SplitContainer(); + this.foundCodeDataGridView = new System.Windows.Forms.DataGridView(); + this.counterDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.instructionDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.infoTextBox = new System.Windows.Forms.TextBox(); + this.stopButton = new System.Windows.Forms.Button(); + this.closeButton = new System.Windows.Forms.Button(); + this.createFunctionButton = new System.Windows.Forms.Button(); + this.bannerBox = new BannerBox(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); + this.splitContainer.Panel1.SuspendLayout(); + this.splitContainer.Panel2.SuspendLayout(); + this.splitContainer.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.foundCodeDataGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); + this.SuspendLayout(); + // + // splitContainer + // + this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.splitContainer.Location = new System.Drawing.Point(0, 49); + this.splitContainer.Name = "splitContainer"; + this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer.Panel1 + // + this.splitContainer.Panel1.Controls.Add(this.foundCodeDataGridView); + // + // splitContainer.Panel2 + // + this.splitContainer.Panel2.Controls.Add(this.infoTextBox); + this.splitContainer.Size = new System.Drawing.Size(476, 426); + this.splitContainer.SplitterDistance = 200; + this.splitContainer.TabIndex = 0; + // + // foundCodeDataGridView + // + this.foundCodeDataGridView.AllowUserToAddRows = false; + this.foundCodeDataGridView.AllowUserToDeleteRows = false; + this.foundCodeDataGridView.AllowUserToResizeRows = false; + this.foundCodeDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleHorizontal; + this.foundCodeDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.foundCodeDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.counterDataGridViewTextBoxColumn, + this.instructionDataGridViewTextBoxColumn}); + this.foundCodeDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + this.foundCodeDataGridView.Location = new System.Drawing.Point(0, 0); + this.foundCodeDataGridView.MultiSelect = false; + this.foundCodeDataGridView.Name = "foundCodeDataGridView"; + this.foundCodeDataGridView.ReadOnly = true; + this.foundCodeDataGridView.RowHeadersVisible = false; + this.foundCodeDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.foundCodeDataGridView.Size = new System.Drawing.Size(476, 200); + this.foundCodeDataGridView.TabIndex = 0; + this.foundCodeDataGridView.SelectionChanged += new System.EventHandler(this.foundCodeDataGridView_SelectionChanged); + // + // counterDataGridViewTextBoxColumn + // + this.counterDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.counterDataGridViewTextBoxColumn.DataPropertyName = "counter"; + this.counterDataGridViewTextBoxColumn.HeaderText = "Counter"; + this.counterDataGridViewTextBoxColumn.Name = "counterDataGridViewTextBoxColumn"; + this.counterDataGridViewTextBoxColumn.ReadOnly = true; + this.counterDataGridViewTextBoxColumn.Width = 69; + // + // instructionDataGridViewTextBoxColumn + // + this.instructionDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.instructionDataGridViewTextBoxColumn.DataPropertyName = "instruction"; + this.instructionDataGridViewTextBoxColumn.HeaderText = "Instruction"; + this.instructionDataGridViewTextBoxColumn.Name = "instructionDataGridViewTextBoxColumn"; + this.instructionDataGridViewTextBoxColumn.ReadOnly = true; + // + // infoTextBox + // + this.infoTextBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.infoTextBox.Location = new System.Drawing.Point(0, 0); + this.infoTextBox.Multiline = true; + this.infoTextBox.Name = "infoTextBox"; + this.infoTextBox.ReadOnly = true; + this.infoTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.infoTextBox.Size = new System.Drawing.Size(476, 222); + this.infoTextBox.TabIndex = 0; + // + // stopButton + // + this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.stopButton.Location = new System.Drawing.Point(489, 101); + this.stopButton.Name = "stopButton"; + this.stopButton.Size = new System.Drawing.Size(86, 35); + this.stopButton.TabIndex = 1; + this.stopButton.Text = "Stop"; + this.stopButton.UseVisualStyleBackColor = true; + this.stopButton.Click += new System.EventHandler(this.stopButton_Click); + // + // closeButton + // + this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.closeButton.Location = new System.Drawing.Point(489, 101); + this.closeButton.Name = "closeButton"; + this.closeButton.Size = new System.Drawing.Size(86, 35); + this.closeButton.TabIndex = 2; + this.closeButton.Text = "Close"; + this.closeButton.UseVisualStyleBackColor = true; + this.closeButton.Visible = false; + this.closeButton.Click += new System.EventHandler(this.closeButton_Click); + // + // createFunctionButton + // + this.createFunctionButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.createFunctionButton.Location = new System.Drawing.Point(489, 60); + this.createFunctionButton.Name = "createFunctionButton"; + this.createFunctionButton.Size = new System.Drawing.Size(86, 35); + this.createFunctionButton.TabIndex = 3; + this.createFunctionButton.Text = "Create Function Node"; + this.createFunctionButton.UseVisualStyleBackColor = true; + this.createFunctionButton.Click += new System.EventHandler(this.createFunctionButton_Click); + // + // bannerBox + // + this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; + this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B32x32_3D_Glasses; + this.bannerBox.Location = new System.Drawing.Point(0, 0); + this.bannerBox.Name = "bannerBox"; + this.bannerBox.Size = new System.Drawing.Size(587, 48); + this.bannerBox.TabIndex = 8; + this.bannerBox.Text = "<>"; + this.bannerBox.Title = "Instruction Finder"; + // + // FoundCodeForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(587, 474); + this.Controls.Add(this.bannerBox); + this.Controls.Add(this.createFunctionButton); + this.Controls.Add(this.closeButton); + this.Controls.Add(this.stopButton); + this.Controls.Add(this.splitContainer); + this.MinimumSize = new System.Drawing.Size(603, 464); + this.Name = "FoundCodeForm"; + this.Text = "<>"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FoundCodeForm_FormClosed); + this.splitContainer.Panel1.ResumeLayout(false); + this.splitContainer.Panel2.ResumeLayout(false); + this.splitContainer.Panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); + this.splitContainer.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.foundCodeDataGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.SplitContainer splitContainer; + private System.Windows.Forms.DataGridView foundCodeDataGridView; + private System.Windows.Forms.Button stopButton; + private System.Windows.Forms.DataGridViewTextBoxColumn counterDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn instructionDataGridViewTextBoxColumn; + private System.Windows.Forms.Button closeButton; + private System.Windows.Forms.TextBox infoTextBox; + private System.Windows.Forms.Button createFunctionButton; + private BannerBox bannerBox; + } +} \ No newline at end of file diff --git a/ReClass.NET/Forms/FoundCodeForm.cs b/ReClass.NET/Forms/FoundCodeForm.cs new file mode 100644 index 00000000..3169db2a --- /dev/null +++ b/ReClass.NET/Forms/FoundCodeForm.cs @@ -0,0 +1,252 @@ +using System; +using System.Data; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using ReClassNET.Debugger; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.Nodes; +using ReClassNET.UI; + +namespace ReClassNET.Forms +{ + public partial class FoundCodeForm : IconForm + { + private class FoundCodeInfo + { + public ExceptionDebugInfo DebugInfo { get; set; } + public DisassembledInstruction[] Instructions { get; set; } + } + + public delegate void StopEventHandler(object sender, EventArgs e); + + private readonly RemoteProcess process; + + private readonly DataTable data; + private volatile bool acceptNewRecords = true; + + public event StopEventHandler Stop; + + public FoundCodeForm(RemoteProcess process, IntPtr address, HardwareBreakpointTrigger trigger) + { + Contract.Requires(process != null); + + this.process = process; + + InitializeComponent(); + + foundCodeDataGridView.AutoGenerateColumns = false; + infoTextBox.Font = new Font(FontFamily.GenericMonospace, infoTextBox.Font.Size); + + if (trigger == HardwareBreakpointTrigger.Write) + { + Text = "Find out what writes to " + address.ToString(Constants.AddressHexFormat); + } + else + { + Text = "Find out what accesses " + address.ToString(Constants.AddressHexFormat); + } + + bannerBox.Text = Text; + + data = new DataTable(); + data.Columns.Add("counter", typeof(int)); + data.Columns.Add("instruction", typeof(string)); + data.Columns.Add("info", typeof(FoundCodeInfo)); + + foundCodeDataGridView.DataSource = data; + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + + #region Event Handler + + private void foundCodeDataGridView_SelectionChanged(object sender, EventArgs e) + { + var info = GetSelectedInfo(); + if (info == null) + { + return; + } + + var sb = new StringBuilder(); + + for (var i = 0; i < 5; ++i) + { + var code = $"{info.Instructions[i].Address.ToString(Constants.AddressHexFormat)} - {info.Instructions[i].Instruction}"; + if (i == 2) + { + sb.AppendLine(code + " <<<"); + } + else + { + sb.AppendLine(code); + } + } + + sb.AppendLine(); + +#if RECLASSNET64 + sb.AppendLine($"RAX = {info.DebugInfo.Registers.Rax.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"RBX = {info.DebugInfo.Registers.Rbx.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"RCX = {info.DebugInfo.Registers.Rcx.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"RDX = {info.DebugInfo.Registers.Rdx.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"RDI = {info.DebugInfo.Registers.Rdi.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"RSI = {info.DebugInfo.Registers.Rsi.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"RSP = {info.DebugInfo.Registers.Rsp.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"RBP = {info.DebugInfo.Registers.Rbp.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"RIP = {info.DebugInfo.Registers.Rip.ToString(Constants.AddressHexFormat)}"); + + sb.AppendLine($"R8 = {info.DebugInfo.Registers.R8.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"R9 = {info.DebugInfo.Registers.R9.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"R10 = {info.DebugInfo.Registers.R10.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"R11 = {info.DebugInfo.Registers.R11.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"R12 = {info.DebugInfo.Registers.R12.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"R13 = {info.DebugInfo.Registers.R13.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"R14 = {info.DebugInfo.Registers.R14.ToString(Constants.AddressHexFormat)}"); + sb.Append($"R15 = {info.DebugInfo.Registers.R15.ToString(Constants.AddressHexFormat)}"); +#else + sb.AppendLine($"EAX = {info.DebugInfo.Registers.Eax.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"EBX = {info.DebugInfo.Registers.Ebx.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"ECX = {info.DebugInfo.Registers.Ecx.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"EDX = {info.DebugInfo.Registers.Edx.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"EDI = {info.DebugInfo.Registers.Edi.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"ESI = {info.DebugInfo.Registers.Esi.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"ESP = {info.DebugInfo.Registers.Esp.ToString(Constants.AddressHexFormat)}"); + sb.AppendLine($"EBP = {info.DebugInfo.Registers.Ebp.ToString(Constants.AddressHexFormat)}"); + sb.Append($"EIP = {info.DebugInfo.Registers.Eip.ToString(Constants.AddressHexFormat)}"); +#endif + + infoTextBox.Text = sb.ToString(); + } + + private void FoundCodeForm_FormClosed(object sender, FormClosedEventArgs e) + { + StopRecording(); + } + + private void createFunctionButton_Click(object sender, EventArgs e) + { + var info = GetSelectedInfo(); + if (info == null) + { + return; + } + + var disassembler = new Disassembler(process.CoreFunctions); + var functionStartAddress = disassembler.RemoteGetFunctionStartAddress(process, info.DebugInfo.ExceptionAddress); + if (functionStartAddress.IsNull()) + { + MessageBox.Show("Could not find the start of the function. Aborting.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); + + return; + } + + var node = LinkedWindowFeatures.CreateClassAtAddress(functionStartAddress, false); + node.AddNode(new FunctionNode + { + Comment = info.Instructions[2].Instruction + }); + } + + private void stopButton_Click(object sender, EventArgs e) + { + StopRecording(); + + stopButton.Visible = false; + closeButton.Visible = true; + } + + private void closeButton_Click(object sender, EventArgs e) + { + Close(); + } + + #endregion + + private FoundCodeInfo GetSelectedInfo() + { + var row = foundCodeDataGridView.SelectedRows.Cast().FirstOrDefault(); + var view = row?.DataBoundItem as DataRowView; + return view?["info"] as FoundCodeInfo; + } + + private void StopRecording() + { + acceptNewRecords = false; + + Stop?.Invoke(this, EventArgs.Empty); + } + + public void AddRecord(ExceptionDebugInfo? context) + { + if (context == null) + { + return; + } + if (!acceptNewRecords) + { + return; + } + + if (InvokeRequired) + { + Invoke((MethodInvoker)(() => AddRecord(context))); + + return; + } + + var row = data.AsEnumerable().FirstOrDefault(r => r.Field("info").DebugInfo.ExceptionAddress == context.Value.ExceptionAddress); + if (row != null) + { + row["counter"] = row.Field("counter") + 1; + } + else + { + var disassembler = new Disassembler(process.CoreFunctions); + + var causedByInstruction = disassembler.RemoteGetPreviousInstruction(process, context.Value.ExceptionAddress); + if (causedByInstruction == null) + { + return; + } + + var instructions = new DisassembledInstruction[5]; + instructions[2] = causedByInstruction; + instructions[1] = disassembler.RemoteGetPreviousInstruction(process, instructions[2].Address); + instructions[0] = disassembler.RemoteGetPreviousInstruction(process, instructions[1].Address); + + var i = 3; + foreach (var instruction in disassembler.RemoteDisassembleCode(process, context.Value.ExceptionAddress, 2 * Disassembler.MaximumInstructionLength, 2)) + { + instructions[i++] = instruction; + } + + row = data.NewRow(); + row["counter"] = 1; + row["instruction"] = causedByInstruction.Instruction; + row["info"] = new FoundCodeInfo + { + DebugInfo = context.Value, + Instructions = instructions + }; + data.Rows.Add(row); + } + } + } +} diff --git a/ReClass.NET/Forms/FoundCodeForm.resx b/ReClass.NET/Forms/FoundCodeForm.resx new file mode 100644 index 00000000..0fa6a150 --- /dev/null +++ b/ReClass.NET/Forms/FoundCodeForm.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + \ No newline at end of file diff --git a/Forms/IconForm.cs b/ReClass.NET/Forms/IconForm.cs similarity index 100% rename from Forms/IconForm.cs rename to ReClass.NET/Forms/IconForm.cs diff --git a/Forms/InputBytesForm.Designer.cs b/ReClass.NET/Forms/InputBytesForm.Designer.cs similarity index 90% rename from Forms/InputBytesForm.Designer.cs rename to ReClass.NET/Forms/InputBytesForm.Designer.cs index 27e6e80d..f00713ba 100644 --- a/Forms/InputBytesForm.Designer.cs +++ b/ReClass.NET/Forms/InputBytesForm.Designer.cs @@ -45,19 +45,17 @@ private void InitializeComponent() this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(5, 9); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(88, 13); + this.label1.Size = new System.Drawing.Size(121, 13); this.label1.TabIndex = 1; - this.label1.Text = "Number of Bytes:"; + this.label1.Text = "Number of Bytes to add:"; // // hexRadioButton // this.hexRadioButton.AutoSize = true; - this.hexRadioButton.Checked = true; - this.hexRadioButton.Location = new System.Drawing.Point(8, 51); + this.hexRadioButton.Location = new System.Drawing.Point(77, 51); this.hexRadioButton.Name = "hexRadioButton"; this.hexRadioButton.Size = new System.Drawing.Size(44, 17); this.hexRadioButton.TabIndex = 2; - this.hexRadioButton.TabStop = true; this.hexRadioButton.Text = "Hex"; this.hexRadioButton.UseVisualStyleBackColor = true; this.hexRadioButton.CheckedChanged += new System.EventHandler(this.hexRadioButton_CheckedChanged); @@ -65,10 +63,12 @@ private void InitializeComponent() // decimalRadioButton // this.decimalRadioButton.AutoSize = true; - this.decimalRadioButton.Location = new System.Drawing.Point(58, 51); + this.decimalRadioButton.Checked = true; + this.decimalRadioButton.Location = new System.Drawing.Point(8, 51); this.decimalRadioButton.Name = "decimalRadioButton"; this.decimalRadioButton.Size = new System.Drawing.Size(63, 17); this.decimalRadioButton.TabIndex = 3; + this.decimalRadioButton.TabStop = true; this.decimalRadioButton.Text = "Decimal"; this.decimalRadioButton.UseVisualStyleBackColor = true; // @@ -111,8 +111,7 @@ private void InitializeComponent() // okButton // this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.okButton.Image = global::ReClassNET.Properties.Resources.B16x16_Accept; - this.okButton.Location = new System.Drawing.Point(102, 121); + this.okButton.Location = new System.Drawing.Point(146, 121); this.okButton.Name = "okButton"; this.okButton.Size = new System.Drawing.Size(75, 23); this.okButton.TabIndex = 8; @@ -122,10 +121,9 @@ private void InitializeComponent() // // bytesNumericUpDown // - this.bytesNumericUpDown.Hexadecimal = true; this.bytesNumericUpDown.Location = new System.Drawing.Point(8, 25); this.bytesNumericUpDown.Name = "bytesNumericUpDown"; - this.bytesNumericUpDown.Size = new System.Drawing.Size(168, 20); + this.bytesNumericUpDown.Size = new System.Drawing.Size(212, 20); this.bytesNumericUpDown.TabIndex = 9; this.bytesNumericUpDown.ValueChanged += new System.EventHandler(this.bytesNumericUpDown_ValueChanged); // @@ -134,7 +132,7 @@ private void InitializeComponent() this.AcceptButton = this.okButton; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(184, 151); + this.ClientSize = new System.Drawing.Size(228, 151); this.Controls.Add(this.bytesNumericUpDown); this.Controls.Add(this.okButton); this.Controls.Add(this.newSizeLabel); @@ -144,6 +142,7 @@ private void InitializeComponent() this.Controls.Add(this.decimalRadioButton); this.Controls.Add(this.hexRadioButton); this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "InputBytesForm"; diff --git a/Forms/InputBytesForm.cs b/ReClass.NET/Forms/InputBytesForm.cs similarity index 74% rename from Forms/InputBytesForm.cs rename to ReClass.NET/Forms/InputBytesForm.cs index cf7981f1..327a2416 100644 --- a/Forms/InputBytesForm.cs +++ b/ReClass.NET/Forms/InputBytesForm.cs @@ -1,6 +1,7 @@ using System; using System.Diagnostics.Contracts; using System.Windows.Forms; +using ReClassNET.UI; namespace ReClassNET.Forms { @@ -22,6 +23,22 @@ public InputBytesForm(int currentSize) FormatLabelText(newSizeLabel, currentSize); } + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + + #region Event Handler + private void hexRadioButton_CheckedChanged(object sender, EventArgs e) { bytesNumericUpDown.Hexadecimal = hexRadioButton.Checked; @@ -32,6 +49,8 @@ private void bytesNumericUpDown_ValueChanged(object sender, EventArgs e) FormatLabelText(newSizeLabel, currentSize + Bytes); } + #endregion + private void FormatLabelText(Label label, int size) { Contract.Requires(label != null); diff --git a/ReClass.NET/Forms/InputBytesForm.resx b/ReClass.NET/Forms/InputBytesForm.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/ReClass.NET/Forms/InputBytesForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ReClass.NET/Forms/InputCorrelatorForm.Designer.cs b/ReClass.NET/Forms/InputCorrelatorForm.Designer.cs new file mode 100644 index 00000000..27a18a9f --- /dev/null +++ b/ReClass.NET/Forms/InputCorrelatorForm.Designer.cs @@ -0,0 +1,197 @@ +using ReClassNET.Controls; + +namespace ReClassNET.Forms +{ + partial class InputCorrelatorForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.refineTimer = new System.Windows.Forms.Timer(this.components); + this.bannerBox = new BannerBox(); + this.settingsGroupBox = new System.Windows.Forms.GroupBox(); + this.removeButton = new System.Windows.Forms.Button(); + this.addButton = new System.Windows.Forms.Button(); + this.valueTypeComboBox = new ReClassNET.Forms.ScannerForm.ScanValueTypeComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.hotkeyListBox = new System.Windows.Forms.ListBox(); + this.hotkeyBox = new HotkeyBox(); + this.startStopButton = new System.Windows.Forms.Button(); + this.infoLabel = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); + this.settingsGroupBox.SuspendLayout(); + this.SuspendLayout(); + // + // refineTimer + // + this.refineTimer.Interval = 50; + this.refineTimer.Tick += new System.EventHandler(this.refineTimer_Tick); + // + // bannerBox + // + this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; + this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B32x32_Canvas_Size; + this.bannerBox.Location = new System.Drawing.Point(0, 0); + this.bannerBox.Name = "bannerBox"; + this.bannerBox.Size = new System.Drawing.Size(301, 48); + this.bannerBox.TabIndex = 8; + this.bannerBox.Text = "Scan for values correlated to input."; + this.bannerBox.Title = "Input Correlator"; + // + // settingsGroupBox + // + this.settingsGroupBox.Controls.Add(this.removeButton); + this.settingsGroupBox.Controls.Add(this.addButton); + this.settingsGroupBox.Controls.Add(this.valueTypeComboBox); + this.settingsGroupBox.Controls.Add(this.label1); + this.settingsGroupBox.Controls.Add(this.hotkeyListBox); + this.settingsGroupBox.Controls.Add(this.hotkeyBox); + this.settingsGroupBox.Location = new System.Drawing.Point(7, 54); + this.settingsGroupBox.Name = "settingsGroupBox"; + this.settingsGroupBox.Size = new System.Drawing.Size(288, 179); + this.settingsGroupBox.TabIndex = 9; + this.settingsGroupBox.TabStop = false; + this.settingsGroupBox.Text = "Settings"; + // + // removeButton + // + this.removeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.removeButton.Location = new System.Drawing.Point(203, 45); + this.removeButton.Name = "removeButton"; + this.removeButton.Size = new System.Drawing.Size(79, 23); + this.removeButton.TabIndex = 13; + this.removeButton.Text = "Remove Key"; + this.removeButton.UseVisualStyleBackColor = true; + this.removeButton.Click += new System.EventHandler(this.removeButton_Click); + // + // addButton + // + this.addButton.Location = new System.Drawing.Point(6, 45); + this.addButton.Name = "addButton"; + this.addButton.Size = new System.Drawing.Size(58, 23); + this.addButton.TabIndex = 12; + this.addButton.Text = "Add Key"; + this.addButton.UseVisualStyleBackColor = true; + this.addButton.Click += new System.EventHandler(this.addButton_Click); + // + // valueTypeComboBox + // + this.valueTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.valueTypeComboBox.Location = new System.Drawing.Point(66, 149); + this.valueTypeComboBox.Name = "valueTypeComboBox"; + this.valueTypeComboBox.Size = new System.Drawing.Size(216, 21); + this.valueTypeComboBox.TabIndex = 11; + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(3, 152); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(64, 13); + this.label1.TabIndex = 12; + this.label1.Text = "Value Type:"; + // + // hotkeyListBox + // + this.hotkeyListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.hotkeyListBox.FormattingEnabled = true; + this.hotkeyListBox.Location = new System.Drawing.Point(6, 74); + this.hotkeyListBox.Name = "hotkeyListBox"; + this.hotkeyListBox.Size = new System.Drawing.Size(276, 69); + this.hotkeyListBox.TabIndex = 11; + // + // hotkeyBox + // + this.hotkeyBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.hotkeyBox.Input = null; + this.hotkeyBox.Location = new System.Drawing.Point(6, 19); + this.hotkeyBox.Name = "hotkeyBox"; + this.hotkeyBox.Size = new System.Drawing.Size(276, 20); + this.hotkeyBox.TabIndex = 10; + // + // startStopButton + // + this.startStopButton.Location = new System.Drawing.Point(7, 239); + this.startStopButton.Name = "startStopButton"; + this.startStopButton.Size = new System.Drawing.Size(288, 23); + this.startStopButton.TabIndex = 13; + this.startStopButton.Text = "Start Scan"; + this.startStopButton.UseVisualStyleBackColor = true; + this.startStopButton.Click += new System.EventHandler(this.startStopButton_Click); + // + // infoLabel + // + this.infoLabel.AutoSize = true; + this.infoLabel.Location = new System.Drawing.Point(4, 265); + this.infoLabel.Name = "infoLabel"; + this.infoLabel.Size = new System.Drawing.Size(19, 13); + this.infoLabel.TabIndex = 11; + this.infoLabel.Text = "<>"; + // + // InputCorrelatorForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(301, 287); + this.Controls.Add(this.infoLabel); + this.Controls.Add(this.startStopButton); + this.Controls.Add(this.settingsGroupBox); + this.Controls.Add(this.bannerBox); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "InputCorrelatorForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Input Correlator"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InputCorrelatorForm_FormClosing); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); + this.settingsGroupBox.ResumeLayout(false); + this.settingsGroupBox.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Timer refineTimer; + private BannerBox bannerBox; + private System.Windows.Forms.GroupBox settingsGroupBox; + private HotkeyBox hotkeyBox; + private System.Windows.Forms.ListBox hotkeyListBox; + private System.Windows.Forms.Button removeButton; + private System.Windows.Forms.Button addButton; + private ScannerForm.ScanValueTypeComboBox valueTypeComboBox; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button startStopButton; + private System.Windows.Forms.Label infoLabel; + } +} \ No newline at end of file diff --git a/ReClass.NET/Forms/InputCorrelatorForm.cs b/ReClass.NET/Forms/InputCorrelatorForm.cs new file mode 100644 index 00000000..79508029 --- /dev/null +++ b/ReClass.NET/Forms/InputCorrelatorForm.cs @@ -0,0 +1,205 @@ +using System; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using ReClassNET.Input; +using ReClassNET.Memory; +using ReClassNET.MemoryScanner; +using ReClassNET.UI; + +namespace ReClassNET.Forms +{ + public partial class InputCorrelatorForm : IconForm + { + private static readonly TimeSpan refineInterval = TimeSpan.FromMilliseconds(400); + + private readonly ScannerForm scannerForm; + private readonly RemoteProcess process; + + private readonly KeyboardInput input; + private InputCorrelatedScanner scanner; + + private bool isScanning = false; + private DateTime lastRefineTime; + + public InputCorrelatorForm(ScannerForm scannerForm, RemoteProcess process) + { + Contract.Requires(scannerForm != null); + Contract.Requires(process != null); + + this.scannerForm = scannerForm; + this.process = process; + + InitializeComponent(); + + valueTypeComboBox.SetAvailableValues( + ScanValueType.Byte, + ScanValueType.Short, + ScanValueType.Integer, + ScanValueType.Long, + ScanValueType.Float, + ScanValueType.Double + ); + valueTypeComboBox.SelectedValue = ScanValueType.Integer; + + input = new KeyboardInput(); + + hotkeyBox.Input = input; + + infoLabel.Text = string.Empty; + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + + #region Event Handler + + private async void InputCorrelatorForm_FormClosing(object sender, FormClosingEventArgs e) + { + hotkeyBox.Input = null; + + refineTimer.Enabled = false; + + if (isScanning) + { + e.Cancel = true; + + Hide(); + + await Task.Delay(TimeSpan.FromSeconds(1)); + + Close(); + + return; + } + + scanner?.Dispose(); + + input?.Dispose(); + } + + private void addButton_Click(object sender, EventArgs e) + { + var hotkey = hotkeyBox.Hotkey.Clone(); + if (hotkey.IsEmpty) + { + return; + } + + hotkeyListBox.Items.Add(hotkey); + + hotkeyBox.Clear(); + } + + private void removeButton_Click(object sender, EventArgs e) + { + var index = hotkeyListBox.SelectedIndex; + if (index < 0) + { + return; + } + + hotkeyListBox.Items.RemoveAt(index); + } + + private async void startStopButton_Click(object sender, EventArgs e) + { + if (scanner == null) + { + if (hotkeyListBox.Items.Count == 0) + { + MessageBox.Show("Please add at least one hotkey.", Constants.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error); + + return; + } + + scanner = new InputCorrelatedScanner( + process, + input, + hotkeyListBox.Items.Cast(), + valueTypeComboBox.SelectedValue + ); + + settingsGroupBox.Enabled = false; + + try + { + await scanner.Initialize(); + + startStopButton.Text = "Stop Scan"; + + refineTimer.Enabled = true; + + return; + } + catch (Exception ex) + { + Program.ShowException(ex); + } + } + else + { + refineTimer.Enabled = false; + + startStopButton.Text = "Start Scan"; + + while (isScanning) + { + await Task.Delay(TimeSpan.FromSeconds(1)); + } + + scannerForm.ShowScannerResults(scanner); + + scanner.Dispose(); + scanner = null; + } + + settingsGroupBox.Enabled = true; + } + + private async void refineTimer_Tick(object sender, EventArgs e) + { + if (isScanning) + { + return; + } + + scanner.CorrelateInput(); + + if (lastRefineTime + refineInterval < DateTime.Now) + { + isScanning = true; + + try + { + await scanner.RefineResults(CancellationToken.None, null); + + infoLabel.Text = $"Scan Count: {scanner.ScanCount} Possible Values: {scanner.TotalResultCount}"; + } + catch (Exception ex) + { + Program.ShowException(ex); + } + + isScanning = false; + + lastRefineTime = DateTime.Now; + } + } + + #endregion + } +} diff --git a/ReClass.NET/Forms/InputCorrelatorForm.resx b/ReClass.NET/Forms/InputCorrelatorForm.resx new file mode 100644 index 00000000..4c5d0a61 --- /dev/null +++ b/ReClass.NET/Forms/InputCorrelatorForm.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/Forms/LogForm.Designer.cs b/ReClass.NET/Forms/LogForm.Designer.cs similarity index 98% rename from Forms/LogForm.Designer.cs rename to ReClass.NET/Forms/LogForm.Designer.cs index 5bd2d132..384b0974 100644 --- a/Forms/LogForm.Designer.cs +++ b/ReClass.NET/Forms/LogForm.Designer.cs @@ -86,7 +86,7 @@ private void InitializeComponent() this.entriesDataGridView.Name = "entriesDataGridView"; this.entriesDataGridView.ReadOnly = true; this.entriesDataGridView.RowHeadersVisible = false; - this.entriesDataGridView.RowTemplate.ContextMenuStrip = this.contextMenuStrip; + this.entriesDataGridView.ContextMenuStrip = this.contextMenuStrip; this.entriesDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.entriesDataGridView.Size = new System.Drawing.Size(563, 188); this.entriesDataGridView.TabIndex = 1; diff --git a/Forms/LogForm.cs b/ReClass.NET/Forms/LogForm.cs similarity index 91% rename from Forms/LogForm.cs rename to ReClass.NET/Forms/LogForm.cs index 8d34ea3b..9475d010 100644 --- a/Forms/LogForm.cs +++ b/ReClass.NET/Forms/LogForm.cs @@ -1,11 +1,9 @@ using System; using System.Collections.Generic; -using System.Data; using System.Diagnostics.Contracts; using System.Drawing; using System.Linq; using System.Windows.Forms; -using Microsoft.SqlServer.MessageBox; using ReClassNET.Logger; using ReClassNET.UI; @@ -73,10 +71,7 @@ private void showDetailsToolStripMenuItem_Click(object sender, EventArgs e) private void RefreshDataBinding() { var cm = entriesDataGridView.BindingContext[items] as CurrencyManager; - if (cm != null) - { - cm.Refresh(); - } + cm?.Refresh(); } public void Clear() @@ -115,12 +110,9 @@ public void Add(LogLevel level, string message, Exception ex) private void ShowDetailsForm() { var item = entriesDataGridView.SelectedRows.Cast().FirstOrDefault()?.DataBoundItem as LogItem; - if (item != null) + if (item?.Exception != null) { - if (item.Exception != null) - { - Program.ShowException(item.Exception); - } + Program.ShowException(item.Exception); } } } diff --git a/Forms/LogForm.resx b/ReClass.NET/Forms/LogForm.resx similarity index 100% rename from Forms/LogForm.resx rename to ReClass.NET/Forms/LogForm.resx diff --git a/ReClass.NET/Forms/MainForm.Designer.cs b/ReClass.NET/Forms/MainForm.Designer.cs new file mode 100644 index 00000000..e2b2a199 --- /dev/null +++ b/ReClass.NET/Forms/MainForm.Designer.cs @@ -0,0 +1,1547 @@ +using ReClassNET.Controls; + +namespace ReClassNET.Forms +{ + partial class MainForm + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); + this.processUpdateTimer = new System.Windows.Forms.Timer(this.components); + this.splitContainer = new System.Windows.Forms.SplitContainer(); + this.projectView = new ReClassNET.Controls.ProjectView(); + this.projectClassContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.deleteClassToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator19 = new System.Windows.Forms.ToolStripSeparator(); + this.removeUnusedClassesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator20 = new System.Windows.Forms.ToolStripSeparator(); + this.showCodeOfClassToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); + this.projectClassesContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.enableHierarchyViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.autoExpandHierarchyViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator21 = new System.Windows.Forms.ToolStripSeparator(); + this.expandAllClassesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.collapseAllClassesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator22 = new System.Windows.Forms.ToolStripSeparator(); + this.addNewClassToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.projectEnumContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.editEnumToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.projectEnumsContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.editEnumsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.memoryViewControl = new ReClassNET.Controls.MemoryViewControl(); + this.selectedNodeContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.changeTypeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addBytesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.integerToolStripMenuItem1 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem2 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem3 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem4 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem5 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem6 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem7 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.insertBytesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.integerToolStripMenuItem8 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem9 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem10 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem11 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem12 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem13 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.integerToolStripMenuItem14 = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); + this.createClassFromNodesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator(); + this.dissectNodesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); + this.searchForEqualValuesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator(); + this.findOutWhatAccessesThisAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.findOutWhatWritesToThisAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator14 = new System.Windows.Forms.ToolStripSeparator(); + this.copyNodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pasteNodesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator(); + this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); + this.hideNodesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.unhideNodesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.unhideChildNodesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.unhideNodesAboveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.unhideNodesBelowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator18 = new System.Windows.Forms.ToolStripSeparator(); + this.copyAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator(); + this.showCodeOfClassToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.shrinkClassToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStrip = new System.Windows.Forms.ToolStrip(); + this.attachToProcessToolStripSplitButton = new System.Windows.Forms.ToolStripSplitButton(); + this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); + this.openProjectToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.saveToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); + this.newClassToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.addBytesToolStripDropDownButton = new System.Windows.Forms.ToolStripDropDownButton(); + this.add4BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.add8BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.add64BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.add256BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.add1024BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.add2048BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.add4096BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.addXBytesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.insertBytesToolStripDropDownButton = new System.Windows.Forms.ToolStripDropDownButton(); + this.insert4BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.insert8BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.insert64BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.insert256BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.insert1024BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.insert2048BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.insert4096BytesToolStripMenuItem = new ReClassNET.Controls.IntegerToolStripMenuItem(); + this.insertXBytesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.nodeTypesToolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); + this.statusStrip = new System.Windows.Forms.StatusStrip(); + this.processInfoToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.infoToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); + this.mainMenuStrip = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.attachToProcessToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.reattachToProcessToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.detachToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.openProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mergeWithProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.clearProjectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pluginsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); + this.quitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.processToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.processInformationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.memorySearcherToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.namedAddressesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator23 = new System.Windows.Forms.ToolStripSeparator(); + this.isLittleEndianToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator(); + this.loadSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.loadSymbolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.resumeProcessToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.suspendProcessToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.terminateProcessToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.projectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.goToClassToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.cleanUnusedClassesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.showEnumsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator(); + this.generateCppCodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.generateCSharpCodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); + this.splitContainer.Panel1.SuspendLayout(); + this.splitContainer.Panel2.SuspendLayout(); + this.splitContainer.SuspendLayout(); + this.projectClassContextMenuStrip.SuspendLayout(); + this.projectClassesContextMenuStrip.SuspendLayout(); + this.projectEnumContextMenuStrip.SuspendLayout(); + this.projectEnumsContextMenuStrip.SuspendLayout(); + this.selectedNodeContextMenuStrip.SuspendLayout(); + this.toolStrip.SuspendLayout(); + this.statusStrip.SuspendLayout(); + this.mainMenuStrip.SuspendLayout(); + this.SuspendLayout(); + // + // processUpdateTimer + // + this.processUpdateTimer.Enabled = true; + this.processUpdateTimer.Interval = 5000; + this.processUpdateTimer.Tick += new System.EventHandler(this.processUpdateTimer_Tick); + // + // splitContainer + // + this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer.Location = new System.Drawing.Point(0, 49); + this.splitContainer.Name = "splitContainer"; + // + // splitContainer.Panel1 + // + this.splitContainer.Panel1.Controls.Add(this.projectView); + // + // splitContainer.Panel2 + // + this.splitContainer.Panel2.BackColor = System.Drawing.SystemColors.Control; + this.splitContainer.Panel2.Controls.Add(this.memoryViewControl); + this.splitContainer.Size = new System.Drawing.Size(1141, 524); + this.splitContainer.SplitterDistance = 201; + this.splitContainer.TabIndex = 4; + // + // projectView + // + this.projectView.ClassContextMenuStrip = this.projectClassContextMenuStrip; + this.projectView.ClassesContextMenuStrip = this.projectClassesContextMenuStrip; + this.projectView.Dock = System.Windows.Forms.DockStyle.Fill; + this.projectView.EnumContextMenuStrip = this.projectEnumContextMenuStrip; + this.projectView.EnumsContextMenuStrip = this.projectEnumsContextMenuStrip; + this.projectView.Location = new System.Drawing.Point(0, 0); + this.projectView.Name = "projectView"; + this.projectView.Size = new System.Drawing.Size(201, 524); + this.projectView.TabIndex = 0; + this.projectView.SelectionChanged += new ReClassNET.Controls.ProjectView.SelectionChangedEvent(this.classesView_ClassSelected); + // + // projectClassContextMenuStrip + // + this.projectClassContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.deleteClassToolStripMenuItem, + this.toolStripSeparator19, + this.removeUnusedClassesToolStripMenuItem, + this.toolStripSeparator20, + this.showCodeOfClassToolStripMenuItem2}); + this.projectClassContextMenuStrip.Name = "contextMenuStrip"; + this.projectClassContextMenuStrip.Size = new System.Drawing.Size(206, 82); + // + // deleteClassToolStripMenuItem + // + this.deleteClassToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Class_Remove; + this.deleteClassToolStripMenuItem.Name = "deleteClassToolStripMenuItem"; + this.deleteClassToolStripMenuItem.Size = new System.Drawing.Size(205, 22); + this.deleteClassToolStripMenuItem.Text = "Delete class"; + this.deleteClassToolStripMenuItem.Click += new System.EventHandler(this.deleteClassToolStripMenuItem_Click); + // + // toolStripSeparator19 + // + this.toolStripSeparator19.Name = "toolStripSeparator19"; + this.toolStripSeparator19.Size = new System.Drawing.Size(202, 6); + // + // removeUnusedClassesToolStripMenuItem + // + this.removeUnusedClassesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Chart_Delete; + this.removeUnusedClassesToolStripMenuItem.Name = "removeUnusedClassesToolStripMenuItem"; + this.removeUnusedClassesToolStripMenuItem.Size = new System.Drawing.Size(205, 22); + this.removeUnusedClassesToolStripMenuItem.Text = "Remove unused classes"; + this.removeUnusedClassesToolStripMenuItem.Click += new System.EventHandler(this.removeUnusedClassesToolStripMenuItem_Click); + // + // toolStripSeparator20 + // + this.toolStripSeparator20.Name = "toolStripSeparator20"; + this.toolStripSeparator20.Size = new System.Drawing.Size(202, 6); + // + // showCodeOfClassToolStripMenuItem2 + // + this.showCodeOfClassToolStripMenuItem2.Image = global::ReClassNET.Properties.Resources.B16x16_Page_Code_Cpp; + this.showCodeOfClassToolStripMenuItem2.Name = "showCodeOfClassToolStripMenuItem2"; + this.showCodeOfClassToolStripMenuItem2.Size = new System.Drawing.Size(205, 22); + this.showCodeOfClassToolStripMenuItem2.Text = "Show C++ Code of Class"; + this.showCodeOfClassToolStripMenuItem2.Click += new System.EventHandler(this.showCodeOfClassToolStripMenuItem2_Click); + // + // projectClassesContextMenuStrip + // + this.projectClassesContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.enableHierarchyViewToolStripMenuItem, + this.autoExpandHierarchyViewToolStripMenuItem, + this.toolStripSeparator21, + this.expandAllClassesToolStripMenuItem, + this.collapseAllClassesToolStripMenuItem, + this.toolStripSeparator22, + this.addNewClassToolStripMenuItem}); + this.projectClassesContextMenuStrip.Name = "rootContextMenuStrip"; + this.projectClassesContextMenuStrip.Size = new System.Drawing.Size(222, 126); + // + // enableHierarchyViewToolStripMenuItem + // + this.enableHierarchyViewToolStripMenuItem.Name = "enableHierarchyViewToolStripMenuItem"; + this.enableHierarchyViewToolStripMenuItem.Size = new System.Drawing.Size(221, 22); + this.enableHierarchyViewToolStripMenuItem.Text = "Enable hierarchy view"; + this.enableHierarchyViewToolStripMenuItem.Click += new System.EventHandler(this.enableHierarchyViewToolStripMenuItem_Click); + // + // autoExpandHierarchyViewToolStripMenuItem + // + this.autoExpandHierarchyViewToolStripMenuItem.Name = "autoExpandHierarchyViewToolStripMenuItem"; + this.autoExpandHierarchyViewToolStripMenuItem.Size = new System.Drawing.Size(221, 22); + this.autoExpandHierarchyViewToolStripMenuItem.Text = "Auto expand hierarchy view"; + this.autoExpandHierarchyViewToolStripMenuItem.Click += new System.EventHandler(this.autoExpandHierarchyViewToolStripMenuItem_Click); + // + // toolStripSeparator21 + // + this.toolStripSeparator21.Name = "toolStripSeparator21"; + this.toolStripSeparator21.Size = new System.Drawing.Size(218, 6); + // + // expandAllClassesToolStripMenuItem + // + this.expandAllClassesToolStripMenuItem.Enabled = false; + this.expandAllClassesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Tree_Expand; + this.expandAllClassesToolStripMenuItem.Name = "expandAllClassesToolStripMenuItem"; + this.expandAllClassesToolStripMenuItem.Size = new System.Drawing.Size(221, 22); + this.expandAllClassesToolStripMenuItem.Text = "Expand all classes"; + this.expandAllClassesToolStripMenuItem.Click += new System.EventHandler(this.expandAllClassesToolStripMenuItem_Click); + // + // collapseAllClassesToolStripMenuItem + // + this.collapseAllClassesToolStripMenuItem.Enabled = false; + this.collapseAllClassesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Tree_Collapse; + this.collapseAllClassesToolStripMenuItem.Name = "collapseAllClassesToolStripMenuItem"; + this.collapseAllClassesToolStripMenuItem.Size = new System.Drawing.Size(221, 22); + this.collapseAllClassesToolStripMenuItem.Text = "Collapse all classes"; + this.collapseAllClassesToolStripMenuItem.Click += new System.EventHandler(this.collapseAllClassesToolStripMenuItem_Click); + // + // toolStripSeparator22 + // + this.toolStripSeparator22.Name = "toolStripSeparator22"; + this.toolStripSeparator22.Size = new System.Drawing.Size(218, 6); + // + // addNewClassToolStripMenuItem + // + this.addNewClassToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Class_Add; + this.addNewClassToolStripMenuItem.Name = "addNewClassToolStripMenuItem"; + this.addNewClassToolStripMenuItem.Size = new System.Drawing.Size(221, 22); + this.addNewClassToolStripMenuItem.Text = "Add new class"; + this.addNewClassToolStripMenuItem.Click += new System.EventHandler(this.newClassToolStripButton_Click); + // + // projectEnumContextMenuStrip + // + this.projectEnumContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.editEnumToolStripMenuItem}); + this.projectEnumContextMenuStrip.Name = "projectEnumContextMenuStrip"; + this.projectEnumContextMenuStrip.Size = new System.Drawing.Size(138, 26); + // + // editEnumToolStripMenuItem + // + this.editEnumToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Enum_Type; + this.editEnumToolStripMenuItem.Name = "editEnumToolStripMenuItem"; + this.editEnumToolStripMenuItem.Size = new System.Drawing.Size(137, 22); + this.editEnumToolStripMenuItem.Text = "Edit Enum..."; + this.editEnumToolStripMenuItem.Click += new System.EventHandler(this.editEnumToolStripMenuItem_Click); + // + // projectEnumsContextMenuStrip + // + this.projectEnumsContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.editEnumsToolStripMenuItem}); + this.projectEnumsContextMenuStrip.Name = "projectEnumsContextMenuStrip"; + this.projectEnumsContextMenuStrip.Size = new System.Drawing.Size(143, 26); + // + // editEnumsToolStripMenuItem + // + this.editEnumsToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Category; + this.editEnumsToolStripMenuItem.Name = "editEnumsToolStripMenuItem"; + this.editEnumsToolStripMenuItem.Size = new System.Drawing.Size(142, 22); + this.editEnumsToolStripMenuItem.Text = "Edit enums..."; + this.editEnumsToolStripMenuItem.Click += new System.EventHandler(this.editEnumsToolStripMenuItem_Click); + // + // memoryViewControl + // + this.memoryViewControl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.memoryViewControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.memoryViewControl.Location = new System.Drawing.Point(0, 0); + this.memoryViewControl.Name = "memoryViewControl"; + this.memoryViewControl.NodeContextMenuStrip = this.selectedNodeContextMenuStrip; + this.memoryViewControl.Size = new System.Drawing.Size(936, 524); + this.memoryViewControl.TabIndex = 0; + this.memoryViewControl.DrawContextRequested += new ReClassNET.Controls.DrawContextRequestEventHandler(this.memoryViewControl_DrawContextRequested); + this.memoryViewControl.SelectionChanged += new System.EventHandler(this.memoryViewControl_SelectionChanged); + this.memoryViewControl.ChangeClassTypeClick += new ReClassNET.Controls.NodeClickEventHandler(this.memoryViewControl_ChangeClassTypeClick); + this.memoryViewControl.ChangeWrappedTypeClick += new ReClassNET.Controls.NodeClickEventHandler(this.memoryViewControl_ChangeWrappedTypeClick); + this.memoryViewControl.ChangeEnumTypeClick += new ReClassNET.Controls.NodeClickEventHandler(this.memoryViewControl_ChangeEnumTypeClick); + this.memoryViewControl.KeyDown += new System.Windows.Forms.KeyEventHandler(this.memoryViewControl_KeyDown); + // + // selectedNodeContextMenuStrip + // + this.selectedNodeContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.changeTypeToolStripMenuItem, + this.addBytesToolStripMenuItem, + this.insertBytesToolStripMenuItem, + this.toolStripSeparator8, + this.createClassFromNodesToolStripMenuItem, + this.toolStripSeparator13, + this.dissectNodesToolStripMenuItem, + this.toolStripSeparator9, + this.searchForEqualValuesToolStripMenuItem, + this.toolStripSeparator15, + this.findOutWhatAccessesThisAddressToolStripMenuItem, + this.findOutWhatWritesToThisAddressToolStripMenuItem, + this.toolStripSeparator14, + this.copyNodeToolStripMenuItem, + this.pasteNodesToolStripMenuItem, + this.toolStripSeparator10, + this.removeToolStripMenuItem, + this.toolStripSeparator12, + this.hideNodesToolStripMenuItem, + this.unhideNodesToolStripMenuItem, + this.toolStripSeparator18, + this.copyAddressToolStripMenuItem, + this.toolStripSeparator11, + this.showCodeOfClassToolStripMenuItem, + this.shrinkClassToolStripMenuItem}); + this.selectedNodeContextMenuStrip.Name = "selectedNodeContextMenuStrip"; + this.selectedNodeContextMenuStrip.Size = new System.Drawing.Size(270, 410); + this.selectedNodeContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.selectedNodeContextMenuStrip_Opening); + // + // changeTypeToolStripMenuItem + // + this.changeTypeToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Exchange_Button; + this.changeTypeToolStripMenuItem.Name = "changeTypeToolStripMenuItem"; + this.changeTypeToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.changeTypeToolStripMenuItem.Text = "Change Type"; + // + // addBytesToolStripMenuItem + // + this.addBytesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.integerToolStripMenuItem1, + this.integerToolStripMenuItem2, + this.integerToolStripMenuItem3, + this.integerToolStripMenuItem4, + this.integerToolStripMenuItem5, + this.integerToolStripMenuItem6, + this.integerToolStripMenuItem7, + this.toolStripMenuItem1}); + this.addBytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_X; + this.addBytesToolStripMenuItem.Name = "addBytesToolStripMenuItem"; + this.addBytesToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.addBytesToolStripMenuItem.Text = "Add Bytes"; + // + // integerToolStripMenuItem1 + // + this.integerToolStripMenuItem1.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_4; + this.integerToolStripMenuItem1.Name = "integerToolStripMenuItem1"; + this.integerToolStripMenuItem1.Size = new System.Drawing.Size(154, 22); + this.integerToolStripMenuItem1.Text = "Add 4 Bytes"; + this.integerToolStripMenuItem1.Value = 4; + this.integerToolStripMenuItem1.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // integerToolStripMenuItem2 + // + this.integerToolStripMenuItem2.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_8; + this.integerToolStripMenuItem2.Name = "integerToolStripMenuItem2"; + this.integerToolStripMenuItem2.Size = new System.Drawing.Size(154, 22); + this.integerToolStripMenuItem2.Text = "Add 8 Bytes"; + this.integerToolStripMenuItem2.Value = 8; + this.integerToolStripMenuItem2.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // integerToolStripMenuItem3 + // + this.integerToolStripMenuItem3.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_64; + this.integerToolStripMenuItem3.Name = "integerToolStripMenuItem3"; + this.integerToolStripMenuItem3.Size = new System.Drawing.Size(154, 22); + this.integerToolStripMenuItem3.Text = "Add 64 Bytes"; + this.integerToolStripMenuItem3.Value = 64; + this.integerToolStripMenuItem3.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // integerToolStripMenuItem4 + // + this.integerToolStripMenuItem4.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_256; + this.integerToolStripMenuItem4.Name = "integerToolStripMenuItem4"; + this.integerToolStripMenuItem4.Size = new System.Drawing.Size(154, 22); + this.integerToolStripMenuItem4.Text = "Add 256 Bytes"; + this.integerToolStripMenuItem4.Value = 256; + this.integerToolStripMenuItem4.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // integerToolStripMenuItem5 + // + this.integerToolStripMenuItem5.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_1024; + this.integerToolStripMenuItem5.Name = "integerToolStripMenuItem5"; + this.integerToolStripMenuItem5.Size = new System.Drawing.Size(154, 22); + this.integerToolStripMenuItem5.Text = "Add 1024 Bytes"; + this.integerToolStripMenuItem5.Value = 1024; + this.integerToolStripMenuItem5.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // integerToolStripMenuItem6 + // + this.integerToolStripMenuItem6.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_2048; + this.integerToolStripMenuItem6.Name = "integerToolStripMenuItem6"; + this.integerToolStripMenuItem6.Size = new System.Drawing.Size(154, 22); + this.integerToolStripMenuItem6.Text = "Add 2048 Bytes"; + this.integerToolStripMenuItem6.Value = 2048; + this.integerToolStripMenuItem6.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // integerToolStripMenuItem7 + // + this.integerToolStripMenuItem7.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_4096; + this.integerToolStripMenuItem7.Name = "integerToolStripMenuItem7"; + this.integerToolStripMenuItem7.Size = new System.Drawing.Size(154, 22); + this.integerToolStripMenuItem7.Text = "Add 4096 Bytes"; + this.integerToolStripMenuItem7.Value = 4096; + this.integerToolStripMenuItem7.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_X; + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(154, 22); + this.toolStripMenuItem1.Text = "Add ... Bytes"; + this.toolStripMenuItem1.Click += new System.EventHandler(this.addXBytesToolStripMenuItem_Click); + // + // insertBytesToolStripMenuItem + // + this.insertBytesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.integerToolStripMenuItem8, + this.integerToolStripMenuItem9, + this.integerToolStripMenuItem10, + this.integerToolStripMenuItem11, + this.integerToolStripMenuItem12, + this.integerToolStripMenuItem13, + this.integerToolStripMenuItem14, + this.toolStripMenuItem2}); + this.insertBytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_X; + this.insertBytesToolStripMenuItem.Name = "insertBytesToolStripMenuItem"; + this.insertBytesToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.insertBytesToolStripMenuItem.Text = "Insert Bytes"; + // + // integerToolStripMenuItem8 + // + this.integerToolStripMenuItem8.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_4; + this.integerToolStripMenuItem8.Name = "integerToolStripMenuItem8"; + this.integerToolStripMenuItem8.Size = new System.Drawing.Size(161, 22); + this.integerToolStripMenuItem8.Text = "Insert 4 Bytes"; + this.integerToolStripMenuItem8.Value = 4; + this.integerToolStripMenuItem8.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // integerToolStripMenuItem9 + // + this.integerToolStripMenuItem9.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_8; + this.integerToolStripMenuItem9.Name = "integerToolStripMenuItem9"; + this.integerToolStripMenuItem9.Size = new System.Drawing.Size(161, 22); + this.integerToolStripMenuItem9.Text = "Insert 8 Bytes"; + this.integerToolStripMenuItem9.Value = 8; + this.integerToolStripMenuItem9.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // integerToolStripMenuItem10 + // + this.integerToolStripMenuItem10.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_64; + this.integerToolStripMenuItem10.Name = "integerToolStripMenuItem10"; + this.integerToolStripMenuItem10.Size = new System.Drawing.Size(161, 22); + this.integerToolStripMenuItem10.Text = "Insert 64 Bytes"; + this.integerToolStripMenuItem10.Value = 64; + this.integerToolStripMenuItem10.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // integerToolStripMenuItem11 + // + this.integerToolStripMenuItem11.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_256; + this.integerToolStripMenuItem11.Name = "integerToolStripMenuItem11"; + this.integerToolStripMenuItem11.Size = new System.Drawing.Size(161, 22); + this.integerToolStripMenuItem11.Text = "Insert 256 Bytes"; + this.integerToolStripMenuItem11.Value = 256; + this.integerToolStripMenuItem11.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // integerToolStripMenuItem12 + // + this.integerToolStripMenuItem12.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_1024; + this.integerToolStripMenuItem12.Name = "integerToolStripMenuItem12"; + this.integerToolStripMenuItem12.Size = new System.Drawing.Size(161, 22); + this.integerToolStripMenuItem12.Text = "Insert 1024 Bytes"; + this.integerToolStripMenuItem12.Value = 1024; + this.integerToolStripMenuItem12.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // integerToolStripMenuItem13 + // + this.integerToolStripMenuItem13.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_2048; + this.integerToolStripMenuItem13.Name = "integerToolStripMenuItem13"; + this.integerToolStripMenuItem13.Size = new System.Drawing.Size(161, 22); + this.integerToolStripMenuItem13.Text = "Insert 2048 Bytes"; + this.integerToolStripMenuItem13.Value = 2048; + this.integerToolStripMenuItem13.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // integerToolStripMenuItem14 + // + this.integerToolStripMenuItem14.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_4096; + this.integerToolStripMenuItem14.Name = "integerToolStripMenuItem14"; + this.integerToolStripMenuItem14.Size = new System.Drawing.Size(161, 22); + this.integerToolStripMenuItem14.Text = "Insert 4096 Bytes"; + this.integerToolStripMenuItem14.Value = 4096; + this.integerToolStripMenuItem14.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // toolStripMenuItem2 + // + this.toolStripMenuItem2.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_X; + this.toolStripMenuItem2.Name = "toolStripMenuItem2"; + this.toolStripMenuItem2.Size = new System.Drawing.Size(161, 22); + this.toolStripMenuItem2.Text = "Insert ... Bytes"; + this.toolStripMenuItem2.Click += new System.EventHandler(this.insertXBytesToolStripMenuItem_Click); + // + // toolStripSeparator8 + // + this.toolStripSeparator8.Name = "toolStripSeparator8"; + this.toolStripSeparator8.Size = new System.Drawing.Size(266, 6); + // + // createClassFromNodesToolStripMenuItem + // + this.createClassFromNodesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Class_Add; + this.createClassFromNodesToolStripMenuItem.Name = "createClassFromNodesToolStripMenuItem"; + this.createClassFromNodesToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.createClassFromNodesToolStripMenuItem.Text = "Create Class from Nodes"; + this.createClassFromNodesToolStripMenuItem.Click += new System.EventHandler(this.createClassFromNodesToolStripMenuItem_Click); + // + // toolStripSeparator13 + // + this.toolStripSeparator13.Name = "toolStripSeparator13"; + this.toolStripSeparator13.Size = new System.Drawing.Size(266, 6); + // + // dissectNodesToolStripMenuItem + // + this.dissectNodesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Camera; + this.dissectNodesToolStripMenuItem.Name = "dissectNodesToolStripMenuItem"; + this.dissectNodesToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.dissectNodesToolStripMenuItem.Text = "Dissect Node(s)"; + this.dissectNodesToolStripMenuItem.Click += new System.EventHandler(this.dissectNodesToolStripMenuItem_Click); + // + // toolStripSeparator9 + // + this.toolStripSeparator9.Name = "toolStripSeparator9"; + this.toolStripSeparator9.Size = new System.Drawing.Size(266, 6); + // + // searchForEqualValuesToolStripMenuItem + // + this.searchForEqualValuesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Eye; + this.searchForEqualValuesToolStripMenuItem.Name = "searchForEqualValuesToolStripMenuItem"; + this.searchForEqualValuesToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.searchForEqualValuesToolStripMenuItem.Text = "Search for equal values..."; + this.searchForEqualValuesToolStripMenuItem.Click += new System.EventHandler(this.searchForEqualValuesToolStripMenuItem_Click); + // + // toolStripSeparator15 + // + this.toolStripSeparator15.Name = "toolStripSeparator15"; + this.toolStripSeparator15.Size = new System.Drawing.Size(266, 6); + // + // findOutWhatAccessesThisAddressToolStripMenuItem + // + this.findOutWhatAccessesThisAddressToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Find_Access; + this.findOutWhatAccessesThisAddressToolStripMenuItem.Name = "findOutWhatAccessesThisAddressToolStripMenuItem"; + this.findOutWhatAccessesThisAddressToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.findOutWhatAccessesThisAddressToolStripMenuItem.Text = "Find out what accesses this address..."; + this.findOutWhatAccessesThisAddressToolStripMenuItem.Click += new System.EventHandler(this.findOutWhatAccessesThisAddressToolStripMenuItem_Click); + // + // findOutWhatWritesToThisAddressToolStripMenuItem + // + this.findOutWhatWritesToThisAddressToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Find_Write; + this.findOutWhatWritesToThisAddressToolStripMenuItem.Name = "findOutWhatWritesToThisAddressToolStripMenuItem"; + this.findOutWhatWritesToThisAddressToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.findOutWhatWritesToThisAddressToolStripMenuItem.Text = "Find out what writes to this address..."; + this.findOutWhatWritesToThisAddressToolStripMenuItem.Click += new System.EventHandler(this.findOutWhatWritesToThisAddressToolStripMenuItem_Click); + // + // toolStripSeparator14 + // + this.toolStripSeparator14.Name = "toolStripSeparator14"; + this.toolStripSeparator14.Size = new System.Drawing.Size(266, 6); + // + // copyNodeToolStripMenuItem + // + this.copyNodeToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Page_Copy; + this.copyNodeToolStripMenuItem.Name = "copyNodeToolStripMenuItem"; + this.copyNodeToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.copyNodeToolStripMenuItem.Text = "Copy Node(s)"; + this.copyNodeToolStripMenuItem.Click += new System.EventHandler(this.copyNodeToolStripMenuItem_Click); + // + // pasteNodesToolStripMenuItem + // + this.pasteNodesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Page_Paste; + this.pasteNodesToolStripMenuItem.Name = "pasteNodesToolStripMenuItem"; + this.pasteNodesToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.pasteNodesToolStripMenuItem.Text = "Paste Node(s)"; + this.pasteNodesToolStripMenuItem.Click += new System.EventHandler(this.pasteNodesToolStripMenuItem_Click); + // + // toolStripSeparator10 + // + this.toolStripSeparator10.Name = "toolStripSeparator10"; + this.toolStripSeparator10.Size = new System.Drawing.Size(266, 6); + // + // removeToolStripMenuItem + // + this.removeToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Delete; + this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; + this.removeToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.removeToolStripMenuItem.Text = "Remove Node(s)"; + this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); + // + // toolStripSeparator12 + // + this.toolStripSeparator12.Name = "toolStripSeparator12"; + this.toolStripSeparator12.Size = new System.Drawing.Size(266, 6); + // + // hideNodesToolStripMenuItem + // + this.hideNodesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Eye; + this.hideNodesToolStripMenuItem.Name = "hideNodesToolStripMenuItem"; + this.hideNodesToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.hideNodesToolStripMenuItem.Text = "Hide selected Node(s)"; + this.hideNodesToolStripMenuItem.Click += new System.EventHandler(this.hideNodesToolStripMenuItem_Click); + // + // unhideNodesToolStripMenuItem + // + this.unhideNodesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.unhideChildNodesToolStripMenuItem, + this.unhideNodesAboveToolStripMenuItem, + this.unhideNodesBelowToolStripMenuItem}); + this.unhideNodesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Eye; + this.unhideNodesToolStripMenuItem.Name = "unhideNodesToolStripMenuItem"; + this.unhideNodesToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.unhideNodesToolStripMenuItem.Text = "Unhide..."; + // + // unhideChildNodesToolStripMenuItem + // + this.unhideChildNodesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Eye; + this.unhideChildNodesToolStripMenuItem.Name = "unhideChildNodesToolStripMenuItem"; + this.unhideChildNodesToolStripMenuItem.Size = new System.Drawing.Size(163, 22); + this.unhideChildNodesToolStripMenuItem.Text = "... Child Node(s)"; + this.unhideChildNodesToolStripMenuItem.Click += new System.EventHandler(this.unhideChildNodesToolStripMenuItem_Click); + // + // unhideNodesAboveToolStripMenuItem + // + this.unhideNodesAboveToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Eye; + this.unhideNodesAboveToolStripMenuItem.Name = "unhideNodesAboveToolStripMenuItem"; + this.unhideNodesAboveToolStripMenuItem.Size = new System.Drawing.Size(163, 22); + this.unhideNodesAboveToolStripMenuItem.Text = "... Node(s) above"; + this.unhideNodesAboveToolStripMenuItem.Click += new System.EventHandler(this.unhideNodesAboveToolStripMenuItem_Click); + // + // unhideNodesBelowToolStripMenuItem + // + this.unhideNodesBelowToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Eye; + this.unhideNodesBelowToolStripMenuItem.Name = "unhideNodesBelowToolStripMenuItem"; + this.unhideNodesBelowToolStripMenuItem.Size = new System.Drawing.Size(163, 22); + this.unhideNodesBelowToolStripMenuItem.Text = "... Node(s) below"; + this.unhideNodesBelowToolStripMenuItem.Click += new System.EventHandler(this.unhideNodesBelowToolStripMenuItem_Click); + // + // toolStripSeparator18 + // + this.toolStripSeparator18.Name = "toolStripSeparator18"; + this.toolStripSeparator18.Size = new System.Drawing.Size(266, 6); + // + // copyAddressToolStripMenuItem + // + this.copyAddressToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Page_Copy; + this.copyAddressToolStripMenuItem.Name = "copyAddressToolStripMenuItem"; + this.copyAddressToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.copyAddressToolStripMenuItem.Text = "Copy Address"; + this.copyAddressToolStripMenuItem.Click += new System.EventHandler(this.copyAddressToolStripMenuItem_Click); + // + // toolStripSeparator11 + // + this.toolStripSeparator11.Name = "toolStripSeparator11"; + this.toolStripSeparator11.Size = new System.Drawing.Size(266, 6); + // + // showCodeOfClassToolStripMenuItem + // + this.showCodeOfClassToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Page_Code_Cpp; + this.showCodeOfClassToolStripMenuItem.Name = "showCodeOfClassToolStripMenuItem"; + this.showCodeOfClassToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.showCodeOfClassToolStripMenuItem.Text = "Show C++ Code of Class"; + this.showCodeOfClassToolStripMenuItem.Click += new System.EventHandler(this.showCodeOfClassToolStripMenuItem_Click); + // + // shrinkClassToolStripMenuItem + // + this.shrinkClassToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Chart_Delete; + this.shrinkClassToolStripMenuItem.Name = "shrinkClassToolStripMenuItem"; + this.shrinkClassToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.shrinkClassToolStripMenuItem.Text = "Shrink Class"; + this.shrinkClassToolStripMenuItem.Click += new System.EventHandler(this.shrinkClassToolStripMenuItem_Click); + // + // toolStrip + // + this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.attachToProcessToolStripSplitButton, + this.toolStripSeparator6, + this.openProjectToolStripButton, + this.saveToolStripButton, + this.toolStripSeparator7, + this.newClassToolStripButton, + this.addBytesToolStripDropDownButton, + this.insertBytesToolStripDropDownButton, + this.nodeTypesToolStripSeparator}); + this.toolStrip.Location = new System.Drawing.Point(0, 24); + this.toolStrip.Name = "toolStrip"; + this.toolStrip.Size = new System.Drawing.Size(1141, 25); + this.toolStrip.TabIndex = 3; + // + // attachToProcessToolStripSplitButton + // + this.attachToProcessToolStripSplitButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.attachToProcessToolStripSplitButton.Image = global::ReClassNET.Properties.Resources.B16x16_Magnifier; + this.attachToProcessToolStripSplitButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.attachToProcessToolStripSplitButton.Name = "attachToProcessToolStripSplitButton"; + this.attachToProcessToolStripSplitButton.Size = new System.Drawing.Size(32, 22); + this.attachToProcessToolStripSplitButton.ToolTipText = "Attach to Process..."; + this.attachToProcessToolStripSplitButton.ButtonClick += new System.EventHandler(this.attachToProcessToolStripSplitButton_ButtonClick); + this.attachToProcessToolStripSplitButton.DropDownClosed += new System.EventHandler(this.attachToProcessToolStripSplitButton_DropDownClosed); + this.attachToProcessToolStripSplitButton.DropDownOpening += new System.EventHandler(this.attachToProcessToolStripSplitButton_DropDownOpening); + // + // toolStripSeparator6 + // + this.toolStripSeparator6.Name = "toolStripSeparator6"; + this.toolStripSeparator6.Size = new System.Drawing.Size(6, 25); + // + // openProjectToolStripButton + // + this.openProjectToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.openProjectToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Folder; + this.openProjectToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.openProjectToolStripButton.Name = "openProjectToolStripButton"; + this.openProjectToolStripButton.Size = new System.Drawing.Size(23, 22); + this.openProjectToolStripButton.ToolTipText = "Open Project..."; + this.openProjectToolStripButton.Click += new System.EventHandler(this.openProjectToolStripMenuItem_Click); + // + // saveToolStripButton + // + this.saveToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.saveToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Save; + this.saveToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveToolStripButton.Name = "saveToolStripButton"; + this.saveToolStripButton.Size = new System.Drawing.Size(23, 22); + this.saveToolStripButton.ToolTipText = "Save Project"; + this.saveToolStripButton.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); + // + // toolStripSeparator7 + // + this.toolStripSeparator7.Name = "toolStripSeparator7"; + this.toolStripSeparator7.Size = new System.Drawing.Size(6, 25); + // + // newClassToolStripButton + // + this.newClassToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.newClassToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Class_Add; + this.newClassToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.newClassToolStripButton.Name = "newClassToolStripButton"; + this.newClassToolStripButton.Size = new System.Drawing.Size(23, 22); + this.newClassToolStripButton.Text = "addClassToolStripButton"; + this.newClassToolStripButton.ToolTipText = "Add a new class to this project"; + this.newClassToolStripButton.Click += new System.EventHandler(this.newClassToolStripButton_Click); + // + // addBytesToolStripDropDownButton + // + this.addBytesToolStripDropDownButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.addBytesToolStripDropDownButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.add4BytesToolStripMenuItem, + this.add8BytesToolStripMenuItem, + this.add64BytesToolStripMenuItem, + this.add256BytesToolStripMenuItem, + this.add1024BytesToolStripMenuItem, + this.add2048BytesToolStripMenuItem, + this.add4096BytesToolStripMenuItem, + this.addXBytesToolStripMenuItem}); + this.addBytesToolStripDropDownButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_X; + this.addBytesToolStripDropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.addBytesToolStripDropDownButton.Name = "addBytesToolStripDropDownButton"; + this.addBytesToolStripDropDownButton.Size = new System.Drawing.Size(29, 22); + // + // add4BytesToolStripMenuItem + // + this.add4BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_4; + this.add4BytesToolStripMenuItem.Name = "add4BytesToolStripMenuItem"; + this.add4BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + this.add4BytesToolStripMenuItem.Tag = ""; + this.add4BytesToolStripMenuItem.Text = "Add 4 Bytes"; + this.add4BytesToolStripMenuItem.Value = 4; + this.add4BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // add8BytesToolStripMenuItem + // + this.add8BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_8; + this.add8BytesToolStripMenuItem.Name = "add8BytesToolStripMenuItem"; + this.add8BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + this.add8BytesToolStripMenuItem.Text = "Add 8 Bytes"; + this.add8BytesToolStripMenuItem.Value = 8; + this.add8BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // add64BytesToolStripMenuItem + // + this.add64BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_64; + this.add64BytesToolStripMenuItem.Name = "add64BytesToolStripMenuItem"; + this.add64BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + this.add64BytesToolStripMenuItem.Text = "Add 64 Bytes"; + this.add64BytesToolStripMenuItem.Value = 64; + this.add64BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // add256BytesToolStripMenuItem + // + this.add256BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_256; + this.add256BytesToolStripMenuItem.Name = "add256BytesToolStripMenuItem"; + this.add256BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + this.add256BytesToolStripMenuItem.Text = "Add 256 Bytes"; + this.add256BytesToolStripMenuItem.Value = 256; + this.add256BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // add1024BytesToolStripMenuItem + // + this.add1024BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_1024; + this.add1024BytesToolStripMenuItem.Name = "add1024BytesToolStripMenuItem"; + this.add1024BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + this.add1024BytesToolStripMenuItem.Text = "Add 1024 Bytes"; + this.add1024BytesToolStripMenuItem.Value = 1024; + this.add1024BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // add2048BytesToolStripMenuItem + // + this.add2048BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_2048; + this.add2048BytesToolStripMenuItem.Name = "add2048BytesToolStripMenuItem"; + this.add2048BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + this.add2048BytesToolStripMenuItem.Text = "Add 2048 Bytes"; + this.add2048BytesToolStripMenuItem.Value = 2048; + this.add2048BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // add4096BytesToolStripMenuItem + // + this.add4096BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_4096; + this.add4096BytesToolStripMenuItem.Name = "add4096BytesToolStripMenuItem"; + this.add4096BytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + this.add4096BytesToolStripMenuItem.Text = "Add 4096 Bytes"; + this.add4096BytesToolStripMenuItem.Value = 4096; + this.add4096BytesToolStripMenuItem.Click += new System.EventHandler(this.addBytesToolStripMenuItem_Click); + // + // addXBytesToolStripMenuItem + // + this.addXBytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add_Bytes_X; + this.addXBytesToolStripMenuItem.Name = "addXBytesToolStripMenuItem"; + this.addXBytesToolStripMenuItem.Size = new System.Drawing.Size(154, 22); + this.addXBytesToolStripMenuItem.Text = "Add ... Bytes"; + this.addXBytesToolStripMenuItem.Click += new System.EventHandler(this.addXBytesToolStripMenuItem_Click); + // + // insertBytesToolStripDropDownButton + // + this.insertBytesToolStripDropDownButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.insertBytesToolStripDropDownButton.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.insert4BytesToolStripMenuItem, + this.insert8BytesToolStripMenuItem, + this.insert64BytesToolStripMenuItem, + this.insert256BytesToolStripMenuItem, + this.insert1024BytesToolStripMenuItem, + this.insert2048BytesToolStripMenuItem, + this.insert4096BytesToolStripMenuItem, + this.insertXBytesToolStripMenuItem}); + this.insertBytesToolStripDropDownButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_X; + this.insertBytesToolStripDropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.insertBytesToolStripDropDownButton.Name = "insertBytesToolStripDropDownButton"; + this.insertBytesToolStripDropDownButton.Size = new System.Drawing.Size(29, 22); + this.insertBytesToolStripDropDownButton.ToolTipText = "Insert bytes at selected position"; + // + // insert4BytesToolStripMenuItem + // + this.insert4BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_4; + this.insert4BytesToolStripMenuItem.Name = "insert4BytesToolStripMenuItem"; + this.insert4BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); + this.insert4BytesToolStripMenuItem.Tag = ""; + this.insert4BytesToolStripMenuItem.Text = "Insert 4 Bytes"; + this.insert4BytesToolStripMenuItem.Value = 4; + this.insert4BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // insert8BytesToolStripMenuItem + // + this.insert8BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_8; + this.insert8BytesToolStripMenuItem.Name = "insert8BytesToolStripMenuItem"; + this.insert8BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); + this.insert8BytesToolStripMenuItem.Text = "Insert 8 Bytes"; + this.insert8BytesToolStripMenuItem.Value = 8; + this.insert8BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // insert64BytesToolStripMenuItem + // + this.insert64BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_64; + this.insert64BytesToolStripMenuItem.Name = "insert64BytesToolStripMenuItem"; + this.insert64BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); + this.insert64BytesToolStripMenuItem.Text = "Insert 64 Bytes"; + this.insert64BytesToolStripMenuItem.Value = 64; + this.insert64BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // insert256BytesToolStripMenuItem + // + this.insert256BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_256; + this.insert256BytesToolStripMenuItem.Name = "insert256BytesToolStripMenuItem"; + this.insert256BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); + this.insert256BytesToolStripMenuItem.Text = "Insert 256 Bytes"; + this.insert256BytesToolStripMenuItem.Value = 256; + this.insert256BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // insert1024BytesToolStripMenuItem + // + this.insert1024BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_1024; + this.insert1024BytesToolStripMenuItem.Name = "insert1024BytesToolStripMenuItem"; + this.insert1024BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); + this.insert1024BytesToolStripMenuItem.Text = "Insert 1024 Bytes"; + this.insert1024BytesToolStripMenuItem.Value = 1024; + this.insert1024BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // insert2048BytesToolStripMenuItem + // + this.insert2048BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_2048; + this.insert2048BytesToolStripMenuItem.Name = "insert2048BytesToolStripMenuItem"; + this.insert2048BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); + this.insert2048BytesToolStripMenuItem.Text = "Insert 2048 Bytes"; + this.insert2048BytesToolStripMenuItem.Value = 2048; + this.insert2048BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // insert4096BytesToolStripMenuItem + // + this.insert4096BytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_4096; + this.insert4096BytesToolStripMenuItem.Name = "insert4096BytesToolStripMenuItem"; + this.insert4096BytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); + this.insert4096BytesToolStripMenuItem.Text = "Insert 4096 Bytes"; + this.insert4096BytesToolStripMenuItem.Value = 4096; + this.insert4096BytesToolStripMenuItem.Click += new System.EventHandler(this.insertBytesToolStripMenuItem_Click); + // + // insertXBytesToolStripMenuItem + // + this.insertXBytesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Insert_Bytes_X; + this.insertXBytesToolStripMenuItem.Name = "insertXBytesToolStripMenuItem"; + this.insertXBytesToolStripMenuItem.Size = new System.Drawing.Size(161, 22); + this.insertXBytesToolStripMenuItem.Text = "Insert ... Bytes"; + this.insertXBytesToolStripMenuItem.Click += new System.EventHandler(this.insertXBytesToolStripMenuItem_Click); + // + // nodeTypesToolStripSeparator + // + this.nodeTypesToolStripSeparator.Name = "nodeTypesToolStripSeparator"; + this.nodeTypesToolStripSeparator.Size = new System.Drawing.Size(6, 25); + // + // statusStrip + // + this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.processInfoToolStripStatusLabel, + this.infoToolStripStatusLabel}); + this.statusStrip.Location = new System.Drawing.Point(0, 573); + this.statusStrip.Name = "statusStrip"; + this.statusStrip.Size = new System.Drawing.Size(1141, 22); + this.statusStrip.TabIndex = 1; + // + // processInfoToolStripStatusLabel + // + this.processInfoToolStripStatusLabel.Name = "processInfoToolStripStatusLabel"; + this.processInfoToolStripStatusLabel.Size = new System.Drawing.Size(112, 17); + this.processInfoToolStripStatusLabel.Text = "No process selected"; + // + // infoToolStripStatusLabel + // + this.infoToolStripStatusLabel.Name = "infoToolStripStatusLabel"; + this.infoToolStripStatusLabel.Size = new System.Drawing.Size(23, 17); + this.infoToolStripStatusLabel.Text = "<>"; + this.infoToolStripStatusLabel.Visible = false; + // + // mainMenuStrip + // + this.mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.processToolStripMenuItem, + this.projectToolStripMenuItem, + this.helpToolStripMenuItem}); + this.mainMenuStrip.Location = new System.Drawing.Point(0, 0); + this.mainMenuStrip.Name = "mainMenuStrip"; + this.mainMenuStrip.Size = new System.Drawing.Size(1141, 24); + this.mainMenuStrip.TabIndex = 2; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.attachToProcessToolStripMenuItem, + this.reattachToProcessToolStripMenuItem, + this.detachToolStripMenuItem, + this.toolStripSeparator1, + this.openProjectToolStripMenuItem, + this.mergeWithProjectToolStripMenuItem, + this.clearProjectToolStripMenuItem, + this.toolStripSeparator2, + this.saveToolStripMenuItem, + this.saveAsToolStripMenuItem, + this.toolStripSeparator3, + this.settingsToolStripMenuItem, + this.pluginsToolStripMenuItem, + this.toolStripSeparator5, + this.quitToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + this.fileToolStripMenuItem.DropDownOpening += new System.EventHandler(this.fileToolStripMenuItem_DropDownOpening); + // + // attachToProcessToolStripMenuItem + // + this.attachToProcessToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Magnifier; + this.attachToProcessToolStripMenuItem.Name = "attachToProcessToolStripMenuItem"; + this.attachToProcessToolStripMenuItem.Size = new System.Drawing.Size(195, 22); + this.attachToProcessToolStripMenuItem.Text = "Attach to Process..."; + this.attachToProcessToolStripMenuItem.Click += new System.EventHandler(this.attachToProcessToolStripSplitButton_ButtonClick); + // + // reattachToProcessToolStripMenuItem + // + this.reattachToProcessToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Magnifier_Arrow; + this.reattachToProcessToolStripMenuItem.Name = "reattachToProcessToolStripMenuItem"; + this.reattachToProcessToolStripMenuItem.Size = new System.Drawing.Size(195, 22); + this.reattachToProcessToolStripMenuItem.Text = "<>"; + this.reattachToProcessToolStripMenuItem.Click += new System.EventHandler(this.reattachToProcessToolStripMenuItem_Click); + // + // detachToolStripMenuItem + // + this.detachToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Magnifier_Remove; + this.detachToolStripMenuItem.Name = "detachToolStripMenuItem"; + this.detachToolStripMenuItem.Size = new System.Drawing.Size(195, 22); + this.detachToolStripMenuItem.Text = "Detach"; + this.detachToolStripMenuItem.Click += new System.EventHandler(this.detachToolStripMenuItem_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(192, 6); + // + // openProjectToolStripMenuItem + // + this.openProjectToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Folder; + this.openProjectToolStripMenuItem.Name = "openProjectToolStripMenuItem"; + this.openProjectToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); + this.openProjectToolStripMenuItem.Size = new System.Drawing.Size(195, 22); + this.openProjectToolStripMenuItem.Text = "Open Project..."; + this.openProjectToolStripMenuItem.Click += new System.EventHandler(this.openProjectToolStripMenuItem_Click); + // + // mergeWithProjectToolStripMenuItem + // + this.mergeWithProjectToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Folder_Add; + this.mergeWithProjectToolStripMenuItem.Name = "mergeWithProjectToolStripMenuItem"; + this.mergeWithProjectToolStripMenuItem.Size = new System.Drawing.Size(195, 22); + this.mergeWithProjectToolStripMenuItem.Text = "Merge with Project..."; + this.mergeWithProjectToolStripMenuItem.Click += new System.EventHandler(this.mergeWithProjectToolStripMenuItem_Click); + // + // clearProjectToolStripMenuItem + // + this.clearProjectToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Arrow_Refresh; + this.clearProjectToolStripMenuItem.Name = "clearProjectToolStripMenuItem"; + this.clearProjectToolStripMenuItem.Size = new System.Drawing.Size(195, 22); + this.clearProjectToolStripMenuItem.Text = "Clear Project"; + this.clearProjectToolStripMenuItem.Click += new System.EventHandler(this.clearProjectToolStripMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(192, 6); + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Save; + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); + this.saveToolStripMenuItem.Size = new System.Drawing.Size(195, 22); + this.saveToolStripMenuItem.Text = "Save"; + this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); + // + // saveAsToolStripMenuItem + // + this.saveAsToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Save_As; + this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; + this.saveAsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) + | System.Windows.Forms.Keys.S))); + this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(195, 22); + this.saveAsToolStripMenuItem.Text = "Save as..."; + this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click); + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(192, 6); + // + // settingsToolStripMenuItem + // + this.settingsToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Cogs; + this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; + this.settingsToolStripMenuItem.Size = new System.Drawing.Size(195, 22); + this.settingsToolStripMenuItem.Text = "Settings..."; + this.settingsToolStripMenuItem.Click += new System.EventHandler(this.settingsToolStripMenuItem_Click); + // + // pluginsToolStripMenuItem + // + this.pluginsToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Plugin; + this.pluginsToolStripMenuItem.Name = "pluginsToolStripMenuItem"; + this.pluginsToolStripMenuItem.Size = new System.Drawing.Size(195, 22); + this.pluginsToolStripMenuItem.Text = "Plugins..."; + this.pluginsToolStripMenuItem.Click += new System.EventHandler(this.pluginsToolStripButton_Click); + // + // toolStripSeparator5 + // + this.toolStripSeparator5.Name = "toolStripSeparator5"; + this.toolStripSeparator5.Size = new System.Drawing.Size(192, 6); + // + // quitToolStripMenuItem + // + this.quitToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Quit; + this.quitToolStripMenuItem.Name = "quitToolStripMenuItem"; + this.quitToolStripMenuItem.Size = new System.Drawing.Size(195, 22); + this.quitToolStripMenuItem.Text = "Quit"; + this.quitToolStripMenuItem.Click += new System.EventHandler(this.quitToolStripMenuItem_Click); + // + // processToolStripMenuItem + // + this.processToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.processInformationsToolStripMenuItem, + this.memorySearcherToolStripMenuItem, + this.namedAddressesToolStripMenuItem, + this.toolStripSeparator23, + this.isLittleEndianToolStripMenuItem, + this.toolStripSeparator17, + this.loadSymbolToolStripMenuItem, + this.loadSymbolsToolStripMenuItem, + this.toolStripSeparator4, + this.resumeProcessToolStripMenuItem, + this.suspendProcessToolStripMenuItem, + this.terminateProcessToolStripMenuItem}); + this.processToolStripMenuItem.Name = "processToolStripMenuItem"; + this.processToolStripMenuItem.Size = new System.Drawing.Size(59, 20); + this.processToolStripMenuItem.Text = "Process"; + // + // processInformationsToolStripMenuItem + // + this.processInformationsToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Category; + this.processInformationsToolStripMenuItem.Name = "processInformationsToolStripMenuItem"; + this.processInformationsToolStripMenuItem.Size = new System.Drawing.Size(194, 22); + this.processInformationsToolStripMenuItem.Text = "Process Informations..."; + this.processInformationsToolStripMenuItem.Click += new System.EventHandler(this.memoryViewerToolStripMenuItem_Click); + // + // memorySearcherToolStripMenuItem + // + this.memorySearcherToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Eye; + this.memorySearcherToolStripMenuItem.Name = "memorySearcherToolStripMenuItem"; + this.memorySearcherToolStripMenuItem.Size = new System.Drawing.Size(194, 22); + this.memorySearcherToolStripMenuItem.Text = "Memory Searcher..."; + this.memorySearcherToolStripMenuItem.Click += new System.EventHandler(this.memorySearcherToolStripMenuItem_Click); + // + // namedAddressesToolStripMenuItem + // + this.namedAddressesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Custom_Type; + this.namedAddressesToolStripMenuItem.Name = "namedAddressesToolStripMenuItem"; + this.namedAddressesToolStripMenuItem.Size = new System.Drawing.Size(194, 22); + this.namedAddressesToolStripMenuItem.Text = "Named Addresses..."; + this.namedAddressesToolStripMenuItem.Click += new System.EventHandler(this.namedAddressesToolStripMenuItem_Click); + // + // toolStripSeparator23 + // + this.toolStripSeparator23.Name = "toolStripSeparator23"; + this.toolStripSeparator23.Size = new System.Drawing.Size(191, 6); + // + // isLittleEndianToolStripMenuItem + // + this.isLittleEndianToolStripMenuItem.CheckOnClick = true; + this.isLittleEndianToolStripMenuItem.Name = "isLittleEndianToolStripMenuItem"; + this.isLittleEndianToolStripMenuItem.Size = new System.Drawing.Size(194, 22); + this.isLittleEndianToolStripMenuItem.Text = "Is Little Endian"; + this.isLittleEndianToolStripMenuItem.Click += new System.EventHandler(this.isLittleEndianToolStripMenuItem_Click); + // + // toolStripSeparator17 + // + this.toolStripSeparator17.Name = "toolStripSeparator17"; + this.toolStripSeparator17.Size = new System.Drawing.Size(191, 6); + // + // loadSymbolToolStripMenuItem + // + this.loadSymbolToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Pdb; + this.loadSymbolToolStripMenuItem.Name = "loadSymbolToolStripMenuItem"; + this.loadSymbolToolStripMenuItem.Size = new System.Drawing.Size(194, 22); + this.loadSymbolToolStripMenuItem.Text = "Load Symbol..."; + this.loadSymbolToolStripMenuItem.Click += new System.EventHandler(this.loadSymbolToolStripMenuItem_Click); + // + // loadSymbolsToolStripMenuItem + // + this.loadSymbolsToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("loadSymbolsToolStripMenuItem.Image"))); + this.loadSymbolsToolStripMenuItem.Name = "loadSymbolsToolStripMenuItem"; + this.loadSymbolsToolStripMenuItem.Size = new System.Drawing.Size(194, 22); + this.loadSymbolsToolStripMenuItem.Text = "Load all Symbols"; + this.loadSymbolsToolStripMenuItem.Click += new System.EventHandler(this.loadSymbolsToolStripMenuItem_Click); + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(191, 6); + // + // resumeProcessToolStripMenuItem + // + this.resumeProcessToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Control_Play; + this.resumeProcessToolStripMenuItem.Name = "resumeProcessToolStripMenuItem"; + this.resumeProcessToolStripMenuItem.Size = new System.Drawing.Size(194, 22); + this.resumeProcessToolStripMenuItem.Text = "Resume"; + this.resumeProcessToolStripMenuItem.Click += new System.EventHandler(this.ControlRemoteProcessToolStripMenuItem_Click); + // + // suspendProcessToolStripMenuItem + // + this.suspendProcessToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Control_Pause; + this.suspendProcessToolStripMenuItem.Name = "suspendProcessToolStripMenuItem"; + this.suspendProcessToolStripMenuItem.Size = new System.Drawing.Size(194, 22); + this.suspendProcessToolStripMenuItem.Text = "Suspend"; + this.suspendProcessToolStripMenuItem.Click += new System.EventHandler(this.ControlRemoteProcessToolStripMenuItem_Click); + // + // terminateProcessToolStripMenuItem + // + this.terminateProcessToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Control_Stop; + this.terminateProcessToolStripMenuItem.Name = "terminateProcessToolStripMenuItem"; + this.terminateProcessToolStripMenuItem.Size = new System.Drawing.Size(194, 22); + this.terminateProcessToolStripMenuItem.Text = "Kill"; + this.terminateProcessToolStripMenuItem.Click += new System.EventHandler(this.ControlRemoteProcessToolStripMenuItem_Click); + // + // projectToolStripMenuItem + // + this.projectToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.goToClassToolStripMenuItem, + this.cleanUnusedClassesToolStripMenuItem, + this.showEnumsToolStripMenuItem, + this.toolStripSeparator16, + this.generateCppCodeToolStripMenuItem, + this.generateCSharpCodeToolStripMenuItem}); + this.projectToolStripMenuItem.Name = "projectToolStripMenuItem"; + this.projectToolStripMenuItem.Size = new System.Drawing.Size(56, 20); + this.projectToolStripMenuItem.Text = "Project"; + // + // goToClassToolStripMenuItem + // + this.goToClassToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Class_Type; + this.goToClassToolStripMenuItem.Name = "goToClassToolStripMenuItem"; + this.goToClassToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); + this.goToClassToolStripMenuItem.Size = new System.Drawing.Size(198, 22); + this.goToClassToolStripMenuItem.Text = "Go to class..."; + this.goToClassToolStripMenuItem.Click += new System.EventHandler(this.goToClassToolStripMenuItem_Click); + // + // cleanUnusedClassesToolStripMenuItem + // + this.cleanUnusedClassesToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Chart_Delete; + this.cleanUnusedClassesToolStripMenuItem.Name = "cleanUnusedClassesToolStripMenuItem"; + this.cleanUnusedClassesToolStripMenuItem.Size = new System.Drawing.Size(198, 22); + this.cleanUnusedClassesToolStripMenuItem.Text = "Remove unused classes"; + this.cleanUnusedClassesToolStripMenuItem.Click += new System.EventHandler(this.cleanUnusedClassesToolStripMenuItem_Click); + // + // showEnumsToolStripMenuItem + // + this.showEnumsToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Category; + this.showEnumsToolStripMenuItem.Name = "showEnumsToolStripMenuItem"; + this.showEnumsToolStripMenuItem.Size = new System.Drawing.Size(198, 22); + this.showEnumsToolStripMenuItem.Text = "Show Enums..."; + this.showEnumsToolStripMenuItem.Click += new System.EventHandler(this.showEnumsToolStripMenuItem_Click); + // + // toolStripSeparator16 + // + this.toolStripSeparator16.Name = "toolStripSeparator16"; + this.toolStripSeparator16.Size = new System.Drawing.Size(195, 6); + // + // generateCppCodeToolStripMenuItem + // + this.generateCppCodeToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Page_Code_Cpp; + this.generateCppCodeToolStripMenuItem.Name = "generateCppCodeToolStripMenuItem"; + this.generateCppCodeToolStripMenuItem.Size = new System.Drawing.Size(198, 22); + this.generateCppCodeToolStripMenuItem.Text = "Generate C++ Code..."; + this.generateCppCodeToolStripMenuItem.Click += new System.EventHandler(this.generateCppCodeToolStripMenuItem_Click); + // + // generateCSharpCodeToolStripMenuItem + // + this.generateCSharpCodeToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Page_Code_Csharp; + this.generateCSharpCodeToolStripMenuItem.Name = "generateCSharpCodeToolStripMenuItem"; + this.generateCSharpCodeToolStripMenuItem.Size = new System.Drawing.Size(198, 22); + this.generateCSharpCodeToolStripMenuItem.Text = "Generate C# Code..."; + this.generateCSharpCodeToolStripMenuItem.Click += new System.EventHandler(this.generateCSharpCodeToolStripMenuItem_Click); + // + // helpToolStripMenuItem + // + this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.aboutToolStripMenuItem}); + this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; + this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.helpToolStripMenuItem.Text = "Help"; + // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Information; + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(116, 22); + this.aboutToolStripMenuItem.Text = "About..."; + this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); + // + // MainForm + // + this.AllowDrop = true; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1141, 595); + this.Controls.Add(this.splitContainer); + this.Controls.Add(this.toolStrip); + this.Controls.Add(this.statusStrip); + this.Controls.Add(this.mainMenuStrip); + this.MainMenuStrip = this.mainMenuStrip; + this.MinimumSize = new System.Drawing.Size(200, 100); + this.Name = "MainForm"; + this.Text = "ReClass.NET"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); + this.DragDrop += new System.Windows.Forms.DragEventHandler(this.MainForm_DragDrop); + this.DragEnter += new System.Windows.Forms.DragEventHandler(this.MainForm_DragEnter); + this.splitContainer.Panel1.ResumeLayout(false); + this.splitContainer.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); + this.splitContainer.ResumeLayout(false); + this.projectClassContextMenuStrip.ResumeLayout(false); + this.projectClassesContextMenuStrip.ResumeLayout(false); + this.projectEnumContextMenuStrip.ResumeLayout(false); + this.projectEnumsContextMenuStrip.ResumeLayout(false); + this.selectedNodeContextMenuStrip.ResumeLayout(false); + this.toolStrip.ResumeLayout(false); + this.toolStrip.PerformLayout(); + this.statusStrip.ResumeLayout(false); + this.statusStrip.PerformLayout(); + this.mainMenuStrip.ResumeLayout(false); + this.mainMenuStrip.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + + #endregion + + private MemoryViewControl memoryViewControl; + private System.Windows.Forms.StatusStrip statusStrip; + private System.Windows.Forms.MenuStrip mainMenuStrip; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem attachToProcessToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem clearProjectToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openProjectToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripMenuItem quitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem processToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem processInformationsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripMenuItem resumeProcessToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem suspendProcessToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem terminateProcessToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; + private System.Windows.Forms.ToolStripMenuItem loadSymbolsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; + private System.Windows.Forms.ToolStrip toolStrip; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator6; + private System.Windows.Forms.SplitContainer splitContainer; + private System.Windows.Forms.ToolStripStatusLabel processInfoToolStripStatusLabel; + private System.Windows.Forms.ToolStripMenuItem pluginsToolStripMenuItem; + private System.Windows.Forms.ToolStripButton saveToolStripButton; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator7; + private System.Windows.Forms.ToolStripButton newClassToolStripButton; + private System.Windows.Forms.ToolStripDropDownButton addBytesToolStripDropDownButton; + private IntegerToolStripMenuItem add4BytesToolStripMenuItem; + private IntegerToolStripMenuItem add8BytesToolStripMenuItem; + private IntegerToolStripMenuItem add64BytesToolStripMenuItem; + private IntegerToolStripMenuItem add256BytesToolStripMenuItem; + private IntegerToolStripMenuItem add1024BytesToolStripMenuItem; + private IntegerToolStripMenuItem add2048BytesToolStripMenuItem; + private IntegerToolStripMenuItem add4096BytesToolStripMenuItem; + private System.Windows.Forms.ToolStripDropDownButton insertBytesToolStripDropDownButton; + private IntegerToolStripMenuItem insert4BytesToolStripMenuItem; + private IntegerToolStripMenuItem insert8BytesToolStripMenuItem; + private IntegerToolStripMenuItem insert64BytesToolStripMenuItem; + private IntegerToolStripMenuItem insert256BytesToolStripMenuItem; + private IntegerToolStripMenuItem insert1024BytesToolStripMenuItem; + private IntegerToolStripMenuItem insert2048BytesToolStripMenuItem; + private IntegerToolStripMenuItem insert4096BytesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addXBytesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem insertXBytesToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator nodeTypesToolStripSeparator; + private ProjectView projectView; + private System.Windows.Forms.ToolStripMenuItem projectToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem cleanUnusedClassesToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator16; + private System.Windows.Forms.ToolStripMenuItem generateCppCodeToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem generateCSharpCodeToolStripMenuItem; + private System.Windows.Forms.Timer processUpdateTimer; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator17; + private System.Windows.Forms.ToolStripMenuItem loadSymbolToolStripMenuItem; + private System.Windows.Forms.ToolStripButton openProjectToolStripButton; + private System.Windows.Forms.ToolStripStatusLabel infoToolStripStatusLabel; + private System.Windows.Forms.ToolStripMenuItem mergeWithProjectToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem detachToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem memorySearcherToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem reattachToProcessToolStripMenuItem; + private System.Windows.Forms.ToolStripSplitButton attachToProcessToolStripSplitButton; + private System.Windows.Forms.ToolStripMenuItem namedAddressesToolStripMenuItem; + private System.Windows.Forms.ContextMenuStrip selectedNodeContextMenuStrip; + private System.Windows.Forms.ToolStripMenuItem changeTypeToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addBytesToolStripMenuItem; + private IntegerToolStripMenuItem integerToolStripMenuItem1; + private IntegerToolStripMenuItem integerToolStripMenuItem2; + private IntegerToolStripMenuItem integerToolStripMenuItem3; + private IntegerToolStripMenuItem integerToolStripMenuItem4; + private IntegerToolStripMenuItem integerToolStripMenuItem5; + private IntegerToolStripMenuItem integerToolStripMenuItem6; + private IntegerToolStripMenuItem integerToolStripMenuItem7; + private System.Windows.Forms.ToolStripMenuItem insertBytesToolStripMenuItem; + private IntegerToolStripMenuItem integerToolStripMenuItem8; + private IntegerToolStripMenuItem integerToolStripMenuItem9; + private IntegerToolStripMenuItem integerToolStripMenuItem10; + private IntegerToolStripMenuItem integerToolStripMenuItem11; + private IntegerToolStripMenuItem integerToolStripMenuItem12; + private IntegerToolStripMenuItem integerToolStripMenuItem13; + private IntegerToolStripMenuItem integerToolStripMenuItem14; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator8; + private System.Windows.Forms.ToolStripMenuItem createClassFromNodesToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator13; + private System.Windows.Forms.ToolStripMenuItem dissectNodesToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator9; + private System.Windows.Forms.ToolStripMenuItem searchForEqualValuesToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator15; + private System.Windows.Forms.ToolStripMenuItem findOutWhatAccessesThisAddressToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem findOutWhatWritesToThisAddressToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator14; + private System.Windows.Forms.ToolStripMenuItem copyNodeToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem pasteNodesToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator10; + private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator12; + private System.Windows.Forms.ToolStripMenuItem hideNodesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem unhideNodesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem unhideChildNodesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem unhideNodesAboveToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem unhideNodesBelowToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator18; + private System.Windows.Forms.ToolStripMenuItem copyAddressToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator11; + private System.Windows.Forms.ToolStripMenuItem showCodeOfClassToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem shrinkClassToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2; + private System.Windows.Forms.ToolStripMenuItem goToClassToolStripMenuItem; + private System.Windows.Forms.ContextMenuStrip projectClassContextMenuStrip; + private System.Windows.Forms.ToolStripMenuItem deleteClassToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator19; + private System.Windows.Forms.ToolStripMenuItem removeUnusedClassesToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator20; + private System.Windows.Forms.ToolStripMenuItem showCodeOfClassToolStripMenuItem2; + private System.Windows.Forms.ContextMenuStrip projectClassesContextMenuStrip; + private System.Windows.Forms.ToolStripMenuItem enableHierarchyViewToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem autoExpandHierarchyViewToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator21; + private System.Windows.Forms.ToolStripMenuItem expandAllClassesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem collapseAllClassesToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator22; + private System.Windows.Forms.ToolStripMenuItem addNewClassToolStripMenuItem; + private System.Windows.Forms.ContextMenuStrip projectEnumContextMenuStrip; + private System.Windows.Forms.ToolStripMenuItem editEnumToolStripMenuItem; + private System.Windows.Forms.ContextMenuStrip projectEnumsContextMenuStrip; + private System.Windows.Forms.ToolStripMenuItem editEnumsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem showEnumsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator23; + private System.Windows.Forms.ToolStripMenuItem isLittleEndianToolStripMenuItem; + } +} + diff --git a/ReClass.NET/Forms/MainForm.Functions.cs b/ReClass.NET/Forms/MainForm.Functions.cs new file mode 100644 index 00000000..84f1b53a --- /dev/null +++ b/ReClass.NET/Forms/MainForm.Functions.cs @@ -0,0 +1,560 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.Contracts; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using ReClassNET.CodeGenerator; +using ReClassNET.Controls; +using ReClassNET.DataExchange.ReClass; +using ReClassNET.Extensions; +using ReClassNET.Logger; +using ReClassNET.Memory; +using ReClassNET.Nodes; +using ReClassNET.Project; +using ReClassNET.UI; + +namespace ReClassNET.Forms +{ + public partial class MainForm + { + public void ShowPartialCodeGeneratorForm(IReadOnlyList partialClasses) + { + Contract.Requires(partialClasses != null); + + ShowCodeGeneratorForm(partialClasses, new EnumDescription[0], new CppCodeGenerator(currentProject.TypeMapping)); + } + + public void ShowCodeGeneratorForm(ICodeGenerator generator) + { + Contract.Requires(generator != null); + + ShowCodeGeneratorForm(currentProject.Classes, currentProject.Enums, generator); + } + + public void ShowCodeGeneratorForm(IReadOnlyList classes, IReadOnlyList enums, ICodeGenerator generator) + { + Contract.Requires(classes != null); + Contract.Requires(generator != null); + Contract.Requires(enums != null); + + new CodeForm(generator, classes, enums, Program.Logger).Show(); + } + + public void AttachToProcess(string processName) + { + var info = Program.CoreFunctions.EnumerateProcesses().FirstOrDefault(p => string.Equals(p.Name, processName, StringComparison.OrdinalIgnoreCase)); + if (info == null) + { + MessageBox.Show($"Process '{processName}' could not be found.", Constants.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error); + + Program.Settings.LastProcess = string.Empty; + } + else + { + AttachToProcess(info); + } + } + + public void AttachToProcess(ProcessInfo info) + { + Contract.Requires(info != null); + + Program.RemoteProcess.Close(); + + Program.RemoteProcess.Open(info); + Program.RemoteProcess.UpdateProcessInformations(); + + Program.Settings.LastProcess = Program.RemoteProcess.UnderlayingProcess.Name; + } + + /// Sets the current project. + /// The new project. + public void SetProject(ReClassNetProject newProject) + { + Contract.Requires(newProject != null); + + if (currentProject == newProject) + { + return; + } + + if (currentProject != null) + { + ClassNode.ClassCreated -= currentProject.AddClass; + } + + void UpdateClassNodes(BaseNode node) + { + projectView.UpdateClassNode((ClassNode)node); + } + + currentProject = newProject; + currentProject.ClassAdded += c => + { + projectView.AddClass(c); + c.NodesChanged += UpdateClassNodes; + c.NameChanged += UpdateClassNodes; + }; + currentProject.ClassRemoved += c => + { + projectView.RemoveClass(c); + c.NodesChanged -= UpdateClassNodes; + c.NameChanged -= UpdateClassNodes; + }; + currentProject.EnumAdded += e => { projectView.AddEnum(e); }; + + ClassNode.ClassCreated += currentProject.AddClass; + + projectView.Clear(); + projectView.AddEnums(currentProject.Enums); + projectView.AddClasses(currentProject.Classes); + CurrentClassNode = currentProject.Classes.FirstOrDefault(); + } + + /// Opens the and calls with the result. + /// The title of the input form. + /// The function to call afterwards. + private void AskAddOrInsertBytes(string title, Action callback) + { + Contract.Requires(title != null); + Contract.Requires(callback != null); + + var classNode = CurrentClassNode; + if (classNode == null) + { + return; + } + + using var ib = new InputBytesForm(classNode.MemorySize) + { + Text = title + }; + + if (ib.ShowDialog() == DialogResult.OK) + { + callback(ib.Bytes); + } + } + + /// + /// Adds bytes at the end of the current class. + /// + /// Amount of bytes + public void AddBytesToClass(int bytes) + { + Contract.Requires(bytes >= 0); + + var node = memoryViewControl.GetSelectedNodes().Select(h => h.Node).FirstOrDefault(); + if (node == null) + { + return; + } + + (node as BaseContainerNode ?? node.GetParentContainer())?.AddBytes(bytes); + + Invalidate(); + } + + /// + /// Inserts bytes at the first selected node to the current class. + /// + /// Amount of bytes + public void InsertBytesInClass(int bytes) + { + Contract.Requires(bytes >= 0); + + var node = memoryViewControl.GetSelectedNodes().Select(h => h.Node).FirstOrDefault(); + if (node == null) + { + return; + } + + (node as BaseContainerNode ?? node.GetParentContainer())?.InsertBytes(node, bytes); + + Invalidate(); + } + + /// + /// Unselects all selected nodes. + /// + public void ClearSelection() + { + memoryViewControl.ClearSelection(); + } + + /// Shows an with all valid file extensions. + /// The path to the selected file or null if no file was selected. + public static string ShowOpenProjectFileDialog() + { + using var ofd = new OpenFileDialog + { + CheckFileExists = true, + Filter = $"All ReClass Types |*{ReClassNetFile.FileExtension};*{ReClassFile.FileExtension};*{ReClassQtFile.FileExtension}" + + $"|{ReClassNetFile.FormatName} (*{ReClassNetFile.FileExtension})|*{ReClassNetFile.FileExtension}" + + $"|{ReClassFile.FormatName} (*{ReClassFile.FileExtension})|*{ReClassFile.FileExtension}" + + $"|{ReClassQtFile.FormatName} (*{ReClassQtFile.FileExtension})|*{ReClassQtFile.FileExtension}" + }; + + if (ofd.ShowDialog() == DialogResult.OK) + { + return ofd.FileName; + } + + return null; + } + + /// Loads the file as a new project. + /// Full pathname of the file. + public void LoadProjectFromPath(string path) + { + Contract.Requires(path != null); + + var project = new ReClassNetProject(); + + LoadProjectFromPath(path, ref project); + + // If the file is a ReClass.NET file remember the path. + if (Path.GetExtension(path) == ReClassNetFile.FileExtension) + { + project.Path = path; + } + + SetProject(project); + } + + /// Loads the file into the given project. + /// Full pathname of the file. + /// [in,out] The project. + private static void LoadProjectFromPath(string path, ref ReClassNetProject project) + { + Contract.Requires(path != null); + Contract.Requires(project != null); + Contract.Ensures(Contract.ValueAtReturn(out project) != null); + + IReClassImport import; + switch (Path.GetExtension(path)?.ToLower()) + { + case ReClassNetFile.FileExtension: + import = new ReClassNetFile(project); + break; + case ReClassQtFile.FileExtension: + import = new ReClassQtFile(project); + break; + case ReClassFile.FileExtension: + import = new ReClassFile(project); + break; + default: + Program.Logger.Log(LogLevel.Error, $"The file '{path}' has an unknown type."); + return; + } + import.Load(path, Program.Logger); + } + + /// Loads all symbols for the current process and displays the progress status. + private void LoadAllSymbolsForCurrentProcess() + { + if (loadSymbolsTask != null && !loadSymbolsTask.IsCompleted) + { + return; + } + + infoToolStripStatusLabel.Visible = true; + + var index = 0; + + var progress = new Progress>>( + report => + { + infoToolStripStatusLabel.Text = $"[{++index}/{report.Item2.Count}] Loading symbols for module: {report.Item1.Name}"; + } + ); + + loadSymbolsTaskToken = new CancellationTokenSource(); + + loadSymbolsTask = Program.RemoteProcess + .LoadAllSymbolsAsync(progress, loadSymbolsTaskToken.Token) + .ContinueWith(_ => infoToolStripStatusLabel.Visible = false, TaskScheduler.FromCurrentSynchronizationContext()); + } + + public void ReplaceSelectedNodesWithType(Type type) + { + Contract.Requires(type != null); + Contract.Requires(type.IsSubclassOf(typeof(BaseNode))); + + var selectedNodes = memoryViewControl.GetSelectedNodes(); + + var newSelected = new List(selectedNodes.Count); + + var hotSpotPartitions = selectedNodes + .WhereNot(s => s.Node is ClassNode) + .GroupBy(s => s.Node.GetParentContainer()) + .Select(g => new + { + Container = g.Key, + Partitions = g.OrderBy(s => s.Node.Offset) + .GroupWhile((s1, s2) => s1.Node.Offset + s1.Node.MemorySize == s2.Node.Offset) + }); + + foreach (var containerPartitions in hotSpotPartitions) + { + containerPartitions.Container.BeginUpdate(); + + foreach (var partition in containerPartitions.Partitions) + { + var hotSpotsToReplace = new Queue(partition); + while (hotSpotsToReplace.Count > 0) + { + var selected = hotSpotsToReplace.Dequeue(); + + var node = BaseNode.CreateInstanceFromType(type); + + var createdNodes = new List(); + containerPartitions.Container.ReplaceChildNode(selected.Node, node, ref createdNodes); + + node.IsSelected = true; + + var info = new MemoryViewControl.SelectedNodeInfo(node, selected.Process, selected.Memory, selected.Address, selected.Level); + + newSelected.Add(info); + + // If more than one node is selected I assume the user wants to replace the complete range with the desired node type. + if (selectedNodes.Count > 1) + { + foreach (var createdNode in createdNodes) + { + hotSpotsToReplace.Enqueue(new MemoryViewControl.SelectedNodeInfo(createdNode, selected.Process, selected.Memory, selected.Address + createdNode.Offset - node.Offset, selected.Level)); + } + } + } + } + + containerPartitions.Container.EndUpdate(); + } + + memoryViewControl.ClearSelection(); + + if (newSelected.Count > 0) + { + memoryViewControl.SetSelectedNodes(newSelected); + } + } + + private void FindWhatInteractsWithSelectedNode(bool writeOnly) + { + var selectedNode = memoryViewControl.GetSelectedNodes().FirstOrDefault(); + if (selectedNode == null) + { + return; + } + + LinkedWindowFeatures.FindWhatInteractsWithAddress(selectedNode.Address, selectedNode.Node.MemorySize, writeOnly); + } + + private void CopySelectedNodesToClipboard() + { + var selectedNodes = memoryViewControl.GetSelectedNodes(); + if (selectedNodes.Count > 0) + { + ReClassClipboard.Copy(selectedNodes.Select(h => h.Node), Program.Logger); + } + } + + private void PasteNodeFromClipboardToSelection() + { + var (classNodes, nodes) = ReClassClipboard.Paste(CurrentProject, Program.Logger); + foreach (var pastedClassNode in classNodes) + { + if (!CurrentProject.ContainsClass(pastedClassNode.Uuid)) + { + CurrentProject.AddClass(pastedClassNode); + } + } + + var selectedNodes = memoryViewControl.GetSelectedNodes(); + if (selectedNodes.Count == 1) + { + var selectedNode = selectedNodes[0].Node; + var containerNode = selectedNode.GetParentContainer(); + var classNode = selectedNode.GetParentClass(); + if (containerNode != null && classNode != null) + { + containerNode.BeginUpdate(); + + foreach (var node in nodes) + { + if (node is BaseWrapperNode) + { + var rootWrapper = node.GetRootWrapperNode(); + Debug.Assert(rootWrapper == node); + + if (rootWrapper.ShouldPerformCycleCheckForInnerNode()) + { + if (rootWrapper.ResolveMostInnerNode() is ClassNode innerNode) + { + if (!IsCycleFree(classNode, innerNode)) + { + continue; + } + } + } + } + + containerNode.InsertNode(selectedNode, node); + } + + containerNode.EndUpdate(); + } + } + } + + private void EditSelectedNodeName() + { + var selectedNodes = memoryViewControl.GetSelectedNodes(); + if (selectedNodes.Count == 1) + { + memoryViewControl.ShowNodeNameEditBox(selectedNodes[0].Node); + } + } + + private void RemoveSelectedNodes() + { + memoryViewControl.GetSelectedNodes() + .WhereNot(h => h.Node is ClassNode) + .ForEach(h => h.Node.GetParentContainer().RemoveNode(h.Node)); + + ClearSelection(); + } + + private void HideSelectedNodes() + { + foreach (var hotSpot in memoryViewControl.GetSelectedNodes()) + { + hotSpot.Node.IsHidden = true; + } + + ClearSelection(); + } + + private void UnhideChildNodes() + { + var selectedNodes = memoryViewControl.GetSelectedNodes(); + if (selectedNodes.Count != 1) + { + return; + } + + if (!(selectedNodes[0].Node is BaseContainerNode containerNode)) + { + return; + } + + foreach (var bn in containerNode.Nodes) + { + bn.IsHidden = false; + bn.IsSelected = false; + } + + containerNode.IsSelected = false; + + ClearSelection(); + } + + private void UnhideNodesBelow() + { + var selectedNodes = memoryViewControl.GetSelectedNodes(); + if (selectedNodes.Count != 1) + { + return; + } + + var selectedNode = selectedNodes[0].Node; + + var parentNode = selectedNode.GetParentContainer(); + if (parentNode == null) + { + return; + } + + var hiddenNodeStartIndex = parentNode.FindNodeIndex(selectedNode) + 1; + if (hiddenNodeStartIndex >= parentNode.Nodes.Count) + { + return; + } + + for (var i = hiddenNodeStartIndex; i < parentNode.Nodes.Count; i++) + { + var indexNode = parentNode.Nodes[i]; + if (indexNode.IsHidden) + { + indexNode.IsHidden = false; + indexNode.IsSelected = false; + } + else + { + break; + } + } + + selectedNode.IsSelected = false; + + ClearSelection(); + } + + private void UnhideNodesAbove() + { + var selectedNodes = memoryViewControl.GetSelectedNodes(); + if (selectedNodes.Count != 1) + { + return; + } + + var selectedNode = selectedNodes[0].Node; + + var parentNode = selectedNode.GetParentContainer(); + if (parentNode == null) + { + return; + } + + var hiddenNodeStartIndex = parentNode.FindNodeIndex(selectedNode) - 1; + if (hiddenNodeStartIndex < 0) + { + return; + } + + for (var i = hiddenNodeStartIndex; i > -1; i--) + { + var indexNode = parentNode.Nodes[i]; + if (indexNode.IsHidden) + { + indexNode.IsHidden = false; + indexNode.IsSelected = false; + } + else + { + break; + } + } + + selectedNode.IsSelected = false; + + ClearSelection(); + } + + private bool IsCycleFree(ClassNode parent, ClassNode node) + { + if (ClassUtil.IsCyclicIfClassIsAccessibleFromParent(parent, node, CurrentProject.Classes)) + { + MessageBox.Show("Invalid operation because this would create a class cycle.", "Cycle Detected", MessageBoxButtons.OK, MessageBoxIcon.Error); + + return false; + } + + return true; + } + } +} diff --git a/ReClass.NET/Forms/MainForm.cs b/ReClass.NET/Forms/MainForm.cs new file mode 100644 index 00000000..e771a10d --- /dev/null +++ b/ReClass.NET/Forms/MainForm.cs @@ -0,0 +1,1055 @@ +using System; +using System.ComponentModel; +using System.Diagnostics.Contracts; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using ReClassNET.AddressParser; +using ReClassNET.CodeGenerator; +using ReClassNET.Controls; +using ReClassNET.Core; +using ReClassNET.DataExchange.ReClass; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.MemoryScanner; +using ReClassNET.MemoryScanner.Comparer; +using ReClassNET.Nodes; +using ReClassNET.Plugins; +using ReClassNET.Project; +using ReClassNET.UI; +using ReClassNET.Util; +using ReClassNET.Util.Conversion; + +namespace ReClassNET.Forms +{ + public partial class MainForm : IconForm + { + private readonly PluginManager pluginManager; + private readonly IconProvider iconProvider = new IconProvider(); + + private ReClassNetProject currentProject; + public ReClassNetProject CurrentProject => currentProject; + + private ClassNode currentClassNode; + + private readonly MemoryBuffer memoryViewBuffer = new MemoryBuffer(); + + private Task updateProcessInformationsTask; + private Task loadSymbolsTask; + private CancellationTokenSource loadSymbolsTaskToken; + + public ProjectView ProjectView => projectView; + + public MenuStrip MainMenu => mainMenuStrip; + + public ClassNode CurrentClassNode + { + get => currentClassNode; + set + { + currentClassNode = value; + + projectView.SelectedClass = value; + + memoryViewControl.Reset(); + memoryViewControl.Invalidate(); + } + } + + private void UpdateWindowTitle(string extra = null) + { + var title = $"{(Program.Settings.RandomizeWindowTitle ? Utils.RandomString(Program.GlobalRandom.Next(15, 20)) : Constants.ApplicationName)} ({Constants.Platform})"; + if (!string.IsNullOrEmpty(extra)) + { + title += $" - {extra}"; + } + Text = title; + } + + public MainForm() + { + Contract.Ensures(pluginManager != null); + Contract.Ensures(currentProject != null); + + InitializeComponent(); + UpdateWindowTitle(); + + mainMenuStrip.Renderer = new CustomToolStripProfessionalRenderer(true, true); + toolStrip.Renderer = new CustomToolStripProfessionalRenderer(true, false); + isLittleEndianToolStripMenuItem.Checked = BitConverter.IsLittleEndian; + + Program.RemoteProcess.ProcessAttached += sender => + { + var text = $"{sender.UnderlayingProcess.Name} (ID: {sender.UnderlayingProcess.Id.ToString()})"; + processInfoToolStripStatusLabel.Text = text; + UpdateWindowTitle(text); + + }; + Program.RemoteProcess.ProcessClosed += sender => + { + UpdateWindowTitle(); + processInfoToolStripStatusLabel.Text = "No process selected"; + }; + + pluginManager = new PluginManager(new DefaultPluginHost(this, Program.RemoteProcess, Program.Logger)); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + + pluginManager.LoadAllPlugins(Path.Combine(Application.StartupPath, Constants.PluginsFolder), Program.Logger); + + toolStrip.Items.AddRange(NodeTypesBuilder.CreateToolStripButtons(ReplaceSelectedNodesWithType).ToArray()); + changeTypeToolStripMenuItem.DropDownItems.AddRange(NodeTypesBuilder.CreateToolStripMenuItems(ReplaceSelectedNodesWithType, false).ToArray()); + + var createDefaultProject = true; + + if (Program.CommandLineArgs.FileName != null) + { + try + { + LoadProjectFromPath(Program.CommandLineArgs.FileName); + + createDefaultProject = false; + } + catch (Exception ex) + { + Program.Logger.Log(ex); + } + } + + if (createDefaultProject) + { + SetProject(new ReClassNetProject()); + + LinkedWindowFeatures.CreateDefaultClass(); + } + + if (Program.CommandLineArgs[Constants.CommandLineOptions.AttachTo] != null) + { + AttachToProcess(Program.CommandLineArgs[Constants.CommandLineOptions.AttachTo]); + } + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + pluginManager.UnloadAllPlugins(); + + GlobalWindowManager.RemoveWindow(this); + + base.OnFormClosed(e); + } + + private async void MainForm_FormClosing(object sender, FormClosingEventArgs e) + { + // Stop the update timer + processUpdateTimer.Stop(); + + // and cancel all running tasks. + if (loadSymbolsTask != null || updateProcessInformationsTask != null) + { + e.Cancel = true; + + Hide(); + + if (loadSymbolsTask != null) + { + loadSymbolsTaskToken.Cancel(); + + try + { + await loadSymbolsTask; + } + catch + { + // ignored + } + + loadSymbolsTask = null; + } + + if (updateProcessInformationsTask != null) + { + try + { + await updateProcessInformationsTask; + } + catch + { + // ignored + } + + updateProcessInformationsTask = null; + } + + Close(); + } + } + + #region Menustrip + + private void fileToolStripMenuItem_DropDownOpening(object sender, EventArgs e) + { + var lastProcess = Program.Settings.LastProcess; + if (string.IsNullOrEmpty(lastProcess)) + { + reattachToProcessToolStripMenuItem.Visible = false; + } + else + { + reattachToProcessToolStripMenuItem.Visible = true; + reattachToProcessToolStripMenuItem.Text = $"Re-Attach to '{lastProcess}'"; + } + } + + private void reattachToProcessToolStripMenuItem_Click(object sender, EventArgs e) + { + var lastProcess = Program.Settings.LastProcess; + if (string.IsNullOrEmpty(lastProcess)) + { + return; + } + + AttachToProcess(lastProcess); + } + + private void detachToolStripMenuItem_Click(object sender, EventArgs e) + { + Program.RemoteProcess.Close(); + } + + private void newClassToolStripButton_Click(object sender, EventArgs e) + { + LinkedWindowFeatures.CreateDefaultClass(); + } + + private void openProjectToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + var path = ShowOpenProjectFileDialog(); + if (path != null) + { + LoadProjectFromPath(path); + } + } + catch (Exception ex) + { + Program.Logger.Log(ex); + } + } + + private void mergeWithProjectToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + var path = ShowOpenProjectFileDialog(); + if (path != null) + { + LoadProjectFromPath(path, ref currentProject); + } + } + catch (Exception ex) + { + Program.Logger.Log(ex); + } + } + + private void goToClassToolStripMenuItem_Click(object sender, EventArgs e) + { + using var csf = new ClassSelectionForm(currentProject.Classes.OrderBy(c => c.Name)); + + if (csf.ShowDialog() == DialogResult.OK) + { + var selectedClassNode = csf.SelectedClass; + if (selectedClassNode != null) + { + projectView.SelectedClass = selectedClassNode; + } + } + } + + private void clearProjectToolStripMenuItem_Click(object sender, EventArgs e) + { + SetProject(new ReClassNetProject()); + } + + private void saveToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!currentProject.Classes.Any()) + { + return; + } + + if (string.IsNullOrEmpty(currentProject.Path)) + { + saveAsToolStripMenuItem_Click(sender, e); + + return; + } + + var file = new ReClassNetFile(currentProject); + file.Save(currentProject.Path, Program.Logger); + } + + private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!currentProject.Classes.Any()) + { + return; + } + + using var sfd = new SaveFileDialog + { + DefaultExt = ReClassNetFile.FileExtension, + Filter = $"{ReClassNetFile.FormatName} (*{ReClassNetFile.FileExtension})|*{ReClassNetFile.FileExtension}" + }; + + if (sfd.ShowDialog() == DialogResult.OK) + { + currentProject.Path = sfd.FileName; + + saveToolStripMenuItem_Click(sender, e); + } + } + + private void settingsToolStripMenuItem_Click(object sender, EventArgs e) + { + using var sd = new SettingsForm(Program.Settings, CurrentProject.TypeMapping); + + sd.ShowDialog(); + } + + private void pluginsToolStripButton_Click(object sender, EventArgs e) + { + using var pf = new PluginForm(pluginManager); + + pf.ShowDialog(); + } + + private void quitToolStripMenuItem_Click(object sender, EventArgs e) + { + Close(); + } + + private void memoryViewerToolStripMenuItem_Click(object sender, EventArgs e) + { + new ProcessInfoForm(Program.RemoteProcess).Show(); + } + + private void memorySearcherToolStripMenuItem_Click(object sender, EventArgs e) + { + new ScannerForm(Program.RemoteProcess).Show(); + } + + private void namedAddressesToolStripMenuItem_Click(object sender, EventArgs e) + { + new NamedAddressesForm(Program.RemoteProcess).Show(); + } + + private void isLittleEndianToolStripMenuItem_Click(object sender, EventArgs e) + { + Program.RemoteProcess.BitConverter = isLittleEndianToolStripMenuItem.Checked ? (EndianBitConverter)EndianBitConverter.Little : EndianBitConverter.Big; + } + + private void loadSymbolToolStripMenuItem_Click(object sender, EventArgs e) + { + using var ofd = new OpenFileDialog + { + Filter = "Program Debug Database (*.pdb)|*.pdb|All Files (*.*)|*.*" + }; + + + if (ofd.ShowDialog() == DialogResult.OK) + { + try + { + Program.RemoteProcess.Symbols.LoadSymbolsFromPDB(ofd.FileName); + } + catch (Exception ex) + { + Program.Logger.Log(ex); + } + } + } + + private void loadSymbolsToolStripMenuItem_Click(object sender, EventArgs e) + { + LoadAllSymbolsForCurrentProcess(); + } + + private void ControlRemoteProcessToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!Program.RemoteProcess.IsValid) + { + return; + } + + var action = ControlRemoteProcessAction.Terminate; + if (sender == resumeProcessToolStripMenuItem) + { + action = ControlRemoteProcessAction.Resume; + } + else if (sender == suspendProcessToolStripMenuItem) + { + action = ControlRemoteProcessAction.Suspend; + } + + Program.RemoteProcess.ControlRemoteProcess(action); + } + + private void cleanUnusedClassesToolStripMenuItem_Click(object sender, EventArgs e) + { + currentProject.RemoveUnusedClasses(); + } + + private void generateCppCodeToolStripMenuItem_Click(object sender, EventArgs e) + { + ShowCodeGeneratorForm(new CppCodeGenerator(currentProject.TypeMapping)); + } + + private void generateCSharpCodeToolStripMenuItem_Click(object sender, EventArgs e) + { + ShowCodeGeneratorForm(new CSharpCodeGenerator()); + } + + private void aboutToolStripMenuItem_Click(object sender, EventArgs e) + { + using var af = new AboutForm(); + + af.ShowDialog(); + } + + #endregion + + #region Toolstrip + + private void attachToProcessToolStripSplitButton_ButtonClick(object sender, EventArgs e) + { + using var pb = new ProcessBrowserForm(Program.Settings.LastProcess); + + if (pb.ShowDialog() == DialogResult.OK) + { + if (pb.SelectedProcess != null) + { + AttachToProcess(pb.SelectedProcess); + + if (pb.LoadSymbols) + { + LoadAllSymbolsForCurrentProcess(); + } + } + } + } + + private void attachToProcessToolStripSplitButton_DropDownClosed(object sender, EventArgs e) + { + attachToProcessToolStripSplitButton.DropDownItems.Clear(); + } + + private void attachToProcessToolStripSplitButton_DropDownOpening(object sender, EventArgs e) + { + attachToProcessToolStripSplitButton.DropDownItems.AddRange( + Program.CoreFunctions.EnumerateProcesses() + .OrderBy(p => p.Name).ThenBy(p => p.Id, IntPtrComparer.Instance) + .Select(p => new ToolStripMenuItem($"[{p.Id}] {p.Name}", p.Icon, (sender2, e2) => AttachToProcess(p))) + .Cast() + .ToArray() + ); + } + + private void selectedNodeContextMenuStrip_Opening(object sender, CancelEventArgs e) + { + var selectedNodes = memoryViewControl.GetSelectedNodes(); + + var count = selectedNodes.Count; + var node = selectedNodes.Select(s => s.Node).FirstOrDefault(); + var parentNode = node?.GetParentContainer(); + + var nodeIsClass = node is ClassNode; + var nodeIsContainer = node is BaseContainerNode; + var nodeIsSearchableValueNode = node switch + { + BaseHexNode _ => true, + FloatNode _ => true, + DoubleNode _ => true, + Int8Node _ => true, + UInt8Node _ => true, + Int16Node _ => true, + UInt16Node _ => true, + Int32Node _ => true, + UInt32Node _ => true, + Int64Node _ => true, + UInt64Node _ => true, + NIntNode _ => true, + NUIntNode _ => true, + Utf8TextNode _ => true, + Utf16TextNode _ => true, + Utf32TextNode _ => true, + _ => false + }; + + addBytesToolStripMenuItem.Enabled = parentNode != null || nodeIsContainer; + insertBytesToolStripMenuItem.Enabled = count == 1 && parentNode != null && !nodeIsContainer; + + changeTypeToolStripMenuItem.Enabled = count > 0 && !nodeIsClass; + + createClassFromNodesToolStripMenuItem.Enabled = count > 0 && !nodeIsClass; + dissectNodesToolStripMenuItem.Enabled = count > 0 && !nodeIsClass; + searchForEqualValuesToolStripMenuItem.Enabled = count == 1 && nodeIsSearchableValueNode; + + pasteNodesToolStripMenuItem.Enabled = count == 1 && ReClassClipboard.ContainsNodes; + removeToolStripMenuItem.Enabled = !nodeIsClass; + + copyAddressToolStripMenuItem.Enabled = !nodeIsClass; + + showCodeOfClassToolStripMenuItem.Enabled = nodeIsClass; + shrinkClassToolStripMenuItem.Enabled = nodeIsClass; + + hideNodesToolStripMenuItem.Enabled = selectedNodes.All(h => !(h.Node is ClassNode)); + + unhideChildNodesToolStripMenuItem.Enabled = count == 1 && node is BaseContainerNode bcn && bcn.Nodes.Any(n => n.IsHidden); + unhideNodesAboveToolStripMenuItem.Enabled = count == 1 && parentNode != null && parentNode.TryGetPredecessor(node, out var predecessor) && predecessor.IsHidden; + unhideNodesBelowToolStripMenuItem.Enabled = count == 1 && parentNode != null && parentNode.TryGetSuccessor(node, out var successor) && successor.IsHidden; + } + + private void addBytesToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!(sender is IntegerToolStripMenuItem item)) + { + return; + } + + AddBytesToClass(item.Value); + } + + private void addXBytesToolStripMenuItem_Click(object sender, EventArgs e) + { + AskAddOrInsertBytes("Add Bytes", AddBytesToClass); + } + + private void insertBytesToolStripMenuItem_Click(object sender, EventArgs e) + { + if (!(sender is IntegerToolStripMenuItem item)) + { + return; + } + + InsertBytesInClass(item.Value); + } + + private void insertXBytesToolStripMenuItem_Click(object sender, EventArgs e) + { + AskAddOrInsertBytes("Insert Bytes", InsertBytesInClass); + } + + private void createClassFromNodesToolStripMenuItem_Click(object sender, EventArgs e) + { + var selectedNodes = memoryViewControl.GetSelectedNodes(); + + if (selectedNodes.Count > 0 && !(selectedNodes[0].Node is ClassNode)) + { + if (selectedNodes[0].Node.GetParentContainer() is ClassNode parentNode) + { + var newClassNode = ClassNode.Create(); + selectedNodes.Select(h => h.Node).ForEach(newClassNode.AddNode); + + var classInstanceNode = new ClassInstanceNode(); + classInstanceNode.ChangeInnerNode(newClassNode); + + parentNode.InsertNode(selectedNodes[0].Node, classInstanceNode); + + selectedNodes.Select(h => h.Node).ForEach(c => parentNode.RemoveNode(c)); + + ClearSelection(); + } + } + } + + private void dissectNodesToolStripMenuItem_Click(object sender, EventArgs e) + { + var hexNodes = memoryViewControl.GetSelectedNodes().Where(h => h.Node is BaseHexNode).ToList(); + if (!hexNodes.Any()) + { + return; + } + + foreach (var g in hexNodes.GroupBy(n => n.Node.GetParentContainer())) + { + NodeDissector.DissectNodes(g.Select(h => (BaseHexNode)h.Node), Program.RemoteProcess, g.First().Memory); + } + + ClearSelection(); + } + + private void searchForEqualValuesToolStripMenuItem_Click(object sender, EventArgs e) + { + var selectedNode = memoryViewControl.GetSelectedNodes().FirstOrDefault(); + if (selectedNode == null) + { + return; + } + + var bitConverter = Program.RemoteProcess.BitConverter; + + IScanComparer comparer; + switch (selectedNode.Node) + { + case BaseHexNode node: + comparer = new ArrayOfBytesMemoryComparer(node.ReadValueFromMemory(selectedNode.Memory)); + break; + case FloatNode node: + comparer = new FloatMemoryComparer(ScanCompareType.Equal, ScanRoundMode.Normal, 2, node.ReadValueFromMemory(selectedNode.Memory), 0.0f, bitConverter); + break; + case DoubleNode node: + comparer = new DoubleMemoryComparer(ScanCompareType.Equal, ScanRoundMode.Normal, 2, node.ReadValueFromMemory(selectedNode.Memory), 0.0, bitConverter); + break; + case Int8Node node: + comparer = new ByteMemoryComparer(ScanCompareType.Equal, (byte)node.ReadValueFromMemory(selectedNode.Memory), 0); + break; + case UInt8Node node: + comparer = new ByteMemoryComparer(ScanCompareType.Equal, node.ReadValueFromMemory(selectedNode.Memory), 0); + break; + case Int16Node node: + comparer = new ShortMemoryComparer(ScanCompareType.Equal, node.ReadValueFromMemory(selectedNode.Memory), 0, bitConverter); + break; + case UInt16Node node: + comparer = new ShortMemoryComparer(ScanCompareType.Equal, (short)node.ReadValueFromMemory(selectedNode.Memory), 0, bitConverter); + break; + case Int32Node node: + comparer = new IntegerMemoryComparer(ScanCompareType.Equal, node.ReadValueFromMemory(selectedNode.Memory), 0, bitConverter); + break; + case UInt32Node node: + comparer = new IntegerMemoryComparer(ScanCompareType.Equal, (int)node.ReadValueFromMemory(selectedNode.Memory), 0, bitConverter); + break; + case Int64Node node: + comparer = new LongMemoryComparer(ScanCompareType.Equal, node.ReadValueFromMemory(selectedNode.Memory), 0L, bitConverter); + break; + case UInt64Node node: + comparer = new LongMemoryComparer(ScanCompareType.Equal, (long)node.ReadValueFromMemory(selectedNode.Memory), 0L, bitConverter); + break; + case NIntNode node: + { + var value = node.ReadValueFromMemory(selectedNode.Memory); +#if RECLASSNET64 + comparer = new LongMemoryComparer(ScanCompareType.Equal, value.ToInt64(), 0L, bitConverter); +#else + comparer = new IntegerMemoryComparer(ScanCompareType.Equal, value.ToInt32(), 0, bitConverter); +#endif + break; + } + case NUIntNode node: + { + var value = node.ReadValueFromMemory(selectedNode.Memory); +#if RECLASSNET64 + comparer = new LongMemoryComparer(ScanCompareType.Equal, (long)value.ToUInt64(), 0L, bitConverter); +#else + comparer = new IntegerMemoryComparer(ScanCompareType.Equal, (int)value.ToUInt32(), 0, bitConverter); +#endif + break; + } + case Utf8TextNode node: + comparer = new StringMemoryComparer(node.ReadValueFromMemory(selectedNode.Memory), Encoding.UTF8, true); + break; + case Utf16TextNode node: + comparer = new StringMemoryComparer(node.ReadValueFromMemory(selectedNode.Memory), Encoding.Unicode, true); + break; + case Utf32TextNode node: + comparer = new StringMemoryComparer(node.ReadValueFromMemory(selectedNode.Memory), Encoding.UTF32, true); + break; + default: + return; + } + + LinkedWindowFeatures.StartMemoryScan(comparer); + } + + private void findOutWhatAccessesThisAddressToolStripMenuItem_Click(object sender, EventArgs e) + { + FindWhatInteractsWithSelectedNode(false); + } + + private void findOutWhatWritesToThisAddressToolStripMenuItem_Click(object sender, EventArgs e) + { + FindWhatInteractsWithSelectedNode(true); + } + + private void copyNodeToolStripMenuItem_Click(object sender, EventArgs e) + { + CopySelectedNodesToClipboard(); + } + + private void pasteNodesToolStripMenuItem_Click(object sender, EventArgs e) + { + PasteNodeFromClipboardToSelection(); + } + + private void removeToolStripMenuItem_Click(object sender, EventArgs e) + { + RemoveSelectedNodes(); + } + + private void hideNodesToolStripMenuItem_Click(object sender, EventArgs e) + { + HideSelectedNodes(); + } + + private void unhideChildNodesToolStripMenuItem_Click(object sender, EventArgs e) + { + UnhideChildNodes(); + } + + private void unhideNodesAboveToolStripMenuItem_Click(object sender, EventArgs e) + { + UnhideNodesAbove(); + } + + private void unhideNodesBelowToolStripMenuItem_Click(object sender, EventArgs e) + { + UnhideNodesBelow(); + } + + private void copyAddressToolStripMenuItem_Click(object sender, EventArgs e) + { + var selectedNodes = memoryViewControl.GetSelectedNodes(); + if (selectedNodes.Count > 0) + { + Clipboard.SetText(selectedNodes.First().Address.ToString("X")); + } + } + + private void showCodeOfClassToolStripMenuItem_Click(object sender, EventArgs e) + { + if (memoryViewControl.GetSelectedNodes().FirstOrDefault()?.Node is ClassNode node) + { + ShowPartialCodeGeneratorForm(new[] { node }); + } + } + + private void shrinkClassToolStripMenuItem_Click(object sender, EventArgs e) + { + var node = memoryViewControl.GetSelectedNodes().Select(s => s.Node).FirstOrDefault(); + if (!(node is ClassNode classNode)) + { + return; + } + + foreach (var nodeToDelete in classNode.Nodes.Reverse().TakeWhile(n => n is BaseHexNode)) + { + classNode.RemoveNode(nodeToDelete); + } + } + +#endregion + + private void MainForm_DragEnter(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + { + if (e.Data.GetData(DataFormats.FileDrop) is string[] files && files.Any()) + { + switch (Path.GetExtension(files.First())) + { + case ReClassNetFile.FileExtension: + case ReClassQtFile.FileExtension: + case ReClassFile.FileExtension: + e.Effect = DragDropEffects.Copy; + break; + } + } + } + } + + private void MainForm_DragDrop(object sender, DragEventArgs e) + { + if (e.Data.GetData(DataFormats.FileDrop) is string[] files && files.Any()) + { + try + { + var path = files.First(); + + LoadProjectFromPath(path); + } + catch (Exception ex) + { + Program.Logger.Log(ex); + } + } + } + + private void processUpdateTimer_Tick(object sender, EventArgs e) + { + if (updateProcessInformationsTask != null && !updateProcessInformationsTask.IsCompleted) + { + return; + } + + updateProcessInformationsTask = Program.RemoteProcess.UpdateProcessInformationsAsync(); + } + + private void classesView_ClassSelected(object sender, ClassNode node) + { + CurrentClassNode = node; + } + + private void memoryViewControl_KeyDown(object sender, KeyEventArgs args) + { + switch (args.KeyCode) + { + case Keys.C when args.Control: + CopySelectedNodesToClipboard(); + break; + case Keys.V when args.Control: + PasteNodeFromClipboardToSelection(); + break; + + case Keys.Delete: + RemoveSelectedNodes(); + break; + + case Keys.F2: + EditSelectedNodeName(); + break; + } + } + + private void memoryViewControl_SelectionChanged(object sender, EventArgs e) + { + if (!(sender is MemoryViewControl memoryView)) + { + return; + } + + var selectedNodes = memoryView.GetSelectedNodes(); + + var node = selectedNodes.FirstOrDefault()?.Node; + var parentContainer = node?.GetParentContainer(); + var nodeIsClass = node is ClassNode; + var isContainerNode = node is BaseContainerNode; + + addBytesToolStripDropDownButton.Enabled = parentContainer != null || isContainerNode; + insertBytesToolStripDropDownButton.Enabled = selectedNodes.Count == 1 && parentContainer != null && !isContainerNode; + + var enabled = selectedNodes.Count > 0 && !nodeIsClass; + toolStrip.Items.OfType().ForEach(b => b.Enabled = enabled); + } + + private void memoryViewControl_ChangeClassTypeClick(object sender, NodeClickEventArgs e) + { + var classes = CurrentProject.Classes.OrderBy(c => c.Name); + + if (e.Node is FunctionNode functionNode) + { + var noneClass = new ClassNode(false) + { + Name = "None" + }; + + using var csf = new ClassSelectionForm(classes.Prepend(noneClass)); + + if (csf.ShowDialog() == DialogResult.OK) + { + var selectedClassNode = csf.SelectedClass; + if (selectedClassNode != null) + { + if (selectedClassNode == noneClass) + { + selectedClassNode = null; + } + + functionNode.BelongsToClass = selectedClassNode; + } + } + } + else if (e.Node is BaseWrapperNode refNode) + { + using var csf = new ClassSelectionForm(classes); + + if (csf.ShowDialog() == DialogResult.OK) + { + var selectedClassNode = csf.SelectedClass; + if (refNode.CanChangeInnerNodeTo(selectedClassNode)) + { + if (!refNode.GetRootWrapperNode().ShouldPerformCycleCheckForInnerNode() || IsCycleFree(e.Node.GetParentClass(), selectedClassNode)) + { + refNode.ChangeInnerNode(selectedClassNode); + } + } + } + } + } + + private void memoryViewControl_ChangeWrappedTypeClick(object sender, NodeClickEventArgs e) + { + if (e.Node is BaseWrapperNode wrapperNode) + { + var items = NodeTypesBuilder.CreateToolStripMenuItems(t => + { + var node = BaseNode.CreateInstanceFromType(t); + if (wrapperNode.CanChangeInnerNodeTo(node)) + { + wrapperNode.ChangeInnerNode(node); + } + }, wrapperNode.CanChangeInnerNodeTo(null)); + + var menu = new ContextMenuStrip(); + menu.Items.AddRange(items.ToArray()); + menu.Show(this, e.Location); + } + } + + private void memoryViewControl_ChangeEnumTypeClick(object sender, NodeClickEventArgs e) + { + if (e.Node is EnumNode enumNode) + { + using var csf = new EnumSelectionForm(CurrentProject); + + var size = enumNode.Enum.Size; + + if (csf.ShowDialog() == DialogResult.OK) + { + var @enum = csf.SelectedItem; + if (@enum != null) + { + enumNode.ChangeEnum(@enum); + } + } + + if (size != enumNode.Enum.Size) + { + // Update the parent container because the enum size has changed. + enumNode.GetParentContainer()?.ChildHasChanged(enumNode); + } + + foreach (var @enum in CurrentProject.Enums) + { + projectView.UpdateEnumNode(@enum); + } + } + } + + private void showCodeOfClassToolStripMenuItem2_Click(object sender, EventArgs e) + { + var classNode = projectView.SelectedClass; + if (classNode == null) + { + return; + } + + ShowPartialCodeGeneratorForm(new[] { classNode }); + } + + private void enableHierarchyViewToolStripMenuItem_Click(object sender, EventArgs e) + { + var isChecked = !enableHierarchyViewToolStripMenuItem.Checked; + + enableHierarchyViewToolStripMenuItem.Checked = isChecked; + + expandAllClassesToolStripMenuItem.Enabled = collapseAllClassesToolStripMenuItem.Enabled = isChecked; + + projectView.EnableClassHierarchyView = isChecked; + } + + private void autoExpandHierarchyViewToolStripMenuItem_Click(object sender, EventArgs e) + { + var isChecked = !autoExpandHierarchyViewToolStripMenuItem.Checked; + + autoExpandHierarchyViewToolStripMenuItem.Checked = isChecked; + + projectView.AutoExpandClassNodes = isChecked; + } + + private void expandAllClassesToolStripMenuItem_Click(object sender, EventArgs e) + { + projectView.ExpandAllClassNodes(); + } + + private void collapseAllClassesToolStripMenuItem_Click(object sender, EventArgs e) + { + projectView.CollapseAllClassNodes(); + } + + private void removeUnusedClassesToolStripMenuItem_Click(object sender, EventArgs e) + { + CurrentProject.RemoveUnusedClasses(); + } + + private void deleteClassToolStripMenuItem_Click(object sender, EventArgs e) + { + var classNode = projectView.SelectedClass; + if (classNode == null) + { + return; + } + + try + { + CurrentProject.Remove(classNode); + } + catch (ClassReferencedException ex) + { + Program.Logger.Log(ex); + } + } + + private void editEnumsToolStripMenuItem_Click(object sender, EventArgs e) + { + using var elf = new EnumListForm(currentProject); + + elf.ShowDialog(); + } + + private void editEnumToolStripMenuItem_Click(object sender, EventArgs e) + { + var @enum = projectView.SelectedEnum; + if (@enum != null) + { + using var eef = new EnumEditorForm(@enum); + + eef.ShowDialog(); + } + } + + private void showEnumsToolStripMenuItem_Click(object sender, EventArgs e) + { + using var elf = new EnumListForm(currentProject); + + elf.ShowDialog(); + } + + private void memoryViewControl_DrawContextRequested(object sender, DrawContextRequestEventArgs args) + { + var process = Program.RemoteProcess; + + var classNode = CurrentClassNode; + if (classNode != null) + { + memoryViewBuffer.Size = classNode.MemorySize; + + IntPtr address; + try + { + address = process.ParseAddress(classNode.AddressFormula); + } + catch (ParseException) + { + address = IntPtr.Zero; + } + memoryViewBuffer.UpdateFrom(process, address); + + args.Settings = Program.Settings; + args.IconProvider = iconProvider; + args.Process = process; + args.Memory = memoryViewBuffer; + args.Node = classNode; + args.BaseAddress = address; + } + } + } +} diff --git a/ReClass.NET/Forms/MainForm.resx b/ReClass.NET/Forms/MainForm.resx new file mode 100644 index 00000000..c430dab3 --- /dev/null +++ b/ReClass.NET/Forms/MainForm.resx @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 366, 17 + + + 756, 17 + + + 986, 17 + + + 1214, 17 + + + 1434, 17 + + + 530, 17 + + + 268, 17 + + + 17, 17 + + + 133, 17 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH + DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp + bGUAAEjHnZZ3VFTXFofPvXd6oc0wAlKG3rvAANJ7k15FYZgZYCgDDjM0sSGiAhFFRJoiSFDEgNFQJFZE + sRAUVLAHJAgoMRhFVCxvRtaLrqy89/Ly++Osb+2z97n77L3PWhcAkqcvl5cGSwGQyhPwgzyc6RGRUXTs + AIABHmCAKQBMVka6X7B7CBDJy82FniFyAl8EAfB6WLwCcNPQM4BOB/+fpFnpfIHomAARm7M5GSwRF4g4 + JUuQLrbPipgalyxmGCVmvihBEcuJOWGRDT77LLKjmNmpPLaIxTmns1PZYu4V8bZMIUfEiK+ICzO5nCwR + 3xKxRoowlSviN+LYVA4zAwAUSWwXcFiJIjYRMYkfEuQi4uUA4EgJX3HcVyzgZAvEl3JJS8/hcxMSBXQd + li7d1NqaQffkZKVwBALDACYrmcln013SUtOZvBwAFu/8WTLi2tJFRbY0tba0NDQzMv2qUP91829K3NtF + ehn4uWcQrf+L7a/80hoAYMyJarPziy2uCoDOLQDI3fti0zgAgKSobx3Xv7oPTTwviQJBuo2xcVZWlhGX + wzISF/QP/U+Hv6GvvmckPu6P8tBdOfFMYYqALq4bKy0lTcinZ6QzWRy64Z+H+B8H/nUeBkGceA6fwxNF + hImmjMtLELWbx+YKuGk8Opf3n5r4D8P+pMW5FonS+BFQY4yA1HUqQH7tBygKESDR+8Vd/6NvvvgwIH55 + 4SqTi3P/7zf9Z8Gl4iWDm/A5ziUohM4S8jMX98TPEqABAUgCKpAHykAd6ABDYAasgC1wBG7AG/iDEBAJ + VgMWSASpgA+yQB7YBApBMdgJ9oBqUAcaQTNoBcdBJzgFzoNL4Bq4AW6D+2AUTIBnYBa8BgsQBGEhMkSB + 5CEVSBPSh8wgBmQPuUG+UBAUCcVCCRAPEkJ50GaoGCqDqqF6qBn6HjoJnYeuQIPQXWgMmoZ+h97BCEyC + qbASrAUbwwzYCfaBQ+BVcAK8Bs6FC+AdcCXcAB+FO+Dz8DX4NjwKP4PnEIAQERqiihgiDMQF8UeikHiE + j6xHipAKpAFpRbqRPuQmMorMIG9RGBQFRUcZomxRnqhQFAu1BrUeVYKqRh1GdaB6UTdRY6hZ1Ec0Ga2I + 1kfboL3QEegEdBa6EF2BbkK3oy+ib6Mn0K8xGAwNo42xwnhiIjFJmLWYEsw+TBvmHGYQM46Zw2Kx8lh9 + rB3WH8vECrCF2CrsUexZ7BB2AvsGR8Sp4Mxw7rgoHA+Xj6vAHcGdwQ3hJnELeCm8Jt4G749n43PwpfhG + fDf+On4Cv0CQJmgT7AghhCTCJkIloZVwkfCA8JJIJKoRrYmBRC5xI7GSeIx4mThGfEuSIemRXEjRJCFp + B+kQ6RzpLuklmUzWIjuSo8gC8g5yM/kC+RH5jQRFwkjCS4ItsUGiRqJDYkjiuSReUlPSSXK1ZK5kheQJ + yeuSM1J4KS0pFymm1HqpGqmTUiNSc9IUaVNpf+lU6RLpI9JXpKdksDJaMm4ybJkCmYMyF2TGKQhFneJC + YVE2UxopFykTVAxVm+pFTaIWU7+jDlBnZWVkl8mGyWbL1sielh2lITQtmhcthVZKO04bpr1borTEaQln + yfYlrUuGlszLLZVzlOPIFcm1yd2WeydPl3eTT5bfJd8p/1ABpaCnEKiQpbBf4aLCzFLqUtulrKVFS48v + vacIK+opBimuVTyo2K84p6Ss5KGUrlSldEFpRpmm7KicpFyufEZ5WoWiYq/CVSlXOavylC5Ld6Kn0Cvp + vfRZVUVVT1Whar3qgOqCmrZaqFq+WpvaQ3WCOkM9Xr1cvUd9VkNFw08jT6NF454mXpOhmai5V7NPc15L + Wytca6tWp9aUtpy2l3audov2Ax2yjoPOGp0GnVu6GF2GbrLuPt0berCehV6iXo3edX1Y31Kfq79Pf9AA + bWBtwDNoMBgxJBk6GWYathiOGdGMfI3yjTqNnhtrGEcZ7zLuM/5oYmGSYtJoct9UxtTbNN+02/R3Mz0z + llmN2S1zsrm7+QbzLvMXy/SXcZbtX3bHgmLhZ7HVosfig6WVJd+y1XLaSsMq1qrWaoRBZQQwShiXrdHW + ztYbrE9Zv7WxtBHYHLf5zdbQNtn2iO3Ucu3lnOWNy8ft1OyYdvV2o/Z0+1j7A/ajDqoOTIcGh8eO6o5s + xybHSSddpySno07PnU2c+c7tzvMuNi7rXM65Iq4erkWuA24ybqFu1W6P3NXcE9xb3Gc9LDzWepzzRHv6 + eO7yHPFS8mJ5NXvNelt5r/Pu9SH5BPtU+zz21fPl+3b7wX7efrv9HqzQXMFb0ekP/L38d/s/DNAOWBPw + YyAmMCCwJvBJkGlQXlBfMCU4JvhI8OsQ55DSkPuhOqHC0J4wybDosOaw+XDX8LLw0QjjiHUR1yIVIrmR + XVHYqLCopqi5lW4r96yciLaILoweXqW9KnvVldUKq1NWn46RjGHGnIhFx4bHHol9z/RnNjDn4rziauNm + WS6svaxnbEd2OXuaY8cp40zG28WXxU8l2CXsTphOdEisSJzhunCruS+SPJPqkuaT/ZMPJX9KCU9pS8Wl + xqae5Mnwknm9acpp2WmD6frphemja2zW7Fkzy/fhN2VAGasyugRU0c9Uv1BHuEU4lmmfWZP5Jiss60S2 + dDYvuz9HL2d7zmSue+63a1FrWWt78lTzNuWNrXNaV78eWh+3vmeD+oaCDRMbPTYe3kTYlLzpp3yT/LL8 + V5vDN3cXKBVsLBjf4rGlpVCikF84stV2a9021DbutoHt5turtn8sYhddLTYprih+X8IqufqN6TeV33za + Eb9joNSydP9OzE7ezuFdDrsOl0mX5ZaN7/bb3VFOLy8qf7UnZs+VimUVdXsJe4V7Ryt9K7uqNKp2Vr2v + Tqy+XeNc01arWLu9dn4fe9/Qfsf9rXVKdcV17w5wD9yp96jvaNBqqDiIOZh58EljWGPft4xvm5sUmoqb + PhziHRo9HHS4t9mqufmI4pHSFrhF2DJ9NProje9cv+tqNWytb6O1FR8Dx4THnn4f+/3wcZ/jPScYJ1p/ + 0Pyhtp3SXtQBdeR0zHYmdo52RXYNnvQ+2dNt293+o9GPh06pnqo5LXu69AzhTMGZT2dzz86dSz83cz7h + /HhPTM/9CxEXbvUG9g5c9Ll4+ZL7pQt9Tn1nL9tdPnXF5srJq4yrndcsr3X0W/S3/2TxU/uA5UDHdavr + XTesb3QPLh88M+QwdP6m681Lt7xuXbu94vbgcOjwnZHokdE77DtTd1PuvriXeW/h/sYH6AdFD6UeVjxS + fNTws+7PbaOWo6fHXMf6Hwc/vj/OGn/2S8Yv7ycKnpCfVEyqTDZPmU2dmnafvvF05dOJZ+nPFmYKf5X+ + tfa5zvMffnP8rX82YnbiBf/Fp99LXsq/PPRq2aueuYC5R69TXy/MF72Rf3P4LeNt37vwd5MLWe+x7ys/ + 6H7o/ujz8cGn1E+f/gUDmPP8usTo0wAAAAlwSFlzAAALDAAACwwBP0AiyAAAAkxJREFUOE+VketLk2EY + xv1LEqsvFWEFTcPIjKADiVbSlzLMZImBmXSUTjK0bFSYGB7ml1hJBzWtNhQLHViUutwpl+bWps1lqbm5 + U9P9et9XMoZpdcP1PPDcz/Xjup8nBphXi87Kn9T40syD1neon76hx+IQrv72LAAsVhFBqkcdbNx1lPst + neJRNGDcZOBFZS36inL0NdVYNRrxklQRwR2eiVCpbqWtyzwHae4QW3MAW3MjFmUpI1XljJSX8b7oFO1H + DtNy+gyzojkcIRiapeKuFtnunHlJgHGzEVOJgkl1HX5NE1MN93DdVmLMy+FhSjLy1IvI8m14/TNMTocl + yC+QBDDU1fLpugLvYzU+bROexnpcFUosBcdp27EN1d4MPL4ZJjxhxibDuL6FJIA4hgTovnUD+6WzjKsq + hRQqvtbdwV56mZ7cbFq3J1MWtwLZCTvr5EZWZ3ZidwejAfrqKgzHsnEUn8d57QpDxUUY83PRHUjjScJ6 + qvak4574wchYEPtogAGnPxrQr3mOZn86vYcyMMiz6M46iG5fKtotidSsjCMz+aSQwEa8kGCNkMBk90UD + xKWhoJD6TTLJpN2cQNOGtVQvj+VmYhIOd4jBzwH6HX5Mtml6B7wLAaL6nmkoSUrh6rJYLqxKIG9nIWmK + MbaeG5V+IV5ukN7gtWURgCix4Z4IMSzMa3MF+TAcwCJE7hv00W318sriQWeYWhrg/BJiSDBbnQEhsg/9 + 4DRv+710mT109k3R3vt9acBHYV5x/5sWBYiNf9UCwP+LmJ8wl+0I8S7t3QAAAABJRU5ErkJggg== + + + + 42 + + \ No newline at end of file diff --git a/ReClass.NET/Forms/NamedAddressesForm.Designer.cs b/ReClass.NET/Forms/NamedAddressesForm.Designer.cs new file mode 100644 index 00000000..a6a8a6e3 --- /dev/null +++ b/ReClass.NET/Forms/NamedAddressesForm.Designer.cs @@ -0,0 +1,140 @@ +using ReClassNET.Controls; + +namespace ReClassNET.Forms +{ + partial class NamedAddressesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.bannerBox = new BannerBox(); + this.addressTextBox = new PlaceholderTextBox(); + this.nameTextBox = new PlaceholderTextBox(); + this.namedAddressesListBox = new System.Windows.Forms.ListBox(); + this.removeAddressIconButton = new IconButton(); + this.addAddressIconButton = new IconButton(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); + this.SuspendLayout(); + // + // bannerBox + // + this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; + this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B16x16_Custom_Type; + this.bannerBox.Location = new System.Drawing.Point(0, 0); + this.bannerBox.Name = "bannerBox"; + this.bannerBox.Size = new System.Drawing.Size(429, 48); + this.bannerBox.TabIndex = 10; + this.bannerBox.Text = "Give special memory addresses meaningfull names."; + this.bannerBox.Title = "Named Addresses"; + // + // addressTextBox + // + this.addressTextBox.Location = new System.Drawing.Point(13, 55); + this.addressTextBox.Name = "addressTextBox"; + this.addressTextBox.PlaceholderText = "Address"; + this.addressTextBox.Size = new System.Drawing.Size(154, 20); + this.addressTextBox.TabIndex = 1; + this.addressTextBox.TextChanged += new System.EventHandler(this.InputTextBox_TextChanged); + // + // nameTextBox + // + this.nameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.nameTextBox.Location = new System.Drawing.Point(173, 55); + this.nameTextBox.Name = "nameTextBox"; + this.nameTextBox.PlaceholderText = "Name"; + this.nameTextBox.Size = new System.Drawing.Size(190, 20); + this.nameTextBox.TabIndex = 2; + this.nameTextBox.TextChanged += new System.EventHandler(this.InputTextBox_TextChanged); + // + // namedAddressesListBox + // + this.namedAddressesListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.namedAddressesListBox.FormattingEnabled = true; + this.namedAddressesListBox.Location = new System.Drawing.Point(13, 81); + this.namedAddressesListBox.Name = "namedAddressesListBox"; + this.namedAddressesListBox.Size = new System.Drawing.Size(404, 186); + this.namedAddressesListBox.TabIndex = 0; + this.namedAddressesListBox.SelectedIndexChanged += new System.EventHandler(this.namedAddressesListBox_SelectedIndexChanged); + // + // removeAddressIconButton + // + this.removeAddressIconButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.removeAddressIconButton.Enabled = false; + this.removeAddressIconButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Remove; + this.removeAddressIconButton.Location = new System.Drawing.Point(394, 54); + this.removeAddressIconButton.Name = "removeAddressIconButton"; + this.removeAddressIconButton.Pressed = false; + this.removeAddressIconButton.Selected = false; + this.removeAddressIconButton.Size = new System.Drawing.Size(23, 22); + this.removeAddressIconButton.TabIndex = 4; + this.removeAddressIconButton.Click += new System.EventHandler(this.removeAddressIconButton_Click); + // + // addAddressIconButton + // + this.addAddressIconButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.addAddressIconButton.Enabled = false; + this.addAddressIconButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Add; + this.addAddressIconButton.Location = new System.Drawing.Point(369, 54); + this.addAddressIconButton.Name = "addAddressIconButton"; + this.addAddressIconButton.Pressed = false; + this.addAddressIconButton.Selected = false; + this.addAddressIconButton.Size = new System.Drawing.Size(23, 22); + this.addAddressIconButton.TabIndex = 3; + this.addAddressIconButton.Click += new System.EventHandler(this.addAddressIconButton_Click); + // + // NamedAddressesForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(429, 279); + this.Controls.Add(this.addAddressIconButton); + this.Controls.Add(this.removeAddressIconButton); + this.Controls.Add(this.namedAddressesListBox); + this.Controls.Add(this.nameTextBox); + this.Controls.Add(this.addressTextBox); + this.Controls.Add(this.bannerBox); + this.MinimumSize = new System.Drawing.Size(445, 317); + this.Name = "NamedAddressesForm"; + this.Text = "ReClass.NET - Named Addresses"; + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private BannerBox bannerBox; + private PlaceholderTextBox addressTextBox; + private PlaceholderTextBox nameTextBox; + private System.Windows.Forms.ListBox namedAddressesListBox; + private IconButton removeAddressIconButton; + private IconButton addAddressIconButton; + } +} \ No newline at end of file diff --git a/ReClass.NET/Forms/NamedAddressesForm.cs b/ReClass.NET/Forms/NamedAddressesForm.cs new file mode 100644 index 00000000..ffdc8011 --- /dev/null +++ b/ReClass.NET/Forms/NamedAddressesForm.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Windows.Forms; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Forms +{ + public partial class NamedAddressesForm : IconForm + { + private readonly RemoteProcess process; + + public NamedAddressesForm(RemoteProcess process) + { + Contract.Requires(process != null); + + this.process = process; + + InitializeComponent(); + + DisplayNamedAddresses(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + + #region Event Handler + + private void InputTextBox_TextChanged(object sender, EventArgs e) + { + addAddressIconButton.Enabled = IsValidInput(); + } + + private void namedAddressesListBox_SelectedIndexChanged(object sender, EventArgs e) + { + removeAddressIconButton.Enabled = namedAddressesListBox.SelectedIndex != -1; + } + + private void addAddressIconButton_Click(object sender, EventArgs e) + { + if (!IsValidInput()) + { + return; + } + + var address = process.ParseAddress(addressTextBox.Text.Trim()); + var name = nameTextBox.Text.Trim(); + + process.NamedAddresses[address] = name; + + addressTextBox.Text = nameTextBox.Text = null; + + DisplayNamedAddresses(); + } + + private void removeAddressIconButton_Click(object sender, EventArgs e) + { + if (namedAddressesListBox.SelectedItem is BindingDisplayWrapper> namedAddress) + { + process.NamedAddresses.Remove(namedAddress.Value.Key); + + DisplayNamedAddresses(); + } + } + + #endregion + + private void DisplayNamedAddresses() + { + namedAddressesListBox.DataSource = process.NamedAddresses + .Select(kv => new BindingDisplayWrapper>(kv, v => $"0x{v.Key.ToString(Constants.AddressHexFormat)}: {v.Value}")) + .ToList(); + + namedAddressesListBox_SelectedIndexChanged(null, null); + } + + private bool IsValidInput() + { + try + { + var address = process.ParseAddress(addressTextBox.Text.Trim()); + var name = nameTextBox.Text.Trim(); + + return !address.IsNull() && !string.IsNullOrEmpty(name); + } + catch + { + return false; + } + } + } +} diff --git a/ReClass.NET/Forms/NamedAddressesForm.resx b/ReClass.NET/Forms/NamedAddressesForm.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/ReClass.NET/Forms/NamedAddressesForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ReClass.NET/Forms/PluginForm.Designer.cs b/ReClass.NET/Forms/PluginForm.Designer.cs new file mode 100644 index 00000000..c1df5042 --- /dev/null +++ b/ReClass.NET/Forms/PluginForm.Designer.cs @@ -0,0 +1,285 @@ +using ReClassNET.Controls; + +namespace ReClassNET.Forms +{ + partial class PluginForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tabControl = new System.Windows.Forms.TabControl(); + this.pluginsTabPage = new System.Windows.Forms.TabPage(); + this.descriptionGroupBox = new System.Windows.Forms.GroupBox(); + this.descriptionLabel = new System.Windows.Forms.Label(); + this.pluginsDataGridView = new System.Windows.Forms.DataGridView(); + this.nativesTabPage = new System.Windows.Forms.TabPage(); + this.label2 = new System.Windows.Forms.Label(); + this.functionsProvidersComboBox = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.getMoreLinkLabel = new System.Windows.Forms.LinkLabel(); + this.closeButton = new System.Windows.Forms.Button(); + this.bannerBox = new ReClassNET.Controls.BannerBox(); + this.iconColumn = new System.Windows.Forms.DataGridViewImageColumn(); + this.nameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.versionColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.authorColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.tabControl.SuspendLayout(); + this.pluginsTabPage.SuspendLayout(); + this.descriptionGroupBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pluginsDataGridView)).BeginInit(); + this.nativesTabPage.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); + this.SuspendLayout(); + // + // tabControl + // + this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl.Controls.Add(this.pluginsTabPage); + this.tabControl.Controls.Add(this.nativesTabPage); + this.tabControl.Location = new System.Drawing.Point(12, 60); + this.tabControl.Name = "tabControl"; + this.tabControl.SelectedIndex = 0; + this.tabControl.Size = new System.Drawing.Size(716, 328); + this.tabControl.TabIndex = 0; + // + // pluginsTabPage + // + this.pluginsTabPage.Controls.Add(this.descriptionGroupBox); + this.pluginsTabPage.Controls.Add(this.pluginsDataGridView); + this.pluginsTabPage.Location = new System.Drawing.Point(4, 22); + this.pluginsTabPage.Name = "pluginsTabPage"; + this.pluginsTabPage.Padding = new System.Windows.Forms.Padding(3); + this.pluginsTabPage.Size = new System.Drawing.Size(708, 302); + this.pluginsTabPage.TabIndex = 0; + this.pluginsTabPage.Text = "Plugins"; + this.pluginsTabPage.UseVisualStyleBackColor = true; + // + // descriptionGroupBox + // + this.descriptionGroupBox.Controls.Add(this.descriptionLabel); + this.descriptionGroupBox.Location = new System.Drawing.Point(6, 206); + this.descriptionGroupBox.Name = "descriptionGroupBox"; + this.descriptionGroupBox.Size = new System.Drawing.Size(696, 90); + this.descriptionGroupBox.TabIndex = 1; + this.descriptionGroupBox.TabStop = false; + this.descriptionGroupBox.Text = "<>"; + // + // descriptionLabel + // + this.descriptionLabel.Location = new System.Drawing.Point(6, 16); + this.descriptionLabel.Name = "descriptionLabel"; + this.descriptionLabel.Size = new System.Drawing.Size(684, 65); + this.descriptionLabel.TabIndex = 0; + this.descriptionLabel.Text = "<>"; + // + // pluginsDataGridView + // + this.pluginsDataGridView.AllowUserToAddRows = false; + this.pluginsDataGridView.AllowUserToDeleteRows = false; + this.pluginsDataGridView.AllowUserToResizeRows = false; + this.pluginsDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleHorizontal; + this.pluginsDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.pluginsDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.iconColumn, + this.nameColumn, + this.versionColumn, + this.authorColumn}); + this.pluginsDataGridView.Dock = System.Windows.Forms.DockStyle.Top; + this.pluginsDataGridView.Location = new System.Drawing.Point(3, 3); + this.pluginsDataGridView.MultiSelect = false; + this.pluginsDataGridView.Name = "pluginsDataGridView"; + this.pluginsDataGridView.ReadOnly = true; + this.pluginsDataGridView.RowHeadersVisible = false; + this.pluginsDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.pluginsDataGridView.Size = new System.Drawing.Size(702, 197); + this.pluginsDataGridView.TabIndex = 0; + this.pluginsDataGridView.SelectionChanged += new System.EventHandler(this.pluginsDataGridView_SelectionChanged); + // + // nativesTabPage + // + this.nativesTabPage.Controls.Add(this.label2); + this.nativesTabPage.Controls.Add(this.functionsProvidersComboBox); + this.nativesTabPage.Controls.Add(this.label1); + this.nativesTabPage.Location = new System.Drawing.Point(4, 22); + this.nativesTabPage.Name = "nativesTabPage"; + this.nativesTabPage.Padding = new System.Windows.Forms.Padding(3); + this.nativesTabPage.Size = new System.Drawing.Size(708, 302); + this.nativesTabPage.TabIndex = 1; + this.nativesTabPage.Text = "Native Helper"; + this.nativesTabPage.UseVisualStyleBackColor = true; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(6, 66); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(98, 13); + this.label2.TabIndex = 21; + this.label2.Text = "Functions Provider:"; + // + // functionsProvidersComboBox + // + this.functionsProvidersComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.functionsProvidersComboBox.FormattingEnabled = true; + this.functionsProvidersComboBox.Location = new System.Drawing.Point(110, 63); + this.functionsProvidersComboBox.Name = "functionsProvidersComboBox"; + this.functionsProvidersComboBox.Size = new System.Drawing.Size(305, 21); + this.functionsProvidersComboBox.TabIndex = 20; + this.functionsProvidersComboBox.SelectionChangeCommitted += new System.EventHandler(this.functionsProvidersComboBox_SelectionChangeCommitted); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(6, 6); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(409, 39); + this.label1.TabIndex = 0; + this.label1.Text = "Plugins can provide different methods how ReClass.NET accesses a remote process.\r" + + "\n\r\nWarning: You should detach from the current process before changing a functio" + + "n."; + // + // getMoreLinkLabel + // + this.getMoreLinkLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.getMoreLinkLabel.AutoSize = true; + this.getMoreLinkLabel.Location = new System.Drawing.Point(9, 396); + this.getMoreLinkLabel.Name = "getMoreLinkLabel"; + this.getMoreLinkLabel.Size = new System.Drawing.Size(95, 13); + this.getMoreLinkLabel.TabIndex = 1; + this.getMoreLinkLabel.TabStop = true; + this.getMoreLinkLabel.Text = "Get more plugins..."; + this.getMoreLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.getMoreLinkLabel_LinkClicked); + // + // closeButton + // + this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.closeButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.closeButton.Location = new System.Drawing.Point(653, 391); + this.closeButton.Name = "closeButton"; + this.closeButton.Size = new System.Drawing.Size(75, 23); + this.closeButton.TabIndex = 2; + this.closeButton.Text = "Close"; + this.closeButton.UseVisualStyleBackColor = true; + // + // bannerBox + // + this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; + this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B32x32_Plugin; + this.bannerBox.Location = new System.Drawing.Point(0, 0); + this.bannerBox.Name = "bannerBox"; + this.bannerBox.Size = new System.Drawing.Size(740, 48); + this.bannerBox.TabIndex = 3; + this.bannerBox.Text = "Here you can configure all loaded ReClass.NET plugins."; + this.bannerBox.Title = "Plugins"; + // + // iconColumn + // + this.iconColumn.DataPropertyName = "Icon"; + this.iconColumn.HeaderText = ""; + this.iconColumn.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; + this.iconColumn.MinimumWidth = 18; + this.iconColumn.Name = "iconColumn"; + this.iconColumn.ReadOnly = true; + this.iconColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.iconColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.iconColumn.Width = 18; + // + // nameColumn + // + this.nameColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.nameColumn.DataPropertyName = "Name"; + this.nameColumn.HeaderText = "Name"; + this.nameColumn.Name = "nameColumn"; + this.nameColumn.ReadOnly = true; + // + // versionColumn + // + this.versionColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.versionColumn.DataPropertyName = "Version"; + this.versionColumn.HeaderText = "Version"; + this.versionColumn.Name = "versionColumn"; + this.versionColumn.ReadOnly = true; + this.versionColumn.Width = 67; + // + // authorColumn + // + this.authorColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.authorColumn.DataPropertyName = "Author"; + this.authorColumn.HeaderText = "Author"; + this.authorColumn.Name = "authorColumn"; + this.authorColumn.ReadOnly = true; + this.authorColumn.Width = 63; + // + // PluginForm + // + this.AcceptButton = this.closeButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(740, 423); + this.Controls.Add(this.bannerBox); + this.Controls.Add(this.closeButton); + this.Controls.Add(this.getMoreLinkLabel); + this.Controls.Add(this.tabControl); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "PluginForm"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "ReClass.NET - Plugins"; + this.tabControl.ResumeLayout(false); + this.pluginsTabPage.ResumeLayout(false); + this.descriptionGroupBox.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pluginsDataGridView)).EndInit(); + this.nativesTabPage.ResumeLayout(false); + this.nativesTabPage.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TabControl tabControl; + private System.Windows.Forms.TabPage pluginsTabPage; + private System.Windows.Forms.GroupBox descriptionGroupBox; + private System.Windows.Forms.DataGridView pluginsDataGridView; + private System.Windows.Forms.TabPage nativesTabPage; + private System.Windows.Forms.LinkLabel getMoreLinkLabel; + private System.Windows.Forms.Button closeButton; + private System.Windows.Forms.Label descriptionLabel; + private System.Windows.Forms.Label label1; + private BannerBox bannerBox; + private System.Windows.Forms.ComboBox functionsProvidersComboBox; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.DataGridViewImageColumn iconColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn nameColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn versionColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn authorColumn; + } +} \ No newline at end of file diff --git a/ReClass.NET/Forms/PluginForm.cs b/ReClass.NET/Forms/PluginForm.cs new file mode 100644 index 00000000..81577f7f --- /dev/null +++ b/ReClass.NET/Forms/PluginForm.cs @@ -0,0 +1,109 @@ +using System; +using System.Diagnostics; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; +using ReClassNET.Plugins; +using ReClassNET.UI; + +namespace ReClassNET.Forms +{ + public partial class PluginForm : IconForm + { + private class PluginInfoRow + { + private readonly PluginInfo plugin; + + public Image Icon => plugin.Interface?.Icon ?? Properties.Resources.B16x16_Plugin; + public string Name => plugin.Name; + public string Version => plugin.FileVersion; + public string Author => plugin.Author; + public string Description => plugin.Description; + + public PluginInfoRow(PluginInfo plugin) + { + Contract.Requires(plugin != null); + Contract.Ensures(this.plugin != null); + + this.plugin = plugin; + } + } + + internal PluginForm(PluginManager pluginManager) + { + Contract.Requires(pluginManager != null); + + InitializeComponent(); + + // Plugins Tab + + pluginsDataGridView.AutoGenerateColumns = false; + pluginsDataGridView.DataSource = pluginManager.Plugins.Select(p => new PluginInfoRow(p)).ToList(); + + UpdatePluginDescription(); + + // Native Methods Tab + + var providers = Program.CoreFunctions.FunctionProviders.ToArray(); + functionsProvidersComboBox.Items.AddRange(providers); + functionsProvidersComboBox.SelectedIndex = Array.IndexOf(providers, Program.CoreFunctions.CurrentFunctionsProvider); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + + #region Event Handler + + private void pluginsDataGridView_SelectionChanged(object sender, EventArgs e) + { + UpdatePluginDescription(); + } + + private void functionsProvidersComboBox_SelectionChangeCommitted(object sender, EventArgs e) + { + if (!(functionsProvidersComboBox.SelectedItem is string provider)) + { + return; + } + + Program.CoreFunctions.SetActiveFunctionsProvider(provider); + } + + private void getMoreLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + Process.Start(Constants.PluginUrl); + } + + #endregion + + private void UpdatePluginDescription() + { + var row = pluginsDataGridView.SelectedRows.Cast().FirstOrDefault(); + if (row == null) + { + descriptionGroupBox.Text = string.Empty; + descriptionLabel.Text = string.Empty; + + return; + } + + if (row.DataBoundItem is PluginInfoRow plugin) + { + descriptionGroupBox.Text = plugin.Name; + descriptionLabel.Text = plugin.Description; + } + } + } +} diff --git a/Forms/PluginForm.resx b/ReClass.NET/Forms/PluginForm.resx similarity index 89% rename from Forms/PluginForm.resx rename to ReClass.NET/Forms/PluginForm.resx index 0a0b4b4d..7b839618 100644 --- a/Forms/PluginForm.resx +++ b/ReClass.NET/Forms/PluginForm.resx @@ -129,16 +129,4 @@ True - - True - - - True - - - True - - - True - \ No newline at end of file diff --git a/Forms/ProcessBrowserForm.Designer.cs b/ReClass.NET/Forms/ProcessBrowserForm.Designer.cs similarity index 80% rename from Forms/ProcessBrowserForm.Designer.cs rename to ReClass.NET/Forms/ProcessBrowserForm.Designer.cs index eb326744..d4e111d5 100644 --- a/Forms/ProcessBrowserForm.Designer.cs +++ b/ReClass.NET/Forms/ProcessBrowserForm.Designer.cs @@ -1,4 +1,6 @@ -namespace ReClassNET +using ReClassNET.Controls; + +namespace ReClassNET.Forms { partial class ProcessBrowserForm { @@ -35,16 +37,16 @@ private void InitializeComponent() this.pathColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.filterCheckBox = new System.Windows.Forms.CheckBox(); this.refreshButton = new System.Windows.Forms.Button(); - this.openProcessButton = new System.Windows.Forms.Button(); + this.attachToProcessButton = new System.Windows.Forms.Button(); this.loadSymbolsCheckBox = new System.Windows.Forms.CheckBox(); - this.searchGroupBox = new System.Windows.Forms.GroupBox(); + this.filterGroupBox = new System.Windows.Forms.GroupBox(); this.previousProcessLinkLabel = new System.Windows.Forms.LinkLabel(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.filterTextBox = new System.Windows.Forms.TextBox(); - this.bannerBox = new ReClassNET.UI.BannerBox(); + this.bannerBox = new BannerBox(); ((System.ComponentModel.ISupportInitialize)(this.processDataGridView)).BeginInit(); - this.searchGroupBox.SuspendLayout(); + this.filterGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); this.SuspendLayout(); // @@ -137,20 +139,20 @@ private void InitializeComponent() this.refreshButton.UseVisualStyleBackColor = true; this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click); // - // openProcessButton + // attachToProcessButton // - this.openProcessButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + this.attachToProcessButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.openProcessButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.openProcessButton.Image = global::ReClassNET.Properties.Resources.B16x16_Accept; - this.openProcessButton.Location = new System.Drawing.Point(12, 519); - this.openProcessButton.Name = "openProcessButton"; - this.openProcessButton.Size = new System.Drawing.Size(549, 23); - this.openProcessButton.TabIndex = 3; - this.openProcessButton.Text = "Open Process"; - this.openProcessButton.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this.openProcessButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this.openProcessButton.UseVisualStyleBackColor = true; + this.attachToProcessButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.attachToProcessButton.Image = global::ReClassNET.Properties.Resources.B16x16_Accept; + this.attachToProcessButton.Location = new System.Drawing.Point(12, 519); + this.attachToProcessButton.Name = "attachToProcessButton"; + this.attachToProcessButton.Size = new System.Drawing.Size(549, 23); + this.attachToProcessButton.TabIndex = 3; + this.attachToProcessButton.Text = "Attach to Process"; + this.attachToProcessButton.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.attachToProcessButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.attachToProcessButton.UseVisualStyleBackColor = true; // // loadSymbolsCheckBox // @@ -163,22 +165,22 @@ private void InitializeComponent() this.loadSymbolsCheckBox.Text = "Load Symbols"; this.loadSymbolsCheckBox.UseVisualStyleBackColor = true; // - // searchGroupBox + // filterGroupBox // - this.searchGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.filterGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.searchGroupBox.Controls.Add(this.previousProcessLinkLabel); - this.searchGroupBox.Controls.Add(this.label2); - this.searchGroupBox.Controls.Add(this.label1); - this.searchGroupBox.Controls.Add(this.filterCheckBox); - this.searchGroupBox.Controls.Add(this.refreshButton); - this.searchGroupBox.Controls.Add(this.filterTextBox); - this.searchGroupBox.Location = new System.Drawing.Point(12, 60); - this.searchGroupBox.Name = "searchGroupBox"; - this.searchGroupBox.Size = new System.Drawing.Size(549, 133); - this.searchGroupBox.TabIndex = 5; - this.searchGroupBox.TabStop = false; - this.searchGroupBox.Text = "Search for Process"; + this.filterGroupBox.Controls.Add(this.previousProcessLinkLabel); + this.filterGroupBox.Controls.Add(this.label2); + this.filterGroupBox.Controls.Add(this.label1); + this.filterGroupBox.Controls.Add(this.filterCheckBox); + this.filterGroupBox.Controls.Add(this.refreshButton); + this.filterGroupBox.Controls.Add(this.filterTextBox); + this.filterGroupBox.Location = new System.Drawing.Point(12, 60); + this.filterGroupBox.Name = "filterGroupBox"; + this.filterGroupBox.Size = new System.Drawing.Size(549, 133); + this.filterGroupBox.TabIndex = 5; + this.filterGroupBox.TabStop = false; + this.filterGroupBox.Text = "Filter"; // // previousProcessLinkLabel // @@ -225,19 +227,19 @@ private void InitializeComponent() this.bannerBox.Name = "bannerBox"; this.bannerBox.Size = new System.Drawing.Size(573, 48); this.bannerBox.TabIndex = 6; - this.bannerBox.Text = "Select the process to open."; - this.bannerBox.Title = "Select Process"; + this.bannerBox.Text = "Select the process to which ReClass.NET is to be attached."; + this.bannerBox.Title = "Attach to Process"; // // ProcessBrowserForm // - this.AcceptButton = this.openProcessButton; + this.AcceptButton = this.attachToProcessButton; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(573, 554); this.Controls.Add(this.bannerBox); - this.Controls.Add(this.searchGroupBox); + this.Controls.Add(this.filterGroupBox); this.Controls.Add(this.loadSymbolsCheckBox); - this.Controls.Add(this.openProcessButton); + this.Controls.Add(this.attachToProcessButton); this.Controls.Add(this.processDataGridView); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; @@ -245,10 +247,10 @@ private void InitializeComponent() this.Name = "ProcessBrowserForm"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "ReClass.NET - Select Process"; + this.Text = "ReClass.NET - Attach to Process"; ((System.ComponentModel.ISupportInitialize)(this.processDataGridView)).EndInit(); - this.searchGroupBox.ResumeLayout(false); - this.searchGroupBox.PerformLayout(); + this.filterGroupBox.ResumeLayout(false); + this.filterGroupBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -260,17 +262,17 @@ private void InitializeComponent() private System.Windows.Forms.DataGridView processDataGridView; private System.Windows.Forms.CheckBox filterCheckBox; private System.Windows.Forms.Button refreshButton; - private System.Windows.Forms.Button openProcessButton; + private System.Windows.Forms.Button attachToProcessButton; private System.Windows.Forms.CheckBox loadSymbolsCheckBox; private System.Windows.Forms.DataGridViewImageColumn iconColumn; private System.Windows.Forms.DataGridViewTextBoxColumn processNameColumn; private System.Windows.Forms.DataGridViewTextBoxColumn pidColumn; private System.Windows.Forms.DataGridViewTextBoxColumn pathColumn; - private System.Windows.Forms.GroupBox searchGroupBox; + private System.Windows.Forms.GroupBox filterGroupBox; private System.Windows.Forms.LinkLabel previousProcessLinkLabel; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox filterTextBox; - private UI.BannerBox bannerBox; + private BannerBox bannerBox; } } \ No newline at end of file diff --git a/ReClass.NET/Forms/ProcessBrowserForm.cs b/ReClass.NET/Forms/ProcessBrowserForm.cs new file mode 100644 index 00000000..d4ed7cb3 --- /dev/null +++ b/ReClass.NET/Forms/ProcessBrowserForm.cs @@ -0,0 +1,139 @@ +using System; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; +using ReClassNET.Memory; +using ReClassNET.Native; +using ReClassNET.UI; + +namespace ReClassNET.Forms +{ + public partial class ProcessBrowserForm : IconForm + { + private const string NoPreviousProcess = "No previous process"; + + private static readonly string[] commonProcesses = + { + "[system process]", "system", "svchost.exe", "services.exe", "wininit.exe", + "smss.exe", "csrss.exe", "lsass.exe", "winlogon.exe", "wininit.exe", "dwm.exe" + }; + + /// Gets the selected process. + public ProcessInfo SelectedProcess => (processDataGridView.SelectedRows.Cast().FirstOrDefault()?.DataBoundItem as DataRowView) + ?.Row + ?.Field("info"); + + /// Gets if symbols should get loaded. + public bool LoadSymbols => loadSymbolsCheckBox.Checked; + + public ProcessBrowserForm(string previousProcess) + { + InitializeComponent(); + + processDataGridView.AutoGenerateColumns = false; + + // TODO: Workaround, Mono can't display a DataGridViewImageColumn. + if (NativeMethods.IsUnix()) + { + iconColumn.Visible = false; + } + + previousProcessLinkLabel.Text = string.IsNullOrEmpty(previousProcess) ? NoPreviousProcess : previousProcess; + + RefreshProcessList(); + + foreach (var row in processDataGridView.Rows.Cast()) + { + if (row.Cells[1].Value as string == previousProcess) + { + processDataGridView.CurrentCell = row.Cells[1]; + break; + } + } + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + + #region Event Handler + + private void filterCheckBox_CheckedChanged(object sender, EventArgs e) + { + RefreshProcessList(); + } + + private void filterTextBox_TextChanged(object sender, EventArgs e) + { + ApplyFilter(); + } + + private void refreshButton_Click(object sender, EventArgs e) + { + RefreshProcessList(); + } + + private void previousProcessLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + filterTextBox.Text = previousProcessLinkLabel.Text == NoPreviousProcess ? string.Empty : previousProcessLinkLabel.Text; + } + + private void processDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) + { + AcceptButton.PerformClick(); + } + + #endregion + + /// Queries all processes and displays them. + private void RefreshProcessList() + { + var dt = new DataTable(); + dt.Columns.Add("icon", typeof(Image)); + dt.Columns.Add("name", typeof(string)); + dt.Columns.Add("id", typeof(IntPtr)); + dt.Columns.Add("path", typeof(string)); + dt.Columns.Add("info", typeof(ProcessInfo)); + + var shouldFilter = filterCheckBox.Checked; + + foreach (var p in Program.CoreFunctions.EnumerateProcesses().Where(p => !shouldFilter || !commonProcesses.Contains(p.Name.ToLower()))) + { + var row = dt.NewRow(); + row["icon"] = p.Icon; + row["name"] = p.Name; + row["id"] = p.Id; + row["path"] = p.Path; + row["info"] = p; + dt.Rows.Add(row); + } + + dt.DefaultView.Sort = "name ASC"; + + processDataGridView.DataSource = dt; + + ApplyFilter(); + } + + private void ApplyFilter() + { + var filter = filterTextBox.Text; + if (!string.IsNullOrEmpty(filter)) + { + filter = $"name like '%{filter}%' or path like '%{filter}%' or CONVERT(id, System.String) like '%{filter}%'"; + } + ((DataTable)processDataGridView.DataSource).DefaultView.RowFilter = filter; + } + } +} diff --git a/Forms/ProcessBrowserForm.resx b/ReClass.NET/Forms/ProcessBrowserForm.resx similarity index 89% rename from Forms/ProcessBrowserForm.resx rename to ReClass.NET/Forms/ProcessBrowserForm.resx index 8c9b1f03..2509bcf4 100644 --- a/Forms/ProcessBrowserForm.resx +++ b/ReClass.NET/Forms/ProcessBrowserForm.resx @@ -129,16 +129,4 @@ True - - True - - - True - - - True - - - True - \ No newline at end of file diff --git a/ReClass.NET/Forms/ProcessInfoForm.Designer.cs b/ReClass.NET/Forms/ProcessInfoForm.Designer.cs new file mode 100644 index 00000000..90fa7959 --- /dev/null +++ b/ReClass.NET/Forms/ProcessInfoForm.Designer.cs @@ -0,0 +1,350 @@ +using ReClassNET.Controls; + +namespace ReClassNET.Forms +{ + partial class ProcessInfoForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.setCurrentClassAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.createClassAtAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.dumpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.sectionsDataGridView = new System.Windows.Forms.DataGridView(); + this.addressColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.sizeColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.nameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.protectionColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.typeColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.moduleColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.bannerBox1 = new ReClassNET.Controls.BannerBox(); + this.tabControl = new System.Windows.Forms.TabControl(); + this.modulesTabPage = new System.Windows.Forms.TabPage(); + this.modulesDataGridView = new System.Windows.Forms.DataGridView(); + this.moduleIconDataGridViewImageColumn = new System.Windows.Forms.DataGridViewImageColumn(); + this.moduleNameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.moduleAddressDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.moduleSizeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.modulePathDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.sectionsTabPage = new System.Windows.Forms.TabPage(); + this.contextMenuStrip.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.sectionsDataGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox1)).BeginInit(); + this.tabControl.SuspendLayout(); + this.modulesTabPage.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.modulesDataGridView)).BeginInit(); + this.sectionsTabPage.SuspendLayout(); + this.SuspendLayout(); + // + // contextMenuStrip + // + this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.setCurrentClassAddressToolStripMenuItem, + this.createClassAtAddressToolStripMenuItem, + this.toolStripSeparator2, + this.dumpToolStripMenuItem}); + this.contextMenuStrip.Name = "contextMenuStrip"; + this.contextMenuStrip.Size = new System.Drawing.Size(203, 98); + this.contextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip_Opening); + // + // setCurrentClassAddressToolStripMenuItem + // + this.setCurrentClassAddressToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Exchange_Button; + this.setCurrentClassAddressToolStripMenuItem.Name = "setCurrentClassAddressToolStripMenuItem"; + this.setCurrentClassAddressToolStripMenuItem.Size = new System.Drawing.Size(202, 22); + this.setCurrentClassAddressToolStripMenuItem.Text = "Set current class address"; + this.setCurrentClassAddressToolStripMenuItem.Click += new System.EventHandler(this.setCurrentClassAddressToolStripMenuItem_Click); + // + // createClassAtAddressToolStripMenuItem + // + this.createClassAtAddressToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Class_Add; + this.createClassAtAddressToolStripMenuItem.Name = "createClassAtAddressToolStripMenuItem"; + this.createClassAtAddressToolStripMenuItem.Size = new System.Drawing.Size(202, 22); + this.createClassAtAddressToolStripMenuItem.Text = "Create class at address"; + this.createClassAtAddressToolStripMenuItem.Click += new System.EventHandler(this.createClassAtAddressToolStripMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(199, 6); + // + // dumpToolStripMenuItem + // + this.dumpToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Drive_Go; + this.dumpToolStripMenuItem.Name = "dumpToolStripMenuItem"; + this.dumpToolStripMenuItem.Size = new System.Drawing.Size(202, 22); + this.dumpToolStripMenuItem.Text = "Dump..."; + this.dumpToolStripMenuItem.Click += new System.EventHandler(this.dumpToolStripMenuItem_Click); + // + // sectionsDataGridView + // + this.sectionsDataGridView.AllowUserToAddRows = false; + this.sectionsDataGridView.AllowUserToDeleteRows = false; + this.sectionsDataGridView.AllowUserToResizeRows = false; + this.sectionsDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleHorizontal; + this.sectionsDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.sectionsDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.addressColumn, + this.sizeColumn, + this.nameColumn, + this.protectionColumn, + this.typeColumn, + this.moduleColumn}); + this.sectionsDataGridView.ContextMenuStrip = this.contextMenuStrip; + this.sectionsDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + this.sectionsDataGridView.Location = new System.Drawing.Point(3, 3); + this.sectionsDataGridView.MultiSelect = false; + this.sectionsDataGridView.Name = "sectionsDataGridView"; + this.sectionsDataGridView.ReadOnly = true; + this.sectionsDataGridView.RowHeadersVisible = false; + this.sectionsDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.sectionsDataGridView.Size = new System.Drawing.Size(796, 386); + this.sectionsDataGridView.TabIndex = 0; + this.sectionsDataGridView.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.sectionsDataGridView_CellMouseDoubleClick); + this.sectionsDataGridView.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.SelectRow_CellMouseDown); + // + // addressColumn + // + this.addressColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.addressColumn.DataPropertyName = "address"; + this.addressColumn.HeaderText = "Address"; + this.addressColumn.Name = "addressColumn"; + this.addressColumn.ReadOnly = true; + this.addressColumn.Width = 70; + // + // sizeColumn + // + this.sizeColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.sizeColumn.DataPropertyName = "size"; + this.sizeColumn.HeaderText = "Size"; + this.sizeColumn.Name = "sizeColumn"; + this.sizeColumn.ReadOnly = true; + this.sizeColumn.Width = 52; + // + // nameColumn + // + this.nameColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.nameColumn.DataPropertyName = "name"; + this.nameColumn.HeaderText = "Name"; + this.nameColumn.Name = "nameColumn"; + this.nameColumn.ReadOnly = true; + this.nameColumn.Width = 60; + // + // protectionColumn + // + this.protectionColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.protectionColumn.DataPropertyName = "protection"; + this.protectionColumn.HeaderText = "Protection"; + this.protectionColumn.Name = "protectionColumn"; + this.protectionColumn.ReadOnly = true; + this.protectionColumn.Width = 80; + // + // typeColumn + // + this.typeColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.typeColumn.DataPropertyName = "type"; + this.typeColumn.HeaderText = "Type"; + this.typeColumn.Name = "typeColumn"; + this.typeColumn.ReadOnly = true; + this.typeColumn.Width = 56; + // + // moduleColumn + // + this.moduleColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.moduleColumn.DataPropertyName = "module"; + this.moduleColumn.HeaderText = "Module"; + this.moduleColumn.Name = "moduleColumn"; + this.moduleColumn.ReadOnly = true; + // + // bannerBox1 + // + this.bannerBox1.Dock = System.Windows.Forms.DockStyle.Top; + this.bannerBox1.Icon = global::ReClassNET.Properties.Resources.B32x32_Magnifier; + this.bannerBox1.Location = new System.Drawing.Point(0, 0); + this.bannerBox1.Name = "bannerBox1"; + this.bannerBox1.Size = new System.Drawing.Size(834, 48); + this.bannerBox1.TabIndex = 2; + this.bannerBox1.Text = "View informations about the current process."; + this.bannerBox1.Title = "Process Informations"; + // + // tabControl + // + this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl.Controls.Add(this.modulesTabPage); + this.tabControl.Controls.Add(this.sectionsTabPage); + this.tabControl.Location = new System.Drawing.Point(12, 60); + this.tabControl.Name = "tabControl"; + this.tabControl.SelectedIndex = 0; + this.tabControl.Size = new System.Drawing.Size(810, 418); + this.tabControl.TabIndex = 3; + // + // modulesTabPage + // + this.modulesTabPage.Controls.Add(this.modulesDataGridView); + this.modulesTabPage.Location = new System.Drawing.Point(4, 22); + this.modulesTabPage.Name = "modulesTabPage"; + this.modulesTabPage.Padding = new System.Windows.Forms.Padding(3); + this.modulesTabPage.Size = new System.Drawing.Size(802, 392); + this.modulesTabPage.TabIndex = 1; + this.modulesTabPage.Text = "Modules"; + this.modulesTabPage.UseVisualStyleBackColor = true; + // + // modulesDataGridView + // + this.modulesDataGridView.AllowUserToAddRows = false; + this.modulesDataGridView.AllowUserToDeleteRows = false; + this.modulesDataGridView.AllowUserToResizeRows = false; + this.modulesDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleHorizontal; + this.modulesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.modulesDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.moduleIconDataGridViewImageColumn, + this.moduleNameDataGridViewTextBoxColumn, + this.moduleAddressDataGridViewTextBoxColumn, + this.moduleSizeDataGridViewTextBoxColumn, + this.modulePathDataGridViewTextBoxColumn}); + this.modulesDataGridView.ContextMenuStrip = this.contextMenuStrip; + this.modulesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + this.modulesDataGridView.Location = new System.Drawing.Point(3, 3); + this.modulesDataGridView.MultiSelect = false; + this.modulesDataGridView.Name = "modulesDataGridView"; + this.modulesDataGridView.ReadOnly = true; + this.modulesDataGridView.RowHeadersVisible = false; + this.modulesDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.modulesDataGridView.Size = new System.Drawing.Size(796, 386); + this.modulesDataGridView.TabIndex = 1; + this.modulesDataGridView.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.SelectRow_CellMouseDown); + // + // moduleIconDataGridViewImageColumn + // + this.moduleIconDataGridViewImageColumn.DataPropertyName = "icon"; + this.moduleIconDataGridViewImageColumn.HeaderText = ""; + this.moduleIconDataGridViewImageColumn.MinimumWidth = 18; + this.moduleIconDataGridViewImageColumn.Name = "moduleIconDataGridViewImageColumn"; + this.moduleIconDataGridViewImageColumn.ReadOnly = true; + this.moduleIconDataGridViewImageColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.moduleIconDataGridViewImageColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.moduleIconDataGridViewImageColumn.Width = 18; + // + // moduleNameDataGridViewTextBoxColumn + // + this.moduleNameDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.moduleNameDataGridViewTextBoxColumn.DataPropertyName = "name"; + this.moduleNameDataGridViewTextBoxColumn.HeaderText = "Module"; + this.moduleNameDataGridViewTextBoxColumn.Name = "moduleNameDataGridViewTextBoxColumn"; + this.moduleNameDataGridViewTextBoxColumn.ReadOnly = true; + this.moduleNameDataGridViewTextBoxColumn.Width = 67; + // + // moduleAddressDataGridViewTextBoxColumn + // + this.moduleAddressDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.moduleAddressDataGridViewTextBoxColumn.DataPropertyName = "address"; + this.moduleAddressDataGridViewTextBoxColumn.HeaderText = "Address"; + this.moduleAddressDataGridViewTextBoxColumn.Name = "moduleAddressDataGridViewTextBoxColumn"; + this.moduleAddressDataGridViewTextBoxColumn.ReadOnly = true; + this.moduleAddressDataGridViewTextBoxColumn.Width = 70; + // + // moduleSizeDataGridViewTextBoxColumn + // + this.moduleSizeDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.moduleSizeDataGridViewTextBoxColumn.DataPropertyName = "size"; + this.moduleSizeDataGridViewTextBoxColumn.HeaderText = "Size"; + this.moduleSizeDataGridViewTextBoxColumn.Name = "moduleSizeDataGridViewTextBoxColumn"; + this.moduleSizeDataGridViewTextBoxColumn.ReadOnly = true; + this.moduleSizeDataGridViewTextBoxColumn.Width = 52; + // + // modulePathDataGridViewTextBoxColumn + // + this.modulePathDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.modulePathDataGridViewTextBoxColumn.DataPropertyName = "path"; + this.modulePathDataGridViewTextBoxColumn.HeaderText = "Path"; + this.modulePathDataGridViewTextBoxColumn.Name = "modulePathDataGridViewTextBoxColumn"; + this.modulePathDataGridViewTextBoxColumn.ReadOnly = true; + // + // sectionsTabPage + // + this.sectionsTabPage.Controls.Add(this.sectionsDataGridView); + this.sectionsTabPage.Location = new System.Drawing.Point(4, 22); + this.sectionsTabPage.Name = "sectionsTabPage"; + this.sectionsTabPage.Padding = new System.Windows.Forms.Padding(3); + this.sectionsTabPage.Size = new System.Drawing.Size(802, 392); + this.sectionsTabPage.TabIndex = 0; + this.sectionsTabPage.Text = "Sections"; + this.sectionsTabPage.UseVisualStyleBackColor = true; + // + // ProcessInfoForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(834, 490); + this.Controls.Add(this.tabControl); + this.Controls.Add(this.bannerBox1); + this.MinimumSize = new System.Drawing.Size(586, 320); + this.Name = "ProcessInfoForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "ReClass.NET - Process Informations"; + this.Load += new System.EventHandler(this.ProcessInfoForm_Load); + this.contextMenuStrip.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.sectionsDataGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox1)).EndInit(); + this.tabControl.ResumeLayout(false); + this.modulesTabPage.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.modulesDataGridView)).EndInit(); + this.sectionsTabPage.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataGridView sectionsDataGridView; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip; + private System.Windows.Forms.ToolStripMenuItem setCurrentClassAddressToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem createClassAtAddressToolStripMenuItem; + private BannerBox bannerBox1; + private System.Windows.Forms.TabControl tabControl; + private System.Windows.Forms.TabPage modulesTabPage; + private System.Windows.Forms.DataGridView modulesDataGridView; + private System.Windows.Forms.TabPage sectionsTabPage; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem dumpToolStripMenuItem; + private System.Windows.Forms.DataGridViewImageColumn moduleIconDataGridViewImageColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn moduleNameDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn moduleAddressDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn moduleSizeDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn modulePathDataGridViewTextBoxColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn addressColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn sizeColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn nameColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn protectionColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn typeColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn moduleColumn; + } +} \ No newline at end of file diff --git a/ReClass.NET/Forms/ProcessInfoForm.cs b/ReClass.NET/Forms/ProcessInfoForm.cs new file mode 100644 index 00000000..fc56d3eb --- /dev/null +++ b/ReClass.NET/Forms/ProcessInfoForm.cs @@ -0,0 +1,252 @@ +using System; +using System.ComponentModel; +using System.Data; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; +using ReClassNET.Memory; +using ReClassNET.Native; +using ReClassNET.UI; + +namespace ReClassNET.Forms +{ + public partial class ProcessInfoForm : IconForm + { + private readonly IProcessReader process; + + /// The context menu of the sections grid view. + public ContextMenuStrip GridContextMenu => contextMenuStrip; + + public ProcessInfoForm(IProcessReader process) + { + Contract.Requires(process != null); + + this.process = process; + + InitializeComponent(); + + tabControl.ImageList = new ImageList(); + tabControl.ImageList.Images.Add(Properties.Resources.B16x16_Category); + tabControl.ImageList.Images.Add(Properties.Resources.B16x16_Page_White_Stack); + modulesTabPage.ImageIndex = 0; + sectionsTabPage.ImageIndex = 1; + + modulesDataGridView.AutoGenerateColumns = false; + sectionsDataGridView.AutoGenerateColumns = false; + + // TODO: Workaround, Mono can't display a DataGridViewImageColumn. + if (NativeMethods.IsUnix()) + { + moduleIconDataGridViewImageColumn.Visible = false; + } + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + + #region Event Handler + + private async void ProcessInfoForm_Load(object sender, EventArgs e) + { + var sectionsTable = new DataTable(); + sectionsTable.Columns.Add("address", typeof(string)); + sectionsTable.Columns.Add("size", typeof(string)); + sectionsTable.Columns.Add("name", typeof(string)); + sectionsTable.Columns.Add("protection", typeof(string)); + sectionsTable.Columns.Add("type", typeof(string)); + sectionsTable.Columns.Add("module", typeof(string)); + sectionsTable.Columns.Add("section", typeof(Section)); + + var modulesTable = new DataTable(); + modulesTable.Columns.Add("icon", typeof(Icon)); + modulesTable.Columns.Add("name", typeof(string)); + modulesTable.Columns.Add("address", typeof(string)); + modulesTable.Columns.Add("size", typeof(string)); + modulesTable.Columns.Add("path", typeof(string)); + modulesTable.Columns.Add("module", typeof(Module)); + + await Task.Run(() => + { + if (process.EnumerateRemoteSectionsAndModules(out var sections, out var modules)) + { + foreach (var section in sections) + { + var row = sectionsTable.NewRow(); + row["address"] = section.Start.ToString(Constants.AddressHexFormat); + row["size"] = section.Size.ToString(Constants.AddressHexFormat); + row["name"] = section.Name; + row["protection"] = section.Protection.ToString(); + row["type"] = section.Type.ToString(); + row["module"] = section.ModuleName; + row["section"] = section; + sectionsTable.Rows.Add(row); + } + foreach (var module in modules) + { + var row = modulesTable.NewRow(); + row["icon"] = NativeMethods.GetIconForFile(module.Path); + row["name"] = module.Name; + row["address"] = module.Start.ToString(Constants.AddressHexFormat); + row["size"] = module.Size.ToString(Constants.AddressHexFormat); + row["path"] = module.Path; + row["module"] = module; + modulesTable.Rows.Add(row); + } + } + }); + + sectionsDataGridView.DataSource = sectionsTable; + modulesDataGridView.DataSource = modulesTable; + } + + private void SelectRow_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) + { + if (!(sender is DataGridView dgv)) + { + return; + } + + if (e.Button == MouseButtons.Right) + { + int row = e.RowIndex; + if (e.RowIndex != -1) + { + dgv.Rows[row].Selected = true; + } + } + } + + private void contextMenuStrip_Opening(object sender, CancelEventArgs e) + { + var sourceControl = (sender as ContextMenuStrip)?.SourceControl; + + e.Cancel = sourceControl == null || (sourceControl == modulesDataGridView && GetSelectedModule() == null) || (sourceControl == sectionsDataGridView && GetSelectedSection() == null); + } + + private void setCurrentClassAddressToolStripMenuItem_Click(object sender, EventArgs e) + { + LinkedWindowFeatures.SetCurrentClassAddress(GetSelectedAddress(sender)); + } + + private void createClassAtAddressToolStripMenuItem_Click(object sender, EventArgs e) + { + LinkedWindowFeatures.CreateClassAtAddress(GetSelectedAddress(sender), true); + } + + private void dumpToolStripMenuItem_Click(object sender, EventArgs e) + { + Func createDialogFn; + Action dumpFn; + + if (GetToolStripSourceControl(sender) == modulesDataGridView) + { + var module = GetSelectedModule(); + if (module == null) + { + return; + } + + createDialogFn = () => new SaveFileDialog + { + FileName = $"{Path.GetFileNameWithoutExtension(module.Name)}_Dumped{Path.GetExtension(module.Name)}", + InitialDirectory = Path.GetDirectoryName(module.Path) + }; + + dumpFn = (reader, stream) => + { + Dumper.DumpModule(reader, module, stream); + + MessageBox.Show("Module successfully dumped.", Constants.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); + }; + } + else + { + var section = GetSelectedSection(); + if (section == null) + { + return; + } + + createDialogFn = () => new SaveFileDialog + { + FileName = $"Section_{section.Start.ToString("X")}_{section.End.ToString("X")}.dat" + }; + + dumpFn = (reader, stream) => + { + Dumper.DumpSection(reader, section, stream); + + MessageBox.Show("Section successfully dumped.", Constants.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); + }; + } + + using var sfd = createDialogFn(); + sfd.Filter = "All|*.*"; + + if (sfd.ShowDialog() != DialogResult.OK) + { + return; + } + + try + { + using var stream = sfd.OpenFile(); + + dumpFn(process, stream); + } + catch (Exception ex) + { + Program.ShowException(ex); + } + } + + private void sectionsDataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) + { + setCurrentClassAddressToolStripMenuItem_Click(sender, e); + + Close(); + } + + #endregion + + private IntPtr GetSelectedAddress(object sender) + { + if (GetToolStripSourceControl(sender) == modulesDataGridView) + { + return GetSelectedModule()?.Start ?? IntPtr.Zero; + } + return GetSelectedSection()?.Start ?? IntPtr.Zero; + } + + private static Control GetToolStripSourceControl(object sender) + { + return ((sender as ToolStripMenuItem)?.GetCurrentParent() as ContextMenuStrip)?.SourceControl; + } + + private Module GetSelectedModule() + { + var row = modulesDataGridView.SelectedRows.Cast().FirstOrDefault()?.DataBoundItem as DataRowView; + return row?["module"] as Module; + } + + private Section GetSelectedSection() + { + var row = sectionsDataGridView.SelectedRows.Cast().FirstOrDefault()?.DataBoundItem as DataRowView; + return row?["section"] as Section; + } + } +} diff --git a/ReClass.NET/Forms/ProcessInfoForm.resx b/ReClass.NET/Forms/ProcessInfoForm.resx new file mode 100644 index 00000000..e4940a88 --- /dev/null +++ b/ReClass.NET/Forms/ProcessInfoForm.resx @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/Forms/ProcessMemoryViewForm.Designer.cs b/ReClass.NET/Forms/ProcessMemoryViewForm.Designer.cs similarity index 95% rename from Forms/ProcessMemoryViewForm.Designer.cs rename to ReClass.NET/Forms/ProcessMemoryViewForm.Designer.cs index 114dfcf4..ad90bf60 100644 --- a/Forms/ProcessMemoryViewForm.Designer.cs +++ b/ReClass.NET/Forms/ProcessMemoryViewForm.Designer.cs @@ -37,14 +37,13 @@ private void InitializeComponent() this.createClassAtAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.regionsGroupBox = new System.Windows.Forms.GroupBox(); this.sectionsDataGridView = new System.Windows.Forms.DataGridView(); + this.bannerBox1 = new ReClassNET.UI.BannerBox(); this.addressColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.sizeColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.nameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.protectionColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.stateColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.typeColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.moduleColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.bannerBox1 = new ReClassNET.UI.BannerBox(); this.contextMenuStrip.SuspendLayout(); this.regionsGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.sectionsDataGridView)).BeginInit(); @@ -109,7 +108,6 @@ private void InitializeComponent() this.sizeColumn, this.nameColumn, this.protectionColumn, - this.stateColumn, this.typeColumn, this.moduleColumn}); this.sectionsDataGridView.Location = new System.Drawing.Point(6, 19); @@ -124,6 +122,17 @@ private void InitializeComponent() this.sectionsDataGridView.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.sectionsDataGridView_CellMouseDoubleClick); this.sectionsDataGridView.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.sectionsDataGridView_CellMouseDown); // + // bannerBox1 + // + this.bannerBox1.Dock = System.Windows.Forms.DockStyle.Top; + this.bannerBox1.Icon = global::ReClassNET.Properties.Resources.B32x32_Magnifier; + this.bannerBox1.Location = new System.Drawing.Point(0, 0); + this.bannerBox1.Name = "bannerBox1"; + this.bannerBox1.Size = new System.Drawing.Size(834, 48); + this.bannerBox1.TabIndex = 2; + this.bannerBox1.Text = "View all memory regions mapped in the process."; + this.bannerBox1.Title = "Memory Viewer"; + // // addressColumn // this.addressColumn.DataPropertyName = "address"; @@ -163,15 +172,6 @@ private void InitializeComponent() this.protectionColumn.ReadOnly = true; this.protectionColumn.Width = 80; // - // stateColumn - // - this.stateColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.stateColumn.DataPropertyName = "state"; - this.stateColumn.HeaderText = "State"; - this.stateColumn.Name = "stateColumn"; - this.stateColumn.ReadOnly = true; - this.stateColumn.Width = 57; - // // typeColumn // this.typeColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; @@ -189,17 +189,6 @@ private void InitializeComponent() this.moduleColumn.Name = "moduleColumn"; this.moduleColumn.ReadOnly = true; // - // bannerBox1 - // - this.bannerBox1.Dock = System.Windows.Forms.DockStyle.Top; - this.bannerBox1.Icon = global::ReClassNET.Properties.Resources.B32x32_Magnifier; - this.bannerBox1.Location = new System.Drawing.Point(0, 0); - this.bannerBox1.Name = "bannerBox1"; - this.bannerBox1.Size = new System.Drawing.Size(834, 48); - this.bannerBox1.TabIndex = 2; - this.bannerBox1.Text = "View all memory regions mapped in the process."; - this.bannerBox1.Title = "Memory Viewer"; - // // ProcessMemoryViewer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -222,18 +211,17 @@ private void InitializeComponent() #endregion private System.Windows.Forms.DataGridView sectionsDataGridView; - private System.Windows.Forms.DataGridViewTextBoxColumn addressColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn sizeColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn nameColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn protectionColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn stateColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn typeColumn; - private System.Windows.Forms.DataGridViewTextBoxColumn moduleColumn; private System.Windows.Forms.GroupBox regionsGroupBox; private System.Windows.Forms.ContextMenuStrip contextMenuStrip; private System.Windows.Forms.ToolStripMenuItem setCurrentClassAddressToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem createClassAtAddressToolStripMenuItem; private UI.BannerBox bannerBox1; + private System.Windows.Forms.DataGridViewTextBoxColumn addressColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn sizeColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn nameColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn protectionColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn typeColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn moduleColumn; } } \ No newline at end of file diff --git a/Forms/ProcessMemoryViewForm.cs b/ReClass.NET/Forms/ProcessMemoryViewForm.cs similarity index 90% rename from Forms/ProcessMemoryViewForm.cs rename to ReClass.NET/Forms/ProcessMemoryViewForm.cs index 5cd54d9e..24ca0bad 100644 --- a/Forms/ProcessMemoryViewForm.cs +++ b/ReClass.NET/Forms/ProcessMemoryViewForm.cs @@ -30,22 +30,22 @@ public ProcessMemoryViewer(RemoteProcess process, ClassNodeView classesView) if (process.IsValid) { DataTable dt = new DataTable(); - dt.Columns.Add("address", typeof(long)); - dt.Columns.Add("size", typeof(long)); + dt.Columns.Add("address", typeof(string)); + dt.Columns.Add("address_val", typeof(IntPtr)); + dt.Columns.Add("size", typeof(ulong)); dt.Columns.Add("name", typeof(string)); dt.Columns.Add("protection", typeof(string)); - dt.Columns.Add("state", typeof(string)); dt.Columns.Add("type", typeof(string)); dt.Columns.Add("module", typeof(string)); process.NativeHelper.EnumerateRemoteSectionsAndModules(process.Process.Handle, delegate (IntPtr baseAddress, IntPtr regionSize, string name, NativeMethods.StateEnum state, NativeMethods.AllocationProtectEnum protection, NativeMethods.TypeEnum type, string modulePath) { var row = dt.NewRow(); - row["address"] = baseAddress.ToInt64(); - row["size"] = regionSize.ToInt64(); + row["address"] = baseAddress.ToString("X"); + row["address_val"] = baseAddress; + row["size"] = (ulong)regionSize.ToInt64(); row["name"] = name; row["protection"] = protection.ToString(); - row["state"] = state.ToString(); row["type"] = type.ToString(); row["module"] = Path.GetFileName(modulePath); dt.Rows.Add(row); @@ -122,7 +122,7 @@ private IntPtr GetSelectedRegionAddress() var row = sectionsDataGridView.SelectedRows.Cast().FirstOrDefault()?.DataBoundItem as DataRowView; if (row != null) { - return (IntPtr)(long)row["address"]; + return (IntPtr)row["address_val"]; } return IntPtr.Zero; } diff --git a/Forms/ProcessMemoryViewForm.resx b/ReClass.NET/Forms/ProcessMemoryViewForm.resx similarity index 97% rename from Forms/ProcessMemoryViewForm.resx rename to ReClass.NET/Forms/ProcessMemoryViewForm.resx index 7c975f22..63396554 100644 --- a/Forms/ProcessMemoryViewForm.resx +++ b/ReClass.NET/Forms/ProcessMemoryViewForm.resx @@ -132,9 +132,6 @@ True - - True - True diff --git a/ReClass.NET/Forms/ScannerForm.Designer.cs b/ReClass.NET/Forms/ScannerForm.Designer.cs new file mode 100644 index 00000000..d6fd02ac --- /dev/null +++ b/ReClass.NET/Forms/ScannerForm.Designer.cs @@ -0,0 +1,883 @@ +using ReClassNET.Controls; + +namespace ReClassNET.Forms +{ + partial class ScannerForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.bannerBox = new ReClassNET.Controls.BannerBox(); + this.filterGroupBox = new System.Windows.Forms.GroupBox(); + this.valueTypeComboBox = new ReClassNET.Forms.ScannerForm.ScanValueTypeComboBox(); + this.label3 = new System.Windows.Forms.Label(); + this.compareTypeComboBox = new ReClassNET.Forms.ScannerForm.ScanCompareTypeComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.isHexCheckBox = new System.Windows.Forms.CheckBox(); + this.dualValueBox = new ReClassNET.Controls.DualValueBox(); + this.scanOptionsGroupBox = new System.Windows.Forms.GroupBox(); + this.fastScanAlignmentTextBox = new System.Windows.Forms.TextBox(); + this.fastScanCheckBox = new System.Windows.Forms.CheckBox(); + this.scanCopyOnWriteCheckBox = new System.Windows.Forms.CheckBox(); + this.scanExecutableCheckBox = new System.Windows.Forms.CheckBox(); + this.scanWritableCheckBox = new System.Windows.Forms.CheckBox(); + this.scanMappedCheckBox = new System.Windows.Forms.CheckBox(); + this.scanImageCheckBox = new System.Windows.Forms.CheckBox(); + this.scanPrivateCheckBox = new System.Windows.Forms.CheckBox(); + this.stopAddressTextBox = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.startAddressTextBox = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); + this.floatingOptionsGroupBox = new System.Windows.Forms.GroupBox(); + this.roundTruncateRadioButton = new System.Windows.Forms.RadioButton(); + this.roundLooseRadioButton = new System.Windows.Forms.RadioButton(); + this.roundStrictRadioButton = new System.Windows.Forms.RadioButton(); + this.stringOptionsGroupBox = new System.Windows.Forms.GroupBox(); + this.caseSensitiveCheckBox = new System.Windows.Forms.CheckBox(); + this.encodingUtf32RadioButton = new System.Windows.Forms.RadioButton(); + this.encodingUtf16RadioButton = new System.Windows.Forms.RadioButton(); + this.encodingUtf8RadioButton = new System.Windows.Forms.RadioButton(); + this.firstScanButton = new System.Windows.Forms.Button(); + this.nextScanButton = new System.Windows.Forms.Button(); + this.scanProgressBar = new System.Windows.Forms.ProgressBar(); + this.resultCountLabel = new System.Windows.Forms.Label(); + this.updateValuesTimer = new System.Windows.Forms.Timer(this.components); + this.resultMemoryRecordList = new ReClassNET.Controls.MemoryRecordList(); + this.resultListContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.addSelectedResultsToAddressListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeSelectedRecordsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.changeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.descriptionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.valueTypeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.valueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.setCurrentClassAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.createClassAtAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.findOutWhatAccessesThisAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.findOutWhatWritesToThisAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.copyAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addressListMemoryRecordList = new ReClassNET.Controls.MemoryRecordList(); + this.toolStripPanel = new System.Windows.Forms.ToolStripPanel(); + this.menuToolStrip = new System.Windows.Forms.ToolStrip(); + this.openAddressFileToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.saveAddressFileToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.saveAddressFileAsToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.clearAddressListToolStripButton = new System.Windows.Forms.ToolStripButton(); + this.infoToolTip = new System.Windows.Forms.ToolTip(this.components); + this.undoIconButton = new ReClassNET.Controls.IconButton(); + this.showInputCorrelatorIconButton = new ReClassNET.Controls.IconButton(); + this.cancelScanIconButton = new ReClassNET.Controls.IconButton(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); + this.filterGroupBox.SuspendLayout(); + this.scanOptionsGroupBox.SuspendLayout(); + this.flowLayoutPanel.SuspendLayout(); + this.floatingOptionsGroupBox.SuspendLayout(); + this.stringOptionsGroupBox.SuspendLayout(); + this.resultListContextMenuStrip.SuspendLayout(); + this.toolStripPanel.SuspendLayout(); + this.menuToolStrip.SuspendLayout(); + this.SuspendLayout(); + // + // bannerBox + // + this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; + this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B32x32_Eye; + this.bannerBox.Location = new System.Drawing.Point(0, 0); + this.bannerBox.Name = "bannerBox"; + this.bannerBox.Size = new System.Drawing.Size(612, 48); + this.bannerBox.TabIndex = 7; + this.bannerBox.Text = "Scan the process memory for specific values."; + this.bannerBox.Title = "Scanner"; + // + // filterGroupBox + // + this.filterGroupBox.Controls.Add(this.valueTypeComboBox); + this.filterGroupBox.Controls.Add(this.label3); + this.filterGroupBox.Controls.Add(this.compareTypeComboBox); + this.filterGroupBox.Controls.Add(this.label1); + this.filterGroupBox.Controls.Add(this.isHexCheckBox); + this.filterGroupBox.Controls.Add(this.dualValueBox); + this.filterGroupBox.Location = new System.Drawing.Point(3, 3); + this.filterGroupBox.Margin = new System.Windows.Forms.Padding(3, 3, 3, 1); + this.filterGroupBox.Name = "filterGroupBox"; + this.filterGroupBox.Size = new System.Drawing.Size(308, 103); + this.filterGroupBox.TabIndex = 8; + this.filterGroupBox.TabStop = false; + this.filterGroupBox.Text = "Filter"; + // + // valueTypeComboBox + // + this.valueTypeComboBox.Location = new System.Drawing.Point(72, 74); + this.valueTypeComboBox.Name = "valueTypeComboBox"; + this.valueTypeComboBox.Size = new System.Drawing.Size(224, 21); + this.valueTypeComboBox.TabIndex = 8; + this.valueTypeComboBox.SelectionChangeCommitted += new System.EventHandler(this.valueTypeComboBox_SelectionChangeCommitted); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(3, 77); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(64, 13); + this.label3.TabIndex = 7; + this.label3.Text = "Value Type:"; + // + // compareTypeComboBox + // + this.compareTypeComboBox.Location = new System.Drawing.Point(72, 50); + this.compareTypeComboBox.Name = "compareTypeComboBox"; + this.compareTypeComboBox.Size = new System.Drawing.Size(224, 21); + this.compareTypeComboBox.TabIndex = 5; + this.compareTypeComboBox.SelectionChangeCommitted += new System.EventHandler(this.scanTypeComboBox_SelectionChangeCommitted); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(3, 53); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(62, 13); + this.label1.TabIndex = 4; + this.label1.Text = "Scan Type:"; + // + // isHexCheckBox + // + this.isHexCheckBox.AutoSize = true; + this.isHexCheckBox.Location = new System.Drawing.Point(6, 28); + this.isHexCheckBox.Name = "isHexCheckBox"; + this.isHexCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.isHexCheckBox.Size = new System.Drawing.Size(56, 17); + this.isHexCheckBox.TabIndex = 3; + this.isHexCheckBox.Text = "Is Hex"; + this.isHexCheckBox.UseVisualStyleBackColor = true; + // + // dualValueBox + // + this.dualValueBox.Location = new System.Drawing.Point(72, 12); + this.dualValueBox.Name = "dualValueBox"; + this.dualValueBox.ShowSecondInputField = false; + this.dualValueBox.Size = new System.Drawing.Size(224, 34); + this.dualValueBox.TabIndex = 2; + this.dualValueBox.Value1 = "0"; + this.dualValueBox.Value2 = "0"; + // + // scanOptionsGroupBox + // + this.scanOptionsGroupBox.Controls.Add(this.fastScanAlignmentTextBox); + this.scanOptionsGroupBox.Controls.Add(this.fastScanCheckBox); + this.scanOptionsGroupBox.Controls.Add(this.scanCopyOnWriteCheckBox); + this.scanOptionsGroupBox.Controls.Add(this.scanExecutableCheckBox); + this.scanOptionsGroupBox.Controls.Add(this.scanWritableCheckBox); + this.scanOptionsGroupBox.Controls.Add(this.scanMappedCheckBox); + this.scanOptionsGroupBox.Controls.Add(this.scanImageCheckBox); + this.scanOptionsGroupBox.Controls.Add(this.scanPrivateCheckBox); + this.scanOptionsGroupBox.Controls.Add(this.stopAddressTextBox); + this.scanOptionsGroupBox.Controls.Add(this.label4); + this.scanOptionsGroupBox.Controls.Add(this.startAddressTextBox); + this.scanOptionsGroupBox.Controls.Add(this.label2); + this.scanOptionsGroupBox.Location = new System.Drawing.Point(3, 239); + this.scanOptionsGroupBox.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3); + this.scanOptionsGroupBox.Name = "scanOptionsGroupBox"; + this.scanOptionsGroupBox.Size = new System.Drawing.Size(308, 141); + this.scanOptionsGroupBox.TabIndex = 9; + this.scanOptionsGroupBox.TabStop = false; + this.scanOptionsGroupBox.Text = "Scan Options"; + // + // fastScanAlignmentTextBox + // + this.fastScanAlignmentTextBox.Location = new System.Drawing.Point(144, 112); + this.fastScanAlignmentTextBox.Name = "fastScanAlignmentTextBox"; + this.fastScanAlignmentTextBox.Size = new System.Drawing.Size(26, 20); + this.fastScanAlignmentTextBox.TabIndex = 11; + // + // fastScanCheckBox + // + this.fastScanCheckBox.AutoSize = true; + this.fastScanCheckBox.Checked = true; + this.fastScanCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.fastScanCheckBox.Location = new System.Drawing.Point(9, 114); + this.fastScanCheckBox.Name = "fastScanCheckBox"; + this.fastScanCheckBox.Size = new System.Drawing.Size(129, 17); + this.fastScanCheckBox.TabIndex = 10; + this.fastScanCheckBox.Text = "Fast Scan, Alignment:"; + this.fastScanCheckBox.UseVisualStyleBackColor = true; + // + // scanCopyOnWriteCheckBox + // + this.scanCopyOnWriteCheckBox.AutoSize = true; + this.scanCopyOnWriteCheckBox.Location = new System.Drawing.Point(189, 91); + this.scanCopyOnWriteCheckBox.Name = "scanCopyOnWriteCheckBox"; + this.scanCopyOnWriteCheckBox.Size = new System.Drawing.Size(95, 17); + this.scanCopyOnWriteCheckBox.TabIndex = 9; + this.scanCopyOnWriteCheckBox.Text = "Copy On Write"; + this.scanCopyOnWriteCheckBox.ThreeState = true; + this.scanCopyOnWriteCheckBox.UseVisualStyleBackColor = true; + // + // scanExecutableCheckBox + // + this.scanExecutableCheckBox.AutoSize = true; + this.scanExecutableCheckBox.Checked = true; + this.scanExecutableCheckBox.CheckState = System.Windows.Forms.CheckState.Indeterminate; + this.scanExecutableCheckBox.Location = new System.Drawing.Point(91, 91); + this.scanExecutableCheckBox.Name = "scanExecutableCheckBox"; + this.scanExecutableCheckBox.Size = new System.Drawing.Size(79, 17); + this.scanExecutableCheckBox.TabIndex = 8; + this.scanExecutableCheckBox.Text = "Executable"; + this.scanExecutableCheckBox.ThreeState = true; + this.scanExecutableCheckBox.UseVisualStyleBackColor = true; + // + // scanWritableCheckBox + // + this.scanWritableCheckBox.AutoSize = true; + this.scanWritableCheckBox.Checked = true; + this.scanWritableCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.scanWritableCheckBox.Location = new System.Drawing.Point(9, 91); + this.scanWritableCheckBox.Name = "scanWritableCheckBox"; + this.scanWritableCheckBox.Size = new System.Drawing.Size(65, 17); + this.scanWritableCheckBox.TabIndex = 7; + this.scanWritableCheckBox.Text = "Writable"; + this.scanWritableCheckBox.ThreeState = true; + this.scanWritableCheckBox.UseVisualStyleBackColor = true; + // + // scanMappedCheckBox + // + this.scanMappedCheckBox.AutoSize = true; + this.scanMappedCheckBox.Location = new System.Drawing.Point(189, 68); + this.scanMappedCheckBox.Name = "scanMappedCheckBox"; + this.scanMappedCheckBox.Size = new System.Drawing.Size(65, 17); + this.scanMappedCheckBox.TabIndex = 6; + this.scanMappedCheckBox.Text = "Mapped"; + this.scanMappedCheckBox.UseVisualStyleBackColor = true; + // + // scanImageCheckBox + // + this.scanImageCheckBox.AutoSize = true; + this.scanImageCheckBox.Checked = true; + this.scanImageCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.scanImageCheckBox.Location = new System.Drawing.Point(91, 68); + this.scanImageCheckBox.Name = "scanImageCheckBox"; + this.scanImageCheckBox.Size = new System.Drawing.Size(55, 17); + this.scanImageCheckBox.TabIndex = 5; + this.scanImageCheckBox.Text = "Image"; + this.scanImageCheckBox.UseVisualStyleBackColor = true; + // + // scanPrivateCheckBox + // + this.scanPrivateCheckBox.AutoSize = true; + this.scanPrivateCheckBox.Checked = true; + this.scanPrivateCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.scanPrivateCheckBox.Location = new System.Drawing.Point(9, 68); + this.scanPrivateCheckBox.Name = "scanPrivateCheckBox"; + this.scanPrivateCheckBox.Size = new System.Drawing.Size(59, 17); + this.scanPrivateCheckBox.TabIndex = 4; + this.scanPrivateCheckBox.Text = "Private"; + this.scanPrivateCheckBox.UseVisualStyleBackColor = true; + // + // stopAddressTextBox + // + this.stopAddressTextBox.Location = new System.Drawing.Point(66, 42); + this.stopAddressTextBox.Name = "stopAddressTextBox"; + this.stopAddressTextBox.Size = new System.Drawing.Size(218, 20); + this.stopAddressTextBox.TabIndex = 3; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(6, 45); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(32, 13); + this.label4.TabIndex = 2; + this.label4.Text = "Stop:"; + // + // startAddressTextBox + // + this.startAddressTextBox.Location = new System.Drawing.Point(66, 19); + this.startAddressTextBox.Name = "startAddressTextBox"; + this.startAddressTextBox.Size = new System.Drawing.Size(218, 20); + this.startAddressTextBox.TabIndex = 1; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(6, 22); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(32, 13); + this.label2.TabIndex = 0; + this.label2.Text = "Start:"; + // + // flowLayoutPanel + // + this.flowLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.flowLayoutPanel.Controls.Add(this.filterGroupBox); + this.flowLayoutPanel.Controls.Add(this.floatingOptionsGroupBox); + this.flowLayoutPanel.Controls.Add(this.stringOptionsGroupBox); + this.flowLayoutPanel.Controls.Add(this.scanOptionsGroupBox); + this.flowLayoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flowLayoutPanel.Location = new System.Drawing.Point(292, 80); + this.flowLayoutPanel.Margin = new System.Windows.Forms.Padding(0); + this.flowLayoutPanel.Name = "flowLayoutPanel"; + this.flowLayoutPanel.Size = new System.Drawing.Size(317, 314); + this.flowLayoutPanel.TabIndex = 9; + this.flowLayoutPanel.WrapContents = false; + // + // floatingOptionsGroupBox + // + this.floatingOptionsGroupBox.Controls.Add(this.roundTruncateRadioButton); + this.floatingOptionsGroupBox.Controls.Add(this.roundLooseRadioButton); + this.floatingOptionsGroupBox.Controls.Add(this.roundStrictRadioButton); + this.floatingOptionsGroupBox.Location = new System.Drawing.Point(3, 107); + this.floatingOptionsGroupBox.Margin = new System.Windows.Forms.Padding(3, 0, 3, 1); + this.floatingOptionsGroupBox.Name = "floatingOptionsGroupBox"; + this.floatingOptionsGroupBox.Size = new System.Drawing.Size(308, 64); + this.floatingOptionsGroupBox.TabIndex = 9; + this.floatingOptionsGroupBox.TabStop = false; + this.floatingOptionsGroupBox.Visible = false; + // + // roundTruncateRadioButton + // + this.roundTruncateRadioButton.AutoSize = true; + this.roundTruncateRadioButton.Location = new System.Drawing.Point(72, 42); + this.roundTruncateRadioButton.Name = "roundTruncateRadioButton"; + this.roundTruncateRadioButton.Size = new System.Drawing.Size(68, 17); + this.roundTruncateRadioButton.TabIndex = 2; + this.roundTruncateRadioButton.Text = "Truncate"; + this.infoToolTip.SetToolTip(this.roundTruncateRadioButton, "123.45 == 123.99"); + this.roundTruncateRadioButton.UseVisualStyleBackColor = true; + // + // roundLooseRadioButton + // + this.roundLooseRadioButton.AutoSize = true; + this.roundLooseRadioButton.Checked = true; + this.roundLooseRadioButton.Location = new System.Drawing.Point(72, 26); + this.roundLooseRadioButton.Name = "roundLooseRadioButton"; + this.roundLooseRadioButton.Size = new System.Drawing.Size(103, 17); + this.roundLooseRadioButton.TabIndex = 1; + this.roundLooseRadioButton.TabStop = true; + this.roundLooseRadioButton.Text = "Rounded (loose)"; + this.infoToolTip.SetToolTip(this.roundLooseRadioButton, "123.44 <= x <= 123.46"); + this.roundLooseRadioButton.UseVisualStyleBackColor = true; + // + // roundStrictRadioButton + // + this.roundStrictRadioButton.AutoSize = true; + this.roundStrictRadioButton.Location = new System.Drawing.Point(72, 10); + this.roundStrictRadioButton.Name = "roundStrictRadioButton"; + this.roundStrictRadioButton.Size = new System.Drawing.Size(100, 17); + this.roundStrictRadioButton.TabIndex = 0; + this.roundStrictRadioButton.Text = "Rounded (strict)"; + this.infoToolTip.SetToolTip(this.roundStrictRadioButton, "123.45 == 123.454319"); + this.roundStrictRadioButton.UseVisualStyleBackColor = true; + // + // stringOptionsGroupBox + // + this.stringOptionsGroupBox.Controls.Add(this.caseSensitiveCheckBox); + this.stringOptionsGroupBox.Controls.Add(this.encodingUtf32RadioButton); + this.stringOptionsGroupBox.Controls.Add(this.encodingUtf16RadioButton); + this.stringOptionsGroupBox.Controls.Add(this.encodingUtf8RadioButton); + this.stringOptionsGroupBox.Location = new System.Drawing.Point(3, 172); + this.stringOptionsGroupBox.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3); + this.stringOptionsGroupBox.Name = "stringOptionsGroupBox"; + this.stringOptionsGroupBox.Size = new System.Drawing.Size(308, 64); + this.stringOptionsGroupBox.TabIndex = 10; + this.stringOptionsGroupBox.TabStop = false; + this.stringOptionsGroupBox.Visible = false; + // + // caseSensitiveCheckBox + // + this.caseSensitiveCheckBox.AutoSize = true; + this.caseSensitiveCheckBox.Checked = true; + this.caseSensitiveCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.caseSensitiveCheckBox.Location = new System.Drawing.Point(164, 10); + this.caseSensitiveCheckBox.Name = "caseSensitiveCheckBox"; + this.caseSensitiveCheckBox.Size = new System.Drawing.Size(94, 17); + this.caseSensitiveCheckBox.TabIndex = 3; + this.caseSensitiveCheckBox.Text = "Case sensitive"; + this.infoToolTip.SetToolTip(this.caseSensitiveCheckBox, "ASD == asd"); + this.caseSensitiveCheckBox.UseVisualStyleBackColor = true; + // + // encodingUtf32RadioButton + // + this.encodingUtf32RadioButton.AutoSize = true; + this.encodingUtf32RadioButton.Location = new System.Drawing.Point(72, 42); + this.encodingUtf32RadioButton.Name = "encodingUtf32RadioButton"; + this.encodingUtf32RadioButton.Size = new System.Drawing.Size(61, 17); + this.encodingUtf32RadioButton.TabIndex = 2; + this.encodingUtf32RadioButton.Text = "UTF-32"; + this.encodingUtf32RadioButton.UseVisualStyleBackColor = true; + // + // encodingUtf16RadioButton + // + this.encodingUtf16RadioButton.AutoSize = true; + this.encodingUtf16RadioButton.Location = new System.Drawing.Point(72, 26); + this.encodingUtf16RadioButton.Name = "encodingUtf16RadioButton"; + this.encodingUtf16RadioButton.Size = new System.Drawing.Size(61, 17); + this.encodingUtf16RadioButton.TabIndex = 1; + this.encodingUtf16RadioButton.Text = "UTF-16"; + this.encodingUtf16RadioButton.UseVisualStyleBackColor = true; + // + // encodingUtf8RadioButton + // + this.encodingUtf8RadioButton.AutoSize = true; + this.encodingUtf8RadioButton.Checked = true; + this.encodingUtf8RadioButton.Location = new System.Drawing.Point(72, 10); + this.encodingUtf8RadioButton.Name = "encodingUtf8RadioButton"; + this.encodingUtf8RadioButton.Size = new System.Drawing.Size(55, 17); + this.encodingUtf8RadioButton.TabIndex = 0; + this.encodingUtf8RadioButton.TabStop = true; + this.encodingUtf8RadioButton.Text = "UTF-8"; + this.encodingUtf8RadioButton.UseVisualStyleBackColor = true; + // + // firstScanButton + // + this.firstScanButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.firstScanButton.Location = new System.Drawing.Point(292, 54); + this.firstScanButton.Name = "firstScanButton"; + this.firstScanButton.Size = new System.Drawing.Size(75, 23); + this.firstScanButton.TabIndex = 11; + this.firstScanButton.Text = "First Scan"; + this.firstScanButton.UseVisualStyleBackColor = true; + this.firstScanButton.Click += new System.EventHandler(this.firstScanButton_Click); + // + // nextScanButton + // + this.nextScanButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.nextScanButton.Enabled = false; + this.nextScanButton.Location = new System.Drawing.Point(373, 54); + this.nextScanButton.Name = "nextScanButton"; + this.nextScanButton.Size = new System.Drawing.Size(75, 23); + this.nextScanButton.TabIndex = 12; + this.nextScanButton.Text = "Next Scan"; + this.nextScanButton.UseVisualStyleBackColor = true; + this.nextScanButton.Click += new System.EventHandler(this.nextScanButton_Click); + // + // scanProgressBar + // + this.scanProgressBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.scanProgressBar.Location = new System.Drawing.Point(454, 54); + this.scanProgressBar.Name = "scanProgressBar"; + this.scanProgressBar.Size = new System.Drawing.Size(149, 23); + this.scanProgressBar.TabIndex = 13; + // + // resultCountLabel + // + this.resultCountLabel.AutoSize = true; + this.resultCountLabel.Location = new System.Drawing.Point(8, 59); + this.resultCountLabel.Name = "resultCountLabel"; + this.resultCountLabel.Size = new System.Drawing.Size(19, 13); + this.resultCountLabel.TabIndex = 15; + this.resultCountLabel.Text = "<>"; + // + // updateValuesTimer + // + this.updateValuesTimer.Enabled = true; + this.updateValuesTimer.Interval = 1000; + this.updateValuesTimer.Tick += new System.EventHandler(this.updateValuesTimer_Tick); + // + // resultMemoryRecordList + // + this.resultMemoryRecordList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.resultMemoryRecordList.ContextMenuStrip = this.resultListContextMenuStrip; + this.resultMemoryRecordList.Location = new System.Drawing.Point(11, 80); + this.resultMemoryRecordList.Name = "resultMemoryRecordList"; + this.resultMemoryRecordList.ShowAddressColumn = true; + this.resultMemoryRecordList.ShowDescriptionColumn = false; + this.resultMemoryRecordList.ShowPreviousValueColumn = true; + this.resultMemoryRecordList.ShowValueColumn = true; + this.resultMemoryRecordList.ShowValueTypeColumn = false; + this.resultMemoryRecordList.Size = new System.Drawing.Size(268, 314); + this.resultMemoryRecordList.TabIndex = 16; + this.resultMemoryRecordList.RecordDoubleClick += new ReClassNET.Controls.MemorySearchResultControlResultDoubleClickEventHandler(this.memorySearchResultControl_ResultDoubleClick); + // + // resultListContextMenuStrip + // + this.resultListContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addSelectedResultsToAddressListToolStripMenuItem, + this.removeSelectedRecordsToolStripMenuItem, + this.changeToolStripMenuItem, + this.toolStripSeparator2, + this.setCurrentClassAddressToolStripMenuItem, + this.createClassAtAddressToolStripMenuItem, + this.toolStripSeparator3, + this.findOutWhatAccessesThisAddressToolStripMenuItem, + this.findOutWhatWritesToThisAddressToolStripMenuItem, + this.toolStripSeparator4, + this.copyAddressToolStripMenuItem}); + this.resultListContextMenuStrip.Name = "resultListContextMenuStrip"; + this.resultListContextMenuStrip.Size = new System.Drawing.Size(270, 198); + this.resultListContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.resultListContextMenuStrip_Opening); + // + // addSelectedResultsToAddressListToolStripMenuItem + // + this.addSelectedResultsToAddressListToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Tree_Expand; + this.addSelectedResultsToAddressListToolStripMenuItem.Name = "addSelectedResultsToAddressListToolStripMenuItem"; + this.addSelectedResultsToAddressListToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.addSelectedResultsToAddressListToolStripMenuItem.Text = "Add selected results to address list"; + this.addSelectedResultsToAddressListToolStripMenuItem.Click += new System.EventHandler(this.addSelectedResultsToAddressListToolStripMenuItem_Click); + // + // removeSelectedRecordsToolStripMenuItem + // + this.removeSelectedRecordsToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Delete; + this.removeSelectedRecordsToolStripMenuItem.Name = "removeSelectedRecordsToolStripMenuItem"; + this.removeSelectedRecordsToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.removeSelectedRecordsToolStripMenuItem.Text = "Remove selected records"; + this.removeSelectedRecordsToolStripMenuItem.Click += new System.EventHandler(this.removeSelectedRecordsToolStripMenuItem_Click); + // + // changeToolStripMenuItem + // + this.changeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.descriptionToolStripMenuItem, + this.addressToolStripMenuItem, + this.valueTypeToolStripMenuItem, + this.valueToolStripMenuItem}); + this.changeToolStripMenuItem.Enabled = false; + this.changeToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Textfield_Rename; + this.changeToolStripMenuItem.Name = "changeToolStripMenuItem"; + this.changeToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.changeToolStripMenuItem.Text = "Change..."; + // + // descriptionToolStripMenuItem + // + this.descriptionToolStripMenuItem.Name = "descriptionToolStripMenuItem"; + this.descriptionToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.descriptionToolStripMenuItem.Text = "Description"; + // + // addressToolStripMenuItem + // + this.addressToolStripMenuItem.Name = "addressToolStripMenuItem"; + this.addressToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.addressToolStripMenuItem.Text = "Address"; + // + // valueTypeToolStripMenuItem + // + this.valueTypeToolStripMenuItem.Name = "valueTypeToolStripMenuItem"; + this.valueTypeToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.valueTypeToolStripMenuItem.Text = "Value Type"; + // + // valueToolStripMenuItem + // + this.valueToolStripMenuItem.Name = "valueToolStripMenuItem"; + this.valueToolStripMenuItem.Size = new System.Drawing.Size(134, 22); + this.valueToolStripMenuItem.Text = "Value"; + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(266, 6); + // + // setCurrentClassAddressToolStripMenuItem + // + this.setCurrentClassAddressToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Exchange_Button; + this.setCurrentClassAddressToolStripMenuItem.Name = "setCurrentClassAddressToolStripMenuItem"; + this.setCurrentClassAddressToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.setCurrentClassAddressToolStripMenuItem.Text = "Set current class address"; + this.setCurrentClassAddressToolStripMenuItem.Click += new System.EventHandler(this.setCurrentClassAddressToolStripMenuItem_Click); + // + // createClassAtAddressToolStripMenuItem + // + this.createClassAtAddressToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Class_Add; + this.createClassAtAddressToolStripMenuItem.Name = "createClassAtAddressToolStripMenuItem"; + this.createClassAtAddressToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.createClassAtAddressToolStripMenuItem.Text = "Create class at address"; + this.createClassAtAddressToolStripMenuItem.Click += new System.EventHandler(this.createClassAtAddressToolStripMenuItem_Click); + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(266, 6); + // + // findOutWhatAccessesThisAddressToolStripMenuItem + // + this.findOutWhatAccessesThisAddressToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Find_Access; + this.findOutWhatAccessesThisAddressToolStripMenuItem.Name = "findOutWhatAccessesThisAddressToolStripMenuItem"; + this.findOutWhatAccessesThisAddressToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.findOutWhatAccessesThisAddressToolStripMenuItem.Text = "Find out what accesses this address..."; + this.findOutWhatAccessesThisAddressToolStripMenuItem.Click += new System.EventHandler(this.findOutWhatAccessesThisAddressToolStripMenuItem_Click); + // + // findOutWhatWritesToThisAddressToolStripMenuItem + // + this.findOutWhatWritesToThisAddressToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Find_Write; + this.findOutWhatWritesToThisAddressToolStripMenuItem.Name = "findOutWhatWritesToThisAddressToolStripMenuItem"; + this.findOutWhatWritesToThisAddressToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.findOutWhatWritesToThisAddressToolStripMenuItem.Text = "Find out what writes to this address..."; + this.findOutWhatWritesToThisAddressToolStripMenuItem.Click += new System.EventHandler(this.findOutWhatWritesToThisAddressToolStripMenuItem_Click); + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(266, 6); + // + // copyAddressToolStripMenuItem + // + this.copyAddressToolStripMenuItem.Image = global::ReClassNET.Properties.Resources.B16x16_Page_Copy; + this.copyAddressToolStripMenuItem.Name = "copyAddressToolStripMenuItem"; + this.copyAddressToolStripMenuItem.Size = new System.Drawing.Size(269, 22); + this.copyAddressToolStripMenuItem.Text = "Copy Address"; + this.copyAddressToolStripMenuItem.Click += new System.EventHandler(this.copyAddressToolStripMenuItem_Click); + // + // addressListMemoryRecordList + // + this.addressListMemoryRecordList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.addressListMemoryRecordList.ContextMenuStrip = this.resultListContextMenuStrip; + this.addressListMemoryRecordList.Location = new System.Drawing.Point(11, 425); + this.addressListMemoryRecordList.Name = "addressListMemoryRecordList"; + this.addressListMemoryRecordList.ShowAddressColumn = true; + this.addressListMemoryRecordList.ShowDescriptionColumn = true; + this.addressListMemoryRecordList.ShowPreviousValueColumn = false; + this.addressListMemoryRecordList.ShowValueColumn = true; + this.addressListMemoryRecordList.ShowValueTypeColumn = true; + this.addressListMemoryRecordList.Size = new System.Drawing.Size(592, 169); + this.addressListMemoryRecordList.TabIndex = 17; + // + // toolStripPanel + // + this.toolStripPanel.Controls.Add(this.menuToolStrip); + this.toolStripPanel.Location = new System.Drawing.Point(11, 397); + this.toolStripPanel.Name = "toolStripPanel"; + this.toolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal; + this.toolStripPanel.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; + this.toolStripPanel.RowMargin = new System.Windows.Forms.Padding(0); + this.toolStripPanel.Size = new System.Drawing.Size(128, 25); + // + // menuToolStrip + // + this.menuToolStrip.Dock = System.Windows.Forms.DockStyle.None; + this.menuToolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.menuToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.openAddressFileToolStripButton, + this.saveAddressFileToolStripButton, + this.saveAddressFileAsToolStripButton, + this.toolStripSeparator1, + this.clearAddressListToolStripButton}); + this.menuToolStrip.Location = new System.Drawing.Point(0, 0); + this.menuToolStrip.Name = "menuToolStrip"; + this.menuToolStrip.Size = new System.Drawing.Size(101, 25); + this.menuToolStrip.TabIndex = 0; + // + // openAddressFileToolStripButton + // + this.openAddressFileToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.openAddressFileToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Folder; + this.openAddressFileToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.openAddressFileToolStripButton.Name = "openAddressFileToolStripButton"; + this.openAddressFileToolStripButton.Size = new System.Drawing.Size(23, 22); + this.openAddressFileToolStripButton.ToolTipText = "Open..."; + this.openAddressFileToolStripButton.Click += new System.EventHandler(this.openAddressFileToolStripButton_Click); + // + // saveAddressFileToolStripButton + // + this.saveAddressFileToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.saveAddressFileToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Save; + this.saveAddressFileToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveAddressFileToolStripButton.Name = "saveAddressFileToolStripButton"; + this.saveAddressFileToolStripButton.Size = new System.Drawing.Size(23, 22); + this.saveAddressFileToolStripButton.ToolTipText = "Save"; + this.saveAddressFileToolStripButton.Click += new System.EventHandler(this.saveAddressFileToolStripButton_Click); + // + // saveAddressFileAsToolStripButton + // + this.saveAddressFileAsToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.saveAddressFileAsToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Save_As; + this.saveAddressFileAsToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveAddressFileAsToolStripButton.Name = "saveAddressFileAsToolStripButton"; + this.saveAddressFileAsToolStripButton.Size = new System.Drawing.Size(23, 22); + this.saveAddressFileAsToolStripButton.ToolTipText = "Save As..."; + this.saveAddressFileAsToolStripButton.Click += new System.EventHandler(this.saveAsToolStripButton_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + // + // clearAddressListToolStripButton + // + this.clearAddressListToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.clearAddressListToolStripButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Delete; + this.clearAddressListToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.clearAddressListToolStripButton.Name = "clearAddressListToolStripButton"; + this.clearAddressListToolStripButton.Size = new System.Drawing.Size(23, 22); + this.clearAddressListToolStripButton.ToolTipText = "Clear"; + this.clearAddressListToolStripButton.Click += new System.EventHandler(this.clearAddressListToolStripButton_Click); + // + // infoToolTip + // + this.infoToolTip.AutomaticDelay = 100; + // + // undoIconButton + // + this.undoIconButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.undoIconButton.Image = global::ReClassNET.Properties.Resources.B16x16_Undo; + this.undoIconButton.Location = new System.Drawing.Point(256, 54); + this.undoIconButton.Name = "undoIconButton"; + this.undoIconButton.Pressed = false; + this.undoIconButton.Selected = false; + this.undoIconButton.Size = new System.Drawing.Size(23, 22); + this.undoIconButton.TabIndex = 18; + this.undoIconButton.Click += new System.EventHandler(this.undoIconButton_Click); + // + // showInputCorrelatorIconButton + // + this.showInputCorrelatorIconButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.showInputCorrelatorIconButton.Image = global::ReClassNET.Properties.Resources.B16x16_Canvas_Size; + this.showInputCorrelatorIconButton.Location = new System.Drawing.Point(580, 398); + this.showInputCorrelatorIconButton.Name = "showInputCorrelatorIconButton"; + this.showInputCorrelatorIconButton.Pressed = false; + this.showInputCorrelatorIconButton.Selected = false; + this.showInputCorrelatorIconButton.Size = new System.Drawing.Size(23, 22); + this.showInputCorrelatorIconButton.TabIndex = 19; + this.showInputCorrelatorIconButton.Click += new System.EventHandler(this.showInputCorrelatorIconButton_Click); + // + // cancelScanIconButton + // + this.cancelScanIconButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.cancelScanIconButton.Image = global::ReClassNET.Properties.Resources.B16x16_Button_Delete; + this.cancelScanIconButton.Location = new System.Drawing.Point(517, 54); + this.cancelScanIconButton.Name = "cancelScanIconButton"; + this.cancelScanIconButton.Pressed = false; + this.cancelScanIconButton.Selected = false; + this.cancelScanIconButton.Size = new System.Drawing.Size(23, 22); + this.cancelScanIconButton.TabIndex = 21; + this.cancelScanIconButton.Visible = false; + this.cancelScanIconButton.Click += new System.EventHandler(this.cancelScanIconButton_Click); + // + // ScannerForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(612, 607); + this.Controls.Add(this.cancelScanIconButton); + this.Controls.Add(this.showInputCorrelatorIconButton); + this.Controls.Add(this.undoIconButton); + this.Controls.Add(this.toolStripPanel); + this.Controls.Add(this.addressListMemoryRecordList); + this.Controls.Add(this.resultMemoryRecordList); + this.Controls.Add(this.resultCountLabel); + this.Controls.Add(this.scanProgressBar); + this.Controls.Add(this.nextScanButton); + this.Controls.Add(this.firstScanButton); + this.Controls.Add(this.flowLayoutPanel); + this.Controls.Add(this.bannerBox); + this.MinimumSize = new System.Drawing.Size(628, 622); + this.Name = "ScannerForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "ReClass.NET - Scanner"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MemorySearchForm_FormClosing); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); + this.filterGroupBox.ResumeLayout(false); + this.filterGroupBox.PerformLayout(); + this.scanOptionsGroupBox.ResumeLayout(false); + this.scanOptionsGroupBox.PerformLayout(); + this.flowLayoutPanel.ResumeLayout(false); + this.floatingOptionsGroupBox.ResumeLayout(false); + this.floatingOptionsGroupBox.PerformLayout(); + this.stringOptionsGroupBox.ResumeLayout(false); + this.stringOptionsGroupBox.PerformLayout(); + this.resultListContextMenuStrip.ResumeLayout(false); + this.toolStripPanel.ResumeLayout(false); + this.toolStripPanel.PerformLayout(); + this.menuToolStrip.ResumeLayout(false); + this.menuToolStrip.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private BannerBox bannerBox; + private System.Windows.Forms.GroupBox filterGroupBox; + private DualValueBox dualValueBox; + private System.Windows.Forms.CheckBox isHexCheckBox; + private ScanCompareTypeComboBox compareTypeComboBox; + private System.Windows.Forms.Label label1; + private ScanValueTypeComboBox valueTypeComboBox; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.GroupBox scanOptionsGroupBox; + private System.Windows.Forms.TextBox fastScanAlignmentTextBox; + private System.Windows.Forms.CheckBox fastScanCheckBox; + private System.Windows.Forms.CheckBox scanCopyOnWriteCheckBox; + private System.Windows.Forms.CheckBox scanExecutableCheckBox; + private System.Windows.Forms.CheckBox scanWritableCheckBox; + private System.Windows.Forms.CheckBox scanMappedCheckBox; + private System.Windows.Forms.CheckBox scanImageCheckBox; + private System.Windows.Forms.CheckBox scanPrivateCheckBox; + private System.Windows.Forms.TextBox stopAddressTextBox; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox startAddressTextBox; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel; + private System.Windows.Forms.GroupBox floatingOptionsGroupBox; + private System.Windows.Forms.RadioButton roundTruncateRadioButton; + private System.Windows.Forms.RadioButton roundLooseRadioButton; + private System.Windows.Forms.RadioButton roundStrictRadioButton; + private System.Windows.Forms.GroupBox stringOptionsGroupBox; + private System.Windows.Forms.CheckBox caseSensitiveCheckBox; + private System.Windows.Forms.RadioButton encodingUtf32RadioButton; + private System.Windows.Forms.RadioButton encodingUtf16RadioButton; + private System.Windows.Forms.RadioButton encodingUtf8RadioButton; + private System.Windows.Forms.Button firstScanButton; + private System.Windows.Forms.Button nextScanButton; + private System.Windows.Forms.ProgressBar scanProgressBar; + private System.Windows.Forms.Label resultCountLabel; + private System.Windows.Forms.Timer updateValuesTimer; + private MemoryRecordList resultMemoryRecordList; + private MemoryRecordList addressListMemoryRecordList; + private System.Windows.Forms.ToolStripPanel toolStripPanel; + private System.Windows.Forms.ToolStrip menuToolStrip; + private System.Windows.Forms.ToolStripButton openAddressFileToolStripButton; + private System.Windows.Forms.ToolStripButton saveAddressFileToolStripButton; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripButton clearAddressListToolStripButton; + private System.Windows.Forms.ToolTip infoToolTip; + private System.Windows.Forms.ToolStripButton saveAddressFileAsToolStripButton; + private System.Windows.Forms.ContextMenuStrip resultListContextMenuStrip; + private System.Windows.Forms.ToolStripMenuItem addSelectedResultsToAddressListToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem setCurrentClassAddressToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem createClassAtAddressToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripMenuItem findOutWhatAccessesThisAddressToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem findOutWhatWritesToThisAddressToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem removeSelectedRecordsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem changeToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem descriptionToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addressToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem valueTypeToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem valueToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripMenuItem copyAddressToolStripMenuItem; + private IconButton undoIconButton; + private IconButton showInputCorrelatorIconButton; + private IconButton cancelScanIconButton; + } +} \ No newline at end of file diff --git a/ReClass.NET/Forms/ScannerForm.cs b/ReClass.NET/Forms/ScannerForm.cs new file mode 100644 index 00000000..0fb4d430 --- /dev/null +++ b/ReClass.NET/Forms/ScannerForm.cs @@ -0,0 +1,889 @@ +using System; +using System.ComponentModel; +using System.Diagnostics.Contracts; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using ReClassNET.Controls; +using ReClassNET.DataExchange.Scanner; +using ReClassNET.Extensions; +using ReClassNET.Logger; +using ReClassNET.Memory; +using ReClassNET.MemoryScanner; +using ReClassNET.MemoryScanner.Comparer; +using ReClassNET.UI; +using ReClassNET.Util; + +namespace ReClassNET.Forms +{ + public partial class ScannerForm : IconForm + { + // The designer can't handle generic controls... + internal class ScanCompareTypeComboBox : EnumComboBox { } + internal class ScanValueTypeComboBox : EnumComboBox { } + + private const int MaxVisibleResults = 10000; + + private readonly RemoteProcess process; + + private bool isFirstScan; + + private Scanner scanner; + private CancellationTokenSource cts; + + private string addressFilePath; + + public ScannerForm(RemoteProcess process) + { + Contract.Requires(process != null); + + this.process = process; + + InitializeComponent(); + + toolStripPanel.Renderer = new CustomToolStripProfessionalRenderer(true, false); + menuToolStrip.Renderer = new CustomToolStripProfessionalRenderer(false, false); + + SetGuiFromSettings(ScanSettings.Default); + + OnValueTypeChanged(); + + Reset(); + + firstScanButton.Enabled = flowLayoutPanel.Enabled = process.IsValid; + + process.ProcessAttached += RemoteProcessOnProcessAttached; + process.ProcessClosing += RemoteProcessOnProcessClosing; + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + + #region Event Handler + + private void RemoteProcessOnProcessAttached(RemoteProcess remoteProcess) + { + firstScanButton.Enabled = nextScanButton.Enabled = flowLayoutPanel.Enabled = true; + + Reset(); + + if (addressListMemoryRecordList.Records.Any()) + { + if (MessageBox.Show("Keep the current address list?", "Process has changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) + { + addressListMemoryRecordList.Clear(); + } + else + { + foreach (var record in addressListMemoryRecordList.Records) + { + record.ResolveAddress(process); + record.RefreshValue(process); + } + } + } + } + + private void RemoteProcessOnProcessClosing(RemoteProcess remoteProcess) + { + Reset(); + + firstScanButton.Enabled = nextScanButton.Enabled = flowLayoutPanel.Enabled = false; + } + + private void MemorySearchForm_FormClosing(object sender, FormClosingEventArgs e) + { + scanner?.Dispose(); + + process.ProcessAttached -= RemoteProcessOnProcessAttached; + process.ProcessClosing -= RemoteProcessOnProcessClosing; + } + + private void updateValuesTimer_Tick(object sender, EventArgs e) + { + resultMemoryRecordList.RefreshValues(process); + addressListMemoryRecordList.RefreshValues(process); + } + + private void scanTypeComboBox_SelectionChangeCommitted(object sender, EventArgs e) + { + OnCompareTypeChanged(); + } + + private void valueTypeComboBox_SelectionChangeCommitted(object sender, EventArgs e) + { + OnValueTypeChanged(); + } + + private async void firstScanButton_Click(object sender, EventArgs e) + { + if (isFirstScan) + { + try + { + var settings = CreateSearchSettings(); + var comparer = CreateComparer(settings); + + await StartFirstScanEx(settings, comparer); + } + catch (Exception ex) + { + Program.ShowException(ex); + } + + return; + } + + Reset(); + } + + private async void nextScanButton_Click(object sender, EventArgs e) + { + if (!process.IsValid) + { + return; + } + + if (!isFirstScan) + { + firstScanButton.Enabled = false; + nextScanButton.Enabled = false; + cancelScanIconButton.Visible = true; + + try + { + var comparer = CreateComparer(scanner.Settings); + + var report = new Progress(i => + { + scanProgressBar.Value = i; + SetResultCount(scanner.TotalResultCount); + }); + cts = new CancellationTokenSource(); + + await scanner.Search(comparer, report, cts.Token); + + ShowScannerResults(scanner); + + undoIconButton.Enabled = scanner.CanUndoLastScan; + } + catch (Exception ex) + { + Program.ShowException(ex); + } + + firstScanButton.Enabled = true; + nextScanButton.Enabled = true; + cancelScanIconButton.Visible = false; + + scanProgressBar.Value = 0; + } + } + + private void cancelScanIconButton_Click(object sender, EventArgs e) + { + cts?.Cancel(); + } + + private void memorySearchResultControl_ResultDoubleClick(object sender, MemoryRecord record) + { + addressListMemoryRecordList.Records.Add(record); + } + + private void openAddressFileToolStripButton_Click(object sender, EventArgs e) + { + using var ofd = new OpenFileDialog + { + CheckFileExists = true, + Filter = $"All Scanner Types |*{ReClassScanFile.FileExtension};*{CheatEngineFile.FileExtension};*{CrySearchFile.FileExtension}" + + $"|{ReClassScanFile.FormatName} (*{ReClassScanFile.FileExtension})|*{ReClassScanFile.FileExtension}" + + $"|{CheatEngineFile.FormatName} (*{CheatEngineFile.FileExtension})|*{CheatEngineFile.FileExtension}" + + $"|{CrySearchFile.FormatName} (*{CrySearchFile.FileExtension})|*{CrySearchFile.FileExtension}" + }; + + if (ofd.ShowDialog() == DialogResult.OK) + { + IScannerImport import = null; + switch (Path.GetExtension(ofd.FileName)?.ToLower()) + { + case ReClassScanFile.FileExtension: + import = new ReClassScanFile(); + break; + case CheatEngineFile.FileExtension: + import = new CheatEngineFile(); + break; + case CrySearchFile.FileExtension: + import = new CrySearchFile(); + break; + default: + Program.Logger.Log(LogLevel.Error, $"The file '{ofd.FileName}' has an unknown type."); + break; + } + if (import == null) + { + return; + } + + if (addressListMemoryRecordList.Records.Any()) + { + if (MessageBox.Show("The address list contains addresses. Do you really want to open the file?", $"{Constants.ApplicationName} Scanner", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) + { + return; + } + } + + if (import is ReClassScanFile) + { + addressFilePath = ofd.FileName; + } + + addressListMemoryRecordList.SetRecords( + import.Load(ofd.FileName, Program.Logger) + .Select(r => + { + r.ResolveAddress(process); + r.RefreshValue(process); + return r; + }) + ); + } + } + + private void saveAddressFileToolStripButton_Click(object sender, EventArgs e) + { + if (addressListMemoryRecordList.Records.None()) + { + return; + } + + if (string.IsNullOrEmpty(addressFilePath)) + { + saveAsToolStripButton_Click(sender, e); + + return; + } + + var file = new ReClassScanFile(); + file.Save(addressListMemoryRecordList.Records, addressFilePath, Program.Logger); + } + + private void saveAsToolStripButton_Click(object sender, EventArgs e) + { + if (addressListMemoryRecordList.Records.None()) + { + return; + } + + using var sfd = new SaveFileDialog + { + DefaultExt = ReClassScanFile.FileExtension, + Filter = $"{ReClassScanFile.FormatName} (*{ReClassScanFile.FileExtension})|*{ReClassScanFile.FileExtension}" + }; + + if (sfd.ShowDialog() == DialogResult.OK) + { + addressFilePath = sfd.FileName; + + saveAddressFileToolStripButton_Click(sender, e); + } + } + + private void clearAddressListToolStripButton_Click(object sender, EventArgs e) + { + addressListMemoryRecordList.Clear(); + } + + private void showInputCorrelatorIconButton_Click(object sender, EventArgs e) + { + new InputCorrelatorForm(this, process).Show(); + } + + private void resultListContextMenuStrip_Opening(object sender, CancelEventArgs e) + { + var cms = (ContextMenuStrip)sender; + + var isResultList = cms.SourceControl.Parent == resultMemoryRecordList; + + addSelectedResultsToAddressListToolStripMenuItem.Visible = isResultList; + changeToolStripMenuItem.Visible = !isResultList; + removeSelectedRecordsToolStripMenuItem.Visible = !isResultList; + + // Hide all other items if multiple records are selected. + var multipleRecordsSelected = (isResultList ? resultMemoryRecordList.SelectedRecords.Count : addressListMemoryRecordList.SelectedRecords.Count) > 1; + for (var i = 3; i < cms.Items.Count; ++i) + { + cms.Items[i].Visible = !multipleRecordsSelected; + } + } + + private static MemoryRecordList GetMemoryRecordListFromMenuItem(object sender) => + (MemoryRecordList)((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl.Parent; + + private void addSelectedResultsToAddressListToolStripMenuItem_Click(object sender, EventArgs e) + { + foreach (var record in resultMemoryRecordList.SelectedRecords) + { + addressListMemoryRecordList.Records.Add(record); + } + } + + private void removeSelectedRecordsToolStripMenuItem_Click(object sender, EventArgs e) + { + foreach (var record in addressListMemoryRecordList.SelectedRecords) + { + addressListMemoryRecordList.Records.Remove(record); + } + } + + private void setCurrentClassAddressToolStripMenuItem_Click(object sender, EventArgs e) + { + LinkedWindowFeatures.SetCurrentClassAddress(GetMemoryRecordListFromMenuItem(sender).SelectedRecord.RealAddress); + } + + private void createClassAtAddressToolStripMenuItem_Click(object sender, EventArgs e) + { + LinkedWindowFeatures.CreateClassAtAddress(GetMemoryRecordListFromMenuItem(sender).SelectedRecord.RealAddress, true); + } + + private void findOutWhatAccessesThisAddressToolStripMenuItem_Click(object sender, EventArgs e) + { + FindWhatInteractsWithSelectedRecord( + GetMemoryRecordListFromMenuItem(sender).SelectedRecord, + false + ); + } + + private void findOutWhatWritesToThisAddressToolStripMenuItem_Click(object sender, EventArgs e) + { + FindWhatInteractsWithSelectedRecord( + GetMemoryRecordListFromMenuItem(sender).SelectedRecord, + true + ); + } + + private void copyAddressToolStripMenuItem_Click(object sender, EventArgs e) + { + var record = GetMemoryRecordListFromMenuItem(sender)?.SelectedRecord; + if (record != null) + { + Clipboard.SetText(record.RealAddress.ToString("X")); + } + } + + private void undoIconButton_Click(object sender, EventArgs e) + { + if (scanner.CanUndoLastScan) + { + scanner.UndoLastScan(); + + ShowScannerResults(scanner); + } + + undoIconButton.Enabled = scanner.CanUndoLastScan; + } + + #endregion + + /// + /// Displays the total result count. + /// + /// Number of. + private void SetResultCount(int count) + { + resultCountLabel.Text = count > MaxVisibleResults ? $"Found: {count} (only {MaxVisibleResults} shown)" : $"Found: {count}"; + } + + /// + /// Shows some of the scanner results. + /// + public void ShowScannerResults(Scanner scanner) + { + Contract.Requires(scanner != null); + + SetResultCount(scanner.TotalResultCount); + + resultMemoryRecordList.SetRecords( + scanner.GetResults() + .Take(MaxVisibleResults) + .OrderBy(r => r.Address, IntPtrComparer.Instance) + .Select(r => + { + var record = new MemoryRecord(r); + record.ResolveAddress(process); + return record; + }) + ); + } + + /// + /// Set input elements according to the selected compare type. + /// + private void OnCompareTypeChanged() + { + var enableHexCheckBox = true; + var enableValueBox = true; + var enableDualInput = false; + + switch (compareTypeComboBox.SelectedValue) + { + case ScanCompareType.Unknown: + enableHexCheckBox = false; + enableValueBox = false; + break; + case ScanCompareType.Between: + case ScanCompareType.BetweenOrEqual: + enableDualInput = true; + break; + } + + switch (valueTypeComboBox.SelectedValue) + { + case ScanValueType.Float: + case ScanValueType.Double: + case ScanValueType.ArrayOfBytes: + case ScanValueType.String: + case ScanValueType.Regex: + isHexCheckBox.Checked = false; + enableHexCheckBox = false; + break; + } + + isHexCheckBox.Enabled = enableHexCheckBox; + dualValueBox.Enabled = enableValueBox; + dualValueBox.ShowSecondInputField = enableDualInput; + } + + /// + /// Hide gui elements after the value type has changed. + /// + private void OnValueTypeChanged() + { + SetValidCompareTypes(); + + var valueType = valueTypeComboBox.SelectedValue; + + switch (valueType) + { + case ScanValueType.Byte: + case ScanValueType.Short: + case ScanValueType.Integer: + case ScanValueType.Long: + isHexCheckBox.Enabled = true; + break; + case ScanValueType.Float: + case ScanValueType.Double: + case ScanValueType.ArrayOfBytes: + case ScanValueType.String: + case ScanValueType.Regex: + isHexCheckBox.Checked = false; + isHexCheckBox.Enabled = false; + break; + } + + var alignment = 1; + switch (valueType) + { + case ScanValueType.Short: + alignment = 2; + break; + case ScanValueType.Float: + case ScanValueType.Double: + case ScanValueType.Integer: + case ScanValueType.Long: + alignment = 4; + break; + } + fastScanAlignmentTextBox.Text = alignment.ToString(); + + floatingOptionsGroupBox.Visible = valueType == ScanValueType.Float || valueType == ScanValueType.Double; + stringOptionsGroupBox.Visible = valueType == ScanValueType.String || valueType == ScanValueType.Regex; + } + + /// + /// Sets valid compare types dependend on the selected value type. + /// + private void SetValidCompareTypes() + { + var compareType = compareTypeComboBox.SelectedValue; + var valueType = valueTypeComboBox.SelectedValue; + if (valueType == ScanValueType.ArrayOfBytes || valueType == ScanValueType.String || valueType == ScanValueType.Regex) + { + compareTypeComboBox.SetAvailableValues(ScanCompareType.Equal); + } + else if (isFirstScan) + { + compareTypeComboBox.SetAvailableValuesExclude( + ScanCompareType.Changed, ScanCompareType.NotChanged, ScanCompareType.Decreased, + ScanCompareType.DecreasedOrEqual, ScanCompareType.Increased, ScanCompareType.IncreasedOrEqual + ); + } + else + { + compareTypeComboBox.SetAvailableValuesExclude(ScanCompareType.Unknown); + } + + compareTypeComboBox.SelectedValue = compareType; + } + + /// + /// Resets all fields. + /// + private void Reset() + { + scanner?.Dispose(); + scanner = null; + + undoIconButton.Enabled = false; + + SetResultCount(0); + resultMemoryRecordList.Clear(); + + firstScanButton.Enabled = true; + nextScanButton.Enabled = false; + + isHexCheckBox.Enabled = true; + //isHexCheckBox.Checked = false; + + valueTypeComboBox.Enabled = true; + //valueTypeComboBox.SelectedItem = valueTypeComboBox.Items.Cast>().PredicateOrFirst(e => e.Value == ScanValueType.Integer); + OnValueTypeChanged(); + + floatingOptionsGroupBox.Enabled = true; + stringOptionsGroupBox.Enabled = true; + scanOptionsGroupBox.Enabled = true; + + isFirstScan = true; + undoIconButton.Enabled = false; + + SetValidCompareTypes(); + } + + /// + /// Excutes a new scan with the provided settings and comparer. + /// + /// The scan settings. + /// The comparer. + public void ExcuteScan(ScanSettings settings, IScanComparer comparer) + { + Contract.Requires(settings != null); + Contract.Requires(comparer != null); + + Reset(); + + SetGuiFromSettings(settings); + + Invoke((Action)(async () => await StartFirstScanEx(settings, comparer))); + } + + /// + /// Starts a new first scan with the provided settings and comparer. + /// + /// The scan settings. + /// The comparer. + private async Task StartFirstScanEx(ScanSettings settings, IScanComparer comparer) + { + if (!process.IsValid) + { + return; + } + + firstScanButton.Enabled = false; + cancelScanIconButton.Visible = true; + + try + { + scanner = new Scanner(process, settings); + + var report = new Progress(i => + { + scanProgressBar.Value = i; + SetResultCount(scanner.TotalResultCount); + }); + cts = new CancellationTokenSource(); + + await scanner.Search(comparer, report, cts.Token); + + ShowScannerResults(scanner); + + cancelScanIconButton.Visible = false; + nextScanButton.Enabled = true; + valueTypeComboBox.Enabled = false; + + floatingOptionsGroupBox.Enabled = false; + stringOptionsGroupBox.Enabled = false; + scanOptionsGroupBox.Enabled = false; + + isFirstScan = false; + + SetValidCompareTypes(); + OnCompareTypeChanged(); + } + finally + { + firstScanButton.Enabled = true; + + scanProgressBar.Value = 0; + } + } + + /// + /// Creates the search settings from the user input. + /// + /// The scan settings. + private ScanSettings CreateSearchSettings() + { + Contract.Ensures(Contract.Result() != null); + + var settings = new ScanSettings + { + ValueType = valueTypeComboBox.SelectedValue + }; + + long.TryParse(startAddressTextBox.Text, NumberStyles.HexNumber, null, out var startAddressVar); + long.TryParse(stopAddressTextBox.Text, NumberStyles.HexNumber, null, out var endAddressVar); +#if RECLASSNET64 + settings.StartAddress = (IntPtr)startAddressVar; + settings.StopAddress = (IntPtr)endAddressVar; +#else + settings.StartAddress = unchecked((IntPtr)(int)startAddressVar); + settings.StopAddress = unchecked((IntPtr)(int)endAddressVar); +#endif + settings.EnableFastScan = fastScanCheckBox.Checked; + int.TryParse(fastScanAlignmentTextBox.Text, out var alignment); + settings.FastScanAlignment = Math.Max(1, alignment); + + static SettingState CheckStateToSettingState(CheckState state) + { + switch (state) + { + case CheckState.Checked: + return SettingState.Yes; + case CheckState.Unchecked: + return SettingState.No; + default: + return SettingState.Indeterminate; + } + } + + settings.ScanPrivateMemory = scanPrivateCheckBox.Checked; + settings.ScanImageMemory = scanImageCheckBox.Checked; + settings.ScanMappedMemory = scanMappedCheckBox.Checked; + settings.ScanWritableMemory = CheckStateToSettingState(scanWritableCheckBox.CheckState); + settings.ScanExecutableMemory = CheckStateToSettingState(scanExecutableCheckBox.CheckState); + settings.ScanCopyOnWriteMemory = CheckStateToSettingState(scanCopyOnWriteCheckBox.CheckState); + + return settings; + } + + /// + /// Sets the input fields according to the provided settings. + /// + /// The scan settings. + private void SetGuiFromSettings(ScanSettings settings) + { + Contract.Requires(settings != null); + + valueTypeComboBox.SelectedValue = settings.ValueType; + + startAddressTextBox.Text = settings.StartAddress.ToString(Constants.AddressHexFormat); + stopAddressTextBox.Text = settings.StopAddress.ToString(Constants.AddressHexFormat); + + fastScanCheckBox.Checked = settings.EnableFastScan; + fastScanAlignmentTextBox.Text = Math.Max(1, settings.FastScanAlignment).ToString(); + + static CheckState SettingStateToCheckState(SettingState state) + { + switch (state) + { + case SettingState.Yes: + return CheckState.Checked; + case SettingState.No: + return CheckState.Unchecked; + default: + return CheckState.Indeterminate; + } + } + + scanPrivateCheckBox.Checked = settings.ScanPrivateMemory; + scanImageCheckBox.Checked = settings.ScanImageMemory; + scanMappedCheckBox.Checked = settings.ScanMappedMemory; + scanWritableCheckBox.CheckState = SettingStateToCheckState(settings.ScanWritableMemory); + scanExecutableCheckBox.CheckState = SettingStateToCheckState(settings.ScanExecutableMemory); + scanCopyOnWriteCheckBox.CheckState = SettingStateToCheckState(settings.ScanCopyOnWriteMemory); + } + + /// + /// Creates the comparer from the user input. + /// + /// The scan comparer. + private IScanComparer CreateComparer(ScanSettings settings) + { + Contract.Requires(settings != null); + Contract.Ensures(Contract.Result() != null); + + var compareType = compareTypeComboBox.SelectedValue; + var checkBothInputFields = compareType == ScanCompareType.Between || compareType == ScanCompareType.BetweenOrEqual; + + if (settings.ValueType == ScanValueType.Byte || settings.ValueType == ScanValueType.Short || settings.ValueType == ScanValueType.Integer || settings.ValueType == ScanValueType.Long) + { + var numberStyle = isHexCheckBox.Checked ? NumberStyles.HexNumber : NumberStyles.Integer; + if (!long.TryParse(dualValueBox.Value1, numberStyle, null, out var value1)) throw new InvalidInputException(dualValueBox.Value1); + if (!long.TryParse(dualValueBox.Value2, numberStyle, null, out var value2) && checkBothInputFields) throw new InvalidInputException(dualValueBox.Value2); + + if (compareType == ScanCompareType.Between || compareType == ScanCompareType.BetweenOrEqual) + { + if (value1 > value2) + { + Utils.Swap(ref value1, ref value2); + } + } + + switch (settings.ValueType) + { + case ScanValueType.Byte: + return new ByteMemoryComparer(compareType, (byte)value1, (byte)value2); + case ScanValueType.Short: + return new ShortMemoryComparer(compareType, (short)value1, (short)value2, process.BitConverter); + case ScanValueType.Integer: + return new IntegerMemoryComparer(compareType, (int)value1, (int)value2, process.BitConverter); + case ScanValueType.Long: + return new LongMemoryComparer(compareType, value1, value2, process.BitConverter); + } + } + else if (settings.ValueType == ScanValueType.Float || settings.ValueType == ScanValueType.Double) + { + int CalculateSignificantDigits(string input, NumberFormatInfo numberFormat) + { + Contract.Requires(input != null); + Contract.Requires(numberFormat != null); + + var digits = 0; + + var decimalIndex = input.IndexOf(numberFormat.NumberDecimalSeparator, StringComparison.Ordinal); + if (decimalIndex != -1) + { + digits = input.Length - 1 - decimalIndex; + } + + return digits; + } + + var nf1 = NumberFormat.GuessNumberFormat(dualValueBox.Value1); + if (!double.TryParse(dualValueBox.Value1, NumberStyles.Float, nf1, out var value1)) throw new InvalidInputException(dualValueBox.Value1); + var nf2 = NumberFormat.GuessNumberFormat(dualValueBox.Value2); + if (!double.TryParse(dualValueBox.Value2, NumberStyles.Float, nf2, out var value2) && checkBothInputFields) throw new InvalidInputException(dualValueBox.Value2); + + if (compareType == ScanCompareType.Between || compareType == ScanCompareType.BetweenOrEqual) + { + if (value1 > value2) + { + Utils.Swap(ref value1, ref value2); + } + } + + var significantDigits = Math.Max( + CalculateSignificantDigits(dualValueBox.Value1, nf1), + CalculateSignificantDigits(dualValueBox.Value2, nf2) + ); + + var roundMode = roundStrictRadioButton.Checked ? ScanRoundMode.Strict : roundLooseRadioButton.Checked ? ScanRoundMode.Normal : ScanRoundMode.Truncate; + + switch (settings.ValueType) + { + case ScanValueType.Float: + return new FloatMemoryComparer(compareType, roundMode, significantDigits, (float)value1, (float)value2, process.BitConverter); + case ScanValueType.Double: + return new DoubleMemoryComparer(compareType, roundMode, significantDigits, value1, value2, process.BitConverter); + } + } + else if (settings.ValueType == ScanValueType.ArrayOfBytes) + { + var pattern = BytePattern.Parse(dualValueBox.Value1); + + return new ArrayOfBytesMemoryComparer(pattern); + } + else if (settings.ValueType == ScanValueType.String || settings.ValueType == ScanValueType.Regex) + { + if (string.IsNullOrEmpty(dualValueBox.Value1)) + { + throw new InvalidInputException(dualValueBox.Value1); + } + + var encoding = encodingUtf8RadioButton.Checked ? Encoding.UTF8 : encodingUtf16RadioButton.Checked ? Encoding.Unicode : Encoding.UTF32; + if (settings.ValueType == ScanValueType.String) + { + return new StringMemoryComparer(dualValueBox.Value1, encoding, caseSensitiveCheckBox.Checked); + } + else + { + return new RegexStringMemoryComparer(dualValueBox.Value1, encoding, caseSensitiveCheckBox.Checked); + } + } + + throw new InvalidOperationException(); + } + + /// + /// Attaches the debugger to find what interacts with the selected record. + /// + /// Thrown when one or more arguments are outside the required range. + /// The record. + /// True to search only for write access. + private static void FindWhatInteractsWithSelectedRecord(MemoryRecord record, bool writeOnly) + { + int size; + switch (record.ValueType) + { + case ScanValueType.Byte: + size = 1; + break; + case ScanValueType.Short: + size = 2; + break; + case ScanValueType.Integer: + case ScanValueType.Float: + size = 4; + break; + case ScanValueType.Long: + case ScanValueType.Double: + size = 8; + break; + case ScanValueType.ArrayOfBytes: + size = record.ValueLength; + break; + case ScanValueType.String: + case ScanValueType.Regex: + size = record.ValueLength; + break; + default: + throw new ArgumentOutOfRangeException(); + } + + LinkedWindowFeatures.FindWhatInteractsWithAddress(record.RealAddress, size, writeOnly); + } + } + + internal class InvalidInputException : Exception + { + public InvalidInputException(string input) + : base($"'{input}' is not a valid input.") + { + + } + } +} diff --git a/ReClass.NET/Forms/ScannerForm.resx b/ReClass.NET/Forms/ScannerForm.resx new file mode 100644 index 00000000..a51fb480 --- /dev/null +++ b/ReClass.NET/Forms/ScannerForm.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 304, 6 + + + 15, 6 + + + 417, 6 + + + 172, 6 + + + 42 + + \ No newline at end of file diff --git a/ReClass.NET/Forms/SettingsForm.Designer.cs b/ReClass.NET/Forms/SettingsForm.Designer.cs new file mode 100644 index 00000000..82e4efd9 --- /dev/null +++ b/ReClass.NET/Forms/SettingsForm.Designer.cs @@ -0,0 +1,1251 @@ +using ReClassNET.Controls; + +namespace ReClassNET.Forms +{ + partial class SettingsForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.settingsTabControl = new System.Windows.Forms.TabControl(); + this.generalSettingsTabPage = new System.Windows.Forms.TabPage(); + this.fileAssociationGroupBox = new System.Windows.Forms.GroupBox(); + this.removeAssociationButton = new System.Windows.Forms.Button(); + this.createAssociationButton = new System.Windows.Forms.Button(); + this.associationInfoLabel = new System.Windows.Forms.Label(); + this.commentsGroupBox = new System.Windows.Forms.GroupBox(); + this.showPluginInfoCheckBox = new System.Windows.Forms.CheckBox(); + this.showStringCheckBox = new System.Windows.Forms.CheckBox(); + this.showSymbolsCheckBox = new System.Windows.Forms.CheckBox(); + this.showRttiCheckBox = new System.Windows.Forms.CheckBox(); + this.showPointerCheckBox = new System.Windows.Forms.CheckBox(); + this.showIntegerCheckBox = new System.Windows.Forms.CheckBox(); + this.showFloatCheckBox = new System.Windows.Forms.CheckBox(); + this.displayGroupBox = new System.Windows.Forms.GroupBox(); + this.randomizeWindowTitleCheckBox = new System.Windows.Forms.CheckBox(); + this.runAsAdminCheckBox = new System.Windows.Forms.CheckBox(); + this.highlightChangedValuesCheckBox = new System.Windows.Forms.CheckBox(); + this.showTextCheckBox = new System.Windows.Forms.CheckBox(); + this.showNodeOffsetCheckBox = new System.Windows.Forms.CheckBox(); + this.showNodeAddressCheckBox = new System.Windows.Forms.CheckBox(); + this.stayOnTopCheckBox = new System.Windows.Forms.CheckBox(); + this.colorsSettingTabPage = new System.Windows.Forms.TabPage(); + this.nodeColorGroupBox = new System.Windows.Forms.GroupBox(); + this.nodeValueLabel = new System.Windows.Forms.Label(); + this.nodePluginLabel = new System.Windows.Forms.Label(); + this.nodeHexValueColorBox = new ReClassNET.Controls.ColorBox(); + this.nodePluginColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeHexValueLabel = new System.Windows.Forms.Label(); + this.nodeVTableLabel = new System.Windows.Forms.Label(); + this.nodeOffsetColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeVTableColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeOffsetLabel = new System.Windows.Forms.Label(); + this.nodeTextLabel = new System.Windows.Forms.Label(); + this.nodeAddressColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeTextColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeAddressLabel = new System.Windows.Forms.Label(); + this.nodeCommentLabel = new System.Windows.Forms.Label(); + this.nodeHiddenColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeCommentColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeHiddenLabel = new System.Windows.Forms.Label(); + this.nodeIndexLabel = new System.Windows.Forms.Label(); + this.nodeSelectedColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeIndexColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeSelectedLabel = new System.Windows.Forms.Label(); + this.nodeTypeColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeValueColorBox = new ReClassNET.Controls.ColorBox(); + this.nodeTypeLabel = new System.Windows.Forms.Label(); + this.nodeNameLabel = new System.Windows.Forms.Label(); + this.nodeNameColorBox = new ReClassNET.Controls.ColorBox(); + this.backgroundLabel = new System.Windows.Forms.Label(); + this.backgroundColorBox = new ReClassNET.Controls.ColorBox(); + this.typeDefinitionsSettingsTabPage = new System.Windows.Forms.TabPage(); + this.nuintSettingsLabel = new System.Windows.Forms.Label(); + this.nuintTypeTextBox = new System.Windows.Forms.TextBox(); + this.nintSettingsLabel = new System.Windows.Forms.Label(); + this.nintTypeTextBox = new System.Windows.Forms.TextBox(); + this.boolSettingsLabel = new System.Windows.Forms.Label(); + this.boolTypeTextBox = new System.Windows.Forms.TextBox(); + this.generatorInfoLabel = new System.Windows.Forms.Label(); + this.functionPtrSettingsLabel = new System.Windows.Forms.Label(); + this.functionPtrTypeTextBox = new System.Windows.Forms.TextBox(); + this.utf16TextSettingsLabel = new System.Windows.Forms.Label(); + this.utf16TextTypeTextBox = new System.Windows.Forms.TextBox(); + this.utf8TextSettingsLabel = new System.Windows.Forms.Label(); + this.utf8TextTypeTextBox = new System.Windows.Forms.TextBox(); + this.matrix3x3SettingsLabel = new System.Windows.Forms.Label(); + this.matrix3x3TypeTextBox = new System.Windows.Forms.TextBox(); + this.matrix3x4SettingsLabel = new System.Windows.Forms.Label(); + this.matrix3x4TypeTextBox = new System.Windows.Forms.TextBox(); + this.matrix4x4SettingsLabel = new System.Windows.Forms.Label(); + this.matrix4x4TypeTextBox = new System.Windows.Forms.TextBox(); + this.vector2SettingsLabel = new System.Windows.Forms.Label(); + this.vector2TypeTextBox = new System.Windows.Forms.TextBox(); + this.vector3SettingsLabel = new System.Windows.Forms.Label(); + this.vector3TypeTextBox = new System.Windows.Forms.TextBox(); + this.vector4SettingsLabel = new System.Windows.Forms.Label(); + this.vector4TypeTextBox = new System.Windows.Forms.TextBox(); + this.doubleSettingsLabel = new System.Windows.Forms.Label(); + this.doubleTypeTextBox = new System.Windows.Forms.TextBox(); + this.floatSettingsLabel = new System.Windows.Forms.Label(); + this.floatTypeTextBox = new System.Windows.Forms.TextBox(); + this.uint64SettingsLabel = new System.Windows.Forms.Label(); + this.uint64TypeTextBox = new System.Windows.Forms.TextBox(); + this.uint32SettingsLabel = new System.Windows.Forms.Label(); + this.uint32TypeTextBox = new System.Windows.Forms.TextBox(); + this.uint16SettingsLabel = new System.Windows.Forms.Label(); + this.uint16TypeTextBox = new System.Windows.Forms.TextBox(); + this.uint8SettingsLabel = new System.Windows.Forms.Label(); + this.uint8TypeTextBox = new System.Windows.Forms.TextBox(); + this.int64SettingsLabel = new System.Windows.Forms.Label(); + this.int64TypeTextBox = new System.Windows.Forms.TextBox(); + this.int32SettingsLabel = new System.Windows.Forms.Label(); + this.int32TypeTextBox = new System.Windows.Forms.TextBox(); + this.int16SettingsLabel = new System.Windows.Forms.Label(); + this.int16TypeTextBox = new System.Windows.Forms.TextBox(); + this.int8SettingsLabel = new System.Windows.Forms.Label(); + this.int8TypeTextBox = new System.Windows.Forms.TextBox(); + this.bannerBox = new ReClassNET.Controls.BannerBox(); + this.utf32TextSettingsLabel = new System.Windows.Forms.Label(); + this.utf32TextTypeTextBox = new System.Windows.Forms.TextBox(); + this.settingsTabControl.SuspendLayout(); + this.generalSettingsTabPage.SuspendLayout(); + this.fileAssociationGroupBox.SuspendLayout(); + this.commentsGroupBox.SuspendLayout(); + this.displayGroupBox.SuspendLayout(); + this.colorsSettingTabPage.SuspendLayout(); + this.nodeColorGroupBox.SuspendLayout(); + this.typeDefinitionsSettingsTabPage.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).BeginInit(); + this.SuspendLayout(); + // + // settingsTabControl + // + this.settingsTabControl.Controls.Add(this.generalSettingsTabPage); + this.settingsTabControl.Controls.Add(this.colorsSettingTabPage); + this.settingsTabControl.Controls.Add(this.typeDefinitionsSettingsTabPage); + this.settingsTabControl.Location = new System.Drawing.Point(12, 60); + this.settingsTabControl.Name = "settingsTabControl"; + this.settingsTabControl.SelectedIndex = 0; + this.settingsTabControl.Size = new System.Drawing.Size(562, 355); + this.settingsTabControl.TabIndex = 1; + // + // generalSettingsTabPage + // + this.generalSettingsTabPage.Controls.Add(this.fileAssociationGroupBox); + this.generalSettingsTabPage.Controls.Add(this.commentsGroupBox); + this.generalSettingsTabPage.Controls.Add(this.displayGroupBox); + this.generalSettingsTabPage.Controls.Add(this.stayOnTopCheckBox); + this.generalSettingsTabPage.Location = new System.Drawing.Point(4, 22); + this.generalSettingsTabPage.Name = "generalSettingsTabPage"; + this.generalSettingsTabPage.Padding = new System.Windows.Forms.Padding(3); + this.generalSettingsTabPage.Size = new System.Drawing.Size(554, 329); + this.generalSettingsTabPage.TabIndex = 0; + this.generalSettingsTabPage.Text = "General"; + this.generalSettingsTabPage.UseVisualStyleBackColor = true; + // + // fileAssociationGroupBox + // + this.fileAssociationGroupBox.Controls.Add(this.removeAssociationButton); + this.fileAssociationGroupBox.Controls.Add(this.createAssociationButton); + this.fileAssociationGroupBox.Controls.Add(this.associationInfoLabel); + this.fileAssociationGroupBox.Location = new System.Drawing.Point(6, 231); + this.fileAssociationGroupBox.Name = "fileAssociationGroupBox"; + this.fileAssociationGroupBox.Size = new System.Drawing.Size(542, 85); + this.fileAssociationGroupBox.TabIndex = 4; + this.fileAssociationGroupBox.TabStop = false; + this.fileAssociationGroupBox.Text = "RCNET File Association"; + // + // removeAssociationButton + // + this.removeAssociationButton.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.removeAssociationButton.Location = new System.Drawing.Point(146, 52); + this.removeAssociationButton.Name = "removeAssociationButton"; + this.removeAssociationButton.Size = new System.Drawing.Size(135, 23); + this.removeAssociationButton.TabIndex = 2; + this.removeAssociationButton.Text = "&Remove Association"; + this.removeAssociationButton.UseVisualStyleBackColor = true; + this.removeAssociationButton.Click += new System.EventHandler(this.removeAssociationButton_Click); + // + // createAssociationButton + // + this.createAssociationButton.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.createAssociationButton.Location = new System.Drawing.Point(9, 52); + this.createAssociationButton.Name = "createAssociationButton"; + this.createAssociationButton.Size = new System.Drawing.Size(131, 23); + this.createAssociationButton.TabIndex = 1; + this.createAssociationButton.Text = "Create &Association"; + this.createAssociationButton.UseVisualStyleBackColor = true; + this.createAssociationButton.Click += new System.EventHandler(this.createAssociationButton_Click); + // + // associationInfoLabel + // + this.associationInfoLabel.Location = new System.Drawing.Point(6, 21); + this.associationInfoLabel.Name = "associationInfoLabel"; + this.associationInfoLabel.Size = new System.Drawing.Size(525, 28); + this.associationInfoLabel.TabIndex = 0; + this.associationInfoLabel.Text = "RCNET files can be associated with ReClass.NET. When you double-click a RCNET fil" + + "e, they will automatically be opened by ReClass.NET."; + // + // commentsGroupBox + // + this.commentsGroupBox.Controls.Add(this.showPluginInfoCheckBox); + this.commentsGroupBox.Controls.Add(this.showStringCheckBox); + this.commentsGroupBox.Controls.Add(this.showSymbolsCheckBox); + this.commentsGroupBox.Controls.Add(this.showRttiCheckBox); + this.commentsGroupBox.Controls.Add(this.showPointerCheckBox); + this.commentsGroupBox.Controls.Add(this.showIntegerCheckBox); + this.commentsGroupBox.Controls.Add(this.showFloatCheckBox); + this.commentsGroupBox.Location = new System.Drawing.Point(6, 39); + this.commentsGroupBox.Name = "commentsGroupBox"; + this.commentsGroupBox.Size = new System.Drawing.Size(265, 186); + this.commentsGroupBox.TabIndex = 3; + this.commentsGroupBox.TabStop = false; + this.commentsGroupBox.Text = "Node Comments"; + // + // showPluginInfoCheckBox + // + this.showPluginInfoCheckBox.AutoSize = true; + this.showPluginInfoCheckBox.Location = new System.Drawing.Point(6, 157); + this.showPluginInfoCheckBox.Name = "showPluginInfoCheckBox"; + this.showPluginInfoCheckBox.Size = new System.Drawing.Size(111, 17); + this.showPluginInfoCheckBox.TabIndex = 6; + this.showPluginInfoCheckBox.Text = "Show Plugin Infos"; + this.showPluginInfoCheckBox.UseVisualStyleBackColor = true; + // + // showStringCheckBox + // + this.showStringCheckBox.AutoSize = true; + this.showStringCheckBox.Location = new System.Drawing.Point(6, 134); + this.showStringCheckBox.Name = "showStringCheckBox"; + this.showStringCheckBox.Size = new System.Drawing.Size(88, 17); + this.showStringCheckBox.TabIndex = 5; + this.showStringCheckBox.Text = "Show Strings"; + this.showStringCheckBox.UseVisualStyleBackColor = true; + // + // showSymbolsCheckBox + // + this.showSymbolsCheckBox.AutoSize = true; + this.showSymbolsCheckBox.Location = new System.Drawing.Point(6, 111); + this.showSymbolsCheckBox.Name = "showSymbolsCheckBox"; + this.showSymbolsCheckBox.Size = new System.Drawing.Size(130, 17); + this.showSymbolsCheckBox.TabIndex = 4; + this.showSymbolsCheckBox.Text = "Show Debug Symbols"; + this.showSymbolsCheckBox.UseVisualStyleBackColor = true; + // + // showRttiCheckBox + // + this.showRttiCheckBox.AutoSize = true; + this.showRttiCheckBox.Location = new System.Drawing.Point(6, 88); + this.showRttiCheckBox.Name = "showRttiCheckBox"; + this.showRttiCheckBox.Size = new System.Drawing.Size(81, 17); + this.showRttiCheckBox.TabIndex = 3; + this.showRttiCheckBox.Text = "Show RTTI"; + this.showRttiCheckBox.UseVisualStyleBackColor = true; + // + // showPointerCheckBox + // + this.showPointerCheckBox.AutoSize = true; + this.showPointerCheckBox.Location = new System.Drawing.Point(6, 65); + this.showPointerCheckBox.Name = "showPointerCheckBox"; + this.showPointerCheckBox.Size = new System.Drawing.Size(94, 17); + this.showPointerCheckBox.TabIndex = 2; + this.showPointerCheckBox.Text = "Show Pointers"; + this.showPointerCheckBox.UseVisualStyleBackColor = true; + // + // showIntegerCheckBox + // + this.showIntegerCheckBox.AutoSize = true; + this.showIntegerCheckBox.Location = new System.Drawing.Point(6, 42); + this.showIntegerCheckBox.Name = "showIntegerCheckBox"; + this.showIntegerCheckBox.Size = new System.Drawing.Size(124, 17); + this.showIntegerCheckBox.TabIndex = 1; + this.showIntegerCheckBox.Text = "Show Integer Values"; + this.showIntegerCheckBox.UseVisualStyleBackColor = true; + // + // showFloatCheckBox + // + this.showFloatCheckBox.AutoSize = true; + this.showFloatCheckBox.Location = new System.Drawing.Point(6, 19); + this.showFloatCheckBox.Name = "showFloatCheckBox"; + this.showFloatCheckBox.Size = new System.Drawing.Size(114, 17); + this.showFloatCheckBox.TabIndex = 0; + this.showFloatCheckBox.Text = "Show Float Values"; + this.showFloatCheckBox.UseVisualStyleBackColor = true; + // + // displayGroupBox + // + this.displayGroupBox.Controls.Add(this.randomizeWindowTitleCheckBox); + this.displayGroupBox.Controls.Add(this.runAsAdminCheckBox); + this.displayGroupBox.Controls.Add(this.highlightChangedValuesCheckBox); + this.displayGroupBox.Controls.Add(this.showTextCheckBox); + this.displayGroupBox.Controls.Add(this.showNodeOffsetCheckBox); + this.displayGroupBox.Controls.Add(this.showNodeAddressCheckBox); + this.displayGroupBox.Location = new System.Drawing.Point(283, 39); + this.displayGroupBox.Name = "displayGroupBox"; + this.displayGroupBox.Size = new System.Drawing.Size(265, 160); + this.displayGroupBox.TabIndex = 2; + this.displayGroupBox.TabStop = false; + this.displayGroupBox.Text = "Display"; + // + // randomizeWindowTitleCheckBox + // + this.randomizeWindowTitleCheckBox.AutoSize = true; + this.randomizeWindowTitleCheckBox.Location = new System.Drawing.Point(6, 134); + this.randomizeWindowTitleCheckBox.Name = "randomizeWindowTitleCheckBox"; + this.randomizeWindowTitleCheckBox.Size = new System.Drawing.Size(137, 17); + this.randomizeWindowTitleCheckBox.TabIndex = 5; + this.randomizeWindowTitleCheckBox.Text = "Randomize window title"; + this.randomizeWindowTitleCheckBox.UseVisualStyleBackColor = true; + // + // runAsAdminCheckBox + // + this.runAsAdminCheckBox.AutoSize = true; + this.runAsAdminCheckBox.Location = new System.Drawing.Point(6, 111); + this.runAsAdminCheckBox.Name = "runAsAdminCheckBox"; + this.runAsAdminCheckBox.Size = new System.Drawing.Size(200, 17); + this.runAsAdminCheckBox.TabIndex = 4; + this.runAsAdminCheckBox.Text = "Run as administrator (requires restart)"; + this.runAsAdminCheckBox.UseVisualStyleBackColor = true; + // + // highlightChangedValuesCheckBox + // + this.highlightChangedValuesCheckBox.AutoSize = true; + this.highlightChangedValuesCheckBox.Location = new System.Drawing.Point(6, 88); + this.highlightChangedValuesCheckBox.Name = "highlightChangedValuesCheckBox"; + this.highlightChangedValuesCheckBox.Size = new System.Drawing.Size(148, 17); + this.highlightChangedValuesCheckBox.TabIndex = 3; + this.highlightChangedValuesCheckBox.Text = "Highlight Changed Values"; + this.highlightChangedValuesCheckBox.UseVisualStyleBackColor = true; + // + // showTextCheckBox + // + this.showTextCheckBox.AutoSize = true; + this.showTextCheckBox.Location = new System.Drawing.Point(6, 65); + this.showTextCheckBox.Name = "showTextCheckBox"; + this.showTextCheckBox.Size = new System.Drawing.Size(166, 17); + this.showTextCheckBox.TabIndex = 2; + this.showTextCheckBox.Text = "Show Textual Representation"; + this.showTextCheckBox.UseVisualStyleBackColor = true; + // + // showNodeOffsetCheckBox + // + this.showNodeOffsetCheckBox.AutoSize = true; + this.showNodeOffsetCheckBox.Location = new System.Drawing.Point(6, 42); + this.showNodeOffsetCheckBox.Name = "showNodeOffsetCheckBox"; + this.showNodeOffsetCheckBox.Size = new System.Drawing.Size(113, 17); + this.showNodeOffsetCheckBox.TabIndex = 1; + this.showNodeOffsetCheckBox.Text = "Show Node Offset"; + this.showNodeOffsetCheckBox.UseVisualStyleBackColor = true; + // + // showNodeAddressCheckBox + // + this.showNodeAddressCheckBox.AutoSize = true; + this.showNodeAddressCheckBox.Location = new System.Drawing.Point(6, 19); + this.showNodeAddressCheckBox.Name = "showNodeAddressCheckBox"; + this.showNodeAddressCheckBox.Size = new System.Drawing.Size(123, 17); + this.showNodeAddressCheckBox.TabIndex = 0; + this.showNodeAddressCheckBox.Text = "Show Node Address"; + this.showNodeAddressCheckBox.UseVisualStyleBackColor = true; + // + // stayOnTopCheckBox + // + this.stayOnTopCheckBox.AutoSize = true; + this.stayOnTopCheckBox.Location = new System.Drawing.Point(6, 6); + this.stayOnTopCheckBox.Name = "stayOnTopCheckBox"; + this.stayOnTopCheckBox.Size = new System.Drawing.Size(187, 17); + this.stayOnTopCheckBox.TabIndex = 1; + this.stayOnTopCheckBox.Text = "Force ReClass.NET to stay on top"; + this.stayOnTopCheckBox.UseVisualStyleBackColor = true; + // + // colorsSettingTabPage + // + this.colorsSettingTabPage.Controls.Add(this.nodeColorGroupBox); + this.colorsSettingTabPage.Controls.Add(this.backgroundLabel); + this.colorsSettingTabPage.Controls.Add(this.backgroundColorBox); + this.colorsSettingTabPage.Location = new System.Drawing.Point(4, 22); + this.colorsSettingTabPage.Name = "colorsSettingTabPage"; + this.colorsSettingTabPage.Padding = new System.Windows.Forms.Padding(3); + this.colorsSettingTabPage.Size = new System.Drawing.Size(554, 329); + this.colorsSettingTabPage.TabIndex = 1; + this.colorsSettingTabPage.Text = "Colors"; + this.colorsSettingTabPage.UseVisualStyleBackColor = true; + // + // nodeColorGroupBox + // + this.nodeColorGroupBox.Controls.Add(this.nodeValueLabel); + this.nodeColorGroupBox.Controls.Add(this.nodePluginLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeHexValueColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodePluginColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeHexValueLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeVTableLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeOffsetColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeVTableColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeOffsetLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeTextLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeAddressColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeTextColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeAddressLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeCommentLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeHiddenColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeCommentColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeHiddenLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeIndexLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeSelectedColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeIndexColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeSelectedLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeTypeColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeValueColorBox); + this.nodeColorGroupBox.Controls.Add(this.nodeTypeLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeNameLabel); + this.nodeColorGroupBox.Controls.Add(this.nodeNameColorBox); + this.nodeColorGroupBox.Location = new System.Drawing.Point(9, 43); + this.nodeColorGroupBox.Name = "nodeColorGroupBox"; + this.nodeColorGroupBox.Size = new System.Drawing.Size(539, 225); + this.nodeColorGroupBox.TabIndex = 28; + this.nodeColorGroupBox.TabStop = false; + this.nodeColorGroupBox.Text = "Node Colors"; + // + // nodeValueLabel + // + this.nodeValueLabel.AutoSize = true; + this.nodeValueLabel.Location = new System.Drawing.Point(9, 198); + this.nodeValueLabel.Name = "nodeValueLabel"; + this.nodeValueLabel.Size = new System.Drawing.Size(64, 13); + this.nodeValueLabel.TabIndex = 17; + this.nodeValueLabel.Text = "Value Color:"; + // + // nodePluginLabel + // + this.nodePluginLabel.AutoSize = true; + this.nodePluginLabel.Location = new System.Drawing.Point(286, 172); + this.nodePluginLabel.Name = "nodePluginLabel"; + this.nodePluginLabel.Size = new System.Drawing.Size(87, 13); + this.nodePluginLabel.TabIndex = 27; + this.nodePluginLabel.Text = "Plugin Info Color:"; + // + // nodeHexValueColorBox + // + this.nodeHexValueColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeHexValueColorBox.Location = new System.Drawing.Point(133, 117); + this.nodeHexValueColorBox.Name = "nodeHexValueColorBox"; + this.nodeHexValueColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeHexValueColorBox.TabIndex = 2; + // + // nodePluginColorBox + // + this.nodePluginColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodePluginColorBox.Location = new System.Drawing.Point(410, 169); + this.nodePluginColorBox.Name = "nodePluginColorBox"; + this.nodePluginColorBox.Size = new System.Drawing.Size(123, 20); + this.nodePluginColorBox.TabIndex = 26; + // + // nodeHexValueLabel + // + this.nodeHexValueLabel.AutoSize = true; + this.nodeHexValueLabel.Location = new System.Drawing.Point(9, 120); + this.nodeHexValueLabel.Name = "nodeHexValueLabel"; + this.nodeHexValueLabel.Size = new System.Drawing.Size(86, 13); + this.nodeHexValueLabel.TabIndex = 3; + this.nodeHexValueLabel.Text = "Hex Value Color:"; + // + // nodeVTableLabel + // + this.nodeVTableLabel.AutoSize = true; + this.nodeVTableLabel.Location = new System.Drawing.Point(286, 94); + this.nodeVTableLabel.Name = "nodeVTableLabel"; + this.nodeVTableLabel.Size = new System.Drawing.Size(71, 13); + this.nodeVTableLabel.TabIndex = 25; + this.nodeVTableLabel.Text = "VTable Color:"; + // + // nodeOffsetColorBox + // + this.nodeOffsetColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeOffsetColorBox.Location = new System.Drawing.Point(133, 91); + this.nodeOffsetColorBox.Name = "nodeOffsetColorBox"; + this.nodeOffsetColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeOffsetColorBox.TabIndex = 4; + // + // nodeVTableColorBox + // + this.nodeVTableColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeVTableColorBox.Location = new System.Drawing.Point(410, 91); + this.nodeVTableColorBox.Name = "nodeVTableColorBox"; + this.nodeVTableColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeVTableColorBox.TabIndex = 24; + // + // nodeOffsetLabel + // + this.nodeOffsetLabel.AutoSize = true; + this.nodeOffsetLabel.Location = new System.Drawing.Point(9, 94); + this.nodeOffsetLabel.Name = "nodeOffsetLabel"; + this.nodeOffsetLabel.Size = new System.Drawing.Size(65, 13); + this.nodeOffsetLabel.TabIndex = 5; + this.nodeOffsetLabel.Text = "Offset Color:"; + // + // nodeTextLabel + // + this.nodeTextLabel.AutoSize = true; + this.nodeTextLabel.Location = new System.Drawing.Point(286, 146); + this.nodeTextLabel.Name = "nodeTextLabel"; + this.nodeTextLabel.Size = new System.Drawing.Size(58, 13); + this.nodeTextLabel.TabIndex = 23; + this.nodeTextLabel.Text = "Text Color:"; + // + // nodeAddressColorBox + // + this.nodeAddressColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeAddressColorBox.Location = new System.Drawing.Point(133, 65); + this.nodeAddressColorBox.Name = "nodeAddressColorBox"; + this.nodeAddressColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeAddressColorBox.TabIndex = 6; + // + // nodeTextColorBox + // + this.nodeTextColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeTextColorBox.Location = new System.Drawing.Point(410, 143); + this.nodeTextColorBox.Name = "nodeTextColorBox"; + this.nodeTextColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeTextColorBox.TabIndex = 22; + // + // nodeAddressLabel + // + this.nodeAddressLabel.AutoSize = true; + this.nodeAddressLabel.Location = new System.Drawing.Point(9, 68); + this.nodeAddressLabel.Name = "nodeAddressLabel"; + this.nodeAddressLabel.Size = new System.Drawing.Size(75, 13); + this.nodeAddressLabel.TabIndex = 7; + this.nodeAddressLabel.Text = "Address Color:"; + // + // nodeCommentLabel + // + this.nodeCommentLabel.AutoSize = true; + this.nodeCommentLabel.Location = new System.Drawing.Point(286, 120); + this.nodeCommentLabel.Name = "nodeCommentLabel"; + this.nodeCommentLabel.Size = new System.Drawing.Size(81, 13); + this.nodeCommentLabel.TabIndex = 21; + this.nodeCommentLabel.Text = "Comment Color:"; + // + // nodeHiddenColorBox + // + this.nodeHiddenColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeHiddenColorBox.Location = new System.Drawing.Point(410, 18); + this.nodeHiddenColorBox.Name = "nodeHiddenColorBox"; + this.nodeHiddenColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeHiddenColorBox.TabIndex = 8; + // + // nodeCommentColorBox + // + this.nodeCommentColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeCommentColorBox.Location = new System.Drawing.Point(410, 117); + this.nodeCommentColorBox.Name = "nodeCommentColorBox"; + this.nodeCommentColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeCommentColorBox.TabIndex = 20; + // + // nodeHiddenLabel + // + this.nodeHiddenLabel.AutoSize = true; + this.nodeHiddenLabel.Location = new System.Drawing.Point(286, 21); + this.nodeHiddenLabel.Name = "nodeHiddenLabel"; + this.nodeHiddenLabel.Size = new System.Drawing.Size(71, 13); + this.nodeHiddenLabel.TabIndex = 9; + this.nodeHiddenLabel.Text = "Hidden Color:"; + // + // nodeIndexLabel + // + this.nodeIndexLabel.AutoSize = true; + this.nodeIndexLabel.Location = new System.Drawing.Point(286, 68); + this.nodeIndexLabel.Name = "nodeIndexLabel"; + this.nodeIndexLabel.Size = new System.Drawing.Size(63, 13); + this.nodeIndexLabel.TabIndex = 19; + this.nodeIndexLabel.Text = "Index Color:"; + // + // nodeSelectedColorBox + // + this.nodeSelectedColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeSelectedColorBox.Location = new System.Drawing.Point(133, 18); + this.nodeSelectedColorBox.Name = "nodeSelectedColorBox"; + this.nodeSelectedColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeSelectedColorBox.TabIndex = 10; + // + // nodeIndexColorBox + // + this.nodeIndexColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeIndexColorBox.Location = new System.Drawing.Point(410, 65); + this.nodeIndexColorBox.Name = "nodeIndexColorBox"; + this.nodeIndexColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeIndexColorBox.TabIndex = 18; + // + // nodeSelectedLabel + // + this.nodeSelectedLabel.AutoSize = true; + this.nodeSelectedLabel.Location = new System.Drawing.Point(9, 21); + this.nodeSelectedLabel.Name = "nodeSelectedLabel"; + this.nodeSelectedLabel.Size = new System.Drawing.Size(79, 13); + this.nodeSelectedLabel.TabIndex = 11; + this.nodeSelectedLabel.Text = "Selected Color:"; + // + // nodeTypeColorBox + // + this.nodeTypeColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeTypeColorBox.Location = new System.Drawing.Point(133, 143); + this.nodeTypeColorBox.Name = "nodeTypeColorBox"; + this.nodeTypeColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeTypeColorBox.TabIndex = 12; + // + // nodeValueColorBox + // + this.nodeValueColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeValueColorBox.Location = new System.Drawing.Point(133, 195); + this.nodeValueColorBox.Name = "nodeValueColorBox"; + this.nodeValueColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeValueColorBox.TabIndex = 16; + // + // nodeTypeLabel + // + this.nodeTypeLabel.AutoSize = true; + this.nodeTypeLabel.Location = new System.Drawing.Point(9, 146); + this.nodeTypeLabel.Name = "nodeTypeLabel"; + this.nodeTypeLabel.Size = new System.Drawing.Size(61, 13); + this.nodeTypeLabel.TabIndex = 13; + this.nodeTypeLabel.Text = "Type Color:"; + // + // nodeNameLabel + // + this.nodeNameLabel.AutoSize = true; + this.nodeNameLabel.Location = new System.Drawing.Point(9, 172); + this.nodeNameLabel.Name = "nodeNameLabel"; + this.nodeNameLabel.Size = new System.Drawing.Size(65, 13); + this.nodeNameLabel.TabIndex = 15; + this.nodeNameLabel.Text = "Name Color:"; + // + // nodeNameColorBox + // + this.nodeNameColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.nodeNameColorBox.Location = new System.Drawing.Point(133, 169); + this.nodeNameColorBox.Name = "nodeNameColorBox"; + this.nodeNameColorBox.Size = new System.Drawing.Size(123, 20); + this.nodeNameColorBox.TabIndex = 14; + // + // backgroundLabel + // + this.backgroundLabel.AutoSize = true; + this.backgroundLabel.Location = new System.Drawing.Point(6, 14); + this.backgroundLabel.Name = "backgroundLabel"; + this.backgroundLabel.Size = new System.Drawing.Size(161, 13); + this.backgroundLabel.TabIndex = 1; + this.backgroundLabel.Text = "Memory View Background Color:"; + // + // backgroundColorBox + // + this.backgroundColorBox.Color = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + this.backgroundColorBox.Location = new System.Drawing.Point(175, 11); + this.backgroundColorBox.Name = "backgroundColorBox"; + this.backgroundColorBox.Size = new System.Drawing.Size(123, 20); + this.backgroundColorBox.TabIndex = 0; + // + // typeDefinitionsSettingsTabPage + // + this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf32TextSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf32TextTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.nuintSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.nuintTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.nintSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.nintTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.boolSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.boolTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.generatorInfoLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.functionPtrSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.functionPtrTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf16TextSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf16TextTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf8TextSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.utf8TextTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x3SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x3TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x4SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix3x4TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix4x4SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.matrix4x4TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector2SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector2TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector3SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector3TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector4SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.vector4TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.doubleSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.doubleTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.floatSettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.floatTypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint64SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint64TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint32SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint32TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint16SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint16TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint8SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.uint8TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int64SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int64TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int32SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int32TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int16SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int16TypeTextBox); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int8SettingsLabel); + this.typeDefinitionsSettingsTabPage.Controls.Add(this.int8TypeTextBox); + this.typeDefinitionsSettingsTabPage.Location = new System.Drawing.Point(4, 22); + this.typeDefinitionsSettingsTabPage.Name = "typeDefinitionsSettingsTabPage"; + this.typeDefinitionsSettingsTabPage.Padding = new System.Windows.Forms.Padding(3); + this.typeDefinitionsSettingsTabPage.Size = new System.Drawing.Size(554, 329); + this.typeDefinitionsSettingsTabPage.TabIndex = 2; + this.typeDefinitionsSettingsTabPage.Text = "Type Definitions"; + this.typeDefinitionsSettingsTabPage.UseVisualStyleBackColor = true; + // + // nuintSettingsLabel + // + this.nuintSettingsLabel.AutoSize = true; + this.nuintSettingsLabel.Location = new System.Drawing.Point(6, 233); + this.nuintSettingsLabel.Name = "nuintSettingsLabel"; + this.nuintSettingsLabel.Size = new System.Drawing.Size(38, 13); + this.nuintSettingsLabel.TabIndex = 50; + this.nuintSettingsLabel.Text = "NUInt:"; + // + // nuintTypeTextBox + // + this.nuintTypeTextBox.Location = new System.Drawing.Point(98, 230); + this.nuintTypeTextBox.Name = "nuintTypeTextBox"; + this.nuintTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.nuintTypeTextBox.TabIndex = 49; + // + // nintSettingsLabel + // + this.nintSettingsLabel.AutoSize = true; + this.nintSettingsLabel.Location = new System.Drawing.Point(6, 123); + this.nintSettingsLabel.Name = "nintSettingsLabel"; + this.nintSettingsLabel.Size = new System.Drawing.Size(30, 13); + this.nintSettingsLabel.TabIndex = 48; + this.nintSettingsLabel.Text = "NInt:"; + // + // nintTypeTextBox + // + this.nintTypeTextBox.Location = new System.Drawing.Point(98, 120); + this.nintTypeTextBox.Name = "nintTypeTextBox"; + this.nintTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.nintTypeTextBox.TabIndex = 47; + // + // boolSettingsLabel + // + this.boolSettingsLabel.AutoSize = true; + this.boolSettingsLabel.Location = new System.Drawing.Point(254, 35); + this.boolSettingsLabel.Name = "boolSettingsLabel"; + this.boolSettingsLabel.Size = new System.Drawing.Size(31, 13); + this.boolSettingsLabel.TabIndex = 46; + this.boolSettingsLabel.Text = "Bool:"; + // + // boolTypeTextBox + // + this.boolTypeTextBox.Location = new System.Drawing.Point(346, 32); + this.boolTypeTextBox.Name = "boolTypeTextBox"; + this.boolTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.boolTypeTextBox.TabIndex = 45; + // + // generatorInfoLabel + // + this.generatorInfoLabel.AutoSize = true; + this.generatorInfoLabel.Location = new System.Drawing.Point(6, 6); + this.generatorInfoLabel.Name = "generatorInfoLabel"; + this.generatorInfoLabel.Size = new System.Drawing.Size(236, 13); + this.generatorInfoLabel.TabIndex = 44; + this.generatorInfoLabel.Text = "These types are used to generate the C++ code:"; + // + // functionPtrSettingsLabel + // + this.functionPtrSettingsLabel.AutoSize = true; + this.functionPtrSettingsLabel.Location = new System.Drawing.Point(254, 255); + this.functionPtrSettingsLabel.Name = "functionPtrSettingsLabel"; + this.functionPtrSettingsLabel.Size = new System.Drawing.Size(87, 13); + this.functionPtrSettingsLabel.TabIndex = 43; + this.functionPtrSettingsLabel.Text = "Function Pointer:"; + // + // functionPtrTypeTextBox + // + this.functionPtrTypeTextBox.Location = new System.Drawing.Point(346, 252); + this.functionPtrTypeTextBox.Name = "functionPtrTypeTextBox"; + this.functionPtrTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.functionPtrTypeTextBox.TabIndex = 42; + // + // utf16TextSettingsLabel + // + this.utf16TextSettingsLabel.AutoSize = true; + this.utf16TextSettingsLabel.Location = new System.Drawing.Point(254, 211); + this.utf16TextSettingsLabel.Name = "utf16TextSettingsLabel"; + this.utf16TextSettingsLabel.Size = new System.Drawing.Size(43, 13); + this.utf16TextSettingsLabel.TabIndex = 39; + this.utf16TextSettingsLabel.Text = "UTF16:"; + // + // utf16TextTypeTextBox + // + this.utf16TextTypeTextBox.Location = new System.Drawing.Point(346, 208); + this.utf16TextTypeTextBox.Name = "utf16TextTypeTextBox"; + this.utf16TextTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.utf16TextTypeTextBox.TabIndex = 38; + // + // utf8TextSettingsLabel + // + this.utf8TextSettingsLabel.AutoSize = true; + this.utf8TextSettingsLabel.Location = new System.Drawing.Point(254, 189); + this.utf8TextSettingsLabel.Name = "utf8TextSettingsLabel"; + this.utf8TextSettingsLabel.Size = new System.Drawing.Size(37, 13); + this.utf8TextSettingsLabel.TabIndex = 35; + this.utf8TextSettingsLabel.Text = "UTF8:"; + // + // utf8TextTypeTextBox + // + this.utf8TextTypeTextBox.Location = new System.Drawing.Point(346, 186); + this.utf8TextTypeTextBox.Name = "utf8TextTypeTextBox"; + this.utf8TextTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.utf8TextTypeTextBox.TabIndex = 34; + // + // matrix3x3SettingsLabel + // + this.matrix3x3SettingsLabel.AutoSize = true; + this.matrix3x3SettingsLabel.Location = new System.Drawing.Point(254, 123); + this.matrix3x3SettingsLabel.Name = "matrix3x3SettingsLabel"; + this.matrix3x3SettingsLabel.Size = new System.Drawing.Size(64, 13); + this.matrix3x3SettingsLabel.TabIndex = 33; + this.matrix3x3SettingsLabel.Text = "Matrix (3x3):"; + // + // matrix3x3TypeTextBox + // + this.matrix3x3TypeTextBox.Location = new System.Drawing.Point(346, 120); + this.matrix3x3TypeTextBox.Name = "matrix3x3TypeTextBox"; + this.matrix3x3TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.matrix3x3TypeTextBox.TabIndex = 32; + // + // matrix3x4SettingsLabel + // + this.matrix3x4SettingsLabel.AutoSize = true; + this.matrix3x4SettingsLabel.Location = new System.Drawing.Point(254, 145); + this.matrix3x4SettingsLabel.Name = "matrix3x4SettingsLabel"; + this.matrix3x4SettingsLabel.Size = new System.Drawing.Size(64, 13); + this.matrix3x4SettingsLabel.TabIndex = 31; + this.matrix3x4SettingsLabel.Text = "Matrix (3x4):"; + // + // matrix3x4TypeTextBox + // + this.matrix3x4TypeTextBox.Location = new System.Drawing.Point(346, 142); + this.matrix3x4TypeTextBox.Name = "matrix3x4TypeTextBox"; + this.matrix3x4TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.matrix3x4TypeTextBox.TabIndex = 30; + // + // matrix4x4SettingsLabel + // + this.matrix4x4SettingsLabel.AutoSize = true; + this.matrix4x4SettingsLabel.Location = new System.Drawing.Point(254, 167); + this.matrix4x4SettingsLabel.Name = "matrix4x4SettingsLabel"; + this.matrix4x4SettingsLabel.Size = new System.Drawing.Size(64, 13); + this.matrix4x4SettingsLabel.TabIndex = 29; + this.matrix4x4SettingsLabel.Text = "Matrix (4x4):"; + // + // matrix4x4TypeTextBox + // + this.matrix4x4TypeTextBox.Location = new System.Drawing.Point(346, 164); + this.matrix4x4TypeTextBox.Name = "matrix4x4TypeTextBox"; + this.matrix4x4TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.matrix4x4TypeTextBox.TabIndex = 28; + // + // vector2SettingsLabel + // + this.vector2SettingsLabel.AutoSize = true; + this.vector2SettingsLabel.Location = new System.Drawing.Point(254, 57); + this.vector2SettingsLabel.Name = "vector2SettingsLabel"; + this.vector2SettingsLabel.Size = new System.Drawing.Size(47, 13); + this.vector2SettingsLabel.TabIndex = 27; + this.vector2SettingsLabel.Text = "Vector2:"; + // + // vector2TypeTextBox + // + this.vector2TypeTextBox.Location = new System.Drawing.Point(346, 54); + this.vector2TypeTextBox.Name = "vector2TypeTextBox"; + this.vector2TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.vector2TypeTextBox.TabIndex = 26; + // + // vector3SettingsLabel + // + this.vector3SettingsLabel.AutoSize = true; + this.vector3SettingsLabel.Location = new System.Drawing.Point(254, 79); + this.vector3SettingsLabel.Name = "vector3SettingsLabel"; + this.vector3SettingsLabel.Size = new System.Drawing.Size(47, 13); + this.vector3SettingsLabel.TabIndex = 25; + this.vector3SettingsLabel.Text = "Vector3:"; + // + // vector3TypeTextBox + // + this.vector3TypeTextBox.Location = new System.Drawing.Point(346, 76); + this.vector3TypeTextBox.Name = "vector3TypeTextBox"; + this.vector3TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.vector3TypeTextBox.TabIndex = 24; + // + // vector4SettingsLabel + // + this.vector4SettingsLabel.AutoSize = true; + this.vector4SettingsLabel.Location = new System.Drawing.Point(254, 101); + this.vector4SettingsLabel.Name = "vector4SettingsLabel"; + this.vector4SettingsLabel.Size = new System.Drawing.Size(47, 13); + this.vector4SettingsLabel.TabIndex = 23; + this.vector4SettingsLabel.Text = "Vector4:"; + // + // vector4TypeTextBox + // + this.vector4TypeTextBox.Location = new System.Drawing.Point(346, 98); + this.vector4TypeTextBox.Name = "vector4TypeTextBox"; + this.vector4TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.vector4TypeTextBox.TabIndex = 22; + // + // doubleSettingsLabel + // + this.doubleSettingsLabel.AutoSize = true; + this.doubleSettingsLabel.Location = new System.Drawing.Point(6, 277); + this.doubleSettingsLabel.Name = "doubleSettingsLabel"; + this.doubleSettingsLabel.Size = new System.Drawing.Size(44, 13); + this.doubleSettingsLabel.TabIndex = 21; + this.doubleSettingsLabel.Text = "Double:"; + // + // doubleTypeTextBox + // + this.doubleTypeTextBox.Location = new System.Drawing.Point(98, 274); + this.doubleTypeTextBox.Name = "doubleTypeTextBox"; + this.doubleTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.doubleTypeTextBox.TabIndex = 20; + // + // floatSettingsLabel + // + this.floatSettingsLabel.AutoSize = true; + this.floatSettingsLabel.Location = new System.Drawing.Point(6, 255); + this.floatSettingsLabel.Name = "floatSettingsLabel"; + this.floatSettingsLabel.Size = new System.Drawing.Size(33, 13); + this.floatSettingsLabel.TabIndex = 19; + this.floatSettingsLabel.Text = "Float:"; + // + // floatTypeTextBox + // + this.floatTypeTextBox.Location = new System.Drawing.Point(98, 252); + this.floatTypeTextBox.Name = "floatTypeTextBox"; + this.floatTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.floatTypeTextBox.TabIndex = 18; + // + // uint64SettingsLabel + // + this.uint64SettingsLabel.AutoSize = true; + this.uint64SettingsLabel.Location = new System.Drawing.Point(6, 211); + this.uint64SettingsLabel.Name = "uint64SettingsLabel"; + this.uint64SettingsLabel.Size = new System.Drawing.Size(42, 13); + this.uint64SettingsLabel.TabIndex = 17; + this.uint64SettingsLabel.Text = "UInt64:"; + // + // uint64TypeTextBox + // + this.uint64TypeTextBox.Location = new System.Drawing.Point(98, 208); + this.uint64TypeTextBox.Name = "uint64TypeTextBox"; + this.uint64TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.uint64TypeTextBox.TabIndex = 16; + // + // uint32SettingsLabel + // + this.uint32SettingsLabel.AutoSize = true; + this.uint32SettingsLabel.Location = new System.Drawing.Point(6, 189); + this.uint32SettingsLabel.Name = "uint32SettingsLabel"; + this.uint32SettingsLabel.Size = new System.Drawing.Size(42, 13); + this.uint32SettingsLabel.TabIndex = 15; + this.uint32SettingsLabel.Text = "UInt32:"; + // + // uint32TypeTextBox + // + this.uint32TypeTextBox.Location = new System.Drawing.Point(98, 186); + this.uint32TypeTextBox.Name = "uint32TypeTextBox"; + this.uint32TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.uint32TypeTextBox.TabIndex = 14; + // + // uint16SettingsLabel + // + this.uint16SettingsLabel.AutoSize = true; + this.uint16SettingsLabel.Location = new System.Drawing.Point(6, 167); + this.uint16SettingsLabel.Name = "uint16SettingsLabel"; + this.uint16SettingsLabel.Size = new System.Drawing.Size(42, 13); + this.uint16SettingsLabel.TabIndex = 13; + this.uint16SettingsLabel.Text = "UInt16:"; + // + // uint16TypeTextBox + // + this.uint16TypeTextBox.Location = new System.Drawing.Point(98, 164); + this.uint16TypeTextBox.Name = "uint16TypeTextBox"; + this.uint16TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.uint16TypeTextBox.TabIndex = 12; + // + // uint8SettingsLabel + // + this.uint8SettingsLabel.AutoSize = true; + this.uint8SettingsLabel.Location = new System.Drawing.Point(6, 145); + this.uint8SettingsLabel.Name = "uint8SettingsLabel"; + this.uint8SettingsLabel.Size = new System.Drawing.Size(36, 13); + this.uint8SettingsLabel.TabIndex = 11; + this.uint8SettingsLabel.Text = "UInt8:"; + // + // uint8TypeTextBox + // + this.uint8TypeTextBox.Location = new System.Drawing.Point(98, 142); + this.uint8TypeTextBox.Name = "uint8TypeTextBox"; + this.uint8TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.uint8TypeTextBox.TabIndex = 10; + // + // int64SettingsLabel + // + this.int64SettingsLabel.AutoSize = true; + this.int64SettingsLabel.Location = new System.Drawing.Point(6, 101); + this.int64SettingsLabel.Name = "int64SettingsLabel"; + this.int64SettingsLabel.Size = new System.Drawing.Size(34, 13); + this.int64SettingsLabel.TabIndex = 9; + this.int64SettingsLabel.Text = "Int64:"; + // + // int64TypeTextBox + // + this.int64TypeTextBox.Location = new System.Drawing.Point(98, 98); + this.int64TypeTextBox.Name = "int64TypeTextBox"; + this.int64TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.int64TypeTextBox.TabIndex = 8; + // + // int32SettingsLabel + // + this.int32SettingsLabel.AutoSize = true; + this.int32SettingsLabel.Location = new System.Drawing.Point(6, 79); + this.int32SettingsLabel.Name = "int32SettingsLabel"; + this.int32SettingsLabel.Size = new System.Drawing.Size(34, 13); + this.int32SettingsLabel.TabIndex = 7; + this.int32SettingsLabel.Text = "Int32:"; + // + // int32TypeTextBox + // + this.int32TypeTextBox.Location = new System.Drawing.Point(98, 76); + this.int32TypeTextBox.Name = "int32TypeTextBox"; + this.int32TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.int32TypeTextBox.TabIndex = 6; + // + // int16SettingsLabel + // + this.int16SettingsLabel.AutoSize = true; + this.int16SettingsLabel.Location = new System.Drawing.Point(6, 57); + this.int16SettingsLabel.Name = "int16SettingsLabel"; + this.int16SettingsLabel.Size = new System.Drawing.Size(34, 13); + this.int16SettingsLabel.TabIndex = 5; + this.int16SettingsLabel.Text = "Int16:"; + // + // int16TypeTextBox + // + this.int16TypeTextBox.Location = new System.Drawing.Point(98, 54); + this.int16TypeTextBox.Name = "int16TypeTextBox"; + this.int16TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.int16TypeTextBox.TabIndex = 4; + // + // int8SettingsLabel + // + this.int8SettingsLabel.AutoSize = true; + this.int8SettingsLabel.Location = new System.Drawing.Point(6, 35); + this.int8SettingsLabel.Name = "int8SettingsLabel"; + this.int8SettingsLabel.Size = new System.Drawing.Size(28, 13); + this.int8SettingsLabel.TabIndex = 3; + this.int8SettingsLabel.Text = "Int8:"; + // + // int8TypeTextBox + // + this.int8TypeTextBox.Location = new System.Drawing.Point(98, 32); + this.int8TypeTextBox.Name = "int8TypeTextBox"; + this.int8TypeTextBox.Size = new System.Drawing.Size(120, 20); + this.int8TypeTextBox.TabIndex = 2; + // + // bannerBox + // + this.bannerBox.Dock = System.Windows.Forms.DockStyle.Top; + this.bannerBox.Icon = global::ReClassNET.Properties.Resources.B32x32_Cogs; + this.bannerBox.Location = new System.Drawing.Point(0, 0); + this.bannerBox.Name = "bannerBox"; + this.bannerBox.Size = new System.Drawing.Size(586, 48); + this.bannerBox.TabIndex = 2; + this.bannerBox.Text = "Configure the global settings."; + this.bannerBox.Title = "Settings"; + // + // utf32TextSettingsLabel + // + this.utf32TextSettingsLabel.AutoSize = true; + this.utf32TextSettingsLabel.Location = new System.Drawing.Point(254, 233); + this.utf32TextSettingsLabel.Name = "utf32TextSettingsLabel"; + this.utf32TextSettingsLabel.Size = new System.Drawing.Size(43, 13); + this.utf32TextSettingsLabel.TabIndex = 52; + this.utf32TextSettingsLabel.Text = "UTF32:"; + // + // utf32TextTypeTextBox + // + this.utf32TextTypeTextBox.Location = new System.Drawing.Point(346, 230); + this.utf32TextTypeTextBox.Name = "utf32TextTypeTextBox"; + this.utf32TextTypeTextBox.Size = new System.Drawing.Size(120, 20); + this.utf32TextTypeTextBox.TabIndex = 51; + // + // SettingsForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(586, 427); + this.Controls.Add(this.bannerBox); + this.Controls.Add(this.settingsTabControl); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "SettingsForm"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "ReClass.NET - Settings"; + this.settingsTabControl.ResumeLayout(false); + this.generalSettingsTabPage.ResumeLayout(false); + this.generalSettingsTabPage.PerformLayout(); + this.fileAssociationGroupBox.ResumeLayout(false); + this.commentsGroupBox.ResumeLayout(false); + this.commentsGroupBox.PerformLayout(); + this.displayGroupBox.ResumeLayout(false); + this.displayGroupBox.PerformLayout(); + this.colorsSettingTabPage.ResumeLayout(false); + this.colorsSettingTabPage.PerformLayout(); + this.nodeColorGroupBox.ResumeLayout(false); + this.nodeColorGroupBox.PerformLayout(); + this.typeDefinitionsSettingsTabPage.ResumeLayout(false); + this.typeDefinitionsSettingsTabPage.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.bannerBox)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.TabControl settingsTabControl; + private System.Windows.Forms.TabPage generalSettingsTabPage; + private System.Windows.Forms.TabPage colorsSettingTabPage; + private System.Windows.Forms.TabPage typeDefinitionsSettingsTabPage; + private System.Windows.Forms.CheckBox stayOnTopCheckBox; + private System.Windows.Forms.GroupBox displayGroupBox; + private System.Windows.Forms.CheckBox showNodeAddressCheckBox; + private System.Windows.Forms.CheckBox showTextCheckBox; + private System.Windows.Forms.CheckBox showNodeOffsetCheckBox; + private System.Windows.Forms.CheckBox highlightChangedValuesCheckBox; + private System.Windows.Forms.GroupBox commentsGroupBox; + private System.Windows.Forms.CheckBox showRttiCheckBox; + private System.Windows.Forms.CheckBox showPointerCheckBox; + private System.Windows.Forms.CheckBox showIntegerCheckBox; + private System.Windows.Forms.CheckBox showFloatCheckBox; + private System.Windows.Forms.CheckBox showPluginInfoCheckBox; + private System.Windows.Forms.CheckBox showStringCheckBox; + private System.Windows.Forms.CheckBox showSymbolsCheckBox; + private ColorBox backgroundColorBox; + private System.Windows.Forms.Label nodeSelectedLabel; + private ColorBox nodeSelectedColorBox; + private System.Windows.Forms.Label nodeHiddenLabel; + private ColorBox nodeHiddenColorBox; + private System.Windows.Forms.Label nodeAddressLabel; + private ColorBox nodeAddressColorBox; + private System.Windows.Forms.Label nodeOffsetLabel; + private ColorBox nodeOffsetColorBox; + private System.Windows.Forms.Label nodeHexValueLabel; + private ColorBox nodeHexValueColorBox; + private System.Windows.Forms.Label backgroundLabel; + private System.Windows.Forms.Label nodeValueLabel; + private ColorBox nodeValueColorBox; + private System.Windows.Forms.Label nodeNameLabel; + private ColorBox nodeNameColorBox; + private System.Windows.Forms.Label nodeTypeLabel; + private ColorBox nodeTypeColorBox; + private System.Windows.Forms.Label nodeVTableLabel; + private ColorBox nodeVTableColorBox; + private System.Windows.Forms.Label nodeTextLabel; + private ColorBox nodeTextColorBox; + private System.Windows.Forms.Label nodeCommentLabel; + private ColorBox nodeCommentColorBox; + private System.Windows.Forms.Label nodeIndexLabel; + private ColorBox nodeIndexColorBox; + private System.Windows.Forms.Label nodePluginLabel; + private ColorBox nodePluginColorBox; + private System.Windows.Forms.Label floatSettingsLabel; + private System.Windows.Forms.TextBox floatTypeTextBox; + private System.Windows.Forms.Label uint64SettingsLabel; + private System.Windows.Forms.TextBox uint64TypeTextBox; + private System.Windows.Forms.Label uint32SettingsLabel; + private System.Windows.Forms.TextBox uint32TypeTextBox; + private System.Windows.Forms.Label uint16SettingsLabel; + private System.Windows.Forms.TextBox uint16TypeTextBox; + private System.Windows.Forms.Label uint8SettingsLabel; + private System.Windows.Forms.TextBox uint8TypeTextBox; + private System.Windows.Forms.Label int64SettingsLabel; + private System.Windows.Forms.TextBox int64TypeTextBox; + private System.Windows.Forms.Label int32SettingsLabel; + private System.Windows.Forms.TextBox int32TypeTextBox; + private System.Windows.Forms.Label int16SettingsLabel; + private System.Windows.Forms.TextBox int16TypeTextBox; + private System.Windows.Forms.Label int8SettingsLabel; + private System.Windows.Forms.TextBox int8TypeTextBox; + private System.Windows.Forms.Label functionPtrSettingsLabel; + private System.Windows.Forms.TextBox functionPtrTypeTextBox; + private System.Windows.Forms.Label utf16TextSettingsLabel; + private System.Windows.Forms.TextBox utf16TextTypeTextBox; + private System.Windows.Forms.Label utf8TextSettingsLabel; + private System.Windows.Forms.TextBox utf8TextTypeTextBox; + private System.Windows.Forms.Label matrix3x3SettingsLabel; + private System.Windows.Forms.TextBox matrix3x3TypeTextBox; + private System.Windows.Forms.Label matrix3x4SettingsLabel; + private System.Windows.Forms.TextBox matrix3x4TypeTextBox; + private System.Windows.Forms.Label matrix4x4SettingsLabel; + private System.Windows.Forms.TextBox matrix4x4TypeTextBox; + private System.Windows.Forms.Label vector2SettingsLabel; + private System.Windows.Forms.TextBox vector2TypeTextBox; + private System.Windows.Forms.Label vector3SettingsLabel; + private System.Windows.Forms.TextBox vector3TypeTextBox; + private System.Windows.Forms.Label vector4SettingsLabel; + private System.Windows.Forms.TextBox vector4TypeTextBox; + private System.Windows.Forms.Label doubleSettingsLabel; + private System.Windows.Forms.TextBox doubleTypeTextBox; + private System.Windows.Forms.GroupBox nodeColorGroupBox; + private System.Windows.Forms.Label generatorInfoLabel; + private BannerBox bannerBox; + private System.Windows.Forms.Label boolSettingsLabel; + private System.Windows.Forms.TextBox boolTypeTextBox; + private System.Windows.Forms.GroupBox fileAssociationGroupBox; + private System.Windows.Forms.Button removeAssociationButton; + private System.Windows.Forms.Button createAssociationButton; + private System.Windows.Forms.Label associationInfoLabel; + private System.Windows.Forms.CheckBox randomizeWindowTitleCheckBox; + private System.Windows.Forms.CheckBox runAsAdminCheckBox; + private System.Windows.Forms.Label nuintSettingsLabel; + private System.Windows.Forms.TextBox nuintTypeTextBox; + private System.Windows.Forms.Label nintSettingsLabel; + private System.Windows.Forms.TextBox nintTypeTextBox; + private System.Windows.Forms.Label utf32TextSettingsLabel; + private System.Windows.Forms.TextBox utf32TextTypeTextBox; + } +} \ No newline at end of file diff --git a/ReClass.NET/Forms/SettingsForm.cs b/ReClass.NET/Forms/SettingsForm.cs new file mode 100644 index 00000000..fcc4121e --- /dev/null +++ b/ReClass.NET/Forms/SettingsForm.cs @@ -0,0 +1,157 @@ +using System; +using System.Diagnostics.Contracts; +using System.Windows.Forms; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Native; +using ReClassNET.Project; +using ReClassNET.UI; +using ReClassNET.Util; + +namespace ReClassNET.Forms +{ + public partial class SettingsForm : IconForm + { + private readonly Settings settings; + private readonly CppTypeMapping typeMapping; + + public TabControl SettingsTabControl => settingsTabControl; + + public SettingsForm(Settings settings, CppTypeMapping typeMapping) + { + Contract.Requires(settings != null); + Contract.Requires(typeMapping != null); + + this.settings = settings; + this.typeMapping = typeMapping; + + InitializeComponent(); + + var imageList = new ImageList(); + imageList.Images.Add(Properties.Resources.B16x16_Gear); + imageList.Images.Add(Properties.Resources.B16x16_Color_Wheel); + imageList.Images.Add(Properties.Resources.B16x16_Settings_Edit); + + settingsTabControl.ImageList = imageList; + generalSettingsTabPage.ImageIndex = 0; + colorsSettingTabPage.ImageIndex = 1; + typeDefinitionsSettingsTabPage.ImageIndex = 2; + + SetGeneralBindings(); + SetColorBindings(); + SetTypeDefinitionBindings(); + + if (NativeMethods.IsUnix()) + { + fileAssociationGroupBox.Enabled = false; + runAsAdminCheckBox.Enabled = false; + } + else + { + NativeMethodsWindows.SetButtonShield(createAssociationButton, true); + NativeMethodsWindows.SetButtonShield(removeAssociationButton, true); + } + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + GlobalWindowManager.AddWindow(this); + } + + protected override void OnFormClosed(FormClosedEventArgs e) + { + base.OnFormClosed(e); + + GlobalWindowManager.RemoveWindow(this); + } + + private void createAssociationButton_Click(object sender, EventArgs e) + { + WinUtil.RunElevated(PathUtil.LauncherExecutablePath, $"-{Constants.CommandLineOptions.FileExtRegister}"); + } + + private void removeAssociationButton_Click(object sender, EventArgs e) + { + WinUtil.RunElevated(PathUtil.LauncherExecutablePath, $"-{Constants.CommandLineOptions.FileExtUnregister}"); + } + + private static void SetBinding(IBindableComponent control, string propertyName, object dataSource, string dataMember) + { + Contract.Requires(control != null); + Contract.Requires(propertyName != null); + Contract.Requires(dataSource != null); + Contract.Requires(dataMember != null); + + control.DataBindings.Add(propertyName, dataSource, dataMember, true, DataSourceUpdateMode.OnPropertyChanged); + } + + private void SetGeneralBindings() + { + SetBinding(stayOnTopCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.StayOnTop)); + stayOnTopCheckBox.CheckedChanged += (_, _2) => GlobalWindowManager.Windows.ForEach(w => w.TopMost = stayOnTopCheckBox.Checked); + + SetBinding(showNodeAddressCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowNodeAddress)); + SetBinding(showNodeOffsetCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowNodeOffset)); + SetBinding(showTextCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowNodeText)); + SetBinding(highlightChangedValuesCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.HighlightChangedValues)); + + SetBinding(showFloatCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowCommentFloat)); + SetBinding(showIntegerCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowCommentInteger)); + SetBinding(showPointerCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowCommentPointer)); + SetBinding(showRttiCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowCommentRtti)); + SetBinding(showSymbolsCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowCommentSymbol)); + SetBinding(showStringCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowCommentString)); + SetBinding(showPluginInfoCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.ShowCommentPluginInfo)); + SetBinding(runAsAdminCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.RunAsAdmin)); + SetBinding(randomizeWindowTitleCheckBox, nameof(CheckBox.Checked), settings, nameof(Settings.RandomizeWindowTitle)); + } + + private void SetColorBindings() + { + SetBinding(backgroundColorBox, nameof(ColorBox.Color), settings, nameof(Settings.BackgroundColor)); + + SetBinding(nodeSelectedColorBox, nameof(ColorBox.Color), settings, nameof(Settings.SelectedColor)); + SetBinding(nodeHiddenColorBox, nameof(ColorBox.Color), settings, nameof(Settings.HiddenColor)); + SetBinding(nodeAddressColorBox, nameof(ColorBox.Color), settings, nameof(Settings.AddressColor)); + SetBinding(nodeOffsetColorBox, nameof(ColorBox.Color), settings, nameof(Settings.OffsetColor)); + SetBinding(nodeHexValueColorBox, nameof(ColorBox.Color), settings, nameof(Settings.HexColor)); + SetBinding(nodeTypeColorBox, nameof(ColorBox.Color), settings, nameof(Settings.TypeColor)); + SetBinding(nodeNameColorBox, nameof(ColorBox.Color), settings, nameof(Settings.NameColor)); + SetBinding(nodeValueColorBox, nameof(ColorBox.Color), settings, nameof(Settings.ValueColor)); + SetBinding(nodeIndexColorBox, nameof(ColorBox.Color), settings, nameof(Settings.IndexColor)); + SetBinding(nodeVTableColorBox, nameof(ColorBox.Color), settings, nameof(Settings.VTableColor)); + SetBinding(nodeCommentColorBox, nameof(ColorBox.Color), settings, nameof(Settings.CommentColor)); + SetBinding(nodeTextColorBox, nameof(ColorBox.Color), settings, nameof(Settings.TextColor)); + SetBinding(nodePluginColorBox, nameof(ColorBox.Color), settings, nameof(Settings.PluginColor)); + } + + private void SetTypeDefinitionBindings() + { + SetBinding(boolTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeBool)); + SetBinding(int8TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeInt8)); + SetBinding(int16TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeInt16)); + SetBinding(int32TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeInt32)); + SetBinding(int64TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeInt64)); + SetBinding(nintTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeNInt)); + SetBinding(uint8TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUInt8)); + SetBinding(uint16TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUInt16)); + SetBinding(uint32TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUInt32)); + SetBinding(uint64TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUInt64)); + SetBinding(nuintTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeNUInt)); + SetBinding(floatTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeFloat)); + SetBinding(doubleTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeDouble)); + SetBinding(vector2TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeVector2)); + SetBinding(vector3TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeVector3)); + SetBinding(vector4TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeVector4)); + SetBinding(matrix3x3TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeMatrix3x3)); + SetBinding(matrix3x4TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeMatrix3x4)); + SetBinding(matrix4x4TypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeMatrix4x4)); + SetBinding(utf8TextTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUtf8Text)); + SetBinding(utf16TextTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUtf16Text)); + SetBinding(utf32TextTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeUtf32Text)); + SetBinding(functionPtrTypeTextBox, nameof(TextBox.Text), typeMapping, nameof(CppTypeMapping.TypeFunctionPtr)); + } + } +} diff --git a/ReClass.NET/Forms/SettingsForm.resx b/ReClass.NET/Forms/SettingsForm.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/ReClass.NET/Forms/SettingsForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ReClass.NET/Input/KeyboardHotkey.cs b/ReClass.NET/Input/KeyboardHotkey.cs new file mode 100644 index 00000000..aad26440 --- /dev/null +++ b/ReClass.NET/Input/KeyboardHotkey.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Windows.Forms; + +namespace ReClassNET.Input +{ + public class KeyboardHotkey + { + private readonly HashSet keys = new HashSet(); + + public IEnumerable Keys => keys; + + public bool IsEmpty => keys.Count == 0; + + public void Clear() => keys.Clear(); + + public bool AddKey(Keys key) => keys.Add(key); + + public bool Matches(Keys[] pressedKeys) + { + Contract.Requires(pressedKeys != null); + + if (keys.Count == 0 || keys.Count > pressedKeys.Length) + { + return false; + } + + return keys.All(pressedKeys.Contains); + } + + public KeyboardHotkey Clone() + { + var copy = new KeyboardHotkey(); + foreach (var key in Keys) copy.AddKey(key); + return copy; + } + + public override string ToString() + { + if (keys.Count == 0) + { + return string.Empty; + } + return keys.Select(k => k.ToString()).Aggregate((s1, s2) => $"{s1} + {s2}"); + } + } +} diff --git a/ReClass.NET/Input/KeyboardInput.cs b/ReClass.NET/Input/KeyboardInput.cs new file mode 100644 index 00000000..faa51156 --- /dev/null +++ b/ReClass.NET/Input/KeyboardInput.cs @@ -0,0 +1,40 @@ +using System; +using System.Diagnostics.Contracts; +using System.Windows.Forms; + +namespace ReClassNET.Input +{ + public class KeyboardInput : IDisposable + { + private readonly IntPtr handle; + + public KeyboardInput() + { + handle = Program.CoreFunctions.InitializeInput(); + } + + public void Dispose() + { + ReleaseUnmanagedResources(); + + GC.SuppressFinalize(this); + } + + ~KeyboardInput() + { + ReleaseUnmanagedResources(); + } + + private void ReleaseUnmanagedResources() + { + Program.CoreFunctions.ReleaseInput(handle); + } + + public Keys[] GetPressedKeys() + { + Contract.Ensures(Contract.Result() != null); + + return Program.CoreFunctions.GetPressedKeys(handle); + } + } +} diff --git a/Logger/BaseLogger.cs b/ReClass.NET/Logger/BaseLogger.cs similarity index 85% rename from Logger/BaseLogger.cs rename to ReClass.NET/Logger/BaseLogger.cs index dd6301ed..7b1f58b4 100644 --- a/Logger/BaseLogger.cs +++ b/ReClass.NET/Logger/BaseLogger.cs @@ -4,7 +4,7 @@ namespace ReClassNET.Logger { - class BaseLogger : ILogger + public abstract class BaseLogger : ILogger { private readonly object sync = new object(); @@ -12,15 +12,11 @@ class BaseLogger : ILogger public void Log(Exception ex) { - Contract.Requires(ex != null); - Log(LogLevel.Error, ExceptionMessageBox.GetMessageText(ex), ex); } public void Log(LogLevel level, string message) { - Contract.Requires(message != null); - Log(level, message, null); } diff --git a/Logger/GuiLogger.cs b/ReClass.NET/Logger/GuiLogger.cs similarity index 95% rename from Logger/GuiLogger.cs rename to ReClass.NET/Logger/GuiLogger.cs index 924dc6a8..7371afc2 100644 --- a/Logger/GuiLogger.cs +++ b/ReClass.NET/Logger/GuiLogger.cs @@ -6,7 +6,7 @@ namespace ReClassNET.Logger { /// A logger which displays messages in a form. - class GuiLogger : BaseLogger + public class GuiLogger : BaseLogger { private readonly LogForm form; diff --git a/Logger/ILogger.cs b/ReClass.NET/Logger/ILogger.cs similarity index 83% rename from Logger/ILogger.cs rename to ReClass.NET/Logger/ILogger.cs index 5744da57..46967266 100644 --- a/Logger/ILogger.cs +++ b/ReClass.NET/Logger/ILogger.cs @@ -5,7 +5,7 @@ namespace ReClassNET.Logger { public delegate void NewLogEntryEventHandler(LogLevel level, string message, Exception ex); - [ContractClass(typeof(ILoggerContract))] + [ContractClass(typeof(LoggerContract))] public interface ILogger { /// Gets triggered every time a new entry is created. @@ -22,9 +22,9 @@ public interface ILogger } [ContractClassFor(typeof(ILogger))] - internal abstract class ILoggerContract : ILogger + internal abstract class LoggerContract : ILogger { - public event NewLogEntryEventHandler NewLogEntry; + public event NewLogEntryEventHandler NewLogEntry { add { throw new NotImplementedException(); } remove { } } public void Log(Exception ex) { diff --git a/Logger/LogLevel.cs b/ReClass.NET/Logger/LogLevel.cs similarity index 100% rename from Logger/LogLevel.cs rename to ReClass.NET/Logger/LogLevel.cs diff --git a/Logger/NullLogger.cs b/ReClass.NET/Logger/NullLogger.cs similarity index 100% rename from Logger/NullLogger.cs rename to ReClass.NET/Logger/NullLogger.cs diff --git a/ReClass.NET/Makefile b/ReClass.NET/Makefile new file mode 100644 index 00000000..d66fd569 --- /dev/null +++ b/ReClass.NET/Makefile @@ -0,0 +1,38 @@ +.PHONY: all clean debug clean_debug release clean_release update docker_debug docker_release podman_debug podman_release + +all: debug release + +clean: clean_debug clean_release + +debug: + msbuild /p:Configuration=Debug /p:Platform=x86 ReClass.NET.csproj + msbuild /p:Configuration=Debug /p:Platform=x64 ReClass.NET.csproj + +clean_debug: + msbuild /t:Clean ReClass.NET.csproj + +release: + msbuild /p:Configuration=Release /p:Platform=x86 ReClass.NET.csproj + msbuild /p:Configuration=Release /p:Platform=x64 ReClass.NET.csproj + +clean_release: + msbuild /t:Clean ReClass.NET.csproj + +update: + mono --runtime=v4.0 ../Dependencies/nuget.exe restore ReClass.NET.csproj -SolutionDirectory ../ + +docker_debug: + docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Debug /p:Platform=x86 ReClass.NET.csproj" + docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Debug /p:Platform=x64 ReClass.NET.csproj" + +docker_release: + docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Release /p:Platform=x86 ReClass.NET.csproj" + docker container run --rm -v ${PWD}/..:/build:z -w /build -u $(shell id -u ${USER}):$(shell id -g ${USER}) mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Release /p:Platform=x64 ReClass.NET.csproj" + +podman_debug: + podman container run --rm -v ${PWD}/..:/build:z -w /build mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Debug /p:Platform=x86 ReClass.NET.csproj" + podman container run --rm -v ${PWD}/..:/build:z -w /build mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Debug /p:Platform=x64 ReClass.NET.csproj" + +podman_release: + podman container run --rm -v ${PWD}/..:/build:z -w /build mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Release /p:Platform=x86 ReClass.NET.csproj" + podman container run --rm -v ${PWD}/..:/build:z -w /build mono:latest bash -c "cd ReClass.NET && msbuild /p:Configuration=Release /p:Platform=x64 ReClass.NET.csproj" diff --git a/ReClass.NET/Memory/Disassembler.cs b/ReClass.NET/Memory/Disassembler.cs new file mode 100644 index 00000000..d83dfc97 --- /dev/null +++ b/ReClass.NET/Memory/Disassembler.cs @@ -0,0 +1,277 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Runtime.InteropServices; +using ReClassNET.Core; +using ReClassNET.Extensions; + +namespace ReClassNET.Memory +{ + public class Disassembler + { + // The maximum number of bytes of a x86-64 instruction. + public const int MaximumInstructionLength = 15; + + private readonly CoreFunctionsManager coreFunctions; + + public Disassembler(CoreFunctionsManager coreFunctions) + { + Contract.Requires(coreFunctions != null); + + this.coreFunctions = coreFunctions; + } + + /// Disassembles the code in the given range (, ) in the remote process. + /// The process to read from. + /// The address of the code. + /// The length of the code in bytes. + /// A list of . + public IReadOnlyList RemoteDisassembleCode(IRemoteMemoryReader process, IntPtr address, int length) + { + Contract.Requires(process != null); + Contract.Ensures(Contract.Result>() != null); + + return RemoteDisassembleCode(process, address, length, -1); + } + + /// Disassembles the code in the given range (, ) in the remote process. + /// The process to read from. + /// The address of the code. + /// The length of the code in bytes. + /// The maximum number of instructions to disassemble. If is -1, all available instructions get returned. + /// A list of . + public IReadOnlyList RemoteDisassembleCode(IRemoteMemoryReader process, IntPtr address, int length, int maxInstructions) + { + Contract.Requires(process != null); + Contract.Ensures(Contract.Result>() != null); + + var buffer = process.ReadRemoteMemory(address, length); + + return DisassembleCode(buffer, address, maxInstructions); + } + + /// Disassembles the code in the given data. + /// The data to disassemble. + /// The virtual address of the code. This allows to decode instructions located anywhere in memory even if they are not at their original place. + /// The maximum number of instructions to disassemble. If is -1, all available instructions get returned. + /// A list of . + public IReadOnlyList DisassembleCode(byte[] data, IntPtr virtualAddress, int maxInstructions) + { + Contract.Requires(data != null); + Contract.Ensures(Contract.Result>() != null); + + var handle = GCHandle.Alloc(data, GCHandleType.Pinned); + try + { + var instructions = new List(); + + coreFunctions.DisassembleCode(handle.AddrOfPinnedObject(), data.Length, virtualAddress, false, (ref InstructionData instruction) => + { + instructions.Add(new DisassembledInstruction(ref instruction)); + + return maxInstructions == -1 || instructions.Count < maxInstructions; + }); + + return instructions; + } + finally + { + if (handle.IsAllocated) + { + handle.Free(); + } + } + } + + /// Disassembles the code in the given range (, ) in the remote process until the first 0xCC instruction. + /// The process to read from. + /// The address of the code. + /// The maximum maxLength of the code. + /// A list of which belong to the function. + public IReadOnlyList RemoteDisassembleFunction(IRemoteMemoryReader process, IntPtr address, int maxLength) + { + Contract.Requires(process != null); + Contract.Ensures(Contract.Result>() != null); + + var buffer = process.ReadRemoteMemory(address, maxLength); + + return DisassembleFunction(buffer, address); + } + + /// Disassembles the code in the given data. + /// The data to disassemble. + /// The virtual address of the code. This allows to decode instructions located anywhere in memory even if they are not at their original place. + /// A list of which belong to the function. + public IReadOnlyList DisassembleFunction(byte[] data, IntPtr virtualAddress) + { + Contract.Requires(data != null); + Contract.Ensures(Contract.Result>() != null); + + var handle = GCHandle.Alloc(data, GCHandleType.Pinned); + try + { + var instructions = new List(); + + // Read until first CC. + coreFunctions.DisassembleCode(handle.AddrOfPinnedObject(), data.Length, virtualAddress, false, (ref InstructionData result) => + { + if (result.Length == 1 && result.Data[0] == 0xCC) + { + return false; + } + + instructions.Add(new DisassembledInstruction(ref result)); + + return true; + }); + + return instructions; + } + finally + { + if (handle.IsAllocated) + { + handle.Free(); + } + } + } + + /// Tries to find and disassembles the instruction prior to the given address. + /// The process to read from. + /// The address of the code. + /// The prior instruction. + public DisassembledInstruction RemoteGetPreviousInstruction(IRemoteMemoryReader process, IntPtr address) + { + const int TotalBufferSize = 7 * MaximumInstructionLength; + const int BufferShiftSize = 6 * MaximumInstructionLength; + + var buffer = process.ReadRemoteMemory(address - BufferShiftSize, TotalBufferSize); + + var handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); + try + { + var bufferAddress = handle.AddrOfPinnedObject(); + var targetBufferAddress = bufferAddress + BufferShiftSize; + + var instruction = default(InstructionData); + + foreach (var offset in new[] + { + 6 * MaximumInstructionLength, + 4 * MaximumInstructionLength, + 2 * MaximumInstructionLength, + 1 * MaximumInstructionLength, + 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + }) + { + var currentAddress = targetBufferAddress - offset; + + coreFunctions.DisassembleCode(currentAddress, offset + 1, address - offset, false, (ref InstructionData data) => + { + var nextAddress = currentAddress + data.Length; + if (nextAddress.CompareTo(targetBufferAddress) > 0) + { + return false; + } + + instruction = data; + + currentAddress = nextAddress; + + return true; + }); + + if (currentAddress == targetBufferAddress) + { + return new DisassembledInstruction(ref instruction); + } + } + + return null; + } + finally + { + if (handle.IsAllocated) + { + handle.Free(); + } + } + } + + /// Tries to find the start address of the function points into. + /// The process to read from. + /// The address inside the function. + /// The start address of the function (maybe) or if no start address could be found. + public IntPtr RemoteGetFunctionStartAddress(IRemoteMemoryReader process, IntPtr address) + { + const int BufferLength = 512; + + var buffer = new byte[2 + BufferLength + 2 + 1]; + + for (var i = 1; i <= 10; ++i) + { + if (!process.ReadRemoteMemoryIntoBuffer(address - i * BufferLength - 2, ref buffer)) + { + return IntPtr.Zero; + } + + for (var o = BufferLength + 4; o > 0; --o) + { + // Search for two CC in a row. + if (buffer[o] == 0xCC && buffer[o - 1] == 0xCC) + { + var start = address - i * BufferLength + o - 1; + + // Check if the two previous instructions are really a CC. + var prevInstruction = RemoteGetPreviousInstruction(process, start); + if (prevInstruction.Length == 1 && prevInstruction.Data[0] == 0xCC) + { + prevInstruction = RemoteGetPreviousInstruction(process, start - 1); + if (prevInstruction.Length == 1 && prevInstruction.Data[0] == 0xCC) + { + // Disassemble the code from the start and check if the instructions sum up to address. + var totalInstructionLength = RemoteDisassembleCode(process, start, address.Sub(start).ToInt32()) + .Sum(ins => ins.Length); + if (start + totalInstructionLength == address) + { + return start; + } + } + else + { + o -= prevInstruction.Length; + } + } + else + { + o -= prevInstruction.Length; + } + } + } + } + + return IntPtr.Zero; + } + } + + public class DisassembledInstruction + { + public IntPtr Address { get; set; } + public int Length { get; set; } + public byte[] Data { get; set; } + public string Instruction { get; set; } + + public bool IsValid => Length > 0; + + public DisassembledInstruction(ref InstructionData data) + { + Address = data.Address; + Length = data.Length; + Data = data.Data; + Instruction = data.Instruction; + } + + public override string ToString() => $"{Address.ToString(Constants.AddressHexFormat)} - {Instruction}"; + } +} diff --git a/ReClass.NET/Memory/Dumper.cs b/ReClass.NET/Memory/Dumper.cs new file mode 100644 index 00000000..ba434ae0 --- /dev/null +++ b/ReClass.NET/Memory/Dumper.cs @@ -0,0 +1,52 @@ +using System; +using System.Diagnostics.Contracts; +using System.IO; + +namespace ReClassNET.Memory +{ + public static class Dumper + { + /// Dumps a chunk of memory to the given stream. + /// The memory reader to use. + /// The begin of the chunk. + /// The size of the chunk. + /// The stream to dump to. + public static void DumpRaw(IRemoteMemoryReader reader, IntPtr address, int size, Stream stream) + { + Contract.Requires(size >= 0); + Contract.Requires(stream != null); + + var data = reader.ReadRemoteMemory(address, size); + + stream.Write(data, 0, data.Length); + } + + /// Dumps a section to the given stream. + /// The memory reader to use. + /// The section to dump. + /// The stream to dump to. + public static void DumpSection(IRemoteMemoryReader reader, Section section, Stream stream) + { + Contract.Requires(section != null); + Contract.Requires(stream != null); + + DumpRaw(reader, section.Start, section.Size.ToInt32(), stream); + } + + /// Dumps a module to the given stream. The section headers of the pe header get fixed to build a valid pe file. + /// The memory reader to use. + /// The module to dump. + /// The stream to dump to. + public static void DumpModule(IRemoteMemoryReader reader, Module module, Stream stream) + { + Contract.Requires(module != null); + Contract.Requires(stream != null); + + var data = reader.ReadRemoteMemory(module.Start, module.Size.ToInt32()); + + SimplePeHeader.FixSectionHeaders(data); + + stream.Write(data, 0, data.Length); + } + } +} diff --git a/ReClass.NET/Memory/IProcessReader.cs b/ReClass.NET/Memory/IProcessReader.cs new file mode 100644 index 00000000..048bbea7 --- /dev/null +++ b/ReClass.NET/Memory/IProcessReader.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; + +namespace ReClassNET.Memory +{ + public interface IProcessReader : IRemoteMemoryReader + { + Section GetSectionToPointer(IntPtr address); + + Module GetModuleToPointer(IntPtr address); + + Module GetModuleByName(string name); + + bool EnumerateRemoteSectionsAndModules(out List
sections, out List modules); + } +} diff --git a/ReClass.NET/Memory/IRemoteMemoryReader.cs b/ReClass.NET/Memory/IRemoteMemoryReader.cs new file mode 100644 index 00000000..f60a4aaf --- /dev/null +++ b/ReClass.NET/Memory/IRemoteMemoryReader.cs @@ -0,0 +1,33 @@ +using System; +using ReClassNET.Util.Conversion; + +namespace ReClassNET.Memory +{ + public interface IRemoteMemoryReader + { + EndianBitConverter BitConverter { get; set; } + + /// Reads remote memory from the address into the buffer. + /// The address to read from. + /// [out] The data buffer to fill. If the remote process is not valid, the buffer will get filled with zeros. + bool ReadRemoteMemoryIntoBuffer(IntPtr address, ref byte[] buffer); + + /// Reads remote memory from the address into the buffer. + /// The address to read from. + /// [out] The data buffer to fill. If the remote process is not valid, the buffer will get filled with zeros. + /// The offset in the data. + /// The number of bytes to read. + bool ReadRemoteMemoryIntoBuffer(IntPtr address, ref byte[] buffer, int offset, int length); + + /// Reads bytes from the address in the remote process. + /// The address to read from. + /// The size in bytes to read. + /// An array of bytes. + byte[] ReadRemoteMemory(IntPtr address, int size); + + /// Reads remote runtime type information for the given address from the remote process. + /// The address. + /// A string containing the runtime type information or null if no information could get found. + string ReadRemoteRuntimeTypeInformation(IntPtr address); + } +} diff --git a/ReClass.NET/Memory/IRemoteMemoryWriter.cs b/ReClass.NET/Memory/IRemoteMemoryWriter.cs new file mode 100644 index 00000000..fc895b3a --- /dev/null +++ b/ReClass.NET/Memory/IRemoteMemoryWriter.cs @@ -0,0 +1,17 @@ +using System; +using System.Text; +using ReClassNET.Util.Conversion; + +namespace ReClassNET.Memory +{ + public interface IRemoteMemoryWriter + { + EndianBitConverter BitConverter { get; set; } + + /// Writes the given to the in the remote process. + /// The address to write to. + /// The data to write. + /// True if it succeeds, false if it fails. + bool WriteRemoteMemory(IntPtr address, byte[] data); + } +} diff --git a/ReClass.NET/Memory/MemoryBuffer.cs b/ReClass.NET/Memory/MemoryBuffer.cs new file mode 100644 index 00000000..e1b515a4 --- /dev/null +++ b/ReClass.NET/Memory/MemoryBuffer.cs @@ -0,0 +1,370 @@ +using System; +using System.Diagnostics.Contracts; +using System.Text; +using ReClassNET.Extensions; +using ReClassNET.Util.Conversion; + +namespace ReClassNET.Memory +{ + public class MemoryBuffer + { + private byte[] data; + private byte[] historyData; + + private bool hasHistory; + + public byte[] RawData => data; + + public EndianBitConverter BitConverter { get; set; } = EndianBitConverter.System; + + public int Size + { + get => data.Length; + set + { + if (value >= 0 && value != data.Length) + { + data = new byte[value]; + historyData = new byte[value]; + + hasHistory = false; + + ContainsValidData = false; + } + } + } + + public int Offset { get; set; } + + public bool ContainsValidData { get; private set; } + + [ContractInvariantMethod] + private void ObjectInvariants() + { + Contract.Invariant(data != null); + Contract.Invariant(historyData != null); + } + + public MemoryBuffer() + { + Contract.Ensures(data != null); + Contract.Ensures(historyData != null); + + data = Array.Empty(); + historyData = Array.Empty(); + } + + public MemoryBuffer Clone() + { + Contract.Ensures(Contract.Result() != null); + + return new MemoryBuffer + { + data = data, + historyData = historyData, + hasHistory = hasHistory, + + BitConverter = BitConverter, + ContainsValidData = ContainsValidData, + Offset = Offset + }; + } + + public void UpdateFrom(IRemoteMemoryReader reader, IntPtr address) + { + if (reader == null) + { + data.FillWithZero(); + + hasHistory = false; + + return; + } + + Array.Copy(data, historyData, data.Length); + + hasHistory = ContainsValidData; + + BitConverter = reader.BitConverter; + + ContainsValidData = reader.ReadRemoteMemoryIntoBuffer(address, ref data); + if (!ContainsValidData) + { + data.FillWithZero(); + + hasHistory = false; + } + } + + public byte[] ReadBytes(int offset, int length) + { + Contract.Requires(offset >= 0); + Contract.Requires(length >= 0); + + var buffer = new byte[length]; + + ReadBytes(offset, buffer); + + return buffer; + } + + public void ReadBytes(int offset, byte[] buffer) + { + Contract.Requires(offset >= 0); + Contract.Requires(buffer != null); + + offset = Offset + offset; + if (offset + buffer.Length > data.Length) + { + return; + } + + Array.Copy(data, offset, buffer, 0, buffer.Length); + } + + #region Read Primitive Types + + /// Reads a from the specific offset. + /// The offset into the data. + /// The data read as or 0 if the offset is outside the data. + public sbyte ReadInt8(int offset) + { + Contract.Requires(offset >= 0); + + offset = Offset + offset; + if (offset + sizeof(sbyte) > data.Length) + { + return default; + } + + return (sbyte)data[offset]; + } + + /// Reads a from the specific offset. + /// The offset into the data. + /// The data read as or 0 if the offset is outside the data. + public byte ReadUInt8(int offset) + { + Contract.Requires(offset >= 0); + + offset = Offset + offset; + if (offset + sizeof(byte) > data.Length) + { + return default; + } + + return data[offset]; + } + + /// Reads a from the specific offset. + /// The offset into the data. + /// The data read as or 0 if the offset is outside the data. + public short ReadInt16(int offset) + { + Contract.Requires(offset >= 0); + + offset = Offset + offset; + if (offset + sizeof(short) > data.Length) + { + return default; + } + + return BitConverter.ToInt16(data, offset); + } + + /// Reads a from the specific offset. + /// The offset into the data. + /// The data read as or 0 if the offset is outside the data. + public ushort ReadUInt16(int offset) + { + Contract.Requires(offset >= 0); + + offset = Offset + offset; + if (offset + sizeof(ushort) > data.Length) + { + return default; + } + + return BitConverter.ToUInt16(data, offset); + } + + /// Reads a from the specific offset. + /// The offset into the data. + /// The data read as or 0 if the offset is outside the data. + public int ReadInt32(int offset) + { + Contract.Requires(offset >= 0); + + offset = Offset + offset; + if (offset + sizeof(int) > data.Length) + { + return default; + } + + return BitConverter.ToInt32(data, offset); + } + + /// Reads a from the specific offset. + /// The offset into the data. + /// The data read as or 0 if the offset is outside the data. + public uint ReadUInt32(int offset) + { + Contract.Requires(offset >= 0); + + offset = Offset + offset; + if (offset + sizeof(uint) > data.Length) + { + return default; + } + + return BitConverter.ToUInt32(data, offset); + } + + /// Reads a from the specific offset. + /// The offset into the data. + /// The data read as or 0 if the offset is outside the data. + public long ReadInt64(int offset) + { + Contract.Requires(offset >= 0); + + offset = Offset + offset; + if (offset + sizeof(long) > data.Length) + { + return default; + } + + return BitConverter.ToInt64(data, offset); + } + + /// Reads a from the specific offset. + /// The offset into the data. + /// The data read as or 0 if the offset is outside the data. + public ulong ReadUInt64(int offset) + { + Contract.Requires(offset >= 0); + + offset = Offset + offset; + if (offset + sizeof(ulong) > data.Length) + { + return default; + } + + return BitConverter.ToUInt64(data, offset); + } + + /// Reads a from the specific offset. + /// The offset into the data. + /// The data read as or 0 if the offset is outside the data. + public float ReadFloat(int offset) + { + Contract.Requires(offset >= 0); + + offset = Offset + offset; + if (offset + sizeof(float) > data.Length) + { + return default; + } + + return BitConverter.ToSingle(data, offset); + } + + /// Reads a from the specific offset. + /// The offset into the data. + /// The data read as or 0 if the offset is outside the data. + public double ReadDouble(int offset) + { + Contract.Requires(offset >= 0); + + offset = Offset + offset; + if (offset + sizeof(double) > data.Length) + { + return default; + } + + return BitConverter.ToDouble(data, offset); + } + + /// Reads a from the specific offset. + /// The offset into the data. + /// The data read as or 0 if the offset is outside the data. + public IntPtr ReadIntPtr(int offset) + { + Contract.Requires(offset >= 0); + +#if RECLASSNET64 + return (IntPtr)ReadInt64(offset); +#else + return (IntPtr)ReadInt32(offset); +#endif + } + + /// Reads a from the specific offset. + /// The offset into the data. + /// The data read as or 0 if the offset is outside the data. + public UIntPtr ReadUIntPtr(int offset) + { + Contract.Requires(offset >= 0); + +#if RECLASSNET64 + return (UIntPtr)ReadUInt64(offset); +#else + return (UIntPtr)ReadUInt32(offset); +#endif + } + + #endregion + + public string ReadString(Encoding encoding, int offset, int length) + { + Contract.Requires(encoding != null); + Contract.Requires(offset >= 0); + Contract.Requires(length >= 0); + Contract.Ensures(Contract.Result() != null); + + if (Offset + offset + length > data.Length) + { + length = Math.Max(data.Length - Offset - offset, 0); + } + + if (length <= 0) + { + return string.Empty; + } + + var sb = new StringBuilder(encoding.GetString(data, Offset + offset, length)); + for (var i = 0; i < sb.Length; ++i) + { + if (!sb[i].IsPrintable()) + { + sb[i] = '.'; + } + } + return sb.ToString(); + } + + public bool HasChanged(int offset, int length) + { + if (!hasHistory) + { + return false; + } + + if (Offset + offset + length > data.Length) + { + return false; + } + + var end = Offset + offset + length; + + for (var i = Offset + offset; i < end; ++i) + { + if (data[i] != historyData[i]) + { + return true; + } + } + + return false; + } + } +} diff --git a/ReClass.NET/Memory/Module.cs b/ReClass.NET/Memory/Module.cs new file mode 100644 index 00000000..f4e43747 --- /dev/null +++ b/ReClass.NET/Memory/Module.cs @@ -0,0 +1,13 @@ +using System; + +namespace ReClassNET.Memory +{ + public class Module + { + public IntPtr Start { get; set; } + public IntPtr End { get; set; } + public IntPtr Size { get; set; } + public string Name { get; set; } + public string Path { get; set; } + } +} diff --git a/ReClass.NET/Memory/NodeDissector.cs b/ReClass.NET/Memory/NodeDissector.cs new file mode 100644 index 00000000..e03b92e9 --- /dev/null +++ b/ReClass.NET/Memory/NodeDissector.cs @@ -0,0 +1,178 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using ReClassNET.Extensions; +using ReClassNET.Nodes; + +namespace ReClassNET.Memory +{ + public class NodeDissector + { + public static void DissectNodes(IEnumerable nodes, IProcessReader reader, MemoryBuffer memory) + { + Contract.Requires(nodes != null); + Contract.Requires(Contract.ForAll(nodes, n => n != null)); + Contract.Requires(memory != null); + + foreach (var node in nodes) + { + if (GuessNode(node, reader, memory, out var guessedNode)) + { + node.GetParentContainer()?.ReplaceChildNode(node, guessedNode); + } + } + } + + public static bool GuessNode(BaseHexNode node, IProcessReader reader, MemoryBuffer memory, out BaseNode guessedNode) + { + Contract.Requires(node != null); + Contract.Requires(memory != null); + + guessedNode = null; + + var offset = node.Offset; + var is4ByteAligned = offset % 4 == 0; + var is8ByteAligned = offset % 8 == 0; + + // The node is not aligned, skip it. + if (!is4ByteAligned) + { + return false; + } + + var data64 = new UInt64FloatDoubleData + { + Raw1 = memory.ReadInt32(offset), + Raw2 = memory.ReadInt32(offset + sizeof(int)) + }; ; + var data32 = new UInt32FloatData + { + Raw = memory.ReadInt32(offset) + }; + + var raw = memory.ReadBytes(offset, node.MemorySize); + if (raw.InterpretAsSingleByteCharacter().IsLikelyPrintableData()) + { + guessedNode = new Utf8TextNode(); + + return true; + } + if (raw.InterpretAsDoubleByteCharacter().IsLikelyPrintableData()) + { + guessedNode = new Utf16TextNode(); + + return true; + } + +#if RECLASSNET64 + if (is8ByteAligned) + { + if (GuessPointerNode(data64.IntPtr, reader, out guessedNode)) + { + return true; + } + } +#else + if (GuessPointerNode(data32.IntPtr, reader, out guessedNode)) + { + return true; + } +#endif + + // 0 could be anything. + if (data32.IntValue != 0) + { + // If the data represents a reasonable range, it could be a float. + if (-999999.0f <= data32.FloatValue && data32.FloatValue <= 999999.0f && !data32.FloatValue.IsNearlyEqual(0.0f, 0.001f)) + { + guessedNode = new FloatNode(); + + return true; + } + + if (-999999 <= data32.IntValue && data32.IntValue <= 999999) + { + guessedNode = new Int32Node(); + + return true; + } + } + + if (is8ByteAligned) + { + if (data64.LongValue != 0) + { + // If the data represents a reasonable range, it could be a double. + if (-999999.0 <= data64.DoubleValue && data64.DoubleValue <= 999999.0 && !data64.DoubleValue.IsNearlyEqual(0.0, 0.001)) + { + guessedNode = new DoubleNode(); + + return true; + } + } + } + + return false; + } + + private static bool GuessPointerNode(IntPtr address, IProcessReader process, out BaseNode node) + { + Contract.Requires(process != null); + + node = null; + + if (address.IsNull()) + { + return false; + } + + var section = process.GetSectionToPointer(address); + if (section == null) + { + return false; + } + + if (section.Category == SectionCategory.CODE) // If the section contains code, it should be a function pointer. + { + node = new FunctionPtrNode(); + + return true; + } + if (section.Category == SectionCategory.DATA || section.Category == SectionCategory.HEAP) // If the section contains data, it is at least a pointer to a class or something. + { + // Check if it is a vtable. Check if the first 3 values are pointers to a code section. + if (process.GetSectionToPointer(process.ReadRemoteIntPtr(address))?.Category == SectionCategory.CODE + && process.GetSectionToPointer(process.ReadRemoteIntPtr(address + IntPtr.Size))?.Category == SectionCategory.CODE + && process.GetSectionToPointer(process.ReadRemoteIntPtr(address + 2 * IntPtr.Size))?.Category == SectionCategory.CODE) + { + node = new VirtualMethodTableNode(); + + return true; + } + + // Check if it is a string. + var data = process.ReadRemoteMemory(address, IntPtr.Size * 2); + if (data.Take(IntPtr.Size).InterpretAsSingleByteCharacter().IsLikelyPrintableData()) + { + node = new Utf8TextPtrNode(); + + return true; + } + if (data.InterpretAsDoubleByteCharacter().IsLikelyPrintableData()) + { + node = new Utf16TextPtrNode(); + + return true; + } + + // Now it could be a pointer to something else but we can't tell. :( + node = new PointerNode(); + + return true; + } + + return false; + } + } +} diff --git a/ReClass.NET/Memory/ProcessInfo.cs b/ReClass.NET/Memory/ProcessInfo.cs new file mode 100644 index 00000000..b2f8c67e --- /dev/null +++ b/ReClass.NET/Memory/ProcessInfo.cs @@ -0,0 +1,32 @@ +using System; +using System.Diagnostics.Contracts; +using System.Drawing; +using ReClassNET.Native; + +namespace ReClassNET.Memory +{ + public class ProcessInfo + { + public IntPtr Id { get; } + public string Name { get; } + public string Path { get; } + public Image Icon => icon.Value; + + private readonly Lazy icon; + + public ProcessInfo(IntPtr id, string name, string path) + { + Contract.Requires(name != null); + Contract.Requires(path != null); + + Id = id; + Name = name; + Path = path; + icon = new Lazy(() => + { + using var i = NativeMethods.GetIconForFile(Path); + return i?.ToBitmap(); + }); + } + } +} diff --git a/ReClass.NET/Memory/RemoteProcess.cs b/ReClass.NET/Memory/RemoteProcess.cs new file mode 100644 index 00000000..0f994e20 --- /dev/null +++ b/ReClass.NET/Memory/RemoteProcess.cs @@ -0,0 +1,555 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using ReClassNET.AddressParser; +using ReClassNET.Core; +using ReClassNET.Debugger; +using ReClassNET.Extensions; +using ReClassNET.Native; +using ReClassNET.Symbols; +using ReClassNET.Util.Conversion; + +namespace ReClassNET.Memory +{ + public delegate void RemoteProcessEvent(RemoteProcess sender); + + public class RemoteProcess : IDisposable, IRemoteMemoryReader, IRemoteMemoryWriter, IProcessReader + { + private readonly object processSync = new object(); + + private readonly CoreFunctionsManager coreFunctions; + + private readonly RemoteDebugger debugger; + + private readonly Dictionary> formulaCache = new Dictionary>(); + + private readonly Dictionary rttiCache = new Dictionary(); + + private readonly List modules = new List(); + + private readonly List
sections = new List
(); + + private readonly SymbolStore symbols = new SymbolStore(); + + private ProcessInfo process; + private IntPtr handle; + + /// Event which gets invoked when a process was opened. + public event RemoteProcessEvent ProcessAttached; + + /// Event which gets invoked before a process gets closed. + public event RemoteProcessEvent ProcessClosing; + + /// Event which gets invoked after a process was closed. + public event RemoteProcessEvent ProcessClosed; + + public CoreFunctionsManager CoreFunctions => coreFunctions; + + public RemoteDebugger Debugger => debugger; + + public ProcessInfo UnderlayingProcess => process; + + public SymbolStore Symbols => symbols; + + public EndianBitConverter BitConverter { get; set; } = EndianBitConverter.System; + + /// Gets a copy of the current modules list. This list may change if the remote process (un)loads a module. + public IEnumerable Modules + { + get + { + lock (modules) + { + return new List(modules); + } + } + } + + /// Gets a copy of the current sections list. This list may change if the remote process (un)loads a section. + public IEnumerable
Sections + { + get + { + lock (sections) + { + return new List
(sections); + } + } + } + + /// A map of named addresses. + public Dictionary NamedAddresses { get; } = new Dictionary(); + + public bool IsValid => process != null && coreFunctions.IsProcessValid(handle); + + public RemoteProcess(CoreFunctionsManager coreFunctions) + { + Contract.Requires(coreFunctions != null); + + this.coreFunctions = coreFunctions; + + debugger = new RemoteDebugger(this); + } + + public void Dispose() + { + Close(); + } + + /// Opens the given process to gather informations from. + /// The process information. + public void Open(ProcessInfo info) + { + Contract.Requires(info != null); + + if (process != info) + { + lock (processSync) + { + Close(); + + rttiCache.Clear(); + + process = info; + + handle = coreFunctions.OpenRemoteProcess(process.Id, ProcessAccess.Full); + } + + ProcessAttached?.Invoke(this); + } + } + + /// Closes the underlaying process. If the debugger is attached, it will automaticly detached. + public void Close() + { + if (process != null) + { + ProcessClosing?.Invoke(this); + + lock (processSync) + { + debugger.Terminate(); + + coreFunctions.CloseRemoteProcess(handle); + + handle = IntPtr.Zero; + + process = null; + } + + ProcessClosed?.Invoke(this); + } + } + + #region ReadMemory + + public bool ReadRemoteMemoryIntoBuffer(IntPtr address, ref byte[] buffer) + { + Contract.Requires(buffer != null); + Contract.Ensures(Contract.ValueAtReturn(out buffer) != null); + + return ReadRemoteMemoryIntoBuffer(address, ref buffer, 0, buffer.Length); + } + + public bool ReadRemoteMemoryIntoBuffer(IntPtr address, ref byte[] buffer, int offset, int length) + { + Contract.Requires(buffer != null); + Contract.Requires(offset >= 0); + Contract.Requires(length >= 0); + Contract.Requires(offset + length <= buffer.Length); + Contract.Ensures(Contract.ValueAtReturn(out buffer) != null); + Contract.EndContractBlock(); + + if (!IsValid) + { + Close(); + + buffer.FillWithZero(); + + return false; + } + + return coreFunctions.ReadRemoteMemory(handle, address, ref buffer, offset, length); + } + + public byte[] ReadRemoteMemory(IntPtr address, int size) + { + Contract.Requires(size >= 0); + Contract.Ensures(Contract.Result() != null); + + var data = new byte[size]; + ReadRemoteMemoryIntoBuffer(address, ref data); + return data; + } + + public string ReadRemoteRuntimeTypeInformation(IntPtr address) + { + if (address.MayBeValid()) + { + if (!rttiCache.TryGetValue(address, out var rtti)) + { + var objectLocatorPtr = this.ReadRemoteIntPtr(address - IntPtr.Size); + if (objectLocatorPtr.MayBeValid()) + { + +#if RECLASSNET64 + rtti = ReadRemoteRuntimeTypeInformation64(objectLocatorPtr); +#else + rtti = ReadRemoteRuntimeTypeInformation32(objectLocatorPtr); +#endif + + rttiCache[address] = rtti; + } + } + return rtti; + } + + return null; + } + + private string ReadRemoteRuntimeTypeInformation32(IntPtr address) + { + var classHierarchyDescriptorPtr = this.ReadRemoteIntPtr(address + 0x10); + if (classHierarchyDescriptorPtr.MayBeValid()) + { + var baseClassCount = this.ReadRemoteInt32(classHierarchyDescriptorPtr + 8); + if (baseClassCount > 0 && baseClassCount < 25) + { + var baseClassArrayPtr = this.ReadRemoteIntPtr(classHierarchyDescriptorPtr + 0xC); + if (baseClassArrayPtr.MayBeValid()) + { + var sb = new StringBuilder(); + for (var i = 0; i < baseClassCount; ++i) + { + var baseClassDescriptorPtr = this.ReadRemoteIntPtr(baseClassArrayPtr + (4 * i)); + if (baseClassDescriptorPtr.MayBeValid()) + { + var typeDescriptorPtr = this.ReadRemoteIntPtr(baseClassDescriptorPtr); + if (typeDescriptorPtr.MayBeValid()) + { + var name = this.ReadRemoteStringUntilFirstNullCharacter(typeDescriptorPtr + 0x0C, Encoding.UTF8, 60); + if (name.EndsWith("@@")) + { + name = NativeMethods.UndecorateSymbolName("?" + name); + } + + sb.Append(name); + sb.Append(" : "); + + continue; + } + } + + break; + } + + if (sb.Length != 0) + { + sb.Length -= 3; + + return sb.ToString(); + } + } + } + } + + return null; + } + + private string ReadRemoteRuntimeTypeInformation64(IntPtr address) + { + int baseOffset = this.ReadRemoteInt32(address + 0x14); + if (baseOffset != 0) + { + var baseAddress = address - baseOffset; + + var classHierarchyDescriptorOffset = this.ReadRemoteInt32(address + 0x10); + if (classHierarchyDescriptorOffset != 0) + { + var classHierarchyDescriptorPtr = baseAddress + classHierarchyDescriptorOffset; + + var baseClassCount = this.ReadRemoteInt32(classHierarchyDescriptorPtr + 0x08); + if (baseClassCount > 0 && baseClassCount < 25) + { + var baseClassArrayOffset = this.ReadRemoteInt32(classHierarchyDescriptorPtr + 0x0C); + if (baseClassArrayOffset != 0) + { + var baseClassArrayPtr = baseAddress + baseClassArrayOffset; + + var sb = new StringBuilder(); + for (var i = 0; i < baseClassCount; ++i) + { + var baseClassDescriptorOffset = this.ReadRemoteInt32(baseClassArrayPtr + (4 * i)); + if (baseClassDescriptorOffset != 0) + { + var baseClassDescriptorPtr = baseAddress + baseClassDescriptorOffset; + + var typeDescriptorOffset = this.ReadRemoteInt32(baseClassDescriptorPtr); + if (typeDescriptorOffset != 0) + { + var typeDescriptorPtr = baseAddress + typeDescriptorOffset; + + var name = this.ReadRemoteStringUntilFirstNullCharacter(typeDescriptorPtr + 0x14, Encoding.UTF8, 60); + if (string.IsNullOrEmpty(name)) + { + break; + } + + if (name.EndsWith("@@")) + { + name = NativeMethods.UndecorateSymbolName("?" + name); + } + + sb.Append(name); + sb.Append(" : "); + + continue; + } + } + + break; + } + + if (sb.Length != 0) + { + sb.Length -= 3; + + return sb.ToString(); + } + } + } + } + } + + return null; + } + + #endregion + + #region WriteMemory + + public bool WriteRemoteMemory(IntPtr address, byte[] data) + { + Contract.Requires(data != null); + + if (!IsValid) + { + return false; + } + + return coreFunctions.WriteRemoteMemory(handle, address, ref data, 0, data.Length); + } + + #endregion + + public Section GetSectionToPointer(IntPtr address) + { + lock (sections) + { + var index = sections.BinarySearch(s => address.CompareToRange(s.Start, s.End)); + return index < 0 ? null : sections[index]; + } + } + + public Module GetModuleToPointer(IntPtr address) + { + lock (modules) + { + var index = modules.BinarySearch(m => address.CompareToRange(m.Start, m.End)); + return index < 0 ? null : modules[index]; + } + } + + public Module GetModuleByName(string name) + { + lock (modules) + { + return modules + .FirstOrDefault(m => m.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); + } + } + + /// Tries to map the given address to a section or a module of the process. + /// The address to map. + /// The named address or null if no mapping exists. + public string GetNamedAddress(IntPtr address) + { + if (NamedAddresses.TryGetValue(address, out var namedAddress)) + { + return namedAddress; + } + + var section = GetSectionToPointer(address); + if (section != null) + { + if (section.Category == SectionCategory.CODE || section.Category == SectionCategory.DATA) + { + // Code and Data sections belong to a module. + return $"<{section.Category}>{section.ModuleName}.{address.ToString("X")}"; + } + if (section.Category == SectionCategory.HEAP) + { + return $"{address.ToString("X")}"; + } + } + var module = GetModuleToPointer(address); + if (module != null) + { + return $"{module.Name}.{address.ToString("X")}"; + } + return null; + } + + public bool EnumerateRemoteSectionsAndModules(out List
_sections, out List _modules) + { + if (!IsValid) + { + _sections = null; + _modules = null; + + return false; + } + + _sections = new List
(); + _modules = new List(); + + coreFunctions.EnumerateRemoteSectionsAndModules(handle, _sections.Add, _modules.Add); + + return true; + } + + /// Updates the process informations. + public void UpdateProcessInformations() + { + UpdateProcessInformationsAsync().Wait(); + } + + /// Updates the process informations asynchronous. + /// The Task. + public Task UpdateProcessInformationsAsync() + { + Contract.Ensures(Contract.Result() != null); + + if (!IsValid) + { + lock (modules) + { + modules.Clear(); + } + lock (sections) + { + sections.Clear(); + } + + // TODO: Mono doesn't support Task.CompletedTask at the moment. + //return Task.CompletedTask; + return Task.FromResult(true); + } + + return Task.Run(() => + { + EnumerateRemoteSectionsAndModules(out var newSections, out var newModules); + + newModules.Sort((m1, m2) => m1.Start.CompareTo(m2.Start)); + newSections.Sort((s1, s2) => s1.Start.CompareTo(s2.Start)); + + lock (modules) + { + modules.Clear(); + modules.AddRange(newModules); + } + lock (sections) + { + sections.Clear(); + sections.AddRange(newSections); + } + }); + } + + /// Parse the address formula. + /// The address formula. + /// The result of the parsed address or . + public IntPtr ParseAddress(string addressFormula) + { + Contract.Requires(addressFormula != null); + + if (!formulaCache.TryGetValue(addressFormula, out var func)) + { + var expression = Parser.Parse(addressFormula); + + func = DynamicCompiler.CompileExpression(expression); + + formulaCache.Add(addressFormula, func); + } + + return func(this); + } + + /// Loads all symbols asynchronous. + /// The progress reporter is called for every module. Can be null. + /// The token used to cancel the task. + /// The task. + public Task LoadAllSymbolsAsync(IProgress>> progress, CancellationToken token) + { + List copy; + lock (modules) + { + copy = modules.ToList(); + } + + // Try to resolve all symbols in a background thread. This can take a long time because symbols are downloaded from the internet. + // The COM objects can only be used in the thread they were created so we can't use them. + // Thats why an other task loads the real symbols afterwards in the UI thread context. + return Task.Run( + () => + { + foreach (var module in copy) + { + token.ThrowIfCancellationRequested(); + + progress?.Report(Tuple.Create>(module, copy)); + + Symbols.TryResolveSymbolsForModule(module); + } + }, + token + ) + .ContinueWith( + _ => + { + foreach (var module in copy) + { + token.ThrowIfCancellationRequested(); + + try + { + Symbols.LoadSymbolsForModule(module); + } + catch + { + //ignore + } + } + }, + token, + TaskContinuationOptions.None, + TaskScheduler.FromCurrentSynchronizationContext() + ); + } + + public void ControlRemoteProcess(ControlRemoteProcessAction action) + { + if (!IsValid) + { + return; + } + + coreFunctions.ControlRemoteProcess(handle, action); + } + } +} diff --git a/ReClass.NET/Memory/Section.cs b/ReClass.NET/Memory/Section.cs new file mode 100644 index 00000000..8e1e30a4 --- /dev/null +++ b/ReClass.NET/Memory/Section.cs @@ -0,0 +1,47 @@ +using System; + +namespace ReClassNET.Memory +{ + public enum SectionCategory + { + Unknown, + CODE, + DATA, + HEAP + } + + [Flags] + public enum SectionProtection + { + NoAccess = 0, + + Read = 1, + Write = 2, + CopyOnWrite = 4, + Execute = 8, + + Guard = 16 + } + + public enum SectionType + { + Unknown, + + Private, + Mapped, + Image + } + + public class Section + { + public IntPtr Start { get; set; } + public IntPtr End { get; set; } + public IntPtr Size { get; set; } + public string Name { get; set; } + public SectionCategory Category { get; set; } + public SectionProtection Protection { get; set; } + public SectionType Type { get; set; } + public string ModuleName { get; set; } + public string ModulePath { get; set; } + } +} diff --git a/ReClass.NET/Memory/SimplePeHeader.cs b/ReClass.NET/Memory/SimplePeHeader.cs new file mode 100644 index 00000000..89f0e804 --- /dev/null +++ b/ReClass.NET/Memory/SimplePeHeader.cs @@ -0,0 +1,46 @@ +using System; +using System.IO; + +namespace ReClassNET.Memory +{ + public class SimplePeHeader + { + private readonly byte[] data; + + private int e_lfanew => BitConverter.ToInt32(data, 60); + + private int FileHeader => e_lfanew + 4; + + public int NumberOfSections => BitConverter.ToInt16(data, FileHeader + 2); + + private int SizeOfOptionalHeader => BitConverter.ToInt16(data, FileHeader + 16); + + private int FirstSectionOffset => e_lfanew + 24 + SizeOfOptionalHeader; + + public int SectionOffset(int index) => FirstSectionOffset + index * 40; + + private SimplePeHeader(byte[] data) + { + this.data = data; + } + + /// + /// Rewrites the section headers to build a valid pe file. + /// + /// The memory of a dumped module. + public static void FixSectionHeaders(byte[] data) + { + var pe = new SimplePeHeader(data); + + using var ms = new MemoryStream(data); + using var bw = new BinaryWriter(ms); + for (var i = 0; i < pe.NumberOfSections; ++i) + { + var offset = pe.SectionOffset(i); + bw.Seek(offset + 16, SeekOrigin.Begin); + bw.Write(BitConverter.ToUInt32(data, offset + 8)); // SizeOfRawData = VirtualSize + bw.Write(BitConverter.ToUInt32(data, offset + 12)); // PointerToRawData = VirtualAddress + } + } + } +} diff --git a/Memory/UnionDataType.cs b/ReClass.NET/Memory/UnionDataType.cs similarity index 68% rename from Memory/UnionDataType.cs rename to ReClass.NET/Memory/UnionDataType.cs index f8dd6bf8..0cea977a 100644 --- a/Memory/UnionDataType.cs +++ b/ReClass.NET/Memory/UnionDataType.cs @@ -1,10 +1,10 @@ -using System; +using System; using System.Runtime.InteropServices; namespace ReClassNET.Memory { [StructLayout(LayoutKind.Explicit)] - struct UInt8Data + public struct UInt8Data { [FieldOffset(0)] public sbyte SByteValue; @@ -14,7 +14,7 @@ struct UInt8Data } [StructLayout(LayoutKind.Explicit)] - struct UInt16Data + public struct UInt16Data { [FieldOffset(0)] public short ShortValue; @@ -24,43 +24,52 @@ struct UInt16Data } [StructLayout(LayoutKind.Explicit)] - struct UInt32FloatData + public struct UInt32FloatData { + [FieldOffset(0)] + public int Raw; + [FieldOffset(0)] public int IntValue; - public IntPtr IntPtr => unchecked((IntPtr)IntValue); + public IntPtr IntPtr => (IntPtr)IntValue; [FieldOffset(0)] public uint UIntValue; - public UIntPtr UIntPtr => unchecked((UIntPtr)UIntValue); + public UIntPtr UIntPtr => (UIntPtr)UIntValue; [FieldOffset(0)] public float FloatValue; } [StructLayout(LayoutKind.Explicit)] - struct UInt64FloatDoubleData + public struct UInt64FloatDoubleData { + [FieldOffset(0)] + public int Raw1; + + [FieldOffset(4)] + public int Raw2; + [FieldOffset(0)] public long LongValue; public IntPtr IntPtr => -#if WIN32 - unchecked((IntPtr)(int)LongValue); +#if RECLASSNET64 + (IntPtr)LongValue; #else - unchecked((IntPtr)LongValue); + unchecked((IntPtr)(int)LongValue); #endif [FieldOffset(0)] public ulong ULongValue; public UIntPtr UIntPtr => -#if WIN32 - unchecked((UIntPtr)(uint)ULongValue); +#if RECLASSNET64 + (UIntPtr)ULongValue; #else - unchecked((UIntPtr)ULongValue); + unchecked((UIntPtr)(uint)ULongValue); #endif [FieldOffset(0)] diff --git a/ReClass.NET/MemoryScanner/BytePattern.cs b/ReClass.NET/MemoryScanner/BytePattern.cs new file mode 100644 index 00000000..3bbca9ed --- /dev/null +++ b/ReClass.NET/MemoryScanner/BytePattern.cs @@ -0,0 +1,345 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.IO; +using System.Linq; +using System.Text; +using ReClassNET.Extensions; + +namespace ReClassNET.MemoryScanner +{ + public enum PatternMaskFormat + { + /// + /// Example: AA BB ?? D? ?E FF + /// + Combined, + /// + /// Example: \xAA\xBB\x00\x00\x00\xFF xx???x + /// + Separated + } + + public class BytePattern + { + private interface IPatternByte + { + /// + /// Gets the byte value of the pattern byte if possible. + /// + /// + byte ToByte(); + + /// + /// Compares the pattern byte with the given byte. + /// + /// + /// + bool Equals(byte b); + + /// + /// Formats the pattern byte as string. + /// + /// + /// + Tuple ToString(PatternMaskFormat format); + } + + private class PatternByte : IPatternByte + { + private struct Nibble + { + public int Value; + public bool IsWildcard; + } + + private Nibble nibble1; + private Nibble nibble2; + + public bool HasWildcard => nibble1.IsWildcard || nibble2.IsWildcard; + + public byte ToByte() => !HasWildcard ? (byte)((nibble1.Value << 4) + nibble2.Value) : throw new InvalidOperationException(); + + public static PatternByte NewWildcardByte() + { + var pb = new PatternByte + { + nibble1 = { IsWildcard = true }, + nibble2 = { IsWildcard = true } + }; + return pb; + } + + private static bool IsHexValue(char c) + { + return '0' <= c && c <= '9' + || 'A' <= c && c <= 'F' + || 'a' <= c && c <= 'f'; + } + + private static int HexToInt(char c) + { + if ('0' <= c && c <= '9') return c - '0'; + if ('A' <= c && c <= 'F') return c - 'A' + 10; + return c - 'a' + 10; + } + + public bool TryRead(StringReader sr) + { + Contract.Requires(sr != null); + + var temp = sr.ReadSkipWhitespaces(); + if (temp == -1 || !IsHexValue((char)temp) && (char)temp != '?') + { + return false; + } + + nibble1.Value = HexToInt((char)temp) & 0xF; + nibble1.IsWildcard = (char)temp == '?'; + + temp = sr.Read(); + if (temp == -1 || char.IsWhiteSpace((char)temp) || (char)temp == '?') + { + nibble2.IsWildcard = true; + + return true; + } + + if (!IsHexValue((char)temp)) + { + return false; + } + nibble2.Value = HexToInt((char)temp) & 0xF; + nibble2.IsWildcard = false; + + return true; + } + + public bool Equals(byte b) + { + if (nibble1.IsWildcard || ((b >> 4) & 0xF) == nibble1.Value) + { + if (nibble2.IsWildcard || (b & 0xF) == nibble2.Value) + { + return true; + } + } + + return false; + } + + public Tuple ToString(PatternMaskFormat format) + { + switch (format) + { + case PatternMaskFormat.Separated: + return HasWildcard ? Tuple.Create("\\x00", "?") : Tuple.Create($"\\x{ToByte():X02}", "x"); + case PatternMaskFormat.Combined: + var sb = new StringBuilder(); + if (nibble1.IsWildcard) sb.Append('?'); + else sb.AppendFormat("{0:X}", nibble1.Value); + if (nibble2.IsWildcard) sb.Append('?'); + else sb.AppendFormat("{0:X}", nibble2.Value); + return Tuple.Create(sb.ToString(), (string)null); + default: + throw new ArgumentOutOfRangeException(nameof(format), format, null); + } + } + + public override string ToString() => ToString(PatternMaskFormat.Combined).Item1; + } + + private class SimplePatternByte : IPatternByte + { + private readonly byte value; + + public SimplePatternByte(byte value) + { + this.value = value; + } + + public byte ToByte() => value; + + public bool Equals(byte b) => value == b; + + public Tuple ToString(PatternMaskFormat format) + { + switch (format) + { + case PatternMaskFormat.Separated: + return Tuple.Create($"\\x{ToByte():X02}", "x"); + case PatternMaskFormat.Combined: + return Tuple.Create($"{ToByte():X02}", (string)null); + default: + throw new ArgumentOutOfRangeException(nameof(format), format, null); + } + } + } + + private readonly List pattern = new List(); + + /// + /// Gets the length of the pattern in byte. + /// + public int Length => pattern.Count; + + /// + /// Gets if the pattern contains wildcards. + /// + public bool HasWildcards => pattern.Any(pb => pb is PatternByte pb2 && pb2.HasWildcard); + + private BytePattern() + { + + } + + /// + /// Parses the provided string for a byte pattern. Wildcards are supported by nibble. + /// + /// + /// Valid patterns: + /// AA BB CC DD + /// AABBCCDD + /// aabb CCdd + /// A? ?B ?? DD + /// + /// Thrown if the provided string doesn't contain a valid byte pattern. + /// The byte pattern in hex format. + /// The corresponding . + public static BytePattern Parse(string value) + { + Contract.Requires(!string.IsNullOrEmpty(value)); + Contract.Ensures(Contract.Result() != null); + + var pattern = new BytePattern(); + + using var sr = new StringReader(value); + while (true) + { + var pb = new PatternByte(); + if (pb.TryRead(sr)) + { + if (!pb.HasWildcard) + { + pattern.pattern.Add(new SimplePatternByte(pb.ToByte())); + } + else + { + pattern.pattern.Add(pb); + } + } + else + { + break; + } + } + + // Check if we are not at the end of the stream + if (sr.Peek() != -1) + { + throw new ArgumentException($"'{value}' is not a valid byte pattern."); + } + + return pattern; + } + + /// + /// Creates a byte pattern from the provided bytes. + /// + /// The bytes to match. + /// + public static BytePattern From(IEnumerable data) + { + var pattern = new BytePattern(); + pattern.pattern.AddRange(data.Select(b => new SimplePatternByte(b))); + return pattern; + } + + /// + /// Creates a byte pattern with wildcard support from the provided bytes. The boolean tuple item signals a wildcard. + /// + /// The byte data or the wildcard flag. + /// + public static BytePattern From(IEnumerable> data) + { + var pattern = new BytePattern(); + + foreach (var (value, isWildcard) in data) + { + var pb = isWildcard ? (IPatternByte)PatternByte.NewWildcardByte() : new SimplePatternByte(value); + + pattern.pattern.Add(pb); + } + + return pattern; + } + + /// + /// Tests if the provided byte array matches the byte pattern at the provided index. + /// + /// The byte array to be compared. + /// The index into the byte array. + /// True if the pattern matches, false if they are not. + public bool Equals(byte[] data, int index) + { + Contract.Requires(data != null); + + for (var j = 0; j < pattern.Count; ++j) + { + if (!pattern[j].Equals(data[index + j])) + { + return false; + } + } + + return true; + } + + /// + /// Converts this to a byte array. + /// + /// Thrown if the pattern contains wildcards. + /// The bytes of the pattern. + /// + public byte[] ToByteArray() + { + Contract.Ensures(Contract.Result() != null); + + if (HasWildcards) + { + throw new InvalidOperationException(); + } + + return pattern.Select(pb => pb.ToByte()).ToArray(); + } + + /// + /// Formats the in the specified . + /// + /// The format of the pattern. + /// A tuple containing the format. If is not the second item is null. + public Tuple ToString(PatternMaskFormat format) + { + switch (format) + { + case PatternMaskFormat.Separated: + var sb1 = new StringBuilder(); + var sb2 = new StringBuilder(); + pattern + .Select(p => p.ToString(PatternMaskFormat.Separated)) + .ForEach(t => + { + sb1.Append(t.Item1); + sb2.Append(t.Item2); + }); + return Tuple.Create(sb1.ToString(), sb2.ToString()); + case PatternMaskFormat.Combined: + return Tuple.Create(string.Join(" ", pattern.Select(p => p.ToString(PatternMaskFormat.Combined).Item1)), null); + default: + throw new ArgumentOutOfRangeException(nameof(format), format, null); + } + } + + public override string ToString() => ToString(PatternMaskFormat.Combined).Item1; + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/ArrayOfBytesMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/ArrayOfBytesMemoryComparer.cs new file mode 100644 index 00000000..3e377f25 --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/ArrayOfBytesMemoryComparer.cs @@ -0,0 +1,69 @@ +using System; +using System.Diagnostics; +using System.Diagnostics.Contracts; + +namespace ReClassNET.MemoryScanner.Comparer +{ + public class ArrayOfBytesMemoryComparer : ISimpleScanComparer + { + public ScanCompareType CompareType => ScanCompareType.Equal; + public int ValueSize => bytePattern?.Length ?? byteArray.Length; + + private readonly BytePattern bytePattern; + private readonly byte[] byteArray; + + public ArrayOfBytesMemoryComparer(BytePattern pattern) + { + Contract.Requires(pattern != null); + + bytePattern = pattern; + + if (!bytePattern.HasWildcards) + { + byteArray = bytePattern.ToByteArray(); + } + } + + public ArrayOfBytesMemoryComparer(byte[] pattern) + { + Contract.Requires(pattern != null); + + byteArray = pattern; + } + + public bool Compare(byte[] data, int index, out ScanResult result) + { + result = null; + + if (byteArray != null) + { + for (var i = 0; i < byteArray.Length; ++i) + { + if (data[index + i] != byteArray[i]) + { + return false; + } + } + } + else if (!bytePattern.Equals(data, index)) + { + return false; + } + + var temp = new byte[ValueSize]; + Array.Copy(data, index, temp, 0, temp.Length); + result = new ArrayOfBytesScanResult(temp); + + return true; + } + + public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) + { +#if DEBUG + Debug.Assert(previous is ArrayOfBytesScanResult); +#endif + + return Compare(data, index, out result); + } + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/ByteMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/ByteMemoryComparer.cs new file mode 100644 index 00000000..10efe5cc --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/ByteMemoryComparer.cs @@ -0,0 +1,108 @@ +using System; +using System.Diagnostics; + +namespace ReClassNET.MemoryScanner.Comparer +{ + public class ByteMemoryComparer : ISimpleScanComparer + { + public ScanCompareType CompareType { get; } + public byte Value1 { get; } + public byte Value2 { get; } + public int ValueSize => sizeof(byte); + + public ByteMemoryComparer(ScanCompareType compareType, byte value1, byte value2) + { + CompareType = compareType; + + Value1 = value1; + Value2 = value2; + } + + public bool Compare(byte[] data, int index, out ScanResult result) + { + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Unknown => true, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } + + public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) + { +#if DEBUG + Debug.Assert(previous is ByteScanResult); +#endif + + return Compare(data, index, (ByteScanResult)previous, out result); + } + + public bool Compare(byte[] data, int index, ByteScanResult previous, out ScanResult result) + { + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Changed => value != previous.Value, + ScanCompareType.NotChanged => value == previous.Value, + ScanCompareType.Increased => value > previous.Value, + ScanCompareType.IncreasedOrEqual => value >= previous.Value, + ScanCompareType.Decreased => value < previous.Value, + ScanCompareType.DecreasedOrEqual => value <= previous.Value, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } + + private static bool CompareInternal(byte[] data, int index, Func matcher, out ScanResult result) + { + result = null; + + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + if ((uint)index >= data.Length) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + if (index > data.Length - 1) + { + throw new ArgumentException(); + } + + var value = data[index]; + + if (!matcher(value)) + { + return false; + } + + result = new ByteScanResult(value); + + return true; + } + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/DoubleMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/DoubleMemoryComparer.cs new file mode 100644 index 00000000..5e866608 --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/DoubleMemoryComparer.cs @@ -0,0 +1,122 @@ +using System; +using System.Diagnostics; +using ReClassNET.Extensions; +using ReClassNET.Util.Conversion; + +namespace ReClassNET.MemoryScanner.Comparer +{ + public class DoubleMemoryComparer : ISimpleScanComparer + { + public ScanCompareType CompareType { get; } + public ScanRoundMode RoundType { get; } + public double Value1 { get; } + public double Value2 { get; } + public int ValueSize => sizeof(double); + + private readonly int significantDigits; + private readonly double minValue; + private readonly double maxValue; + + private readonly EndianBitConverter bitConverter; + + public DoubleMemoryComparer(ScanCompareType compareType, ScanRoundMode roundType, int significantDigits, double value1, double value2, EndianBitConverter bitConverter) + { + CompareType = compareType; + + RoundType = roundType; + this.significantDigits = Math.Max(significantDigits, 1); + Value1 = Math.Round(value1, this.significantDigits, MidpointRounding.AwayFromZero); + Value2 = Math.Round(value2, this.significantDigits, MidpointRounding.AwayFromZero); + + var factor = (int)Math.Pow(10.0, this.significantDigits); + + minValue = value1 - 1.0 / factor; + maxValue = value1 + 1.0 / factor; + + this.bitConverter = bitConverter; + } + + private bool CheckRoundedEquality(double value) => + RoundType switch + { + ScanRoundMode.Strict => Value1.IsNearlyEqual(Math.Round(value, significantDigits, MidpointRounding.AwayFromZero), 0.0001), + ScanRoundMode.Normal => minValue < value && value < maxValue, + ScanRoundMode.Truncate => (long)value == (long)Value1, + _ => throw new ArgumentOutOfRangeException() + }; + + public bool Compare(byte[] data, int index, out ScanResult result) + { + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => CheckRoundedEquality(value), + ScanCompareType.NotEqual => !CheckRoundedEquality(value), + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Unknown => true, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } + + public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) + { +#if DEBUG + Debug.Assert(previous is DoubleScanResult); +#endif + + return Compare(data, index, (DoubleScanResult)previous, out result); + } + + public bool Compare(byte[] data, int index, DoubleScanResult previous, out ScanResult result) + { + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => CheckRoundedEquality(value), + ScanCompareType.NotEqual => !CheckRoundedEquality(value), + ScanCompareType.Changed => value != previous.Value, + ScanCompareType.NotChanged => value == previous.Value, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.Increased => value > previous.Value, + ScanCompareType.IncreasedOrEqual => value >= previous.Value, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Decreased => value < previous.Value, + ScanCompareType.DecreasedOrEqual => value <= previous.Value, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } + + private bool CompareInternal(byte[] data, int index, Func matcher, out ScanResult result) + { + result = null; + + var value = bitConverter.ToDouble(data, index); + + if (!matcher(value)) + { + return false; + } + + result = new DoubleScanResult(value); + + return true; + } + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/FloatMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/FloatMemoryComparer.cs new file mode 100644 index 00000000..60a3acdf --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/FloatMemoryComparer.cs @@ -0,0 +1,122 @@ +using System; +using System.Diagnostics; +using ReClassNET.Extensions; +using ReClassNET.Util.Conversion; + +namespace ReClassNET.MemoryScanner.Comparer +{ + public class FloatMemoryComparer : ISimpleScanComparer + { + public ScanCompareType CompareType { get; } + public ScanRoundMode RoundType { get; } + public float Value1 { get; } + public float Value2 { get; } + public int ValueSize => sizeof(float); + + private readonly int significantDigits; + private readonly float minValue; + private readonly float maxValue; + + private readonly EndianBitConverter bitConverter; + + public FloatMemoryComparer(ScanCompareType compareType, ScanRoundMode roundType, int significantDigits, float value1, float value2, EndianBitConverter bitConverter) + { + CompareType = compareType; + + RoundType = roundType; + this.significantDigits = Math.Max(significantDigits, 1); + Value1 = (float)Math.Round(value1, this.significantDigits, MidpointRounding.AwayFromZero); + Value2 = (float)Math.Round(value2, this.significantDigits, MidpointRounding.AwayFromZero); + + var factor = (int)Math.Pow(10.0, this.significantDigits); + + minValue = value1 - 1.0f / factor; + maxValue = value1 + 1.0f / factor; + + this.bitConverter = bitConverter; + } + + private bool CheckRoundedEquality(float value) => + RoundType switch + { + ScanRoundMode.Strict => Value1.IsNearlyEqual((float)Math.Round(value, significantDigits, MidpointRounding.AwayFromZero), 0.0001f), + ScanRoundMode.Normal => minValue < value && value < maxValue, + ScanRoundMode.Truncate => (int)value == (int)Value1, + _ => throw new ArgumentOutOfRangeException() + }; + + public bool Compare(byte[] data, int index, out ScanResult result) + { + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => CheckRoundedEquality(value), + ScanCompareType.NotEqual => !CheckRoundedEquality(value), + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Unknown => true, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } + + public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) + { +#if DEBUG + Debug.Assert(previous is FloatScanResult); +#endif + + return Compare(data, index, (FloatScanResult)previous, out result); + } + + public bool Compare(byte[] data, int index, FloatScanResult previous, out ScanResult result) + { + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => CheckRoundedEquality(value), + ScanCompareType.NotEqual => !CheckRoundedEquality(value), + ScanCompareType.Changed => value != previous.Value, + ScanCompareType.NotChanged => value == previous.Value, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.Increased => value > previous.Value, + ScanCompareType.IncreasedOrEqual => value >= previous.Value, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Decreased => value < previous.Value, + ScanCompareType.DecreasedOrEqual => value <= previous.Value, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } + + private bool CompareInternal(byte[] data, int index, Func matcher, out ScanResult result) + { + result = null; + + var value = bitConverter.ToSingle(data, index); + + if (!matcher(value)) + { + return false; + } + + result = new FloatScanResult(value); + + return true; + } + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/IComplexScanComparer.cs b/ReClass.NET/MemoryScanner/Comparer/IComplexScanComparer.cs new file mode 100644 index 00000000..55e1cd8e --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/IComplexScanComparer.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace ReClassNET.MemoryScanner.Comparer +{ + public interface IComplexScanComparer : IScanComparer + { + /// + /// Compares all data to the current . + /// + /// The byte array to be compared. + /// The index into the byte array. + /// List of matches. + IEnumerable Compare(byte[] data, int size); + + /// + /// Compares all data to the current . + /// The previous results may be used. + /// + /// The byte array to be compared. + /// The index into the byte array. + /// Scan result to be compared. + /// [out] The scan result if the matched. + /// True if matched. + bool CompareWithPrevious(byte[] data, int size, ScanResult previous, out ScanResult result); + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/IScanComparer.cs b/ReClass.NET/MemoryScanner/Comparer/IScanComparer.cs new file mode 100644 index 00000000..4f3c2e4f --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/IScanComparer.cs @@ -0,0 +1,7 @@ +namespace ReClassNET.MemoryScanner.Comparer +{ + public interface IScanComparer + { + ScanCompareType CompareType { get; } + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/ISimpleScanComparer.cs b/ReClass.NET/MemoryScanner/Comparer/ISimpleScanComparer.cs new file mode 100644 index 00000000..a54b2f70 --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/ISimpleScanComparer.cs @@ -0,0 +1,27 @@ +namespace ReClassNET.MemoryScanner.Comparer +{ + public interface ISimpleScanComparer : IScanComparer + { + int ValueSize { get; } + + /// + /// Compares the data at the provided index to the current . + /// + /// The byte array to be compared. + /// The index into the byte array. + /// [out] The scan result if the matched. + /// True if matched. + bool Compare(byte[] data, int index, out ScanResult result); + + /// + /// Compares the data at the provided index to the current . + /// The previous results may be used. + /// + /// The byte array to be compared. + /// The index into the byte array. + /// Scan result to be compared. + /// [out] The scan result if the matched. + /// True if matched. + bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result); + } +} \ No newline at end of file diff --git a/ReClass.NET/MemoryScanner/Comparer/IntegerMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/IntegerMemoryComparer.cs new file mode 100644 index 00000000..44b372af --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/IntegerMemoryComparer.cs @@ -0,0 +1,100 @@ +using System; +using System.Diagnostics; +using ReClassNET.Util.Conversion; + +namespace ReClassNET.MemoryScanner.Comparer +{ + public class IntegerMemoryComparer : ISimpleScanComparer + { + public ScanCompareType CompareType { get; } + public int Value1 { get; } + public int Value2 { get; } + public int ValueSize => sizeof(int); + + private readonly EndianBitConverter bitConverter; + + public IntegerMemoryComparer(ScanCompareType compareType, int value1, int value2, EndianBitConverter bitConverter) + { + CompareType = compareType; + + Value1 = value1; + Value2 = value2; + + this.bitConverter = bitConverter; + } + + public bool Compare(byte[] data, int index, out ScanResult result) + { + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Unknown => true, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } + + public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) + { +#if DEBUG + Debug.Assert(previous is IntegerScanResult); +#endif + + return Compare(data, index, (IntegerScanResult)previous, out result); + } + + public bool Compare(byte[] data, int index, IntegerScanResult previous, out ScanResult result) + { + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Changed => value != previous.Value, + ScanCompareType.NotChanged => value == previous.Value, + ScanCompareType.Increased => value > previous.Value, + ScanCompareType.IncreasedOrEqual => value >= previous.Value, + ScanCompareType.Decreased => value < previous.Value, + ScanCompareType.DecreasedOrEqual => value <= previous.Value, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } + + private bool CompareInternal(byte[] data, int index, Func matcher, out ScanResult result) + { + result = null; + + var value = bitConverter.ToInt32(data, index); + + if (!matcher(value)) + { + return false; + } + + result = new IntegerScanResult(value); + + return true; + } + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/InvalidCompareTypeException.cs b/ReClass.NET/MemoryScanner/Comparer/InvalidCompareTypeException.cs new file mode 100644 index 00000000..2bf6ce91 --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/InvalidCompareTypeException.cs @@ -0,0 +1,13 @@ +using System; + +namespace ReClassNET.MemoryScanner.Comparer +{ + public class InvalidCompareTypeException : Exception + { + public InvalidCompareTypeException(ScanCompareType type) + : base($"{type} is not valid in the current state.") + { + + } + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/LongMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/LongMemoryComparer.cs new file mode 100644 index 00000000..f95051ad --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/LongMemoryComparer.cs @@ -0,0 +1,100 @@ +using System; +using System.Diagnostics; +using ReClassNET.Util.Conversion; + +namespace ReClassNET.MemoryScanner.Comparer +{ + public class LongMemoryComparer : ISimpleScanComparer + { + public ScanCompareType CompareType { get; } + public long Value1 { get; } + public long Value2 { get; } + public int ValueSize => sizeof(long); + + private readonly EndianBitConverter bitConverter; + + public LongMemoryComparer(ScanCompareType compareType, long value1, long value2, EndianBitConverter bitConverter) + { + CompareType = compareType; + + Value1 = value1; + Value2 = value2; + + this.bitConverter = bitConverter; + } + + public bool Compare(byte[] data, int index, out ScanResult result) + { + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Unknown => true, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } + + public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) + { +#if DEBUG + Debug.Assert(previous is LongScanResult); +#endif + + return Compare(data, index, (LongScanResult)previous, out result); + } + + public bool Compare(byte[] data, int index, LongScanResult previous, out ScanResult result) + { + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Changed => value != previous.Value, + ScanCompareType.NotChanged => value == previous.Value, + ScanCompareType.Increased => value > previous.Value, + ScanCompareType.IncreasedOrEqual => value >= previous.Value, + ScanCompareType.Decreased => value < previous.Value, + ScanCompareType.DecreasedOrEqual => value <= previous.Value, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } + + private bool CompareInternal(byte[] data, int index, Func matcher, out ScanResult result) + { + result = null; + + var value = bitConverter.ToInt64(data, index); + + if (!matcher(value)) + { + return false; + } + + result = new LongScanResult(value); + + return true; + } + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/RegexStringMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/RegexStringMemoryComparer.cs new file mode 100644 index 00000000..efd9d448 --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/RegexStringMemoryComparer.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; + +namespace ReClassNET.MemoryScanner.Comparer +{ + public class RegexStringMemoryComparer : IComplexScanComparer + { + public ScanCompareType CompareType => ScanCompareType.Equal; + + public Regex Pattern { get; } + + public Encoding Encoding { get; } + + public RegexStringMemoryComparer(string pattern, Encoding encoding, bool caseSensitive) + { + var options = RegexOptions.Singleline | RegexOptions.Compiled; + if (!caseSensitive) + { + options |= RegexOptions.IgnoreCase; + } + + Pattern = new Regex(pattern, options); + + Encoding = encoding; + } + + public IEnumerable Compare(byte[] data, int size) + { + var buffer = Encoding.GetString(data, 0, size); + var bufferArray = buffer.ToCharArray(); + + var lastIndex = 0; + var lastOffset = 0; + + var match = Pattern.Match(buffer); + while (match.Success) + { + var byteOffset = Encoding.GetByteCount(bufferArray, lastIndex, match.Index - lastIndex) + lastOffset; + + lastIndex = match.Index; + lastOffset = byteOffset; + + yield return new RegexStringScanResult(match.Value, Encoding) + { + Address = (IntPtr)byteOffset + }; + + match = match.NextMatch(); + } + } + + public bool CompareWithPrevious(byte[] data, int size, ScanResult previous, out ScanResult result) + { + result = null; + + var byteOffset = previous.Address.ToInt32(); + if (byteOffset >= size) + { + return false; + } + + var buffer = Encoding.GetString(data, byteOffset, size - byteOffset); + + var match = Pattern.Match(buffer); + if (!match.Success) + { + return false; + } + + result = new RegexStringScanResult(match.Value, Encoding) + { + Address = (IntPtr)byteOffset + }; + + return true; + } + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/ShortMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/ShortMemoryComparer.cs new file mode 100644 index 00000000..6d8ba6a3 --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/ShortMemoryComparer.cs @@ -0,0 +1,100 @@ +using System; +using System.Diagnostics; +using ReClassNET.Util.Conversion; + +namespace ReClassNET.MemoryScanner.Comparer +{ + public class ShortMemoryComparer : ISimpleScanComparer + { + public ScanCompareType CompareType { get; } + public short Value1 { get; } + public short Value2 { get; } + public int ValueSize => sizeof(short); + + private readonly EndianBitConverter bitConverter; + + public ShortMemoryComparer(ScanCompareType compareType, short value1, short value2, EndianBitConverter bitConverter) + { + CompareType = compareType; + + Value1 = value1; + Value2 = value2; + + this.bitConverter = bitConverter; + } + + public bool Compare(byte[] data, int index, out ScanResult result) + { + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Unknown => true, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } + + public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) + { +#if DEBUG + Debug.Assert(previous is ShortScanResult); +#endif + + return Compare(data, index, (ShortScanResult)previous, out result); + } + + public bool Compare(byte[] data, int index, ShortScanResult previous, out ScanResult result) + { + return CompareInternal( + data, + index, + value => CompareType switch + { + ScanCompareType.Equal => value == Value1, + ScanCompareType.NotEqual => value != Value1, + ScanCompareType.GreaterThan => value > Value1, + ScanCompareType.GreaterThanOrEqual => value >= Value1, + ScanCompareType.LessThan => value < Value1, + ScanCompareType.LessThanOrEqual => value <= Value1, + ScanCompareType.Between => Value1 < value && value < Value2, + ScanCompareType.BetweenOrEqual => Value1 <= value && value <= Value2, + ScanCompareType.Changed => value != previous.Value, + ScanCompareType.NotChanged => value == previous.Value, + ScanCompareType.Increased => value > previous.Value, + ScanCompareType.IncreasedOrEqual => value >= previous.Value, + ScanCompareType.Decreased => value < previous.Value, + ScanCompareType.DecreasedOrEqual => value <= previous.Value, + _ => throw new InvalidCompareTypeException(CompareType) + }, + out result + ); + } + + private bool CompareInternal(byte[] data, int index, Func matcher, out ScanResult result) + { + result = null; + + var value = bitConverter.ToInt16(data, index); + + if (!matcher(value)) + { + return false; + } + + result = new ShortScanResult(value); + + return true; + } + } +} diff --git a/ReClass.NET/MemoryScanner/Comparer/StringMemoryComparer.cs b/ReClass.NET/MemoryScanner/Comparer/StringMemoryComparer.cs new file mode 100644 index 00000000..c6875aba --- /dev/null +++ b/ReClass.NET/MemoryScanner/Comparer/StringMemoryComparer.cs @@ -0,0 +1,49 @@ +using System; +using System.Diagnostics; +using System.Text; +using ReClassNET.Extensions; + +namespace ReClassNET.MemoryScanner.Comparer +{ + public class StringMemoryComparer : ISimpleScanComparer + { + public ScanCompareType CompareType => ScanCompareType.Equal; + public bool CaseSensitive { get; } + public Encoding Encoding { get; } + public string Value { get; } + public int ValueSize { get; } + + public StringMemoryComparer(string value, Encoding encoding, bool caseSensitive) + { + Value = value; + Encoding = encoding; + CaseSensitive = caseSensitive; + ValueSize = Value.Length * Encoding.GuessByteCountPerChar(); + } + + public bool Compare(byte[] data, int index, out ScanResult result) + { + result = null; + + var value = Encoding.GetString(data, index, ValueSize); + + if (!Value.Equals(value, CaseSensitive ? StringComparison.InvariantCulture : StringComparison.InvariantCultureIgnoreCase)) + { + return false; + } + + result = new StringScanResult(value, Encoding); + + return true; + } + + public bool Compare(byte[] data, int index, ScanResult previous, out ScanResult result) + { +#if DEBUG + Debug.Assert(previous is StringScanResult); +#endif + + return Compare(data, index, out result); + } + } +} diff --git a/ReClass.NET/MemoryScanner/ComplexScannerWorker.cs b/ReClass.NET/MemoryScanner/ComplexScannerWorker.cs new file mode 100644 index 00000000..fab1b22c --- /dev/null +++ b/ReClass.NET/MemoryScanner/ComplexScannerWorker.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; +using System.Threading; +using ReClassNET.MemoryScanner.Comparer; + +namespace ReClassNET.MemoryScanner +{ + internal class ComplexScannerWorker : IScannerWorker + { + private readonly ScanSettings settings; + private readonly IComplexScanComparer comparer; + + public ComplexScannerWorker(ScanSettings settings, IComplexScanComparer comparer) + { + this.settings = settings; + this.comparer = comparer; + } + + public IList Search(byte[] data, int count, CancellationToken ct) + { + var results = new List(); + + foreach (var result in comparer.Compare(data, count)) + { + results.Add(result); + + if (ct.IsCancellationRequested) + { + break; + } + } + + return results; + } + + public IList Search(byte[] data, int count, IEnumerable previousResults, CancellationToken ct) + { + var results = new List(); + + foreach (var previousResult in previousResults) + { + if (ct.IsCancellationRequested) + { + break; + } + + if (comparer.CompareWithPrevious(data, count, previousResult, out var result)) + { + results.Add(result); + } + } + + return results; + } + } +} diff --git a/ReClass.NET/MemoryScanner/IScannerWorker.cs b/ReClass.NET/MemoryScanner/IScannerWorker.cs new file mode 100644 index 00000000..494c5874 --- /dev/null +++ b/ReClass.NET/MemoryScanner/IScannerWorker.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Threading; +using ReClassNET.MemoryScanner.Comparer; + +namespace ReClassNET.MemoryScanner +{ + internal interface IScannerWorker + { + /// + /// Uses the to scan the byte array for results. + /// + /// The data to scan. + /// The length of the parameter. + /// The to stop the scan. + /// An enumeration of all s. + IList Search(byte[] data, int count, CancellationToken ct); + + /// + /// Uses the to scan the byte array for results. + /// The comparer uses the provided previous results to compare to the current value. + /// + /// The data to scan. + /// The length of the parameter. + /// The previous results to use. + /// The to stop the scan. + /// An enumeration of all s. + IList Search(byte[] data, int count, IEnumerable previousResults, CancellationToken ct); + } +} diff --git a/ReClass.NET/MemoryScanner/InputCorrelatedScanner.cs b/ReClass.NET/MemoryScanner/InputCorrelatedScanner.cs new file mode 100644 index 00000000..33e3b719 --- /dev/null +++ b/ReClass.NET/MemoryScanner/InputCorrelatedScanner.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using ReClassNET.Input; +using ReClassNET.Memory; +using ReClassNET.MemoryScanner.Comparer; + +namespace ReClassNET.MemoryScanner +{ + public class InputCorrelatedScanner : Scanner + { + private readonly RemoteProcess process; + private readonly KeyboardInput input; + private readonly List hotkeys; + + /// + /// Gets the count of executed scans. + /// + public int ScanCount { get; private set; } + + public InputCorrelatedScanner(RemoteProcess process, KeyboardInput input, IEnumerable hotkeys, ScanValueType valueType) + : base(process, CreateScanSettings(valueType)) + { + Contract.Requires(process != null); + Contract.Requires(input != null); + Contract.Requires(hotkeys != null); + Contract.Ensures(this.input != null); + + this.process = process; + this.input = input; + this.hotkeys = hotkeys.ToList(); + } + + /// + /// Creates from the given . + /// + /// The to use. + /// The created . + private static ScanSettings CreateScanSettings(ScanValueType valueType) + { + Contract.Ensures(Contract.Result() != null); + + var settings = ScanSettings.Default; + settings.ValueType = valueType; + return settings; + } + + /// + /// Creates a for the given and . + /// + /// The to use. + /// The created . + private IScanComparer CreateScanComparer(ScanCompareType compareType) + { + Contract.Ensures(Contract.Result() != null); + + return Settings.ValueType switch + { + ScanValueType.Byte => new ByteMemoryComparer(compareType, 0, 0), + ScanValueType.Short => new ShortMemoryComparer(compareType, 0, 0, process.BitConverter), + ScanValueType.Integer => new IntegerMemoryComparer(compareType, 0, 0, process.BitConverter), + ScanValueType.Long => new LongMemoryComparer(compareType, 0, 0, process.BitConverter), + ScanValueType.Float => new FloatMemoryComparer(compareType, ScanRoundMode.Normal, 2, 0, 0, process.BitConverter), + ScanValueType.Double => new DoubleMemoryComparer(compareType, ScanRoundMode.Normal, 2, 0, 0, process.BitConverter), + _ => throw new InvalidOperationException(), + }; + } + + /// + /// Initializes the scanner. Needs to get called at first. + /// + /// A task that represents the asynchronous operation. + public Task Initialize() + { + return Search(CreateScanComparer(ScanCompareType.Unknown), null, CancellationToken.None); + } + + private bool shouldHaveChangedSinceLastScan = false; + + /// + /// Checks if the registered keys got pressed. + /// + public void CorrelateInput() + { + if (shouldHaveChangedSinceLastScan) + { + return; + } + + var keys = input.GetPressedKeys().Select(k => k & Keys.KeyCode).Where(k => k != Keys.None).ToArray(); + + if (keys.Length != 0 && hotkeys.Any(h => h.Matches(keys))) + { + shouldHaveChangedSinceLastScan = true; + } + } + + /// + /// Performs a new scan to refine the current scan result. + /// + /// The to abort the scan. + /// Used to report the progress of the scan. + /// A task that represents the asynchronous operation. + public async Task RefineResults(CancellationToken ct, IProgress progress) + { + var compareType = shouldHaveChangedSinceLastScan ? ScanCompareType.Changed : ScanCompareType.NotChanged; + + if (compareType == ScanCompareType.Changed) + { + // If the value should have changed, we give the target some time to react to the pressed key. + await Task.Delay(TimeSpan.FromMilliseconds(200), ct); + } + + await Search(CreateScanComparer(compareType), progress, ct); + + shouldHaveChangedSinceLastScan = false; + + ScanCount++; + } + } +} diff --git a/ReClass.NET/MemoryScanner/MemoryRecord.cs b/ReClass.NET/MemoryScanner/MemoryRecord.cs new file mode 100644 index 00000000..e40e3ff9 --- /dev/null +++ b/ReClass.NET/MemoryScanner/MemoryRecord.cs @@ -0,0 +1,290 @@ +using System; +using System.ComponentModel; +using System.Diagnostics.Contracts; +using System.Globalization; +using System.Text; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.Util; + +namespace ReClassNET.MemoryScanner +{ + public enum MemoryRecordAddressMode + { + Absolute, + Relative, + Unknown + } + + public class MemoryRecord : INotifyPropertyChanged + { + private IntPtr addressOrOffset; + private string moduleName; + + public MemoryRecordAddressMode AddressMode { get; set; } + + public IntPtr AddressOrOffset + { + get => addressOrOffset; + set + { + addressOrOffset = value; + AddressMode = MemoryRecordAddressMode.Unknown; + } + } + + public IntPtr RealAddress { get; private set; } + + public string AddressStr => RealAddress.ToString(Constants.AddressHexFormat); + + public string ModuleName + { + get => moduleName; + set + { + moduleName = value; + AddressMode = MemoryRecordAddressMode.Relative; + } + } + public bool IsRelativeAddress => !string.IsNullOrEmpty(ModuleName); + + public string Description { get; set; } = string.Empty; + public ScanValueType ValueType { get; set; } + + public string ValueStr { get; private set; } + public string PreviousValueStr { get; } + public bool HasChangedValue { get; private set; } + + public int ValueLength { get; set; } + + public Encoding Encoding { get; set; } + + public bool ShowValueHexadecimal { get; set; } + + public event PropertyChangedEventHandler PropertyChanged; + + public MemoryRecord() + { + + } + + public MemoryRecord(ScanResult result) + { + Contract.Requires(result != null); + + addressOrOffset = result.Address; + AddressMode = MemoryRecordAddressMode.Unknown; + ValueType = result.ValueType; + + switch (ValueType) + { + case ScanValueType.Byte: + ValueStr = FormatValue(((ByteScanResult)result).Value, false); + break; + case ScanValueType.Short: + ValueStr = FormatValue(((ShortScanResult)result).Value, false); + break; + case ScanValueType.Integer: + ValueStr = FormatValue(((IntegerScanResult)result).Value, false); + break; + case ScanValueType.Long: + ValueStr = FormatValue(((LongScanResult)result).Value, false); + break; + case ScanValueType.Float: + ValueStr = FormatValue(((FloatScanResult)result).Value); + break; + case ScanValueType.Double: + ValueStr = FormatValue(((DoubleScanResult)result).Value); + break; + case ScanValueType.ArrayOfBytes: + var byteData = ((ArrayOfBytesScanResult)result).Value; + ValueLength = byteData.Length; + ValueStr = FormatValue(byteData); + break; + case ScanValueType.String: + case ScanValueType.Regex: + var strResult = (StringScanResult)result; + ValueLength = strResult.Value.Length; + Encoding = strResult.Encoding; + ValueStr = FormatValue(strResult.Value); + break; + default: + throw new InvalidOperationException(); + } + + PreviousValueStr = ValueStr; + } + + private void NotifyPropertyChanged(string propertyName) + { + var propertyChanged = PropertyChanged; + propertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + public void ResolveAddress(RemoteProcess process) + { + Contract.Requires(process != null); + + if (AddressMode == MemoryRecordAddressMode.Unknown) + { + RealAddress = addressOrOffset; + + var module = process.GetModuleToPointer(addressOrOffset); + if (module != null) + { + addressOrOffset = addressOrOffset.Sub(module.Start); + ModuleName = module.Name; + + AddressMode = MemoryRecordAddressMode.Relative; + } + else + { + AddressMode = MemoryRecordAddressMode.Absolute; + } + } + else if (AddressMode == MemoryRecordAddressMode.Relative) + { + var module = process.GetModuleByName(ModuleName); + if (module != null) + { + RealAddress = module.Start.Add(addressOrOffset); + } + } + } + + public void RefreshValue(RemoteProcess process) + { + Contract.Requires(process != null); + + byte[] buffer; + + switch (ValueType) + { + case ScanValueType.Byte: + buffer = new byte[1]; + break; + case ScanValueType.Short: + buffer = new byte[2]; + break; + case ScanValueType.Integer: + case ScanValueType.Float: + buffer = new byte[4]; + break; + case ScanValueType.Long: + case ScanValueType.Double: + buffer = new byte[8]; + break; + case ScanValueType.ArrayOfBytes: + buffer = new byte[ValueLength]; + break; + case ScanValueType.String: + case ScanValueType.Regex: + buffer = new byte[ValueLength * Encoding.GuessByteCountPerChar()]; + break; + default: + throw new InvalidOperationException(); + } + + if (process.ReadRemoteMemoryIntoBuffer(RealAddress, ref buffer)) + { + switch (ValueType) + { + case ScanValueType.Byte: + ValueStr = FormatValue(buffer[0], ShowValueHexadecimal); + break; + case ScanValueType.Short: + ValueStr = FormatValue(process.BitConverter.ToInt16(buffer, 0), ShowValueHexadecimal); + break; + case ScanValueType.Integer: + ValueStr = FormatValue(process.BitConverter.ToInt32(buffer, 0), ShowValueHexadecimal); + break; + case ScanValueType.Long: + ValueStr = FormatValue(process.BitConverter.ToInt64(buffer, 0), ShowValueHexadecimal); + break; + case ScanValueType.Float: + ValueStr = FormatValue(process.BitConverter.ToSingle(buffer, 0)); + break; + case ScanValueType.Double: + ValueStr = FormatValue(process.BitConverter.ToDouble(buffer, 0)); + break; + case ScanValueType.ArrayOfBytes: + ValueStr = FormatValue(buffer); + break; + case ScanValueType.String: + case ScanValueType.Regex: + ValueStr = FormatValue(Encoding.GetString(buffer)); + break; + } + } + else + { + ValueStr = "???"; + } + + HasChangedValue = ValueStr != PreviousValueStr; + + NotifyPropertyChanged(nameof(ValueStr)); + } + + public void SetValue(RemoteProcess process, string input, bool isHex) + { + Contract.Requires(process != null); + Contract.Requires(input != null); + + byte[] data = null; + + if (ValueType == ScanValueType.Byte || ValueType == ScanValueType.Short || ValueType == ScanValueType.Integer || ValueType == ScanValueType.Long) + { + var numberStyle = isHex ? NumberStyles.HexNumber : NumberStyles.Integer; + long.TryParse(input, numberStyle, null, out var value); + + switch (ValueType) + { + case ScanValueType.Byte: + data = process.BitConverter.GetBytes((byte)value); + break; + case ScanValueType.Short: + data = process.BitConverter.GetBytes((short)value); + break; + case ScanValueType.Integer: + data = process.BitConverter.GetBytes((int)value); + break; + case ScanValueType.Long: + data = process.BitConverter.GetBytes(value); + break; + } + } + else if (ValueType == ScanValueType.Float || ValueType == ScanValueType.Double) + { + var nf = NumberFormat.GuessNumberFormat(input); + double.TryParse(input, NumberStyles.Float, nf, out var value); + + switch (ValueType) + { + case ScanValueType.Float: + data = process.BitConverter.GetBytes((float)value); + break; + case ScanValueType.Double: + data = process.BitConverter.GetBytes(value); + break; + } + } + + if (data != null) + { + process.WriteRemoteMemory(RealAddress, data); + + RefreshValue(process); + } + } + + private static string FormatValue(byte value, bool showAsHex) => showAsHex ? value.ToString("X") : value.ToString(); + private static string FormatValue(short value, bool showAsHex) => showAsHex ? value.ToString("X") : value.ToString(); + private static string FormatValue(int value, bool showAsHex) => showAsHex ? value.ToString("X") : value.ToString(); + private static string FormatValue(long value, bool showAsHex) => showAsHex ? value.ToString("X") : value.ToString(); + private static string FormatValue(float value) => value.ToString("0.0000"); + private static string FormatValue(double value) => value.ToString("0.0000"); + private static string FormatValue(byte[] value) => HexadecimalFormatter.ToString(value); + private static string FormatValue(string value) => value; + } +} diff --git a/ReClass.NET/MemoryScanner/PatternScanner.cs b/ReClass.NET/MemoryScanner/PatternScanner.cs new file mode 100644 index 00000000..48e901d2 --- /dev/null +++ b/ReClass.NET/MemoryScanner/PatternScanner.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; +using ReClassNET.Core; +using ReClassNET.Memory; + +namespace ReClassNET.MemoryScanner +{ + public class PatternScanner + { + /// + /// Searchs for the in the specified . + /// + /// The pattern to search. + /// The process to read from. + /// The module of the process. + /// The address of the pattern or if the pattern was not found. + public static IntPtr FindPattern(BytePattern pattern, RemoteProcess process, Module module) + { + Contract.Requires(pattern != null); + Contract.Requires(process != null); + Contract.Requires(module != null); + + return FindPattern(pattern, process, module.Start, module.Size.ToInt32()); + } + + /// + /// Searchs for the in the specified . + /// + /// The pattern to search. + /// The process to read from. + /// The section of the process. + /// The address of the pattern or if the pattern was not found. + public static IntPtr FindPattern(BytePattern pattern, RemoteProcess process, Section section) + { + Contract.Requires(pattern != null); + Contract.Requires(process != null); + Contract.Requires(section != null); + + return FindPattern(pattern, process, section.Start, section.Size.ToInt32()); + } + + /// + /// Searchs for the in the specified address range. + /// + /// The pattern to search. + /// The process to read from. + /// The start address. + /// The size of the address range. + /// The address of the pattern or if the pattern was not found. + public static IntPtr FindPattern(BytePattern pattern, RemoteProcess process, IntPtr start, int size) + { + Contract.Requires(pattern != null); + Contract.Requires(process != null); + + var moduleBytes = process.ReadRemoteMemory(start, size); + + var offset = FindPattern(pattern, moduleBytes); + if (offset == -1) + { + return IntPtr.Zero; + } + + return start + offset; + } + + /// + /// Searchs for the in the specified data. + /// + /// The pattern to search. + /// The data to scan. + /// The index in data where the pattern was found or -1 otherwise. + public static int FindPattern(BytePattern pattern, byte[] data) + { + Contract.Requires(pattern != null); + Contract.Requires(data != null); + + var limit = data.Length - pattern.Length; + for (var i = 0; i < limit; ++i) + { + if (pattern.Equals(data, i)) + { + return i; + } + } + + return -1; + } + + /// + /// Creates a for the given address range. + /// + /// The process to use. + /// The start of the address range. + /// The size of the address range. + /// A describing the address range. + public static BytePattern CreatePatternFromCode(RemoteProcess process, IntPtr start, int size) + { + var data = new List>(); + + var buffer = process.ReadRemoteMemory(start, size); + + var handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); + try + { + var eip = handle.AddrOfPinnedObject(); + + process.CoreFunctions.DisassembleCode(eip, size, IntPtr.Zero, true, (ref InstructionData instruction) => + { + for (var i = 0; i < instruction.Length; ++i) + { + data.Add(Tuple.Create(instruction.Data[i], i >= instruction.StaticInstructionBytes)); + } + return true; + }); + } + finally + { + if (handle.IsAllocated) + { + handle.Free(); + } + } + + return BytePattern.From(data); + } + } +} diff --git a/ReClass.NET/MemoryScanner/ScanCompareType.cs b/ReClass.NET/MemoryScanner/ScanCompareType.cs new file mode 100644 index 00000000..a7fb6459 --- /dev/null +++ b/ReClass.NET/MemoryScanner/ScanCompareType.cs @@ -0,0 +1,38 @@ +using System.ComponentModel; + +namespace ReClassNET.MemoryScanner +{ + public enum ScanCompareType + { + [Description("Is Equal")] + Equal, + [Description("Is Not Equal")] + NotEqual, + [Description("Has Changed")] + Changed, + [Description("Has Not Changed")] + NotChanged, + [Description("Is Greater Than")] + GreaterThan, + [Description("Is Greater Than Or Equal")] + GreaterThanOrEqual, + [Description("Has Increased")] + Increased, + [Description("Has Increased Or Is Equal")] + IncreasedOrEqual, + [Description("Is Less Than")] + LessThan, + [Description("Is Less Than Or Equal")] + LessThanOrEqual, + [Description("Has Decreased")] + Decreased, + [Description("Has Decreased Or Is Equal")] + DecreasedOrEqual, + [Description("Is Between")] + Between, + [Description("Is Between Or Equal")] + BetweenOrEqual, + [Description("Unknown Initial Value")] + Unknown + } +} diff --git a/ReClass.NET/MemoryScanner/ScanResult.cs b/ReClass.NET/MemoryScanner/ScanResult.cs new file mode 100644 index 00000000..d46ff437 --- /dev/null +++ b/ReClass.NET/MemoryScanner/ScanResult.cs @@ -0,0 +1,315 @@ +using System; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Text; +using ReClassNET.Extensions; + +namespace ReClassNET.MemoryScanner +{ + public abstract class ScanResult + { + public abstract ScanValueType ValueType { get; } + + public IntPtr Address { get; set; } + + public abstract int ValueSize { get; } + + public abstract ScanResult Clone(); + } + + public class ByteScanResult : ScanResult, IEquatable + { + public override ScanValueType ValueType => ScanValueType.Byte; + + public override int ValueSize => sizeof(byte); + + public byte Value { get; } + + public ByteScanResult(byte value) + { + Value = value; + } + + public override ScanResult Clone() + { + return new ByteScanResult(Value) { Address = Address }; + } + + public override bool Equals(object obj) + { + return Equals(obj as ByteScanResult); + } + + public bool Equals(ByteScanResult other) + { + return other != null && Address == other.Address && Value == other.Value; + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } + } + + public class ShortScanResult : ScanResult, IEquatable + { + public override ScanValueType ValueType => ScanValueType.Short; + + public override int ValueSize => sizeof(short); + + public short Value { get; } + + public ShortScanResult(short value) + { + Value = value; + } + + public override ScanResult Clone() + { + return new ShortScanResult(Value) { Address = Address }; + } + + public override bool Equals(object obj) + { + return Equals(obj as ShortScanResult); + } + + public bool Equals(ShortScanResult other) + { + return other != null && Address == other.Address && Value == other.Value; + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } + } + + public class IntegerScanResult : ScanResult, IEquatable + { + public override ScanValueType ValueType => ScanValueType.Integer; + + public override int ValueSize => sizeof(int); + + public int Value { get; } + + public IntegerScanResult(int value) + { + Value = value; + } + + public override ScanResult Clone() + { + return new IntegerScanResult(Value) { Address = Address }; + } + + public override bool Equals(object obj) + { + return Equals(obj as IntegerScanResult); + } + + public bool Equals(IntegerScanResult other) + { + return other != null && Address == other.Address && Value == other.Value; + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } + } + + public class LongScanResult : ScanResult, IEquatable + { + public override ScanValueType ValueType => ScanValueType.Long; + + public override int ValueSize => sizeof(long); + + public long Value { get; } + + public LongScanResult(long value) + { + Value = value; + } + + public override ScanResult Clone() + { + return new LongScanResult(Value) { Address = Address }; + } + + public override bool Equals(object obj) + { + return Equals(obj as LongScanResult); + } + + public bool Equals(LongScanResult other) + { + return other != null && Address == other.Address && Value == other.Value; + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } + } + + public class FloatScanResult : ScanResult, IEquatable + { + public override ScanValueType ValueType => ScanValueType.Float; + + public override int ValueSize => sizeof(float); + + public float Value { get; } + + public FloatScanResult(float value) + { + Value = value; + } + + public override ScanResult Clone() + { + return new FloatScanResult(Value) { Address = Address }; + } + + public override bool Equals(object obj) + { + return Equals(obj as FloatScanResult); + } + + public bool Equals(FloatScanResult other) + { + return other != null && Address == other.Address && Value == other.Value; + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } + } + + public class DoubleScanResult : ScanResult, IEquatable + { + public override ScanValueType ValueType => ScanValueType.Double; + + public override int ValueSize => sizeof(double); + + public double Value { get; } + + public DoubleScanResult(double value) + { + Value = value; + } + + public override ScanResult Clone() + { + return new DoubleScanResult(Value) { Address = Address }; + } + + public override bool Equals(object obj) + { + return Equals(obj as DoubleScanResult); + } + + public bool Equals(DoubleScanResult other) + { + return other != null && Address == other.Address && Value == other.Value; + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } + } + + public class ArrayOfBytesScanResult : ScanResult, IEquatable + { + public override ScanValueType ValueType => ScanValueType.ArrayOfBytes; + + public override int ValueSize => Value.Length; + + public byte[] Value { get; } + + public ArrayOfBytesScanResult(byte[] value) + { + Contract.Requires(value != null); + + Value = value; + } + + public override ScanResult Clone() + { + return new ArrayOfBytesScanResult(Value) { Address = Address }; + } + + public override bool Equals(object obj) + { + return Equals(obj as ArrayOfBytesScanResult); + } + + public bool Equals(ArrayOfBytesScanResult other) + { + return other != null && Address == other.Address && Value.SequenceEqual(other.Value); + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode(); + } + } + + public class StringScanResult : ScanResult, IEquatable + { + public override ScanValueType ValueType => ScanValueType.String; + + public override int ValueSize => Value.Length * Encoding.GuessByteCountPerChar(); + + public string Value { get; } + + public Encoding Encoding { get; } + + public StringScanResult(string value, Encoding encoding) + { + Contract.Requires(value != null); + Contract.Requires(encoding != null); + + Value = value; + Encoding = encoding; + } + + public override ScanResult Clone() + { + return new StringScanResult(Value, Encoding) { Address = Address }; + } + + public override bool Equals(object obj) + { + return Equals(obj as StringScanResult); + } + + public bool Equals(StringScanResult other) + { + return other != null && Address == other.Address && Value == other.Value && Encoding.Equals(other.Encoding); + } + + public override int GetHashCode() + { + return Address.GetHashCode() * 19 + Value.GetHashCode() * 19 + Encoding.GetHashCode(); + } + } + + public class RegexStringScanResult : StringScanResult + { + public override ScanValueType ValueType => ScanValueType.Regex; + + public RegexStringScanResult(string value, Encoding encoding) + : base(value, encoding) + { + + } + + public override ScanResult Clone() + { + return new RegexStringScanResult(Value, Encoding) { Address = Address }; + } + } +} diff --git a/ReClass.NET/MemoryScanner/ScanResultBlock.cs b/ReClass.NET/MemoryScanner/ScanResultBlock.cs new file mode 100644 index 00000000..ab657c15 --- /dev/null +++ b/ReClass.NET/MemoryScanner/ScanResultBlock.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using ReClassNET.Extensions; + +namespace ReClassNET.MemoryScanner +{ + internal class ScanResultBlock + { + public IntPtr Start { get; } + public IntPtr End { get; } + public int Size => End.Sub(Start).ToInt32(); + public IReadOnlyList Results { get; } + + public ScanResultBlock(IntPtr start, IntPtr end, IReadOnlyList results) + { + Contract.Requires(results != null); + + Start = start; + End = end; + Results = results; + } + } +} diff --git a/ReClass.NET/MemoryScanner/ScanResultStore.cs b/ReClass.NET/MemoryScanner/ScanResultStore.cs new file mode 100644 index 00000000..e88033b8 --- /dev/null +++ b/ReClass.NET/MemoryScanner/ScanResultStore.cs @@ -0,0 +1,272 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.IO; +using System.Text; +using ReClassNET.Extensions; + +namespace ReClassNET.MemoryScanner +{ + /// + /// The store of all found scan results. If the result count exceed the limit, + /// the results are stored in temporary files. + /// + internal class ScanResultStore : IDisposable + { + private enum StorageMode + { + Memory, + File + } + + private const int MaximumMemoryResultsCount = 10000000; + + private readonly List store = new List(); + + private readonly string storePath; + private FileStream fileStream; + + private StorageMode mode = StorageMode.Memory; + + private readonly ScanValueType valueType; + + /// + /// Gets the number of total results. + /// + public int TotalResultCount { get; private set; } + + public ScanResultStore(ScanValueType valueType, string storePath) + { + this.valueType = valueType; + this.storePath = Path.Combine(storePath, $"ReClass.NET_MemoryScanner_{Guid.NewGuid()}.tmp"); + } + + public void Dispose() + { + Finish(); + + store.Clear(); + + try + { + if (File.Exists(storePath)) + { + File.Delete(storePath); + } + } + catch + { + // ignored + } + } + + public void Finish() + { + if (mode == StorageMode.File) + { + fileStream?.Dispose(); + fileStream = null; + } + } + + /// + /// Gets the result blocks from the store. This may read results from files.. + /// + public IEnumerable GetResultBlocks() + { + Contract.Ensures(Contract.Result>() != null); + + return mode == StorageMode.Memory ? store : ReadBlocksFromFile(); + } + + /// + /// Adds a result block to the store. If the result count exceed the limit, + /// the results are stored in temporary files. + /// + /// The result block to add. + public void AddBlock(ScanResultBlock block) + { + Contract.Requires(block != null); + + lock (store) + { + TotalResultCount += block.Results.Count; + + if (mode == StorageMode.Memory) + { + if (TotalResultCount > MaximumMemoryResultsCount) + { + mode = StorageMode.File; + + fileStream = File.OpenWrite(storePath); + + foreach (var b in store) + { + AppendBlockToFile(b); + } + store.Clear(); + store.TrimExcess(); + + AppendBlockToFile(block); + } + else + { + store.Add(block); + } + } + else + { + AppendBlockToFile(block); + } + } + } + + /// + /// Writes a result block to the file. + /// + /// The result block to add. + private void AppendBlockToFile(ScanResultBlock block) + { + Contract.Requires(block != null); + + using var bw = new BinaryWriter(fileStream, Encoding.Unicode, true); + bw.Write(block.Start); + bw.Write(block.End); + bw.Write(block.Results.Count); + + foreach (var result in block.Results) + { + WriteSearchResult(bw, result); + } + } + + /// + /// Reads all memory blocks from the file. + /// + private IEnumerable ReadBlocksFromFile() + { + Contract.Ensures(Contract.Result>() != null); + + using var stream = File.OpenRead(storePath); + using var br = new BinaryReader(stream, Encoding.Unicode); + + var length = stream.Length; + + while (stream.Position < length) + { + var start = br.ReadIntPtr(); + var end = br.ReadIntPtr(); + + var resultCount = br.ReadInt32(); + + var results = new List(resultCount); + for (var i = 0; i < resultCount; ++i) + { + results.Add(ReadScanResult(br)); + } + + yield return new ScanResultBlock(start, end, results); + } + } + + /// + /// Reads a single scan result from the file. + /// + /// Thrown if the is not valid. + /// The to read from. + /// The scan result. + private ScanResult ReadScanResult(BinaryReader br) + { + Contract.Ensures(Contract.Result() != null); + + var address = br.ReadIntPtr(); + + ScanResult result; + switch (valueType) + { + case ScanValueType.Byte: + result = new ByteScanResult(br.ReadByte()); + break; + case ScanValueType.Short: + result = new ShortScanResult(br.ReadInt16()); + break; + case ScanValueType.Integer: + result = new IntegerScanResult(br.ReadInt32()); + break; + case ScanValueType.Long: + result = new LongScanResult(br.ReadInt64()); + break; + case ScanValueType.Float: + result = new FloatScanResult(br.ReadSingle()); + break; + case ScanValueType.Double: + result = new DoubleScanResult(br.ReadDouble()); + break; + case ScanValueType.ArrayOfBytes: + result = new ArrayOfBytesScanResult(br.ReadBytes(br.ReadInt32())); + break; + case ScanValueType.String: + case ScanValueType.Regex: + var encoding = br.ReadInt32() switch + { + 0 => Encoding.UTF8, + 1 => Encoding.Unicode, + _ => Encoding.UTF32 + }; + var value = br.ReadString(); + + result = valueType == ScanValueType.String ? new StringScanResult(value, encoding) : new RegexStringScanResult(value, encoding); + break; + default: + throw new ArgumentOutOfRangeException(); + } + + result.Address = address; + + return result; + } + + /// + /// Writes a single scan result to the file. + /// + /// The to write to. + /// The result to write. + private static void WriteSearchResult(BinaryWriter bw, ScanResult result) + { + Contract.Requires(bw != null); + Contract.Requires(result != null); + + bw.Write(result.Address); + + switch (result) + { + case ByteScanResult byteSearchResult: + bw.Write(byteSearchResult.Value); + break; + case ShortScanResult shortSearchResult: + bw.Write(shortSearchResult.Value); + break; + case IntegerScanResult integerSearchResult: + bw.Write(integerSearchResult.Value); + break; + case LongScanResult longSearchResult: + bw.Write(longSearchResult.Value); + break; + case FloatScanResult floatSearchResult: + bw.Write(floatSearchResult.Value); + break; + case DoubleScanResult doubleSearchResult: + bw.Write(doubleSearchResult.Value); + break; + case ArrayOfBytesScanResult arrayOfBytesSearchResult: + bw.Write(arrayOfBytesSearchResult.Value.Length); + bw.Write(arrayOfBytesSearchResult.Value); + break; + case StringScanResult stringSearchResult: + bw.Write(stringSearchResult.Encoding.IsSameCodePage(Encoding.UTF8) ? 0 : stringSearchResult.Encoding.IsSameCodePage(Encoding.Unicode) ? 1 : 2); + bw.Write(stringSearchResult.Value); + break; + } + } + } +} diff --git a/ReClass.NET/MemoryScanner/ScanRoundMode.cs b/ReClass.NET/MemoryScanner/ScanRoundMode.cs new file mode 100644 index 00000000..109a6aa7 --- /dev/null +++ b/ReClass.NET/MemoryScanner/ScanRoundMode.cs @@ -0,0 +1,9 @@ +namespace ReClassNET.MemoryScanner +{ + public enum ScanRoundMode + { + Strict, + Normal, + Truncate + } +} diff --git a/ReClass.NET/MemoryScanner/ScanSettings.cs b/ReClass.NET/MemoryScanner/ScanSettings.cs new file mode 100644 index 00000000..b21b9793 --- /dev/null +++ b/ReClass.NET/MemoryScanner/ScanSettings.cs @@ -0,0 +1,33 @@ +using System; + +namespace ReClassNET.MemoryScanner +{ + public enum SettingState + { + Yes, + No, + Indeterminate + } + + public class ScanSettings + { + public IntPtr StartAddress { get; set; } = IntPtr.Zero; + public IntPtr StopAddress { get; set; } = +#if RECLASSNET64 + (IntPtr)long.MaxValue; +#else + (IntPtr)int.MaxValue; +#endif + public SettingState ScanWritableMemory { get; set; } = SettingState.Yes; + public SettingState ScanExecutableMemory { get; set; } = SettingState.Indeterminate; + public SettingState ScanCopyOnWriteMemory { get; set; } = SettingState.No; + public bool ScanPrivateMemory { get; set; } = true; + public bool ScanImageMemory { get; set; } = true; + public bool ScanMappedMemory { get; set; } = false; + public bool EnableFastScan { get; set; } = true; + public int FastScanAlignment { get; set; } = 4; + public ScanValueType ValueType { get; set; } = ScanValueType.Integer; + + public static ScanSettings Default => new ScanSettings(); + } +} diff --git a/ReClass.NET/MemoryScanner/ScanValueType.cs b/ReClass.NET/MemoryScanner/ScanValueType.cs new file mode 100644 index 00000000..8371e061 --- /dev/null +++ b/ReClass.NET/MemoryScanner/ScanValueType.cs @@ -0,0 +1,26 @@ +using System.ComponentModel; + +namespace ReClassNET.MemoryScanner +{ + public enum ScanValueType + { + [Description("Byte")] + Byte, + [Description("Short (2 Bytes)")] + Short, + [Description("Integer (4 Bytes)")] + Integer, + [Description("Long (8 Bytes)")] + Long, + [Description("Float (4 Bytes)")] + Float, + [Description("Double (8 Bytes)")] + Double, + [Description("Array of Bytes")] + ArrayOfBytes, + [Description("String")] + String, + [Description("Regular Expression")] + Regex + } +} diff --git a/ReClass.NET/MemoryScanner/Scanner.cs b/ReClass.NET/MemoryScanner/Scanner.cs new file mode 100644 index 00000000..acf8532b --- /dev/null +++ b/ReClass.NET/MemoryScanner/Scanner.cs @@ -0,0 +1,417 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.MemoryScanner.Comparer; +using ReClassNET.Util; + +namespace ReClassNET.MemoryScanner +{ + public class Scanner : IDisposable + { + /// + /// Helper class for consolidated memory regions. + /// + private class ConsolidatedMemoryRegion + { + public IntPtr Address { get; set; } + public int Size { get; set; } + } + + private readonly RemoteProcess process; + private readonly CircularBuffer stores; + + public ScanSettings Settings { get; } + + private ScanResultStore CurrentStore => stores.Head; + + /// + /// Gets the total result count from the last scan. + /// + public int TotalResultCount => CurrentStore?.TotalResultCount ?? 0; + + /// + /// Checks if the last scan can be undone. + /// + public bool CanUndoLastScan => stores.Count > 1; + + private bool isFirstScan; + + public Scanner(RemoteProcess process, ScanSettings settings) + { + Contract.Requires(process != null); + Contract.Requires(settings != null); + + stores = new CircularBuffer(3); + + this.process = process; + Settings = settings; + + isFirstScan = true; + } + + public void Dispose() + { + foreach (var store in stores) + { + store?.Dispose(); + } + stores.Clear(); + } + + /// + /// Retrieves the results of the last scan from the store. + /// + /// + /// An enumeration of the s of the last scan. + /// + public IEnumerable GetResults() + { + Contract.Ensures(Contract.Result>() != null); + + if (CurrentStore == null) + { + return Enumerable.Empty(); + } + + return CurrentStore.GetResultBlocks().SelectMany(rb => rb.Results.Select(r => + { + // Convert the block offset to a real address. + var scanResult = r.Clone(); + scanResult.Address = scanResult.Address.Add(rb.Start); + return scanResult; + })); + } + + /// + /// Restores the results of the previous scan. + /// + /// Thrown if no previous results are present. + public void UndoLastScan() + { + if (!CanUndoLastScan) + { + throw new InvalidOperationException(); + } + + var store = stores.Dequeue(); + store?.Dispose(); + } + + /// + /// Creates a new and uses the system temporary path as file location. + /// + /// The new . + private ScanResultStore CreateStore() + { + return new ScanResultStore(Settings.ValueType, Path.GetTempPath()); + } + + /// + /// Gets a list of the sections which meet the provided scan settings. + /// + /// A list of searchable sections. + private IList
GetSearchableSections() + { + Contract.Ensures(Contract.Result>() != null); + + return process.Sections + .Where(s => !s.Protection.HasFlag(SectionProtection.Guard)) + .Where(s => s.Start.IsInRange(Settings.StartAddress, Settings.StopAddress) + || Settings.StartAddress.IsInRange(s.Start, s.End) + || Settings.StopAddress.IsInRange(s.Start, s.End)) + .Where(s => s.Type switch + { + SectionType.Private => Settings.ScanPrivateMemory, + SectionType.Image => Settings.ScanImageMemory, + SectionType.Mapped => Settings.ScanMappedMemory, + _ => false + }) + .Where(s => + { + var isWritable = s.Protection.HasFlag(SectionProtection.Write); + return Settings.ScanWritableMemory switch + { + SettingState.Yes => isWritable, + SettingState.No => !isWritable, + _ => true + }; + }) + .Where(s => + { + var isExecutable = s.Protection.HasFlag(SectionProtection.Execute); + return Settings.ScanExecutableMemory switch + { + SettingState.Yes => isExecutable, + SettingState.No => !isExecutable, + _ => true + }; + }) + .Where(s => + { + var isCopyOnWrite = s.Protection.HasFlag(SectionProtection.CopyOnWrite); + return Settings.ScanCopyOnWriteMemory switch + { + SettingState.Yes => isCopyOnWrite, + SettingState.No => !isCopyOnWrite, + _ => true + }; + }) + .ToList(); + } + + /// + /// Starts an async search with the provided . + /// The results are stored in the store. + /// + /// The comparer to scan for values. + /// The object to report the current progress. + /// The to stop the scan. + /// The asynchronous result indicating if the scan completed. + public Task Search(IScanComparer comparer, IProgress progress, CancellationToken ct) + { + return isFirstScan ? FirstScan(comparer, progress, ct) : NextScan(comparer, progress, ct); + } + + /// + /// Starts an async first scan with the provided . + /// + /// The comparer to scan for values. + /// The object to report the current progress. + /// The to stop the scan. + /// The asynchronous result indicating if the scan completed. + private Task FirstScan(IScanComparer comparer, IProgress progress, CancellationToken ct) + { + Contract.Requires(comparer != null); + Contract.Ensures(Contract.Result>() != null); + + var store = CreateStore(); + + var sections = GetSearchableSections(); + if (sections.Count == 0) + { + return Task.FromResult(true); + } + + var regions = ConsolidateSections(sections); + + var initialBufferSize = (int)(regions.Average(s => s.Size) + 1); + + progress?.Report(0); + + var counter = 0; + var totalSectionCount = (float)regions.Count; + + return Task.Run(() => + { + // Algorithm: + // 1. Partition the sections for the worker threads. + // 2. Create a ScannerContext per worker thread. + // 3. n Worker -> m Sections: Read data, search results, store results + + var result = Parallel.ForEach( + regions, // Sections get grouped by the framework to balance the workers. + () => new ScannerContext(CreateWorker(Settings, comparer), initialBufferSize), // Create a new context for every worker (thread). + (s, state, _, context) => + { + if (!ct.IsCancellationRequested) + { + var start = s.Address; + var end = s.Address + s.Size; + var size = s.Size; + + if (Settings.StartAddress.IsInRange(start, end)) + { + size -= Settings.StartAddress.Sub(start).ToInt32(); + start = Settings.StartAddress; + } + if (Settings.StopAddress.IsInRange(start, end)) + { + size -= end.Sub(Settings.StopAddress).ToInt32(); + } + + context.EnsureBufferSize(size); + var buffer = context.Buffer; + if (process.ReadRemoteMemoryIntoBuffer(start, ref buffer, 0, size)) // Fill the buffer. + { + var results = context.Worker.Search(buffer, size, ct) // Search for results. + .OrderBy(r => r.Address, IntPtrComparer.Instance) + .ToList(); + if (results.Count > 0) + { + var block = CreateResultBlock(results, start); + store.AddBlock(block); // Store the result block. + } + } + + progress?.Report((int)(Interlocked.Increment(ref counter) / totalSectionCount * 100)); + } + else + { + state.Stop(); + } + return context; + }, + w => { } + ); + + store.Finish(); + + var previousStore = stores.Enqueue(store); + previousStore?.Dispose(); + + isFirstScan = false; + + return result.IsCompleted; + }, ct); + } + + /// + /// Starts an async next scan with the provided . + /// The next scan uses the previous results to refine the results. + /// + /// The comparer to scan for values. + /// The object to report the current progress. + /// The to stop the scan. + /// The asynchronous result indicating if the scan completed. + private Task NextScan(IScanComparer comparer, IProgress progress, CancellationToken ct) + { + Contract.Requires(comparer != null); + Contract.Ensures(Contract.Result>() != null); + + var store = CreateStore(); + + progress?.Report(0); + + var counter = 0; + var totalResultCount = (float)CurrentStore.TotalResultCount; + + return Task.Run(() => + { + var result = Parallel.ForEach( + CurrentStore.GetResultBlocks(), + () => new ScannerContext(CreateWorker(Settings, comparer), 0), + (b, state, _, context) => + { + if (!ct.IsCancellationRequested) + { + context.EnsureBufferSize(b.Size); + var buffer = context.Buffer; + if (process.ReadRemoteMemoryIntoBuffer(b.Start, ref buffer, 0, b.Size)) + { + var results = context.Worker.Search(buffer, buffer.Length, b.Results, ct) + .OrderBy(r => r.Address, IntPtrComparer.Instance) + .ToList(); + if (results.Count > 0) + { + var block = CreateResultBlock(results, b.Start); + store.AddBlock(block); + } + } + + progress?.Report((int)(Interlocked.Add(ref counter, b.Results.Count) / totalResultCount * 100)); + } + else + { + state.Stop(); + } + return context; + }, + w => { } + ); + + store.Finish(); + + var previousStore = stores.Enqueue(store); + previousStore?.Dispose(); + + return result.IsCompleted; + }, ct); + } + + /// + /// Consolidate memory sections which are direct neighbours to reduce the number of work items. + /// + /// A list of sections. + /// A list of consolidated memory regions. + private static List ConsolidateSections(IList
sections) + { + var regions = new List(); + + if (sections.Count > 0) + { + var address = sections[0].Start; + var size = sections[0].Size.ToInt32(); + + for (var i = 1; i < sections.Count; ++i) + { + var section = sections[i]; + if (address + size != section.Start) + { + regions.Add(new ConsolidatedMemoryRegion { Address = address, Size = size }); + + address = section.Start; + size = section.Size.ToInt32(); + } + else + { + size += section.Size.ToInt32(); + } + } + + regions.Add(new ConsolidatedMemoryRegion { Address = address, Size = size }); + } + + return regions; + } + + /// + /// Creates a result block from the scan results and adjusts the result offset. + /// + /// The results in this block. + /// The start address of the previous block or section. + /// The new result block. + private static ScanResultBlock CreateResultBlock(IReadOnlyList results, IntPtr previousStartAddress) + { + var firstResult = results.First(); + var lastResult = results.Last(); + + // Calculate start and end address + var startAddress = firstResult.Address.Add(previousStartAddress); + var endAddress = lastResult.Address.Add(previousStartAddress) + lastResult.ValueSize; + + // Adjust the offsets of the results + var firstOffset = firstResult.Address; + foreach (var result in results) + { + result.Address = result.Address.Sub(firstOffset); + } + + var block = new ScanResultBlock( + startAddress, + endAddress, + results + ); + return block; + } + + private static IScannerWorker CreateWorker(ScanSettings settings, IScanComparer comparer) + { + if (comparer is ISimpleScanComparer simpleScanComparer) + { + return new SimpleScannerWorker(settings, simpleScanComparer); + } + if (comparer is IComplexScanComparer complexScanComparer) + { + return new ComplexScannerWorker(settings, complexScanComparer); + } + + throw new Exception(); + } + } +} diff --git a/ReClass.NET/MemoryScanner/ScannerContext.cs b/ReClass.NET/MemoryScanner/ScannerContext.cs new file mode 100644 index 00000000..55caffc1 --- /dev/null +++ b/ReClass.NET/MemoryScanner/ScannerContext.cs @@ -0,0 +1,32 @@ +using System.Diagnostics.Contracts; + +namespace ReClassNET.MemoryScanner +{ + internal class ScannerContext + { + public byte[] Buffer { get; private set; } + public IScannerWorker Worker { get; } + + public ScannerContext(IScannerWorker worker, int bufferSize) + { + Contract.Requires(bufferSize >= 0); + Contract.Ensures(Buffer != null); + Contract.Ensures(Worker != null); + + EnsureBufferSize(bufferSize); + + Worker = worker; + } + + public void EnsureBufferSize(int size) + { + Contract.Requires(size >= 0); + Contract.Ensures(Buffer != null); + + if (Buffer == null || Buffer.Length < size) + { + Buffer = new byte[size]; + } + } + } +} diff --git a/ReClass.NET/MemoryScanner/SimpleScannerWorker.cs b/ReClass.NET/MemoryScanner/SimpleScannerWorker.cs new file mode 100644 index 00000000..3c384f5d --- /dev/null +++ b/ReClass.NET/MemoryScanner/SimpleScannerWorker.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Threading; +using ReClassNET.MemoryScanner.Comparer; + +namespace ReClassNET.MemoryScanner +{ + internal class SimpleScannerWorker : IScannerWorker + { + private readonly ScanSettings settings; + private readonly ISimpleScanComparer comparer; + + public SimpleScannerWorker(ScanSettings settings, ISimpleScanComparer comparer) + { + Contract.Requires(settings != null); + Contract.Requires(comparer != null); + + this.settings = settings; + this.comparer = comparer; + } + + public IList Search(byte[] data, int count, CancellationToken ct) + { + Contract.Requires(data != null); + + var results = new List(); + + var endIndex = count - comparer.ValueSize; + + for (var i = 0; i < endIndex; i += settings.FastScanAlignment) + { + if (ct.IsCancellationRequested) + { + break; + } + + if (comparer.Compare(data, i, out var result)) + { + result.Address = (IntPtr)i; + + results.Add(result); + } + } + + return results; + } + + public IList Search(byte[] data, int count, IEnumerable previousResults, CancellationToken ct) + { + Contract.Requires(data != null); + Contract.Requires(previousResults != null); + + var results = new List(); + + var endIndex = count - comparer.ValueSize; + + foreach (var previousResult in previousResults) + { + if (ct.IsCancellationRequested) + { + break; + } + + var offset = previousResult.Address.ToInt32(); + if (offset <= endIndex) + { + if (comparer.Compare(data, offset, previousResult, out var result)) + { + result.Address = previousResult.Address; + + results.Add(result); + } + } + } + + return results; + } + } +} diff --git a/ReClass.NET/Native/INativeMethods.cs b/ReClass.NET/Native/INativeMethods.cs new file mode 100644 index 00000000..cef87737 --- /dev/null +++ b/ReClass.NET/Native/INativeMethods.cs @@ -0,0 +1,94 @@ +using System; +using System.Diagnostics.Contracts; +using System.Drawing; + +namespace ReClassNET.Native +{ + [ContractClass(typeof(NativeMethodsContract))] + internal interface INativeMethods + { + IntPtr LoadLibrary(string fileName); + + IntPtr GetProcAddress(IntPtr handle, string name); + + void FreeLibrary(IntPtr handle); + + Icon GetIconForFile(string path); + + void EnableDebugPrivileges(); + + string UndecorateSymbolName(string name); + + void SetProcessDpiAwareness(); + + bool RegisterExtension(string fileExtension, string extensionId, string applicationPath, string applicationName); + + void UnregisterExtension(string fileExtension, string extensionId); + } + + [ContractClassFor(typeof(INativeMethods))] + internal abstract class NativeMethodsContract : INativeMethods + { + public IntPtr LoadLibrary(string fileName) + { + Contract.Requires(fileName != null); + + throw new NotImplementedException(); + } + + public IntPtr GetProcAddress(IntPtr handle, string name) + { + Contract.Requires(name != null); + + throw new NotImplementedException(); + } + + public void FreeLibrary(IntPtr handle) + { + throw new NotImplementedException(); + } + + public Icon GetIconForFile(string path) + { + Contract.Requires(path != null); + + throw new NotImplementedException(); + } + + public void EnableDebugPrivileges() + { + throw new NotImplementedException(); + } + + public string UndecorateSymbolName(string name) + { + Contract.Requires(name != null); + Contract.Ensures(Contract.Result() != null); + + throw new NotImplementedException(); + } + + public void SetProcessDpiAwareness() + { + throw new NotImplementedException(); + } + + public bool RegisterExtension(string fileExtension, string extensionId, string applicationPath, string applicationName) + { + Contract.Requires(!string.IsNullOrEmpty(fileExtension)); + Contract.Requires(!string.IsNullOrEmpty(extensionId)); + Contract.Requires(applicationPath != null); + Contract.Requires(applicationName != null); + + throw new NotImplementedException(); + } + + public void UnregisterExtension(string fileExtension, string extensionId) + { + Contract.Requires(!string.IsNullOrEmpty(fileExtension)); + Contract.Requires(!string.IsNullOrEmpty(extensionId)); + + throw new NotImplementedException(); + } + } +} diff --git a/ReClass.NET/Native/NativeMethods.Unix.cs b/ReClass.NET/Native/NativeMethods.Unix.cs new file mode 100644 index 00000000..c1b2e6c4 --- /dev/null +++ b/ReClass.NET/Native/NativeMethods.Unix.cs @@ -0,0 +1,72 @@ +using System; +using System.Drawing; +using System.Runtime.InteropServices; + +namespace ReClassNET.Native +{ + internal class NativeMethodsUnix : INativeMethods + { + #region Imports + + private const int RTLD_NOW = 2; + + [DllImport("__Internal")] + private static extern IntPtr dlopen(string fileName, int flags); + + [DllImport("__Internal")] + private static extern IntPtr dlsym(IntPtr handle, string symbol); + + [DllImport("__Internal")] + private static extern int dlclose(IntPtr handle); + + #endregion + + public IntPtr LoadLibrary(string fileName) + { + return dlopen(fileName, RTLD_NOW); + } + + public IntPtr GetProcAddress(IntPtr handle, string name) + { + // Warning: dlsym could return IntPtr.Zero to a valid function. + // Error checking with dlerror is needed but we treat IntPtr.Zero as error value... + + return dlsym(handle, name); + } + + public void FreeLibrary(IntPtr handle) + { + dlclose(handle); + } + + public Icon GetIconForFile(string path) + { + return null; + } + + public void EnableDebugPrivileges() + { + + } + + public string UndecorateSymbolName(string name) + { + return name; + } + + public void SetProcessDpiAwareness() + { + + } + + public bool RegisterExtension(string fileExtension, string extensionId, string applicationPath, string applicationName) + { + return false; + } + + public void UnregisterExtension(string fileExtension, string extensionId) + { + + } + } +} diff --git a/ReClass.NET/Native/NativeMethods.Windows.cs b/ReClass.NET/Native/NativeMethods.Windows.cs new file mode 100644 index 00000000..f27f9184 --- /dev/null +++ b/ReClass.NET/Native/NativeMethods.Windows.cs @@ -0,0 +1,272 @@ +using System; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Runtime.InteropServices; +using System.Security.Principal; +using System.Text; +using System.Windows.Forms; +using Microsoft.Win32; +using ReClassNET.Extensions; +using ReClassNET.Util; + +namespace ReClassNET.Native +{ + internal class NativeMethodsWindows : INativeMethods + { + #region Imports + + [DllImport("kernel32.dll", ExactSpelling = true)] + private static extern bool CloseHandle(IntPtr hObject); + + [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] + private static extern IntPtr LoadLibrary(string lpFileName); + + [DllImport("kernel32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)] + private static extern IntPtr GetProcAddress(IntPtr hModule, string lpProcName); + + [DllImport("kernel32.dll", ExactSpelling = true)] + private static extern bool FreeLibrary(IntPtr hModule); + + private const uint SHGFI_ICON = 0x100; + private const uint SHGFI_LARGEICON = 0x0; + private const uint SHGFI_SMALLICON = 0x1; + + [StructLayout(LayoutKind.Sequential)] + private struct SHFILEINFO + { + public IntPtr hIcon; + public IntPtr iIcon; + public uint dwAttributes; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + public string szDisplayName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] + public string szTypeName; + }; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct LUID + { + public uint LowPart; + public int HighPart; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + private struct TOKEN_PRIVILEGES + { + public uint PrivilegeCount; + public LUID Luid; + public uint Attributes; + } + + [DllImport("shell32.dll")] + private static extern IntPtr SHGetFileInfo(string pszPath, int dwFileAttributes, ref SHFILEINFO psfi, int cbSizeFileInfo, uint uFlags); + + [DllImport("user32.dll", ExactSpelling = true)] + private static extern int DestroyIcon(IntPtr hIcon); + + [DllImport("advapi32.dll", ExactSpelling = true)] + private static extern bool OpenProcessToken(IntPtr ProcessHandle, TokenAccessLevels DesiredAccess, out IntPtr TokenHandle); + + [DllImport("advapi32.dll", ExactSpelling = true)] + private static extern bool AdjustTokenPrivileges(IntPtr TokenHandle, [MarshalAs(UnmanagedType.Bool)]bool DisableAllPrivileges, ref TOKEN_PRIVILEGES NewState, uint Zero, IntPtr Null1, IntPtr Null2); + + [DllImport("dbghelp.dll", CharSet = CharSet.Unicode)] + private static extern int UnDecorateSymbolName(string DecoratedName, StringBuilder UnDecoratedName, int UndecoratedLength, int Flags); + + [DllImport("user32.dll")] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool SetProcessDPIAware(); + + private enum ProcessDpiAwareness : uint + { + Unaware = 0, + SystemAware = 1, + PerMonitorAware = 2 + } + + [DllImport("shcore.dll")] + private static extern int SetProcessDpiAwareness([MarshalAs(UnmanagedType.U4)] ProcessDpiAwareness a); + + [DllImport("shell32.dll")] + private static extern void SHChangeNotify(int wEventId, uint uFlags, IntPtr dwItem1, IntPtr dwItem2); + + private const int SHCNE_ASSOCCHANGED = 0x08000000; + private const uint SHCNF_IDLIST = 0x0000; + + [DllImport("user32.dll")] + private static extern IntPtr SendMessage(IntPtr hWnd, int nMsg, IntPtr wParam, IntPtr lParam); + + private const int BCM_SETSHIELD = 0x160C; + + #endregion + + IntPtr INativeMethods.LoadLibrary(string fileName) + { + return LoadLibrary(fileName); + } + + IntPtr INativeMethods.GetProcAddress(IntPtr handle, string name) + { + return GetProcAddress(handle, name); + } + + void INativeMethods.FreeLibrary(IntPtr handle) + { + FreeLibrary(handle); + } + + public Icon GetIconForFile(string path) + { + var shinfo = new SHFILEINFO(); + if (!SHGetFileInfo(path, 0, ref shinfo, Marshal.SizeOf(shinfo), SHGFI_ICON | SHGFI_SMALLICON).IsNull()) + { + var icon = Icon.FromHandle(shinfo.hIcon).Clone() as Icon; + DestroyIcon(shinfo.hIcon); + return icon; + } + + return null; + } + + public void EnableDebugPrivileges() + { + if (OpenProcessToken(System.Diagnostics.Process.GetCurrentProcess().Handle, TokenAccessLevels.AllAccess, out var token)) + { + var privileges = new TOKEN_PRIVILEGES + { + PrivilegeCount = 1, + Luid = + { + LowPart = 0x14, + HighPart = 0 + }, + Attributes = 2 + }; + + AdjustTokenPrivileges(token, false, ref privileges, 0, IntPtr.Zero, IntPtr.Zero); + + CloseHandle(token); + } + } + + public string UndecorateSymbolName(string name) + { + var sb = new StringBuilder(255); + if (UnDecorateSymbolName(name, sb, sb.Capacity, /*UNDNAME_NAME_ONLY*/0x1000) != 0) + { + return sb.ToString(); + } + return name; + } + + public void SetProcessDpiAwareness() + { + if (WinUtil.IsAtLeastWindows10) + { + SetProcessDpiAwareness(ProcessDpiAwareness.SystemAware); + } + else if (WinUtil.IsAtLeastWindowsVista) + { + SetProcessDPIAware(); + } + } + + public bool RegisterExtension(string fileExtension, string extensionId, string applicationPath, string applicationName) + { + try + { + var classesRoot = Registry.ClassesRoot; + + using (var fileExtensionKey = classesRoot.CreateSubKey(fileExtension)) + { + fileExtensionKey?.SetValue(string.Empty, extensionId, RegistryValueKind.String); + } + + using (var extensionInfoKey = classesRoot.CreateSubKey(extensionId)) + { + extensionInfoKey?.SetValue(string.Empty, applicationName, RegistryValueKind.String); + + using (var icon = extensionInfoKey?.CreateSubKey("DefaultIcon")) + { + icon?.SetValue(string.Empty, "\"" + applicationPath + "\",0", RegistryValueKind.String); + } + + using (var shellKey = extensionInfoKey?.CreateSubKey("shell")) + { + using (var openKey = shellKey?.CreateSubKey("open")) + { + openKey?.SetValue(string.Empty, $"&Open with {applicationName}", RegistryValueKind.String); + + using (var commandKey = openKey?.CreateSubKey("command")) + { + commandKey?.SetValue(string.Empty, $"\"{applicationPath}\" \"%1\"", RegistryValueKind.String); + } + } + } + } + + ShChangeNotify(); + + return true; + } + catch (Exception) + { + return false; + } + } + + public void UnregisterExtension(string fileExtension, string extensionId) + { + try + { + var classesRoot = Registry.ClassesRoot; + + classesRoot.DeleteSubKeyTree(fileExtension); + classesRoot.DeleteSubKeyTree(extensionId); + + ShChangeNotify(); + } + catch + { + // ignored + } + } + + private static void ShChangeNotify() + { + try + { + SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero); + } + catch + { + // ignored + } + } + + public static void SetButtonShield(Button button, bool setShield) + { + Contract.Requires(button != null); + + try + { + if (button.FlatStyle != FlatStyle.System) + { + button.FlatStyle = FlatStyle.System; + } + + var h = button.Handle; + if (h == IntPtr.Zero) + { + return; + } + + SendMessage(h, BCM_SETSHIELD, IntPtr.Zero, (IntPtr)(setShield ? 1 : 0)); + } + catch + { + // ignored + } + } + } +} diff --git a/ReClass.NET/Native/NativeMethods.cs b/ReClass.NET/Native/NativeMethods.cs new file mode 100644 index 00000000..397fc38b --- /dev/null +++ b/ReClass.NET/Native/NativeMethods.cs @@ -0,0 +1,115 @@ +using System; +using System.Diagnostics.Contracts; +using System.Drawing; + +namespace ReClassNET.Native +{ + public static class NativeMethods + { + private static readonly INativeMethods nativeMethods; + + static NativeMethods() + { + if (IsUnix()) + { + nativeMethods = new NativeMethodsUnix(); + } + else + { + nativeMethods = new NativeMethodsWindows(); + } + } + + private static bool? isUnix; + public static bool IsUnix() + { + if (isUnix.HasValue) + { + return isUnix.Value; + } + + var p = GetPlatformId(); + + isUnix = (p == PlatformID.Unix) || (p == PlatformID.MacOSX) || ((int)p == 128); + + return isUnix.Value; + } + + private static PlatformID? plattformId; + public static PlatformID GetPlatformId() + { + if (plattformId.HasValue) + { + return plattformId.Value; + } + + plattformId = Environment.OSVersion.Platform; + + // TODO: Mono returns PlatformID.Unix on Mac OS X + + return plattformId.Value; + } + + public static IntPtr LoadLibrary(string name) + { + Contract.Requires(name != null); + + return nativeMethods.LoadLibrary(name); + } + + public static IntPtr GetProcAddress(IntPtr handle, string name) + { + Contract.Requires(name != null); + + return nativeMethods.GetProcAddress(handle, name); + } + + public static void FreeLibrary(IntPtr handle) + { + nativeMethods.FreeLibrary(handle); + } + + public static Icon GetIconForFile(string path) + { + Contract.Requires(path != null); + + return nativeMethods.GetIconForFile(path); + } + + public static void EnableDebugPrivileges() + { + nativeMethods.EnableDebugPrivileges(); + } + + public static string UndecorateSymbolName(string name) + { + Contract.Requires(name != null); + Contract.Ensures(Contract.Result() != null); + + return nativeMethods.UndecorateSymbolName(name); + } + + public static void SetProcessDpiAwareness() + { + nativeMethods.SetProcessDpiAwareness(); + } + + public static bool RegisterExtension(string fileExtension, string extensionId, string applicationPath, string applicationName) + { + Contract.Requires(!string.IsNullOrEmpty(fileExtension)); + Contract.Requires(!string.IsNullOrEmpty(extensionId)); + Contract.Requires(applicationPath != null); + Contract.Requires(applicationName != null); + + return nativeMethods.RegisterExtension(fileExtension, extensionId, applicationPath, applicationName); + } + + public static void UnregisterExtension(string fileExtension, string extensionId) + { + Contract.Requires(!string.IsNullOrEmpty(fileExtension)); + Contract.Requires(!string.IsNullOrEmpty(extensionId)); + + nativeMethods.UnregisterExtension(fileExtension, extensionId); + } + } +} diff --git a/ReClass.NET/Nodes/ArrayNode.cs b/ReClass.NET/Nodes/ArrayNode.cs new file mode 100644 index 00000000..4a0fbec3 --- /dev/null +++ b/ReClass.NET/Nodes/ArrayNode.cs @@ -0,0 +1,40 @@ +using System; +using System.Drawing; +using ReClassNET.Controls; + +namespace ReClassNET.Nodes +{ + public class ArrayNode : BaseWrapperArrayNode + { + public ArrayNode() + { + IsReadOnly = false; + } + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Array"; + icon = Properties.Resources.B16x16_Button_Array; + } + + public override void Initialize() + { + ChangeInnerNode(IntPtr.Size == 4 ? (BaseNode)new Hex32Node() : new Hex64Node()); + } + + public override Size Draw(DrawContext context, int x, int y) + { + return Draw(context, x, y, "Array"); + } + + protected override Size DrawChild(DrawContext context, int x, int y) + { + var innerContext = context.Clone(); + innerContext.Address = context.Address + Offset + InnerNode.MemorySize * CurrentIndex; + innerContext.Memory = context.Memory.Clone(); + innerContext.Memory.Offset += Offset + InnerNode.MemorySize * CurrentIndex; + + return InnerNode.Draw(innerContext, x, y); + } + } +} diff --git a/ReClass.NET/Nodes/BaseClassWrapperNode.cs b/ReClass.NET/Nodes/BaseClassWrapperNode.cs new file mode 100644 index 00000000..aa50aaba --- /dev/null +++ b/ReClass.NET/Nodes/BaseClassWrapperNode.cs @@ -0,0 +1,18 @@ +namespace ReClassNET.Nodes +{ + public abstract class BaseClassWrapperNode : BaseWrapperNode + { + public override void Initialize() + { + var node = ClassNode.Create(); + node.Initialize(); + + ChangeInnerNode(node); + } + + public override bool CanChangeInnerNodeTo(BaseNode node) + { + return node is ClassNode; + } + } +} diff --git a/ReClass.NET/Nodes/BaseContainerNode.cs b/ReClass.NET/Nodes/BaseContainerNode.cs new file mode 100644 index 00000000..6926111f --- /dev/null +++ b/ReClass.NET/Nodes/BaseContainerNode.cs @@ -0,0 +1,365 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; + +namespace ReClassNET.Nodes +{ + public abstract class BaseContainerNode : BaseNode + { + private readonly List nodes = new List(); + + private int updateCount; + + /// The child nodes of the container. + public IReadOnlyList Nodes => nodes; + + /// + /// If true and the size of replaced nodes differs, the gap will be padded with default nodes (see ). + /// + protected abstract bool ShouldCompensateSizeChanges { get; } + + /// + /// Should be called before adding a child to test if the container can handle the node type. + /// + /// The new child node. + /// True if the container can handle the child node or false otherwise. + public abstract bool CanHandleChildNode(BaseNode node); + + private void CheckCanHandleChildNode(BaseNode node) + { + if (!CanHandleChildNode(node)) + { + throw new ArgumentException(); + } + } + + public override void ClearSelection() + { + base.ClearSelection(); + + foreach (var node in Nodes) + { + node.ClearSelection(); + } + } + + /// Calculates the offset of every child node. + public virtual void UpdateOffsets() + { + var offset = 0; + foreach (var node in Nodes) + { + node.Offset = offset; + offset += node.MemorySize; + } + } + + /// Searches for the node and returns the zero based index. + /// The node to search. + /// The found node index or -1 if the node was not found. + public int FindNodeIndex(BaseNode node) + { + Contract.Requires(node != null); + Contract.Ensures(Contract.Result() >= -1 && Contract.Result() < nodes.Count); + + return nodes.FindIndex(n => n == node); + } + + /// + /// Checks if the node exists in the container. + /// + /// The node to search. + /// True if the node exists in the container, false otherwise. + public bool ContainsNode(BaseNode node) + { + return FindNodeIndex(node) != -1; + } + + /// + /// Tries to get the predecessor of the given node in the container. + /// + /// The root node. + /// The predecessor of the given node. + /// True if a predecessor exists, otherwise false. + public bool TryGetPredecessor(BaseNode node, out BaseNode predecessor) + { + Contract.Requires(node != null); + + return TryGetNeighbour(node, -1, out predecessor); + } + + /// + /// Tries to get the successor of the given node in the container. + /// + /// The root node. + /// The successor of the given node. + /// True if a successor exists, otherwise false. + public bool TryGetSuccessor(BaseNode node, out BaseNode successor) + { + Contract.Requires(node != null); + + return TryGetNeighbour(node, 1, out successor); + } + + private bool TryGetNeighbour(BaseNode node, int offset, out BaseNode neighbour) + { + Contract.Requires(node != null); + + neighbour = null; + + var index = FindNodeIndex(node); + if (index == -1) + { + return false; + } + + var neighbourIndex = index + offset; + if (neighbourIndex < 0 || neighbourIndex >= nodes.Count) + { + return false; + } + + neighbour = nodes[neighbourIndex]; + + return true; + } + + /// + /// Disables internal events to speed up batch processing. + /// must be called to restore the functionality. + /// + public void BeginUpdate() + { + updateCount++; + } + + /// + /// Enables internal events disabled by . + /// + public void EndUpdate() + { + updateCount = Math.Max(0, updateCount - 1); + + OnNodesUpdated(); + } + + private void OnNodesUpdated() + { + if (updateCount == 0) + { + UpdateOffsets(); + + GetParentContainer()?.ChildHasChanged(this); + } + } + + /// Replaces the old node with the new node. + /// The old node to replacce. + /// The new node. + public void ReplaceChildNode(BaseNode oldNode, BaseNode newNode) + { + Contract.Requires(oldNode != null); + Contract.Requires(newNode != null); + + List dummy = null; + ReplaceChildNode(oldNode, newNode, ref dummy); + } + + /// Replaces the old node with the new node. + /// The old node to replacce. + /// The new node. + /// [out] A list for additional created nodes (see ) or null if not needed. + public void ReplaceChildNode(BaseNode oldNode, BaseNode newNode, ref List additionalCreatedNodes) + { + Contract.Requires(oldNode != null); + Contract.Requires(newNode != null); + + CheckCanHandleChildNode(newNode); + + var index = FindNodeIndex(oldNode); + if (index == -1) + { + throw new ArgumentException($"Node {oldNode} is not a child of {this}."); + } + + newNode.CopyFromNode(oldNode); + + newNode.ParentNode = this; + + nodes[index] = newNode; + + if (ShouldCompensateSizeChanges) + { + var oldSize = oldNode.MemorySize; + var newSize = newNode.MemorySize; + + if (newSize < oldSize) + { + InsertBytes(index + 1, oldSize - newSize, ref additionalCreatedNodes); + } + /*else if (newSize > oldSize) + { + RemoveNodes(index + 1, newSize - oldSize); + }*/ + } + + OnNodesUpdated(); + } + + /// + /// Creates the default container node which takes up to bytes. + /// + /// The maximum size in bytes. + /// A new node or null if no node is available for this size. + protected virtual BaseNode CreateDefaultNodeForSize(int size) + { + Contract.Requires(size > 0); + +#if RECLASSNET64 + if (size >= 8) + { + return new Hex64Node(); + } +#endif + if (size >= 4) + { + return new Hex32Node(); + } + if (size >= 2) + { + return new Hex16Node(); + } + + return new Hex8Node(); + } + + /// Adds the specific amount of bytes at the end of the node. + /// The number of bytes to insert. + public void AddBytes(int size) + { + List dummy = null; + InsertBytes(nodes.Count, size, ref dummy); + } + + public void InsertBytes(BaseNode position, int size) + { + List dummy = null; + InsertBytes(FindNodeIndex(position), size, ref dummy); + } + + /// Inserts bytes at the specified position. + /// Zero-based position. + /// The number of bytes to insert. + /// [out] A list with the created nodes. + protected void InsertBytes(int index, int size, ref List createdNodes) + { + if (index < 0 || index > nodes.Count) + { + throw new ArgumentOutOfRangeException($"The index {index} is not in the range [0, {nodes.Count}]."); + } + + if (size == 0) + { + return; + } + + while (size > 0) + { + var node = CreateDefaultNodeForSize(size); + if (node == null) + { + break; + } + + node.ParentNode = this; + + nodes.Insert(index, node); + + createdNodes?.Add(node); + + size -= node.MemorySize; + + index++; + } + + OnNodesUpdated(); + } + + /// + /// Adds all nodes at the end of the container. + /// + /// The nodes to add. + public void AddNodes(IEnumerable nodes) + { + Contract.Requires(nodes != null); + + foreach (var node in nodes) + { + AddNode(node); + } + } + + /// + /// Adds the node at the end of the container. + /// + /// The node to add. + public void AddNode(BaseNode node) + { + Contract.Requires(node != null); + + CheckCanHandleChildNode(node); + + node.ParentNode = this; + + nodes.Add(node); + + OnNodesUpdated(); + } + + /// + /// Inserts the node infront of the node. + /// + /// The target node. + /// The node to insert. + public void InsertNode(BaseNode position, BaseNode node) + { + Contract.Requires(node != null); + + CheckCanHandleChildNode(node); + + var index = FindNodeIndex(position); + if (index == -1) + { + throw new ArgumentException(); + } + + node.ParentNode = this; + + nodes.Insert(index, node); + + OnNodesUpdated(); + } + + /// Removes the specified node. + /// The node to remove. + /// True if it succeeds, false if it fails. + public bool RemoveNode(BaseNode node) + { + Contract.Requires(node != null); + + var result = nodes.Remove(node); + if (result) + { + OnNodesUpdated(); + } + return result; + } + + /// Called by a child if it has changed. + /// The child. + protected internal virtual void ChildHasChanged(BaseNode child) + { + // TODO Add BaseNode.GetParentContainer + } + } +} diff --git a/ReClass.NET/Nodes/BaseFunctionNode.cs b/ReClass.NET/Nodes/BaseFunctionNode.cs new file mode 100644 index 00000000..8e143585 --- /dev/null +++ b/ReClass.NET/Nodes/BaseFunctionNode.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Linq; +using ReClassNET.Controls; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public abstract class BaseFunctionNode : BaseNode + { + protected class FunctionNodeInstruction + { + public string Address { get; set; } + public string Data { get; set; } + public string Instruction { get; set; } + } + + protected IntPtr Address = IntPtr.Zero; + protected readonly List Instructions = new List(); + + protected Size DrawInstructions(DrawContext view, int tx, int y) + { + Contract.Requires(view != null); + + var origY = y; + + var minWidth = 26 * view.Font.Width; + var maxWidth = 0; + + using (var brush = new SolidBrush(view.Settings.HiddenColor)) + { + foreach (var instruction in Instructions) + { + y += view.Font.Height; + + var x = AddText(view, tx, y, view.Settings.AddressColor, HotSpot.ReadOnlyId, instruction.Address) + 6; + + view.Graphics.FillRectangle(brush, x, y, 1, view.Font.Height); + x += 6; + + x = Math.Max(AddText(view, x, y, view.Settings.HexColor, HotSpot.ReadOnlyId, instruction.Data) + 6, x + minWidth); + + view.Graphics.FillRectangle(brush, x, y, 1, view.Font.Height); + x += 6; + + x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.ReadOnlyId, instruction.Instruction); + + maxWidth = Math.Max(x - tx, maxWidth); + } + } + + return new Size(maxWidth, y - origY); + } + + protected void DisassembleRemoteCode(RemoteProcess process, IntPtr address, out int memorySize) + { + Contract.Requires(process != null); + + memorySize = 0; + + var disassembler = new Disassembler(process.CoreFunctions); + foreach (var instruction in disassembler.RemoteDisassembleFunction(process, address, 8192)) + { + memorySize += instruction.Length; + + Instructions.Add(new FunctionNodeInstruction + { + Address = instruction.Address.ToString(Constants.AddressHexFormat), + Data = string.Join(" ", instruction.Data.Take(instruction.Length).Select(b => $"{b:X2}")), + Instruction = instruction.Instruction + }); + } + } + } +} diff --git a/ReClass.NET/Nodes/BaseFunctionPtrNode.cs b/ReClass.NET/Nodes/BaseFunctionPtrNode.cs new file mode 100644 index 00000000..4fd73a2c --- /dev/null +++ b/ReClass.NET/Nodes/BaseFunctionPtrNode.cs @@ -0,0 +1,127 @@ +using System; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Linq; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public abstract class BaseFunctionPtrNode : BaseFunctionNode + { + public override int MemorySize => IntPtr.Size; + + public override string GetToolTipText(HotSpot spot) + { + var ptr = spot.Memory.ReadIntPtr(Offset); + + DisassembleRemoteCode(spot.Process, ptr); + + return string.Join("\n", Instructions.Select(i => i.Instruction)); + } + + protected Size Draw(DrawContext context, int x, int y, string type, string name) + { + Contract.Requires(context != null); + Contract.Requires(type != null); + Contract.Requires(name != null); + + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + + AddSelection(context, x, y, context.Font.Height); + + x = AddIconPadding(context, x); + + x = AddIcon(context, x, y, context.IconProvider.Function, HotSpot.NoneId, HotSpotType.None); + + var tx = x; + + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, name) + context.Font.Width; + } + + x = AddOpenCloseIcon(context, x, y) + context.Font.Width; + + x = AddComment(context, x, y); + + if (context.Settings.ShowCommentSymbol) + { + var value = context.Memory.ReadIntPtr(Offset); + + var module = context.Process.GetModuleToPointer(value); + if (module != null) + { + var symbols = context.Process.Symbols.GetSymbolsForModule(module); + var symbol = symbols?.GetSymbolString(value, module); + if (!string.IsNullOrEmpty(symbol)) + { + x = AddText(context, x, y, context.Settings.OffsetColor, HotSpot.ReadOnlyId, symbol); + } + } + } + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + var size = new Size(x - origX, context.Font.Height); + + if (LevelsOpen[context.Level]) + { + var ptr = context.Memory.ReadIntPtr(Offset); + + DisassembleRemoteCode(context.Process, ptr); + + var instructionSize = DrawInstructions(context, tx, y); + + size.Width = Math.Max(size.Width, instructionSize.Width + tx - origX); + size.Height += instructionSize.Height; + } + + return size; + } + + public override int CalculateDrawnHeight(DrawContext context) + { + if (IsHidden) + { + return HiddenHeight; + } + + var height = context.Font.Height; + if (LevelsOpen[context.Level]) + { + height += Instructions.Count * context.Font.Height; + } + return height; + } + + private void DisassembleRemoteCode(RemoteProcess process, IntPtr address) + { + Contract.Requires(process != null); + + if (this.Address != address) + { + Instructions.Clear(); + + this.Address = address; + + if (!address.IsNull() && process.IsValid) + { + DisassembleRemoteCode(process, address, out _); + } + } + } + } +} diff --git a/ReClass.NET/Nodes/BaseHexCommentNode.cs b/ReClass.NET/Nodes/BaseHexCommentNode.cs new file mode 100644 index 00000000..f2a4053f --- /dev/null +++ b/ReClass.NET/Nodes/BaseHexCommentNode.cs @@ -0,0 +1,114 @@ +using System; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Text; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public abstract class BaseHexCommentNode : BaseHexNode + { + protected int AddComment(DrawContext view, int x, int y, float fvalue, IntPtr ivalue, UIntPtr uvalue) + { + Contract.Requires(view != null); + + if (view.Settings.ShowCommentFloat) + { + x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.ReadOnlyId, fvalue > -999999.0f && fvalue < 999999.0f ? fvalue.ToString("0.000") : "#####") + view.Font.Width; + } + if (view.Settings.ShowCommentInteger) + { + if (ivalue == IntPtr.Zero) + { + x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.ReadOnlyId, "0") + view.Font.Width; + } + else + { + x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.ReadOnlyId, ivalue.ToInt64().ToString()) + view.Font.Width; + x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.ReadOnlyId, $"0x{uvalue.ToUInt64():X}") + view.Font.Width; + } + } + + if (ivalue != IntPtr.Zero) + { + var namedAddress = view.Process.GetNamedAddress(ivalue); + if (!string.IsNullOrEmpty(namedAddress)) + { + if (view.Settings.ShowCommentPointer) + { + x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.NoneId, "->") + view.Font.Width; + x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.ReadOnlyId, namedAddress) + view.Font.Width; + } + + if (view.Settings.ShowCommentRtti) + { + var rtti = view.Process.ReadRemoteRuntimeTypeInformation(ivalue); + if (!string.IsNullOrEmpty(rtti)) + { + x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.ReadOnlyId, rtti) + view.Font.Width; + } + } + + if (view.Settings.ShowCommentSymbol) + { + var module = view.Process.GetModuleToPointer(ivalue); + if (module != null) + { + var symbols = view.Process.Symbols.GetSymbolsForModule(module); + var symbol = symbols?.GetSymbolString(ivalue, module); + if (!string.IsNullOrEmpty(symbol)) + { + x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.ReadOnlyId, symbol) + view.Font.Width; + } + } + } + + if (view.Settings.ShowCommentString) + { + var data = view.Process.ReadRemoteMemory(ivalue, 64); + + var isWideString = false; + string text = null; + + // First check if it could be an UTF8 string and if not try UTF16. + if (data.Take(IntPtr.Size).InterpretAsSingleByteCharacter().IsPrintableData()) + { + text = new string(Encoding.UTF8.GetChars(data).TakeWhile(c => c != 0).ToArray()); + } + else if (data.Take(IntPtr.Size * 2).InterpretAsDoubleByteCharacter().IsPrintableData()) + { + isWideString = true; + + text = new string(Encoding.Unicode.GetChars(data).TakeWhile(c => c != 0).ToArray()); + } + + if (text != null) + { + x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, isWideString ? "L'" : "'"); + x = AddText(view, x, y, view.Settings.TextColor, HotSpot.ReadOnlyId, text); + x = AddText(view, x, y, view.Settings.TextColor, HotSpot.NoneId, "'") + view.Font.Width; + } + } + + if (view.Settings.ShowCommentPluginInfo) + { + var nodeAddress = view.Address + Offset; + + foreach (var reader in NodeInfoReader) + { + var info = reader.ReadNodeInfo(this, view.Process, view.Memory, nodeAddress, ivalue); + if (info != null) + { + x = AddText(view, x, y, view.Settings.PluginColor, HotSpot.ReadOnlyId, info) + view.Font.Width; + } + } + } + } + } + + return x; + } + } +} diff --git a/ReClass.NET/Nodes/BaseHexNode.cs b/ReClass.NET/Nodes/BaseHexNode.cs new file mode 100644 index 00000000..060db7da --- /dev/null +++ b/ReClass.NET/Nodes/BaseHexNode.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Globalization; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; +using ReClassNET.Util; + +namespace ReClassNET.Nodes +{ + public abstract class BaseHexNode : BaseNode + { + private static readonly Random highlightRandom = new Random(); + private static readonly Color[] highlightColors = { + Color.Aqua, Color.Aquamarine, Color.Blue, Color.BlueViolet, Color.Chartreuse, Color.Crimson, Color.LawnGreen, Color.Magenta + }; + private static Color GetRandomHighlightColor() => highlightColors[highlightRandom.Next(highlightColors.Length)]; + + private static readonly TimeSpan hightlightDuration = TimeSpan.FromSeconds(1); + + private static readonly Dictionary> highlightTimer = new Dictionary>(); + + private readonly byte[] buffer; + + protected BaseHexNode() + { + Contract.Ensures(buffer != null); + + buffer = new byte[MemorySize]; + } + + protected Size Draw(DrawContext context, int x, int y, string text, int length) + { + Contract.Requires(context != null); + + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + + AddSelection(context, x, y, context.Font.Height); + + x = AddIconPadding(context, x); + x = AddIconPadding(context, x); + + x = AddAddressOffset(context, x, y); + + if (!string.IsNullOrEmpty(text)) + { + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, text); + } + + context.Memory.ReadBytes(Offset, buffer); + + var color = context.Settings.HexColor; + if (context.Settings.HighlightChangedValues) + { + var address = context.Address + Offset; + + highlightTimer.RemoveWhere(kv => kv.Value.Value < context.CurrentTime); + + if (highlightTimer.TryGetValue(address, out var until)) + { + if (until.Value >= context.CurrentTime) + { + color = GetRandomHighlightColor(); + + if (context.Memory.HasChanged(Offset, MemorySize)) + { + until.Value = context.CurrentTime.Add(hightlightDuration); + } + } + } + else if (context.Memory.HasChanged(Offset, MemorySize)) + { + highlightTimer.Add(address, context.CurrentTime.Add(hightlightDuration)); + + color = GetRandomHighlightColor(); + } + } + + for (var i = 0; i < length; ++i) + { + x = AddText(context, x, y, color, i, $"{buffer[i]:X02}") + context.Font.Width; + } + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + return new Size(x - origX, context.Font.Height); + } + + public override int CalculateDrawnHeight(DrawContext context) + { + return IsHidden && !IsWrapped ? HiddenHeight : context.Font.Height; + } + + /// Updates the node from the given spot. Sets the value of the selected byte. + /// The spot. + /// The highest spot id. + public void Update(HotSpot spot, int maxId) + { + Contract.Requires(spot != null); + + base.Update(spot); + + if (spot.Id >= 0 && spot.Id < maxId) + { + if (byte.TryParse(spot.Text, NumberStyles.HexNumber, null, out var val)) + { + spot.Process.WriteRemoteMemory(spot.Address + spot.Id, val); + } + } + } + + public byte[] ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadBytes(Offset, MemorySize); + } + } +} diff --git a/ReClass.NET/Nodes/BaseMatrixNode.cs b/ReClass.NET/Nodes/BaseMatrixNode.cs new file mode 100644 index 00000000..84929c5e --- /dev/null +++ b/ReClass.NET/Nodes/BaseMatrixNode.cs @@ -0,0 +1,176 @@ +using System; +using System.Diagnostics.Contracts; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public abstract class BaseMatrixNode : BaseNode + { + /// Size of the value type in bytes. + public abstract int ValueTypeSize { get; } + + protected BaseMatrixNode() + { + LevelsOpen.DefaultValue = true; + } + + protected delegate void DrawMatrixValues(int x, ref int maxX, ref int y); + + protected Size DrawMatrixType(DrawContext context, int x, int y, string type, int rows, int columns) + { + Contract.Requires(context != null); + Contract.Requires(type != null); + + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + var origY = y; + + AddSelection(context, x, y, context.Font.Height); + + x = AddIconPadding(context, x); + + x = AddIcon(context, x, y, context.IconProvider.Matrix, HotSpot.NoneId, HotSpotType.None); + + var tx = x; + + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name); + } + x = AddOpenCloseIcon(context, x, y); + + x += context.Font.Width; + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + if (LevelsOpen[context.Level]) + { + var index = 0; + for (var row = 0; row < rows; ++row) + { + y += context.Font.Height; + var x2 = tx; + + x2 = AddText(context, x2, y, context.Settings.NameColor, HotSpot.NoneId, "|"); + + for (var column = 0; column < columns; ++column) + { + var value = context.Memory.ReadFloat(Offset + index * sizeof(float)); + x2 = AddText(context, x2, y, context.Settings.ValueColor, index, $"{value,14:0.000}"); + + index++; + } + + x2 = AddText(context, x2, y, context.Settings.NameColor, HotSpot.NoneId, "|"); + + x = Math.Max(x2, x); + } + } + + return new Size(x - origX, y - origY + context.Font.Height); + } + + protected delegate void DrawVectorValues(ref int x, ref int y); + protected Size DrawVectorType(DrawContext context, int x, int y, string type, int columns) + { + Contract.Requires(context != null); + Contract.Requires(type != null); + + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + DrawInvalidMemoryIndicatorIcon(context, y); + + var origX = x; + var origY = y; + + AddSelection(context, x, y, context.Font.Height); + + x = AddIconPadding(context, x); + + x = AddIcon(context, x, y, context.IconProvider.Vector, HotSpot.NoneId, HotSpotType.None); + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name); + } + x = AddOpenCloseIcon(context, x, y); + + if (LevelsOpen[context.Level]) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NoneId, "("); + for (var column = 0; column < columns; ++column) + { + var value = context.Memory.ReadFloat(Offset + column * sizeof(float)); + + x = AddText(context, x, y, context.Settings.ValueColor, column, $"{value:0.000}"); + + if (column < columns - 1) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NoneId, ","); + } + } + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NoneId, ")"); + } + + x += context.Font.Width; + + x = AddComment(context, x, y); + + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + return new Size(x - origX, y - origY + context.Font.Height); + } + + public override int CalculateDrawnHeight(DrawContext context) + { + if (IsHidden && !IsWrapped) + { + return HiddenHeight; + } + + var height = context.Font.Height; + if (LevelsOpen[context.Level]) + { + height += CalculateValuesHeight(context); + } + return height; + } + + protected abstract int CalculateValuesHeight(DrawContext context); + + public void Update(HotSpot spot, int max) + { + Contract.Requires(spot != null); + + base.Update(spot); + + if (spot.Id >= 0 && spot.Id < max) + { + if (float.TryParse(spot.Text, out var val)) + { + spot.Process.WriteRemoteMemory(spot.Address + spot.Id * ValueTypeSize, val); + } + } + } + } +} diff --git a/ReClass.NET/Nodes/BaseNode.cs b/ReClass.NET/Nodes/BaseNode.cs new file mode 100644 index 00000000..adef39e5 --- /dev/null +++ b/ReClass.NET/Nodes/BaseNode.cs @@ -0,0 +1,552 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.Contracts; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.UI; +using ReClassNET.Util; + +namespace ReClassNET.Nodes +{ + public delegate void NodeEventHandler(BaseNode sender); + + [DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")] + [ContractClass(typeof(BaseNodeContract))] + public abstract class BaseNode + { + private string DebuggerDisplay => $"Type: {GetType().Name} Name: {Name} Offset: 0x{Offset:X}"; + + internal static readonly List NodeInfoReader = new List(); + + protected static readonly int HiddenHeight = 0; + + private static int nodeIndex = 0; + + private string name = string.Empty; + private string comment = string.Empty; + + /// Gets or sets the offset of the node. + public int Offset { get; set; } + + /// Gets or sets the name of the node. If a new name was set the property changed event gets fired. + public virtual string Name { get => name; set { if (value != null && name != value) { name = value; NameChanged?.Invoke(this); } } } + + /// Gets or sets the comment of the node. + public string Comment { get => comment; set { if (value != null && comment != value) { comment = value; CommentChanged?.Invoke(this); } } } + + /// Gets or sets the parent node. + public BaseNode ParentNode { get; internal set; } + + /// Gets a value indicating whether this node is wrapped into an other node. + public bool IsWrapped => ParentNode is BaseWrapperNode; + + /// Gets or sets a value indicating whether this node is hidden. + public bool IsHidden { get; set; } + + /// Gets or sets a value indicating whether this node is selected. + public bool IsSelected { get; set; } + + /// Size of the node in bytes. + public abstract int MemorySize { get; } + + public event NodeEventHandler NameChanged; + public event NodeEventHandler CommentChanged; + + protected GrowingList LevelsOpen { get; } = new GrowingList(false); + + [ContractInvariantMethod] + private void ObjectInvariants() + { + Contract.Invariant(name != null); + Contract.Invariant(comment != null); + Contract.Invariant(Offset >= 0); + Contract.Invariant(LevelsOpen != null); + } + + /// + /// Creates an instance of the specific node type. + /// + /// The of the node. + /// An instance of the node type or null if the type is not a valid node type. + public static BaseNode CreateInstanceFromType(Type nodeType) + { + return CreateInstanceFromType(nodeType, true); + } + + /// + /// Creates an instance of the specific node type. + /// + /// The of the node. + /// If true gets called for the new node. + /// An instance of the node type or null if the type is not a valid node type. + public static BaseNode CreateInstanceFromType(Type nodeType, bool callInitialize) + { + var node = Activator.CreateInstance(nodeType) as BaseNode; + if (callInitialize) + { + node?.Initialize(); + } + return node; + } + + /// Constructor which sets a unique . + protected BaseNode() + { + Contract.Ensures(name != null); + Contract.Ensures(comment != null); + + Name = $"N{nodeIndex++:X08}"; + Comment = string.Empty; + + LevelsOpen[0] = true; + } + + public abstract void GetUserInterfaceInfo(out string name, out Image icon); + + public virtual bool UseMemoryPreviewToolTip(HotSpot spot, out IntPtr address) + { + Contract.Requires(spot != null); + + address = IntPtr.Zero; + + return false; + } + + /// Gets informations about this node to show in a tool tip. + /// The spot. + /// The information to show in a tool tip or null if no information should be shown. + public virtual string GetToolTipText(HotSpot spot) + { + Contract.Requires(spot != null); + + return null; + } + + /// Called when the node was created. Does not get called after loading a project. + public virtual void Initialize() + { + + } + + /// Initializes this object from the given node. It copies the name and the comment. + /// The node to copy from. + public virtual void CopyFromNode(BaseNode node) + { + Contract.Requires(node != null); + + Name = node.Name; + Comment = node.Comment; + Offset = node.Offset; + } + + /// + /// Gets the parent container of the node. + /// + /// + public BaseContainerNode GetParentContainer() + { + var parentNode = ParentNode; + while (parentNode != null) + { + if (parentNode is BaseContainerNode containerNode) + { + return containerNode; + } + + parentNode = parentNode.ParentNode; + } + + if (this is BaseContainerNode containerNode2) + { + return containerNode2; + } + + return null; + } + + /// + /// Gets the parent class of the node. + /// + /// + public ClassNode GetParentClass() + { + var parentNode = ParentNode; + while (parentNode != null) + { + if (parentNode is ClassNode classNode) + { + return classNode; + } + + parentNode = parentNode.ParentNode; + } + + return null; + } + + /// + /// Gets the root wrapper node if this node is the inner node of a wrapper chain. + /// + /// The root or null if this node is not wrapped or isn't itself a wrapper node. + public BaseWrapperNode GetRootWrapperNode() + { + BaseWrapperNode rootWrapperNode = null; + + var parentNode = ParentNode; + while (parentNode is BaseWrapperNode wrapperNode) + { + rootWrapperNode = wrapperNode; + + parentNode = parentNode.ParentNode; + } + + // Test if this node is the root wrapper node. + if (rootWrapperNode == null) + { + if (this is BaseWrapperNode wrapperNode) + { + return wrapperNode; + } + } + + return rootWrapperNode; + } + + /// Clears the selection of the node. + public virtual void ClearSelection() + { + IsSelected = false; + } + + /// Draws the node. + /// The drawing context. + /// The x coordinate. + /// The y coordinate. + /// The pixel size the node occupies. + public abstract Size Draw(DrawContext context, int x, int y); + + /// + /// Calculates the height of the node if drawn. + /// This method is used to determine if a node outside the visible area should be drawn. + /// The returned height must be equal to the height which is returned by the method. + /// + /// The drawing context. + /// The calculated height. + public abstract int CalculateDrawnHeight(DrawContext context); + + /// Updates the node from the given . Sets the and of the node. + /// The spot. + public virtual void Update(HotSpot spot) + { + Contract.Requires(spot != null); + + if (spot.Id == HotSpot.NameId) + { + Name = spot.Text; + } + else if (spot.Id == HotSpot.CommentId) + { + Comment = spot.Text; + } + } + + /// Toggles the specified level. + /// The level to toggle. + internal void ToggleLevelOpen(int level) + { + LevelsOpen[level] = !LevelsOpen[level]; + } + + /// Sets the specific level. + /// The level to set. + /// True to open. + internal void SetLevelOpen(int level, bool open) + { + LevelsOpen[level] = open; + } + + /// Adds a the user can interact with. + /// The drawing context. + /// The spot. + /// The text to edit. + /// The id of the spot. + /// The type of the spot. + protected void AddHotSpot(DrawContext context, Rectangle spot, string text, int id, HotSpotType type) + { + Contract.Requires(context != null); + Contract.Requires(context.Memory != null); + Contract.Requires(text != null); + + if (spot.Top > context.ClientArea.Bottom || spot.Bottom < 0) + { + return; + } + + context.HotSpots.Add(new HotSpot + { + Rect = spot, + Text = text, + Address = context.Address + Offset, + Id = id, + Type = type, + Node = this, + Level = context.Level, + Process = context.Process, + Memory = context.Memory + }); + } + + /// Draws the specific text and adds a if is not . + /// The drawing context. + /// The x coordinate. + /// The y coordinate. + /// The color of the text. + /// Id for the clickable area. + /// The text to draw. + /// The new x coordinate after drawing the text. + protected int AddText(DrawContext context, int x, int y, Color color, int hitId, string text) + { + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); + Contract.Requires(context.Font != null); + Contract.Requires(text != null); + + var width = Math.Max(text.Length, hitId != HotSpot.NoneId ? 1 : 0) * context.Font.Width; + + if (y >= -context.Font.Height && y + context.Font.Height <= context.ClientArea.Bottom + context.Font.Height) + { + if (hitId != HotSpot.NoneId) + { + var rect = new Rectangle(x, y, width, context.Font.Height); + AddHotSpot(context, rect, text, hitId, HotSpotType.Edit); + } + + context.Graphics.DrawStringEx(text, context.Font.Font, color, x, y); + /*using (var brush = new SolidBrush(color)) + { + context.Graphics.DrawString(text, context.Font.Font, brush, x, y); + }*/ + } + + return x + width; + } + + /// Draws the address and of the node. + /// The drawing context. + /// The x coordinate. + /// The y coordinate. + /// The new x coordinate after drawing the text. + protected int AddAddressOffset(DrawContext context, int x, int y) + { + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); + Contract.Requires(context.Font != null); + + if (context.Settings.ShowNodeOffset) + { + x = AddText(context, x, y, context.Settings.OffsetColor, HotSpot.NoneId, $"{Offset:X04}") + context.Font.Width; + } + + if (context.Settings.ShowNodeAddress) + { + x = AddText(context, x, y, context.Settings.AddressColor, HotSpot.AddressId, (context.Address + Offset).ToString(Constants.AddressHexFormat)) + context.Font.Width; + } + + return x; + } + + /// Draws a bar which indicates the selection status of the node. A for this area gets added too. + /// The drawing context. + /// The x coordinate. + /// The y coordinate. + /// The height of the bar. + protected void AddSelection(DrawContext context, int x, int y, int height) + { + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); + + if (y > context.ClientArea.Bottom || y + height < 0 || IsWrapped) + { + return; + } + + if (IsSelected) + { + using var brush = new SolidBrush(context.Settings.SelectedColor); + + context.Graphics.FillRectangle(brush, 0, y, context.ClientArea.Right, height); + } + + AddHotSpot(context, new Rectangle(0, y, context.ClientArea.Right - (IsSelected ? 16 : 0), height), string.Empty, HotSpot.NoneId, HotSpotType.Select); + } + + protected int AddIconPadding(DrawContext view, int x) + { + return x + view.IconProvider.Dimensions; + } + + /// Draws an icon and adds a if is not . + /// The drawing context. + /// The x coordinate. + /// The y coordinate. + /// The icon. + /// The id of the spot. + /// The type of the spot. + /// The new x coordinate after drawing the icon. + protected int AddIcon(DrawContext context, int x, int y, Image icon, int id, HotSpotType type) + { + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); + Contract.Requires(icon != null); + + var size = context.IconProvider.Dimensions; + + if (y > context.ClientArea.Bottom || y + size < 0) + { + return x + size; + } + + context.Graphics.DrawImage(icon, x + 2, y, size, size); + + if (id != HotSpot.NoneId) + { + AddHotSpot(context, new Rectangle(x, y, size, size), string.Empty, id, type); + } + + return x + size; + } + + /// Adds a togglable Open/Close icon. + /// The drawing context. + /// The x coordinate. + /// The y coordinate. + /// The new x coordinate after drawing the icon. + protected int AddOpenCloseIcon(DrawContext context, int x, int y) + { + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); + + if (y > context.ClientArea.Bottom || y + context.IconProvider.Dimensions < 0) + { + return x + context.IconProvider.Dimensions; + } + + var icon = LevelsOpen[context.Level] ? context.IconProvider.OpenCloseOpen : context.IconProvider.OpenCloseClosed; + return AddIcon(context, x, y, icon, 0, HotSpotType.OpenClose); + } + + /// Draws a context drop icon if the node is selected. + /// The drawing context. + /// The y coordinate. + protected void AddContextDropDownIcon(DrawContext context, int y) + { + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); + + if (context.MultipleNodesSelected || y > context.ClientArea.Bottom || y + context.IconProvider.Dimensions < 0 || IsWrapped) + { + return; + } + + if (IsSelected) + { + AddIcon(context, 0, y, context.IconProvider.DropArrow, 0, HotSpotType.Context); + } + } + + /// Draws a delete icon if the node is selected. + /// The drawing context. + /// The y coordinate. + protected void AddDeleteIcon(DrawContext context, int y) + { + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); + + if (y > context.ClientArea.Bottom || y + context.IconProvider.Dimensions < 0 || IsWrapped) + { + return; + } + + if (IsSelected) + { + AddIcon(context, context.ClientArea.Right - context.IconProvider.Dimensions, y, context.IconProvider.Delete, 0, HotSpotType.Delete); + } + } + + /// Draws the . + /// The drawing context. + /// The x coordinate. + /// The y coordinate. + /// The new x coordinate after drawing the comment. + protected virtual int AddComment(DrawContext context, int x, int y) + { + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); + Contract.Requires(context.Font != null); + + x = AddText(context, x, y, context.Settings.CommentColor, HotSpot.NoneId, "//"); + x = AddText(context, x, y, context.Settings.CommentColor, HotSpot.CommentId, Comment) + context.Font.Width; + + return x; + } + + /// Draws a vertical line to show the hidden state. + /// The drawing context. + /// The x coordinate. + /// The y coordinate. + /// The size of the drawing. + protected Size DrawHidden(DrawContext context, int x, int y) + { + Contract.Requires(context != null); + Contract.Requires(context.Graphics != null); + + using (var brush = new SolidBrush(IsSelected ? context.Settings.SelectedColor : context.Settings.HiddenColor)) + { + context.Graphics.FillRectangle(brush, 0, y, context.ClientArea.Right, 1); + } + + return new Size(0, HiddenHeight); + } + + /// Draws an error indicator if the used memory buffer is not valid. + /// The drawing context. + /// The y coordinate. + protected void DrawInvalidMemoryIndicatorIcon(DrawContext context, int y) + { + if (!context.Memory.ContainsValidData) + { + AddIcon(context, 0, y, Properties.Resources.B16x16_Error, HotSpot.NoneId, HotSpotType.None); + } + } + } + + [ContractClassFor(typeof(BaseNode))] + internal abstract class BaseNodeContract : BaseNode + { + public override int MemorySize + { + get + { + Contract.Ensures(Contract.Result() >= 0); + + throw new NotImplementedException(); + } + } + + public override Size Draw(DrawContext context, int x, int y) + { + Contract.Requires(context != null); + + throw new NotImplementedException(); + } + + public override int CalculateDrawnHeight(DrawContext context) + { + Contract.Requires(context != null); + + throw new NotImplementedException(); + } + } +} diff --git a/ReClass.NET/Nodes/BaseNumericNode.cs b/ReClass.NET/Nodes/BaseNumericNode.cs new file mode 100644 index 00000000..61782ca6 --- /dev/null +++ b/ReClass.NET/Nodes/BaseNumericNode.cs @@ -0,0 +1,66 @@ +using System.Diagnostics.Contracts; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public abstract class BaseNumericNode : BaseNode + { + /// Draws the node. + /// The drawing context. + /// The x coordinate. + /// The y coordinate. + /// The icon of the node. + /// The type of the node. + /// The value of the node. + /// An alternative value of the node. + /// The pixel size the node occupies. + protected Size DrawNumeric(DrawContext context, int x, int y, Image icon, string type, string value, string alternativeValue) + { + Contract.Requires(context != null); + Contract.Requires(icon != null); + Contract.Requires(type != null); + Contract.Requires(value != null); + + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + + AddSelection(context, x, y, context.Font.Height); + + x = AddIconPadding(context, x); + + x = AddIcon(context, x, y, icon, HotSpot.NoneId, HotSpotType.None); + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; + } + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NoneId, "=") + context.Font.Width; + x = AddText(context, x, y, context.Settings.ValueColor, 0, value) + context.Font.Width; + if (alternativeValue != null) + { + x = AddText(context, x, y, context.Settings.ValueColor, 1, alternativeValue) + context.Font.Width; + } + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + return new Size(x - origX, context.Font.Height); + } + + public override int CalculateDrawnHeight(DrawContext context) + { + return IsHidden && !IsWrapped ? HiddenHeight : context.Font.Height; + } + } +} diff --git a/ReClass.NET/Nodes/BaseTextNode.cs b/ReClass.NET/Nodes/BaseTextNode.cs new file mode 100644 index 00000000..d395b24d --- /dev/null +++ b/ReClass.NET/Nodes/BaseTextNode.cs @@ -0,0 +1,102 @@ +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Text; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public abstract class BaseTextNode : BaseNode + { + public int Length { get; set; } + + public override int MemorySize => Length * CharacterSize; + + /// The encoding of the string. + public abstract Encoding Encoding { get; } + + /// Size of one character in bytes. + private int CharacterSize => Encoding.GuessByteCountPerChar(); + + public override void CopyFromNode(BaseNode node) + { + Length = node.MemorySize / CharacterSize; + } + + protected Size DrawText(DrawContext context, int x, int y, string type) + { + Contract.Requires(context != null); + Contract.Requires(type != null); + + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var length = MemorySize / CharacterSize; + var text = ReadValueFromMemory(context.Memory); + + var origX = x; + + AddSelection(context, x, y, context.Font.Height); + + x = AddIconPadding(context, x); + + x = AddIcon(context, x, y, context.IconProvider.Text, HotSpot.NoneId, HotSpotType.None); + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name); + } + x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "["); + x = AddText(context, x, y, context.Settings.IndexColor, 0, length.ToString()); + x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "]") + context.Font.Width; + + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, "= '"); + x = AddText(context, x, y, context.Settings.TextColor, 1, text.LimitLength(150)); + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, "'") + context.Font.Width; + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + return new Size(x - origX, context.Font.Height); + } + + public override int CalculateDrawnHeight(DrawContext context) + { + return IsHidden && !IsWrapped ? HiddenHeight : context.Font.Height; + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0) + { + if (int.TryParse(spot.Text, out var val) && val > 0) + { + Length = val; + + GetParentContainer()?.ChildHasChanged(this); + } + } + else if (spot.Id == 1) + { + var data = Encoding.GetBytes(spot.Text); + spot.Process.WriteRemoteMemory(spot.Address, data); + } + } + + public string ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadString(Encoding, Offset, MemorySize); + } + } +} diff --git a/ReClass.NET/Nodes/BaseTextPtrNode.cs b/ReClass.NET/Nodes/BaseTextPtrNode.cs new file mode 100644 index 00000000..d7b00238 --- /dev/null +++ b/ReClass.NET/Nodes/BaseTextPtrNode.cs @@ -0,0 +1,72 @@ +using System; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Text; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public abstract class BaseTextPtrNode : BaseNode + { + private const int MaxStringCharacterCount = 256; + + public override int MemorySize => IntPtr.Size; + + /// The encoding of the string. + public abstract Encoding Encoding { get; } + + /// Draws this node. + /// The drawing context. + /// The x coordinate. + /// The y coordinate. + /// The name of the type. + /// The pixel size the node occupies. + public Size DrawText(DrawContext context, int x, int y, string type) + { + Contract.Requires(context != null); + Contract.Requires(type != null); + + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var ptr = context.Memory.ReadIntPtr(Offset); + var text = context.Process.ReadRemoteString(ptr, Encoding, MaxStringCharacterCount); + + var origX = x; + + AddSelection(context, x, y, context.Font.Height); + + x = AddIconPadding(context, x); + + x = AddIcon(context, x, y, context.IconProvider.Text, HotSpot.NoneId, HotSpotType.None); + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; + } + + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, "= '"); + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.ReadOnlyId, text); + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, "'") + context.Font.Width; + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + return new Size(x - origX, context.Font.Height); + } + + public override int CalculateDrawnHeight(DrawContext context) + { + return IsHidden && !IsWrapped ? HiddenHeight : context.Font.Height; + } + } +} diff --git a/ReClass.NET/Nodes/BaseWrapperArrayNode.cs b/ReClass.NET/Nodes/BaseWrapperArrayNode.cs new file mode 100644 index 00000000..ee042751 --- /dev/null +++ b/ReClass.NET/Nodes/BaseWrapperArrayNode.cs @@ -0,0 +1,152 @@ +using System; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public abstract class BaseWrapperArrayNode : BaseWrapperNode + { + public override int MemorySize => InnerNode.MemorySize * Count; + + public int CurrentIndex { get; set; } + public int Count { get; set; } = 1; + public bool IsReadOnly { get; protected set; } + + protected override bool PerformCycleCheck => true; + + public override bool CanChangeInnerNodeTo(BaseNode node) + { + switch (node) + { + case null: + case ClassNode _: + case VirtualMethodNode _: + return false; + } + + return true; + } + + protected Size Draw(DrawContext context, int x, int y, string type) + { + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + + AddSelection(context, x, y, context.Font.Height); + + x = AddOpenCloseIcon(context, x, y); + x = AddIcon(context, x, y, context.IconProvider.Array, HotSpot.NoneId, HotSpotType.None); + + var tx = x; + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, type) + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name); + } + x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "["); + x = AddText(context, x, y, context.Settings.IndexColor, IsReadOnly ? HotSpot.NoneId : 0, Count.ToString()); + x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "]"); + + x = AddIcon(context, x, y, context.IconProvider.LeftArrow, 2, HotSpotType.Click); + x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, "("); + x = AddText(context, x, y, context.Settings.IndexColor, 1, CurrentIndex.ToString()); + x = AddText(context, x, y, context.Settings.IndexColor, HotSpot.NoneId, ")"); + x = AddIcon(context, x, y, context.IconProvider.RightArrow, 3, HotSpotType.Click) + context.Font.Width; + + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"") + context.Font.Width; + x = AddIcon(context, x + 2, y, context.IconProvider.Change, 4, HotSpotType.ChangeWrappedType); + + x += context.Font.Width; + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + y += context.Font.Height; + + var size = new Size(x - origX, context.Font.Height); + + if (LevelsOpen[context.Level]) + { + var childSize = DrawChild(context, tx, y); + + size.Width = Math.Max(size.Width, childSize.Width + tx - origX); + size.Height += childSize.Height; + } + + return size; + } + + protected abstract Size DrawChild(DrawContext context, int x, int y); + + public override int CalculateDrawnHeight(DrawContext context) + { + if (IsHidden && !IsWrapped) + { + return HiddenHeight; + } + + var height = context.Font.Height; + if (LevelsOpen[context.Level]) + { + height += InnerNode.CalculateDrawnHeight(context); + } + return height; + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0 || spot.Id == 1) + { + if (int.TryParse(spot.Text, out var value)) + { + if (spot.Id == 0 && !IsReadOnly) + { + if (value != 0) + { + Count = value; + + if (CurrentIndex >= value) + { + CurrentIndex = value - 1; + } + + GetParentContainer()?.ChildHasChanged(this); + } + } + else + { + if (value < Count) + { + CurrentIndex = value; + } + } + } + } + else if (spot.Id == 2) + { + if (CurrentIndex > 0) + { + --CurrentIndex; + } + } + else if (spot.Id == 3) + { + if (CurrentIndex < Count - 1) + { + ++CurrentIndex; + } + } + } + } +} diff --git a/ReClass.NET/Nodes/BaseWrapperNode.cs b/ReClass.NET/Nodes/BaseWrapperNode.cs new file mode 100644 index 00000000..b499f0ce --- /dev/null +++ b/ReClass.NET/Nodes/BaseWrapperNode.cs @@ -0,0 +1,112 @@ +using System; + +namespace ReClassNET.Nodes +{ + public abstract class BaseWrapperNode : BaseNode + { + /// Gets or sets the inner node. + public BaseNode InnerNode { get; private set; } + + /// Gets signaled if the inner node was changed. + public event NodeEventHandler InnerNodeChanged; + + /// True to perform class cycle checks when changing the inner node. + protected abstract bool PerformCycleCheck { get; } + + /// + /// Should be called before to test if the node can handle the inner node type. + /// + /// The new inner node type. + /// True if the class can handle the inner node type or false otherwise. + public abstract bool CanChangeInnerNodeTo(BaseNode node); + + /// Changes the inner node. + /// The new node. + public void ChangeInnerNode(BaseNode node) + { + if (!CanChangeInnerNodeTo(node)) + { + throw new InvalidOperationException($"Can't change inner node to '{node?.GetType().ToString() ?? "null"}'"); + } + + if (InnerNode != node) + { + InnerNode = node; + + if (node != null) + { + node.ParentNode = this; + } + + InnerNodeChanged?.Invoke(this); + + GetParentContainer()?.ChildHasChanged(this); + } + } + + /// + /// Resolve the most inner node of a chain. + /// + /// The most inner node or null. + public BaseNode ResolveMostInnerNode() + { + if (InnerNode == null) + { + return null; + } + if (InnerNode is BaseWrapperNode baseWrapperNode) + { + return baseWrapperNode.ResolveMostInnerNode(); + } + return InnerNode; + } + + /// + /// Tests if the cycle check is really needed in a chain. + /// + /// + public bool ShouldPerformCycleCheckForInnerNode() + { + // TODO Should there be a "is ClassNode" for the last inner node? + + if (!PerformCycleCheck) + { + return false; + } + + var wrapperNode = this; + while (wrapperNode.InnerNode is BaseWrapperNode wrappedNode) + { + if (!wrappedNode.PerformCycleCheck) + { + return false; + } + + wrapperNode = wrappedNode; + } + + return true; + } + + /// + /// Tests if the given node type is present in the chain of wrapped nodes. + /// + /// The node type to check. + /// True if the given node type is present in the chain of wrapped nodes, false otherwise. + public bool IsNodePresentInChain() where TNode : BaseNode + { + BaseNode node = this; + while (node is BaseWrapperNode wrapperNode) + { + if (node is TNode) + { + return true; + } + + node = wrapperNode.InnerNode; + } + + return false; + } + } +} diff --git a/ReClass.NET/Nodes/BitFieldNode.cs b/ReClass.NET/Nodes/BitFieldNode.cs new file mode 100644 index 00000000..22461c37 --- /dev/null +++ b/ReClass.NET/Nodes/BitFieldNode.cs @@ -0,0 +1,222 @@ +using System; +using System.Diagnostics.Contracts; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; +using ReClassNET.Util; + +namespace ReClassNET.Nodes +{ + public class BitFieldNode : BaseNode + { + private int size; + private int bits; + + /// Gets or sets the bit count. + /// Possible values: 64, 32, 16, 8 + public int Bits + { + get => bits; + set + { + Contract.Ensures(bits > 0); + Contract.Ensures(size > 0); + + if (value >= 64) + { + bits = 64; + } + else if (value >= 32) + { + bits = 32; + } + else if (value >= 16) + { + bits = 16; + } + else + { + bits = 8; + } + + size = bits / 8; + } + } + + public override int MemorySize => size; + + public BitFieldNode() + { + Bits = IntPtr.Size * 8; + + LevelsOpen.DefaultValue = true; + } + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Bitfield"; + icon = Properties.Resources.B16x16_Button_Bits; + } + + public override void CopyFromNode(BaseNode node) + { + base.CopyFromNode(node); + + Bits = node.MemorySize * 8; + } + + /// + /// Gets the underlaying node for the bit field. + /// + /// + public BaseNumericNode GetUnderlayingNode() + { + switch (Bits) + { + case 8: + return new UInt8Node(); + case 16: + return new UInt16Node(); + case 32: + return new UInt32Node(); + case 64: + return new UInt64Node(); + } + + throw new Exception(); // TODO + } + + /// Converts the memory value to a bit string. + /// The process memory. + /// The value converted to a bit string. + private string ConvertValueToBitString(MemoryBuffer memory) + { + Contract.Requires(memory != null); + Contract.Ensures(Contract.Result() != null); + + switch(bits) + { + case 64: + return BitString.ToString(memory.ReadInt64(Offset)); + case 32: + return BitString.ToString(memory.ReadInt32(Offset)); + case 16: + return BitString.ToString(memory.ReadInt16(Offset)); + default: + return BitString.ToString(memory.ReadUInt8(Offset)); + } + } + + public override Size Draw(DrawContext context, int x, int y) + { + const int BitsPerBlock = 4; + + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + var origY = y; + + AddSelection(context, x, y, context.Font.Height); + + x = AddIconPadding(context, x); + x = AddIconPadding(context, x); + + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Bits") + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; + } + + x = AddOpenCloseIcon(context, x, y) + context.Font.Width; + + var tx = x - 3; + + for (var i = 0; i < bits; ++i) + { + var rect = new Rectangle(x + (i + i / BitsPerBlock) * context.Font.Width, y, context.Font.Width, context.Font.Height); + AddHotSpot(context, rect, string.Empty, i, HotSpotType.Edit); + } + + var value = ConvertValueToBitString(context.Memory); + + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, value) + context.Font.Width; + + x += context.Font.Width; + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + if (LevelsOpen[context.Level]) + { + y += context.Font.Height; + + var format = new StringFormat(StringFormatFlags.DirectionVertical); + + using (var brush = new SolidBrush(context.Settings.ValueColor)) + { + var maxCharCount = bits + (bits / 4 - 1) - 1; + + for (int bitCount = 0, padding = 0; bitCount < bits; bitCount += 4, padding += 5) + { + context.Graphics.DrawString(bitCount.ToString(), context.Font.Font, brush, tx + (maxCharCount - padding) * context.Font.Width, y, format); + } + } + + y += 8; + } + + return new Size(x - origX, y - origY + context.Font.Height); + } + + public override int CalculateDrawnHeight(DrawContext context) + { + if (IsHidden && !IsWrapped) + { + return HiddenHeight; + } + + var height = context.Font.Height; + if (LevelsOpen[context.Level]) + { + height += context.Font.Height + 8; + } + return height; + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id >= 0 && spot.Id < bits) + { + if (spot.Text == "1" || spot.Text == "0") + { + var bit = bits - 1 - spot.Id; + var add = bit / 8; + bit = bit % 8; + + var val = spot.Memory.ReadUInt8(Offset + add); + if (spot.Text == "1") + { + val |= (byte)(1 << bit); + } + else + { + val &= (byte)~(1 << bit); + } + spot.Process.WriteRemoteMemory(spot.Address + add, val); + } + } + } + } +} diff --git a/ReClass.NET/Nodes/BoolNode.cs b/ReClass.NET/Nodes/BoolNode.cs new file mode 100644 index 00000000..89e164dd --- /dev/null +++ b/ReClass.NET/Nodes/BoolNode.cs @@ -0,0 +1,73 @@ +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class BoolNode : BaseNumericNode + { + public override int MemorySize => 1; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Bool"; + icon = Properties.Resources.B16x16_Button_Bool; + } + + public override Size Draw(DrawContext context, int x, int y) + { + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + + AddSelection(context, x, y, context.Font.Height); + + x = AddIconPadding(context, x); + x = AddIconPadding(context, x); + + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Bool") + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; + } + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NoneId, "=") + context.Font.Width; + + var value = context.Memory.ReadUInt8(Offset); + x = AddText(context, x, y, context.Settings.ValueColor, 0, value == 0 ? "false" : "true") + context.Font.Width; + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + return new Size(x - origX, context.Font.Height); + } + + public override int CalculateDrawnHeight(DrawContext context) + { + return IsHidden && !IsWrapped ? HiddenHeight : context.Font.Height; + } + + /// Updates the node from the given spot and sets the value. + /// The spot. + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0) + { + if (bool.TryParse(spot.Text, out var val)) + { + spot.Process.WriteRemoteMemory(spot.Address, (byte)(val ? 1 : 0)); + } + } + } + } +} diff --git a/ReClass.NET/Nodes/ClassInstanceArrayNode.cs b/ReClass.NET/Nodes/ClassInstanceArrayNode.cs new file mode 100644 index 00000000..8faf5657 --- /dev/null +++ b/ReClass.NET/Nodes/ClassInstanceArrayNode.cs @@ -0,0 +1,40 @@ +using System.Drawing; +using ReClassNET.Extensions; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class ClassInstanceArrayNode : BaseArrayNode + { + public override int MemorySize => InnerNode.MemorySize * Count; + + public override bool PerformCycleCheck => true; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Class Instance Array"; + icon = Properties.Resources.B16x16_Button_Array; + } + + public override void Intialize() + { + InnerNode = ClassNode.Create(); + InnerNode.Intialize(); + } + + public override Size Draw(ViewInfo view, int x, int y) + { + return Draw(view, x, y, "Array", HotSpotType.ChangeClassType); + } + + protected override Size DrawChild(ViewInfo view, int x, int y) + { + var v = view.Clone(); + v.Address = view.Address.Add(Offset) + InnerNode.MemorySize * CurrentIndex; + v.Memory = view.Memory.Clone(); + v.Memory.Offset += Offset.ToInt32() + InnerNode.MemorySize * CurrentIndex; + + return InnerNode.Draw(v, x, y); + } + } +} diff --git a/ReClass.NET/Nodes/ClassInstanceNode.cs b/ReClass.NET/Nodes/ClassInstanceNode.cs new file mode 100644 index 00000000..0a52b51a --- /dev/null +++ b/ReClass.NET/Nodes/ClassInstanceNode.cs @@ -0,0 +1,86 @@ +using System; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class ClassInstanceNode : BaseClassWrapperNode + { + public override int MemorySize => InnerNode.MemorySize; + + protected override bool PerformCycleCheck => true; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Class Instance"; + icon = Properties.Resources.B16x16_Button_Class_Instance; + } + + public override Size Draw(DrawContext context, int x, int y) + { + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + var origY = y; + + AddSelection(context, x, y, context.Font.Height); + + x = AddOpenCloseIcon(context, x, y); + x = AddIcon(context, x, y, context.IconProvider.Class, HotSpot.NoneId, HotSpotType.None); + + var tx = x; + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Instance") + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; + } + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>") + context.Font.Width; + x = AddIcon(context, x, y, context.IconProvider.Change, 4, HotSpotType.ChangeClassType) + context.Font.Width; + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + y += context.Font.Height; + + var size = new Size(x - origX, y - origY); + + if (LevelsOpen[context.Level]) + { + var innerContext = context.Clone(); + innerContext.Address = context.Address + Offset; + innerContext.Memory = context.Memory.Clone(); + innerContext.Memory.Offset += Offset; + + var innerSize = InnerNode.Draw(innerContext, tx, y); + size.Width = Math.Max(size.Width, innerSize.Width + tx - origX); + size.Height += innerSize.Height; + } + + return size; + } + + public override int CalculateDrawnHeight(DrawContext context) + { + if (IsHidden && !IsWrapped) + { + return HiddenHeight; + } + + var height = context.Font.Height; + if (LevelsOpen[context.Level]) + { + height += InnerNode.CalculateDrawnHeight(context); + } + return height; + } + } +} diff --git a/ReClass.NET/Nodes/ClassNode.cs b/ReClass.NET/Nodes/ClassNode.cs new file mode 100644 index 00000000..9b144061 --- /dev/null +++ b/ReClass.NET/Nodes/ClassNode.cs @@ -0,0 +1,189 @@ +using System; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Linq; +using ReClassNET.Controls; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public delegate void ClassCreatedEventHandler(ClassNode node); + + public class ClassNode : BaseContainerNode + { + public static event ClassCreatedEventHandler ClassCreated; + +#if RECLASSNET64 + public static IntPtr DefaultAddress { get; } = (IntPtr)0x140000000; + public static string DefaultAddressFormula { get; } = "140000000"; +#else + public static IntPtr DefaultAddress { get; } = (IntPtr)0x400000; + public static string DefaultAddressFormula { get; } = "400000"; +#endif + + public override int MemorySize => Nodes.Sum(n => n.MemorySize); + + protected override bool ShouldCompensateSizeChanges => true; + + public Guid Uuid { get; set; } + + public string AddressFormula { get; set; } = DefaultAddressFormula; + + public event NodeEventHandler NodesChanged; + + internal ClassNode(bool notifyClassCreated) + { + Contract.Ensures(AddressFormula != null); + + LevelsOpen.DefaultValue = true; + + Uuid = Guid.NewGuid(); + + if (notifyClassCreated) + { + ClassCreated?.Invoke(this); + } + } + + public static ClassNode Create() + { + Contract.Ensures(Contract.Result() != null); + + return new ClassNode(true); + } + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + throw new InvalidOperationException($"The '{nameof(ClassNode)}' node should not be accessible from the ui."); + } + + public override bool CanHandleChildNode(BaseNode node) + { + switch (node) + { + case null: + case ClassNode _: + case VirtualMethodNode _: + return false; + } + + return true; + } + + public override void Initialize() + { + AddBytes(IntPtr.Size); + } + + public override Size Draw(DrawContext context, int x, int y) + { + AddSelection(context, 0, y, context.Font.Height); + + var origX = x; + var origY = y; + + x = AddOpenCloseIcon(context, x, y); + + var tx = x; + + x = AddIcon(context, x, y, context.IconProvider.Class, HotSpot.NoneId, HotSpotType.None); + x = AddText(context, x, y, context.Settings.OffsetColor, 0, AddressFormula) + context.Font.Width; + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Class") + context.Font.Width; + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"[{MemorySize}]") + context.Font.Width; + x = AddComment(context, x, y); + + y += context.Font.Height; + + var size = new Size(x - origX, y - origY); + + if (LevelsOpen[context.Level]) + { + var childOffset = tx - origX; + + var innerContext = context.Clone(); + innerContext.Level++; + foreach (var node in Nodes) + { + Size AggregateNodeSizes(Size baseSize, Size newSize) + { + return new Size(Math.Max(baseSize.Width, newSize.Width), baseSize.Height + newSize.Height); + } + + Size ExtendWidth(Size baseSize, int width) + { + return new Size(baseSize.Width + width, baseSize.Height); + } + + // Draw the node if it is in the visible area. + if (context.ClientArea.Contains(tx, y)) + { + var innerSize = node.Draw(innerContext, tx, y); + + size = AggregateNodeSizes(size, ExtendWidth(innerSize, childOffset)); + + y += innerSize.Height; + } + else + { + // Otherwise calculate the height... + var calculatedHeight = node.CalculateDrawnHeight(innerContext); + + // and check if the node area overlaps with the visible area... + if (new Rectangle(tx, y, 9999999, calculatedHeight).IntersectsWith(context.ClientArea)) + { + // then draw the node... + var innerSize = node.Draw(innerContext, tx, y); + + size = AggregateNodeSizes(size, ExtendWidth(innerSize, childOffset)); + + y += innerSize.Height; + } + else + { + // or skip drawing and just use the calculated height. + size = AggregateNodeSizes(size, new Size(0, calculatedHeight)); + + y += calculatedHeight; + } + } + } + } + + return size; + } + + public override int CalculateDrawnHeight(DrawContext context) + { + if (IsHidden) + { + return HiddenHeight; + } + + var height = context.Font.Height; + if (LevelsOpen[context.Level]) + { + var nv = context.Clone(); + nv.Level++; + height += Nodes.Sum(n => n.CalculateDrawnHeight(nv)); + } + return height; + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0) + { + AddressFormula = spot.Text; + } + } + + protected internal override void ChildHasChanged(BaseNode child) + { + NodesChanged?.Invoke(this); + } + } +} diff --git a/ReClass.NET/Nodes/ClassUtil.cs b/ReClass.NET/Nodes/ClassUtil.cs new file mode 100644 index 00000000..17ea2ce8 --- /dev/null +++ b/ReClass.NET/Nodes/ClassUtil.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using ReClassNET.Util; + +namespace ReClassNET.Nodes +{ + public class ClassUtil + { + /// + /// Tests if the class to check can be inserted into the parent class without creating a cycle. + /// + /// The class into which + /// The class which should get inserted. + /// An enumeration of all available classes. + /// True if a cycle is detected, false otherwise. + public static bool IsCyclicIfClassIsAccessibleFromParent(ClassNode parent, ClassNode classToCheck, IEnumerable classes) + { + Contract.Requires(parent != null); + Contract.Requires(classToCheck != null); + Contract.Requires(classes != null); + Contract.Requires(Contract.ForAll(classes, c => c != null)); + + var graph = new DirectedGraph(); + graph.AddVertices(classes); + + graph.AddEdge(parent, classToCheck); + + foreach (var c in graph.Vertices) + { + foreach (var wrapperNode in c.Nodes.OfType()) + { + if (wrapperNode.ShouldPerformCycleCheckForInnerNode() && wrapperNode.ResolveMostInnerNode() is ClassNode classNode) + { + graph.AddEdge(c, classNode); + } + } + } + + return graph.ContainsCycle(); + } + } +} diff --git a/ReClass.NET/Nodes/DoubleNode.cs b/ReClass.NET/Nodes/DoubleNode.cs new file mode 100644 index 00000000..58df6e15 --- /dev/null +++ b/ReClass.NET/Nodes/DoubleNode.cs @@ -0,0 +1,42 @@ +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class DoubleNode : BaseNumericNode + { + public override int MemorySize => 8; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Double"; + icon = Properties.Resources.B16x16_Button_Double; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return DrawNumeric(context, x, y, context.IconProvider.Double, "Double", ReadValueFromMemory(context.Memory).ToString("0.000"), null); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0) + { + if (double.TryParse(spot.Text, out var val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } + } + } + + public double ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadDouble(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/EnumNode.cs b/ReClass.NET/Nodes/EnumNode.cs new file mode 100644 index 00000000..d2fcf746 --- /dev/null +++ b/ReClass.NET/Nodes/EnumNode.cs @@ -0,0 +1,183 @@ +using System; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Text; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.Project; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class EnumNode : BaseNode + { + public override int MemorySize => (int)Enum.Size; + + public EnumDescription Enum { get; private set; } = EnumDescription.Default; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Enum"; + icon = Properties.Resources.B16x16_Button_Enum; + } + + public void ChangeEnum(EnumDescription @enum) + { + Contract.Requires(@enum != null); + + Enum = @enum; + + GetParentContainer()?.ChildHasChanged(this); + } + + private string GetTextRepresentation(MemoryBuffer memory) + { + return Enum.UseFlagsMode ? GetFlagsStringRepresentation(memory) : GetStringRepresentation(memory); + } + + private long ReadSignedValueFromMemory(MemoryBuffer memory) + { + switch (Enum.Size) + { + case EnumDescription.UnderlyingTypeSize.OneByte: + return memory.ReadInt8(Offset); + case EnumDescription.UnderlyingTypeSize.TwoBytes: + return memory.ReadInt16(Offset); + case EnumDescription.UnderlyingTypeSize.FourBytes: + return memory.ReadInt32(Offset); + case EnumDescription.UnderlyingTypeSize.EightBytes: + return memory.ReadInt64(Offset); + default: + throw new ArgumentOutOfRangeException(); + } + } + + private string GetStringRepresentation(MemoryBuffer memory) + { + var value = ReadSignedValueFromMemory(memory); + var index = Enum.Values.FindIndex(kv => kv.Value == value); + if (index == -1) + { + return value.ToString(); + } + + return Enum.Values[index].Key; + } + + private ulong ReadUnsignedValueFromMemory(MemoryBuffer memory) + { + switch (Enum.Size) + { + case EnumDescription.UnderlyingTypeSize.OneByte: + return memory.ReadUInt8(Offset); + case EnumDescription.UnderlyingTypeSize.TwoBytes: + return memory.ReadUInt16(Offset); + case EnumDescription.UnderlyingTypeSize.FourBytes: + return memory.ReadUInt32(Offset); + case EnumDescription.UnderlyingTypeSize.EightBytes: + return memory.ReadUInt64(Offset); + default: + throw new ArgumentOutOfRangeException(); + } + } + + private string GetFlagsStringRepresentation(MemoryBuffer memory) + { + var value = ReadUnsignedValueFromMemory(memory); + var result = value; + + var values = Enum.Values; + + var index = values.Count - 1; + var retval = new StringBuilder(); + var firstTime = true; + var saveResult = result; + + while (index >= 0) + { + var temp = (ulong)values[index].Value; + if (index == 0 && temp == 0) + { + break; + } + + if ((result & temp) == temp) + { + result -= temp; + if (!firstTime) + { + retval.Prepend(" | "); + } + + retval.Prepend(values[index].Key); + firstTime = false; + } + + index--; + } + + if (result != 0) + { + return value.ToString(); + } + + if (saveResult == 0) + { + if (values.Count > 0 && values[0].Value == 0) + { + return values[0].Key; + } + + return "0"; + } + + return retval.ToString(); + } + + public override Size Draw(DrawContext context, int x, int y) + { + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + + AddSelection(context, x, y, context.Font.Height); + + x = AddIconPadding(context, x); + + x = AddIcon(context, x, y, context.IconProvider.Enum, HotSpot.NoneId, HotSpotType.None); + + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Enum") + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; + } + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"<{Enum.Name}>") + context.Font.Width; + x = AddIcon(context, x, y, context.IconProvider.Change, 4, HotSpotType.ChangeEnumType) + context.Font.Width; + + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, "=") + context.Font.Width; + + var text = GetTextRepresentation(context.Memory); + + x = AddText(context, x, y, context.Settings.TextColor, HotSpot.NoneId, text) + context.Font.Width; + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + return new Size(x - origX, context.Font.Height); + } + + public override int CalculateDrawnHeight(DrawContext context) + { + return IsHidden && !IsWrapped ? HiddenHeight : context.Font.Height; + } + } +} diff --git a/ReClass.NET/Nodes/FloatNode.cs b/ReClass.NET/Nodes/FloatNode.cs new file mode 100644 index 00000000..b02ebaff --- /dev/null +++ b/ReClass.NET/Nodes/FloatNode.cs @@ -0,0 +1,42 @@ +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class FloatNode : BaseNumericNode + { + public override int MemorySize => 4; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Float"; + icon = Properties.Resources.B16x16_Button_Float; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return DrawNumeric(context, x, y, context.IconProvider.Float, "Float", ReadValueFromMemory(context.Memory).ToString("0.000"), null); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0) + { + if (float.TryParse(spot.Text, out var val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } + } + } + + public float ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadFloat(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/FunctionNode.Tokenizer.cs b/ReClass.NET/Nodes/FunctionNode.Tokenizer.cs new file mode 100644 index 00000000..27f7a3bc --- /dev/null +++ b/ReClass.NET/Nodes/FunctionNode.Tokenizer.cs @@ -0,0 +1,353 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Linq; +using ReClassNET.Memory; +using ReClassNET.UI; +using ReClassNET.Util; + +namespace ReClassNET.Nodes +{ + public class FunctionNode : BaseNode + { + private IntPtr address = IntPtr.Zero; + private readonly List instructions = new List(); + private readonly List> instructions2 = new List>(); + + public string Signature { get; set; } = "void function()"; + + public ClassNode BelongsToClass { get; set; } + + private int memorySize = IntPtr.Size; + /// Size of the node in bytes. + public override int MemorySize => memorySize; + + public override string GetToolTipText(HotSpot spot, MemoryBuffer memory) + { + DisassembleRemoteCode(memory, spot.Address); + + return string.Join("\n", instructions); + } + + public override int Draw(ViewInfo view, int x, int y) + { + Contract.Requires(view != null); + + if (IsHidden) + { + return DrawHidden(view, x, y); + } + + AddSelection(view, x, y, view.Font.Height); + AddDelete(view, x, y); + AddTypeDrop(view, x, y); + + x += TextPadding; + + x = AddIcon(view, x, y, Icons.Function, -1, HotSpotType.None); + + var tx = x; + + x = AddAddressOffset(view, x, y); + + x = AddText(view, x, y, view.Settings.TypeColor, HotSpot.NoneId, "Function") + view.Font.Width; + x = AddText(view, x, y, view.Settings.NameColor, HotSpot.NameId, Name) + view.Font.Width; + + x = AddOpenClose(view, x, y) + view.Font.Width; + + x = AddComment(view, x, y); + + var ptr = view.Address.Add(Offset); + + DisassembleRemoteCode(view.Memory, ptr); + + if (levelsOpen[view.Level]) + { + y += view.Font.Height; + x = AddText(view, tx, y, view.Settings.TypeColor, HotSpot.NoneId, "Signature:") + view.Font.Width; + x = AddText(view, x, y, view.Settings.ValueColor, 0, Signature); + + y += view.Font.Height; + x = AddText(view, tx, y, view.Settings.TextColor, HotSpot.NoneId, "Belongs to: "); + x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, BelongsToClass == null ? "" : $"<{BelongsToClass.Name}>"); + x = AddIcon(view, x, y, Icons.Change, 1, HotSpotType.ChangeType); + + var minWidth = 26 * view.Font.Width; + + var addressColor = Color.FromArgb(128, 128, 128); + + y += 4; + foreach (var line in instructions2) + { + y += view.Font.Height; + + //AddText(view, tx, y, view.Settings.NameColor, HotSpot.ReadOnlyId, line); + x = AddText(view, tx, y, view.Settings.AddressColor, HotSpot.ReadOnlyId, line.Item1) + 15; + x = Math.Max(AddText(view, x, y, view.Settings.HexColor, HotSpot.ReadOnlyId, line.Item2), x + minWidth) + 6; + + /*foreach (var token in new AssemblerTokenizer().Read(line.Item3)) + { + var color = Color.Black; + if (token.TokenType == TokenType.Keyword) + { + if (AssemblerTokenizer.IsKeyword(token.Value)) + { + color = Color.Navy; + } + else if (AssemblerTokenizer.IsRegister(token.Value)) + { + color = Color.Green; + } + } + else if (token.TokenType == TokenType.Bracket) + { + color = Color.Purple; + } + else if (token.TokenType == TokenType.Operation) + { + color = Color.Red; + } + + x = AddText(view, x, y, color, HotSpot.NoneId, token.Value) + 5; + }*/ + AddText(view, x, y, view.Settings.ValueColor, HotSpot.ReadOnlyId, line.Item3); + + } + y += 4; + } + + return y + view.Font.Height; + } + + public override int CalculateHeight(ViewInfo view) + { + if (IsHidden) + { + return HiddenHeight; + } + + var h = view.Font.Height; + if (levelsOpen[view.Level]) + { + h += instructions.Count() * view.Font.Height; + } + return h; + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0) // Signature + { + Signature = spot.Text; + } + } + + private void DisassembleRemoteCode(MemoryBuffer memory, IntPtr address) + { + Contract.Requires(memory != null); + + if (this.address != address) + { + instructions.Clear(); + + this.address = address; + + if (!address.IsNull() && memory.Process.IsValid) + { + memorySize = 0; + + var disassembler = new Disassembler(memory.Process.CoreFunctions); + foreach (var instruction in disassembler.RemoteDisassembleFunction(memory.Process, address, 8192)) + { + memorySize += instruction.Length; + + instructions.Add($"{instruction.Address.ToString(Constants.StringHexFormat)} {instruction.Instruction}"); + instructions2.Add(Tuple.Create(instruction.Address.ToString(Constants.StringHexFormat), Utils.BytesToString(instruction.Data, instruction.Length), instruction.Instruction)); + } + + ParentNode?.ChildHasChanged(this); + } + } + } + } + + enum TokenType + { + Number, + Keyword, + Operation, + Bracket, + Register, + Text + } + + class Token + { + /// The type of the token. + public TokenType TokenType { get; } + + /// The value of the token. + public string Value { get; } + + public Token(TokenType type, string value) + { + Contract.Requires(value != null); + + TokenType = type; + Value = value; + } + + public override string ToString() + { + return $"{TokenType} {Value}"; + } + } + + class AssemblerTokenizer + { + public List Read(string instruction) + { + Contract.Requires(instruction != null); + + var tokens = new List(); + + var characters = instruction.ToCharArray(); + for (var i = 0; i < characters.Length; ++i) + { + if (IsPartOfKeyword(characters[i], true)) + { + var buffer = characters[i].ToString(); + while (++i < characters.Length && IsPartOfKeyword(characters[i], false)) + { + buffer += characters[i]; + } + + if (IsRegister(buffer)) + { + tokens.Add(new Token(TokenType.Register, buffer)); + } + else if (IsKeyword(buffer)) + { + tokens.Add(new Token(TokenType.Keyword, buffer)); + } + else + { + tokens.Add(new Token(TokenType.Text, buffer)); + } + + if (i == characters.Length) + { + continue; + } + } + + if (IsPartOfNumber(characters[i], true)) + { + var buffer = characters[i].ToString(); + while (++i < characters.Length && IsPartOfNumber(characters[i], false)) + { + buffer += characters[i]; + } + + tokens.Add(new Token(TokenType.Number, buffer)); + + if (i == characters.Length) + { + continue; + } + } + + switch (characters[i]) + { + case ' ': + continue; + case ',': + case ':': + tokens.Add(new Token(TokenType.Text, characters[i].ToString())); + break; + case '+': + case '-': + case '*': + case '/': + tokens.Add(new Token(TokenType.Operation, characters[i].ToString())); + break; + case '[': + case ']': + tokens.Add(new Token(TokenType.Bracket, characters[i].ToString())); + break; + default: + throw new Exception($"Invalid token '{characters[i]}' detected at position {i}."); + } + } + + return tokens; + } + + private bool IsPartOfKeyword(char character, bool isFirstCharacter) + { + return (character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z') || (!isFirstCharacter && (character >= '0' && character <= '9')); + } + + private bool IsPartOfNumber(char character, bool isFirstCharacter) + { + return (character >= '0' && character <= '9') || (character >= 'a' && character <= 'f') || (character >= 'A' && character <= 'F') || (!isFirstCharacter && (character == 'x' || character == 'X')); + } + + private static HashSet Registers = new HashSet + { + "rax", "eax", "ax", "al", "ah", + "rbx", "ebx", "bx", "bl", "bh", + "rcx", "ecx", "cx", "cl", "ch", + "rdx", "edx", "dx", "dl", "dh", + "rsi", "esi", "si", "sil", + "rdi", "edi", "di", "dil", + "rbp", "ebp", "bp", "bpl", + "rsp", "esp", "sp", "spl", + "r8", "r8d", "r8w", "r8b", + "r9", "r9d", "r9w", "r9b", + "r10", "r10d", "r10w", "r10b", + "r11", "r11d", "r11w", "r11b", + "r12", "r12d", "r12w", "r12b", + "r13", "r13d", "r13w", "r13b", + "r14", "r14d", "r14w", "r14b", + "r15", "r15d", "r15w", "r15b", + "xmm0", "ymm0", + "xmm1", "ymm1", + "xmm2", "ymm2", + "xmm3", "ymm3", + "xmm4", "ymm4", + "xmm5", "ymm5", + "xmm6", "ymm6", + "xmm7", "ymm7", + "xmm8", "ymm8", + "xmm9", "ymm9", + "xmm10", "ymm10", + "xmm11", "ymm11", + "xmm12", "ymm12", + "xmm13", "ymm13", + "xmm14", "ymm14", + "xmm15", "ymm15" + }; + + public static bool IsRegister(string text) + { + return Registers.Contains(text); + } + + private static HashSet Keywords = new HashSet + { + "ret", "retn", + "call", + "jl", "ja", "jb", "jbe", "je", "jz", "js", "jne", "jnz", "jns", "jae", "jmp", + "push", "pop" + }; + + public static bool IsKeyword(string text) + { + return Keywords.Contains(text); + } + } +} diff --git a/ReClass.NET/Nodes/FunctionNode.cs b/ReClass.NET/Nodes/FunctionNode.cs new file mode 100644 index 00000000..8a6c4429 --- /dev/null +++ b/ReClass.NET/Nodes/FunctionNode.cs @@ -0,0 +1,141 @@ +using System; +using System.Diagnostics.Contracts; +using System.Drawing; +using System.Linq; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class FunctionNode : BaseFunctionNode + { + public string Signature { get; set; } = "void function()"; + + public ClassNode BelongsToClass { get; set; } + + private int memorySize = IntPtr.Size; + public override int MemorySize => memorySize; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Function"; + icon = Properties.Resources.B16x16_Button_Function; + } + + public override string GetToolTipText(HotSpot spot) + { + DisassembleRemoteCode(spot.Process, spot.Address); + + return string.Join("\n", Instructions.Select(i => i.Instruction)); + } + + public override Size Draw(DrawContext context, int x, int y) + { + Contract.Requires(context != null); + + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + + AddSelection(context, x, y, context.Font.Height); + + x = AddIconPadding(context, x); + + x = AddIcon(context, x, y, context.IconProvider.Function, HotSpot.NoneId, HotSpotType.None); + + var tx = x; + + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Function") + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; + } + + x = AddOpenCloseIcon(context, x, y) + context.Font.Width; + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + var size = new Size(x - origX, context.Font.Height); + + var ptr = context.Address + Offset; + DisassembleRemoteCode(context.Process, ptr); + + if (LevelsOpen[context.Level]) + { + y += context.Font.Height; + x = AddText(context, tx, y, context.Settings.TypeColor, HotSpot.NoneId, "Signature:") + context.Font.Width; + x = AddText(context, x, y, context.Settings.ValueColor, 0, Signature); + size.Width = Math.Max(size.Width, x - origX); + size.Height += context.Font.Height; + + y += context.Font.Height; + x = AddText(context, tx, y, context.Settings.TextColor, HotSpot.NoneId, "Belongs to: "); + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, BelongsToClass == null ? "" : $"<{BelongsToClass.Name}>") + context.Font.Width; + x = AddIcon(context, x, y, context.IconProvider.Change, 1, HotSpotType.ChangeClassType); + size.Width = Math.Max(size.Width, x - origX); + size.Height += context.Font.Height; + + var instructionSize = DrawInstructions(context, tx, y + 4); + size.Width = Math.Max(size.Width, instructionSize.Width + tx - origX); + size.Height += instructionSize.Height + 4; + } + + return size; + } + + public override int CalculateDrawnHeight(DrawContext context) + { + if (IsHidden && !IsWrapped) + { + return HiddenHeight; + } + + var height = context.Font.Height; + if (LevelsOpen[context.Level]) + { + height += Instructions.Count * context.Font.Height; + } + return height; + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0) // Signature + { + Signature = spot.Text; + } + } + + private void DisassembleRemoteCode(RemoteProcess process, IntPtr address) + { + Contract.Requires(process != null); + + if (this.Address != address) + { + Instructions.Clear(); + + this.Address = address; + + if (!address.IsNull() && process.IsValid) + { + DisassembleRemoteCode(process, address, out memorySize); + } + + GetParentContainer()?.ChildHasChanged(this); + } + } + } +} diff --git a/ReClass.NET/Nodes/FunctionPtrNode.cs b/ReClass.NET/Nodes/FunctionPtrNode.cs new file mode 100644 index 00000000..6b7d28e7 --- /dev/null +++ b/ReClass.NET/Nodes/FunctionPtrNode.cs @@ -0,0 +1,19 @@ +using System.Drawing; +using ReClassNET.Controls; + +namespace ReClassNET.Nodes +{ + public class FunctionPtrNode : BaseFunctionPtrNode + { + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Function Pointer"; + icon = Properties.Resources.B16x16_Button_Function_Pointer; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return Draw(context, x, y, "FunctionPtr", Name); + } + } +} diff --git a/ReClass.NET/Nodes/Hex16Node.cs b/ReClass.NET/Nodes/Hex16Node.cs new file mode 100644 index 00000000..2e18994a --- /dev/null +++ b/ReClass.NET/Nodes/Hex16Node.cs @@ -0,0 +1,35 @@ +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Hex16Node : BaseHexNode + { + public override int MemorySize => 2; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Hex16"; + icon = Properties.Resources.B16x16_Button_Hex_16; + } + + public override string GetToolTipText(HotSpot spot) + { + var value = new UInt16Data { ShortValue = spot.Memory.ReadInt16(Offset) }; + + return $"Int16: {value.ShortValue}\nUInt16: 0x{value.UShortValue:X04}"; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return Draw(context, x, y, context.Settings.ShowNodeText ? context.Memory.ReadString(context.Settings.RawDataEncoding, Offset, 2) + " " : null, 2); + } + + public override void Update(HotSpot spot) + { + Update(spot, 2); + } + } +} diff --git a/ReClass.NET/Nodes/Hex32Node.cs b/ReClass.NET/Nodes/Hex32Node.cs new file mode 100644 index 00000000..c7b54027 --- /dev/null +++ b/ReClass.NET/Nodes/Hex32Node.cs @@ -0,0 +1,61 @@ +using System; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Hex32Node : BaseHexCommentNode + { + public override int MemorySize => 4; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Hex32"; + icon = Properties.Resources.B16x16_Button_Hex_32; + } + + public override bool UseMemoryPreviewToolTip(HotSpot spot, out IntPtr address) + { + var value = ReadFromBuffer(spot.Memory, Offset); + + address = value.IntPtr; + + return spot.Process?.GetNamedAddress(value.IntPtr) != null; + } + + public override string GetToolTipText(HotSpot spot) + { + var value = ReadFromBuffer(spot.Memory, Offset); + + return $"Int32: {value.IntValue}\nUInt32: 0x{value.UIntValue:X08}\nFloat: {value.FloatValue:0.000}"; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return Draw(context, x, y, context.Settings.ShowNodeText ? context.Memory.ReadString(context.Settings.RawDataEncoding, Offset, 4) + " " : null, 4); + } + + public override void Update(HotSpot spot) + { + Update(spot, 4); + } + + protected override int AddComment(DrawContext context, int x, int y) + { + x = base.AddComment(context, x, y); + + var value = ReadFromBuffer(context.Memory, Offset); + + x = AddComment(context, x, y, value.FloatValue, value.IntPtr, value.UIntPtr); + + return x; + } + + private static UInt32FloatData ReadFromBuffer(MemoryBuffer memory, int offset) => new UInt32FloatData + { + Raw = memory.ReadInt32(offset) + }; + } +} diff --git a/ReClass.NET/Nodes/Hex64Node.cs b/ReClass.NET/Nodes/Hex64Node.cs new file mode 100644 index 00000000..d54f1e71 --- /dev/null +++ b/ReClass.NET/Nodes/Hex64Node.cs @@ -0,0 +1,62 @@ +using System; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Hex64Node : BaseHexCommentNode + { + public override int MemorySize => 8; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Hex64"; + icon = Properties.Resources.B16x16_Button_Hex_64; + } + + public override bool UseMemoryPreviewToolTip(HotSpot spot, out IntPtr address) + { + var value = ReadFromBuffer(spot.Memory, Offset); + + address = value.IntPtr; + + return spot.Process.GetSectionToPointer(value.IntPtr) != null; + } + + public override string GetToolTipText(HotSpot spot) + { + var value = ReadFromBuffer(spot.Memory, Offset); + + return $"Int64: {value.LongValue}\nUInt64: 0x{value.ULongValue:X016}\nFloat: {value.FloatValue:0.000}\nDouble: {value.DoubleValue:0.000}"; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return Draw(context, x, y, context.Settings.ShowNodeText ? context.Memory.ReadString(context.Settings.RawDataEncoding, Offset, 8) + " " : null, 8); + } + + public override void Update(HotSpot spot) + { + Update(spot, 8); + } + + protected override int AddComment(DrawContext context, int x, int y) + { + x = base.AddComment(context, x, y); + + var value = ReadFromBuffer(context.Memory, Offset); + + x = AddComment(context, x, y, value.FloatValue, value.IntPtr, value.UIntPtr); + + return x; + } + + private static UInt64FloatDoubleData ReadFromBuffer(MemoryBuffer memory, int offset) => new UInt64FloatDoubleData + { + Raw1 = memory.ReadInt32(offset), + Raw2 = memory.ReadInt32(offset + sizeof(int)) + }; + } +} diff --git a/ReClass.NET/Nodes/Hex8Node.cs b/ReClass.NET/Nodes/Hex8Node.cs new file mode 100644 index 00000000..7c29884e --- /dev/null +++ b/ReClass.NET/Nodes/Hex8Node.cs @@ -0,0 +1,34 @@ +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Hex8Node : BaseHexNode + { + public override int MemorySize => 1; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Hex8"; + icon = Properties.Resources.B16x16_Button_Hex_8; + } + + public override string GetToolTipText(HotSpot spot) + { + var b = spot.Memory.ReadUInt8(Offset); + + return $"Int8: {(int)b}\nUInt8: 0x{b:X02}"; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return Draw(context, x, y, context.Settings.ShowNodeText ? context.Memory.ReadString(context.Settings.RawDataEncoding, Offset, 1) + " " : null, 1); + } + + public override void Update(HotSpot spot) + { + Update(spot, 1); + } + } +} diff --git a/ReClass.NET/Nodes/INodeInfoReader.cs b/ReClass.NET/Nodes/INodeInfoReader.cs new file mode 100644 index 00000000..75289ccf --- /dev/null +++ b/ReClass.NET/Nodes/INodeInfoReader.cs @@ -0,0 +1,34 @@ +using System; +using System.Diagnostics.Contracts; +using ReClassNET.Memory; + +namespace ReClassNET.Nodes +{ + [ContractClass(typeof(NodeInfoReaderContract))] + public interface INodeInfoReader + { + /// + /// Used to print custom informations about a node. + /// + /// The node. + /// The current . + /// The current . + /// The absolute address of the node. + /// The memory value of the node as . + /// Custom informations about the node or null. + string ReadNodeInfo(BaseHexCommentNode node, IRemoteMemoryReader reader, MemoryBuffer memory, IntPtr nodeAddress, IntPtr nodeValue); + } + + [ContractClassFor(typeof(INodeInfoReader))] + internal abstract class NodeInfoReaderContract : INodeInfoReader + { + public string ReadNodeInfo(BaseHexCommentNode node, IRemoteMemoryReader reader, MemoryBuffer memory, IntPtr nodeAddress, IntPtr nodeValue) + { + Contract.Requires(node != null); + Contract.Requires(reader != null); + Contract.Requires(memory != null); + + throw new NotImplementedException(); + } + } +} diff --git a/ReClass.NET/Nodes/Int16Node.cs b/ReClass.NET/Nodes/Int16Node.cs new file mode 100644 index 00000000..e67b2145 --- /dev/null +++ b/ReClass.NET/Nodes/Int16Node.cs @@ -0,0 +1,44 @@ +using System.Drawing; +using System.Globalization; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Int16Node : BaseNumericNode + { + public override int MemorySize => 2; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Int16"; + icon = Properties.Resources.B16x16_Button_Int_16; + } + + public override Size Draw(DrawContext context, int x, int y) + { + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Signed, "Int16", value.ToString(), $"0x{value:X}"); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0 || spot.Id == 1) + { + if (short.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && short.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } + } + } + + public short ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadInt16(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/Int32Node.cs b/ReClass.NET/Nodes/Int32Node.cs new file mode 100644 index 00000000..5ba2090e --- /dev/null +++ b/ReClass.NET/Nodes/Int32Node.cs @@ -0,0 +1,44 @@ +using System.Drawing; +using System.Globalization; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Int32Node : BaseNumericNode + { + public override int MemorySize => 4; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Int32"; + icon = Properties.Resources.B16x16_Button_Int_32; + } + + public override Size Draw(DrawContext context, int x, int y) + { + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Signed, "Int32", value.ToString(), $"0x{value:X}"); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0 || spot.Id == 1) + { + if (int.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && int.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } + } + } + + public int ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadInt32(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/Int64Node.cs b/ReClass.NET/Nodes/Int64Node.cs new file mode 100644 index 00000000..935e4569 --- /dev/null +++ b/ReClass.NET/Nodes/Int64Node.cs @@ -0,0 +1,44 @@ +using System.Drawing; +using System.Globalization; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Int64Node : BaseNumericNode + { + public override int MemorySize => 8; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Int64"; + icon = Properties.Resources.B16x16_Button_Int_64; + } + + public override Size Draw(DrawContext context, int x, int y) + { + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Signed, "Int64", value.ToString(), $"0x{value:X}"); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0 || spot.Id == 1) + { + if (long.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && long.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } + } + } + + public long ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadInt64(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/Int8Node.cs b/ReClass.NET/Nodes/Int8Node.cs new file mode 100644 index 00000000..fbfe4038 --- /dev/null +++ b/ReClass.NET/Nodes/Int8Node.cs @@ -0,0 +1,44 @@ +using System.Drawing; +using System.Globalization; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Int8Node : BaseNumericNode + { + public override int MemorySize => 1; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Int8"; + icon = Properties.Resources.B16x16_Button_Int_8; + } + + public override Size Draw(DrawContext context, int x, int y) + { + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Signed, "Int8", value.ToString(), $"0x{value:X}"); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0 || spot.Id == 1) + { + if (sbyte.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && sbyte.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } + } + } + + public sbyte ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadInt8(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/Matrix3x3Node.cs b/ReClass.NET/Nodes/Matrix3x3Node.cs new file mode 100644 index 00000000..37bc1802 --- /dev/null +++ b/ReClass.NET/Nodes/Matrix3x3Node.cs @@ -0,0 +1,36 @@ +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Matrix3x3Node : BaseMatrixNode + { + public override int ValueTypeSize => sizeof(float); + + public override int MemorySize => 9 * ValueTypeSize; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Matrix 3x3"; + icon = Properties.Resources.B16x16_Button_Matrix_3x3; + } + + public override Size Draw(DrawContext context, int x2, int y2) + { + return DrawMatrixType(context, x2, y2, "Matrix (3x3)", 3, 3); + } + + protected override int CalculateValuesHeight(DrawContext context) + { + return 3 * context.Font.Height; + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + Update(spot, 9); + } + } +} diff --git a/ReClass.NET/Nodes/Matrix3x4Node.cs b/ReClass.NET/Nodes/Matrix3x4Node.cs new file mode 100644 index 00000000..96948064 --- /dev/null +++ b/ReClass.NET/Nodes/Matrix3x4Node.cs @@ -0,0 +1,36 @@ +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Matrix3x4Node : BaseMatrixNode + { + public override int ValueTypeSize => sizeof(float); + + public override int MemorySize => 12 * ValueTypeSize; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Matrix 3x4"; + icon = Properties.Resources.B16x16_Button_Matrix_3x4; + } + + public override Size Draw(DrawContext context, int x2, int y2) + { + return DrawMatrixType(context, x2, y2, "Matrix (3x4)", 3, 4); + } + + protected override int CalculateValuesHeight(DrawContext context) + { + return 3 * context.Font.Height; + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + Update(spot, 12); + } + } +} diff --git a/ReClass.NET/Nodes/Matrix4x4Node.cs b/ReClass.NET/Nodes/Matrix4x4Node.cs new file mode 100644 index 00000000..69318694 --- /dev/null +++ b/ReClass.NET/Nodes/Matrix4x4Node.cs @@ -0,0 +1,36 @@ +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Matrix4x4Node : BaseMatrixNode + { + public override int ValueTypeSize => sizeof(float); + + public override int MemorySize => 16 * ValueTypeSize; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Matrix 4x4"; + icon = Properties.Resources.B16x16_Button_Matrix_4x4; + } + + public override Size Draw(DrawContext context, int x2, int y2) + { + return DrawMatrixType(context, x2, y2, "Matrix (4x4)", 4, 4); + } + + protected override int CalculateValuesHeight(DrawContext context) + { + return 4 * context.Font.Height; + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + Update(spot, 16); + } + } +} diff --git a/ReClass.NET/Nodes/NIntNode.cs b/ReClass.NET/Nodes/NIntNode.cs new file mode 100644 index 00000000..77d021e0 --- /dev/null +++ b/ReClass.NET/Nodes/NIntNode.cs @@ -0,0 +1,57 @@ +using System; +using System.Drawing; +using System.Globalization; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class NIntNode : BaseNumericNode + { + public override int MemorySize => IntPtr.Size; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "NInt"; + icon = Properties.Resources.B16x16_Button_NInt; + } + + public override Size Draw(DrawContext context, int x, int y) + { + var value = ReadValueFromMemory(context.Memory) +#if RECLASSNET64 + .ToInt64(); +#else + .ToInt32(); +#endif + return DrawNumeric(context, x, y, context.IconProvider.Signed, "NInt", value.ToString(), $"0x{value:X}"); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0 || spot.Id == 1) + { +#if RECLASSNET64 + if (long.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && long.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } +#else + if (int.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && int.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } +#endif + } + } + + public IntPtr ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadIntPtr(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/NUIntNode.cs b/ReClass.NET/Nodes/NUIntNode.cs new file mode 100644 index 00000000..1b502ad0 --- /dev/null +++ b/ReClass.NET/Nodes/NUIntNode.cs @@ -0,0 +1,57 @@ +using System; +using System.Drawing; +using System.Globalization; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class NUIntNode : BaseNumericNode + { + public override int MemorySize => UIntPtr.Size; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "NUInt"; + icon = Properties.Resources.B16x16_Button_NUInt; + } + + public override Size Draw(DrawContext context, int x, int y) + { + var value = ReadValueFromMemory(context.Memory) +#if RECLASSNET64 + .ToUInt64(); +#else + .ToUInt32(); +#endif + return DrawNumeric(context, x, y, context.IconProvider.Unsigned, "NUInt", value.ToString(), $"0x{value:X}"); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0 || spot.Id == 1) + { +#if RECLASSNET64 + if (ulong.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && ulong.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } +#else + if (uint.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && uint.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } +#endif + } + } + + public UIntPtr ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadUIntPtr(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/PointerNode.cs b/ReClass.NET/Nodes/PointerNode.cs new file mode 100644 index 00000000..027b0d28 --- /dev/null +++ b/ReClass.NET/Nodes/PointerNode.cs @@ -0,0 +1,138 @@ +using System; +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class PointerNode : BaseWrapperNode + { + private readonly MemoryBuffer memory = new MemoryBuffer(); + + public override int MemorySize => IntPtr.Size; + + protected override bool PerformCycleCheck => false; + + public PointerNode() + { + LevelsOpen.DefaultValue = true; + } + + public override void Initialize() + { + var node = new ClassInstanceNode(); + node.Initialize(); + ((BaseContainerNode)node.InnerNode).AddBytes(16 * IntPtr.Size); + + ChangeInnerNode(node); + } + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Pointer"; + icon = Properties.Resources.B16x16_Button_Pointer; + } + + public override bool UseMemoryPreviewToolTip(HotSpot spot, out IntPtr address) + { + // TODO Should the preview be disabled if an inner node is set? + + address = spot.Memory.ReadIntPtr(Offset); + + return spot.Process.GetNamedAddress(address) != null; + } + + public override bool CanChangeInnerNodeTo(BaseNode node) => + node switch + { + ClassNode _ => false, + VirtualMethodNode _ => false, + _ => true + }; + + public override Size Draw(DrawContext context, int x, int y) + { + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + var origY = y; + + AddSelection(context, x, y, context.Font.Height); + + if (InnerNode != null) + { + x = AddOpenCloseIcon(context, x, y); + } + else + { + x = AddIconPadding(context, x); + } + x = AddIcon(context, x, y, context.IconProvider.Pointer, HotSpot.NoneId, HotSpotType.None); + + var tx = x; + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Ptr") + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; + } + if (InnerNode == null) + { + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, "") + context.Font.Width; + } + x = AddIcon(context, x, y, context.IconProvider.Change, 4, HotSpotType.ChangeWrappedType) + context.Font.Width; + + var ptr = context.Memory.ReadIntPtr(Offset); + + x = AddText(context, x, y, context.Settings.OffsetColor, HotSpot.NoneId, "->") + context.Font.Width; + x = AddText(context, x, y, context.Settings.ValueColor, 0, "0x" + ptr.ToString(Constants.AddressHexFormat)) + context.Font.Width; + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + y += context.Font.Height; + + var size = new Size(x - origX, y - origY); + + if (LevelsOpen[context.Level] && InnerNode != null) + { + memory.Size = InnerNode.MemorySize; + memory.UpdateFrom(context.Process, ptr); + + var innerContext = context.Clone(); + innerContext.Address = ptr; + innerContext.Memory = memory; + + var innerSize = InnerNode.Draw(innerContext, tx, y); + + size.Width = Math.Max(size.Width, innerSize.Width + tx - origX); + size.Height += innerSize.Height; + } + + return size; + } + + public override int CalculateDrawnHeight(DrawContext context) + { + if (IsHidden && !IsWrapped) + { + return HiddenHeight; + } + + var height = context.Font.Height; + if (LevelsOpen[context.Level] && InnerNode != null) + { + height += InnerNode.CalculateDrawnHeight(context); + } + return height; + } + } +} diff --git a/ReClass.NET/Nodes/UInt16Node.cs b/ReClass.NET/Nodes/UInt16Node.cs new file mode 100644 index 00000000..47f72602 --- /dev/null +++ b/ReClass.NET/Nodes/UInt16Node.cs @@ -0,0 +1,44 @@ +using System.Drawing; +using System.Globalization; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class UInt16Node : BaseNumericNode + { + public override int MemorySize => 2; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "UInt16 / WORD"; + icon = Properties.Resources.B16x16_Button_UInt_16; + } + + public override Size Draw(DrawContext context, int x, int y) + { + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Unsigned, "UInt16", value.ToString(), $"0x{value:X}"); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0 || spot.Id == 1) + { + if (ushort.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && ushort.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } + } + } + + public ushort ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadUInt16(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/UInt32Node.cs b/ReClass.NET/Nodes/UInt32Node.cs new file mode 100644 index 00000000..ad97faae --- /dev/null +++ b/ReClass.NET/Nodes/UInt32Node.cs @@ -0,0 +1,44 @@ +using System.Drawing; +using System.Globalization; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class UInt32Node : BaseNumericNode + { + public override int MemorySize => 4; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "UInt32 / DWORD"; + icon = Properties.Resources.B16x16_Button_UInt_32; + } + + public override Size Draw(DrawContext context, int x, int y) + { + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Unsigned, "UInt32", value.ToString(), $"0x{value:X}"); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0 || spot.Id == 1) + { + if (uint.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && uint.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } + } + } + + public uint ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadUInt32(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/UInt64Node.cs b/ReClass.NET/Nodes/UInt64Node.cs new file mode 100644 index 00000000..603eb784 --- /dev/null +++ b/ReClass.NET/Nodes/UInt64Node.cs @@ -0,0 +1,44 @@ +using System.Drawing; +using System.Globalization; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class UInt64Node : BaseNumericNode + { + public override int MemorySize => 8; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "UInt64 / QWORD"; + icon = Properties.Resources.B16x16_Button_UInt_64; + } + + public override Size Draw(DrawContext context, int x, int y) + { + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Unsigned, "UInt64", value.ToString(), $"0x{value:X}"); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0 || spot.Id == 1) + { + if (ulong.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && ulong.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } + } + } + + public ulong ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadUInt64(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/UInt8Node.cs b/ReClass.NET/Nodes/UInt8Node.cs new file mode 100644 index 00000000..ce6def15 --- /dev/null +++ b/ReClass.NET/Nodes/UInt8Node.cs @@ -0,0 +1,44 @@ +using System.Drawing; +using System.Globalization; +using ReClassNET.Controls; +using ReClassNET.Extensions; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class UInt8Node : BaseNumericNode + { + public override int MemorySize => 1; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "UInt8 / BYTE"; + icon = Properties.Resources.B16x16_Button_UInt_8; + } + + public override Size Draw(DrawContext context, int x, int y) + { + var value = ReadValueFromMemory(context.Memory); + return DrawNumeric(context, x, y, context.IconProvider.Unsigned, "UInt8", value.ToString(), $"0x{value:X}"); + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + if (spot.Id == 0 || spot.Id == 1) + { + if (byte.TryParse(spot.Text, out var val) || spot.Text.TryGetHexString(out var hexValue) && byte.TryParse(hexValue, NumberStyles.HexNumber, null, out val)) + { + spot.Process.WriteRemoteMemory(spot.Address, val); + } + } + } + + public byte ReadValueFromMemory(MemoryBuffer memory) + { + return memory.ReadUInt8(Offset); + } + } +} diff --git a/ReClass.NET/Nodes/UTF16TextNode.cs b/ReClass.NET/Nodes/UTF16TextNode.cs new file mode 100644 index 00000000..9ea1bc6a --- /dev/null +++ b/ReClass.NET/Nodes/UTF16TextNode.cs @@ -0,0 +1,22 @@ +using System.Drawing; +using System.Text; +using ReClassNET.Controls; + +namespace ReClassNET.Nodes +{ + public class Utf16TextNode : BaseTextNode + { + public override Encoding Encoding => Encoding.Unicode; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "UTF16 / Unicode Text"; + icon = Properties.Resources.B16x16_Button_UText; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return DrawText(context, x, y, "Text16"); + } + } +} diff --git a/ReClass.NET/Nodes/UTF16TextPtrNode.cs b/ReClass.NET/Nodes/UTF16TextPtrNode.cs new file mode 100644 index 00000000..dc02f3f1 --- /dev/null +++ b/ReClass.NET/Nodes/UTF16TextPtrNode.cs @@ -0,0 +1,22 @@ +using System.Drawing; +using System.Text; +using ReClassNET.Controls; + +namespace ReClassNET.Nodes +{ + public class Utf16TextPtrNode : BaseTextPtrNode + { + public override Encoding Encoding => Encoding.Unicode; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "UTF16 / Unicode Text Pointer"; + icon = Properties.Resources.B16x16_Button_UText_Pointer; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return DrawText(context, x, y, "Text16Ptr"); + } + } +} diff --git a/ReClass.NET/Nodes/UTF32TextNode.cs b/ReClass.NET/Nodes/UTF32TextNode.cs new file mode 100644 index 00000000..f08d7735 --- /dev/null +++ b/ReClass.NET/Nodes/UTF32TextNode.cs @@ -0,0 +1,22 @@ +using System.Drawing; +using System.Text; +using ReClassNET.Controls; + +namespace ReClassNET.Nodes +{ + public class Utf32TextNode : BaseTextNode + { + public override Encoding Encoding => Encoding.UTF32; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "UTF32 Text"; + icon = Properties.Resources.B16x16_Button_UText; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return DrawText(context, x, y, "Text32"); + } + } +} diff --git a/ReClass.NET/Nodes/UTF32TextPtrNode.cs b/ReClass.NET/Nodes/UTF32TextPtrNode.cs new file mode 100644 index 00000000..3e7b920e --- /dev/null +++ b/ReClass.NET/Nodes/UTF32TextPtrNode.cs @@ -0,0 +1,22 @@ +using System.Drawing; +using System.Text; +using ReClassNET.Controls; + +namespace ReClassNET.Nodes +{ + public class Utf32TextPtrNode : BaseTextPtrNode + { + public override Encoding Encoding => Encoding.UTF32; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "UTF32 Text Pointer"; + icon = Properties.Resources.B16x16_Button_UText_Pointer; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return DrawText(context, x, y, "Text32Ptr"); + } + } +} diff --git a/ReClass.NET/Nodes/UTF8TextNode.cs b/ReClass.NET/Nodes/UTF8TextNode.cs new file mode 100644 index 00000000..ef9c5ff6 --- /dev/null +++ b/ReClass.NET/Nodes/UTF8TextNode.cs @@ -0,0 +1,22 @@ +using System.Drawing; +using System.Text; +using ReClassNET.Controls; + +namespace ReClassNET.Nodes +{ + public class Utf8TextNode : BaseTextNode + { + public override Encoding Encoding => Encoding.UTF8; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "UTF8 / ASCII Text"; + icon = Properties.Resources.B16x16_Button_Text; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return DrawText(context, x, y, "Text8"); + } + } +} diff --git a/ReClass.NET/Nodes/UTF8TextPtrNode.cs b/ReClass.NET/Nodes/UTF8TextPtrNode.cs new file mode 100644 index 00000000..d1173ff2 --- /dev/null +++ b/ReClass.NET/Nodes/UTF8TextPtrNode.cs @@ -0,0 +1,22 @@ +using System.Drawing; +using System.Text; +using ReClassNET.Controls; + +namespace ReClassNET.Nodes +{ + public class Utf8TextPtrNode : BaseTextPtrNode + { + public override Encoding Encoding => Encoding.UTF8; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "UTF8 / ASCII Text Pointer"; + icon = Properties.Resources.B16x16_Button_Text_Pointer; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return DrawText(context, x, y, "Text8Ptr"); + } + } +} diff --git a/ReClass.NET/Nodes/UnionNode.cs b/ReClass.NET/Nodes/UnionNode.cs new file mode 100644 index 00000000..f46108c2 --- /dev/null +++ b/ReClass.NET/Nodes/UnionNode.cs @@ -0,0 +1,117 @@ +using System; +using System.Drawing; +using System.Linq; +using ReClassNET.Controls; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class UnionNode : BaseContainerNode + { + public override int MemorySize => Nodes.Max(n => n.MemorySize); + + protected override bool ShouldCompensateSizeChanges => false; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Union"; + icon = Properties.Resources.B16x16_Button_Union; + } + + public override bool CanHandleChildNode(BaseNode node) + { + switch (node) + { + case null: + case ClassNode _: + case VirtualMethodNode _: + return false; + } + + return true; + } + + public override void Initialize() + { + AddNode(CreateDefaultNodeForSize(IntPtr.Size)); + } + + public override void UpdateOffsets() + { + foreach (var node in Nodes) + { + node.Offset = 0; + } + } + + public override Size Draw(DrawContext context, int x, int y) + { + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + var origY = y; + + AddSelection(context, x, y, context.Font.Height); + + x = AddOpenCloseIcon(context, x, y); + x = AddIcon(context, x, y, context.IconProvider.Union, -1, HotSpotType.None); + + var tx = x; + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.TypeColor, HotSpot.NoneId, "Union") + context.Font.Width; + + x = AddText(context, x, y, context.Settings.ValueColor, HotSpot.NoneId, $"[Nodes: {Nodes.Count}, Size: {MemorySize}]") + context.Font.Width; + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + y += context.Font.Height; + + var size = new Size(x - origX, y - origY); + + if (LevelsOpen[context.Level]) + { + var innerContext = context.Clone(); + innerContext.Settings = Program.Settings.Clone(); + innerContext.Settings.ShowNodeAddress = false; + innerContext.Address = context.Address + Offset; + innerContext.Memory = context.Memory.Clone(); + innerContext.Memory.Offset += Offset; + + foreach (var node in Nodes) + { + var innerSize = node.Draw(innerContext, tx, y); + + size.Width = Math.Max(size.Width, innerSize.Width + tx - origX); + size.Height += innerSize.Height; + + y += innerSize.Height; + } + } + + return size; + } + + public override int CalculateDrawnHeight(DrawContext context) + { + if (IsHidden && !IsWrapped) + { + return HiddenHeight; + } + + var height = context.Font.Height; + if (LevelsOpen[context.Level]) + { + height += Nodes.Sum(n => n.CalculateDrawnHeight(context)); + } + return height; + } + } +} diff --git a/ReClass.NET/Nodes/Vector2Node.cs b/ReClass.NET/Nodes/Vector2Node.cs new file mode 100644 index 00000000..a3df104a --- /dev/null +++ b/ReClass.NET/Nodes/Vector2Node.cs @@ -0,0 +1,36 @@ +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Vector2Node : BaseMatrixNode + { + public override int ValueTypeSize => sizeof(float); + + public override int MemorySize => 2 * ValueTypeSize; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Vector2"; + icon = Properties.Resources.B16x16_Button_Vector_2; + } + + public override Size Draw(DrawContext context, int x2, int y2) + { + return DrawVectorType(context, x2, y2, "Vector2", 2); + } + + protected override int CalculateValuesHeight(DrawContext context) + { + return 0; + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + Update(spot, 2); + } + } +} diff --git a/ReClass.NET/Nodes/Vector3Node.cs b/ReClass.NET/Nodes/Vector3Node.cs new file mode 100644 index 00000000..b2b84b25 --- /dev/null +++ b/ReClass.NET/Nodes/Vector3Node.cs @@ -0,0 +1,36 @@ +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Vector3Node : BaseMatrixNode + { + public override int ValueTypeSize => sizeof(float); + + public override int MemorySize => 3 * ValueTypeSize; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Vector3"; + icon = Properties.Resources.B16x16_Button_Vector_3; + } + + public override Size Draw(DrawContext context, int x2, int y2) + { + return DrawVectorType(context, x2, y2, "Vector3", 3); + } + + protected override int CalculateValuesHeight(DrawContext context) + { + return 0; + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + Update(spot, 3); + } + } +} diff --git a/ReClass.NET/Nodes/Vector4Node.cs b/ReClass.NET/Nodes/Vector4Node.cs new file mode 100644 index 00000000..54f1a43c --- /dev/null +++ b/ReClass.NET/Nodes/Vector4Node.cs @@ -0,0 +1,36 @@ +using System.Drawing; +using ReClassNET.Controls; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class Vector4Node : BaseMatrixNode + { + public override int ValueTypeSize => sizeof(float); + + public override int MemorySize => 4 * ValueTypeSize; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "Vector4"; + icon = Properties.Resources.B16x16_Button_Vector_4; + } + + public override Size Draw(DrawContext context, int x2, int y2) + { + return DrawVectorType(context, x2, y2, "Vector4", 4); + } + + protected override int CalculateValuesHeight(DrawContext context) + { + return 0; + } + + public override void Update(HotSpot spot) + { + base.Update(spot); + + Update(spot, 4); + } + } +} diff --git a/ReClass.NET/Nodes/VirtualMethodNode.cs b/ReClass.NET/Nodes/VirtualMethodNode.cs new file mode 100644 index 00000000..22bae685 --- /dev/null +++ b/ReClass.NET/Nodes/VirtualMethodNode.cs @@ -0,0 +1,29 @@ +using System; +using System.Diagnostics.Contracts; +using System.Drawing; +using ReClassNET.Controls; + +namespace ReClassNET.Nodes +{ + public class VirtualMethodNode : BaseFunctionPtrNode + { + public string MethodName => string.IsNullOrEmpty(Name) ? $"Function{Offset / IntPtr.Size}" : Name; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + throw new InvalidOperationException($"The '{nameof(VirtualMethodNode)}' node should not be accessible from the ui."); + } + + public VirtualMethodNode() + { + Contract.Ensures(Name != null); + + Name = string.Empty; + } + + public override Size Draw(DrawContext context, int x, int y) + { + return Draw(context, x, y, $"({Offset / IntPtr.Size})", MethodName); + } + } +} diff --git a/ReClass.NET/Nodes/VirtualMethodTableNode.cs b/ReClass.NET/Nodes/VirtualMethodTableNode.cs new file mode 100644 index 00000000..9e82ab40 --- /dev/null +++ b/ReClass.NET/Nodes/VirtualMethodTableNode.cs @@ -0,0 +1,117 @@ +using System; +using System.Drawing; +using System.Linq; +using ReClassNET.Controls; +using ReClassNET.Memory; +using ReClassNET.UI; + +namespace ReClassNET.Nodes +{ + public class VirtualMethodTableNode : BaseContainerNode + { + private readonly MemoryBuffer memory = new MemoryBuffer(); + + public override int MemorySize => IntPtr.Size; + + protected override bool ShouldCompensateSizeChanges => false; + + public override void GetUserInterfaceInfo(out string name, out Image icon) + { + name = "VTable Pointer"; + icon = Properties.Resources.B16x16_Button_VTable; + } + + public override bool CanHandleChildNode(BaseNode node) + { + return node is VirtualMethodNode; + } + + public override void Initialize() + { + for (var i = 0; i < 10; ++i) + { + AddNode(CreateDefaultNodeForSize(IntPtr.Size)); + } + } + + public override Size Draw(DrawContext context, int x, int y) + { + if (IsHidden && !IsWrapped) + { + return DrawHidden(context, x, y); + } + + var origX = x; + var origY = y; + + AddSelection(context, x, y, context.Font.Height); + + x = AddOpenCloseIcon(context, x, y); + x = AddIcon(context, x, y, context.IconProvider.VirtualTable, HotSpot.NoneId, HotSpotType.None); + + var tx = x; + x = AddAddressOffset(context, x, y); + + x = AddText(context, x, y, context.Settings.VTableColor, HotSpot.NoneId, $"VTable[{Nodes.Count}]") + context.Font.Width; + if (!IsWrapped) + { + x = AddText(context, x, y, context.Settings.NameColor, HotSpot.NameId, Name) + context.Font.Width; + } + + x = AddComment(context, x, y); + + DrawInvalidMemoryIndicatorIcon(context, y); + AddContextDropDownIcon(context, y); + AddDeleteIcon(context, y); + + y += context.Font.Height; + + var size = new Size(x - origX, y - origY); + + if (LevelsOpen[context.Level]) + { + var ptr = context.Memory.ReadIntPtr(Offset); + + memory.Size = Nodes.Count * IntPtr.Size; + memory.UpdateFrom(context.Process, ptr); + + var innerContext = context.Clone(); + innerContext.Address = ptr; + innerContext.Memory = memory; + + foreach (var node in Nodes) + { + var innerSize = node.Draw(innerContext, tx, y); + + size.Width = Math.Max(size.Width, innerSize.Width + tx - origX); + size.Height += innerSize.Height; + + y += innerSize.Height; + } + } + + return size; + } + + public override int CalculateDrawnHeight(DrawContext context) + { + if (IsHidden && !IsWrapped) + { + return HiddenHeight; + } + + var height = context.Font.Height; + if (LevelsOpen[context.Level]) + { + height += Nodes.Sum(n => n.CalculateDrawnHeight(context)); + } + return height; + } + + protected override BaseNode CreateDefaultNodeForSize(int size) + { + // ignore the size parameter + return new VirtualMethodNode(); + } + } +} diff --git a/ReClass.NET/Plugins/DefaultPluginHost.cs b/ReClass.NET/Plugins/DefaultPluginHost.cs new file mode 100644 index 00000000..24b3958a --- /dev/null +++ b/ReClass.NET/Plugins/DefaultPluginHost.cs @@ -0,0 +1,32 @@ +using System.Diagnostics.Contracts; +using System.Resources; +using ReClassNET.Forms; +using ReClassNET.Logger; +using ReClassNET.Memory; + +namespace ReClassNET.Plugins +{ + internal sealed class DefaultPluginHost : IPluginHost + { + public MainForm MainWindow { get; } + + public ResourceManager Resources => Properties.Resources.ResourceManager; + + public RemoteProcess Process { get; } + + public ILogger Logger { get; } + + public Settings Settings => Program.Settings; + + public DefaultPluginHost(MainForm form, RemoteProcess process, ILogger logger) + { + Contract.Requires(form != null); + Contract.Requires(process != null); + Contract.Requires(logger != null); + + MainWindow = form; + Process = process; + Logger = logger; + } + } +} diff --git a/ReClass.NET/Plugins/IPluginHost.cs b/ReClass.NET/Plugins/IPluginHost.cs new file mode 100644 index 00000000..7be6bf4d --- /dev/null +++ b/ReClass.NET/Plugins/IPluginHost.cs @@ -0,0 +1,82 @@ +using System; +using System.Diagnostics.Contracts; +using System.Resources; +using ReClassNET.Forms; +using ReClassNET.Logger; +using ReClassNET.Memory; + +namespace ReClassNET.Plugins +{ + [ContractClass(typeof(PluginHostContract))] + public interface IPluginHost + { + /// Gets the main window of ReClass.NET. + MainForm MainWindow { get; } + + /// Gets the resources of ReClass.NET. + ResourceManager Resources { get; } + + /// Gets the process ReClass.NET is attached to. + RemoteProcess Process { get; } + + /// Gets the logger ReClass.NET is using. + ILogger Logger { get; } + + /// Gets the settings ReClass.NET is using. + Settings Settings { get; } + } + + [ContractClassFor(typeof(IPluginHost))] + internal abstract class PluginHostContract : IPluginHost + { + public ILogger Logger + { + get + { + Contract.Ensures(Logger != null); + + throw new NotImplementedException(); + } + } + + public MainForm MainWindow + { + get + { + Contract.Ensures(MainWindow != null); + + throw new NotImplementedException(); + } + } + + public RemoteProcess Process + { + get + { + Contract.Ensures(Process != null); + + throw new NotImplementedException(); + } + } + + public ResourceManager Resources + { + get + { + Contract.Ensures(Resources != null); + + throw new NotImplementedException(); + } + } + + public Settings Settings + { + get + { + Contract.Ensures(Settings != null); + + throw new NotImplementedException(); + } + } + } +} diff --git a/ReClass.NET/Plugins/Plugin.cs b/ReClass.NET/Plugins/Plugin.cs new file mode 100644 index 00000000..2004be7e --- /dev/null +++ b/ReClass.NET/Plugins/Plugin.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Drawing; +using ReClassNET.CodeGenerator; +using ReClassNET.DataExchange.ReClass; +using ReClassNET.Nodes; + +namespace ReClassNET.Plugins +{ + public class Plugin + { + public class CustomNodeTypes + { + /// + /// A list with custom node types. + /// + public IReadOnlyList NodeTypes { get; set; } + + /// + /// An instance of a serializer which can process the custom node types. + /// + public ICustomNodeSerializer Serializer { get; set; } + + /// + /// An instance of a code generator which can process the custom node types. + /// + public CustomCppCodeGenerator CodeGenerator { get; set; } + } + + /// + /// The icon of the plugin. + /// + public virtual Image Icon => null; + + public virtual bool Initialize(IPluginHost host) + { + Contract.Requires(host != null); + + return true; + } + + public virtual void Terminate() + { + + } + + /// + /// Gets called once to receive all node info readers the plugin provides. + /// + /// A list with node info readers or null if the plugin provides none. + public virtual IReadOnlyList GetNodeInfoReaders() + { + return null; + } + + /// + /// Gets called once to receive all custom node types the plugin provides. + /// + /// Informations about the custom nodes or null if the plugin provides none. + public virtual CustomNodeTypes GetCustomNodeTypes() + { + return null; + } + } +} diff --git a/Plugins/PluginInfo.cs b/ReClass.NET/Plugins/PluginInfo.cs similarity index 56% rename from Plugins/PluginInfo.cs rename to ReClass.NET/Plugins/PluginInfo.cs index cd1d02fc..c9c9e72f 100644 --- a/Plugins/PluginInfo.cs +++ b/ReClass.NET/Plugins/PluginInfo.cs @@ -1,11 +1,15 @@ using System; +using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.Contracts; using System.IO; +using ReClassNET.Extensions; +using ReClassNET.Native; +using ReClassNET.Nodes; namespace ReClassNET.Plugins { - class PluginInfo + internal class PluginInfo : IDisposable { public const string PluginName = "ReClass.NET Plugin"; public const string PluginNativeName = "ReClass.NET Native Plugin"; @@ -26,13 +30,17 @@ class PluginInfo public IntPtr NativeHandle { get; set; } + public IReadOnlyList NodeInfoReaders { get; set; } + + public Plugin.CustomNodeTypes CustomNodeTypes { get; set; } + public PluginInfo(string filePath, FileVersionInfo versionInfo) { Contract.Requires(filePath != null); Contract.Requires(versionInfo != null); FilePath = filePath; - IsNative = versionInfo.ProductName == PluginNativeName; + IsNative = versionInfo.ProductName == null /* Unix */ || versionInfo.ProductName == PluginNativeName; FileVersion = (versionInfo.FileVersion ?? string.Empty).Trim(); @@ -45,5 +53,39 @@ public PluginInfo(string filePath, FileVersionInfo versionInfo) Name = Path.GetFileNameWithoutExtension(FilePath); } } + + ~PluginInfo() + { + ReleaseUnmanagedResources(); + } + + private void ReleaseUnmanagedResources() + { + if (!NativeHandle.IsNull()) + { + NativeMethods.FreeLibrary(NativeHandle); + + NativeHandle = IntPtr.Zero; + } + } + + public void Dispose() + { + if (Interface != null) + { + try + { + Interface.Terminate(); + } + catch + { + // ignored + } + } + + ReleaseUnmanagedResources(); + + GC.SuppressFinalize(this); + } } } diff --git a/ReClass.NET/Plugins/PluginManager.cs b/ReClass.NET/Plugins/PluginManager.cs new file mode 100644 index 00000000..d4372fb8 --- /dev/null +++ b/ReClass.NET/Plugins/PluginManager.cs @@ -0,0 +1,238 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.Contracts; +using System.IO; +using ReClassNET.CodeGenerator; +using ReClassNET.Core; +using ReClassNET.DataExchange.ReClass; +using ReClassNET.Extensions; +using ReClassNET.Logger; +using ReClassNET.Native; +using ReClassNET.Nodes; +using ReClassNET.UI; + +namespace ReClassNET.Plugins +{ + internal sealed class PluginManager + { + private readonly List plugins = new List(); + + private readonly IPluginHost host; + + public IEnumerable Plugins => plugins; + + public PluginManager(IPluginHost host) + { + Contract.Requires(host != null); + + this.host = host; + } + + public void LoadAllPlugins(string path, ILogger logger) + { + Contract.Requires(path != null); + Contract.Requires(logger != null); + + try + { + if (!Directory.Exists(path)) + { + return; + } + + var directory = new DirectoryInfo(path); + + LoadPlugins(directory.GetFiles("*.dll", SearchOption.AllDirectories), logger, true); + + LoadPlugins(directory.GetFiles("*.exe", SearchOption.AllDirectories), logger, true); + + LoadPlugins(directory.GetFiles("*.so", SearchOption.AllDirectories), logger, false); + } + catch (Exception ex) + { + logger.Log(ex); + } + } + + private void LoadPlugins(IEnumerable files, ILogger logger, bool checkProductName) + { + // TODO: How to include plugin infos for unix files as they don't have embedded version info. + + Contract.Requires(files != null); + Contract.Requires(logger != null); + + foreach (var fi in files) + { + FileVersionInfo fvi; + try + { + fvi = FileVersionInfo.GetVersionInfo(fi.FullName); + + if (checkProductName && fvi.ProductName != PluginInfo.PluginName && fvi.ProductName != PluginInfo.PluginNativeName) + { + continue; + } + } + catch + { + continue; + } + + try + { + var pi = new PluginInfo(fi.FullName, fvi); + if (!pi.IsNative) + { + pi.Interface = CreatePluginInstance(pi.FilePath); + + if (!pi.Interface.Initialize(host)) + { + continue; + } + + RegisterNodeInfoReaders(pi); + RegisterCustomNodeTypes(pi); + } + else + { + pi.NativeHandle = CreateNativePluginInstance(pi.FilePath); + + Program.CoreFunctions.RegisterFunctions( + pi.Name, + new NativeCoreWrapper(pi.NativeHandle) + ); + } + + plugins.Add(pi); + } + catch (Exception ex) + { + logger.Log(ex); + } + } + } + + public void UnloadAllPlugins() + { + foreach (var pi in plugins) + { + if (pi.Interface != null) // Exclude native plugins + { + DeregisterNodeInfoReaders(pi); + DeregisterCustomNodeTypes(pi); + } + + pi.Dispose(); + } + + plugins.Clear(); + } + + private static Plugin CreatePluginInstance(string filePath) + { + Contract.Requires(filePath != null); + + var type = Path.GetFileNameWithoutExtension(filePath); + type = type + "." + type + "Ext"; + + var handle = Activator.CreateInstanceFrom(filePath, type); + + if (!(handle.Unwrap() is Plugin plugin)) + { + throw new FileLoadException(); + } + return plugin; + } + + private static IntPtr CreateNativePluginInstance(string filePath) + { + Contract.Requires(filePath != null); + + var handle = NativeMethods.LoadLibrary(filePath); + if (handle.IsNull()) + { + throw new FileLoadException($"Failed to load native plugin: {Path.GetFileName(filePath)}"); + } + return handle; + } + + private static void RegisterNodeInfoReaders(PluginInfo pluginInfo) + { + Contract.Requires(pluginInfo != null); + + var nodeInfoReaders = pluginInfo.Interface.GetNodeInfoReaders(); + + if (nodeInfoReaders == null || nodeInfoReaders.Count == 0) + { + return; + } + + pluginInfo.NodeInfoReaders = nodeInfoReaders; + + BaseNode.NodeInfoReader.AddRange(nodeInfoReaders); + } + + private static void DeregisterNodeInfoReaders(PluginInfo pluginInfo) + { + Contract.Requires(pluginInfo != null); + + if (pluginInfo.NodeInfoReaders == null) + { + return; + } + + foreach (var reader in pluginInfo.NodeInfoReaders) + { + BaseNode.NodeInfoReader.Remove(reader); + } + } + + private static void RegisterCustomNodeTypes(PluginInfo pluginInfo) + { + Contract.Requires(pluginInfo != null); + + var customNodeTypes = pluginInfo.Interface.GetCustomNodeTypes(); + + if (customNodeTypes == null) + { + return; + } + + if (customNodeTypes.NodeTypes == null || customNodeTypes.Serializer == null || customNodeTypes.CodeGenerator == null) + { + throw new ArgumentException(); // TODO + } + + foreach (var nodeType in customNodeTypes.NodeTypes) + { + if (!nodeType.IsSubclassOf(typeof(BaseNode))) + { + throw new ArgumentException($"Type '{nodeType}' is not a valid node."); + } + } + + pluginInfo.CustomNodeTypes = customNodeTypes; + + NodeTypesBuilder.AddPluginNodeGroup(pluginInfo.Interface, customNodeTypes.NodeTypes); + + CustomNodeSerializer.Add(customNodeTypes.Serializer); + CppCodeGenerator.Add(customNodeTypes.CodeGenerator); + } + + private static void DeregisterCustomNodeTypes(PluginInfo pluginInfo) + { + Contract.Requires(pluginInfo != null); + + if (pluginInfo.CustomNodeTypes == null) + { + return; + } + + NodeTypesBuilder.RemovePluginNodeGroup(pluginInfo.Interface); + + CustomNodeSerializer.Remove(pluginInfo.CustomNodeTypes.Serializer); + CppCodeGenerator.Remove(pluginInfo.CustomNodeTypes.CodeGenerator); + } + } +} diff --git a/ReClass.NET/Program.cs b/ReClass.NET/Program.cs new file mode 100644 index 00000000..f28cb0bd --- /dev/null +++ b/ReClass.NET/Program.cs @@ -0,0 +1,117 @@ +using System; +using System.Diagnostics; +using System.Drawing; +using System.Globalization; +using System.Windows.Forms; +using Microsoft.SqlServer.MessageBox; +using ReClassNET.Core; +using ReClassNET.Forms; +using ReClassNET.Logger; +using ReClassNET.Memory; +using ReClassNET.Native; +using ReClassNET.UI; +using ReClassNET.Util; + +namespace ReClassNET +{ + public static class Program + { + public static CommandLineArgs CommandLineArgs { get; private set; } + + public static Settings Settings { get; private set; } + + public static ILogger Logger { get; private set; } + + public static Random GlobalRandom { get; } = new Random(); + + public static RemoteProcess RemoteProcess { get; private set; } + + public static CoreFunctionsManager CoreFunctions => RemoteProcess.CoreFunctions; + + public static MainForm MainForm { get; private set; } + + public static bool DesignMode { get; private set; } = true; + + public static FontEx MonoSpaceFont { get; private set; } + + [STAThread] + static void Main(string[] args) + { + DesignMode = false; // The designer doesn't call Main() + + CommandLineArgs = new CommandLineArgs(args); + + try + { + DpiUtil.ConfigureProcess(); + DpiUtil.TrySetDpiFromCurrentDesktop(); + } + catch + { + // ignored + } + + MonoSpaceFont = new FontEx + { + Font = new Font("Courier New", DpiUtil.ScaleIntX(13), GraphicsUnit.Pixel), + Width = DpiUtil.ScaleIntX(8), + Height = DpiUtil.ScaleIntY(16) + }; + + NativeMethods.EnableDebugPrivileges(); + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + + CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; + + Settings = SettingsSerializer.Load(); + Logger = new GuiLogger(); + + if (!NativeMethods.IsUnix() && Settings.RunAsAdmin && !WinUtil.IsAdministrator) + { + WinUtil.RunElevated(Process.GetCurrentProcess().MainModule?.FileName, args.Length > 0 ? string.Join(" ", args) : null); + return; + } + +#if !DEBUG + try + { +#endif + using (var coreFunctions = new CoreFunctionsManager()) + { + RemoteProcess = new RemoteProcess(coreFunctions); + + MainForm = new MainForm(); + + Application.Run(MainForm); + + RemoteProcess.Dispose(); + } +#if !DEBUG + } + catch (Exception ex) + { + ShowException(ex); + } +#endif + + SettingsSerializer.Save(Settings); + } + + /// Shows the exception in a special form. + /// The exception. + public static void ShowException(Exception ex) + { + ex.HelpLink = Constants.HelpUrl; + + var msg = new ExceptionMessageBox(ex) + { + Beep = false, + ShowToolBar = true, + Symbol = ExceptionMessageBoxSymbol.Error + }; + msg.Show(null); + } + } +} diff --git a/ReClass.NET/Project/CppTypeMapping.cs b/ReClass.NET/Project/CppTypeMapping.cs new file mode 100644 index 00000000..03e1bc48 --- /dev/null +++ b/ReClass.NET/Project/CppTypeMapping.cs @@ -0,0 +1,96 @@ +using System.Xml.Linq; +using ReClassNET.Util; + +namespace ReClassNET.Project +{ + public class CppTypeMapping + { + public string TypeBool { get; set; } = "bool"; + + public string TypeInt8 { get; set; } = "int8_t"; + public string TypeInt16 { get; set; } = "int16_t"; + public string TypeInt32 { get; set; } = "int32_t"; + public string TypeInt64 { get; set; } = "int64_t"; + public string TypeNInt { get; set; } = "ptrdiff_t"; + + public string TypeUInt8 { get; set; } = "uint8_t"; + public string TypeUInt16 { get; set; } = "uint16_t"; + public string TypeUInt32 { get; set; } = "uint32_t"; + public string TypeUInt64 { get; set; } = "uint64_t"; + public string TypeNUInt { get; set; } = "size_t"; + + public string TypeFloat { get; set; } = "float"; + public string TypeDouble { get; set; } = "double"; + + public string TypeVector2 { get; set; } = "Vector2"; + public string TypeVector3 { get; set; } = "Vector3"; + public string TypeVector4 { get; set; } = "Vector4"; + + public string TypeMatrix3x3 { get; set; } = "Matrix3x3"; + public string TypeMatrix3x4 { get; set; } = "Matrix3x4"; + public string TypeMatrix4x4 { get; set; } = "Matrix4x4"; + + public string TypeUtf8Text { get; set; } = "char"; + public string TypeUtf16Text { get; set; } = "wchar_t"; // Should be char16_t, but this type isn't well supported at the moment. + public string TypeUtf32Text { get; set; } = "char32_t"; + + public string TypeFunctionPtr { get; set; } = "void*"; + + internal XElement Serialize(string name) + { + return new XElement( + name, + XElementSerializer.ToXml(nameof(TypeBool), TypeBool), + XElementSerializer.ToXml(nameof(TypeInt8), TypeInt8), + XElementSerializer.ToXml(nameof(TypeInt16), TypeInt16), + XElementSerializer.ToXml(nameof(TypeInt32), TypeInt32), + XElementSerializer.ToXml(nameof(TypeInt64), TypeInt64), + XElementSerializer.ToXml(nameof(TypeNInt), TypeNInt), + XElementSerializer.ToXml(nameof(TypeUInt8), TypeUInt8), + XElementSerializer.ToXml(nameof(TypeUInt16), TypeUInt16), + XElementSerializer.ToXml(nameof(TypeUInt32), TypeUInt32), + XElementSerializer.ToXml(nameof(TypeUInt64), TypeUInt64), + XElementSerializer.ToXml(nameof(TypeNUInt), TypeNUInt), + XElementSerializer.ToXml(nameof(TypeFloat), TypeFloat), + XElementSerializer.ToXml(nameof(TypeDouble), TypeDouble), + XElementSerializer.ToXml(nameof(TypeVector2), TypeVector2), + XElementSerializer.ToXml(nameof(TypeVector3), TypeVector3), + XElementSerializer.ToXml(nameof(TypeVector4), TypeVector4), + XElementSerializer.ToXml(nameof(TypeMatrix3x3), TypeMatrix3x3), + XElementSerializer.ToXml(nameof(TypeMatrix3x4), TypeMatrix3x4), + XElementSerializer.ToXml(nameof(TypeMatrix4x4), TypeMatrix4x4), + XElementSerializer.ToXml(nameof(TypeUtf8Text), TypeUtf8Text), + XElementSerializer.ToXml(nameof(TypeUtf16Text), TypeUtf16Text), + XElementSerializer.ToXml(nameof(TypeUtf32Text), TypeUtf32Text), + XElementSerializer.ToXml(nameof(TypeFunctionPtr), TypeFunctionPtr) + ); + } + + internal void Deserialize(XElement element) + { + XElementSerializer.TryRead(element, nameof(TypeBool), e => TypeBool = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeInt8), e => TypeInt8 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeInt16), e => TypeInt16 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeInt32), e => TypeInt32 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeInt64), e => TypeInt64 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeNInt), e => TypeNInt = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeUInt8), e => TypeUInt8 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeUInt16), e => TypeUInt16 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeUInt32), e => TypeUInt32 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeUInt64), e => TypeUInt64 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeNUInt), e => TypeNUInt = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeFloat), e => TypeFloat = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeDouble), e => TypeDouble = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeVector2), e => TypeVector2 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeVector3), e => TypeVector3 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeVector4), e => TypeVector4 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeMatrix3x3), e => TypeMatrix3x3 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeMatrix3x4), e => TypeMatrix3x4 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeMatrix4x4), e => TypeMatrix4x4 = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeUtf8Text), e => TypeUtf8Text = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeUtf16Text), e => TypeUtf16Text = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeUtf32Text), e => TypeUtf32Text = XElementSerializer.ToString(e)); + XElementSerializer.TryRead(element, nameof(TypeFunctionPtr), e => TypeFunctionPtr = XElementSerializer.ToString(e)); + } + } +} diff --git a/ReClass.NET/Project/EnumDescription.cs b/ReClass.NET/Project/EnumDescription.cs new file mode 100644 index 00000000..6c72596b --- /dev/null +++ b/ReClass.NET/Project/EnumDescription.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace ReClassNET.Project +{ + public class EnumDescription + { + public enum UnderlyingTypeSize + { + OneByte = 1, + TwoBytes = 2, + FourBytes = 4, + EightBytes = 8 + } + + public static EnumDescription Default => new EnumDescription { Name = "DummyEnum" }; + + public string Name { get; set; } = string.Empty; + + public bool UseFlagsMode { get; private set; } + + public UnderlyingTypeSize Size { get; private set; } = UnderlyingTypeSize.FourBytes; + + public IReadOnlyList> Values { get; private set; } = new Dictionary().ToList(); + + public void SetData(bool useFlagsMode, UnderlyingTypeSize size, IEnumerable> values) + { + var temp = values.OrderBy(t => t.Value).ToList(); + + if (useFlagsMode) + { + var maxPossibleValue = ulong.MaxValue; + switch (size) + { + case UnderlyingTypeSize.OneByte: + maxPossibleValue = byte.MaxValue; + break; + case UnderlyingTypeSize.TwoBytes: + maxPossibleValue = ushort.MaxValue; + break; + case UnderlyingTypeSize.FourBytes: + maxPossibleValue = uint.MaxValue; + break; + } + + if (temp.Select(kv => (ulong)kv.Value).Max() > maxPossibleValue) + { + throw new ArgumentOutOfRangeException(); + } + } + else + { + var minPossibleValue = long.MinValue; + var maxPossibleValue = long.MaxValue; + switch (size) + { + case UnderlyingTypeSize.OneByte: + minPossibleValue = sbyte.MinValue; + maxPossibleValue = sbyte.MaxValue; + break; + case UnderlyingTypeSize.TwoBytes: + minPossibleValue = short.MinValue; + maxPossibleValue = short.MaxValue; + break; + case UnderlyingTypeSize.FourBytes: + minPossibleValue = int.MinValue; + maxPossibleValue = int.MaxValue; + break; + } + + if (temp.Max(kv => kv.Value) > maxPossibleValue || temp.Min(kv => kv.Value) < minPossibleValue) + { + throw new ArgumentOutOfRangeException(); + } + } + + UseFlagsMode = useFlagsMode; + Size = size; + Values = temp; + } + } +} diff --git a/ReClass.NET/Project/ReClassNetProject.cs b/ReClass.NET/Project/ReClassNetProject.cs new file mode 100644 index 00000000..90f4b5ca --- /dev/null +++ b/ReClass.NET/Project/ReClassNetProject.cs @@ -0,0 +1,215 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using ReClassNET.Nodes; +using ReClassNET.Util; + +namespace ReClassNET.Project +{ + public class ReClassNetProject : IDisposable + { + public delegate void ClassesChangedEvent(ClassNode sender); + public event ClassesChangedEvent ClassAdded; + public event ClassesChangedEvent ClassRemoved; + + public delegate void EnumsChangedEvent(EnumDescription sender); + public event EnumsChangedEvent EnumAdded; + public event EnumsChangedEvent EnumRemoved; + + private readonly List enums = new List(); + private readonly List classes = new List(); + + public IReadOnlyList Enums => enums; + + public IReadOnlyList Classes => classes; + + public string Path { get; set; } + + /// + /// Key-Value map with custom data for plugins to store project related data. + /// The preferred key format is {Plugin Name}_{Key Name}. + /// + public CustomDataMap CustomData { get; } = new CustomDataMap(); + + /// + /// List of data types to use while generating C++ code for nodes. + /// + public CppTypeMapping TypeMapping { get; } = new CppTypeMapping(); + + public void Dispose() + { + Clear(); + + ClassAdded = null; + ClassRemoved = null; + + EnumAdded = null; + EnumRemoved = null; + } + + public void AddClass(ClassNode node) + { + Contract.Requires(node != null); + + classes.Add(node); + + node.NodesChanged += NodesChanged_Handler; + + ClassAdded?.Invoke(node); + } + + public bool ContainsClass(Guid uuid) + { + Contract.Requires(uuid != null); + + return classes.Any(c => c.Uuid.Equals(uuid)); + } + + public ClassNode GetClassByUuid(Guid uuid) + { + Contract.Requires(uuid != null); + + return classes.First(c => c.Uuid.Equals(uuid)); + } + + private void NodesChanged_Handler(BaseNode sender) + { + classes.ForEach(c => c.UpdateOffsets()); + } + + public void Clear() + { + var temp = classes.ToList(); + + classes.Clear(); + + foreach (var node in temp) + { + node.NodesChanged -= NodesChanged_Handler; + + ClassRemoved?.Invoke(node); + } + + var temp2 = enums.ToList(); + + enums.Clear(); + + foreach (var @enum in temp2) + { + EnumRemoved?.Invoke(@enum); + } + } + + private IEnumerable GetClassReferences(ClassNode node) + { + Contract.Requires(node != null); + + return classes + .Where(c => c != node) + .Where(c => c.Nodes.OfType().Any(w => w.ResolveMostInnerNode() == node)); + } + + public void Remove(ClassNode node) + { + Contract.Requires(node != null); + + var references = GetClassReferences(node).ToList(); + if (references.Any()) + { + throw new ClassReferencedException(node, references); + } + + if (classes.Remove(node)) + { + node.NodesChanged -= NodesChanged_Handler; + + ClassRemoved?.Invoke(node); + } + } + + public void RemoveUnusedClasses() + { + var toRemove = classes + .Except(classes.Where(x => GetClassReferences(x).Any())) // check for references + .Where(c => c.Nodes.All(n => n is BaseHexNode)) // check if only hex nodes are present + .ToList(); + foreach (var node in toRemove) + { + if (classes.Remove(node)) + { + ClassRemoved?.Invoke(node); + } + } + } + + public void AddEnum(EnumDescription @enum) + { + Contract.Requires(@enum != null); + + enums.Add(@enum); + + EnumAdded?.Invoke(@enum); + } + + public void RemoveEnum(EnumDescription @enum) + { + Contract.Requires(@enum != null); + + var refrences = GetEnumReferences(@enum).ToList(); + if (refrences.Any()) + { + throw new EnumReferencedException(@enum, refrences.Select(e => e.GetParentClass()).Distinct()); + } + + if (enums.Remove(@enum)) + { + EnumRemoved?.Invoke(@enum); + } + } + + private IEnumerable GetEnumReferences(EnumDescription @enum) + { + Contract.Requires(@enum != null); + + return classes + .SelectMany(c => c.Nodes.Where(n => n is EnumNode || (n as BaseWrapperNode)?.ResolveMostInnerNode() is EnumNode)) + .Cast() + .Where(e => e.Enum == @enum); + } + } + + public class ClassReferencedException : Exception + { + public ClassNode ClassNode { get; } + public IEnumerable References { get; } + + public ClassReferencedException(ClassNode node, IEnumerable references) + : base($"The class '{node.Name}' is referenced in other classes.") + { + Contract.Requires(node != null); + Contract.Requires(references != null); + Contract.Requires(Contract.ForAll(references, c => c != null)); + + ClassNode = node; + References = references; + } + } + + public class EnumReferencedException : Exception + { + public EnumDescription Enum { get; } + public IEnumerable References { get; } + + public EnumReferencedException(EnumDescription @enum, IEnumerable references) + : base($"The enum '{@enum.Name}' is referenced in other classes.") + { + Contract.Requires(@enum != null); + Contract.Requires(references != null); + Contract.Requires(Contract.ForAll(references, c => c != null)); + + Enum = @enum; + References = references; + } + } +} diff --git a/Properties/AssemblyInfo.cs b/ReClass.NET/Properties/AssemblyInfo.cs similarity index 89% rename from Properties/AssemblyInfo.cs rename to ReClass.NET/Properties/AssemblyInfo.cs index 7d8125ba..77d83991 100644 --- a/Properties/AssemblyInfo.cs +++ b/ReClass.NET/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden @@ -10,7 +9,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Reclass.NET")] -[assembly: AssemblyCopyright("")] +[assembly: AssemblyCopyright("KN4CK3R")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +31,5 @@ // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")] diff --git a/Properties/Resources.Designer.cs b/ReClass.NET/Properties/Resources.Designer.cs similarity index 67% rename from Properties/Resources.Designer.cs rename to ReClass.NET/Properties/Resources.Designer.cs index 26d51f36..3d412074 100644 --- a/Properties/Resources.Designer.cs +++ b/ReClass.NET/Properties/Resources.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,13 +13,13 @@ namespace ReClassNET.Properties { /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// A strongly-typed resource class, for looking up localized strings, etc. /// - // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -33,7 +33,7 @@ internal Resources() { } /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ internal Resources() { } /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ internal Resources() { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Accept { get { @@ -71,7 +71,7 @@ internal static System.Drawing.Bitmap B16x16_Accept { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Array_Type { get { @@ -81,7 +81,7 @@ internal static System.Drawing.Bitmap B16x16_Array_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Arrow_Refresh { get { @@ -91,7 +91,17 @@ internal static System.Drawing.Bitmap B16x16_Arrow_Refresh { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Button_Add { + get { + object obj = ResourceManager.GetObject("B16x16_Button_Add", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_1024 { get { @@ -101,7 +111,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_1024 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_2048 { get { @@ -111,7 +121,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_2048 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_256 { get { @@ -121,7 +131,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_256 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_4 { get { @@ -131,7 +141,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_4 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_4096 { get { @@ -141,7 +151,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_4096 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_64 { get { @@ -151,7 +161,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_64 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_8 { get { @@ -161,7 +171,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_8 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_X { get { @@ -171,7 +181,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Add_Bytes_X { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Array { get { @@ -181,7 +191,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Array { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Bits { get { @@ -191,7 +201,17 @@ internal static System.Drawing.Bitmap B16x16_Button_Bits { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Button_Bool { + get { + object obj = ResourceManager.GetObject("B16x16_Button_Bool", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Class_Add { get { @@ -201,7 +221,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Class_Add { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Class_Instance { get { @@ -211,7 +231,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Class_Instance { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Class_Pointer { get { @@ -221,7 +241,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Class_Pointer { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Class_Remove { get { @@ -231,7 +251,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Class_Remove { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Delete { get { @@ -241,7 +261,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Delete { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Double { get { @@ -251,7 +271,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Double { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Drop_Down { get { @@ -261,7 +281,17 @@ internal static System.Drawing.Bitmap B16x16_Button_Drop_Down { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Button_Enum { + get { + object obj = ResourceManager.GetObject("B16x16_Button_Enum", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Float { get { @@ -271,7 +301,17 @@ internal static System.Drawing.Bitmap B16x16_Button_Float { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Button_Function { + get { + object obj = ResourceManager.GetObject("B16x16_Button_Function", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Function_Pointer { get { @@ -281,7 +321,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Function_Pointer { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Hex_16 { get { @@ -291,7 +331,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Hex_16 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Hex_32 { get { @@ -301,7 +341,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Hex_32 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Hex_64 { get { @@ -311,7 +351,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Hex_64 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Hex_8 { get { @@ -321,7 +361,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Hex_8 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_1024 { get { @@ -331,7 +371,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_1024 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_2048 { get { @@ -341,7 +381,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_2048 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_256 { get { @@ -351,7 +391,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_256 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_4 { get { @@ -361,7 +401,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_4 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_4096 { get { @@ -371,7 +411,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_4096 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_64 { get { @@ -381,7 +421,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_64 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_8 { get { @@ -391,7 +431,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_8 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_X { get { @@ -401,7 +441,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Insert_Bytes_X { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Int_16 { get { @@ -411,7 +451,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Int_16 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Int_32 { get { @@ -421,7 +461,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Int_32 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Int_64 { get { @@ -431,7 +471,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Int_64 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Int_8 { get { @@ -441,7 +481,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Int_8 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Matrix_3x3 { get { @@ -451,7 +491,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Matrix_3x3 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Matrix_3x4 { get { @@ -461,7 +501,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Matrix_3x4 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Matrix_4x4 { get { @@ -471,7 +511,37 @@ internal static System.Drawing.Bitmap B16x16_Button_Matrix_4x4 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Button_NInt { + get { + object obj = ResourceManager.GetObject("B16x16_Button_NInt", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Button_NUInt { + get { + object obj = ResourceManager.GetObject("B16x16_Button_NUInt", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Button_Pointer { + get { + object obj = ResourceManager.GetObject("B16x16_Button_Pointer", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Pointer_Array { get { @@ -481,7 +551,17 @@ internal static System.Drawing.Bitmap B16x16_Button_Pointer_Array { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Button_Remove { + get { + object obj = ResourceManager.GetObject("B16x16_Button_Remove", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Text { get { @@ -491,7 +571,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Text { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Text_Pointer { get { @@ -501,7 +581,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Text_Pointer { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_UInt_16 { get { @@ -511,7 +591,7 @@ internal static System.Drawing.Bitmap B16x16_Button_UInt_16 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_UInt_32 { get { @@ -521,7 +601,7 @@ internal static System.Drawing.Bitmap B16x16_Button_UInt_32 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_UInt_64 { get { @@ -531,7 +611,7 @@ internal static System.Drawing.Bitmap B16x16_Button_UInt_64 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_UInt_8 { get { @@ -541,7 +621,17 @@ internal static System.Drawing.Bitmap B16x16_Button_UInt_8 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Button_Union { + get { + object obj = ResourceManager.GetObject("B16x16_Button_Union", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_UText { get { @@ -551,7 +641,7 @@ internal static System.Drawing.Bitmap B16x16_Button_UText { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_UText_Pointer { get { @@ -561,7 +651,7 @@ internal static System.Drawing.Bitmap B16x16_Button_UText_Pointer { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Vector_2 { get { @@ -571,7 +661,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Vector_2 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Vector_3 { get { @@ -581,7 +671,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Vector_3 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_Vector_4 { get { @@ -591,7 +681,7 @@ internal static System.Drawing.Bitmap B16x16_Button_Vector_4 { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Button_VTable { get { @@ -601,7 +691,7 @@ internal static System.Drawing.Bitmap B16x16_Button_VTable { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Camera { get { @@ -611,7 +701,27 @@ internal static System.Drawing.Bitmap B16x16_Camera { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Canvas_Size { + get { + object obj = ResourceManager.GetObject("B16x16_Canvas_Size", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Category { + get { + object obj = ResourceManager.GetObject("B16x16_Category", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Chart_Delete { get { @@ -621,7 +731,7 @@ internal static System.Drawing.Bitmap B16x16_Chart_Delete { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Class_Type { get { @@ -631,7 +741,7 @@ internal static System.Drawing.Bitmap B16x16_Class_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Closed_Icon { get { @@ -641,7 +751,7 @@ internal static System.Drawing.Bitmap B16x16_Closed_Icon { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Cogs { get { @@ -651,7 +761,7 @@ internal static System.Drawing.Bitmap B16x16_Cogs { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Color_Wheel { get { @@ -661,7 +771,7 @@ internal static System.Drawing.Bitmap B16x16_Color_Wheel { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Control_Pause { get { @@ -671,7 +781,7 @@ internal static System.Drawing.Bitmap B16x16_Control_Pause { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Control_Play { get { @@ -681,7 +791,7 @@ internal static System.Drawing.Bitmap B16x16_Control_Play { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Control_Stop { get { @@ -691,7 +801,7 @@ internal static System.Drawing.Bitmap B16x16_Control_Stop { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Custom_Type { get { @@ -701,7 +811,7 @@ internal static System.Drawing.Bitmap B16x16_Custom_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Double_Type { get { @@ -711,7 +821,17 @@ internal static System.Drawing.Bitmap B16x16_Double_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Drive_Go { + get { + object obj = ResourceManager.GetObject("B16x16_Drive_Go", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Enum_Type { get { @@ -721,7 +841,7 @@ internal static System.Drawing.Bitmap B16x16_Enum_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Error { get { @@ -731,7 +851,7 @@ internal static System.Drawing.Bitmap B16x16_Error { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Exchange_Button { get { @@ -741,7 +861,37 @@ internal static System.Drawing.Bitmap B16x16_Exchange_Button { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Eye { + get { + object obj = ResourceManager.GetObject("B16x16_Eye", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Find_Access { + get { + object obj = ResourceManager.GetObject("B16x16_Find_Access", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Find_Write { + get { + object obj = ResourceManager.GetObject("B16x16_Find_Write", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Float_Type { get { @@ -751,7 +901,7 @@ internal static System.Drawing.Bitmap B16x16_Float_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Folder { get { @@ -761,7 +911,7 @@ internal static System.Drawing.Bitmap B16x16_Folder { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Folder_Add { get { @@ -771,7 +921,7 @@ internal static System.Drawing.Bitmap B16x16_Folder_Add { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Function_Type { get { @@ -781,7 +931,7 @@ internal static System.Drawing.Bitmap B16x16_Function_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Gear { get { @@ -791,7 +941,7 @@ internal static System.Drawing.Bitmap B16x16_Gear { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Help { get { @@ -801,7 +951,7 @@ internal static System.Drawing.Bitmap B16x16_Help { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Information { get { @@ -811,7 +961,7 @@ internal static System.Drawing.Bitmap B16x16_Information { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Interface_Type { get { @@ -821,7 +971,7 @@ internal static System.Drawing.Bitmap B16x16_Interface_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Left_Button { get { @@ -831,7 +981,7 @@ internal static System.Drawing.Bitmap B16x16_Left_Button { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Magnifier { get { @@ -841,7 +991,27 @@ internal static System.Drawing.Bitmap B16x16_Magnifier { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Magnifier_Arrow { + get { + object obj = ResourceManager.GetObject("B16x16_Magnifier_Arrow", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Magnifier_Remove { + get { + object obj = ResourceManager.GetObject("B16x16_Magnifier_Remove", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Matrix_Type { get { @@ -851,7 +1021,7 @@ internal static System.Drawing.Bitmap B16x16_Matrix_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Open_Icon { get { @@ -861,7 +1031,7 @@ internal static System.Drawing.Bitmap B16x16_Open_Icon { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Page_Code { get { @@ -871,7 +1041,7 @@ internal static System.Drawing.Bitmap B16x16_Page_Code { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Page_Code_Add { get { @@ -881,7 +1051,7 @@ internal static System.Drawing.Bitmap B16x16_Page_Code_Add { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Page_Code_Cpp { get { @@ -891,7 +1061,7 @@ internal static System.Drawing.Bitmap B16x16_Page_Code_Cpp { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Page_Code_Csharp { get { @@ -901,7 +1071,7 @@ internal static System.Drawing.Bitmap B16x16_Page_Code_Csharp { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Page_Copy { get { @@ -911,7 +1081,7 @@ internal static System.Drawing.Bitmap B16x16_Page_Copy { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Page_Paste { get { @@ -921,7 +1091,17 @@ internal static System.Drawing.Bitmap B16x16_Page_Paste { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Page_White_Stack { + get { + object obj = ResourceManager.GetObject("B16x16_Page_White_Stack", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Pdb { get { @@ -931,7 +1111,7 @@ internal static System.Drawing.Bitmap B16x16_Pdb { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Plugin { get { @@ -941,7 +1121,7 @@ internal static System.Drawing.Bitmap B16x16_Plugin { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Pointer_Type { get { @@ -951,7 +1131,7 @@ internal static System.Drawing.Bitmap B16x16_Pointer_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Quit { get { @@ -961,7 +1141,17 @@ internal static System.Drawing.Bitmap B16x16_Quit { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Redo { + get { + object obj = ResourceManager.GetObject("B16x16_Redo", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Right_Button { get { @@ -971,7 +1161,7 @@ internal static System.Drawing.Bitmap B16x16_Right_Button { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Save { get { @@ -981,7 +1171,7 @@ internal static System.Drawing.Bitmap B16x16_Save { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Save_As { get { @@ -991,7 +1181,7 @@ internal static System.Drawing.Bitmap B16x16_Save_As { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Settings_Edit { get { @@ -1001,7 +1191,7 @@ internal static System.Drawing.Bitmap B16x16_Settings_Edit { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Signed_Type { get { @@ -1011,7 +1201,7 @@ internal static System.Drawing.Bitmap B16x16_Signed_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Table_Gear { get { @@ -1021,7 +1211,7 @@ internal static System.Drawing.Bitmap B16x16_Table_Gear { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Text_List_Bullets { get { @@ -1031,7 +1221,7 @@ internal static System.Drawing.Bitmap B16x16_Text_List_Bullets { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Text_Type { get { @@ -1041,7 +1231,7 @@ internal static System.Drawing.Bitmap B16x16_Text_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Textfield_Rename { get { @@ -1051,7 +1241,7 @@ internal static System.Drawing.Bitmap B16x16_Textfield_Rename { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Tree_Collapse { get { @@ -1061,7 +1251,7 @@ internal static System.Drawing.Bitmap B16x16_Tree_Collapse { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Tree_Expand { get { @@ -1071,7 +1261,17 @@ internal static System.Drawing.Bitmap B16x16_Tree_Expand { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B16x16_Undo { + get { + object obj = ResourceManager.GetObject("B16x16_Undo", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Unsigned_Type { get { @@ -1081,7 +1281,7 @@ internal static System.Drawing.Bitmap B16x16_Unsigned_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Vector_Type { get { @@ -1091,7 +1291,7 @@ internal static System.Drawing.Bitmap B16x16_Vector_Type { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B16x16_Warning { get { @@ -1101,7 +1301,27 @@ internal static System.Drawing.Bitmap B16x16_Warning { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B32x32_3D_Glasses { + get { + object obj = ResourceManager.GetObject("B32x32_3D_Glasses", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B32x32_Canvas_Size { + get { + object obj = ResourceManager.GetObject("B32x32_Canvas_Size", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B32x32_Cogs { get { @@ -1111,7 +1331,17 @@ internal static System.Drawing.Bitmap B32x32_Cogs { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap B32x32_Eye { + get { + object obj = ResourceManager.GetObject("B32x32_Eye", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B32x32_Magnifier { get { @@ -1121,7 +1351,7 @@ internal static System.Drawing.Bitmap B32x32_Magnifier { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B32x32_Page_Code { get { @@ -1131,7 +1361,7 @@ internal static System.Drawing.Bitmap B32x32_Page_Code { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap B32x32_Plugin { get { @@ -1141,8 +1371,8 @@ internal static System.Drawing.Bitmap B32x32_Plugin { } /// - /// Sucht eine lokalisierte Zeichenfolge, die 2016/11/16 13:16:24 - /// ähnelt. + /// Looks up a localized string similar to 2020/10/17 09:45:04 + ///. /// internal static string BuildDate { get { @@ -1151,7 +1381,7 @@ internal static string BuildDate { } /// - /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Icon ähnlich wie (Symbol). + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// internal static System.Drawing.Icon ReClassNet { get { diff --git a/Properties/Resources.resx b/ReClass.NET/Properties/Resources.resx similarity index 85% rename from Properties/Resources.resx rename to ReClass.NET/Properties/Resources.resx index cd9d3805..48c2c826 100644 --- a/Properties/Resources.resx +++ b/ReClass.NET/Properties/Resources.resx @@ -184,14 +184,17 @@ ..\Resources\Images\B16x16_Button_Matrix_3x4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Folder_Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Images\B16x16_Button_Text.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\Images\B16x16_Button_Int_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Images\B16x16_Button_Float.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Button_UText_Pointer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\Images\B16x16_Button_Insert_Bytes_256.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -205,18 +208,12 @@ ..\Resources\Images\B16x16_Pointer_Type.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Images\B16x16_Button_Add_Bytes_4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\Images\B16x16_Double_Type.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\Images\B16x16_Button_Add_Bytes_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\BuildDate.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16 - ..\Resources\Images\B16x16_Array_Type.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -262,12 +259,18 @@ ..\Resources\Images\B32x32_Page_Code.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Button_Delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Images\B16x16_Pdb.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\Images\B16x16_Button_Insert_Bytes_2048.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Page_Copy.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Images\B16x16_Button_Class_Remove.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -283,9 +286,6 @@ ..\Resources\Images\B16x16_Information.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Images\B16x16_Button_Drop_Down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\Images\B16x16_Warning.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -304,18 +304,24 @@ ..\Resources\Images\B16x16_Button_Insert_Bytes_4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Button_Bool.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Images\B16x16_Control_Stop.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\Images\B16x16_Class_Type.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Images\B16x16_Left_Button.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B32x32_Cogs.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\Images\B16x16_Float_Type.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Drive_Go.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Images\B16x16_Button_Add_Bytes_2048.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -328,6 +334,12 @@ ..\Resources\Images\B16x16_Textfield_Rename.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Magnifier_Remove.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Unsigned_Type.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Images\B16x16_Button_Add_Bytes_X.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -358,11 +370,14 @@ ..\Resources\Images\B16x16_Open_Icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Left_Button.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Icon\ReClassNet.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Images\B16x16_Button_UText_Pointer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\BuildDate.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16 ..\Resources\Images\B16x16_Button_Add_Bytes_8.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -385,14 +400,14 @@ ..\Resources\Images\B16x16_Color_Wheel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Images\B16x16_Unsigned_Type.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Category.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\Images\B16x16_Button_Insert_Bytes_8.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Images\B16x16_Magnifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Page_White_Stack.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\Images\B16x16_Button_Insert_Bytes_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -406,14 +421,17 @@ ..\Resources\Images\B16x16_Help.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Button_Function.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Images\B16x16_Vector_Type.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\Images\B16x16_Control_Pause.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Images\B16x16_Page_Copy.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Magnifier.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\Images\B16x16_Exchange_Button.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -421,8 +439,8 @@ ..\Resources\Images\B16x16_Cogs.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Images\B32x32_Cogs.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Button_Drop_Down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\Images\B16x16_Button_UInt_8.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -433,6 +451,9 @@ ..\Resources\Images\B16x16_Button_Int_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Button_Float.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\Images\B16x16_Function_Type.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -442,10 +463,58 @@ ..\Resources\Images\B16x16_Matrix_Type.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Images\B16x16_Button_Delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Button_Add_Bytes_4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Images\B16x16_Folder_Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Images\B16x16_Find_Access.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Find_Write.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Eye.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Magnifier_Arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B32x32_3D_Glasses.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B32x32_Eye.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B32x32_Canvas_Size.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Canvas_Size.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Redo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Undo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Button_Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Button_Remove.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Button_Pointer.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Button_Enum.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Button_Union.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Button_NInt.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Images\B16x16_Button_NUInt.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/ReClass.NET/Properties/Settings.Designer.cs similarity index 77% rename from Properties/Settings.Designer.cs rename to ReClass.NET/Properties/Settings.Designer.cs index 8d3e4a41..cfa4e29c 100644 --- a/Properties/Settings.Designer.cs +++ b/ReClass.NET/Properties/Settings.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -12,7 +12,7 @@ namespace ReClassNET.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/Properties/Settings.settings b/ReClass.NET/Properties/Settings.settings similarity index 100% rename from Properties/Settings.settings rename to ReClass.NET/Properties/Settings.settings diff --git a/ReClass.NET.csproj b/ReClass.NET/ReClass.NET.csproj similarity index 58% rename from ReClass.NET.csproj rename to ReClass.NET/ReClass.NET.csproj index 71085a64..0c990cc2 100644 --- a/ReClass.NET.csproj +++ b/ReClass.NET/ReClass.NET.csproj @@ -9,20 +9,23 @@ Properties ReClassNET ReClass.NET - v4.6.1 + v4.7.2 512 true 0 + + latest x86 true full false - bin\Debug\ - TRACE;DEBUG;WIN32 + $(SolutionDir)bin\Debug\x86\ + $(SolutionDir)obj\$(Configuration)\x86\$(MSBuildProjectName)\ + TRACE;DEBUG prompt 4 false @@ -68,14 +71,15 @@ True Full %28none%29 - 0 + 3 x86 pdbonly true - bin\Release\ - TRACE;WIN32;RELEASE + $(SolutionDir)bin\Release\x86\ + $(SolutionDir)obj\$(Configuration)\x86\$(MSBuildProjectName)\ + TRACE;RELEASE prompt 4 @@ -84,8 +88,9 @@ true full false - bin\Debug\x64\ - TRACE;DEBUG;WIN64 + $(SolutionDir)bin\Debug\x64\ + $(SolutionDir)obj\$(Configuration)\x64\$(MSBuildProjectName)\ + TRACE;DEBUG;RECLASSNET64 prompt 4 false @@ -94,70 +99,206 @@ x64 pdbonly true - bin\Release\x64\ - TRACE;WIN64;RELEASE + $(SolutionDir)bin\Release\x64\ + $(SolutionDir)obj\$(Configuration)\x64\$(MSBuildProjectName)\ + TRACE;RECLASSNET64;RELEASE prompt 4 Resources\Icon\ReClassNet.ico + False - Dependencies\ColorCode.dll + ..\Dependencies\ColorCode.dll - Dependencies\Dia2Lib.dll + ..\Dependencies\Dia2Lib.dll True False - Dependencies\Microsoft.ExceptionMessageBox.dll + ..\Dependencies\Microsoft.ExceptionMessageBox.dll - - packages\System.Data.SQLite.Core.1.0.103\lib\net46\System.Data.SQLite.dll - True - - - - + + - + + + - - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Form + + + EnumEditorForm.cs + + + Form + + + EnumListForm.cs + + + Form + + + EnumSelectionForm.cs + + + Form + + + Form + + + NamedAddressesForm.cs + + + Form + + + ClassSelectionForm.cs + + + Form + + + FoundCodeForm.cs + Form InputBytesForm.cs + + + Form + + + InputCorrelatorForm.cs + + + Form + + + ScannerForm.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + Component @@ -169,10 +310,9 @@ - - - - + + + Form @@ -180,13 +320,16 @@ AboutForm.cs + + + - + UserControl - - ClassNodeView.cs + + ProjectView.cs Form @@ -194,13 +337,13 @@ CodeForm.cs - + UserControl - + ColorBox.cs - + Component @@ -212,11 +355,63 @@ LogForm.cs - - + + UserControl + + + DualValueBox.cs + + + Component + + + + UserControl + + + HotkeyBox.cs + + + Component + + + + + Component + + + UserControl + + + MemoryRecordList.cs + + MemoryViewControl.cs + + + Component + + + + + + + + + + + + + + + + + + + + Form @@ -231,46 +426,39 @@ SettingsForm.cs - - + Component - Form MainForm.cs - - - + + + - - + + UserControl - - - - + - - @@ -282,7 +470,6 @@ - @@ -307,14 +494,14 @@ ProcessBrowserForm.cs - + Form - - ProcessMemoryViewForm.cs + + ProcessInfoForm.cs - - + + @@ -324,35 +511,61 @@ - - UserControl - - - - Component - - - Component - - + + + + + + + + + + + + AboutForm.cs + + EnumEditorForm.cs + + + EnumListForm.cs + + + EnumSelectionForm.cs + + + NamedAddressesForm.cs + + + ClassSelectionForm.cs + Designer + CodeForm.cs + + FoundCodeForm.cs + InputBytesForm.cs - - ClassNodeView.cs + + InputCorrelatorForm.cs + + + ScannerForm.cs + + + ProjectView.cs Designer @@ -362,10 +575,19 @@ MainForm.cs Designer - + ColorBox.cs - + + DualValueBox.cs + + + HotkeyBox.cs + + + MemoryRecordList.cs + + MemoryViewControl.cs @@ -374,8 +596,8 @@ ProcessBrowserForm.cs - - ProcessMemoryViewForm.cs + + ProcessInfoForm.cs SettingsForm.cs @@ -385,7 +607,7 @@ Designer Resources.Designer.cs - + SettingsSingleFileGenerator Settings.Designer.cs @@ -729,16 +951,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - Missing file: "{0}". - - - - powershell -Command "((Get-Date).ToUniversalTime()).ToString(\"yyyy\/MM\/dd HH:mm:ss\") | Out-File '$(ProjectDir)Resources\BuildDate.txt'" + powershell -Command "((Get-Date).ToUniversalTime()).ToString(\"yyyy\/MM\/dd HH:mm:ss\") | Out-File '$(ProjectDir)Resources\BuildDate.txt'" + date +"%Y/%m/%d %H:%M:%S" > $(ProjectDir)/Resources/BuildDate.txt