Smali syntax to understand Android hack software

Source: Internet
Author: User

syntax in Smali:

Type

v void can only be used for return value types

Z Boolean

B byte

S Short

C Char

I int

J Long 2 registers

F float

D Double 2 registers

Object Type :lpackage/name/objectname; equivalent to package.name.ObjectName in Java ; The explanations are as follows:

L: Indicates that this is an object type

Package/name: the package in which the object resides

;: Indicates the end of the object name

representation of the array :

[I: represents a shaped one-dimensional array, equivalent to Java 's int[];

For multidimensional arrays, just increase [ on the line,[I = int[][]; Note: maximum per dimension 255 one;

Representation of an array of objects:

[Ljava/lang/string represents an Array of objects of a String;

Method called Representation of:

Lpackage/name/objectname;-->methodname (III) Z is detailed below:

Lpackage/name/objectname Expression Type

MethodName represents the method name

III represents the parameter (represented here as 3 integer parameters)

Note: The parameters of the method are one after the other, the middle is not separated;

method (i [[i i ljava/lang/string;[ Ljava/lang/object;) ljava/lang/string;

Method(int,int[][],int,string,object[])

In Java, it is:
string method (int, int[][], int, String, object[])

representation of a field :

lpackage/name/objectname;-->fieldname:ljava/lang/string;

That means: Package name, field name, and field type

There are two ways to specify how many registers are available in a method:

the. Registers directive specifies the total number of registers in the method

The. Locals instruction shows the total number of non-parameter registers in the method, appearing in the first line of the method

Parameter of the method:

When a method is called, the parameter of the method is placed in the lastNregisters in a single device. If a method has2parameters,5a register (v0-v4), then the parameters are placed in the last2a register--v3and theV4.  The first parameter in a non-static method always calls the object of the method.
For example, a non-static methodLmyobject;->callme (II) Vhave a2integer parameter, plus an impliedLmyobject;parameters, so a total of3a parameter. In this method, if you specify the5a register (v0-v4), to. Registersmode designation5one or the. Localsmode designation2One (ie2aLocalRegister Device+3parameter register). When the method is called, the object of the method is called (that is, Thisreference) stored inv2, the first integer parameter is stored in thev3, the second integer parameter is stored in theV4the.

How registers are named:

V naming

P naming The first register is the first parameter register in a method

Comparison: The use of the P name is to prevent later if the register is added in the method, it is necessary to re-numbering the parameter register disadvantage

Special Note:Long and Double types are 2

For example, for non-static methods

Lmyobject-->mymethod (IJZ) V;

There are 4 parameters:lmyobject,int,long,bool; 5 registers are required to store the parameters;

P0 this

P1 I (int)

P2,P3 J (long)

P4 Z (BOOL)

Add:
@ Static fields define tags for static variables
@ Instance fields defines the markup for an instance variable
@ Direct Methods defines the markup for a static method
@virtual methods Defining a non-static method's markup
The return type of the constructor is V, and the name is <init>.



If-eq P1, V0,: Cond8 indicates that if p1 and v0 are equal, the process of Cond8 is performed:
: Cond8
Invoke-direct {p0}, lcom/paul/test/a;->d () V
Call the D () method of Com.paul.test.a
If-ne P1, V0,: Condb indicates that the process of condb is not equal :
: condb
Invoke-direct {p0}, lcom/paul/test/a;->c () V

Smali syntax to understand Android hack software

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.